import { Agent } from '../agent/index.js'; import type { ToolsInput, ToolsetsInput } from '../agent/types.js'; import type { MastraLanguageModel } from '../llm/model/shared.types.js'; import { RequestContext } from '../request-context/index.js'; import { askUserTool } from '../tools/builtin/ask-user.js'; import { submitPlanTool } from '../tools/builtin/submit-plan.js'; import type { HarnessSubagent } from './types.js'; export { askUserTool }; export { submitPlanTool }; export { taskWriteTool, taskUpdateTool, taskCompleteTool, taskCheckTool, assignTaskIds, summarizeTaskCheck, } from '../tools/builtin/task-tools.js'; export type { TaskItem, TaskItemInput, TaskItemSnapshot, TaskCheckResult, TaskCheckSummary, } from '../tools/builtin/task-tools.js'; export { TaskStateProcessor } from '../tools/builtin/task-state-processor.js'; export interface CreateSubagentToolOptions { subagents: HarnessSubagent[]; resolveModel: (modelId: string) => MastraLanguageModel; /** Resolved harness tools (already evaluated from DynamicArgument) */ harnessTools?: ToolsInput; /** Fallback model ID when subagent definition has no defaultModelId */ fallbackModelId?: string; /** Returns the parent model ID for display when a subagent call is forked. */ getParentModelId?: () => string; /** * Returns the parent Agent that owns the current run. Invoked when a * subagent call is forked so the fork can reuse the parent's * instructions, tools, and model to preserve prompt-cache prefix. */ getParentAgent?: () => Agent | undefined; /** * Clones the parent thread so a forked subagent can run on a copy * without polluting the parent conversation. Typically delegates to * `Harness.cloneThread`. Returns the new thread metadata. */ cloneThreadForFork?: (opts: { sourceThreadId: string; resourceId?: string; title?: string; }) => Promise<{ id: string; resourceId: string; }>; /** * Resolves the toolsets the parent agent runs with for the current request. * When set, forked subagents inherit the parent's toolsets so harness-injected * tools like `ask_user` / `submit_plan` / user-configured harness tools remain * available inside the fork. The `subagent` entry is preserved for prompt-cache * stability, but its runtime execute function is patched to block recursion. */ getParentToolsets?: (requestContext?: RequestContext) => Promise; } /** * Creates a `subagent` tool from registered subagent definitions. * The tool spawns a fresh Agent per invocation with constrained tools, * streams the response, and forwards events to the harness. */ export declare function createSubagentTool(opts: CreateSubagentToolOptions): import("../tools").Tool<{ agentType: string; task: string; modelId?: string | undefined; forked?: boolean | undefined; }, unknown, unknown, unknown, import("../tools").ToolExecutionContext, "subagent", unknown>; /** * Parse subagent metadata from a tool result string. * * Older persisted threads may have an internal `` tag * appended to the subagent tool result content (carrying modelId / durationMs * / sub-tool-call summary, used by history-render UIs to reconstruct the * subagent activity box when live events aren't available). * * New runs no longer append the tag — the metadata leaked into model context * and could be echoed back as visible assistant text — but this parser is * retained so existing threads continue to render cleanly. It also strips the * tag so callers never display it to users. * * Returns the cleaned text plus any parsed metadata. */ export declare function parseSubagentMeta(content: string): { text: string; modelId?: string; durationMs?: number; toolCalls?: Array<{ name: string; isError: boolean; }>; }; //# sourceMappingURL=tools.d.ts.map