@asaidimu/utils-workspace 6.2.1 → 6.2.3

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.
package/index.d.mts CHANGED
@@ -1,8 +1,479 @@
1
- import { SchemaDefinition } from '@asaidimu/anansi';
2
- import { Collection, Database, Document } from '@core/database';
3
- import { EventBus } from '@core/events';
1
+ import { IndexDefinition, SchemaDefinition, SchemaChange, DataTransform } from '@asaidimu/anansi';
2
+ import { QueryFilter, PaginationOptions } from '@asaidimu/query';
4
3
  import { GenerateContentParameters, GoogleGenAI, GenerateContentResponse, Content, Part } from '@google/genai';
5
4
 
5
+ /**
6
+ * Buffers write operations across one or more stores and commits them atomically.
7
+ *
8
+ * ## How atomicity works
9
+ *
10
+ * ### IndexedDB stores (same database)
11
+ * At commit time, TransactionContext collects the names of every IDB store that
12
+ * received operations, then opens a **single** `IDBTransaction` spanning all of
13
+ * them via `ConnectionManager.openTransaction`. Each store's `executeInTransaction`
14
+ * receives that shared transaction object and performs its writes against it
15
+ * without opening a new transaction of its own. IDB commits or aborts the
16
+ * entire multi-store transaction as one unit.
17
+ *
18
+ * ### MemoryStore
19
+ * MemoryStore's `executeInTransaction` receives `null` for the shared transaction.
20
+ * It applies ops against an internal staging map and returns. If a later
21
+ * participant fails, TransactionContext calls `rollbackMemory` on each
22
+ * MemoryStore that already applied its staged ops. MemoryStore restores its
23
+ * pre-transaction snapshot.
24
+ *
25
+ * ### Mixed (IDB + Memory in the same transaction)
26
+ * All IDB stores are committed first as a single atomic IDB transaction, then
27
+ * each MemoryStore is committed. If a MemoryStore fails after IDB has already
28
+ * committed, the IDB side cannot be rolled back — this is an inherent limitation
29
+ * of mixing two different storage engines. In practice the schema store is
30
+ * always MemoryStore-or-IDB consistently, so mixed transactions should not arise
31
+ * in normal usage.
32
+ */
33
+ declare class TransactionContext {
34
+ readonly id: string;
35
+ /**
36
+ * Flat list of every operation staged so far, in the order they were added.
37
+ * We keep the store reference alongside the op so commit() can group them.
38
+ */
39
+ private staged;
40
+ private done;
41
+ constructor();
42
+ /**
43
+ * Stages a single write operation against a store.
44
+ * Does NOT touch the store — no I/O happens until commit().
45
+ */
46
+ addOp<T extends Record<string, any>>(store: Store$1<T>, type: "put" | "delete" | "add", data: any): Promise<void>;
47
+ /**
48
+ * Commits all staged operations atomically.
49
+ *
50
+ * For IDB stores: opens one shared IDBTransaction across all participating
51
+ * stores, then dispatches ops to each store's executeInTransaction.
52
+ * For MemoryStores: dispatches sequentially; rolls back on failure.
53
+ */
54
+ commit(): Promise<void>;
55
+ /**
56
+ * Discards all staged operations. No I/O has occurred so there is nothing
57
+ * to undo — we simply clear the buffer.
58
+ */
59
+ rollback(): void;
60
+ /**
61
+ * Opens ONE IDBTransaction across all participating IDB stores and lets
62
+ * each store execute its ops against the shared transaction handle.
63
+ *
64
+ * We obtain the IDBDatabase from the first store (they all share the same
65
+ * ConnectionManager / database) and open the transaction ourselves so that
66
+ * the commit/abort lifecycle belongs entirely to this method.
67
+ */
68
+ private commitIDB;
69
+ /**
70
+ * Commits MemoryStore groups sequentially.
71
+ * Maintains a list of stores that have already applied their ops; if any
72
+ * store throws, all previously-applied stores are rolled back via the
73
+ * store-level `_rollbackMemory(snapshot)` escape hatch.
74
+ */
75
+ private commitMemory;
76
+ completed(): boolean;
77
+ }
78
+
79
+ interface CursorCallbackResult<T> {
80
+ value: T | null;
81
+ done: boolean;
82
+ offset?: number;
83
+ }
84
+ /**
85
+ * Callback function for cursor iteration over store records.
86
+ *
87
+ * @template T - The type of records stored.
88
+ * @param value - The current record value (cloned, not a live reference).
89
+ * @param key - The key (ID) of the current record.
90
+ * @param cursor - The underlying cursor object (implementation-specific; may be `null` in memory adapters).
91
+ * @returns A promise resolving to an object indicating whether iteration should stop,
92
+ * and an optional offset to advance.
93
+ */
94
+ type CursorCallback<T> = (value: T, key: string | number, cursor: any) => Promise<CursorCallbackResult<T>>;
95
+ /**
96
+ * A generic representation of a key range, replacing the browser-specific IDBKeyRange.
97
+ */
98
+ interface StoreKeyRange {
99
+ lower?: any;
100
+ upper?: any;
101
+ lowerOpen?: boolean;
102
+ upperOpen?: boolean;
103
+ }
104
+ /**
105
+ * A single buffered operation staged inside a TransactionContext.
106
+ * Kept intentionally minimal — the context only needs to know what to
107
+ * replay against a store during commit.
108
+ */
109
+ type BufferedOperation<T> = {
110
+ type: "add" | "put";
111
+ data: T | T[];
112
+ } | {
113
+ type: "delete";
114
+ data: string | number | (string | number)[];
115
+ };
116
+ /**
117
+ * Storage adapter interface for a single object store (collection).
118
+ *
119
+ * Stores own their indexes. Index lifecycle (create, drop) and index-aware reads
120
+ * (findByIndex) are part of this contract so that both MemoryStore and IndexedDBStore
121
+ * implement them natively — MemoryStore via in-memory index maps, IndexedDB via its
122
+ * native index mechanism.
123
+ *
124
+ * @template T - The type of objects stored. Must include the key path property.
125
+ */
126
+ interface Store$1<T extends Record<string, any> = Record<string, any>> {
127
+ /**
128
+ * Returns the name of this store (the IDB object store / collection name).
129
+ * Used by TransactionContext to group operations and open a correctly-scoped
130
+ * multi-store IDB transaction at commit time.
131
+ */
132
+ name(): string;
133
+ /**
134
+ * Opens the store, ensuring underlying storage structures exist.
135
+ */
136
+ open(): Promise<void>;
137
+ /**
138
+ * Adds one or more records to the store.
139
+ * If a record does not have a value for the store's key path, an automatic
140
+ * key may be assigned. Throws if a record with the same key already exists.
141
+ */
142
+ add(data: T | T[]): Promise<string | number | (string | number)[]>;
143
+ /**
144
+ * Removes all records from the store without destroying index structures.
145
+ */
146
+ clear(): Promise<void>;
147
+ /**
148
+ * Returns the total number of records in the store.
149
+ */
150
+ count(): Promise<number>;
151
+ /**
152
+ * Deletes one or more records by their keys.
153
+ */
154
+ delete(id: string | number | (string | number)[]): Promise<void>;
155
+ /**
156
+ * Retrieves a single record by its primary key.
157
+ */
158
+ getById(id: string | number): Promise<T | undefined>;
159
+ /**
160
+ * Retrieves the first record matching an exact index key (point lookup).
161
+ * Useful for unique indexes — returns the single matching record or undefined.
162
+ *
163
+ * @param indexName - The name of the index to query.
164
+ * @param key - The exact key value to look up.
165
+ */
166
+ getByIndex(indexName: string, key: any): Promise<T | undefined>;
167
+ /**
168
+ * Retrieves all records from a named index, optionally filtered by a key range.
169
+ * Use this for range scans over an index (e.g. all records where age >= 18).
170
+ *
171
+ * @param indexName - The name of the index to query.
172
+ * @param keyRange - Optional range to filter results.
173
+ */
174
+ getByKeyRange(indexName: string, keyRange?: StoreKeyRange): Promise<T[]>;
175
+ /**
176
+ * Retrieves all records from the store without index involvement.
177
+ */
178
+ getAll(): Promise<T[]>;
179
+ /**
180
+ * Inserts or replaces a record. Validates OCC if a record with the same key exists.
181
+ */
182
+ put(data: T): Promise<string | number>;
183
+ /**
184
+ * Iterates over records using a cursor, allowing early termination and skipping.
185
+ *
186
+ * @param callback - Invoked for each record; return `{ done: true }` to stop,
187
+ * `{ offset: n }` to skip ahead n records.
188
+ * @param direction - Iteration order.
189
+ * @param keyRange - Optional range to restrict iteration.
190
+ */
191
+ cursor(callback: CursorCallback<T>, direction?: "forward" | "backward", keyRange?: StoreKeyRange): Promise<T | null>;
192
+ /**
193
+ * Executes a batch of write operations atomically within this store.
194
+ * All operations succeed or fail together.
195
+ *
196
+ * Used for standalone (single-store) atomic writes. For cross-store atomicity,
197
+ * use executeInTransaction instead.
198
+ */
199
+ batch(operations: Array<{
200
+ type: "add" | "put";
201
+ data: T | T[];
202
+ } | {
203
+ type: "delete";
204
+ data: string | number | (string | number)[];
205
+ }>): Promise<void>;
206
+ /**
207
+ * Registers a new index on the store. Idempotent — no-op if the index already exists.
208
+ * For IndexedDB, this triggers a database version upgrade.
209
+ * For MemoryStore, this builds the index map from existing records.
210
+ *
211
+ * @param definition - The full index definition from the schema.
212
+ */
213
+ createIndex(definition: IndexDefinition): Promise<void>;
214
+ /**
215
+ * Removes a named index from the store.
216
+ * For IndexedDB, this triggers a database version upgrade.
217
+ * For MemoryStore, this drops the in-memory index map.
218
+ *
219
+ * @param name - The index name as declared in IndexDefinition.name.
220
+ */
221
+ dropIndex(name: string): Promise<void>;
222
+ /**
223
+ * Returns all records matching an exact index key.
224
+ * Unlike getByIndex (which returns only the first match), this returns all matches —
225
+ * essential for non-unique indexes where multiple records share the same indexed value.
226
+ *
227
+ * @param indexName - The name of the index to query.
228
+ * @param value - The exact value to look up.
229
+ */
230
+ findByIndex(indexName: string, value: any): Promise<T[]>;
231
+ /**
232
+ * Executes a set of buffered operations as part of a cross-store atomic transaction.
233
+ *
234
+ * For IndexedDBStore: `sharedTx` is the single IDBTransaction opened across all
235
+ * participating stores. Operations are applied directly to `sharedTx.objectStore(name)`
236
+ * without opening a new transaction — IDB commits or aborts the whole thing atomically.
237
+ *
238
+ * For MemoryStore: `sharedTx` is null. The store applies ops against its own staging
239
+ * area. The caller (TransactionContext) is responsible for coordinating rollback across
240
+ * all MemoryStores if any participant fails.
241
+ *
242
+ * This method must NOT open, commit, or abort any transaction itself.
243
+ *
244
+ * @param ops - The buffered operations to apply.
245
+ * @param sharedTx - The shared IDBTransaction (IndexedDB only), or null (MemoryStore).
246
+ */
247
+ executeInTransaction(ops: BufferedOperation<T>[], sharedTx: IDBTransaction | null): Promise<void>;
248
+ }
249
+ interface Collection<T> {
250
+ /**
251
+ * Finds a single document matching the query.
252
+ */
253
+ find: (query: QueryFilter<T>) => Promise<Document<T> | null>;
254
+ /**
255
+ * Lists documents with pagination. Returns an AsyncIterator so consumers can
256
+ * wrap it in their own iteration protocol (e.g. for-await-of via AsyncIterable).
257
+ */
258
+ list: (query: PaginationOptions) => Promise<AsyncIterator<Document<T>[]>>;
259
+ /**
260
+ * Filters all documents matching the query.
261
+ */
262
+ filter: (query: QueryFilter<T>) => Promise<Document<T>[]>;
263
+ /**
264
+ * Creates a new document in the collection.
265
+ *
266
+ * When a TransactionContext is provided the initial store.add is buffered into
267
+ * the transaction rather than written immediately. The document is returned in
268
+ * its fully initialised in-memory state regardless — callers can use it before
269
+ * the transaction commits.
270
+ *
271
+ * @param initial - The initial data for the document.
272
+ * @param tx - Optional transaction to buffer the write into.
273
+ */
274
+ create: (initial: T, tx?: TransactionContext) => Promise<Document<T>>;
275
+ /**
276
+ * Updates all documents matching the query with the provided partial data.
277
+ * Returns the number of documents updated.
278
+ */
279
+ update: (query: QueryFilter<T>, data: Partial<T>, tx?: TransactionContext) => Promise<number>;
280
+ /**
281
+ * Deletes all documents matching the query.
282
+ * Returns the number of documents deleted.
283
+ */
284
+ delete: (query: QueryFilter<T>, tx?: TransactionContext) => Promise<number>;
285
+ /**
286
+ * Subscribes to collection-level events.
287
+ */
288
+ subscribe: (event: CollectionEventType | TelemetryEventType, callback: (event: CollectionEvent<T> | TelemetryEvent) => void) => () => void;
289
+ /**
290
+ * Validates data against the collection's schema.
291
+ */
292
+ validate(data: Record<string, any>): Promise<{
293
+ value?: any;
294
+ issues: Array<{
295
+ message: string;
296
+ path: Array<string>;
297
+ }>;
298
+ }>;
299
+ invalidate(): void;
300
+ }
301
+ /**
302
+ * Event payload for Collection events.
303
+ */
304
+ type CollectionEventType = "document:create" | "collection:read" | "migration:start" | "migration:end";
305
+ type CollectionEvent<T> = {
306
+ type: CollectionEventType;
307
+ document?: T;
308
+ model?: string;
309
+ method?: keyof Collection<T>;
310
+ metadata?: Record<string, unknown>;
311
+ timestamp: number;
312
+ };
313
+ interface Database {
314
+ /**
315
+ * Opens an existing collection by name.
316
+ */
317
+ collection: <T>(schemaName: string) => Promise<Collection<T>>;
318
+ /**
319
+ * Creates a new collection from a schema definition.
320
+ */
321
+ createCollection: <T>(schema: SchemaDefinition) => Promise<Collection<T>>;
322
+ /**
323
+ * Deletes a collection and its schema record.
324
+ */
325
+ deleteCollection: (schemaName: string) => Promise<boolean>;
326
+ /**
327
+ * Updates an existing collection's schema record.
328
+ */
329
+ updateCollection: (schema: SchemaDefinition) => Promise<boolean>;
330
+ /**
331
+ * Migrates an existing collection's data and schema definition.
332
+ * Processes data in a streaming fashion to avoid loading the full collection
333
+ * into memory.
334
+ */
335
+ migrateCollection: <T>(name: string, opts: CollectionMigrationOptions, batchSize?: number) => Promise<Collection<T>>;
336
+ /**
337
+ * Executes a callback within a TransactionContext.
338
+ * Writes buffered inside the callback are flushed atomically on commit.
339
+ * If the callback throws, the buffer is discarded (no writes are flushed).
340
+ */
341
+ transaction: (callback: (tx: TransactionContext) => Promise<void>) => Promise<void>;
342
+ /**
343
+ * Subscribes to database-level events.
344
+ */
345
+ subscribe: (event: DatabaseEventType | "telemetry", callback: (event: DatabaseEvent | TelemetryEvent) => void) => () => void;
346
+ /**
347
+ * Releases in-memory references and event bus subscriptions.
348
+ * Does not delete any persisted data.
349
+ */
350
+ close: () => void;
351
+ clear: () => Promise<void>;
352
+ /**
353
+ * Ensures a collection exists; creates it if it doesn't. Idempotent.
354
+ */
355
+ ensureCollection: (schema: SchemaDefinition) => Promise<void>;
356
+ /**
357
+ * Ensures multiple collections exist; creates any that don't. Idempotent.
358
+ */
359
+ setupCollections: (schemas: SchemaDefinition[]) => Promise<void>;
360
+ }
361
+ type CollectionMigrationOptions = {
362
+ changes: SchemaChange<any>[];
363
+ description: string;
364
+ rollback?: SchemaChange<any>[];
365
+ transform?: string | DataTransform<any, any>;
366
+ };
367
+ type DatabaseEventType = "collection:create" | "collection:delete" | "collection:update" | "collection:read" | "migrate";
368
+ type DatabaseEvent = {
369
+ type: DatabaseEventType;
370
+ schema?: SchemaDefinition | Partial<SchemaDefinition>;
371
+ timestamp: number;
372
+ };
373
+ type DocumentMetadata = {
374
+ $id?: string;
375
+ $created?: string | Date;
376
+ $updated?: string | Date;
377
+ $version?: number;
378
+ };
379
+ type Document<T> = {
380
+ readonly [K in keyof T]: T[K];
381
+ } & DocumentMetadata & {
382
+ read: () => Promise<boolean>;
383
+ save: (tx?: TransactionContext) => Promise<boolean>;
384
+ update: (props: Partial<T>, tx?: TransactionContext) => Promise<boolean>;
385
+ delete: (tx?: TransactionContext) => Promise<boolean>;
386
+ subscribe: (event: DocumentEventType | TelemetryEventType, callback: (event: DocumentEvent<T> | TelemetryEvent) => void) => () => void;
387
+ state(): T;
388
+ $metadata(): DocumentMetadata;
389
+ };
390
+ type DocumentEventType = "document:create" | "document:write" | "document:update" | "document:delete" | "document:read";
391
+ type DocumentEvent<T> = {
392
+ type: DocumentEventType;
393
+ data?: Partial<T>;
394
+ timestamp: number;
395
+ };
396
+ type TelemetryEventType = "telemetry";
397
+ type TelemetryEvent = {
398
+ type: TelemetryEventType;
399
+ method: string;
400
+ timestamp: number;
401
+ source: any;
402
+ metadata: {
403
+ args: any[];
404
+ performance: {
405
+ durationMs: number;
406
+ };
407
+ source: {
408
+ level: "database" | "collection" | "document";
409
+ collection?: string;
410
+ document?: string;
411
+ };
412
+ result?: {
413
+ type: "array" | string;
414
+ size?: number;
415
+ };
416
+ error: {
417
+ message: string;
418
+ name: string;
419
+ stack?: string;
420
+ } | null;
421
+ };
422
+ };
423
+
424
+ /**
425
+ * Interface defining the shape of the EventBus.
426
+ * @template TEventMap - A record mapping event names to their respective payload types.
427
+ */
428
+ interface EventBus<TEventMap extends Record<string, any>> {
429
+ /**
430
+ * Subscribes to a specific event by name.
431
+ * @param eventName - The name of the event to subscribe to.
432
+ * @param callback - The function to call when the event is emitted.
433
+ * @returns A function to unsubscribe from the event.
434
+ */
435
+ subscribe: <TEventName extends keyof TEventMap>(eventName: TEventName, callback: (payload: TEventMap[TEventName]) => void) => () => void;
436
+ /**
437
+ * Subscribes to an event and automatically unsubscribes after it fires once.
438
+ * @param eventName - The name of the event to subscribe to.
439
+ * @param callback - The function to call when the event is emitted.
440
+ * @returns A function to cancel the one-shot subscription before it fires.
441
+ */
442
+ once: <TEventName extends keyof TEventMap>(eventName: TEventName, callback: (payload: TEventMap[TEventName]) => void) => () => void;
443
+ /**
444
+ * Emits an event with a payload to all subscribed listeners.
445
+ * @param event - An object containing the event name and payload.
446
+ */
447
+ emit: <TEventName extends keyof TEventMap>(event: {
448
+ name: TEventName;
449
+ payload: TEventMap[TEventName];
450
+ }) => void;
451
+ /**
452
+ * Retrieves metrics about event bus usage.
453
+ * @returns An object containing various metrics.
454
+ */
455
+ metrics: () => EventMetrics;
456
+ /**
457
+ * Clears all subscriptions and resets metrics.
458
+ * After calling clear(), the bus is fully reset and can be reused —
459
+ * cross-tab communication is re-established if it was previously enabled.
460
+ */
461
+ clear: () => void;
462
+ }
463
+ /**
464
+ * Interface defining the metrics tracked by the EventBus.
465
+ */
466
+ interface EventMetrics {
467
+ /** Total number of events emitted (both sync and deferred paths). */
468
+ totalEvents: number;
469
+ /** Number of active subscriptions across all event names. */
470
+ activeSubscriptions: number;
471
+ /** Map of event names to their emission counts. */
472
+ eventCounts: Map<string, number>;
473
+ /** Average duration of event dispatch in milliseconds. */
474
+ averageEmitDuration: number;
475
+ }
476
+
6
477
  /**
7
478
  * Utility type for representing partial updates to the state, allowing deep nesting.
8
479
  * It makes all properties optional and applies the same transformation recursively
@@ -2228,7 +2699,6 @@ declare class TurnTree {
2228
2699
  }
2229
2700
 
2230
2701
  declare function success<T>(value: T): Result<T, never>;
2231
- declare function ok<T>(value: T): Result<T, never>;
2232
2702
  declare function error<E extends WorkspaceError>(err: E): Result<never, E>;
2233
2703
  declare function omitNullUndefined<T extends Record<string, any>>(obj: T): Partial<T>;
2234
2704
  declare function del<T>(): T;
@@ -2421,4 +2891,4 @@ declare function createWorkspace(params: CreateWorkspaceParams): Promise<{
2421
2891
  services: WorkspaceServices;
2422
2892
  }>;
2423
2893
 
2424
- export { type AddContext, type AddPreference, type AddRole, type AddSessionTopics, type AddTopic, type AddTurn, type AuthRequest, type BackendError, type BaseCommand, type BaseContentBlock, type BlobCommand, type BlobContextContent, type BlobError, type BlobMediaType, type BlobRecord, type BlobRef, type BlobResolver, type BranchInfo, type BranchTurn, COLLECTIONS, type Collections, type Command, type ContentBlock, type Context, type ContextContent, type ContextDefinition, type ContextRetriever, type ContextSummary, type CreateSession, type CreateWorkspace, type CreateWorkspaceParams, type DeepPartial, type DefaultContextContent, type DeleteContext, type DeletePreference, type DeleteRole, type DeleteSession, type DeleteTopic, type DeleteTurn, type DocumentBlock, type DocumentMediaType, type DuplicateKeyError, EMPTY_SYSTEM_ROLE, type EditTurn, type ForkSession, index as GoogleAdapter, type ImageBlock, type ImageMediaType, type Index, type IndexExtensions, type IndexedDBBlobConfig, IndexedDBBlobStorage, type Indexer, type InvalidCommandError, type JsonContextContent, type LLMAdapter, type LLMAdapterStatic, LRUCache, MemoryBlobStorage, type MergeTopics, type ModelConstraint, type ModelConstraintMap, type ModelName, type ModelProfile, type ModelRegistry, type NotFoundError, type OverrideSessionPreferences, type PermissionDeniedError, type PermissionGuard, type Preference, type PreferenceSummary, type Project, type PromptBuilder, type PromptBuilderOptions, type PurgeBlob, type RecordBlobRemoteId, type RegisterBlob, type ReleaseBlob, type RemoteContextContent, type ResolvedBlob, type ResolvedSession, type Result, type RetainBlob, type Role, type RoleSummary, type RoleTransitionBlock, type SHA256, Session, SessionManager, type SessionMetadata, type SessionSnapshot, type Settings, type Store, type Summarizer, type SummaryBlock, type SwitchSessionRole, type SyncWorkspace, type SystemActor, type TextBlock, type TextContextContent, type ThinkingBlock, type Timestamp, type ToolCall, type ToolCallCommand, type ToolRegistry, type ToolResultBlock, type ToolSummary, type ToolUseBlock, type Topic, type TopicIndex, type Turn, TurnBuilder, type TurnKey, type TurnNode, type TurnProcessor, type TurnRef, TurnTree, type URI, type UUID, type UpdateContext, type UpdatePreference, type UpdateRole, type UpdateSession, type UpdateTopic, type UpdateTurn, type Workspace, type WorkspaceBundle, type WorkspaceContext, type WorkspaceDatabase, type WorkspaceError, type WorkspaceEvents, type WorkspaceExtension, WorkspaceManager, type WorkspaceMiddleware, type WorkspaceReducer, bufferToBase64, computeSHA256, createEmptySession, createEmptyTurn, createEmptyWorkspace, createWorkspace, createWorkspaceDatabase, del, error, getExtension, merge, ok, omitNullUndefined, shortHash, success };
2894
+ export { type AddContext, type AddPreference, type AddRole, type AddSessionTopics, type AddTopic, type AddTurn, type AuthRequest, type BackendError, type BaseCommand, type BaseContentBlock, type BlobCommand, type BlobContextContent, type BlobError, type BlobMediaType, type BlobRecord, type BlobRef, type BlobResolver, type BranchInfo, type BranchTurn, COLLECTIONS, type Collections, type Command, type ContentBlock, type Context, type ContextContent, type ContextDefinition, type ContextRetriever, type ContextSummary, type CreateSession, type CreateWorkspace, type CreateWorkspaceParams, type DeepPartial, type DefaultContextContent, type DeleteContext, type DeletePreference, type DeleteRole, type DeleteSession, type DeleteTopic, type DeleteTurn, type DocumentBlock, type DocumentMediaType, type DuplicateKeyError, EMPTY_SYSTEM_ROLE, type EditTurn, type ForkSession, index as GoogleAdapter, type ImageBlock, type ImageMediaType, type Index, type IndexExtensions, type IndexedDBBlobConfig, IndexedDBBlobStorage, type Indexer, type InvalidCommandError, type JsonContextContent, type LLMAdapter, type LLMAdapterStatic, LRUCache, MemoryBlobStorage, type MergeTopics, type ModelConstraint, type ModelConstraintMap, type ModelName, type ModelProfile, type ModelRegistry, type NotFoundError, type OverrideSessionPreferences, type PermissionDeniedError, type PermissionGuard, type Preference, type PreferenceSummary, type Project, type PromptBuilder, type PromptBuilderOptions, type PurgeBlob, type RecordBlobRemoteId, type RegisterBlob, type ReleaseBlob, type RemoteContextContent, type ResolvedBlob, type ResolvedSession, type Result, type RetainBlob, type Role, type RoleSummary, type RoleTransitionBlock, type SHA256, Session, SessionManager, type SessionMetadata, type SessionSnapshot, type Settings, type Store, type Summarizer, type SummaryBlock, type SwitchSessionRole, type SyncWorkspace, type SystemActor, type TextBlock, type TextContextContent, type ThinkingBlock, type Timestamp, type ToolCall, type ToolCallCommand, type ToolRegistry, type ToolResultBlock, type ToolSummary, type ToolUseBlock, type Topic, type TopicIndex, type Turn, TurnBuilder, type TurnKey, type TurnNode, type TurnProcessor, type TurnRef, TurnTree, type URI, type UUID, type UpdateContext, type UpdatePreference, type UpdateRole, type UpdateSession, type UpdateTopic, type UpdateTurn, type Workspace, type WorkspaceBundle, type WorkspaceContext, type WorkspaceDatabase, type WorkspaceError, type WorkspaceEvents, type WorkspaceExtension, WorkspaceManager, type WorkspaceMiddleware, type WorkspaceReducer, bufferToBase64, computeSHA256, createEmptySession, createEmptyTurn, createEmptyWorkspace, createWorkspace, createWorkspaceDatabase, del, error, getExtension, merge, omitNullUndefined, shortHash, success };