/** * QueryTrackerService — PROC-10 * * Tracks literary agent query submissions for a novel project. * Authors send query letters, synopses, and sample pages to literary agents; * this service records each submission and its current status. * * All persistence is via MCPClient SQL queries. */ import type { MCPClient } from '../core/database.js'; /** The lifecycle status of an agent query submission. */ export type QueryStatus = 'sent' | 'pending' | 'rejected' | 'partial_request' | 'full_request' | 'offer' | 'closed'; /** A single agent query record. */ export interface AgentQuery { id: string; projectId: string; agentName: string; agency?: string; queryDate: string; status: QueryStatus; responseDate?: string; notes?: string; /** e.g. ['query_letter', 'synopsis', 'first_10_pages'] */ materialsSent: string[]; createdAt: string; updatedAt: string; } /** Aggregate statistics for all queries on a project. */ export interface QueryStats { total: number; byStatus: Record; /** Average calendar days from queryDate to responseDate; null if no responses yet. */ avgResponseDays: number | null; /** (partial_request + full_request + offer) / total; null if total === 0. */ successRate: number | null; } export declare class QueryTrackerService { private readonly client; constructor(client: MCPClient); /** * Record a new agent query submission. * * @param projectId - The owning project id * @param agentName - Agent's full name (e.g. "Jane Smith") * @param opts - Optional agency, query date, materials sent, and notes * @returns The persisted AgentQuery record */ addQuery(projectId: string, agentName: string, opts?: { agency?: string; queryDate?: string; materialsSent?: string[]; notes?: string; }): Promise; /** * Return all agent queries for a project, optionally filtered by status. * * @param projectId - The owning project id * @param filter - Optional status filter */ listQueries(projectId: string, filter?: { status?: QueryStatus; }): Promise; /** * Update mutable fields on an existing query record. * `updatedAt` is always refreshed. * * @param id - Primary key of the record to update * @param fields - Partial patch of status, responseDate, and/or notes */ updateQuery(id: string, fields: Partial>): Promise; /** * Compute aggregate statistics for all queries in a project. * * - `byStatus` counts every QueryStatus (0 if none found) * - `avgResponseDays` is the mean calendar days from queryDate → responseDate * for queries that have a responseDate set; null otherwise * - `successRate` is (partial_request + full_request + offer) / total; null if total === 0 */ getStats(projectId: string): Promise; /** * Build a query package directory under `/export/query-package/` * containing an `-query.md` template file. * * The template includes: * - A query letter placeholder header * - The first 500 words of `export/synopsis-short.md` (if it exists) * - The first 10 non-empty paragraphs from the first chapter file (if found) * * @param projectId - The owning project id (used for query lookup) * @param projectPath - Absolute path to the novel project directory * @param agentName - Name of the agent; used to derive the filename * @returns The absolute path to the created `.md` file */ exportQueryPackage(projectId: string, projectPath: string, agentName: string): Promise; } //# sourceMappingURL=query-tracker-service.d.ts.map