@mnemo-ai/types 3.6.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,420 @@
1
+ import { bU as StorageAdapter, bV as StorageCapabilities, b3 as OutboxEntry, s as AuditLogEntry, bl as RecallLogEntry, bC as ReplayFailureReview, _ as CreateSessionInput, aX as MnemoSession, bN as SessionTurn, V as CreateFactInput, aQ as MnemoFact, c2 as UpdateFactInput, aH as MergeFactByTopicKeyInput, bA as ReplaceFactInput, bB as ReplaceFactResult, ai as FactFilter, b6 as PaginatedResult, k as ApplyConsolidationMergeInput, N as ConsolidationMergeSnapshot, aj as FindContradictingFactsInput, P as ContradictingFact, bc as PurgeFactsFilter, bd as PurgeFactsResult, R as CreateDecisionInput, aM as MnemoDecision, b$ as UpdateDecisionInput, a6 as DecisionFilter, T as CreateEpisodeInput, aO as MnemoEpisode, c1 as UpdateEpisodeInput, af as EpisodeFilter, bx as RememberKind, bP as SimilarEpisode, S as CreateEntityInput, aN as MnemoEntity, c0 as UpdateEntityInput, ae as EntityFilter, bO as SimilarEntity, a0 as CreateStrategyInput, aZ as MnemoStrategy, c6 as UpdateStrategyInput, bW as StrategyFilter, a4 as CreateWorkflowInput, b1 as MnemoWorkflow, c9 as UpdateWorkflowInput, ck as WorkflowFilter, $ as CreateSkillInput, aY as MnemoSkill, c5 as UpdateSkillInput, bQ as SkillFilter, a1 as CreateTaskInput, a_ as MnemoTask, c7 as UpdateTaskInput, bX as TaskFilter, U as CreateEventInput, aP as MnemoEvent, ah as EventFilter, X as CreateReasoningInput, aU as MnemoReasoning, c4 as UpdateReasoningInput, bh as ReasoningFilter, aJ as MnemoAgentProfile, W as CreateHyperedgeInput, aS as MnemoHyperedge, c3 as UpdateHyperedgeInput, an as HyperedgeFilter, Q as CreateCompositionRuleInput, aL as MnemoCompositionRule, b_ as UpdateCompositionRuleInput, I as CompositionRuleFilter, j as AppendInferenceInput, aT as MnemoInferenceLogEntry, aG as MaterialiseInferenceInput, ap as InferenceLogFilter, aR as MnemoFactHash, ca as UpsertFactHashInput, cb as UpsertFactLshInput, bo as RecallPrimitiveRef, bn as RecallPrimitiveRecord, bs as RecallStructures, b9 as PointerCandidateQuery, b8 as PointerCandidate, ak as FtsCandidate, M as ConfidenceMapRow, ay as KnowledgeGapRow, aI as MetacognitionTrends, bJ as SequentialPatternRow, b7 as PeriodicPatternRow, L as ConditionalPatternRow, G as CoOccurrencePatternRow, Y as CreateRelationInput, aV as MnemoRelation, bu as RelationFilter, ba as PrimitiveKind, cm as WorthDelta, a3 as CreateWebhookEndpointInput, b0 as MnemoWebhookEndpoint, c8 as UpdateWebhookEndpointInput, a2 as CreateWebhookDeliveryInput, a$ as MnemoWebhookDelivery, Z as CreateReminderInput, aW as MnemoReminder, bm as RecallLogRecord, al as HealthStatus, ab as EmbeddableTable, am as HotTierSnapshotRow, b as AccessPolicyStore, a as AccessPolicyRecord, n as ApprovalStore, m as ApprovalRequestInput, l as ApprovalRequest, z as BreakGlassStore, x as BreakGlassRequestInput, y as BreakGlassRequestRecord } from '../ports-PqoQMXjO.js';
2
+ import 'zod';
3
+
4
+ declare class InMemoryStorageAdapter implements StorageAdapter {
5
+ readonly capabilities: StorageCapabilities;
6
+ private sessions;
7
+ private turns;
8
+ private facts;
9
+ private decisions;
10
+ private episodes;
11
+ private entities;
12
+ private strategies;
13
+ private workflows;
14
+ private skills;
15
+ private tasks;
16
+ private events;
17
+ private reasonings;
18
+ private hyperedges;
19
+ private compositionRules;
20
+ private inferences;
21
+ private factHashes;
22
+ private factLsh;
23
+ private embeddings;
24
+ private relations;
25
+ private agentProfiles;
26
+ private workspaceModes;
27
+ private queryCache;
28
+ private embeddingCache;
29
+ outbox: OutboxEntry[];
30
+ auditLog: AuditLogEntry[];
31
+ recallLog: RecallLogEntry[];
32
+ consolidationReviews: Array<{
33
+ id: string;
34
+ workspaceId: string;
35
+ factId: string;
36
+ reason: string;
37
+ review: ReplayFailureReview;
38
+ }>;
39
+ createSession(input: CreateSessionInput): Promise<MnemoSession>;
40
+ appendTurn(sessionId: string, turn: Omit<SessionTurn, "id" | "createdAt">): Promise<void>;
41
+ listTurns(sessionId: string, workspaceId: string): Promise<SessionTurn[]>;
42
+ closeSession(id: string, workspaceId: string): Promise<void>;
43
+ archiveSession(id: string, workspaceId: string): Promise<void>;
44
+ getSession(id: string, workspaceId: string): Promise<MnemoSession | null>;
45
+ listSessions(workspaceId: string): Promise<MnemoSession[]>;
46
+ pinSessionTurn(sessionId: string, turnId: string, workspaceId: string, pinned: boolean): Promise<void>;
47
+ createFact(input: CreateFactInput): Promise<MnemoFact>;
48
+ getFact(id: string, workspaceId: string): Promise<MnemoFact | null>;
49
+ updateFact(id: string, workspaceId: string, input: UpdateFactInput): Promise<MnemoFact | null>;
50
+ mergeFactByTopicKey(input: MergeFactByTopicKeyInput): Promise<MnemoFact | null>;
51
+ replaceFact(input: ReplaceFactInput): Promise<ReplaceFactResult | null>;
52
+ archiveFact(id: string, workspaceId: string): Promise<void>;
53
+ queryFacts(filter: FactFilter): Promise<PaginatedResult<MnemoFact>>;
54
+ applyConsolidationMerge(input: ApplyConsolidationMergeInput): Promise<ConsolidationMergeSnapshot | null>;
55
+ private consolidationRows;
56
+ private pendingConsolidationRows;
57
+ private compensateConsolidationMerge;
58
+ rollbackConsolidationMerge(input: {
59
+ snapshot: ConsolidationMergeSnapshot;
60
+ review: ReplayFailureReview;
61
+ }): Promise<"rolled_back" | "conflict">;
62
+ finalizeConsolidationMerge(input: {
63
+ snapshot: ConsolidationMergeSnapshot;
64
+ applyReplayBoost: boolean;
65
+ }): Promise<"finalized" | "conflict">;
66
+ refreshConsolidationMergeLease(input: {
67
+ snapshot: ConsolidationMergeSnapshot;
68
+ leaseExpiresAt: Date;
69
+ }): Promise<"refreshed" | "conflict">;
70
+ inspectConsolidationMergeState(snapshot: ConsolidationMergeSnapshot): Promise<"pending" | "restored" | "retained" | "divergent">;
71
+ recoverExpiredConsolidationMerges(input: {
72
+ workspaceId: string;
73
+ expiredBefore: Date;
74
+ }): Promise<number>;
75
+ findContradictingFacts(workspaceId: string, input: FindContradictingFactsInput): Promise<ContradictingFact[]>;
76
+ purgeFacts(filter: PurgeFactsFilter): Promise<PurgeFactsResult>;
77
+ createDecision(input: CreateDecisionInput): Promise<MnemoDecision>;
78
+ getDecision(id: string, workspaceId: string): Promise<MnemoDecision | null>;
79
+ updateDecision(id: string, input: UpdateDecisionInput): Promise<MnemoDecision>;
80
+ archiveDecision(id: string, workspaceId: string): Promise<void>;
81
+ queryDecisions(filter: DecisionFilter): Promise<PaginatedResult<MnemoDecision>>;
82
+ createEpisode(input: CreateEpisodeInput): Promise<MnemoEpisode>;
83
+ getEpisode(id: string, workspaceId: string): Promise<MnemoEpisode | null>;
84
+ updateEpisode(id: string, input: UpdateEpisodeInput): Promise<MnemoEpisode>;
85
+ archiveEpisode(id: string, workspaceId: string): Promise<void>;
86
+ queryEpisodes(filter: EpisodeFilter): Promise<PaginatedResult<MnemoEpisode>>;
87
+ getEpisodeTreeNeighbors(episodeId: string, workspaceId: string, limit?: number): Promise<MnemoEpisode[]>;
88
+ persistCompression(input: {
89
+ workspaceId: string;
90
+ rootEpisodeId: string;
91
+ compressedNarrative: string;
92
+ retainedDeltas: Array<{
93
+ episodeId: string;
94
+ deltaContent: string;
95
+ }>;
96
+ }): Promise<void>;
97
+ getKnowledgeDistribution(workspaceId: string): Promise<Partial<Record<RememberKind, number>>>;
98
+ reconstructEpisode(id: string, workspaceId: string): Promise<MnemoEpisode>;
99
+ findSimilarEpisodes(workspaceId: string, embedding: number[], limit: number, minSim: number): Promise<SimilarEpisode[]>;
100
+ createEntity(input: CreateEntityInput): Promise<MnemoEntity>;
101
+ getEntity(id: string, workspaceId: string): Promise<MnemoEntity | null>;
102
+ updateEntity(id: string, input: UpdateEntityInput): Promise<MnemoEntity>;
103
+ archiveEntity(id: string, workspaceId: string): Promise<void>;
104
+ queryEntities(filter: EntityFilter): Promise<PaginatedResult<MnemoEntity>>;
105
+ findSimilarEntities(_workspaceId: string, _embedding: number[], _limit: number, _minSim: number): Promise<SimilarEntity[]>;
106
+ createStrategy(input: CreateStrategyInput): Promise<MnemoStrategy>;
107
+ getStrategy(id: string, workspaceId: string): Promise<MnemoStrategy | null>;
108
+ updateStrategy(id: string, input: UpdateStrategyInput): Promise<MnemoStrategy>;
109
+ archiveStrategy(id: string, workspaceId: string): Promise<void>;
110
+ queryStrategies(filter: StrategyFilter): Promise<PaginatedResult<MnemoStrategy>>;
111
+ createWorkflow(input: CreateWorkflowInput): Promise<MnemoWorkflow>;
112
+ getWorkflow(id: string, workspaceId: string): Promise<MnemoWorkflow | null>;
113
+ updateWorkflow(id: string, input: UpdateWorkflowInput): Promise<MnemoWorkflow>;
114
+ archiveWorkflow(id: string, workspaceId: string): Promise<void>;
115
+ queryWorkflows(filter: WorkflowFilter): Promise<PaginatedResult<MnemoWorkflow>>;
116
+ createSkill(input: CreateSkillInput): Promise<MnemoSkill>;
117
+ getSkill(id: string, workspaceId: string): Promise<MnemoSkill | null>;
118
+ updateSkill(id: string, input: UpdateSkillInput): Promise<MnemoSkill>;
119
+ archiveSkill(id: string, workspaceId: string): Promise<void>;
120
+ querySkills(filter: SkillFilter): Promise<PaginatedResult<MnemoSkill>>;
121
+ createTask(input: CreateTaskInput): Promise<MnemoTask>;
122
+ getTask(id: string, workspaceId: string): Promise<MnemoTask | null>;
123
+ updateTask(id: string, input: UpdateTaskInput): Promise<MnemoTask>;
124
+ archiveTask(id: string, workspaceId: string): Promise<void>;
125
+ listTasksForSession(workspaceId: string, sessionId: string): Promise<Array<{
126
+ id: string;
127
+ status: string;
128
+ }>>;
129
+ listStaleTasks(workspaceId: string, staleSinceMs: number, limit: number): Promise<Array<{
130
+ id: string;
131
+ title: string;
132
+ status: string;
133
+ updatedAt: Date;
134
+ }>>;
135
+ countFactsByTypeStatus(): Promise<Array<{
136
+ type: string;
137
+ status: string;
138
+ count: number;
139
+ }>>;
140
+ worthHistogram(): Promise<Array<{
141
+ bucket: string;
142
+ count: number;
143
+ }>>;
144
+ countActiveSessions(): Promise<number>;
145
+ countTasksByStatus(): Promise<Array<{
146
+ status: string;
147
+ count: number;
148
+ }>>;
149
+ countStaleTasks(): Promise<number>;
150
+ listScoredTrajectories(workspaceId: string, agentId: string, limit: number): Promise<Array<{
151
+ sessionId: string;
152
+ score: number;
153
+ promptVersionId: string | null;
154
+ createdAt: Date;
155
+ }>>;
156
+ computeCandidateAbScore(workspaceId: string, agentId: string, promptVersionId: string): Promise<number | null>;
157
+ delegateTask(id: string, workspaceId: string, input: {
158
+ assignedTo: string;
159
+ delegatedBy: string;
160
+ }): Promise<MnemoTask>;
161
+ queryTasks(filter: TaskFilter): Promise<PaginatedResult<MnemoTask>>;
162
+ createEvent(input: CreateEventInput): Promise<MnemoEvent>;
163
+ getEvent(id: string, workspaceId: string): Promise<MnemoEvent | null>;
164
+ archiveEvent(id: string, workspaceId: string): Promise<void>;
165
+ appendEventAnnotation(id: string, workspaceId: string, annotation: {
166
+ author: string;
167
+ content: string;
168
+ at: Date;
169
+ }): Promise<MnemoEvent>;
170
+ queryEvents(filter: EventFilter): Promise<PaginatedResult<MnemoEvent>>;
171
+ updateEventSensitivity(id: string, workspaceId: string, sensitivity: MnemoEvent['sensitivity']): Promise<void>;
172
+ createReasoning(input: CreateReasoningInput): Promise<MnemoReasoning>;
173
+ getReasoning(id: string, workspaceId: string): Promise<MnemoReasoning | null>;
174
+ updateReasoning(id: string, input: UpdateReasoningInput): Promise<MnemoReasoning>;
175
+ archiveReasoning(id: string, workspaceId: string): Promise<void>;
176
+ queryReasoning(filter: ReasoningFilter): Promise<PaginatedResult<MnemoReasoning>>;
177
+ searchReasoning(input: {
178
+ workspaceId: string;
179
+ vector: number[];
180
+ limit: number;
181
+ includeAllStatuses?: boolean;
182
+ }): Promise<Array<{
183
+ id: string;
184
+ cosine: number;
185
+ worth: number;
186
+ successCount: number;
187
+ failureCount: number;
188
+ status: MnemoReasoning["status"];
189
+ }>>;
190
+ recordReasoningUse(id: string, workspaceId: string): Promise<void>;
191
+ setReasoningStatus(id: string, workspaceId: string, status: MnemoReasoning["status"]): Promise<void>;
192
+ getAgentProfile(workspaceId: string, agentId: string): Promise<MnemoAgentProfile | null>;
193
+ upsertAgentProfile(input: {
194
+ workspaceId: string;
195
+ agentId: string;
196
+ summary?: string;
197
+ metadata?: Record<string, unknown>;
198
+ }): Promise<MnemoAgentProfile>;
199
+ incrementSessionsSinceReflection(workspaceId: string, agentId: string): Promise<number>;
200
+ createHyperedge(input: CreateHyperedgeInput): Promise<MnemoHyperedge>;
201
+ getHyperedge(id: string, workspaceId: string): Promise<MnemoHyperedge | null>;
202
+ updateHyperedge(id: string, input: UpdateHyperedgeInput): Promise<MnemoHyperedge>;
203
+ archiveHyperedge(id: string, workspaceId: string): Promise<void>;
204
+ queryHyperedges(filter: HyperedgeFilter): Promise<PaginatedResult<MnemoHyperedge>>;
205
+ bumpHyperedgeActivation(id: string, workspaceId: string): Promise<void>;
206
+ createCompositionRule(input: CreateCompositionRuleInput): Promise<MnemoCompositionRule>;
207
+ getCompositionRule(id: string, workspaceId: string): Promise<MnemoCompositionRule | null>;
208
+ updateCompositionRule(id: string, workspaceId: string, input: UpdateCompositionRuleInput): Promise<MnemoCompositionRule>;
209
+ queryCompositionRules(filter: CompositionRuleFilter): Promise<PaginatedResult<MnemoCompositionRule>>;
210
+ bumpCompositionExecution(id: string, workspaceId: string): Promise<void>;
211
+ ensureBuiltinCompositionRules(_workspaceId: string): Promise<void>;
212
+ appendInference(input: AppendInferenceInput): Promise<MnemoInferenceLogEntry>;
213
+ materialiseInference(input: MaterialiseInferenceInput): Promise<{
214
+ id: string;
215
+ }>;
216
+ queryInferences(filter: InferenceLogFilter): Promise<PaginatedResult<MnemoInferenceLogEntry>>;
217
+ lookupFactHash(workspaceId: string, statementHash: string): Promise<MnemoFactHash | null>;
218
+ upsertFactHash(input: UpsertFactHashInput): Promise<MnemoFactHash>;
219
+ private candidateFactMatches;
220
+ private pointerCandidate;
221
+ /** Test-only helper: store a pre-computed embedding to be returned by pointerCandidates. */
222
+ setEmbedding(id: string, vec: number[]): void;
223
+ upsertFactLsh(input: UpsertFactLshInput): Promise<void>;
224
+ getRecallPrimitives(workspaceId: string, refs: RecallPrimitiveRef[]): Promise<RecallPrimitiveRecord[]>;
225
+ getRecallStructures(workspaceId: string, sourceIds: string[], hyperedgeLimitPerMember: number): Promise<RecallStructures>;
226
+ pointerCandidates(query: PointerCandidateQuery): Promise<PointerCandidate[]>;
227
+ /** FTS arm of hybrid Tier-3 recall: lexical substring match over statement. */
228
+ ftsCandidates(query: Omit<PointerCandidateQuery, "bands">): Promise<FtsCandidate[]>;
229
+ getConfidenceMap(workspaceId: string, opts?: {
230
+ limit?: number;
231
+ }): Promise<ConfidenceMapRow[]>;
232
+ getKnowledgeGaps(_workspaceId: string, _opts?: {
233
+ limit?: number;
234
+ minScore?: number;
235
+ }): Promise<KnowledgeGapRow[]>;
236
+ getMetacognitionTrends(_workspaceId: string): Promise<MetacognitionTrends>;
237
+ refreshMetacognitionViews(): Promise<void>;
238
+ getSequentialPatterns(_args: {
239
+ workspaceId: string;
240
+ predecessorId?: string;
241
+ minConfidence?: number;
242
+ limit?: number;
243
+ }): Promise<SequentialPatternRow[]>;
244
+ getPeriodicPatterns(_args: {
245
+ workspaceId: string;
246
+ dayOfWeek?: number;
247
+ hourBucket?: number;
248
+ limit?: number;
249
+ }): Promise<PeriodicPatternRow[]>;
250
+ refreshAnticipationViews(): Promise<void>;
251
+ getConditionalPatterns(): Promise<ConditionalPatternRow[]>;
252
+ getCoOccurrencePatterns(): Promise<CoOccurrencePatternRow[]>;
253
+ createRelation(input: CreateRelationInput): Promise<MnemoRelation>;
254
+ getRelations(filter: RelationFilter): Promise<MnemoRelation[]>;
255
+ updateRelationStrength(id: string, delta: number): Promise<void>;
256
+ deleteRelation(id: string, workspaceId: string): Promise<void>;
257
+ updateWorth(id: string, workspaceId: string, primitiveKind: PrimitiveKind, delta: WorthDelta): Promise<void>;
258
+ recordRecall(entry: RecallLogEntry): Promise<void>;
259
+ getTdPredecessors(_workspaceId: string, _sessionId: string, _excludeFactId: string): Promise<Array<{
260
+ factId: string;
261
+ tdCredit: number;
262
+ recalledAt: Date;
263
+ }>>;
264
+ setCanonical(id: string, workspaceId: string, canonical: boolean): Promise<void>;
265
+ getRecalledFactIds(workspaceId: string, sessionId: string): Promise<string[]>;
266
+ getProvenanceCredit(workspaceId: string, terminalIds: string[], lambda: number, maxHops: number): Promise<Array<{
267
+ factId: string;
268
+ credit: number;
269
+ }>>;
270
+ appendAuditEntry(entry: Omit<AuditLogEntry, "id" | "createdAt">): Promise<void>;
271
+ listAuditLog(workspaceId: string, limit: number): Promise<AuditLogEntry[]>;
272
+ appendOutbox(entry: Omit<OutboxEntry, "id" | "createdAt" | "attempts">): Promise<void>;
273
+ claimOutbox(limit: number): Promise<OutboxEntry[]>;
274
+ markOutboxProcessed(ids: string[]): Promise<void>;
275
+ markOutboxFailed(id: string, error: string): Promise<void>;
276
+ reapDeadLetters(maxAttempts: number): Promise<number>;
277
+ purgeOutbox(olderThanMs: number): Promise<number>;
278
+ countPendingOutbox(): Promise<number>;
279
+ private webhookEndpoints;
280
+ private webhookDeliveries;
281
+ createWebhookEndpoint(input: CreateWebhookEndpointInput): Promise<MnemoWebhookEndpoint>;
282
+ getWebhookEndpoint(id: string, workspaceId: string): Promise<MnemoWebhookEndpoint | null>;
283
+ listWebhookEndpoints(workspaceId: string): Promise<MnemoWebhookEndpoint[]>;
284
+ updateWebhookEndpoint(id: string, input: UpdateWebhookEndpointInput): Promise<MnemoWebhookEndpoint>;
285
+ deleteWebhookEndpoint(id: string, workspaceId: string): Promise<void>;
286
+ listActiveWebhookEndpoints(workspaceId: string, eventType: string): Promise<MnemoWebhookEndpoint[]>;
287
+ recordWebhookDelivery(entry: CreateWebhookDeliveryInput): Promise<void>;
288
+ listWebhookDeliveries(webhookId: string, workspaceId: string, limit?: number): Promise<MnemoWebhookDelivery[]>;
289
+ listPendingWebhookDeliveries(limit: number): Promise<MnemoWebhookDelivery[]>;
290
+ updateWebhookDelivery(id: string, workspaceId: string, update: {
291
+ status?: "pending" | "delivered" | "failed";
292
+ responseStatus?: number;
293
+ responseBody?: string;
294
+ attempt?: number;
295
+ deliveredAt?: Date;
296
+ nextAttemptAt?: Date | null;
297
+ }): Promise<void>;
298
+ private reminders;
299
+ createReminder(input: CreateReminderInput): Promise<MnemoReminder>;
300
+ getReminder(id: string, workspaceId: string): Promise<MnemoReminder | null>;
301
+ listPendingReminders(workspaceId: string, asOf: Date): Promise<MnemoReminder[]>;
302
+ dismissReminder(id: string, workspaceId: string, newStatus: "triggered" | "dismissed"): Promise<void>;
303
+ listReminders(workspaceId: string, status: "pending" | "triggered" | "dismissed" | "all", limit: number): Promise<MnemoReminder[]>;
304
+ private mnemoRecallLog;
305
+ logRecall(workspaceId: string, memoryId: string, score: number): Promise<void>;
306
+ getRecallLog(workspaceId: string, memoryId: string, limit: number): Promise<Array<{
307
+ id: string;
308
+ recalledAt: string;
309
+ recallScore: number;
310
+ }>>;
311
+ getRecallLogs(workspaceId: string, memoryIds: string[], limitPerMemory: number): Promise<RecallLogRecord[]>;
312
+ getRecentQueriesForFacts(workspaceId: string, factIds: string[], limit: number): Promise<string[]>;
313
+ lookupQueryCache(workspaceId: string, embedding: Float32Array, threshold: number): Promise<{
314
+ resultIds: string[];
315
+ resultKinds: string[];
316
+ } | null>;
317
+ upsertQueryCache(input: {
318
+ workspaceId: string;
319
+ queryText: string;
320
+ embedding: Float32Array;
321
+ resultIds: string[];
322
+ resultKinds: string[];
323
+ ttlMs: number;
324
+ }): Promise<void>;
325
+ getCachedEmbedding(workspaceId: string, textHash: string): Promise<Float32Array | null>;
326
+ putCachedEmbedding(input: {
327
+ workspaceId: string;
328
+ textHash: string;
329
+ embedding: Float32Array;
330
+ model: string;
331
+ }): Promise<void>;
332
+ healthCheck(): Promise<HealthStatus>;
333
+ close(): Promise<void>;
334
+ listWorkspaceIds(): Promise<string[]>;
335
+ getWorkspaceMode(workspaceId: string): Promise<{
336
+ mode: "learning" | "production";
337
+ sessionCount: number;
338
+ promoteAt: number | null;
339
+ startedAt: Date;
340
+ factCount: number;
341
+ entityCount: number;
342
+ } | null>;
343
+ setWorkspaceMode(workspaceId: string, patch: {
344
+ mode?: "learning" | "production";
345
+ sessionCount?: number;
346
+ promoteAt?: number | null;
347
+ factCount?: number;
348
+ entityCount?: number;
349
+ }): Promise<void>;
350
+ incrementWorkspaceModeCounters(workspaceId: string, delta: {
351
+ factCount?: number;
352
+ entityCount?: number;
353
+ sessionCount?: number;
354
+ }): Promise<void>;
355
+ decayKind(_workspaceId: string, _decayClass: string, _halfLifeDays: number): Promise<number>;
356
+ recordCoRecallStdp(_workspaceId: string, _relationId: string, _coRecalledAt: Date): Promise<void>;
357
+ normalizeHebbianWeights(_workspaceId: string): Promise<number>;
358
+ enqueueReviewItem(_input: {
359
+ workspaceId: string;
360
+ primitiveId: string;
361
+ primitiveKind?: string;
362
+ reason: string;
363
+ detail?: Record<string, unknown>;
364
+ }): Promise<void>;
365
+ queryDriftCandidates(_workspaceId: string): Promise<Array<{
366
+ id: string;
367
+ statement: string;
368
+ metadata: Record<string, unknown>;
369
+ }>>;
370
+ listStaleEmbeddings(_table: EmbeddableTable, _workspaceId: string, _currentModel: string, _limit: number): Promise<Array<{
371
+ id: string;
372
+ text: string;
373
+ }>>;
374
+ markEmbeddingsStale(_table: EmbeddableTable, _workspaceId: string, _currentModel: string): Promise<number>;
375
+ updateEmbeddingVector(_table: EmbeddableTable, _id: string, _workspaceId: string, _vector: number[], _model: string): Promise<void>;
376
+ upsertHotTierSnapshot(_rows: HotTierSnapshotRow[]): Promise<void>;
377
+ loadHotTierSnapshots(_workspaceId?: string): Promise<HotTierSnapshotRow[]>;
378
+ /**
379
+ * Return distinct topic_keys for facts in a session that were tagged with the
380
+ * given extraction_source. Used by the hybrid collapse dedup gate.
381
+ */
382
+ listSessionTopicKeysBySource(workspaceId: string, sessionId: string, source: string): Promise<string[]>;
383
+ /** Clear all data — call between test cases. */
384
+ reset(): void;
385
+ }
386
+
387
+ declare function runStorageAdapterContractTests(makeAdapter: () => StorageAdapter | Promise<StorageAdapter>): void;
388
+
389
+ declare class InMemoryAccessPolicyStore implements AccessPolicyStore {
390
+ private readonly byKey;
391
+ private key;
392
+ getPolicy(workspaceId: string, agentId: string): Promise<AccessPolicyRecord | null>;
393
+ putPolicy(policy: AccessPolicyRecord): Promise<void>;
394
+ }
395
+
396
+ declare class InMemoryApprovalStore implements ApprovalStore {
397
+ private readonly byId;
398
+ create(input: ApprovalRequestInput): Promise<ApprovalRequest>;
399
+ get(workspaceId: string, id: string): Promise<ApprovalRequest | null>;
400
+ resolve(workspaceId: string, id: string, status: "approved" | "denied", resolvedBy: string): Promise<void>;
401
+ }
402
+
403
+ /**
404
+ * WP8 (F10) — In-memory test double for the BreakGlassStore port.
405
+ *
406
+ * Pure decision logic only — no infra imports (Postgres / Drizzle live in the
407
+ * adapter layer). The two-person dual-control rule (requester ≠ approver) and
408
+ * the pending → approved → used finite-state machine are enforced here so they
409
+ * can be unit-tested without a database.
410
+ */
411
+ declare class InMemoryBreakGlassStore implements BreakGlassStore {
412
+ private readonly byId;
413
+ request(input: BreakGlassRequestInput): Promise<BreakGlassRequestRecord>;
414
+ approve(workspaceId: string, id: string, approverId: string): Promise<void>;
415
+ get(workspaceId: string, id: string): Promise<BreakGlassRequestRecord | null>;
416
+ getActiveApproved(workspaceId: string, requestedBy: string): Promise<BreakGlassRequestRecord | null>;
417
+ markUsed(workspaceId: string, id: string): Promise<void>;
418
+ }
419
+
420
+ export { InMemoryAccessPolicyStore, InMemoryApprovalStore, InMemoryBreakGlassStore, InMemoryStorageAdapter, runStorageAdapterContractTests };