@spinabot/brigade 0.1.2 → 1.0.1
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 +748 -88
- 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 +91 -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 +585 -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 -48
- 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
package/dist/core/agent.js
DELETED
|
@@ -1,1123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build a Brigade agent session — a thin wrapper over Pi's `createAgentSession`.
|
|
3
|
-
*
|
|
4
|
-
* What this gives the agent:
|
|
5
|
-
* - The 5 Pi built-in coding tools (read, bash, edit, write, grep)
|
|
6
|
-
* - A system prompt set on agent.state.systemPrompt (layered .md assembly comes in Primitive #2)
|
|
7
|
-
* - File-backed AuthStorage + ModelRegistry rooted at ~/.brigade
|
|
8
|
-
* - Pi's auto-resuming session manager (continueRecent on cwd)
|
|
9
|
-
* - Brigade's loop hooks wired in: beforeToolCall, afterToolCall, transformContext
|
|
10
|
-
* (each is a no-op by default; callers pass overrides via BuildAgentOptions)
|
|
11
|
-
*
|
|
12
|
-
* The hooks are deliberately wired here — not in the TUI layer — so any future
|
|
13
|
-
* channel (web, mobile, ACP) gets the same loop semantics. Tests in
|
|
14
|
-
* tests/loop/ exercise them directly via session.agent.{beforeToolCall,...}.
|
|
15
|
-
*/
|
|
16
|
-
import { createAgentSession, SessionManager, } from "@mariozechner/pi-coding-agent";
|
|
17
|
-
import { BRIGADE_DIR, getBrigadeSessionDir } from "./config.js";
|
|
18
|
-
import { classifyError, decideRetry } from "./error-classifier.js";
|
|
19
|
-
import { pickInitialThinkingLevel } from "./model-caps.js";
|
|
20
|
-
import { wrapStreamFnWithPayloadMutations } from "./provider-payload-mutators.js";
|
|
21
|
-
import { decodeXaiToolCallArgs, downgradeOpenAIResponsesReasoningPairs, dropAnthropicThinkingBlocks, isMistralModel, isOpenAIResponsesModel, isXaiModel, sanitizeMistralToolCallIds, } from "./provider-quirks.js";
|
|
22
|
-
import { smartCompactToolResults } from "./smart-compaction.js";
|
|
23
|
-
import { refreshSessionSystemPrompt, seedDefaultPrompts } from "./system-prompt.js";
|
|
24
|
-
export async function buildAgent(opts) {
|
|
25
|
-
// Seed default prompt files into ~/.brigade/workspace/ on first boot.
|
|
26
|
-
// Idempotent: existing files are never overwritten (users own their edits).
|
|
27
|
-
// Failure is non-fatal — the assembler falls back to embedded defaults
|
|
28
|
-
// when files are missing or unreadable.
|
|
29
|
-
await seedDefaultPrompts();
|
|
30
|
-
// Auto-resume the most recent conversation in this cwd, or start fresh if none.
|
|
31
|
-
// Pass a Brigade-rooted session dir so transcripts live under ~/.brigade/sessions/
|
|
32
|
-
// (Pi's default would be ~/.pi/agent/sessions/ — we want Brigade self-contained
|
|
33
|
-
// so "delete my chat" is a single rm under one Brigade folder).
|
|
34
|
-
const sessionManager = SessionManager.continueRecent(opts.cwd, getBrigadeSessionDir(opts.cwd));
|
|
35
|
-
// Per-model SAFE default. See model-caps.ts for the rationale (reasoning-only
|
|
36
|
-
// models like Gemini 2.5 Pro reject "off"; non-reasoning models ignore it).
|
|
37
|
-
// Users can change this at runtime via /thinking <level>.
|
|
38
|
-
const thinkingLevel = pickInitialThinkingLevel(opts.model);
|
|
39
|
-
const { session } = await createAgentSession({
|
|
40
|
-
cwd: opts.cwd,
|
|
41
|
-
agentDir: BRIGADE_DIR, // ~/.brigade — isolates Brigade from any other Pi install
|
|
42
|
-
authStorage: opts.authStorage,
|
|
43
|
-
modelRegistry: opts.modelRegistry,
|
|
44
|
-
model: opts.model,
|
|
45
|
-
sessionManager,
|
|
46
|
-
thinkingLevel,
|
|
47
|
-
// tools: omitted → Pi enables read/bash/edit/write by default; grep is available too
|
|
48
|
-
});
|
|
49
|
-
// Inject Brigade's system prompt — assembled from the layered .md files
|
|
50
|
-
// at ~/.brigade/workspace/ (with per-cwd override). The assembler embeds
|
|
51
|
-
// the BRIGADE_CACHE_BOUNDARY marker between static prefix and dynamic
|
|
52
|
-
// suffix; the payload mutator (wrapStreamFnWithPayloadMutations below)
|
|
53
|
-
// splits at the marker and applies Anthropic cache_control.
|
|
54
|
-
//
|
|
55
|
-
// Caller can override via opts.systemPrompt — used by tests and any
|
|
56
|
-
// future callers that want a fully custom prompt.
|
|
57
|
-
if (opts.systemPrompt) {
|
|
58
|
-
session.agent.state.systemPrompt = opts.systemPrompt;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
await refreshSessionSystemPrompt(session, opts.cwd);
|
|
62
|
-
}
|
|
63
|
-
// Wire loop hooks. These are public properties on the Pi Agent class; setting
|
|
64
|
-
// them after createAgentSession() is the supported integration point —
|
|
65
|
-
// `createAgentSession` itself doesn't surface them as options, so we layer
|
|
66
|
-
// them here. The hook setters wrap the user's hook in a guard so we never
|
|
67
|
-
// pass a thrown error from a hook back to the loop unhandled.
|
|
68
|
-
//
|
|
69
|
-
// beforeToolCall composition (always-on first, user-supplied second):
|
|
70
|
-
// 1. unknownToolGuard — refuse hallucinated names, whitespace-wrapped
|
|
71
|
-
// names, and empty-args calls to tools that need params. Built fresh
|
|
72
|
-
// per session against the actual tool registry so adding/removing
|
|
73
|
-
// tools at runtime stays consistent.
|
|
74
|
-
// 2. user's hook — additional policy (approval workflows, audit, etc.)
|
|
75
|
-
// Runs ONLY if the guard passed (no point asking the user to approve
|
|
76
|
-
// a call that's about to be refused for being malformed).
|
|
77
|
-
const allowedToolNames = (session.agent.state.tools ?? [])
|
|
78
|
-
.map((t) => t.name ?? "")
|
|
79
|
-
.filter((n) => n.length > 0);
|
|
80
|
-
const guardHook = makeUnknownToolGuard(allowedToolNames);
|
|
81
|
-
const userBeforeHook = opts.beforeToolCall;
|
|
82
|
-
session.agent.beforeToolCall = async (ctx, signal) => {
|
|
83
|
-
// xAI / Grok occasionally HTML-encodes string values inside tool args
|
|
84
|
-
// (`"` instead of `"`, `/` instead of `/`). Pi parses the JSON
|
|
85
|
-
// fine but the args object then has unusable strings. Decode in-place
|
|
86
|
-
// BEFORE the guard runs and BEFORE the tool executes — once decoded
|
|
87
|
-
// the rest of the loop sees clean values.
|
|
88
|
-
//
|
|
89
|
-
// Mutates ctx.toolCall.arguments in place, which is what Pi reads when
|
|
90
|
-
// dispatching to the tool. Provider check is live (session.model) so a
|
|
91
|
-
// mid-session /model into / out of xAI takes effect immediately.
|
|
92
|
-
if (isXaiModel(session.model)) {
|
|
93
|
-
const tc = ctx?.toolCall;
|
|
94
|
-
if (tc && tc.arguments && typeof tc.arguments === "object") {
|
|
95
|
-
tc.arguments = decodeXaiToolCallArgs(tc.arguments);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// Guard next. If it returns a block, short-circuit — the user's hook
|
|
99
|
-
// never sees malformed calls.
|
|
100
|
-
try {
|
|
101
|
-
const guardResult = await guardHook(ctx, signal);
|
|
102
|
-
if (guardResult && guardResult.block)
|
|
103
|
-
return guardResult;
|
|
104
|
-
}
|
|
105
|
-
catch (err) {
|
|
106
|
-
return {
|
|
107
|
-
block: true,
|
|
108
|
-
reason: `tool guard error: ${err instanceof Error ? err.message : String(err)}`,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
if (!userBeforeHook)
|
|
112
|
-
return undefined;
|
|
113
|
-
try {
|
|
114
|
-
return await userBeforeHook(ctx, signal);
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
// A throwing hook is treated as "block" — safer than letting an
|
|
118
|
-
// unrelated bug allow a destructive tool through.
|
|
119
|
-
return {
|
|
120
|
-
block: true,
|
|
121
|
-
reason: `policy hook error: ${err instanceof Error ? err.message : String(err)}`,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
if (opts.afterToolCall) {
|
|
126
|
-
const userHook = opts.afterToolCall;
|
|
127
|
-
session.agent.afterToolCall = async (ctx, signal) => {
|
|
128
|
-
try {
|
|
129
|
-
return await userHook(ctx, signal);
|
|
130
|
-
}
|
|
131
|
-
catch {
|
|
132
|
-
// A throwing post-hook should not invalidate a successful tool
|
|
133
|
-
// call. Leave the result unchanged.
|
|
134
|
-
return undefined;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
// Transform context: defensive cleanup ALWAYS runs first, then provider-
|
|
139
|
-
// conditional quirks fire, then the user-supplied hook (if any) gets the
|
|
140
|
-
// final pass.
|
|
141
|
-
//
|
|
142
|
-
// Always-on cleanup, in order:
|
|
143
|
-
// 1. repairToolPairing — synthesize tool_result for any orphaned tool_use.
|
|
144
|
-
// Without this, Anthropic returns 400 on resumed sessions where a
|
|
145
|
-
// tool was interrupted.
|
|
146
|
-
// 2. sanitizeMessages — strip lone UTF-16 surrogates from text/thinking
|
|
147
|
-
// content blocks. Without this, providers occasionally crash JSON
|
|
148
|
-
// encoding when the model emits invalid Unicode.
|
|
149
|
-
// 3. smartCompactToolResults — two-tier (oversized + aggregate) shrinking
|
|
150
|
-
// with head+tail preservation when the result contains errors.
|
|
151
|
-
// Replaces the older blind truncateOversizedToolResults; scales
|
|
152
|
-
// limits to the active model's context window.
|
|
153
|
-
//
|
|
154
|
-
// Provider-conditional quirks (each gated on the active model):
|
|
155
|
-
// 4. dropAnthropicThinkingBlocks — Anthropic rejects re-sent thinking
|
|
156
|
-
// blocks from earlier turns. Strip from all but the latest assistant
|
|
157
|
-
// message. (Anthropic, Bedrock-Claude, Vertex-Claude, OpenRouter→Claude)
|
|
158
|
-
// 5. sanitizeMistralToolCallIds — Mistral requires [a-zA-Z0-9]{9} IDs;
|
|
159
|
-
// rewrite Pi's longer IDs deterministically and keep tool_use ↔
|
|
160
|
-
// tool_result mapping consistent.
|
|
161
|
-
// 6. downgradeOpenAIResponsesReasoningPairs — OpenAI Responses API
|
|
162
|
-
// rejects messages with both reasoning and toolCall; drop reasoning
|
|
163
|
-
// so the call survives.
|
|
164
|
-
const userTransform = opts.transformContext;
|
|
165
|
-
session.agent.transformContext = async (messages, signal) => {
|
|
166
|
-
const repaired = repairToolPairing(messages);
|
|
167
|
-
const sanitized = sanitizeMessages(repaired);
|
|
168
|
-
const compacted = smartCompactToolResults(sanitized, {
|
|
169
|
-
contextWindowTokens: session.model?.contextWindow,
|
|
170
|
-
}).messages;
|
|
171
|
-
// Read session.model LIVE so a /model switch mid-session picks up the
|
|
172
|
-
// right behavior on the very next LLM call (no rebuild needed).
|
|
173
|
-
const m = session.model;
|
|
174
|
-
// Always-on: strip stale thinking blocks from history. The function
|
|
175
|
-
// preserves the LATEST assistant's thinking ONLY when the active
|
|
176
|
-
// model is Anthropic-flavored (cache continuity); for any other
|
|
177
|
-
// active model — including a fresh /model switch into Gemini — it
|
|
178
|
-
// strips every thinking block so the new provider doesn't reject
|
|
179
|
-
// `{type:"thinking"}` as an unknown content type.
|
|
180
|
-
let cleaned = dropAnthropicThinkingBlocks(compacted, m);
|
|
181
|
-
// Provider-conditional quirks.
|
|
182
|
-
if (isMistralModel(m))
|
|
183
|
-
cleaned = sanitizeMistralToolCallIds(cleaned);
|
|
184
|
-
if (isOpenAIResponsesModel(m))
|
|
185
|
-
cleaned = downgradeOpenAIResponsesReasoningPairs(cleaned);
|
|
186
|
-
if (!userTransform)
|
|
187
|
-
return cleaned;
|
|
188
|
-
try {
|
|
189
|
-
return await userTransform(cleaned, signal);
|
|
190
|
-
}
|
|
191
|
-
catch {
|
|
192
|
-
// User hook threw → fall back to the cleaned messages so the loop
|
|
193
|
-
// stays valid. Never let a context transformer break the request.
|
|
194
|
-
return cleaned;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
// Auto-compaction ON by default. Pi monitors context usage and compacts
|
|
198
|
-
// before the model rejects with "context too long" — without this, long
|
|
199
|
-
// sessions silently fail. Users can opt out per-session via setter.
|
|
200
|
-
session.setAutoCompactionEnabled(true);
|
|
201
|
-
// Wrap session.agent.streamFn to inject provider-specific payload mutations
|
|
202
|
-
// inside Pi's `onPayload` hook. Three quirks handled:
|
|
203
|
-
// - OpenRouter Anthropic prompt-cache hints (cost win on long sessions)
|
|
204
|
-
// - Google Gemini thinking-config payload reformat (Pi level → enum)
|
|
205
|
-
// - SiliconFlow / Minimax thinking-mode normalization
|
|
206
|
-
//
|
|
207
|
-
// Strictly additive: preserves Pi's existing auth-aware streamFn by
|
|
208
|
-
// composing on top of it (the wrapper calls the original underneath).
|
|
209
|
-
// Called exactly once here so mutations don't stack across re-builds.
|
|
210
|
-
wrapStreamFnWithPayloadMutations(session);
|
|
211
|
-
// Re-assemble the system prompt at the start of every new human turn so
|
|
212
|
-
// it stays accurate over a long-lived session.
|
|
213
|
-
//
|
|
214
|
-
// - Cost: ~5KB of file I/O per turn (a few ms — negligible vs the
|
|
215
|
-
// 500-5000ms LLM call). Re-read happens BEFORE the first LLM call
|
|
216
|
-
// of the turn, so the new prompt is in effect when Pi reads it.
|
|
217
|
-
// - Hot reload: edits to ~/.brigade/workspace/<layer>.md take effect on
|
|
218
|
-
// the next user turn, no restart needed.
|
|
219
|
-
// - Per-model guidance refresh: a /model swap changes which family
|
|
220
|
-
// guidance fires (OpenAI vs Google vs none for Anthropic). The
|
|
221
|
-
// swap is always followed by a new user prompt → turn_start fires
|
|
222
|
-
// → re-assembly picks up the new family guidance naturally. No
|
|
223
|
-
// need to subscribe to model_select separately (Pi doesn't expose
|
|
224
|
-
// that on the session event stream anyway).
|
|
225
|
-
//
|
|
226
|
-
// Fire-and-forget: errors are swallowed (a stale prompt is better than
|
|
227
|
-
// a crashed turn). Re-assembly is idempotent — same inputs produce
|
|
228
|
-
// same bytes — so cache stability is preserved when nothing changed.
|
|
229
|
-
if (!opts.systemPrompt) {
|
|
230
|
-
const cwdForRefresh = opts.cwd;
|
|
231
|
-
session.subscribe((event) => {
|
|
232
|
-
if (event.type === "turn_start") {
|
|
233
|
-
void refreshSessionSystemPrompt(session, cwdForRefresh).catch(() => {
|
|
234
|
-
/* swallow — stale prompt > crashed turn */
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
return session;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Wrap `session.prompt()` with a multi-level model-fallback chain. After each
|
|
243
|
-
* `prompt()` resolves, we inspect the last assistant message:
|
|
244
|
-
*
|
|
245
|
-
* - `stopReason === "error"` AND fallbacks remain → swap to next model + re-prompt
|
|
246
|
-
* - success OR no more fallbacks → return
|
|
247
|
-
*
|
|
248
|
-
* Why a Brigade wrapper instead of a Pi feature: Pi's loop is intentionally
|
|
249
|
-
* single-model per session — cross-model fallback is application policy,
|
|
250
|
-
* not loop primitive. Implementing it here means any future channel (web,
|
|
251
|
-
* mobile, ACP) gets the same fallback behavior.
|
|
252
|
-
*
|
|
253
|
-
* On total failure (every fallback errors), the original model is restored
|
|
254
|
-
* so the next user turn doesn't run on a failing model. The final error
|
|
255
|
-
* message is surfaced via `onFallbackExhausted`.
|
|
256
|
-
*
|
|
257
|
-
* Pi's stream-stale-detection is layered on TOP via `runWithStreamTimeout`
|
|
258
|
-
* (see below) — they compose: `runWithFallback(runWithStreamTimeout(...))`.
|
|
259
|
-
*/
|
|
260
|
-
export async function runWithFallback(session, userMessage, options = {}) {
|
|
261
|
-
const original = session.model;
|
|
262
|
-
const fallbacks = options.fallbacks ?? [];
|
|
263
|
-
const wrap = options.wrapAttempt ?? ((fn) => fn());
|
|
264
|
-
const policy = options.retryPolicy ?? {};
|
|
265
|
-
const maxRetriesPerModel = policy.maxRetriesPerModel ?? 1;
|
|
266
|
-
const maxDelayMs = policy.maxDelayMs ?? 60_000;
|
|
267
|
-
// Track restore-to-original state so we never call setModel(original)
|
|
268
|
-
// twice — once defensive in the catch branch, once defensive at the end.
|
|
269
|
-
// Doubling means two extra round-trips to the auth resolver and (worse)
|
|
270
|
-
// can race a successful re-attempt during the second restore.
|
|
271
|
-
//
|
|
272
|
-
// `swappedToFallback` gates the restore: if we never left the primary
|
|
273
|
-
// (in-model retry succeeded, or no fallbacks were configured), restoring
|
|
274
|
-
// is a wasteful no-op that costs an auth round-trip. Only call setModel
|
|
275
|
-
// when there's actually something to undo.
|
|
276
|
-
let restoredOriginal = false;
|
|
277
|
-
let swappedToFallback = false;
|
|
278
|
-
const restoreOriginalOnce = async () => {
|
|
279
|
-
if (restoredOriginal || !original || !swappedToFallback)
|
|
280
|
-
return;
|
|
281
|
-
restoredOriginal = true;
|
|
282
|
-
try {
|
|
283
|
-
await session.setModel(original);
|
|
284
|
-
}
|
|
285
|
-
catch {
|
|
286
|
-
/* best-effort — never let restore failures mask the actual error */
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
/**
|
|
290
|
-
* Run a single model's attempt with per-error-class in-model retries.
|
|
291
|
-
* Returns when either (a) the attempt succeeds (no errorMessage on the
|
|
292
|
-
* last assistant) or (b) the error is not retryable on the same model
|
|
293
|
-
* (caller should advance to the next fallback) or (c) the user aborted
|
|
294
|
-
* (session.abort() raises agent.signal which we observe between retries).
|
|
295
|
-
*
|
|
296
|
-
* `attemptOnSameModel` is called once normally + up to maxRetriesPerModel
|
|
297
|
-
* times if the classifier says the same model deserves another shot.
|
|
298
|
-
*/
|
|
299
|
-
const attemptOnSameModel = async (label) => {
|
|
300
|
-
await wrap(() => session.prompt(userMessage));
|
|
301
|
-
// In-model retry loop. Pi already exhausted its internal retries by the
|
|
302
|
-
// time we get here; this is Brigade's outer ring that handles classes
|
|
303
|
-
// Pi doesn't bother with (e.g. context overflow → compact → retry).
|
|
304
|
-
for (let attempt = 1; attempt <= maxRetriesPerModel; attempt++) {
|
|
305
|
-
const errMsg = lastAssistantErrorMessage(session);
|
|
306
|
-
if (!errMsg)
|
|
307
|
-
return; // succeeded on the previous attempt — done with this model
|
|
308
|
-
const classified = classifyError(errMsg);
|
|
309
|
-
// Special case: context overflow → compact, then retry SAME model.
|
|
310
|
-
// No point falling through to a fallback since the conversation
|
|
311
|
-
// length is the same regardless of which model gets it next.
|
|
312
|
-
if (classified.class === "context_overflow") {
|
|
313
|
-
policy.onCompactBeforeRetry?.();
|
|
314
|
-
try {
|
|
315
|
-
await session.compact();
|
|
316
|
-
}
|
|
317
|
-
catch {
|
|
318
|
-
// Compaction itself failed — give up on same-model recovery
|
|
319
|
-
// and let the caller advance to fallback.
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
policy.onRetry?.({ class: classified.class, attempt, delayMs: 0, reason: "compacted, retrying" });
|
|
323
|
-
await wrap(() => session.prompt(userMessage));
|
|
324
|
-
continue;
|
|
325
|
-
}
|
|
326
|
-
const decision = decideRetry(classified, { attempt, maxAttempts: maxRetriesPerModel, maxDelayMs });
|
|
327
|
-
if (!decision.retry)
|
|
328
|
-
return; // not retryable on same model — caller advances
|
|
329
|
-
policy.onRetry?.({
|
|
330
|
-
class: classified.class,
|
|
331
|
-
attempt,
|
|
332
|
-
delayMs: decision.delayMs,
|
|
333
|
-
reason: `${label}: ${decision.reason}`,
|
|
334
|
-
});
|
|
335
|
-
// Abortable sleep — without this a user Ctrl+C during a 5-minute
|
|
336
|
-
// rate-limit wait would hang for the full 5 minutes (the sleep
|
|
337
|
-
// timer ignores signals; only the next session.prompt call would
|
|
338
|
-
// observe the abort). Pi exposes the active turn's AbortSignal as
|
|
339
|
-
// `session.agent.signal`; if it's already aborted at the top of
|
|
340
|
-
// the loop OR fires DURING the sleep, we exit early.
|
|
341
|
-
if (decision.delayMs > 0) {
|
|
342
|
-
const aborted = await sleepAbortable(decision.delayMs, session.agent.signal);
|
|
343
|
-
if (aborted)
|
|
344
|
-
return; // user pressed Ctrl+C during wait — bail out
|
|
345
|
-
}
|
|
346
|
-
// The user could have aborted DURING the sleep on a non-abortable
|
|
347
|
-
// path (e.g., decision.delayMs === 0 path): re-check before the
|
|
348
|
-
// next prompt so we don't fire one more attempt against an aborted
|
|
349
|
-
// session.
|
|
350
|
-
if (session.agent.signal?.aborted)
|
|
351
|
-
return;
|
|
352
|
-
await wrap(() => session.prompt(userMessage));
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
// Initial attempt on the primary (with in-model retries).
|
|
356
|
-
await attemptOnSameModel("primary");
|
|
357
|
-
if (fallbacks.length === 0)
|
|
358
|
-
return;
|
|
359
|
-
for (let i = 0; i < fallbacks.length; i++) {
|
|
360
|
-
const errMsg = lastAssistantErrorMessage(session);
|
|
361
|
-
if (!errMsg) {
|
|
362
|
-
// Success. If we got here AFTER swapping to a fallback (i > 0
|
|
363
|
-
// implies we already swapped at least once), restore the user's
|
|
364
|
-
// chosen primary so the NEXT user turn doesn't transparently run
|
|
365
|
-
// on the fallback. Without this restore, a one-time hiccup on the
|
|
366
|
-
// primary permanently demotes the session.
|
|
367
|
-
await restoreOriginalOnce();
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
const next = fallbacks[i];
|
|
371
|
-
options.onFallback?.(errMsg, next, i + 1);
|
|
372
|
-
try {
|
|
373
|
-
await session.setModel(next.model);
|
|
374
|
-
swappedToFallback = true;
|
|
375
|
-
await attemptOnSameModel(`fallback ${i + 1}/${fallbacks.length}`);
|
|
376
|
-
}
|
|
377
|
-
catch (err) {
|
|
378
|
-
// A throw here means the swap-and-retry itself blew up (e.g. auth
|
|
379
|
-
// resolution failed for the fallback model). Treat it like an error
|
|
380
|
-
// message — try the next fallback if any remain. Loop continues.
|
|
381
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
382
|
-
if (i === fallbacks.length - 1) {
|
|
383
|
-
options.onFallbackExhausted?.(reason);
|
|
384
|
-
await restoreOriginalOnce();
|
|
385
|
-
throw err;
|
|
386
|
-
}
|
|
387
|
-
continue;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
// Loop drained. Inspect final state once.
|
|
391
|
-
const finalErr = lastAssistantErrorMessage(session);
|
|
392
|
-
if (finalErr) {
|
|
393
|
-
options.onFallbackExhausted?.(finalErr);
|
|
394
|
-
}
|
|
395
|
-
// Restore primary either way: success on a fallback OR exhaustion. The
|
|
396
|
-
// next user turn must start on the model the user actually picked.
|
|
397
|
-
await restoreOriginalOnce();
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Sleep for `ms` but bail early if the supplied AbortSignal fires. Returns
|
|
401
|
-
* `true` if the abort fired (caller should treat as "user cancelled"),
|
|
402
|
-
* `false` if the timer ran to completion normally.
|
|
403
|
-
*
|
|
404
|
-
* Without this helper, a `setTimeout` ignores AbortSignal entirely — a
|
|
405
|
-
* 5-minute rate-limit retry sleep would block Ctrl+C for the full 5 minutes
|
|
406
|
-
* since Pi's session.abort() flips agent.signal but the timer stays armed.
|
|
407
|
-
*
|
|
408
|
-
* If the signal is ALREADY aborted on entry, returns true synchronously
|
|
409
|
-
* (microtask) — no wasted timer.
|
|
410
|
-
*/
|
|
411
|
-
async function sleepAbortable(ms, signal) {
|
|
412
|
-
if (signal?.aborted)
|
|
413
|
-
return true;
|
|
414
|
-
return new Promise((resolve) => {
|
|
415
|
-
const timer = setTimeout(() => {
|
|
416
|
-
signal?.removeEventListener("abort", onAbort);
|
|
417
|
-
resolve(false);
|
|
418
|
-
}, ms);
|
|
419
|
-
const onAbort = () => {
|
|
420
|
-
clearTimeout(timer);
|
|
421
|
-
resolve(true);
|
|
422
|
-
};
|
|
423
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
function lastAssistantErrorMessage(session) {
|
|
427
|
-
const last = [...session.messages].reverse().find((m) => m.role === "assistant");
|
|
428
|
-
if (!last)
|
|
429
|
-
return undefined;
|
|
430
|
-
const stop = last.stopReason;
|
|
431
|
-
const errMsg = last.errorMessage;
|
|
432
|
-
if (stop !== "error" || !errMsg)
|
|
433
|
-
return undefined;
|
|
434
|
-
return errMsg;
|
|
435
|
-
}
|
|
436
|
-
export async function runWithStreamTimeout(session, body, options = {}) {
|
|
437
|
-
const idleMs = options.idleMs ?? 60_000;
|
|
438
|
-
let timer;
|
|
439
|
-
let timedOut = false;
|
|
440
|
-
let cleanedUp = false;
|
|
441
|
-
const arm = () => {
|
|
442
|
-
if (timer)
|
|
443
|
-
clearTimeout(timer);
|
|
444
|
-
timer = setTimeout(() => {
|
|
445
|
-
if (cleanedUp)
|
|
446
|
-
return; // race: don't fire after cleanup
|
|
447
|
-
timedOut = true;
|
|
448
|
-
options.onTimeout?.(idleMs);
|
|
449
|
-
void session.abort().catch(() => { });
|
|
450
|
-
}, idleMs);
|
|
451
|
-
};
|
|
452
|
-
const rawUnsubscribe = session.subscribe(() => {
|
|
453
|
-
// Any event from the loop = liveness signal. Reset the timer.
|
|
454
|
-
if (!timedOut && !cleanedUp)
|
|
455
|
-
arm();
|
|
456
|
-
});
|
|
457
|
-
// Idempotent cleanup — safe to call multiple times. Pi's unsub may or may
|
|
458
|
-
// not tolerate double-call; we don't depend on that.
|
|
459
|
-
const cleanup = () => {
|
|
460
|
-
if (cleanedUp)
|
|
461
|
-
return;
|
|
462
|
-
cleanedUp = true;
|
|
463
|
-
if (timer)
|
|
464
|
-
clearTimeout(timer);
|
|
465
|
-
try {
|
|
466
|
-
rawUnsubscribe();
|
|
467
|
-
}
|
|
468
|
-
catch {
|
|
469
|
-
/* defensive — never let unsub throws mask body errors */
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
arm(); // start the clock
|
|
473
|
-
try {
|
|
474
|
-
await body();
|
|
475
|
-
}
|
|
476
|
-
finally {
|
|
477
|
-
cleanup();
|
|
478
|
-
}
|
|
479
|
-
if (timedOut) {
|
|
480
|
-
throw new Error(`No response from model for ${Math.round(idleMs / 1000)}s — connection may be stalled.`);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Run a prompt body. If the model stops with `stopReason: "length"` (hit
|
|
485
|
-
* max_tokens), automatically prompt with a continuation request so the
|
|
486
|
-
* reply isn't left truncated mid-sentence.
|
|
487
|
-
*
|
|
488
|
-
* Capped at ONE continuation per call by control flow — we never recurse.
|
|
489
|
-
* If the continuation ALSO truncates, the user sees both pieces and can
|
|
490
|
-
* ask "continue" manually for a third pass.
|
|
491
|
-
*
|
|
492
|
-
* Without this, long responses on models with tight max_tokens caps
|
|
493
|
-
* look broken (cut off mid-sentence with no follow-through).
|
|
494
|
-
*/
|
|
495
|
-
export async function runWithLengthContinuation(session, body, options = {}) {
|
|
496
|
-
await body();
|
|
497
|
-
const last = [...session.messages].reverse().find((m) => m.role === "assistant");
|
|
498
|
-
if (!last)
|
|
499
|
-
return;
|
|
500
|
-
const stopReason = last.stopReason;
|
|
501
|
-
if (stopReason !== "length")
|
|
502
|
-
return;
|
|
503
|
-
options.onContinue?.();
|
|
504
|
-
// Defensive try/catch: if the continuation prompt itself errors (rate
|
|
505
|
-
// limit during the continuation, network blip, model unavailable), don't
|
|
506
|
-
// throw upstream — the user already has the truncated half of the reply,
|
|
507
|
-
// and an error here would mask the actual partial result. Outer wrappers
|
|
508
|
-
// can decide whether to surface the error.
|
|
509
|
-
try {
|
|
510
|
-
await session.prompt("Please continue your previous reply from exactly where you left off — do not repeat the prior text, just continue.");
|
|
511
|
-
}
|
|
512
|
-
catch {
|
|
513
|
-
/* swallow — partial reply is better than nothing */
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Recognize stop reasons that indicate the model declined to produce a
|
|
518
|
-
* normal reply (refusal, content filter, policy block). Returns null for
|
|
519
|
-
* normal/expected stop reasons like `stop`, `end_turn`, `toolUse`, and
|
|
520
|
-
* for stop reasons already handled elsewhere (`error`, `aborted`).
|
|
521
|
-
*
|
|
522
|
-
* Why this exists: when Anthropic returns `stop_reason: refusal` (etc),
|
|
523
|
-
* the assistant message has no text content. Without this classifier the
|
|
524
|
-
* UI just shows nothing and the user is confused. With it, we display a
|
|
525
|
-
* clear message like "The model declined this request."
|
|
526
|
-
*
|
|
527
|
-
* Expressed as a post-hoc classifier on the final assistant message rather
|
|
528
|
-
* than a stream wrapper — the outcome is the same and the integration
|
|
529
|
-
* point is simpler.
|
|
530
|
-
*/
|
|
531
|
-
export function classifySensitiveStopReason(message) {
|
|
532
|
-
if (!message)
|
|
533
|
-
return null;
|
|
534
|
-
const reason = message.stopReason;
|
|
535
|
-
if (!reason || typeof reason !== "string")
|
|
536
|
-
return null;
|
|
537
|
-
const r = reason.toLowerCase();
|
|
538
|
-
// "Refusal" — model declined to respond. Anthropic's most common case.
|
|
539
|
-
if (r === "refusal" || r === "refused") {
|
|
540
|
-
return {
|
|
541
|
-
kind: "refusal",
|
|
542
|
-
userMessage: "The model declined this request. Try rephrasing or asking a different question.",
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
// Content-policy variants across providers.
|
|
546
|
-
if (r === "content_filter" ||
|
|
547
|
-
r === "content_filtered" ||
|
|
548
|
-
r === "safety" ||
|
|
549
|
-
r === "policy_violation") {
|
|
550
|
-
return {
|
|
551
|
-
kind: "content_filter",
|
|
552
|
-
userMessage: "The model's content filter blocked this response. Try rephrasing the request.",
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
// Unknown but suspicious — anything that ends in "_filter", "_block", "policy", "safety".
|
|
556
|
-
if (/(_filter|_block|policy|safety|prohibited)/i.test(r)) {
|
|
557
|
-
return {
|
|
558
|
-
kind: "unknown_sensitive",
|
|
559
|
-
userMessage: `The model stopped with an unrecognized policy reason ("${reason}"). Try rephrasing.`,
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
// Normal stop reasons + already-handled cases — not our concern.
|
|
563
|
-
return null;
|
|
564
|
-
}
|
|
565
|
-
/* ─────────────────────────── tool-call cleanup ─────────────────────────── */
|
|
566
|
-
/**
|
|
567
|
-
* Trim whitespace from a tool-call name. Some providers occasionally emit
|
|
568
|
-
* `" read "` instead of `"read"`; without this Pi treats the call as an
|
|
569
|
-
* unknown tool and the model has to retry from a confusing failure.
|
|
570
|
-
*
|
|
571
|
-
* Defensive on non-string input — returns "" so the unknown-tool guard
|
|
572
|
-
* downstream catches it cleanly.
|
|
573
|
-
*
|
|
574
|
-
* Expressed as a pure function callable from any layer.
|
|
575
|
-
*/
|
|
576
|
-
export function trimToolCallName(name) {
|
|
577
|
-
if (typeof name !== "string")
|
|
578
|
-
return "";
|
|
579
|
-
return name.trim();
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Tools that DON'T need parameters. If the model calls one of these with
|
|
583
|
-
* empty args, that's normal — don't flag.
|
|
584
|
-
*
|
|
585
|
-
* This is a small allowlist of common parameter-less tools across our
|
|
586
|
-
* provider catalog. If you add a new parameter-less tool, add it here too.
|
|
587
|
-
*/
|
|
588
|
-
const PARAMETERLESS_TOOLS = new Set([
|
|
589
|
-
"ping",
|
|
590
|
-
"status",
|
|
591
|
-
"list_models",
|
|
592
|
-
"list-models",
|
|
593
|
-
"version",
|
|
594
|
-
"help",
|
|
595
|
-
"now",
|
|
596
|
-
]);
|
|
597
|
-
/**
|
|
598
|
-
* Heuristic detector for malformed tool arguments. Returns true when the
|
|
599
|
-
* call looks suspiciously empty (likely a streaming JSON parse failure)
|
|
600
|
-
* for a tool that typically requires arguments.
|
|
601
|
-
*
|
|
602
|
-
* Pure approximation — true repair would need stream-level intervention
|
|
603
|
-
* (a streamFn wrapper that rewrites the args mid-parse). In v1 we use
|
|
604
|
-
* this to surface a clean error to the model so it self-corrects.
|
|
605
|
-
*
|
|
606
|
-
* Caller should refuse the call (via beforeToolCall hook) and tell the
|
|
607
|
-
* model to retry with proper arguments.
|
|
608
|
-
*/
|
|
609
|
-
export function isLikelyMalformedArgs(args, toolName) {
|
|
610
|
-
// Non-object args are always suspicious
|
|
611
|
-
if (args === null || args === undefined)
|
|
612
|
-
return true;
|
|
613
|
-
if (typeof args !== "object")
|
|
614
|
-
return true;
|
|
615
|
-
// Empty object — only suspicious for tools that typically take params
|
|
616
|
-
const keys = Object.keys(args);
|
|
617
|
-
if (keys.length === 0) {
|
|
618
|
-
const normalized = (toolName ?? "").toLowerCase();
|
|
619
|
-
return !PARAMETERLESS_TOOLS.has(normalized);
|
|
620
|
-
}
|
|
621
|
-
return false;
|
|
622
|
-
}
|
|
623
|
-
/* ─────────────────────────── unknown-tool guard ─────────────────────────── */
|
|
624
|
-
/**
|
|
625
|
-
* Build a `beforeToolCall` hook that blocks problematic tool calls before
|
|
626
|
-
* they execute. Three failure modes are caught here:
|
|
627
|
-
*
|
|
628
|
-
* 1. UNKNOWN TOOL — model hallucinated a name not in the allowlist.
|
|
629
|
-
* Returns a refusal listing the real tools so it can self-correct.
|
|
630
|
-
*
|
|
631
|
-
* 2. WHITESPACE-WRAPPED NAME — provider emitted " read " instead of
|
|
632
|
-
* "read". Pi treats this as unknown. We compare trimmed name against
|
|
633
|
-
* the allowlist and refuse if untrimmed name still doesn't match a
|
|
634
|
-
* legitimate tool, with a clear "name had whitespace" hint.
|
|
635
|
-
*
|
|
636
|
-
* 3. MALFORMED ARGS — empty args for a tool that needs params (xAI
|
|
637
|
-
* sometimes emits broken JSON; Pi parses what it can, leaves us
|
|
638
|
-
* with {}). Refuse with explicit instruction to retry with proper
|
|
639
|
-
* arguments.
|
|
640
|
-
*
|
|
641
|
-
* Expressed as a single `beforeToolCall` hook — the hook fires AFTER Pi
|
|
642
|
-
* parses but BEFORE the tool would execute, which is the right point to
|
|
643
|
-
* refuse and re-prompt.
|
|
644
|
-
*
|
|
645
|
-
* Wire via buildAgent's `beforeToolCall` option:
|
|
646
|
-
* buildAgent({ ..., beforeToolCall: makeUnknownToolGuard(toolNames) })
|
|
647
|
-
*/
|
|
648
|
-
export function makeUnknownToolGuard(allowedToolNames) {
|
|
649
|
-
const allowed = new Set(allowedToolNames);
|
|
650
|
-
return (ctx) => {
|
|
651
|
-
// Pi's BeforeToolCallContext exposes the tool call. Field shape varies
|
|
652
|
-
// slightly across Pi versions — the most stable accessors are `name`
|
|
653
|
-
// and `arguments`/`args`.
|
|
654
|
-
const rawName = ctx?.toolCall?.name ?? ctx?.name ?? "";
|
|
655
|
-
const name = trimToolCallName(rawName);
|
|
656
|
-
const args = ctx?.toolCall?.arguments ??
|
|
657
|
-
ctx?.args ??
|
|
658
|
-
ctx?.arguments ??
|
|
659
|
-
{};
|
|
660
|
-
// CHECK ORDER MATTERS:
|
|
661
|
-
// 1. Unknown tool first — if the name is wrong, the model has to
|
|
662
|
-
// retry with a different tool entirely; arg validation is moot.
|
|
663
|
-
// 2. Malformed args second — name was right but call was empty;
|
|
664
|
-
// model needs to retry with proper params for the SAME tool.
|
|
665
|
-
// Without this ordering, a call with both bad name AND empty args
|
|
666
|
-
// would only learn about the name issue on the first retry, then
|
|
667
|
-
// fail again on the args.
|
|
668
|
-
// Unknown tool — refuse with the available list.
|
|
669
|
-
if (!name || !allowed.has(name)) {
|
|
670
|
-
const list = [...allowed].sort().join(", ") || "(no tools enabled)";
|
|
671
|
-
const hint = rawName !== name
|
|
672
|
-
? ` (note: your tool name had extra whitespace — use exactly "${name}" without spaces)`
|
|
673
|
-
: "";
|
|
674
|
-
return {
|
|
675
|
-
block: true,
|
|
676
|
-
reason: `Tool "${rawName}" is not available${hint}. Available tools: ${list}. Please use one of those instead.`,
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
// Malformed args — refuse and ask for retry with proper params.
|
|
680
|
-
// (Only reachable when the name is valid; bad name short-circuits above.)
|
|
681
|
-
if (isLikelyMalformedArgs(args, name)) {
|
|
682
|
-
return {
|
|
683
|
-
block: true,
|
|
684
|
-
reason: `Tool "${name}" was called with empty/missing arguments. Please retry with the required parameters.`,
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
return undefined;
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Walk the message history and truncate text content inside tool-result
|
|
692
|
-
* messages that exceed `maxCharsPerBlock`. Replaces the tail with a
|
|
693
|
-
* `[…N chars truncated]` marker so the model knows the result was cut.
|
|
694
|
-
*
|
|
695
|
-
* Why: Pi's compaction summarizes by turn, not by per-block size. A tool
|
|
696
|
-
* call that returned 500KB of stdout (e.g., `cat large.log`) keeps that
|
|
697
|
-
* 500KB in history until the whole turn is compacted away. Even AFTER
|
|
698
|
-
* compaction, a recent-but-not-current bloated tool result can re-overflow
|
|
699
|
-
* context on the very next request.
|
|
700
|
-
*
|
|
701
|
-
* Pure function. Returns a new array; original is not mutated. Image
|
|
702
|
-
* content blocks pass through untouched (images are stored as base64,
|
|
703
|
-
* which counts as text but truncating would corrupt them).
|
|
704
|
-
*/
|
|
705
|
-
export function truncateOversizedToolResults(messages, options = {}) {
|
|
706
|
-
// Clamp max to a positive integer. Bad input (negative, NaN, Infinity)
|
|
707
|
-
// breaks slice arithmetic silently — slice(0, -50) truncates from the
|
|
708
|
-
// END instead, slice(0, NaN) returns "". Defensive defaults.
|
|
709
|
-
const requested = options.maxCharsPerBlock ?? 8_000;
|
|
710
|
-
const max = Number.isFinite(requested) ? Math.max(1, Math.floor(requested)) : 8_000;
|
|
711
|
-
if (!Array.isArray(messages))
|
|
712
|
-
return messages;
|
|
713
|
-
return messages.map((msg) => {
|
|
714
|
-
const m = msg;
|
|
715
|
-
if (m?.role !== "toolResult" || !Array.isArray(m.content))
|
|
716
|
-
return msg;
|
|
717
|
-
const newContent = m.content.map((block) => {
|
|
718
|
-
if (!block || block.type !== "text" || typeof block.text !== "string")
|
|
719
|
-
return block;
|
|
720
|
-
if (block.text.length <= max)
|
|
721
|
-
return block;
|
|
722
|
-
const cut = block.text.length - max;
|
|
723
|
-
return {
|
|
724
|
-
...block,
|
|
725
|
-
text: `${block.text.slice(0, max)}\n\n[…${cut} chars truncated]`,
|
|
726
|
-
};
|
|
727
|
-
});
|
|
728
|
-
return { ...m, content: newContent };
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
/* ─────────────────────────── surrogate UTF-16 sanitization ─────────────────────────── */
|
|
732
|
-
/**
|
|
733
|
-
* Strip lone UTF-16 surrogate code units from a string. Valid surrogate
|
|
734
|
-
* PAIRS (e.g. emoji like 😀 = U+D83D U+DE00) are preserved.
|
|
735
|
-
*
|
|
736
|
-
* Why: some providers occasionally emit lone surrogates in streamed
|
|
737
|
-
* output. These are invalid Unicode — `JSON.stringify` will throw, and
|
|
738
|
-
* downstream APIs reject the request entirely. Stripping them is safer
|
|
739
|
-
* than crashing the loop.
|
|
740
|
-
*
|
|
741
|
-
* Caveat: assumes `text` is a complete string, not a slice that splits
|
|
742
|
-
* an emoji across boundaries. Pi's content blocks are always whole strings
|
|
743
|
-
* by the time we see them (assistant messages aren't split mid-codepoint),
|
|
744
|
-
* so this is safe in our context.
|
|
745
|
-
*
|
|
746
|
-
* Strips lone UTF-16 surrogate halves before they reach the JSON encoder.
|
|
747
|
-
*/
|
|
748
|
-
export function sanitizeSurrogates(text) {
|
|
749
|
-
if (!text)
|
|
750
|
-
return text;
|
|
751
|
-
// High surrogate (D800-DBFF) NOT followed by a low surrogate (DC00-DFFF) → strip
|
|
752
|
-
// Low surrogate NOT preceded by a high surrogate → strip
|
|
753
|
-
// We do this in two passes to keep the regex simple and correct.
|
|
754
|
-
return text
|
|
755
|
-
.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])/g, "")
|
|
756
|
-
.replace(/(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, "");
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Walk an AgentMessage[] and sanitize lone surrogates from every text /
|
|
760
|
-
* thinking content block. Returns a new array (input is not mutated).
|
|
761
|
-
*
|
|
762
|
-
* Wired via `transformContext` so every LLM call sees clean UTF-16.
|
|
763
|
-
*/
|
|
764
|
-
export function sanitizeMessages(messages) {
|
|
765
|
-
if (!Array.isArray(messages))
|
|
766
|
-
return messages;
|
|
767
|
-
return messages.map((msg) => {
|
|
768
|
-
const m = msg;
|
|
769
|
-
if (!m || !Array.isArray(m.content))
|
|
770
|
-
return msg;
|
|
771
|
-
const cleanedContent = m.content.map((block) => {
|
|
772
|
-
if (!block)
|
|
773
|
-
return block;
|
|
774
|
-
if (block.type === "text" && typeof block.text === "string") {
|
|
775
|
-
return { ...block, text: sanitizeSurrogates(block.text) };
|
|
776
|
-
}
|
|
777
|
-
if (block.type === "thinking" && typeof block.thinking === "string") {
|
|
778
|
-
return { ...block, thinking: sanitizeSurrogates(block.thinking) };
|
|
779
|
-
}
|
|
780
|
-
return block;
|
|
781
|
-
});
|
|
782
|
-
return { ...m, content: cleanedContent };
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
/* ─────────────────────────── tool-call/result pairing repair ─────────────────────────── */
|
|
786
|
-
/**
|
|
787
|
-
* Walk the message transcript and synthesize an error tool_result for any
|
|
788
|
-
* orphaned tool_use block (i.e., assistant emitted a tool call but no
|
|
789
|
-
* corresponding tool_result message follows it before the next assistant
|
|
790
|
-
* turn).
|
|
791
|
-
*
|
|
792
|
-
* Why this matters: Anthropic (and several OpenAI-compatible providers)
|
|
793
|
-
* reject the request with `400: tool_use ids must have corresponding
|
|
794
|
-
* tool_result` if the history violates the pairing invariant. Brigade's
|
|
795
|
-
* session can drift into this state after:
|
|
796
|
-
* - process crash mid-tool-execution
|
|
797
|
-
* - SIGINT during a tool call
|
|
798
|
-
* - extension-emitted custom messages that interleave between tool_use
|
|
799
|
-
* and tool_result
|
|
800
|
-
*
|
|
801
|
-
* Repairs instead of rejecting so resumed sessions don't dead-end.
|
|
802
|
-
*
|
|
803
|
-
* Wired via `buildAgent`'s `transformContext` hook so it runs on every LLM
|
|
804
|
-
* call automatically.
|
|
805
|
-
*/
|
|
806
|
-
export function repairToolPairing(messages) {
|
|
807
|
-
if (!Array.isArray(messages) || messages.length === 0)
|
|
808
|
-
return messages;
|
|
809
|
-
// Pass 1 — collect every tool_use id (with its name) and every
|
|
810
|
-
// fulfilled tool_result toolCallId. Pi's `ToolResultMessage` is at
|
|
811
|
-
// the MESSAGE level (role: "toolResult", toolCallId on the message),
|
|
812
|
-
// not as a content block, so we check `msg.toolCallId` directly.
|
|
813
|
-
const toolUseInfo = new Map(); // id → toolName
|
|
814
|
-
const fulfilledIds = new Set();
|
|
815
|
-
for (const msg of messages) {
|
|
816
|
-
const m = msg;
|
|
817
|
-
if (m?.role === "toolResult" && typeof m.toolCallId === "string") {
|
|
818
|
-
fulfilledIds.add(m.toolCallId);
|
|
819
|
-
continue;
|
|
820
|
-
}
|
|
821
|
-
const content = m?.content;
|
|
822
|
-
if (!Array.isArray(content))
|
|
823
|
-
continue;
|
|
824
|
-
for (const block of content) {
|
|
825
|
-
if (block?.type === "toolCall" && typeof block.id === "string") {
|
|
826
|
-
toolUseInfo.set(block.id, typeof block.name === "string" ? block.name : "unknown");
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
// Find orphans — tool_use with no matching tool_result.
|
|
831
|
-
const orphans = [...toolUseInfo.entries()].filter(([id]) => !fulfilledIds.has(id));
|
|
832
|
-
if (orphans.length === 0)
|
|
833
|
-
return messages;
|
|
834
|
-
// Pass 2 — for each orphan, splice a synthetic toolResult message
|
|
835
|
-
// immediately after the assistant message that contained the tool_use.
|
|
836
|
-
// One ToolResultMessage PER orphan (Pi's shape; no batching).
|
|
837
|
-
const orphanIdSet = new Set(orphans.map(([id]) => id));
|
|
838
|
-
const repaired = [];
|
|
839
|
-
for (const msg of messages) {
|
|
840
|
-
repaired.push(msg);
|
|
841
|
-
const content = msg?.content;
|
|
842
|
-
if (!Array.isArray(content))
|
|
843
|
-
continue;
|
|
844
|
-
for (const block of content) {
|
|
845
|
-
if (block?.type === "toolCall" &&
|
|
846
|
-
typeof block.id === "string" &&
|
|
847
|
-
orphanIdSet.has(block.id)) {
|
|
848
|
-
// Use the proper ToolResultMessage shape from pi-ai. Compiler
|
|
849
|
-
// catches missing fields here — no `as any` to swallow shape
|
|
850
|
-
// drift if Pi changes the type.
|
|
851
|
-
const synthetic = {
|
|
852
|
-
role: "toolResult",
|
|
853
|
-
toolCallId: block.id,
|
|
854
|
-
toolName: toolUseInfo.get(block.id) ?? "unknown",
|
|
855
|
-
content: [
|
|
856
|
-
{
|
|
857
|
-
type: "text",
|
|
858
|
-
text: "(tool result missing — likely interrupted; did not complete)",
|
|
859
|
-
},
|
|
860
|
-
],
|
|
861
|
-
isError: true,
|
|
862
|
-
timestamp: Date.now(),
|
|
863
|
-
};
|
|
864
|
-
repaired.push(synthetic);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
return repaired;
|
|
869
|
-
}
|
|
870
|
-
/**
|
|
871
|
-
* Common phrasings that indicate the model is DESCRIBING an action it intends
|
|
872
|
-
* to take, rather than taking it. Conservative — false positives here cost a
|
|
873
|
-
* single retry, which is preferable to false negatives (silent failures).
|
|
874
|
-
*
|
|
875
|
-
* All patterns are anchored to start-of-string OR start-of-sentence to avoid
|
|
876
|
-
* matching the same phrase inside a quoted user message (e.g. assistant
|
|
877
|
-
* echoing the user's "I'll create a script" in the middle of an answer).
|
|
878
|
-
* `(?:^|[.!?\n]\s+)` is the sentence-start anchor.
|
|
879
|
-
*/
|
|
880
|
-
const SENTENCE_START = "(?:^|[.!?\\n]\\s+)";
|
|
881
|
-
const PLANNING_PHRASES = [
|
|
882
|
-
new RegExp(`${SENTENCE_START}i'?ll (?:create|write|build|make|generate|set up|implement|fix|update|add|do|run|execute|launch|deploy|install|configure)`, "i"),
|
|
883
|
-
new RegExp(`${SENTENCE_START}let me (?:create|write|build|make|generate|implement|fix|update|add|do|run|execute|launch|deploy|install|configure)`, "i"),
|
|
884
|
-
new RegExp(`${SENTENCE_START}(?:going to|i will|i shall) (?:create|write|build|make|generate|implement)`, "i"),
|
|
885
|
-
new RegExp(`${SENTENCE_START}here'?s (?:what|how) i'?ll`, "i"),
|
|
886
|
-
];
|
|
887
|
-
function detectContentIssue(message, hadTools) {
|
|
888
|
-
if (!message || message.role !== "assistant")
|
|
889
|
-
return null;
|
|
890
|
-
const content = message.content;
|
|
891
|
-
if (!Array.isArray(content) || content.length === 0)
|
|
892
|
-
return "empty";
|
|
893
|
-
const textBlocks = content.filter((b) => b && b.type === "text" && typeof b.text === "string");
|
|
894
|
-
const thinkingBlocks = content.filter((b) => b && b.type === "thinking");
|
|
895
|
-
const toolCallBlocks = content.filter((b) => b && b.type === "toolCall");
|
|
896
|
-
const totalText = textBlocks.map((b) => b.text).join("").trim();
|
|
897
|
-
// Reasoning-only: had thinking blocks, no text, no tool call.
|
|
898
|
-
if (thinkingBlocks.length > 0 && totalText.length === 0 && toolCallBlocks.length === 0) {
|
|
899
|
-
return "reasoning-only";
|
|
900
|
-
}
|
|
901
|
-
// Empty: zero text AND zero tool calls (and not reasoning-only above).
|
|
902
|
-
if (totalText.length === 0 && toolCallBlocks.length === 0)
|
|
903
|
-
return "empty";
|
|
904
|
-
// Planning-only: only matters when tools were available — otherwise the
|
|
905
|
-
// model has no choice. We check that the text matches a planning phrase
|
|
906
|
-
// AND no tool was invoked in this final message.
|
|
907
|
-
if (hadTools && toolCallBlocks.length === 0 && totalText.length > 0) {
|
|
908
|
-
if (PLANNING_PHRASES.some((re) => re.test(totalText)))
|
|
909
|
-
return "planning-only";
|
|
910
|
-
}
|
|
911
|
-
return null;
|
|
912
|
-
}
|
|
913
|
-
const STEER_FOR = {
|
|
914
|
-
empty: "You returned no visible reply. Provide your full visible answer to the user's last message now, in plain text.",
|
|
915
|
-
"reasoning-only": "You produced reasoning but no visible answer. Provide your final visible answer to the user now, in plain text outside of any reasoning blocks.",
|
|
916
|
-
"planning-only": "You described an action you would take, but you did not actually invoke the tool to do it. Take the action now using the appropriate tool — do not just describe it again.",
|
|
917
|
-
};
|
|
918
|
-
/**
|
|
919
|
-
* Run a prompt body. After it resolves, inspect the final assistant message
|
|
920
|
-
* for low-quality content (empty / reasoning-only / planning-only). If
|
|
921
|
-
* detected, queue a steering message and re-run ONCE — the cap is hardcoded
|
|
922
|
-
* at one retry by control flow (we never recurse).
|
|
923
|
-
*
|
|
924
|
-
* The cap matters because this wrapper composes with other retry layers
|
|
925
|
-
* (thinkingFallback adds 1, model fallback adds 1+). Without the hard cap,
|
|
926
|
-
* a single user message could trigger 4-6 prompts in pathological cases —
|
|
927
|
-
* burning tokens, money, and patience.
|
|
928
|
-
*
|
|
929
|
-
* Each retry is a fresh `session.prompt()` so it stacks cleanly with
|
|
930
|
-
* `runWithStreamTimeout` / `runWithThinkingFallback` / `runWithFallback`.
|
|
931
|
-
*
|
|
932
|
-
* Three failure modes are handled: planning-only (model emitted a plan
|
|
933
|
-
* but no action), empty-response (no content blocks), and reasoning-only
|
|
934
|
-
* (thinking blocks but no user-visible text). Each gets a tailored
|
|
935
|
-
* re-prompt rather than a blind retry. We re-prompt with a steering
|
|
936
|
-
* message rather than prefilling the model's reasoning — more tokens
|
|
937
|
-
* but no provider-specific prefill API needed in v1.
|
|
938
|
-
*/
|
|
939
|
-
export async function runWithContentQualityRetry(session, body, options = {}) {
|
|
940
|
-
await body();
|
|
941
|
-
// Snapshot session state immediately so async subscribers can't mutate
|
|
942
|
-
// what we're inspecting. Race window without the snapshot: between body()
|
|
943
|
-
// resolving and detectContentIssue() running, another event listener
|
|
944
|
-
// (extension hook, telemetry handler) could append a message — making
|
|
945
|
-
// "last assistant" be something other than what body() actually produced.
|
|
946
|
-
const snapshot = [...session.messages];
|
|
947
|
-
const tools = session.agent.state?.tools;
|
|
948
|
-
const hadTools = Array.isArray(tools) && tools.length > 0;
|
|
949
|
-
const lastAssistant = [...snapshot].reverse().find((m) => m.role === "assistant");
|
|
950
|
-
const issue = detectContentIssue(lastAssistant, hadTools);
|
|
951
|
-
if (!issue)
|
|
952
|
-
return;
|
|
953
|
-
options.onRetry?.(issue);
|
|
954
|
-
// Queue the steer message as a normal user prompt — we re-prompt directly
|
|
955
|
-
// here (Pi's `agent.steer` is for mid-turn injection; this fires AFTER
|
|
956
|
-
// the turn ended). The steer text addresses the specific failure mode.
|
|
957
|
-
await session.prompt(STEER_FOR[issue]);
|
|
958
|
-
}
|
|
959
|
-
/**
|
|
960
|
-
* Run a prompt body and fire a heartbeat callback every `intervalMs` of
|
|
961
|
-
* WALL-CLOCK time during the turn. Fires regardless of whether the model
|
|
962
|
-
* is emitting events — the user wants to see "still working… 2m elapsed"
|
|
963
|
-
* even when tokens are trickling in steadily.
|
|
964
|
-
*
|
|
965
|
-
* Critical for local Ollama where a complex generation can take 5-15
|
|
966
|
-
* minutes and the user has NO other signal that we're alive.
|
|
967
|
-
*
|
|
968
|
-
* Distinct from `runWithStreamTimeout` (which aborts on idle silence) —
|
|
969
|
-
* this is purely informational and ALWAYS fires on its interval.
|
|
970
|
-
*/
|
|
971
|
-
export async function runWithHeartbeat(session, body, options = {}) {
|
|
972
|
-
void session; // session not currently used; kept for future per-session metrics
|
|
973
|
-
const intervalMs = options.intervalMs ?? 30_000;
|
|
974
|
-
const startedAt = Date.now();
|
|
975
|
-
let timer;
|
|
976
|
-
let cleanedUp = false;
|
|
977
|
-
const tick = () => {
|
|
978
|
-
if (cleanedUp)
|
|
979
|
-
return;
|
|
980
|
-
options.onHeartbeat?.(Date.now() - startedAt);
|
|
981
|
-
// Re-arm — heartbeat fires every intervalMs of wall clock.
|
|
982
|
-
timer = setTimeout(tick, intervalMs);
|
|
983
|
-
};
|
|
984
|
-
const cleanup = () => {
|
|
985
|
-
if (cleanedUp)
|
|
986
|
-
return;
|
|
987
|
-
cleanedUp = true;
|
|
988
|
-
if (timer)
|
|
989
|
-
clearTimeout(timer);
|
|
990
|
-
};
|
|
991
|
-
// First tick at intervalMs — don't fire immediately on start.
|
|
992
|
-
timer = setTimeout(tick, intervalMs);
|
|
993
|
-
try {
|
|
994
|
-
await body();
|
|
995
|
-
}
|
|
996
|
-
finally {
|
|
997
|
-
cleanup();
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
/* ─────────────────────────── thinking-level fallback ─────────────────────────── */
|
|
1001
|
-
/**
|
|
1002
|
-
* Detect a "model doesn't support thinking" error in the assistant message.
|
|
1003
|
-
* Provider error texts vary — we match on common phrasings.
|
|
1004
|
-
*
|
|
1005
|
-
* Examples that trigger:
|
|
1006
|
-
* - Ollama: "qwen3-coder:30b does not support thinking"
|
|
1007
|
-
* - Generic: "model X does not support thinking_config"
|
|
1008
|
-
* - Some Cerebras: "thinking is not enabled for this model"
|
|
1009
|
-
* - Anthropic: "model does not support extended thinking"
|
|
1010
|
-
*
|
|
1011
|
-
* If we add a new provider that uses different phrasing, just extend the regex.
|
|
1012
|
-
*/
|
|
1013
|
-
function looksLikeThinkingNotSupported(message) {
|
|
1014
|
-
if (!message)
|
|
1015
|
-
return false;
|
|
1016
|
-
return /not support(?:ed)? (?:extended )?thinking|thinking is not enabled|thinking_config|does not allow thinking|requires thinking_off/i.test(message);
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
* Run a prompt body. If the model rejects with "doesn't support thinking",
|
|
1020
|
-
* silently downgrade `thinkingLevel` to "off" and retry once.
|
|
1021
|
-
*
|
|
1022
|
-
* Why this matters: our static capability inference (model.reasoning flag)
|
|
1023
|
-
* can be wrong. Ollama doesn't report capabilities, so we guess from the
|
|
1024
|
-
* model name — and "qwen3-coder" is qwen3-family but actually code-only.
|
|
1025
|
-
* Without this dynamic fallback, every wrong guess = a hard failure for
|
|
1026
|
-
* the user.
|
|
1027
|
-
*
|
|
1028
|
-
* Capped at one retry. If the second attempt also errors, that error
|
|
1029
|
-
* propagates normally (will be picked up by runWithFallback if composed).
|
|
1030
|
-
*/
|
|
1031
|
-
export async function runWithThinkingFallback(session, body, options = {}) {
|
|
1032
|
-
await body();
|
|
1033
|
-
const errMsg = lastAssistantErrorMessage(session);
|
|
1034
|
-
if (!errMsg || !looksLikeThinkingNotSupported(errMsg))
|
|
1035
|
-
return;
|
|
1036
|
-
// Already on off — retry would loop.
|
|
1037
|
-
if (session.thinkingLevel === "off")
|
|
1038
|
-
return;
|
|
1039
|
-
const originalLevel = session.thinkingLevel;
|
|
1040
|
-
options.onDowngrade?.(originalLevel, errMsg);
|
|
1041
|
-
session.setThinkingLevel("off");
|
|
1042
|
-
// Retry once with thinking off. Re-prompt with the same user message —
|
|
1043
|
-
// we extract from session history.
|
|
1044
|
-
const lastUser = [...session.messages].reverse().find((m) => m.role === "user");
|
|
1045
|
-
if (!lastUser)
|
|
1046
|
-
return;
|
|
1047
|
-
const text = lastUser.content
|
|
1048
|
-
?.filter((b) => b?.type === "text")
|
|
1049
|
-
?.map((b) => b.text)
|
|
1050
|
-
?.join("") ?? "";
|
|
1051
|
-
if (!text)
|
|
1052
|
-
return;
|
|
1053
|
-
await session.prompt(text);
|
|
1054
|
-
}
|
|
1055
|
-
/* ─────────────────────────── mid-turn model switch ─────────────────────────── */
|
|
1056
|
-
/**
|
|
1057
|
-
* Swap the active model WHILE a turn is in flight, then re-run the user's
|
|
1058
|
-
* last message on the new model. Used for live-failover and exposed for
|
|
1059
|
-
* the `/model` slash command so the user can change models without
|
|
1060
|
-
* "abort, switch, retype message."
|
|
1061
|
-
*
|
|
1062
|
-
* Sequence:
|
|
1063
|
-
* 1. abort current run (Pi unwinds cleanly via AbortController)
|
|
1064
|
-
* 2. wait for `agent_end` so session state is settled
|
|
1065
|
-
* 3. setModel(target) — Pi validates auth, persists to session
|
|
1066
|
-
* 4. re-prompt with the same user message
|
|
1067
|
-
*
|
|
1068
|
-
* Returns true if the swap+re-prompt completed, false if the user wasn't
|
|
1069
|
-
* actually mid-turn (caller should fall back to a normal `setModel`).
|
|
1070
|
-
*/
|
|
1071
|
-
export async function switchModelMidTurn(session, target, userMessageToReplay) {
|
|
1072
|
-
// If no turn is active, the caller should use the normal setModel path.
|
|
1073
|
-
if (!session.agent.signal)
|
|
1074
|
-
return false;
|
|
1075
|
-
// Idempotent unsub guard — both the agent_end handler and the 5s safety
|
|
1076
|
-
// timeout call this. Without the guard we'd race-call Pi's raw unsub
|
|
1077
|
-
// twice and (depending on Pi's internals) potentially detach a stale
|
|
1078
|
-
// listener registered by code reading our event stream concurrently.
|
|
1079
|
-
let unsubbed = false;
|
|
1080
|
-
let resolved = false;
|
|
1081
|
-
const ended = new Promise((resolve) => {
|
|
1082
|
-
const rawUnsub = session.subscribe((ev) => {
|
|
1083
|
-
if (ev.type === "agent_end") {
|
|
1084
|
-
if (!unsubbed) {
|
|
1085
|
-
unsubbed = true;
|
|
1086
|
-
try {
|
|
1087
|
-
rawUnsub();
|
|
1088
|
-
}
|
|
1089
|
-
catch {
|
|
1090
|
-
/* defensive */
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
if (!resolved) {
|
|
1094
|
-
resolved = true;
|
|
1095
|
-
resolve();
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
});
|
|
1099
|
-
// Safety: if abort never produces agent_end (shouldn't happen), don't
|
|
1100
|
-
// hang forever. Pi guarantees agent_end after abort, but defense in depth.
|
|
1101
|
-
setTimeout(() => {
|
|
1102
|
-
if (!unsubbed) {
|
|
1103
|
-
unsubbed = true;
|
|
1104
|
-
try {
|
|
1105
|
-
rawUnsub();
|
|
1106
|
-
}
|
|
1107
|
-
catch {
|
|
1108
|
-
/* defensive */
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
if (!resolved) {
|
|
1112
|
-
resolved = true;
|
|
1113
|
-
resolve();
|
|
1114
|
-
}
|
|
1115
|
-
}, 5_000);
|
|
1116
|
-
});
|
|
1117
|
-
await session.abort();
|
|
1118
|
-
await ended;
|
|
1119
|
-
await session.setModel(target);
|
|
1120
|
-
await session.prompt(userMessageToReplay);
|
|
1121
|
-
return true;
|
|
1122
|
-
}
|
|
1123
|
-
//# sourceMappingURL=agent.js.map
|