/** * Tool catalog for the headless LLM loops: `buildTools` (get_task, * create_document, ask_human, ...) plus the ask-human markers and helpers * it needs. Split out of llm.ts (1200-line-per-file rule). */ import { TeamshareApi } from '../api'; import type { ToolDef } from './llm-core'; /** * Phase B ask-human (IMP-530): markers for the `--self` loop. * * THE MCP SERVER IS THE CONTRACT. `ask_human` / `wait_for_answer` exist twice - * here and in `teamshare-backend/src/modules/mcp/tools/human.ts` - and an agent * cannot tell which one it was handed. They used to disagree twice over, both * silently: this one returned immediately with `{pending:true}` while MCP * blocked for three minutes, and this one defaulted to a FIFTEEN minute wait * budget against MCP's three. Two numbers and two shapes for one tool name is * how an agent ends up polling something that never answers. Everything below * now mirrors MCP exactly: same four statuses, same 180s budget, same retry * hint. */ export declare const QUESTION_MARKER = "[question]"; /** The channel name `ask_human` posts to. Must match the backend constant. */ export declare const AGENT_QUESTIONS_CHANNEL = "agent-questions"; /** Must equal `QUESTION_WAIT_BUDGET_SEC` in ask-questions.service.ts. */ export declare const ASK_WAIT_BUDGET_MS = 180000; /** Smallest gap we ever suggest between two `wait_for_answer` calls. */ export declare const ASK_MIN_RETRY_SEC = 10; export interface ToolSessionContext { /** * When set, project-scoped tools (create_task, list/create/read document) * are PINNED to this project: any projectId the model supplies is ignored * in favor of it. Chat mentions and task runs always set this so agents * can never create tasks in a project other than the one they were called * from. */ defaultProjectId?: string; /** * Chat channel this session replies in (2026-10). Pins `post_chat_message` * the way `defaultProjectId` pins project-scoped tools: without it a * `--self` reply in a non-General channel lands in General (the server * default), and the scoped runner then posts a second copy in the right * channel - the duplicate-reply incident. */ defaultChannelId?: string; askTimeoutMs?: number; /** The agent's own user id; "me"/"self" in assigneeId resolve to it. */ agentUserId?: string; } export declare function buildTools(api: TeamshareApi, ctx?: ToolSessionContext | number): { def: ToolDef; run: (args: Record) => Promise; }[];