import { TaskEndpoints } from './api-tasks'; import type { Document, DocumentFolderNode, DocumentJob, SimilarRow } from './api-types'; export declare class ContentEndpoints extends TaskEndpoints { /** Full project context (all sections + version). */ getProjectContext(projectId: string): Promise<{ overview: string | null; architecture: string | null; structure: string | null; workflows: string | null; conventions: string | null; gotchas: string | null; repoMapHash: string | null; /** Multi-folder pool: THIS identity's slice hash (drift detection). */ myRepoMapHash?: string | null; version: number; updatedAt: string; }>; /** Compact context digest injected into session briefs (may be empty). */ getProjectContextDigest(projectId: string): Promise<{ digest: string; }>; /** * Push a freshly scanned repo map into the project's cloud context * (structure section + optional workflows + tree hash). */ pushRepoMap(projectId: string, payload: { repoMapHash: string; structure: string; workflows?: string | null; filesSeen?: number; }): Promise<{ ok: boolean; version: number; }>; /** * Register a git repository on the server (multi-repo support). * Called by the bridge when linking a parent folder with discovered sub-repos. */ registerRepository(projectId: string, input: { name?: string; originUrl: string; defaultBranch?: string; remoteName?: string; provider?: string; }): Promise<{ id: string; projectId: string; originUrl: string; defaultBranch: string; }>; /** Partial section update (optimistic baseVersion check server-side). */ updateProjectContext(projectId: string, payload: Record): Promise<{ ok: boolean; version: number; }>; getProject(projectId: string): Promise<{ id: string; name: string; status: string; /** Per-project working folder override for agents (null = none). */ folderPath?: string | null; /** IMP-914: agent git automation level ('none'|'commit'|'push'|'pr'). */ agentGitPolicy?: string | null; /** * Project-wide base branch (2026-12). Every run branches from it and every * PR targets it. Null = the branch the linked folder is on. */ gitBaseBranch?: string | null; /** * Chat/assistant context budget in tokens (2026-12). Null = the bridge's * 400k default. Chat/document/board assistants rotate their harness session * when the conversation reaches it. */ chatMaxContextTokens?: number | null; }>; /** Per-user folder links for a project (junction table). */ getLinkedFolders(projectId: string): Promise<{ items: Array<{ userId: string; path: string; name?: string; avatarUrl?: string; }>; }>; listDocuments(projectId: string, folderPath?: string): Promise<{ items: Document[]; }>; /** Virtual folder tree of a project (IMP-601). */ listDocumentFolders(projectId: string): Promise<{ folders: DocumentFolderNode[]; }>; /** Raw markdown body of a note document (IMP-601). */ getDocumentRaw(documentId: string): Promise<{ id: string; name: string; content: string; mime: string; }>; /** Creates a markdown note document (documents-driven workflow, IMP-601). */ createNoteDocument(dto: { projectId: string; name: string; content: string; folderPath?: string; }): Promise; /** * Per-run report (2026-10): the backend composes the detailed report * (Summary, What changed, Where to find it, Verification, Notes & risks, * Run facts), saves it as a note in `agents//tasks/` and * attaches it to the task. One report per run (`runKey`); completed runs * only. Falls back to a direct note write when the backend is older than * the endpoint (404) so a report is never lost to a version skew. */ createRunReport(dto: { taskId?: string; toolRunId?: string; workflowRunId?: string; projectId?: string; mode: 'run' | 'build' | 'orchestrator' | 'plan' | 'tool' | 'workflow'; runKey: string; status?: string; title?: string; summary?: string; narrative?: string; workedOn?: string[]; changedPaths?: string[]; verification?: string[]; notes?: string[]; git?: { branch?: string; sha?: string; prUrl?: string; gitLine?: string; }; startedAt?: string; finishedAt?: string; }): Promise<{ id: string; name: string; folderPath: string; taskUrl: string; documentUrl: string; }>; /** * Agent-created Word document: the backend renders markdown to a .docx * file, uploads it to Cloudinary and records it as a file document. * Styling options match the tools-tab DOCX Report form so every path * (harness MCP, self mode, Tools tab) produces the same document. */ createRenderedDocument(dto: { projectId: string; name: string; content: string; folderPath?: string; subtitle?: string; author?: string; accentColor?: string; includeToc?: boolean; pageSize?: 'a4' | 'letter'; }): Promise; /** * Agent-created Excel workbook: the backend renders a structured table * spec to a styled .xlsx file and records it as a file document. */ createXlsxDocument(dto: { projectId: string; name: string; sheets: Array<{ name?: string; headers?: string[]; rows?: (string | number)[][]; freezeHeader?: boolean; columnWidths?: number[]; }>; folderPath?: string; }): Promise; /** * Downloads a public URL server-side and records it as a project file * document (research / file-harvester "download for me"). */ importFileFromUrl(dto: { projectId: string; url: string; name?: string; mime?: string; folderPath?: string; }): Promise; /** Replaces the markdown body of a note document (IMP-601). */ updateDocumentContent(documentId: string, content: string): Promise; getDocument(documentId: string): Promise<{ id: string; type: 'link' | 'file' | 'note'; name: string; urlOrKey?: string | null; projectId: string; mime?: string | null; folderPath?: string; createdAt: string; }>; /** Phase F: extracted text for office/PDF documents. */ getDocumentExtract(documentId: string): Promise<{ text: string; truncated: boolean; format: string; cached: boolean; }>; listQueuedDocumentJobs(projectId: string): Promise; claimDocumentJob(jobId: string): Promise; markDocumentJobProcessing(jobId: string): Promise<{ ok: boolean; }>; /** * Reserve a storage slot for this job's output. * * `assetId` is the identifier to report back: the API minted the public id before * the upload, so it owns the resulting URL and verifies the bytes itself. A bridge * that receives no `assetId` is talking to an older API and should fail loudly * rather than fall back to sending a URL. */ jobUploadUrl(jobId: string): Promise<{ assetId: string; uploadUrl: string; folder: string; formParams: Record; }>; completeDocumentJob(jobId: string, body: { html?: string; /** Reserved slot the bytes were uploaded into. */ assetId?: string; mime?: string; size?: number; name?: string; /** Pre-flight verdict: constructs the merge cannot preserve. */ unsupported?: string[]; /** Preservation report recorded on the resulting version. */ comment?: string; }): Promise<{ job: DocumentJob; versionNumber?: number; }>; failDocumentJob(jobId: string, error: string): Promise<{ job: DocumentJob; }>; /** * Downloads a document. Link docs return { url }; local files return plain * text; Cloudinary-hosted files return { url } (fetchable by the caller); * note documents return their markdown body (IMP-601). */ getDocumentContent(doc: Document): Promise; search(q: string, type?: string): Promise>>; /** * Similar prior work (tasks + documents) for a task, ranked by pg_trgm. * Compact rows only — fetch content with read_document / get_task. */ relatedForTask(taskId: string, limit?: number): Promise; /** Similar prior work (tasks + documents) for a tool run. */ relatedForRun(runId: string, limit?: number): Promise; /** Fuzzy similarity lookup by free-text subject. */ findSimilar(params: { q: string; projectId: string; type?: 'all' | 'task' | 'document'; limit?: number; threshold?: number; }): Promise; listChatMessages(projectId: string, page?: number, pageSize?: number, aroundMessageId?: string, channelId?: string): Promise>; /** * Strip harness JSON events that the LLM sometimes echoes as reply text. * Removes lines matching {"type":"step_start",...}, {"type":"tool_use",...}, * {"type":"step_finish",...} etc. from opencode --format json output. */ private stripHarnessEvents; postChatMessage(projectId: string, body: string, channelId?: string, /** * Thread the post under a message (2026-11). A reply to an agent is * answered IN that thread; the backend stores it as `replyToId`. */ replyToId?: string): Promise>; /** Chat channels of a project (used to find/create `#agent-questions`). */ listChatChannels(projectId: string): Promise>; /** Creates a named channel; CHANNEL_NAME_TAKEN when it already exists. */ createChatChannel(projectId: string, name: string, description?: string): Promise<{ id: string; projectId: string; name: string; createdById: string; createdAt: string; }>; }