import { TeamshareApi } from '../api'; export declare const DEFAULT_LLM_BASE_URL = "https://api.openai.com/v1"; export declare const DEFAULT_LLM_MODEL = "deepseek-chat"; interface ToolDef { name: string; description: string; parameters: Record; } export interface LlmResult { summary: string; iterations: number; tokensUsed: number; finishedBy: 'no-tool-call' | 'max-iterations' | 'task-done'; } export interface LlmOptions { baseUrl: string; apiKey: string; model: string; agentName: string; systemPrompt?: string | null; /** Sampling temperature (0-2). Default 0.2 (Phase D). */ temperature?: number; /** Token budget for the completion (Phase D). */ maxTokens?: number; /** Resume a previous --self session for this task (Phase E, IMP-540). */ continue?: boolean; /** * The agent's own TeamShare user id. Lets the agent assign tasks/subtasks * to itself: create_task/update_task accept assigneeId "me"/"self" which * resolve to this id. Injected from GET /agents/:id/settings (userId). */ agentUserId?: string; } /** * Phase B ask-human (IMP-530): markers + polling for the `--self` loop. * The MCP server implements the same contract for opencode sessions. */ export declare const QUESTION_MARKER = "[question]"; 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; 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; }[]; export declare function runLlmSession(api: TeamshareApi, taskId: string, brief: string, opts: LlmOptions, projectId?: string): Promise; /** * Project-level tool loop (chat mentions): same as runLlmSession but * conversational — no task brief, no continuation persistence, no status * checks. Used when the agent is @mentioned in project chat and the * --self/harness=none loop fires with full MCP tools. * * Returns the final reply text. */ export declare function runProjectSession(api: TeamshareApi, projectId: string, prompt: string, opts: LlmOptions, projectName?: string): Promise; /** * Document-assistant self-mode session (IMP-9xx): identical tool loop to * {@link runProjectSession} but framed around ONE document. Lets a doc * comment mention trigger real actions (create_task, add_comment, search…) * even without an installed harness - parity with what the harness path * gets through the per-session MCP config. */ export declare function runDocumentSession(api: TeamshareApi, ctx: { projectId: string; documentId: string; }, prompt: string, opts: LlmOptions): Promise; /** True when this endpoint is the OpenRouter API gateway. */ export declare function isOpenRouterUrl(baseUrl: string): boolean; /** * OpenRouter attribution headers: `HTTP-Referer` + `X-Title` feed the * gateway's app rankings and let OpenRouter-side logs identify the caller. * Injected ONLY for openrouter.ai base URLs - every other provider would see * them as unknown headers. */ export declare function gatewayHeaders(baseUrl: string): Record; /** * Single-shot chat completion (no tools) - used by the chat-reply loop to * draft a reply to a mention and by the run-report writer. Same env * contract as `--self`. `system` overrides the default chat assistant * persona (e.g. for markdown report generation). */ export declare function complete(prompt: string, opts: Pick, system?: string): Promise; /** * Phase C streaming (IMP-530): OpenAI-compatible SSE `chat/completions` * (stream: true). Calls `onToken` with each content delta as it arrives; * resolves with the full trimmed reply. Works with any OpenAI-compatible * provider (Gemini, DeepSeek, OpenAI, Groq, OpenRouter, Mistral). */ export declare function completeStream(prompt: string, opts: Pick, onToken: (delta: string) => void): Promise; export {};