@agentium/core. Read the storage guide for setup and behavior, or return to the package reference.
A ? marks an optional field. These are declarations for lookup; run the examples in the linked guide. Follow related-type links for Agentium types and source links for imported dependency types.
DynamoDBStorage
Sourceexport declare class DynamoDBStorage implements StorageDriver {
constructor(config?: DynamoDBStorageConfig);
initialize(): Promise<void>;
get<T>(namespace: string, key: string): Promise<T | null>;
set<T>(namespace: string, key: string, value: T): Promise<void>;
delete(namespace: string, key: string): Promise<void>;
list<T>(namespace: string, prefix?: string): Promise<Array<{
key: string;
value: T;
}>>;
close(): Promise<void>;
}
DynamoDBStorageConfig, StorageDriver.
DynamoDBStorageConfig
Sourceexport interface DynamoDBStorageConfig {
tableName?: string;
region?: string;
endpoint?: string;
credentials?: {
accessKeyId: string;
secretAccessKey: string;
};
}
InMemoryStorage
Sourceexport declare class InMemoryStorage implements StorageDriver {
get<T>(namespace: string, key: string): Promise<T | null>;
set<T>(namespace: string, key: string, value: T): Promise<void>;
delete(namespace: string, key: string): Promise<void>;
list<T>(namespace: string, prefix?: string): Promise<Array<{
key: string;
value: T;
}>>;
close(): Promise<void>;
}
StorageDriver.
MongoDBStorage
Sourceexport declare class MongoDBStorage implements StorageDriver {
constructor(uri: string, dbName?: string, collectionName?: string);
initialize(): Promise<void>;
get<T>(namespace: string, key: string): Promise<T | null>;
set<T>(namespace: string, key: string, value: T): Promise<void>;
delete(namespace: string, key: string): Promise<void>;
list<T>(namespace: string, prefix?: string): Promise<Array<{
key: string;
value: T;
}>>;
close(): Promise<void>;
}
StorageDriver.
MySQLStorage
Sourceexport declare class MySQLStorage implements StorageDriver {
constructor(config?: MySQLStorageConfig);
initialize(): Promise<void>;
get<T>(namespace: string, key: string): Promise<T | null>;
set<T>(namespace: string, key: string, value: T): Promise<void>;
delete(namespace: string, key: string): Promise<void>;
list<T>(namespace: string, prefix?: string): Promise<Array<{
key: string;
value: T;
}>>;
close(): Promise<void>;
}
MySQLStorageConfig, StorageDriver.
MySQLStorageConfig
Sourceexport interface MySQLStorageConfig {
host?: string;
port?: number;
user?: string;
password?: string;
database?: string;
connectionString?: string;
tableName?: string;
}
PostgresStorage
Sourceexport declare class PostgresStorage implements StorageDriver {
constructor(connectionString: string);
initialize(): Promise<void>;
get<T>(namespace: string, key: string): Promise<T | null>;
set<T>(namespace: string, key: string, value: T): Promise<void>;
delete(namespace: string, key: string): Promise<void>;
list<T>(namespace: string, prefix?: string): Promise<Array<{
key: string;
value: T;
}>>;
close(): Promise<void>;
}
StorageDriver.
RedisStorage
Sourceexport declare class RedisStorage implements StorageDriver {
constructor(config?: RedisStorageConfig);
initialize(): Promise<void>;
get<T>(namespace: string, key: string): Promise<T | null>;
set<T>(namespace: string, key: string, value: T): Promise<void>;
delete(namespace: string, key: string): Promise<void>;
list<T>(namespace: string, prefix?: string): Promise<Array<{
key: string;
value: T;
}>>;
close(): Promise<void>;
}
RedisStorageConfig, StorageDriver.
RedisStorageConfig
Sourceexport interface RedisStorageConfig {
host?: string;
port?: number;
password?: string;
db?: number;
url?: string;
keyPrefix?: string;
ttl?: number;
/** Defaults to legacy; tuple-v1 requires explicit migration and never reads legacy keys. */
keyEncoding?: "legacy" | "tuple-v1";
}
ScopedStorage
Source/**
* Wraps any `StorageDriver` and namespaces every key by tenant / user, providing
* scope namespaces without requiring per-driver changes. Legacy encoding can
* collide for unrestricted IDs; tuple-v1 requires an explicit persisted migration.
*
* Namespace transformation:
* "sessions" + scope { tenantId: "acme", userId: "u1" }
* -> "tenant:acme:user:u1:sessions"
*/
export declare class ScopedStorage implements StorageDriver {
constructor(inner: StorageDriver, scope: StorageScope, options?: ScopedStorageOptions);
initialize(): Promise<void>;
get<T>(namespace: string, key: string): Promise<T | null>;
set<T>(namespace: string, key: string, value: T): Promise<void>;
delete(namespace: string, key: string): Promise<void>;
list<T>(namespace: string, prefix?: string): Promise<Array<{
key: string;
value: T;
}>>;
close(): Promise<void>;
}
ScopedStorageOptions, StorageDriver, StorageScope.
ScopedStorageOptions
Sourceexport interface ScopedStorageOptions {
/** Legacy defaults preserve existing records. Select tuple-v1 for unrestricted shared-storage identities. */
keyEncoding?: "legacy" | "tuple-v1";
/** Defaults to true. Borrowed wrappers should pass false so close leaves the inner driver open. */
ownsInner?: boolean;
}
SqliteStorage
Sourceexport declare class SqliteStorage implements StorageDriver {
constructor(dbPath: string);
get<T>(namespace: string, key: string): Promise<T | null>;
set<T>(namespace: string, key: string, value: T): Promise<void>;
delete(namespace: string, key: string): Promise<void>;
list<T>(namespace: string, prefix?: string): Promise<Array<{
key: string;
value: T;
}>>;
close(): Promise<void>;
}
StorageDriver.
StorageDriver
Sourceexport interface StorageDriver {
initialize?(): Promise<void>;
get<T>(namespace: string, key: string): Promise<T | null>;
set<T>(namespace: string, key: string, value: T): Promise<void>;
delete(namespace: string, key: string): Promise<void>;
list<T>(namespace: string, prefix?: string): Promise<Array<{
key: string;
value: T;
}>>;
close(): Promise<void>;
}
StorageScope
Sourceexport interface StorageScope {
/** Tenant / organization identifier. */
tenantId?: string;
/** User identifier within the tenant. */
userId?: string;
}