import type { KnowledgeMemoryKind, HistoricalMemoryPromptMode } from "@opengeni/contracts"; import type { Database } from "./database.js"; export type CompanyBrainContextAttemptClaims = Readonly<{ accountId: string; workspaceId: string; sessionId: string; turnId: string; attemptId: string; executionGeneration: number; }>; export type CompanyBrainMemorySelectionReference = Readonly<{ id: string; kind: KnowledgeMemoryKind; textHash: string; contentHash: string; textCodecVersion: number | null; memoryVersion: number; pinned: boolean; }>; export type CompanyBrainContextSelectionReceipt = Readonly<{ id: string; rootSessionId: string; acceptedAt: string; sessionRole: "root" | "child"; memoryEnabled: boolean; memoryPromptMode: HistoricalMemoryPromptMode; companyProfileIncluded: boolean; instructionPolicyEntryHash: string; preferenceDescriptorHash: string | null; companyProfileSnapshotHash: string; turnContextSnapshotId: string; turnContextSnapshotHash: string; turnContextSnapshotSource: "accepted_turn" | "legacy_first_claim"; legacyWorkspaceInstructionsOriginalUtf8Bytes: number | null; legacyWorkspaceInstructionsTruncated: boolean; selectionHash: string; selectedMemoryCount: number; renderedMemoryCount: number; visibleMemoryCount: number; budgetOmittedMemoryCount: number; authorizationOmittedMemoryCount: number; omittedMemoryCount: number; }>; export type ResolvedCompanyBrainContextSelection = Readonly<{ receipt: CompanyBrainContextSelectionReceipt; legacyWorkspaceInstructions: string | null; workspaceMemory: string | null; }>; export type CompanyBrainContextReceiptInspection = Readonly<{ id: string; sessionId: string; rootSessionId: string; turnId: string; acceptedAt: string; createdAt: string; sessionRole: "root" | "child"; memoryEnabled: boolean; memoryPromptMode: HistoricalMemoryPromptMode; companyProfileIncluded: boolean; instructionPolicyEntryHash: string; preferenceDescriptorHash: string | null; companyProfileSnapshotHash: string; turnContextSnapshotId: string; turnContextSnapshotHash: string; turnContextSnapshotSource: "accepted_turn" | "legacy_first_claim"; selectionHash: string; selectedMemoryCount: number; renderedMemoryCount: number; budgetOmittedMemoryCount: number; }>; export type CompanyBrainContextReceiptInspectionCursor = Readonly<{ createdAt: string; id: string; }>; export type InspectCompanyBrainContextReceiptsInput = Readonly<{ workspaceId: string; subjectId: string; attemptId?: string; before?: CompanyBrainContextReceiptInspectionCursor; limit?: number; }>; /** * Read a bounded, content-free projection of existing accepted-turn receipts. * The SQL capability independently proves the exact human and both session * references; this adapter never calls the receipt-creating worker function. */ export declare function inspectCompanyBrainContextReceipts(db: Database, input: InspectCompanyBrainContextReceiptsInput): Promise; /** * Freeze the broad legacy workspace-Memory candidate set once per accepted * logical turn. Recovery gets the original candidate identities and may only * lose rows that no longer pass current lifecycle/hash authorization. The * durable receipt contains references and hashes, never memory text. */ export declare function resolveCompanyBrainContextSelection(db: Database, claims: CompanyBrainContextAttemptClaims): Promise;