import type { SignedCursorCodec } from './cursors.js'; import type { ActorRef } from './policy.js'; import type { ActorIdentity, SynomemEvent } from './types.js'; import type { ParticipationRepository, ReplyRecord, ThreadInput, ThreadPage, ReactionCode, ReactionSummary } from './participation.js'; export interface ParticipationBudgets { reply: { minute: number; hour: number; workspaceDay: number; }; reaction: { minute: number; hour: number; workspaceDay: number; }; } export declare const defaultParticipationBudgets: ParticipationBudgets; export declare function validateParticipationBudgets(budgets: ParticipationBudgets): ParticipationBudgets; /** Trusted storage adapter. SQL uses positional question marks; hosted adapters bind parameters. */ export interface ParticipationSql { query(sql: string, values: unknown[]): Promise>>; execute(sql: string, values: unknown[]): Promise; codec(): SignedCursorCodec; workspaceId: string; budgets?: ParticipationBudgets; } export declare const participationTables = "\nCREATE TABLE replies_current (\n workspace_id TEXT NOT NULL, reply_id TEXT NOT NULL, root_id TEXT NOT NULL, parent_id TEXT,\n author_json TEXT NOT NULL, created_at TEXT NOT NULL, created_sequence BIGINT NOT NULL,\n updated_sequence BIGINT NOT NULL, version INTEGER NOT NULL, body TEXT, mentions_json TEXT NOT NULL,\n deleted_at TEXT, PRIMARY KEY(workspace_id,reply_id), UNIQUE(workspace_id,root_id,reply_id),\n FOREIGN KEY(workspace_id,root_id,parent_id) REFERENCES replies_current(workspace_id,root_id,reply_id)\n);\nCREATE INDEX replies_root_sequence ON replies_current(workspace_id,root_id,created_sequence,reply_id);\nCREATE INDEX replies_root_changes ON replies_current(workspace_id,root_id,updated_sequence,reply_id);\nCREATE TABLE thread_entries (\n workspace_id TEXT NOT NULL, root_id TEXT NOT NULL, event_id TEXT NOT NULL, sequence BIGINT NOT NULL,\n PRIMARY KEY(workspace_id,event_id)\n);\nCREATE INDEX thread_entries_root_sequence ON thread_entries(workspace_id,root_id,sequence,event_id);\nCREATE TABLE thread_members (\n workspace_id TEXT NOT NULL, root_id TEXT NOT NULL, actor_kind TEXT NOT NULL, actor_id TEXT NOT NULL,\n following INTEGER NOT NULL CHECK(following IN (0,1)), muted INTEGER NOT NULL CHECK(muted IN (0,1)),\n last_read_sequence BIGINT NOT NULL DEFAULT 0, joined_sequence BIGINT NOT NULL DEFAULT 0,\n PRIMARY KEY(workspace_id,root_id,actor_kind,actor_id)\n);\nCREATE TABLE reactions_current (\n workspace_id TEXT NOT NULL, target_id TEXT NOT NULL, root_id TEXT NOT NULL,\n actor_kind TEXT NOT NULL, actor_id TEXT NOT NULL, code TEXT NOT NULL,\n event_id TEXT NOT NULL, created_at TEXT NOT NULL,\n PRIMARY KEY(workspace_id,target_id,actor_kind,actor_id,code)\n);\nCREATE INDEX reactions_root ON reactions_current(workspace_id,root_id,target_id);\nCREATE TABLE record_mentions (\n workspace_id TEXT NOT NULL,source_event_id TEXT NOT NULL,root_id TEXT NOT NULL,reply_id TEXT,\n mentioned_kind TEXT NOT NULL,mentioned_id TEXT NOT NULL,\n PRIMARY KEY(workspace_id,source_event_id,mentioned_kind,mentioned_id)\n);\nCREATE INDEX record_mentions_root ON record_mentions(workspace_id,root_id,source_event_id);\nCREATE TABLE mutation_budgets (\n workspace_id TEXT NOT NULL, bucket_key TEXT NOT NULL, bucket_start BIGINT NOT NULL,\n window_seconds INTEGER NOT NULL, used INTEGER NOT NULL,\n PRIMARY KEY(workspace_id,bucket_key,bucket_start,window_seconds)\n);\nCREATE INDEX mutation_budgets_retention ON mutation_budgets(workspace_id,bucket_start);\n"; export declare class SqlParticipationRepository implements ParticipationRepository { private readonly sql; constructor(sql: ParticipationSql); private get workspace(); apply(event: SynomemEvent, sequence: bigint, replay?: boolean): Promise; getReply(id: string): Promise; thread(input: ThreadInput, actor: ActorIdentity, purpose?: string): Promise; changes(input: ThreadInput, actor: ActorIdentity): Promise; read(rootId: string, through: string, actor: ActorRef): Promise; hasReaction(targetId: string, actor: ActorRef, code: ReactionCode): Promise; reactions(targetId: string, actor: ActorRef): Promise; subscription(rootId: string, actor: ActorRef, following: boolean, muted: boolean): Promise; reserveBudget(kind: 'reply' | 'reaction', actor: ActorRef, at: string): Promise; } export declare function participationStatements(event: SynomemEvent, sequence: bigint, workspace: string): Array<{ sql: string; values: unknown[]; }>; //# sourceMappingURL=participation-repository.d.ts.map