/** * Agent discovery and configuration */ import { type ModelScopeConfig } from "../runs/shared/model-scope.ts"; import type { AcceptanceInput, AcceptanceRole, AgentRunnerConfig, OutputMode, ToolBudgetConfig, TurnBudgetConfig } from "../shared/types.ts"; export { buildRuntimeName, frontmatterNameForConfig, parsePackageName } from "./identity.ts"; import { type PermissionRules } from "../runs/shared/permissions.ts"; export type AgentScope = "user" | "project" | "both"; export type AgentSource = "builtin" | "package" | "user" | "project"; type SystemPromptMode = "append" | "replace"; export type AgentDefaultContext = "fresh" | "fork"; export type AgentMemoryScope = "project" | "user"; export interface AgentMemoryConfig { scope: AgentMemoryScope; path: string; } export declare const BUILTIN_AGENT_NAMES: readonly ["advisor", "delegate", "fanout", "oracle", "researcher", "reviewer", "scout", "worker", "workflow-worker"]; export declare function defaultSystemPromptMode(name: string): SystemPromptMode; export declare function defaultInheritProjectContext(name: string): boolean; export declare function defaultInheritSkills(): boolean; export interface BuiltinAgentOverrideBase { description?: string; model?: string; fallbackModels?: string[]; thinking?: string | false; systemPromptMode: SystemPromptMode; inheritProjectContext: boolean; inheritSkills: boolean; defaultContext?: AgentDefaultContext; acceptanceRole?: AcceptanceRole; disabled?: boolean; systemPrompt: string; skills?: string[]; skillPath?: string[]; tools?: string[]; mcpDirectTools?: string[]; extensions?: string[]; subagentOnlyExtensions?: string[]; completionGuard?: boolean; toolBudget?: ToolBudgetConfig; } interface BuiltinAgentOverrideConfig { description?: string; model?: string | false; fallbackModels?: string[] | false; thinking?: string | false; systemPromptMode?: SystemPromptMode; inheritProjectContext?: boolean; inheritSkills?: boolean; defaultContext?: AgentDefaultContext | false; acceptanceRole?: AcceptanceRole | false; disabled?: boolean; systemPrompt?: string; skills?: string[] | false; tools?: string[] | false; extensions?: string[] | false; subagentOnlyExtensions?: string[] | false; completionGuard?: boolean; toolBudget?: ToolBudgetConfig | false; } interface BuiltinAgentOverrideInfo { scope: "user" | "project"; path: string; base: BuiltinAgentOverrideBase; } export interface AgentModelSourceInfo { type: "subagents.defaultModel"; scope: "user" | "project"; path: string; model: string; } export interface AgentConfig { name: string; runner?: AgentRunnerConfig; localName?: string; packageName?: string; description: string; aliases?: string[]; tools?: string[]; mcpDirectTools?: string[]; model?: string; fallbackModels?: string[]; thinking?: string | false; systemPromptMode: SystemPromptMode; inheritProjectContext: boolean; inheritSkills: boolean; defaultContext?: AgentDefaultContext; defaultAsync?: boolean; defaultTimeoutMs?: number; defaultTurnBudget?: TurnBudgetConfig; defaultAcceptance?: AcceptanceInput; acceptanceRole?: AcceptanceRole; systemPrompt: string; source: AgentSource; filePath: string; skills?: string[]; skillPath?: string[]; extensions?: string[]; extensionsFromDefault?: boolean; subagentOnlyExtensions?: string[]; output?: string; defaultReads?: string[]; defaultProgress?: boolean; interactive?: boolean; maxSubagentDepth?: number; completionGuard?: boolean; toolBudget?: ToolBudgetConfig; permissions?: PermissionRules; memory?: AgentMemoryConfig; disabled?: boolean; extraFields?: Record; override?: BuiltinAgentOverrideInfo; modelSource?: AgentModelSourceInfo; } export interface ChainStepConfig { agent?: string; task?: string; phase?: string; label?: string; as?: string; outputSchema?: string | Record; output?: string | false; outputMode?: OutputMode; reads?: string[] | false; model?: string; skills?: string[] | false; progress?: boolean; parallel?: unknown; expand?: unknown; collect?: unknown; concurrency?: number; failFast?: boolean; worktree?: boolean; acceptance?: AcceptanceInput; toolBudget?: ToolBudgetConfig; } export interface ChainConfig { name: string; localName?: string; packageName?: string; description: string; source: AgentSource; filePath: string; steps: ChainStepConfig[]; extraFields?: Record; } export interface ChainDiscoveryDiagnostic { source: AgentSource; filePath: string; error: string; } interface AgentDiscoveryResult { agents: AgentConfig[]; projectAgentsDir: string | null; modelScope?: ModelScopeConfig; } export declare function resolveAgentName(name: string, agents: AgentConfig[]): { agent?: AgentConfig; error?: string; }; export declare function findNearestProjectRoot(cwd: string): string | null; export declare function agentHasFrontmatterField(agent: AgentConfig, ...fields: string[]): boolean; export declare function buildBuiltinOverrideConfig(base: BuiltinAgentOverrideBase, draft: Pick & Partial>): BuiltinAgentOverrideConfig | undefined; export declare function saveBuiltinAgentOverride(cwd: string, name: string, scope: "user" | "project", override: BuiltinAgentOverrideConfig): string; export declare function removeBuiltinAgentOverride(cwd: string, name: string, scope: "user" | "project"): { path: string; removed: boolean; }; export declare function mergeBuiltinAgentOverride(cwd: string, name: string, scope: "user" | "project", fields: BuiltinAgentOverrideConfig): string; export declare function removeBuiltinAgentOverrideFields(cwd: string, name: string, scope: "user" | "project", fields: string[]): { path: string; removed: boolean; }; export declare function resolveBuiltinAgentsDir(moduleDir: string): string; export declare const EXTRA_AGENT_DIRS_ENV = "PI_SUBAGENT_EXTRA_AGENT_DIRS"; export declare function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryResult; export declare function discoverAgentsAll(cwd: string): { builtin: AgentConfig[]; package: AgentConfig[]; user: AgentConfig[]; project: AgentConfig[]; chains: ChainConfig[]; chainDiagnostics: ChainDiscoveryDiagnostic[]; userDir: string; projectDir: string | null; userChainDir: string; projectChainDir: string | null; userSettingsPath: string; projectSettingsPath: string | null; }; //# sourceMappingURL=agents.d.ts.map