import * as react from 'react'; import { MessageData, Tool } from '@strands-agents/sdk'; import { Settings, AgentStatus } from '../types/index.cjs'; import { DynamicContext } from '../lib/system-prompt.cjs'; import './useUserActivity.cjs'; interface AgentConfig { id: string; provider: Settings['provider']; model?: string; apiKey?: string; systemPrompt: string; maxTokens?: number; color: string; createdAt: number; lastUsedAt?: number; /** Optional list of tool names. If set, only these tools (from the parent's tool set) are exposed to this sub-agent. If omitted → inherit ALL parent tools. */ tool_filter?: string[]; /** How the slot's systemPrompt composes with the parent's base prompt: * - 'append' (default): use buildSystemPrompt(settings, ctx) as base, then append this slot's systemPrompt as "## Role/Specialization". * - 'replace': use ONLY this slot's systemPrompt verbatim (no base prompt, no dynamic context). Use for strict/minimal personas. */ prompt_mode?: 'append' | 'replace'; } interface AgentSlot extends AgentConfig { status: AgentStatus; messages: MessageData[]; error?: string; } interface SpawnInput { id: string; provider: Settings['provider']; model?: string; apiKey?: string; systemPrompt?: string; maxTokens?: number; tool_filter?: string[]; prompt_mode?: 'append' | 'replace'; } /** * useAgents — parent agent's tools and dynamic context propagate into every * sub-agent by default. Each slot can further restrict its tools via * config.tool_filter (string[] of tool names). * * @param parentSettings parent's Settings — model, provider, api keys, flags * @param parentTools parent's tool array (from buildTools(settings)) — * sub-agents INHERIT these unless tool_filter is set * @param dynamicCtx optional parent dynamic context — injected into the * base system prompt via buildSystemPrompt(). Pass the * same ctx useAgent uses so sub-agents see mesh peers, * time, active tasks, etc. */ declare function useAgents(parentSettings: Settings, parentTools?: Tool[], dynamicCtx?: DynamicContext): { slots: Map; activeId: string | null; setActiveId: react.Dispatch>; loaded: boolean; spawn: (input: SpawnInput) => Promise; kill: (id: string) => Promise; update: (id: string, patch: Partial) => Promise; send: (id: string, text: string, opts?: { abort?: AbortSignal; }) => Promise; broadcast: (text: string, excludeId?: string) => Promise>; cancel: (id: string) => void; clear: (id: string) => Promise; }; type UseAgentsReturn = ReturnType; export { type AgentConfig, type AgentSlot, type UseAgentsReturn, useAgents };