import type { ActorDirectoryInput, ActorDirectoryPage } from '../actor-directory.js'; import type { BookmarkRepository } from '../bookmarks.js'; import type { SearchInput, SearchPage } from '../search.js'; import type { NotificationRepository } from '../notifications.js'; import type { ParticipationRepository } from '../participation.js'; import type { MutationReceipt } from '../mutation-receipts.js'; import type { ActorRef, AddressableActor, RecordAuthority } from '../policy.js'; import type { ActorIdentity, AgentProfile, AgentRuntimeBinding, ChangePage, ItemListInput, JsonValue, PostAcknowledgment, PostRoster, ItemSummary, KudosListInput, KudosSummary, SynomemConfig, SynomemEvent, Page, RecordKind, Topic, } from '../types.js'; /** * Operations required by authoritative domain behavior. * * This is the first extraction seam around the synchronous SQLite implementation. A later R2 step * replaces callback transactions with asynchronous atomic commit operations suitable for both * local SQLite and remote service implementations. */ export interface SynomemRepository { search?(input: SearchInput, actor: ActorIdentity): Promise; readonly bookmarks: BookmarkRepository; readonly config: SynomemConfig; readonly notifications: NotificationRepository; readonly participation: ParticipationRepository; setAuthority(authority: RecordAuthority): void; init(): Awaitable; close(): Awaitable; assertEventCompatibility(): Awaitable; transaction(operation: () => Awaitable): Promise; insertEvent(event: SynomemEvent): Awaitable; nextAggregateVersion(aggregateId: string): Awaitable; getEventByIdempotency( actorKind: ActorIdentity['kind'], actorId: string, key: string, ): Awaitable; getReadableSynomemEvents(kudosId: string): Awaitable; getReadableItemEvents(id: string): Awaitable; getMutationReceipt( actorKind: string, actorId: string, keyHash: string, ): Awaitable; insertMutationReceipt( actorKind: string, actorId: string, keyHash: string, receipt: MutationReceipt, ): Awaitable; compactMutationReceipts(before: string): Awaitable; canActorReadItem(id: string, actor: ActorRef): Awaitable; getActor(ref: ActorRef): Awaitable; actorCounts( target: ActorRef, viewer: ActorIdentity, ): Awaitable<{ kudosReceived: number; usefulReceived: number }>; listActors(input: ActorDirectoryInput, viewer: ActorIdentity): Awaitable; registerHuman(actor: AddressableActor): Awaitable; insertAgent(profile: AgentProfile): Awaitable; updateAgent(profile: AgentProfile, updatedAt: string): Awaitable; getAgent(idOrAlias: string): Awaitable; listAgents(): Awaitable; /** Resolves a name case-insensitively, reporting ambiguity instead of guessing. */ resolveAgent(query: string): Awaitable<{ match?: AgentProfile; candidates: AgentProfile[] }>; listPostAcknowledgments(postId: string): Awaitable; /** Who has acknowledged a post and who has not; see PostRoster. */ postRoster(postId: string): Awaitable; listRuntimeBindings(agentId: string): Awaitable; bindRuntime(binding: { id: string; agentId: string; installationId?: string; runtime: string; profile?: string; capabilities?: Record; boundAt: string; }): Awaitable; unbindRuntime(bindingId: string): Awaitable; touchRuntimeBinding(agentId: string, runtime: string, at: string): Awaitable; insertTopic(topic: Topic): Awaitable; updateTopic(topic: Topic, updatedAt: string): Awaitable; getTopic(idOrAlias: string): Awaitable; listTopics(status?: 'active' | 'archived'): Awaitable; /** Resolves a name case-insensitively, reporting ambiguity instead of guessing. */ resolveTopic(query: string): Awaitable<{ match?: Topic; candidates: Topic[] }>; listKudosSummaries( input: Required> & KudosListInput, viewer: ActorIdentity, ): Awaitable>; listKudosChanges( after: string | undefined, limit: number, viewer: ActorIdentity, ): Awaitable; listItemSummaries( input: Required> & ItemListInput, viewer: ActorIdentity, ): Awaitable>; listItemChanges( after: string | undefined, limit: number, viewer: ActorIdentity, kinds?: RecordKind[], ): Awaitable; getItemSummary(id: string): Awaitable; } export type Awaitable = T | Promise;