import type { BubbleContext } from '../../types/bubble.js'; import { type CredentialType } from '@bubblelab/shared-schemas'; import type { AIAgentParamsParsed } from './ai-agent.js'; /** * Role of an AIAgent at runtime, computed once in `runBeforeAction`. Drives * which Pro-injected context (capabilities, memory, slack ctx, etc.) gets * folded into the agent's params before execution. * * - `flow-master`: the top-level master AIAgent of a Pro-orchestrated flow * execution (Pearl chat, Slack bot flows, approval resumes). Receives the * full Pro context bundle. * - `subagent`: an AIAgent spawned by `use-capability` (name prefix * "Capability Agent: …"). Skips Pro injections — the master delegated to it * intentionally with a narrow, capability-scoped prompt. * - `utility`: any other AIAgent (workflow-internal, capability-tool-internal, * user flow code without `_isFlowMaster`). Runs with exactly the params the * caller passed. No Pro injections. */ export type AgentRole = 'flow-master' | 'subagent' | 'utility'; type ResolveCapabilityCredentials = (capDef: { metadata: { requiredCredentials: CredentialType[]; optionalCredentials?: CredentialType[]; }; }, capConfig: { credentials?: Record; }) => Partial>; export interface BeforeActionDeps { params: AIAgentParamsParsed; context: BubbleContext | undefined; resolveCapabilityCredentials: ResolveCapabilityCredentials; } /** * Run the full pre-execution pipeline for an AIAgent: * * 1. Classify the agent's role (flow-master / subagent / utility). * 2. (flow-master only) Inject dynamic capabilities + credentials BEFORE * `applyCapabilityPreprocessing` reads them. * 3. Apply common context (dedup caps, min maxTokens, JSON mode, time, run * capability pipeline) — every agent goes through this. * 4. (flow-master only) Inject slack ctx + history + memory + read_image + * capability-management tools + custom `/command` detection. * 5. (subagent only) Apply custom-cap delegate model override if the master * detected a `/command`. * 6. Consume the `_isFlowMaster` marker so children spawned during this * execution stay clean. */ export declare function runBeforeAction(deps: BeforeActionDeps): Promise; export {}; //# sourceMappingURL=ai-agent-before-action.d.ts.map