import type { ActorDirectoryInput, ActorDirectoryPage, ActorProfile, ActorProfileInput, } from './actor-directory.js'; import type { BookmarkInput, BookmarkPage } from './bookmarks.js'; import type { SearchInput, SearchPage } from './search.js'; import type { NotificationInput, NotificationPage } from './notifications.js'; import type { ReplyCreateInput, ReplyDeleteInput, ReplyRecord, ReactionSetInput, ReactionSummary, ThreadInput, ThreadPage, } from './participation.js'; import type { OverrideTaskDecisionInput } from './types.js'; import type { ActorRef, AddressableActor } from './policy.js'; import type { ActorIdentity, AgentDirectoryEntry, AgentProfile, CreatePostInput, PostRecord, PostRoster, UpdatePostInput, AgentResolution, AgentRuntimeBinding, BindRuntimeInput, ChangePage, ChangesInput, CreateAgentInput, CreateNoteInput, CreateNoteResult, CreateTaskInput, CreateTodoInput, CreateTodoResult, CreateTaskResult, DoctorResult, ProjectionStatus, GiveKudosInput, GiveKudosResult, ItemListInput, ItemRecord, ItemSummary, KudosChangesInput, KudosListInput, KudosRecord, KudosStats, KudosSummary, MemoRecord, SynomemClientOptions, SynomemEvent, NoteRecord, Page, ReviseNoteInput, SendMemoInput, SendMemoResult, TaskRecord, TodoRecord, UpdateAgentInput, UpdateTaskInput, UpdateTodoInput, Topic, CreateTopicInput, UpdateTopicInput, TopicListInput, TopicResolution, } from './types.js'; export interface SynomemServiceCapabilities { backend: 'local' | 'remote'; participation?: { version: 2; replies: boolean; reactions: boolean; personalInbox: boolean; search?: boolean; canWrite: boolean; administrator: boolean; managedAgentIds: string[]; }; binding: { workspaceId: string; actor: ActorIdentity; /** The stable context this service is bound to, when the backend reports one. */ contextId?: string; }; administration: { agentCreationViaMcp: boolean; agentArchiveViaMcp: boolean; rebuildViaMcp: boolean; }; projections: { writeWinsMarkdown: boolean; writeMemoryMarkdown: boolean; writeTasksMarkdown: boolean; writeInboxEntries: boolean; }; } export type SynomemServiceInfo = | { backend: 'local'; home: string; databasePath: string } | { backend: 'remote'; baseUrl: string; workspaceId: string }; export interface ProjectionRebuildResult { generated: string[]; removed: string[]; } export interface SynomemDomainService { readonly bookmarks: { list(input?: BookmarkInput): Promise; has(rootId: string): Promise<{ saved: boolean }>; set(input: { rootId: string; present: boolean }): Promise<{ saved: boolean }>; }; search(input: SearchInput): Promise; readonly notifications: { list(input?: NotificationInput): Promise; read(id: string): Promise; dismiss(id: string): Promise; readThrough(through: string): Promise; }; readonly replies: { changes(input: ThreadInput): Promise; create(input: ReplyCreateInput): Promise; get(id: string): Promise; delete(input: ReplyDeleteInput): Promise; }; readonly threads: { read(input: { rootId: string; through: string }): Promise; get(input: ThreadInput): Promise; subscription(input: { rootId: string; following: boolean; muted: boolean }): Promise; }; readonly reactions: { set(input: ReactionSetInput): Promise; get(targetId: string): Promise; }; readonly actor: ActorIdentity; readonly actors: { profile(input: ActorProfileInput): Promise; list(input?: ActorDirectoryInput): Promise; get(ref: ActorRef): Promise; registerHuman(input: { id: string; handle: string; displayName: string; }): Promise; }; readonly agents: { create(input: CreateAgentInput): Promise; update(id: string, changes: UpdateAgentInput): Promise; get(idOrAlias: string): Promise; list(): Promise; resolve(query: string): Promise; archive(idOrAlias: string): Promise; restore(idOrAlias: string): Promise; addAliases(idOrAlias: string, aliases: string[]): Promise; removeAliases(idOrAlias: string, aliases: string[]): Promise; directory(): Promise; bindings(idOrAlias: string): Promise; bindRuntime(input: BindRuntimeInput): Promise; unbindRuntime(bindingId: string): Promise; }; /** * A controlled, reusable subject a record can be filed under — one * canonical display name and a set of aliases, distinct from a tag. */ readonly topics: { create(input: CreateTopicInput): Promise; update(idOrAlias: string, changes: UpdateTopicInput): Promise; get(idOrAlias: string): Promise; list(input?: TopicListInput): Promise; resolve(query: string): Promise; archive(idOrAlias: string): Promise; restore(idOrAlias: string): Promise; }; readonly posts: { create(input: CreatePostInput): Promise<{ record: PostRecord; created: boolean; deduplicated: boolean; }>; list(input?: Omit): Promise>; get(id: string): Promise; update(input: UpdatePostInput): Promise; archive(input: { expectedVersion: number; postId: string; reason?: string; idempotencyKey?: string; }): Promise; acknowledge(input: { expectedVersion: number; postId: string; note?: string; idempotencyKey?: string; }): Promise; withdrawAcknowledgment(input: { expectedVersion: number; postId: string; reason?: string; idempotencyKey?: string; }): Promise; roster(postId: string): Promise; }; readonly kudos: { give(input: GiveKudosInput): Promise; list(input?: KudosListInput): Promise>; changes(input?: KudosChangesInput): Promise; get(id: string): Promise; acknowledge(input: { expectedVersion: number; kudosId: string; note?: string; idempotencyKey?: string; }): Promise; revoke(input: { expectedVersion: number; kudosId: string; reason: string; administrative?: boolean; idempotencyKey?: string; }): Promise; }; readonly memos: { send(input: SendMemoInput): Promise; list(input?: Omit): Promise>; get(id: string): Promise; read(input: { expectedVersion: number; memoId: string; idempotencyKey?: string; }): Promise; archive(input: { expectedVersion: number; memoId: string; idempotencyKey?: string; }): Promise; }; readonly notes: { create(input: CreateNoteInput): Promise; list(input?: Omit): Promise>; get(id: string): Promise; revise(input: ReviseNoteInput): Promise; archive(input: { expectedVersion: number; noteId: string; idempotencyKey?: string; }): Promise; }; readonly tasks: { overrideDecision(input: OverrideTaskDecisionInput): Promise; create(input: CreateTaskInput): Promise; list(input?: Omit): Promise>; get(id: string): Promise; update(input: UpdateTaskInput): Promise; accept(input: { expectedVersion: number; taskId: string; /** Optional: conditions, timing, or partial capability. */ response?: string; idempotencyKey?: string; }): Promise; reject(input: { expectedVersion: number; taskId: string; /** Required: a refusal the assigner cannot act on is barely an answer. */ response: string; idempotencyKey?: string; }): Promise; complete(input: { expectedVersion: number; taskId: string; note?: string; idempotencyKey?: string; }): Promise; reopen(input: { expectedVersion: number; taskId: string; idempotencyKey?: string; }): Promise; cancel(input: { expectedVersion: number; taskId: string; reason?: string; idempotencyKey?: string; }): Promise; }; /** * Private self-reminders. No assignee, no acceptance, owner-only reads. */ readonly todos: { create(input: CreateTodoInput): Promise; list(input?: Omit): Promise>; get(id: string): Promise; update(input: UpdateTodoInput): Promise; complete(input: { expectedVersion: number; todoId: string; note?: string; idempotencyKey?: string; }): Promise; reopen(input: { expectedVersion: number; todoId: string; idempotencyKey?: string; }): Promise; cancel(input: { expectedVersion: number; todoId: string; reason?: string; idempotencyKey?: string; }): Promise; archive(input: { expectedVersion: number; todoId: string; idempotencyKey?: string; }): Promise; }; /** * Unanswered and overdue discovery. Derived from durable events; never a * statement about whether an agent is reachable. */ readonly discovery: { unanswered( input?: Omit & { olderThanHours?: number }, ): Promise>; overdue( input?: Omit & { asOf?: string }, ): Promise>; }; readonly items: { list(input?: ItemListInput): Promise>; get(id: string): Promise; changes(input?: ChangesInput): Promise; }; init(): Promise; close(): Promise; stats(input?: KudosListInput): Promise; } export interface SynomemService extends SynomemDomainService { doctor(): Promise; export(format: 'json' | 'jsonl' | 'markdown'): Promise; backup?(destination: string): Promise; /* * Optional, because only a backend that writes projected files can report on * them. The remote backend keeps no filesystem projections at all, and * inventing an empty answer there would read as "nothing is stale" rather * than "there is nothing to be stale". */ projectionStatus?(): Promise; rebuild(): Promise; capabilities(): Promise; info(): Promise; getCanonicalEvent(id: string): Promise; } export type SynomemServiceFactory = (options: SynomemClientOptions) => SynomemService;