import type { ToolDef } from "../../providers/types.js"; import type { ToolHandler } from "./handlers.js"; import type { GraphClient } from "../../graph/client.js"; import type { GraphFallback } from "../../graph/fallback.js"; import type { BoberToolDefinition } from "../../mcp/tools/registry.js"; import type { BoberConfig } from "../../config/schema.js"; export type { ToolHandler } from "./handlers.js"; /** * All agent roles understood by the orchestrator. * The original 3 roles (planner, generator, evaluator) are preserved for backcompat. * The 5 extended roles are used by sprint 5 GraphToolGate. */ export type AgentRole = "planner" | "researcher-phase1" | "researcher-phase2" | "curator" | "architect" | "generator" | "evaluator"; export interface ToolSet { /** Tool schemas to pass to the LLM client. Provider-agnostic ToolDef format. */ schemas: ToolDef[]; /** Handler functions keyed by tool name. */ handlers: Map; } /** * Graph-gating context snapshot for resolveRoleTools. * Produced by getGraphState() — all deps are passed in (pure function). */ export interface GraphState { graphEnabled: boolean; engineHealth: "ready" | "starting" | "restarting" | "broken" | "disabled"; } /** * Static baseline tool-name map for each agent role. * * @deprecated Use `resolveRoleTools(role, projectRoot, ctx, graphDeps?)` for * new code. This map is kept as a backcompat export (0.12.0 surface). * Its three original entries (planner / generator / evaluator) MUST NOT be * modified — external consumers depend on the exact array contents. * The 4 new entries (researcher-phase1, researcher-phase2, curator, architect) * reflect the ungated (graph-disabled) tool surface for those roles. */ export declare const ROLE_TOOLS: Record; /** * Build a tool set for a specific agent role. * * Returns only the tools appropriate for that role: * - **planner**: read_file, glob, grep (read-only, no execution) * - **generator**: all 6 tools (full filesystem + bash access) * - **evaluator**: bash, read_file, glob, grep (can run commands, cannot write/edit files) * * @deprecated Prefer `resolveRoleTools(role, projectRoot, ctx, graphDeps?)` for new * call sites — it supports graph-gated tool selection (ADR-8). `buildToolSet` * is kept for backcompat and always returns the ungated (static) tool set. */ export declare function buildToolSet(role: AgentRole, projectRoot: string): ToolSet; /** * Returns the 6 graph_* tool definitions for use by the internal * orchestrator. DRY: consumes the same factory as the external MCP server. */ export declare function getGraphInternalTools(client: GraphClient, fallback: GraphFallback): BoberToolDefinition[]; /** * Snapshot the current graph-pipeline state for tool-surface gating. * * Safe to call before `graphPipelineLifecycle.start()` — returns * `{graphEnabled: false, engineHealth: 'disabled'}` in that case. * * @param config Optional bober configuration. When absent, graphEnabled=false. */ export declare function getGraphState(config?: BoberConfig): GraphState; /** * Return the graph client + fallback when the engine is 'ready', otherwise null. * Convenience wrapper over graphPipelineLifecycle.getGraphDeps(). */ export declare function getGraphDeps(): { client: GraphClient; fallback: GraphFallback; } | null; /** * Build the runtime tool set for a given agent role. * * When `ctx.graphEnabled === true` AND `ctx.engineHealth === 'ready'`, * applies ADR-8 gating: * - Roles `researcher-phase2`, `curator`, `architect`: removes bash/grep/glob, * adds the 6 graph_* tools (read_file is retained). * - Roles `generator`, `evaluator`: UNION — keeps all original tools AND adds * the 6 graph_* tools (agent chooses which to use). * * All other conditions return the unchanged static ROLE_TOOLS set (zero * behavior change from 0.12.0). * * @param role Agent role string. * @param projectRoot Absolute project root for filesystem-tool sandboxing. * @param ctx Graph-gating context from getGraphState(). When absent, * defaults to ungated (defensive). * @param graphDeps Required only when ctx triggers gating: { client, fallback }. * If omitted while gated, falls back to ungated (defensive). * @returns A ToolSet with schemas + handlers. * @throws If role is not in ROLE_TOOLS (unknown role). */ export declare function resolveRoleTools(role: AgentRole, projectRoot: string, ctx?: { graphEnabled: boolean; engineHealth?: string; }, graphDeps?: { client: GraphClient; fallback: GraphFallback; }): ToolSet; //# sourceMappingURL=index.d.ts.map