/** * @license * Copyright 2025 Vybestack LLC * SPDX-License-Identifier: Apache-2.0 */ import { BaseDeclarativeTool, BaseToolInvocation, type ToolResult } from './tools.js'; import type { Config } from '../config/config.js'; import { SubagentOrchestrator } from '../core/subagentOrchestrator.js'; import type { SubagentSchedulerFactory } from '../core/subagentScheduler.js'; import type { SubagentManager } from '../config/subagentManager.js'; import type { ProfileManager } from '../config/profileManager.js'; import type { ToolRegistry } from './tool-registry.js'; import type { AsyncTaskManager } from '../services/asyncTaskManager.js'; export interface TaskToolParams { subagent_name?: string; subagentName?: string; goal_prompt?: string; goalPrompt?: string; behaviour_prompts?: string[]; behavior_prompts?: string[]; behaviourPrompts?: string[]; behaviorPrompts?: string[]; tool_whitelist?: string[]; toolWhitelist?: string[]; output_spec?: Record; outputSpec?: Record; context?: Record; context_vars?: Record; contextVars?: Record; timeout_seconds?: number; async?: boolean; } interface TaskToolInvocationParams { subagentName: string; goalPrompt: string; behaviourPrompts: string[]; toolWhitelist?: string[]; outputSpec?: Record; context: Record; async: boolean; } export interface TaskToolDependencies { orchestratorFactory?: () => SubagentOrchestrator; profileManager?: ProfileManager; subagentManager?: SubagentManager; schedulerFactoryProvider?: () => SubagentSchedulerFactory | undefined; isInteractiveEnvironment?: () => boolean; getAsyncTaskManager?: () => AsyncTaskManager | undefined; } interface TaskToolInvocationDeps { createOrchestrator: () => SubagentOrchestrator; getToolRegistry?: () => ToolRegistry | undefined; getSchedulerFactory?: () => SubagentSchedulerFactory | undefined; isInteractiveEnvironment?: () => boolean; getAsyncTaskManager?: () => AsyncTaskManager | undefined; } declare class TaskToolInvocation extends BaseToolInvocation { private readonly config; private readonly normalized; private readonly deps; constructor(config: Config, params: TaskToolParams, normalized: TaskToolInvocationParams, deps: TaskToolInvocationDeps); getDescription(): string; private buildExcludedToolNames; private isExcludedToolName; private buildGovernedToolWhitelist; private createLaunchRequest; execute(signal: AbortSignal, updateOutput?: (output: string) => void): Promise; private isAbortError; private buildContextState; private createErrorResult; private createCancelledResult; private createTimeoutControllers; private resolveTimeoutSeconds; private isTimeoutError; private createTimeoutResult; /** * @plan PLAN-20260130-ASYNCTASK.P11 * * Note: Async tasks are designed to run independently in the background. * Unlike foreground task execution, they do NOT wire cancellation or timeout * to the parent agent's signal. This is an intentional design choice to allow * async tasks to continue running even if the foreground agent is interrupted. */ private executeAsync; /** * @plan PLAN-20260130-ASYNCTASK.P11 * * Execute async task in background using the SAME execution path as sync tasks. * The only difference is the foreground agent doesn't wait for completion. * - Interactive environment → runInteractive() with shared scheduler (tool calls show in UI) * - Non-interactive environment → runNonInteractive() */ private executeInBackground; } /** * Task tool that launches subagents via SubagentOrchestrator. * * @plan PLAN-20251029-SUBAGENTIC * @requirement REQ-SUBAGENTIC-001, REQ-SUBAGENTIC-002 */ export declare class TaskTool extends BaseDeclarativeTool { private readonly config; private readonly dependencies; static readonly Name = "task"; constructor(config: Config, dependencies?: TaskToolDependencies); protected validateToolParamValues(params: TaskToolParams): string | null; protected createInvocation(params: TaskToolParams): TaskToolInvocation; private normalizeParams; private ensureOrchestrator; } export {};