@elizaos/plugin-sql 1.6.5-alpha.9 → 1.6.5
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/dist/browser/index.browser.js +1907 -436
- package/dist/browser/index.browser.js.map +26 -23
- package/dist/browser/tsconfig.build.tsbuildinfo +1 -1
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.node.js +1436 -662
- package/dist/node/index.node.js.map +33 -31
- package/dist/node/tsconfig.build.node.tsbuildinfo +1 -1
- package/package.json +17 -14
- package/dist/browser/base.d.ts +0 -926
- package/dist/browser/index.browser.d.ts +0 -11
- package/dist/browser/migration-service.d.ts +0 -43
- package/dist/browser/pglite/adapter.d.ts +0 -68
- package/dist/browser/pglite/manager.d.ts +0 -21
- package/dist/browser/runtime-migrator/drizzle-adapters/database-introspector.d.ts +0 -62
- package/dist/browser/runtime-migrator/drizzle-adapters/diff-calculator.d.ts +0 -59
- package/dist/browser/runtime-migrator/drizzle-adapters/snapshot-generator.d.ts +0 -18
- package/dist/browser/runtime-migrator/drizzle-adapters/sql-generator.d.ts +0 -38
- package/dist/browser/runtime-migrator/extension-manager.d.ts +0 -6
- package/dist/browser/runtime-migrator/index.d.ts +0 -8
- package/dist/browser/runtime-migrator/runtime-migrator.d.ts +0 -96
- package/dist/browser/runtime-migrator/schema-transformer.d.ts +0 -16
- package/dist/browser/runtime-migrator/storage/journal-storage.d.ts +0 -10
- package/dist/browser/runtime-migrator/storage/migration-tracker.d.ts +0 -13
- package/dist/browser/runtime-migrator/storage/snapshot-storage.d.ts +0 -9
- package/dist/browser/runtime-migrator/types.d.ts +0 -48
- package/dist/browser/schema/agent.d.ts +0 -344
- package/dist/browser/schema/cache.d.ts +0 -97
- package/dist/browser/schema/channel.d.ts +0 -177
- package/dist/browser/schema/channelParticipant.d.ts +0 -41
- package/dist/browser/schema/component.d.ts +0 -163
- package/dist/browser/schema/embedding.d.ts +0 -193
- package/dist/browser/schema/entity.d.ts +0 -122
- package/dist/browser/schema/index.d.ts +0 -18
- package/dist/browser/schema/log.d.ts +0 -114
- package/dist/browser/schema/memory.d.ts +0 -188
- package/dist/browser/schema/message.d.ts +0 -1
- package/dist/browser/schema/messageServer.d.ts +0 -126
- package/dist/browser/schema/owners.d.ts +0 -63
- package/dist/browser/schema/participant.d.ts +0 -114
- package/dist/browser/schema/relationship.d.ts +0 -156
- package/dist/browser/schema/room.d.ts +0 -192
- package/dist/browser/schema/serverAgent.d.ts +0 -41
- package/dist/browser/schema/tasks.d.ts +0 -225
- package/dist/browser/schema/types.d.ts +0 -68
- package/dist/browser/schema/world.d.ts +0 -114
- package/dist/browser/src/base.d.ts +0 -926
- package/dist/browser/src/index.browser.d.ts +0 -11
- package/dist/browser/src/migration-service.d.ts +0 -43
- package/dist/browser/src/pglite/adapter.d.ts +0 -68
- package/dist/browser/src/pglite/manager.d.ts +0 -21
- package/dist/browser/src/runtime-migrator/drizzle-adapters/database-introspector.d.ts +0 -62
- package/dist/browser/src/runtime-migrator/drizzle-adapters/diff-calculator.d.ts +0 -59
- package/dist/browser/src/runtime-migrator/drizzle-adapters/snapshot-generator.d.ts +0 -18
- package/dist/browser/src/runtime-migrator/drizzle-adapters/sql-generator.d.ts +0 -38
- package/dist/browser/src/runtime-migrator/extension-manager.d.ts +0 -6
- package/dist/browser/src/runtime-migrator/index.d.ts +0 -8
- package/dist/browser/src/runtime-migrator/runtime-migrator.d.ts +0 -96
- package/dist/browser/src/runtime-migrator/schema-transformer.d.ts +0 -16
- package/dist/browser/src/runtime-migrator/storage/journal-storage.d.ts +0 -10
- package/dist/browser/src/runtime-migrator/storage/migration-tracker.d.ts +0 -13
- package/dist/browser/src/runtime-migrator/storage/snapshot-storage.d.ts +0 -9
- package/dist/browser/src/runtime-migrator/types.d.ts +0 -48
- package/dist/browser/src/schema/agent.d.ts +0 -344
- package/dist/browser/src/schema/cache.d.ts +0 -97
- package/dist/browser/src/schema/channel.d.ts +0 -177
- package/dist/browser/src/schema/channelParticipant.d.ts +0 -41
- package/dist/browser/src/schema/component.d.ts +0 -163
- package/dist/browser/src/schema/embedding.d.ts +0 -193
- package/dist/browser/src/schema/entity.d.ts +0 -122
- package/dist/browser/src/schema/index.d.ts +0 -18
- package/dist/browser/src/schema/log.d.ts +0 -114
- package/dist/browser/src/schema/memory.d.ts +0 -188
- package/dist/browser/src/schema/message.d.ts +0 -1
- package/dist/browser/src/schema/messageServer.d.ts +0 -126
- package/dist/browser/src/schema/owners.d.ts +0 -63
- package/dist/browser/src/schema/participant.d.ts +0 -114
- package/dist/browser/src/schema/relationship.d.ts +0 -156
- package/dist/browser/src/schema/room.d.ts +0 -192
- package/dist/browser/src/schema/serverAgent.d.ts +0 -41
- package/dist/browser/src/schema/tasks.d.ts +0 -225
- package/dist/browser/src/schema/types.d.ts +0 -68
- package/dist/browser/src/schema/world.d.ts +0 -114
- package/dist/browser/src/types.d.ts +0 -15
- package/dist/browser/src/utils.browser.d.ts +0 -21
- package/dist/browser/types.d.ts +0 -15
- package/dist/browser/utils.browser.d.ts +0 -21
- package/dist/node/src/base.d.ts +0 -926
- package/dist/node/src/index.d.ts +0 -33
- package/dist/node/src/index.node.d.ts +0 -10
- package/dist/node/src/migration-service.d.ts +0 -43
- package/dist/node/src/pg/adapter.d.ts +0 -69
- package/dist/node/src/pg/manager.d.ts +0 -17
- package/dist/node/src/pglite/adapter.d.ts +0 -68
- package/dist/node/src/pglite/manager.d.ts +0 -21
- package/dist/node/src/rls.d.ts +0 -43
- package/dist/node/src/runtime-migrator/drizzle-adapters/database-introspector.d.ts +0 -62
- package/dist/node/src/runtime-migrator/drizzle-adapters/diff-calculator.d.ts +0 -59
- package/dist/node/src/runtime-migrator/drizzle-adapters/snapshot-generator.d.ts +0 -18
- package/dist/node/src/runtime-migrator/drizzle-adapters/sql-generator.d.ts +0 -38
- package/dist/node/src/runtime-migrator/extension-manager.d.ts +0 -6
- package/dist/node/src/runtime-migrator/index.d.ts +0 -8
- package/dist/node/src/runtime-migrator/runtime-migrator.d.ts +0 -96
- package/dist/node/src/runtime-migrator/schema-transformer.d.ts +0 -16
- package/dist/node/src/runtime-migrator/storage/journal-storage.d.ts +0 -10
- package/dist/node/src/runtime-migrator/storage/migration-tracker.d.ts +0 -13
- package/dist/node/src/runtime-migrator/storage/snapshot-storage.d.ts +0 -9
- package/dist/node/src/runtime-migrator/types.d.ts +0 -48
- package/dist/node/src/schema/agent.d.ts +0 -344
- package/dist/node/src/schema/cache.d.ts +0 -97
- package/dist/node/src/schema/channel.d.ts +0 -177
- package/dist/node/src/schema/channelParticipant.d.ts +0 -41
- package/dist/node/src/schema/component.d.ts +0 -163
- package/dist/node/src/schema/embedding.d.ts +0 -193
- package/dist/node/src/schema/entity.d.ts +0 -122
- package/dist/node/src/schema/index.d.ts +0 -18
- package/dist/node/src/schema/log.d.ts +0 -114
- package/dist/node/src/schema/memory.d.ts +0 -188
- package/dist/node/src/schema/message.d.ts +0 -1
- package/dist/node/src/schema/messageServer.d.ts +0 -126
- package/dist/node/src/schema/owners.d.ts +0 -63
- package/dist/node/src/schema/participant.d.ts +0 -114
- package/dist/node/src/schema/relationship.d.ts +0 -156
- package/dist/node/src/schema/room.d.ts +0 -192
- package/dist/node/src/schema/serverAgent.d.ts +0 -41
- package/dist/node/src/schema/tasks.d.ts +0 -225
- package/dist/node/src/schema/types.d.ts +0 -68
- package/dist/node/src/schema/world.d.ts +0 -114
- package/dist/node/src/types.d.ts +0 -15
- package/dist/node/src/utils.d.ts +0 -32
- package/dist/node/src/utils.node.d.ts +0 -6
package/dist/node/src/base.d.ts
DELETED
|
@@ -1,926 +0,0 @@
|
|
|
1
|
-
import { type Agent, type Component, DatabaseAdapter, type Entity, type Log, type Memory, type MemoryMetadata, type Participant, type Relationship, type Room, type Task, type UUID, type World, type AgentRunSummaryResult, type RunStatus } from '@elizaos/core';
|
|
2
|
-
import type { DatabaseMigrationService } from './migration-service';
|
|
3
|
-
import { type EmbeddingDimensionColumn } from './schema/embedding';
|
|
4
|
-
/**
|
|
5
|
-
* Represents metadata information about memory.
|
|
6
|
-
* @typedef {Object} MemoryMetadata
|
|
7
|
-
* @property {string} type - The type of memory.
|
|
8
|
-
* @property {string} [source] - The source of the memory.
|
|
9
|
-
* @property {UUID} [sourceId] - The ID of the source.
|
|
10
|
-
* @property {string} [scope] - The scope of the memory.
|
|
11
|
-
* @property {number} [timestamp] - The timestamp of the memory.
|
|
12
|
-
* @property {string[]} [tags] - The tags associated with the memory.
|
|
13
|
-
* @property {UUID} [documentId] - The ID of the document associated with the memory.
|
|
14
|
-
* @property {number} [position] - The position of the memory.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Abstract class representing a base Drizzle adapter for working with databases.
|
|
18
|
-
* This adapter provides a comprehensive set of methods for interacting with a database
|
|
19
|
-
* using Drizzle ORM. It implements the DatabaseAdapter interface and handles operations
|
|
20
|
-
* for various entity types including agents, entities, components, memories, rooms,
|
|
21
|
-
* participants, relationships, tasks, and more.
|
|
22
|
-
*
|
|
23
|
-
* The adapter includes built-in retry logic for database operations, embedding dimension
|
|
24
|
-
* management, and transaction support. Concrete implementations must provide the
|
|
25
|
-
* withDatabase method to execute operations against their specific database.
|
|
26
|
-
*/
|
|
27
|
-
export declare abstract class BaseDrizzleAdapter extends DatabaseAdapter<any> {
|
|
28
|
-
protected readonly maxRetries: number;
|
|
29
|
-
protected readonly baseDelay: number;
|
|
30
|
-
protected readonly maxDelay: number;
|
|
31
|
-
protected readonly jitterMax: number;
|
|
32
|
-
protected embeddingDimension: EmbeddingDimensionColumn;
|
|
33
|
-
protected migrationService?: DatabaseMigrationService;
|
|
34
|
-
protected abstract withDatabase<T>(operation: () => Promise<T>): Promise<T>;
|
|
35
|
-
abstract init(): Promise<void>;
|
|
36
|
-
abstract close(): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Initialize method that can be overridden by implementations
|
|
39
|
-
*/
|
|
40
|
-
initialize(): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Run plugin schema migrations for all registered plugins
|
|
43
|
-
* @param plugins Array of plugins with their schemas
|
|
44
|
-
* @param options Migration options (verbose, force, dryRun, etc.)
|
|
45
|
-
*/
|
|
46
|
-
runPluginMigrations(plugins: Array<{
|
|
47
|
-
name: string;
|
|
48
|
-
schema?: any;
|
|
49
|
-
}>, options?: {
|
|
50
|
-
verbose?: boolean;
|
|
51
|
-
force?: boolean;
|
|
52
|
-
dryRun?: boolean;
|
|
53
|
-
}): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Get the underlying database instance for testing purposes
|
|
56
|
-
*/
|
|
57
|
-
getDatabase(): any;
|
|
58
|
-
protected agentId: UUID;
|
|
59
|
-
/**
|
|
60
|
-
* Constructor for creating a new instance of Agent with the specified agentId.
|
|
61
|
-
*
|
|
62
|
-
* @param {UUID} agentId - The unique identifier for the agent.
|
|
63
|
-
*/
|
|
64
|
-
constructor(agentId: UUID);
|
|
65
|
-
/**
|
|
66
|
-
* Normalizes entity names to ensure they are always a proper array of strings.
|
|
67
|
-
* Handles strings, Sets, Maps, iterables, and non-iterable values.
|
|
68
|
-
* All array elements are converted to strings to prevent database errors.
|
|
69
|
-
* @param {any} names - The names value to normalize
|
|
70
|
-
* @returns {string[]} A proper array of string names
|
|
71
|
-
* @private
|
|
72
|
-
*/
|
|
73
|
-
private normalizeEntityNames;
|
|
74
|
-
/**
|
|
75
|
-
* Executes the given operation with retry logic.
|
|
76
|
-
* @template T
|
|
77
|
-
* @param {() => Promise<T>} operation - The operation to be executed.
|
|
78
|
-
* @returns {Promise<T>} A promise that resolves with the result of the operation.
|
|
79
|
-
*/
|
|
80
|
-
protected withRetry<T>(operation: () => Promise<T>): Promise<T>;
|
|
81
|
-
/**
|
|
82
|
-
* Asynchronously ensures that the given embedding dimension is valid for the agent.
|
|
83
|
-
*
|
|
84
|
-
* @param {number} dimension - The dimension to ensure for the embedding.
|
|
85
|
-
* @returns {Promise<void>} - Resolves once the embedding dimension is ensured.
|
|
86
|
-
*/
|
|
87
|
-
ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
88
|
-
/**
|
|
89
|
-
* Asynchronously retrieves an agent by their ID from the database.
|
|
90
|
-
* @param {UUID} agentId - The ID of the agent to retrieve.
|
|
91
|
-
* @returns {Promise<Agent | null>} A promise that resolves to the retrieved agent or null if not found.
|
|
92
|
-
*/
|
|
93
|
-
getAgent(agentId: UUID): Promise<Agent | null>;
|
|
94
|
-
/**
|
|
95
|
-
* Asynchronously retrieves a list of agents from the database.
|
|
96
|
-
*
|
|
97
|
-
* @returns {Promise<Partial<Agent>[]>} A Promise that resolves to an array of Agent objects.
|
|
98
|
-
*/
|
|
99
|
-
getAgents(): Promise<Partial<Agent>[]>;
|
|
100
|
-
/**
|
|
101
|
-
* Asynchronously creates a new agent record in the database.
|
|
102
|
-
*
|
|
103
|
-
* @param {Partial<Agent>} agent The agent object to be created.
|
|
104
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating the success of the operation.
|
|
105
|
-
*/
|
|
106
|
-
createAgent(agent: Agent): Promise<boolean>;
|
|
107
|
-
/**
|
|
108
|
-
* Updates an agent in the database with the provided agent ID and data.
|
|
109
|
-
* @param {UUID} agentId - The unique identifier of the agent to update.
|
|
110
|
-
* @param {Partial<Agent>} agent - The partial agent object containing the fields to update.
|
|
111
|
-
* @returns {Promise<boolean>} - A boolean indicating if the agent was successfully updated.
|
|
112
|
-
*/
|
|
113
|
-
updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
|
|
114
|
-
/**
|
|
115
|
-
* Merges updated agent settings with existing settings in the database,
|
|
116
|
-
* with special handling for nested objects like secrets.
|
|
117
|
-
* @param tx - The database transaction
|
|
118
|
-
* @param agentId - The ID of the agent
|
|
119
|
-
* @param updatedSettings - The settings object with updates
|
|
120
|
-
* @returns The merged settings object
|
|
121
|
-
* @private
|
|
122
|
-
*/
|
|
123
|
-
private mergeAgentSettings;
|
|
124
|
-
/**
|
|
125
|
-
* Asynchronously deletes an agent with the specified UUID and all related entries.
|
|
126
|
-
*
|
|
127
|
-
* @param {UUID} agentId - The UUID of the agent to be deleted.
|
|
128
|
-
* @returns {Promise<boolean>} - A boolean indicating if the deletion was successful.
|
|
129
|
-
*/
|
|
130
|
-
deleteAgent(agentId: UUID): Promise<boolean>;
|
|
131
|
-
/**
|
|
132
|
-
* Count all agents in the database
|
|
133
|
-
* Used primarily for maintenance and cleanup operations
|
|
134
|
-
*/
|
|
135
|
-
/**
|
|
136
|
-
* Asynchronously counts the number of agents in the database.
|
|
137
|
-
* @returns {Promise<number>} A Promise that resolves to the number of agents in the database.
|
|
138
|
-
*/
|
|
139
|
-
countAgents(): Promise<number>;
|
|
140
|
-
/**
|
|
141
|
-
* Clean up the agents table by removing all agents
|
|
142
|
-
* This is used during server startup to ensure no orphaned agents exist
|
|
143
|
-
* from previous crashes or improper shutdowns
|
|
144
|
-
*/
|
|
145
|
-
cleanupAgents(): Promise<void>;
|
|
146
|
-
/**
|
|
147
|
-
* Asynchronously retrieves an entity and its components by entity IDs.
|
|
148
|
-
* @param {UUID[]} entityIds - The unique identifiers of the entities to retrieve.
|
|
149
|
-
* @returns {Promise<Entity[] | null>} A Promise that resolves to the entity with its components if found, null otherwise.
|
|
150
|
-
*/
|
|
151
|
-
getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
|
|
152
|
-
/**
|
|
153
|
-
* Asynchronously retrieves all entities for a given room, optionally including their components.
|
|
154
|
-
* @param {UUID} roomId - The unique identifier of the room to get entities for
|
|
155
|
-
* @param {boolean} [includeComponents] - Whether to include component data for each entity
|
|
156
|
-
* @returns {Promise<Entity[]>} A Promise that resolves to an array of entities in the room
|
|
157
|
-
*/
|
|
158
|
-
getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
159
|
-
/**
|
|
160
|
-
* Asynchronously creates new entities in the database.
|
|
161
|
-
* @param {Entity[]} entities - The entity objects to be created.
|
|
162
|
-
* @returns {Promise<boolean>} A Promise that resolves to a boolean indicating the success of the operation.
|
|
163
|
-
*/
|
|
164
|
-
createEntities(entities: Entity[]): Promise<boolean>;
|
|
165
|
-
/**
|
|
166
|
-
* Asynchronously ensures an entity exists, creating it if it doesn't
|
|
167
|
-
* @param entity The entity to ensure exists
|
|
168
|
-
* @returns Promise resolving to boolean indicating success
|
|
169
|
-
*/
|
|
170
|
-
protected ensureEntityExists(entity: Entity): Promise<boolean>;
|
|
171
|
-
/**
|
|
172
|
-
* Asynchronously updates an entity in the database.
|
|
173
|
-
* @param {Entity} entity - The entity object to be updated.
|
|
174
|
-
* @returns {Promise<void>} A Promise that resolves when the entity is updated.
|
|
175
|
-
*/
|
|
176
|
-
updateEntity(entity: Entity): Promise<void>;
|
|
177
|
-
/**
|
|
178
|
-
* Asynchronously deletes an entity from the database based on the provided ID.
|
|
179
|
-
* @param {UUID} entityId - The ID of the entity to delete.
|
|
180
|
-
* @returns {Promise<void>} A Promise that resolves when the entity is deleted.
|
|
181
|
-
*/
|
|
182
|
-
deleteEntity(entityId: UUID): Promise<void>;
|
|
183
|
-
/**
|
|
184
|
-
* Asynchronously retrieves entities by their names and agentId.
|
|
185
|
-
* @param {Object} params - The parameters for retrieving entities.
|
|
186
|
-
* @param {string[]} params.names - The names to search for.
|
|
187
|
-
* @param {UUID} params.agentId - The agent ID to filter by.
|
|
188
|
-
* @returns {Promise<Entity[]>} A Promise that resolves to an array of entities.
|
|
189
|
-
*/
|
|
190
|
-
getEntitiesByNames(params: {
|
|
191
|
-
names: string[];
|
|
192
|
-
agentId: UUID;
|
|
193
|
-
}): Promise<Entity[]>;
|
|
194
|
-
/**
|
|
195
|
-
* Asynchronously searches for entities by name with fuzzy matching.
|
|
196
|
-
* @param {Object} params - The parameters for searching entities.
|
|
197
|
-
* @param {string} params.query - The search query.
|
|
198
|
-
* @param {UUID} params.agentId - The agent ID to filter by.
|
|
199
|
-
* @param {number} params.limit - The maximum number of results to return.
|
|
200
|
-
* @returns {Promise<Entity[]>} A Promise that resolves to an array of entities.
|
|
201
|
-
*/
|
|
202
|
-
searchEntitiesByName(params: {
|
|
203
|
-
query: string;
|
|
204
|
-
agentId: UUID;
|
|
205
|
-
limit?: number;
|
|
206
|
-
}): Promise<Entity[]>;
|
|
207
|
-
getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
|
|
208
|
-
/**
|
|
209
|
-
* Asynchronously retrieves all components for a given entity, optionally filtered by world and source entity.
|
|
210
|
-
* @param {UUID} entityId - The unique identifier of the entity to retrieve components for
|
|
211
|
-
* @param {UUID} [worldId] - Optional world ID to filter components by
|
|
212
|
-
* @param {UUID} [sourceEntityId] - Optional source entity ID to filter components by
|
|
213
|
-
* @returns {Promise<Component[]>} A Promise that resolves to an array of components
|
|
214
|
-
*/
|
|
215
|
-
getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
216
|
-
/**
|
|
217
|
-
* Asynchronously creates a new component in the database.
|
|
218
|
-
* @param {Component} component - The component object to be created.
|
|
219
|
-
* @returns {Promise<boolean>} A Promise that resolves to a boolean indicating the success of the operation.
|
|
220
|
-
*/
|
|
221
|
-
createComponent(component: Component): Promise<boolean>;
|
|
222
|
-
/**
|
|
223
|
-
* Asynchronously updates an existing component in the database.
|
|
224
|
-
* @param {Component} component - The component object to be updated.
|
|
225
|
-
* @returns {Promise<void>} A Promise that resolves when the component is updated.
|
|
226
|
-
*/
|
|
227
|
-
updateComponent(component: Component): Promise<void>;
|
|
228
|
-
/**
|
|
229
|
-
* Asynchronously deletes a component from the database.
|
|
230
|
-
* @param {UUID} componentId - The unique identifier of the component to delete.
|
|
231
|
-
* @returns {Promise<void>} A Promise that resolves when the component is deleted.
|
|
232
|
-
*/
|
|
233
|
-
deleteComponent(componentId: UUID): Promise<void>;
|
|
234
|
-
/**
|
|
235
|
-
* Asynchronously retrieves memories from the database based on the provided parameters.
|
|
236
|
-
* @param {Object} params - The parameters for retrieving memories.
|
|
237
|
-
* @param {UUID} params.roomId - The ID of the room to retrieve memories for.
|
|
238
|
-
* @param {number} [params.count] - The maximum number of memories to retrieve.
|
|
239
|
-
* @param {number} [params.offset] - The offset for pagination.
|
|
240
|
-
* @param {boolean} [params.unique] - Whether to retrieve unique memories only.
|
|
241
|
-
* @param {string} [params.tableName] - The name of the table to retrieve memories from.
|
|
242
|
-
* @param {number} [params.start] - The start date to retrieve memories from.
|
|
243
|
-
* @param {number} [params.end] - The end date to retrieve memories from.
|
|
244
|
-
* @returns {Promise<Memory[]>} A Promise that resolves to an array of memories.
|
|
245
|
-
*/
|
|
246
|
-
getMemories(params: {
|
|
247
|
-
entityId?: UUID;
|
|
248
|
-
agentId?: UUID;
|
|
249
|
-
count?: number;
|
|
250
|
-
offset?: number;
|
|
251
|
-
unique?: boolean;
|
|
252
|
-
tableName: string;
|
|
253
|
-
start?: number;
|
|
254
|
-
end?: number;
|
|
255
|
-
roomId?: UUID;
|
|
256
|
-
worldId?: UUID;
|
|
257
|
-
}): Promise<Memory[]>;
|
|
258
|
-
/**
|
|
259
|
-
* Asynchronously retrieves memories from the database based on the provided parameters.
|
|
260
|
-
* @param {Object} params - The parameters for retrieving memories.
|
|
261
|
-
* @param {UUID[]} params.roomIds - The IDs of the rooms to retrieve memories for.
|
|
262
|
-
* @param {string} params.tableName - The name of the table to retrieve memories from.
|
|
263
|
-
* @param {number} [params.limit] - The maximum number of memories to retrieve.
|
|
264
|
-
* @returns {Promise<Memory[]>} A Promise that resolves to an array of memories.
|
|
265
|
-
*/
|
|
266
|
-
getMemoriesByRoomIds(params: {
|
|
267
|
-
roomIds: UUID[];
|
|
268
|
-
tableName: string;
|
|
269
|
-
limit?: number;
|
|
270
|
-
}): Promise<Memory[]>;
|
|
271
|
-
/**
|
|
272
|
-
* Asynchronously retrieves a memory by its unique identifier.
|
|
273
|
-
* @param {UUID} id - The unique identifier of the memory to retrieve.
|
|
274
|
-
* @returns {Promise<Memory | null>} A Promise that resolves to the memory if found, null otherwise.
|
|
275
|
-
*/
|
|
276
|
-
getMemoryById(id: UUID): Promise<Memory | null>;
|
|
277
|
-
/**
|
|
278
|
-
* Asynchronously retrieves memories from the database based on the provided parameters.
|
|
279
|
-
* @param {Object} params - The parameters for retrieving memories.
|
|
280
|
-
* @param {UUID[]} params.memoryIds - The IDs of the memories to retrieve.
|
|
281
|
-
* @param {string} [params.tableName] - The name of the table to retrieve memories from.
|
|
282
|
-
* @returns {Promise<Memory[]>} A Promise that resolves to an array of memories.
|
|
283
|
-
*/
|
|
284
|
-
getMemoriesByIds(memoryIds: UUID[], tableName?: string): Promise<Memory[]>;
|
|
285
|
-
/**
|
|
286
|
-
* Asynchronously retrieves cached embeddings from the database based on the provided parameters.
|
|
287
|
-
* @param {Object} opts - The parameters for retrieving cached embeddings.
|
|
288
|
-
* @param {string} opts.query_table_name - The name of the table to retrieve embeddings from.
|
|
289
|
-
* @param {number} opts.query_threshold - The threshold for the levenshtein distance.
|
|
290
|
-
* @param {string} opts.query_input - The input string to search for.
|
|
291
|
-
* @param {string} opts.query_field_name - The name of the field to retrieve embeddings from.
|
|
292
|
-
* @param {string} opts.query_field_sub_name - The name of the sub-field to retrieve embeddings from.
|
|
293
|
-
* @param {number} opts.query_match_count - The maximum number of matches to retrieve.
|
|
294
|
-
* @returns {Promise<{ embedding: number[]; levenshtein_score: number }[]>} A Promise that resolves to an array of cached embeddings.
|
|
295
|
-
*/
|
|
296
|
-
getCachedEmbeddings(opts: {
|
|
297
|
-
query_table_name: string;
|
|
298
|
-
query_threshold: number;
|
|
299
|
-
query_input: string;
|
|
300
|
-
query_field_name: string;
|
|
301
|
-
query_field_sub_name: string;
|
|
302
|
-
query_match_count: number;
|
|
303
|
-
}): Promise<{
|
|
304
|
-
embedding: number[];
|
|
305
|
-
levenshtein_score: number;
|
|
306
|
-
}[]>;
|
|
307
|
-
/**
|
|
308
|
-
* Asynchronously logs an event in the database.
|
|
309
|
-
* @param {Object} params - The parameters for logging an event.
|
|
310
|
-
* @param {Object} params.body - The body of the event to log.
|
|
311
|
-
* @param {UUID} params.entityId - The ID of the entity associated with the event.
|
|
312
|
-
* @param {UUID} params.roomId - The ID of the room associated with the event.
|
|
313
|
-
* @param {string} params.type - The type of the event to log.
|
|
314
|
-
* @returns {Promise<void>} A Promise that resolves when the event is logged.
|
|
315
|
-
*/
|
|
316
|
-
log(params: {
|
|
317
|
-
body: {
|
|
318
|
-
[key: string]: unknown;
|
|
319
|
-
};
|
|
320
|
-
entityId: UUID;
|
|
321
|
-
roomId: UUID;
|
|
322
|
-
type: string;
|
|
323
|
-
}): Promise<void>;
|
|
324
|
-
/**
|
|
325
|
-
* Sanitizes a JSON object by replacing problematic Unicode escape sequences
|
|
326
|
-
* that could cause errors during JSON serialization/storage
|
|
327
|
-
*
|
|
328
|
-
* @param value - The value to sanitize
|
|
329
|
-
* @returns The sanitized value
|
|
330
|
-
*/
|
|
331
|
-
private sanitizeJsonObject;
|
|
332
|
-
/**
|
|
333
|
-
* Asynchronously retrieves logs from the database based on the provided parameters.
|
|
334
|
-
* @param {Object} params - The parameters for retrieving logs.
|
|
335
|
-
* @param {UUID} params.entityId - The ID of the entity associated with the logs.
|
|
336
|
-
* @param {UUID} [params.roomId] - The ID of the room associated with the logs.
|
|
337
|
-
* @param {string} [params.type] - The type of the logs to retrieve.
|
|
338
|
-
* @param {number} [params.count] - The maximum number of logs to retrieve.
|
|
339
|
-
* @param {number} [params.offset] - The offset to retrieve logs from.
|
|
340
|
-
* @returns {Promise<Log[]>} A Promise that resolves to an array of logs.
|
|
341
|
-
*/
|
|
342
|
-
getLogs(params: {
|
|
343
|
-
entityId: UUID;
|
|
344
|
-
roomId?: UUID;
|
|
345
|
-
type?: string;
|
|
346
|
-
count?: number;
|
|
347
|
-
offset?: number;
|
|
348
|
-
}): Promise<Log[]>;
|
|
349
|
-
getAgentRunSummaries(params?: {
|
|
350
|
-
limit?: number;
|
|
351
|
-
roomId?: UUID;
|
|
352
|
-
status?: RunStatus | 'all';
|
|
353
|
-
from?: number;
|
|
354
|
-
to?: number;
|
|
355
|
-
}): Promise<AgentRunSummaryResult>;
|
|
356
|
-
/**
|
|
357
|
-
* Asynchronously deletes a log from the database based on the provided parameters.
|
|
358
|
-
* @param {UUID} logId - The ID of the log to delete.
|
|
359
|
-
* @returns {Promise<void>} A Promise that resolves when the log is deleted.
|
|
360
|
-
*/
|
|
361
|
-
deleteLog(logId: UUID): Promise<void>;
|
|
362
|
-
/**
|
|
363
|
-
* Asynchronously searches for memories in the database based on the provided parameters.
|
|
364
|
-
* @param {Object} params - The parameters for searching for memories.
|
|
365
|
-
* @param {string} params.tableName - The name of the table to search for memories in.
|
|
366
|
-
* @param {number[]} params.embedding - The embedding to search for.
|
|
367
|
-
* @param {number} [params.match_threshold] - The threshold for the cosine distance.
|
|
368
|
-
* @param {number} [params.count] - The maximum number of memories to retrieve.
|
|
369
|
-
* @param {boolean} [params.unique] - Whether to retrieve unique memories only.
|
|
370
|
-
* @param {string} [params.query] - Optional query string for potential reranking.
|
|
371
|
-
* @param {UUID} [params.roomId] - Optional room ID to filter by.
|
|
372
|
-
* @param {UUID} [params.worldId] - Optional world ID to filter by.
|
|
373
|
-
* @param {UUID} [params.entityId] - Optional entity ID to filter by.
|
|
374
|
-
* @returns {Promise<Memory[]>} A Promise that resolves to an array of memories.
|
|
375
|
-
*/
|
|
376
|
-
searchMemories(params: {
|
|
377
|
-
tableName: string;
|
|
378
|
-
embedding: number[];
|
|
379
|
-
match_threshold?: number;
|
|
380
|
-
count?: number;
|
|
381
|
-
unique?: boolean;
|
|
382
|
-
query?: string;
|
|
383
|
-
roomId?: UUID;
|
|
384
|
-
worldId?: UUID;
|
|
385
|
-
entityId?: UUID;
|
|
386
|
-
}): Promise<Memory[]>;
|
|
387
|
-
/**
|
|
388
|
-
* Asynchronously searches for memories in the database based on the provided parameters.
|
|
389
|
-
* @param {number[]} embedding - The embedding to search for.
|
|
390
|
-
* @param {Object} params - The parameters for searching for memories.
|
|
391
|
-
* @param {number} [params.match_threshold] - The threshold for the cosine distance.
|
|
392
|
-
* @param {number} [params.count] - The maximum number of memories to retrieve.
|
|
393
|
-
* @param {UUID} [params.roomId] - Optional room ID to filter by.
|
|
394
|
-
* @param {UUID} [params.worldId] - Optional world ID to filter by.
|
|
395
|
-
* @param {UUID} [params.entityId] - Optional entity ID to filter by.
|
|
396
|
-
* @param {boolean} [params.unique] - Whether to retrieve unique memories only.
|
|
397
|
-
* @param {string} [params.tableName] - The name of the table to search for memories in.
|
|
398
|
-
* @returns {Promise<Memory[]>} A Promise that resolves to an array of memories.
|
|
399
|
-
*/
|
|
400
|
-
searchMemoriesByEmbedding(embedding: number[], params: {
|
|
401
|
-
match_threshold?: number;
|
|
402
|
-
count?: number;
|
|
403
|
-
roomId?: UUID;
|
|
404
|
-
worldId?: UUID;
|
|
405
|
-
entityId?: UUID;
|
|
406
|
-
unique?: boolean;
|
|
407
|
-
tableName: string;
|
|
408
|
-
}): Promise<Memory[]>;
|
|
409
|
-
/**
|
|
410
|
-
* Asynchronously creates a new memory in the database.
|
|
411
|
-
* @param {Memory & { metadata?: MemoryMetadata }} memory - The memory object to create.
|
|
412
|
-
* @param {string} tableName - The name of the table to create the memory in.
|
|
413
|
-
* @returns {Promise<UUID>} A Promise that resolves to the ID of the created memory.
|
|
414
|
-
*/
|
|
415
|
-
createMemory(memory: Memory & {
|
|
416
|
-
metadata?: MemoryMetadata;
|
|
417
|
-
}, tableName: string): Promise<UUID>;
|
|
418
|
-
/**
|
|
419
|
-
* Updates an existing memory in the database.
|
|
420
|
-
* @param memory The memory object with updated content and optional embedding
|
|
421
|
-
* @returns Promise resolving to boolean indicating success
|
|
422
|
-
*/
|
|
423
|
-
updateMemory(memory: Partial<Memory> & {
|
|
424
|
-
id: UUID;
|
|
425
|
-
metadata?: MemoryMetadata;
|
|
426
|
-
}): Promise<boolean>;
|
|
427
|
-
/**
|
|
428
|
-
* Asynchronously deletes a memory from the database based on the provided parameters.
|
|
429
|
-
* @param {UUID} memoryId - The ID of the memory to delete.
|
|
430
|
-
* @returns {Promise<void>} A Promise that resolves when the memory is deleted.
|
|
431
|
-
*/
|
|
432
|
-
deleteMemory(memoryId: UUID): Promise<void>;
|
|
433
|
-
/**
|
|
434
|
-
* Asynchronously deletes multiple memories from the database in a single batch operation.
|
|
435
|
-
* @param {UUID[]} memoryIds - An array of UUIDs of the memories to delete.
|
|
436
|
-
* @returns {Promise<void>} A Promise that resolves when all memories are deleted.
|
|
437
|
-
*/
|
|
438
|
-
deleteManyMemories(memoryIds: UUID[]): Promise<void>;
|
|
439
|
-
/**
|
|
440
|
-
* Deletes all memory fragments that reference a specific document memory
|
|
441
|
-
* @param tx The database transaction
|
|
442
|
-
* @param documentId The UUID of the document memory whose fragments should be deleted
|
|
443
|
-
* @private
|
|
444
|
-
*/
|
|
445
|
-
private deleteMemoryFragments;
|
|
446
|
-
/**
|
|
447
|
-
* Retrieves all memory fragments that reference a specific document memory
|
|
448
|
-
* @param tx The database transaction
|
|
449
|
-
* @param documentId The UUID of the document memory whose fragments should be retrieved
|
|
450
|
-
* @returns An array of memory fragments
|
|
451
|
-
* @private
|
|
452
|
-
*/
|
|
453
|
-
private getMemoryFragments;
|
|
454
|
-
/**
|
|
455
|
-
* Asynchronously deletes all memories from the database based on the provided parameters.
|
|
456
|
-
* @param {UUID} roomId - The ID of the room to delete memories from.
|
|
457
|
-
* @param {string} tableName - The name of the table to delete memories from.
|
|
458
|
-
* @returns {Promise<void>} A Promise that resolves when the memories are deleted.
|
|
459
|
-
*/
|
|
460
|
-
deleteAllMemories(roomId: UUID, tableName: string): Promise<void>;
|
|
461
|
-
/**
|
|
462
|
-
* Asynchronously counts the number of memories in the database based on the provided parameters.
|
|
463
|
-
* @param {UUID} roomId - The ID of the room to count memories in.
|
|
464
|
-
* @param {boolean} [unique] - Whether to count unique memories only.
|
|
465
|
-
* @param {string} [tableName] - The name of the table to count memories in.
|
|
466
|
-
* @returns {Promise<number>} A Promise that resolves to the number of memories.
|
|
467
|
-
*/
|
|
468
|
-
countMemories(roomId: UUID, unique?: boolean, tableName?: string): Promise<number>;
|
|
469
|
-
/**
|
|
470
|
-
* Asynchronously retrieves rooms from the database based on the provided parameters.
|
|
471
|
-
* @param {UUID[]} roomIds - The IDs of the rooms to retrieve.
|
|
472
|
-
* @returns {Promise<Room[] | null>} A Promise that resolves to the rooms if found, null otherwise.
|
|
473
|
-
*/
|
|
474
|
-
getRoomsByIds(roomIds: UUID[]): Promise<Room[] | null>;
|
|
475
|
-
/**
|
|
476
|
-
* Asynchronously retrieves all rooms from the database based on the provided parameters.
|
|
477
|
-
* @param {UUID} worldId - The ID of the world to retrieve rooms from.
|
|
478
|
-
* @returns {Promise<Room[]>} A Promise that resolves to an array of rooms.
|
|
479
|
-
*/
|
|
480
|
-
getRoomsByWorld(worldId: UUID): Promise<Room[]>;
|
|
481
|
-
/**
|
|
482
|
-
* Asynchronously updates a room in the database based on the provided parameters.
|
|
483
|
-
* @param {Room} room - The room object to update.
|
|
484
|
-
* @returns {Promise<void>} A Promise that resolves when the room is updated.
|
|
485
|
-
*/
|
|
486
|
-
updateRoom(room: Room): Promise<void>;
|
|
487
|
-
/**
|
|
488
|
-
* Asynchronously creates a new room in the database based on the provided parameters.
|
|
489
|
-
* @param {Room} room - The room object to create.
|
|
490
|
-
* @returns {Promise<UUID>} A Promise that resolves to the ID of the created room.
|
|
491
|
-
*/
|
|
492
|
-
createRooms(rooms: Room[]): Promise<UUID[]>;
|
|
493
|
-
/**
|
|
494
|
-
* Asynchronously deletes a room from the database based on the provided parameters.
|
|
495
|
-
* @param {UUID} roomId - The ID of the room to delete.
|
|
496
|
-
* @returns {Promise<void>} A Promise that resolves when the room is deleted.
|
|
497
|
-
*/
|
|
498
|
-
deleteRoom(roomId: UUID): Promise<void>;
|
|
499
|
-
/**
|
|
500
|
-
* Asynchronously retrieves all rooms for a participant from the database based on the provided parameters.
|
|
501
|
-
* @param {UUID} entityId - The ID of the entity to retrieve rooms for.
|
|
502
|
-
* @returns {Promise<UUID[]>} A Promise that resolves to an array of room IDs.
|
|
503
|
-
*/
|
|
504
|
-
getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
|
|
505
|
-
/**
|
|
506
|
-
* Asynchronously retrieves all rooms for a list of participants from the database based on the provided parameters.
|
|
507
|
-
* @param {UUID[]} entityIds - The IDs of the entities to retrieve rooms for.
|
|
508
|
-
* @returns {Promise<UUID[]>} A Promise that resolves to an array of room IDs.
|
|
509
|
-
*/
|
|
510
|
-
getRoomsForParticipants(entityIds: UUID[]): Promise<UUID[]>;
|
|
511
|
-
/**
|
|
512
|
-
* Asynchronously adds a participant to a room in the database based on the provided parameters.
|
|
513
|
-
* @param {UUID} entityId - The ID of the entity to add to the room.
|
|
514
|
-
* @param {UUID} roomId - The ID of the room to add the entity to.
|
|
515
|
-
* @returns {Promise<boolean>} A Promise that resolves to a boolean indicating whether the participant was added successfully.
|
|
516
|
-
*/
|
|
517
|
-
addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
518
|
-
addParticipantsRoom(entityIds: UUID[], roomId: UUID): Promise<boolean>;
|
|
519
|
-
/**
|
|
520
|
-
* Asynchronously removes a participant from a room in the database based on the provided parameters.
|
|
521
|
-
* @param {UUID} entityId - The ID of the entity to remove from the room.
|
|
522
|
-
* @param {UUID} roomId - The ID of the room to remove the entity from.
|
|
523
|
-
* @returns {Promise<boolean>} A Promise that resolves to a boolean indicating whether the participant was removed successfully.
|
|
524
|
-
*/
|
|
525
|
-
removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
|
|
526
|
-
/**
|
|
527
|
-
* Asynchronously retrieves all participants for an entity from the database based on the provided parameters.
|
|
528
|
-
* @param {UUID} entityId - The ID of the entity to retrieve participants for.
|
|
529
|
-
* @returns {Promise<Participant[]>} A Promise that resolves to an array of participants.
|
|
530
|
-
*/
|
|
531
|
-
getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
|
|
532
|
-
/**
|
|
533
|
-
* Asynchronously retrieves all participants for a room from the database based on the provided parameters.
|
|
534
|
-
* @param {UUID} roomId - The ID of the room to retrieve participants for.
|
|
535
|
-
* @returns {Promise<UUID[]>} A Promise that resolves to an array of entity IDs.
|
|
536
|
-
*/
|
|
537
|
-
getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
|
|
538
|
-
/**
|
|
539
|
-
* Asynchronously retrieves the user state for a participant in a room from the database based on the provided parameters.
|
|
540
|
-
* @param {UUID} roomId - The ID of the room to retrieve the participant's user state for.
|
|
541
|
-
* @param {UUID} entityId - The ID of the entity to retrieve the user state for.
|
|
542
|
-
* @returns {Promise<"FOLLOWED" | "MUTED" | null>} A Promise that resolves to the participant's user state.
|
|
543
|
-
*/
|
|
544
|
-
getParticipantUserState(roomId: UUID, entityId: UUID): Promise<'FOLLOWED' | 'MUTED' | null>;
|
|
545
|
-
/**
|
|
546
|
-
* Asynchronously sets the user state for a participant in a room in the database based on the provided parameters.
|
|
547
|
-
* @param {UUID} roomId - The ID of the room to set the participant's user state for.
|
|
548
|
-
* @param {UUID} entityId - The ID of the entity to set the user state for.
|
|
549
|
-
* @param {string} state - The state to set the participant's user state to.
|
|
550
|
-
* @returns {Promise<void>} A Promise that resolves when the participant's user state is set.
|
|
551
|
-
*/
|
|
552
|
-
setParticipantUserState(roomId: UUID, entityId: UUID, state: 'FOLLOWED' | 'MUTED' | null): Promise<void>;
|
|
553
|
-
/**
|
|
554
|
-
* Asynchronously creates a new relationship in the database based on the provided parameters.
|
|
555
|
-
* @param {Object} params - The parameters for creating a new relationship.
|
|
556
|
-
* @param {UUID} params.sourceEntityId - The ID of the source entity.
|
|
557
|
-
* @param {UUID} params.targetEntityId - The ID of the target entity.
|
|
558
|
-
* @param {string[]} [params.tags] - The tags for the relationship.
|
|
559
|
-
* @param {Object} [params.metadata] - The metadata for the relationship.
|
|
560
|
-
* @returns {Promise<boolean>} A Promise that resolves to a boolean indicating whether the relationship was created successfully.
|
|
561
|
-
*/
|
|
562
|
-
createRelationship(params: {
|
|
563
|
-
sourceEntityId: UUID;
|
|
564
|
-
targetEntityId: UUID;
|
|
565
|
-
tags?: string[];
|
|
566
|
-
metadata?: {
|
|
567
|
-
[key: string]: unknown;
|
|
568
|
-
};
|
|
569
|
-
}): Promise<boolean>;
|
|
570
|
-
/**
|
|
571
|
-
* Asynchronously updates an existing relationship in the database based on the provided parameters.
|
|
572
|
-
* @param {Relationship} relationship - The relationship object to update.
|
|
573
|
-
* @returns {Promise<void>} A Promise that resolves when the relationship is updated.
|
|
574
|
-
*/
|
|
575
|
-
updateRelationship(relationship: Relationship): Promise<void>;
|
|
576
|
-
/**
|
|
577
|
-
* Asynchronously retrieves a relationship from the database based on the provided parameters.
|
|
578
|
-
* @param {Object} params - The parameters for retrieving a relationship.
|
|
579
|
-
* @param {UUID} params.sourceEntityId - The ID of the source entity.
|
|
580
|
-
* @param {UUID} params.targetEntityId - The ID of the target entity.
|
|
581
|
-
* @returns {Promise<Relationship | null>} A Promise that resolves to the relationship if found, null otherwise.
|
|
582
|
-
*/
|
|
583
|
-
getRelationship(params: {
|
|
584
|
-
sourceEntityId: UUID;
|
|
585
|
-
targetEntityId: UUID;
|
|
586
|
-
}): Promise<Relationship | null>;
|
|
587
|
-
/**
|
|
588
|
-
* Asynchronously retrieves relationships from the database based on the provided parameters.
|
|
589
|
-
* @param {Object} params - The parameters for retrieving relationships.
|
|
590
|
-
* @param {UUID} params.entityId - The ID of the entity to retrieve relationships for.
|
|
591
|
-
* @param {string[]} [params.tags] - The tags to filter relationships by.
|
|
592
|
-
* @returns {Promise<Relationship[]>} A Promise that resolves to an array of relationships.
|
|
593
|
-
*/
|
|
594
|
-
getRelationships(params: {
|
|
595
|
-
entityId: UUID;
|
|
596
|
-
tags?: string[];
|
|
597
|
-
}): Promise<Relationship[]>;
|
|
598
|
-
/**
|
|
599
|
-
* Asynchronously retrieves a cache value from the database based on the provided key.
|
|
600
|
-
* @param {string} key - The key to retrieve the cache value for.
|
|
601
|
-
* @returns {Promise<T | undefined>} A Promise that resolves to the cache value if found, undefined otherwise.
|
|
602
|
-
*/
|
|
603
|
-
getCache<T>(key: string): Promise<T | undefined>;
|
|
604
|
-
/**
|
|
605
|
-
* Asynchronously sets a cache value in the database based on the provided key and value.
|
|
606
|
-
* @param {string} key - The key to set the cache value for.
|
|
607
|
-
* @param {T} value - The value to set in the cache.
|
|
608
|
-
* @returns {Promise<boolean>} A Promise that resolves to a boolean indicating whether the cache value was set successfully.
|
|
609
|
-
*/
|
|
610
|
-
setCache<T>(key: string, value: T): Promise<boolean>;
|
|
611
|
-
/**
|
|
612
|
-
* Asynchronously deletes a cache value from the database based on the provided key.
|
|
613
|
-
* @param {string} key - The key to delete the cache value for.
|
|
614
|
-
* @returns {Promise<boolean>} A Promise that resolves to a boolean indicating whether the cache value was deleted successfully.
|
|
615
|
-
*/
|
|
616
|
-
deleteCache(key: string): Promise<boolean>;
|
|
617
|
-
/**
|
|
618
|
-
* Asynchronously creates a new world in the database based on the provided parameters.
|
|
619
|
-
* @param {World} world - The world object to create.
|
|
620
|
-
* @returns {Promise<UUID>} A Promise that resolves to the ID of the created world.
|
|
621
|
-
*/
|
|
622
|
-
createWorld(world: World): Promise<UUID>;
|
|
623
|
-
/**
|
|
624
|
-
* Asynchronously retrieves a world from the database based on the provided parameters.
|
|
625
|
-
* @param {UUID} id - The ID of the world to retrieve.
|
|
626
|
-
* @returns {Promise<World | null>} A Promise that resolves to the world if found, null otherwise.
|
|
627
|
-
*/
|
|
628
|
-
getWorld(id: UUID): Promise<World | null>;
|
|
629
|
-
/**
|
|
630
|
-
* Asynchronously retrieves all worlds from the database based on the provided parameters.
|
|
631
|
-
* @returns {Promise<World[]>} A Promise that resolves to an array of worlds.
|
|
632
|
-
*/
|
|
633
|
-
getAllWorlds(): Promise<World[]>;
|
|
634
|
-
/**
|
|
635
|
-
* Asynchronously updates an existing world in the database based on the provided parameters.
|
|
636
|
-
* @param {World} world - The world object to update.
|
|
637
|
-
* @returns {Promise<void>} A Promise that resolves when the world is updated.
|
|
638
|
-
*/
|
|
639
|
-
updateWorld(world: World): Promise<void>;
|
|
640
|
-
/**
|
|
641
|
-
* Asynchronously removes a world from the database based on the provided parameters.
|
|
642
|
-
* @param {UUID} id - The ID of the world to remove.
|
|
643
|
-
* @returns {Promise<void>} A Promise that resolves when the world is removed.
|
|
644
|
-
*/
|
|
645
|
-
removeWorld(id: UUID): Promise<void>;
|
|
646
|
-
/**
|
|
647
|
-
* Asynchronously creates a new task in the database based on the provided parameters.
|
|
648
|
-
* @param {Task} task - The task object to create.
|
|
649
|
-
* @returns {Promise<UUID>} A Promise that resolves to the ID of the created task.
|
|
650
|
-
*/
|
|
651
|
-
createTask(task: Task): Promise<UUID>;
|
|
652
|
-
/**
|
|
653
|
-
* Asynchronously retrieves tasks based on specified parameters.
|
|
654
|
-
* @param params Object containing optional roomId, tags, and entityId to filter tasks
|
|
655
|
-
* @returns Promise resolving to an array of Task objects
|
|
656
|
-
*/
|
|
657
|
-
getTasks(params: {
|
|
658
|
-
roomId?: UUID;
|
|
659
|
-
tags?: string[];
|
|
660
|
-
entityId?: UUID;
|
|
661
|
-
}): Promise<Task[]>;
|
|
662
|
-
/**
|
|
663
|
-
* Asynchronously retrieves a specific task by its name.
|
|
664
|
-
* @param name The name of the task to retrieve
|
|
665
|
-
* @returns Promise resolving to the Task object if found, null otherwise
|
|
666
|
-
*/
|
|
667
|
-
getTasksByName(name: string): Promise<Task[]>;
|
|
668
|
-
/**
|
|
669
|
-
* Asynchronously retrieves a specific task by its ID.
|
|
670
|
-
* @param id The UUID of the task to retrieve
|
|
671
|
-
* @returns Promise resolving to the Task object if found, null otherwise
|
|
672
|
-
*/
|
|
673
|
-
getTask(id: UUID): Promise<Task | null>;
|
|
674
|
-
/**
|
|
675
|
-
* Asynchronously updates an existing task in the database.
|
|
676
|
-
* @param id The UUID of the task to update
|
|
677
|
-
* @param task Partial Task object containing the fields to update
|
|
678
|
-
* @returns Promise resolving when the update is complete
|
|
679
|
-
*/
|
|
680
|
-
updateTask(id: UUID, task: Partial<Task>): Promise<void>;
|
|
681
|
-
/**
|
|
682
|
-
* Asynchronously deletes a task from the database.
|
|
683
|
-
* @param id The UUID of the task to delete
|
|
684
|
-
* @returns Promise resolving when the deletion is complete
|
|
685
|
-
*/
|
|
686
|
-
deleteTask(id: UUID): Promise<void>;
|
|
687
|
-
getMemoriesByWorldId(params: {
|
|
688
|
-
worldId: UUID;
|
|
689
|
-
count?: number;
|
|
690
|
-
tableName?: string;
|
|
691
|
-
}): Promise<Memory[]>;
|
|
692
|
-
deleteRoomsByWorldId(worldId: UUID): Promise<void>;
|
|
693
|
-
/**
|
|
694
|
-
* Creates a new message server in the central database
|
|
695
|
-
*/
|
|
696
|
-
createMessageServer(data: {
|
|
697
|
-
id?: UUID;
|
|
698
|
-
name: string;
|
|
699
|
-
sourceType: string;
|
|
700
|
-
sourceId?: string;
|
|
701
|
-
metadata?: any;
|
|
702
|
-
}): Promise<{
|
|
703
|
-
id: UUID;
|
|
704
|
-
name: string;
|
|
705
|
-
sourceType: string;
|
|
706
|
-
sourceId?: string;
|
|
707
|
-
metadata?: any;
|
|
708
|
-
createdAt: Date;
|
|
709
|
-
updatedAt: Date;
|
|
710
|
-
}>;
|
|
711
|
-
/**
|
|
712
|
-
* Gets all message servers
|
|
713
|
-
*/
|
|
714
|
-
getMessageServers(): Promise<Array<{
|
|
715
|
-
id: UUID;
|
|
716
|
-
name: string;
|
|
717
|
-
sourceType: string;
|
|
718
|
-
sourceId?: string;
|
|
719
|
-
metadata?: any;
|
|
720
|
-
createdAt: Date;
|
|
721
|
-
updatedAt: Date;
|
|
722
|
-
}>>;
|
|
723
|
-
/**
|
|
724
|
-
* Gets a message server by ID
|
|
725
|
-
*/
|
|
726
|
-
getMessageServerById(serverId: UUID): Promise<{
|
|
727
|
-
id: UUID;
|
|
728
|
-
name: string;
|
|
729
|
-
sourceType: string;
|
|
730
|
-
sourceId?: string;
|
|
731
|
-
metadata?: any;
|
|
732
|
-
createdAt: Date;
|
|
733
|
-
updatedAt: Date;
|
|
734
|
-
} | null>;
|
|
735
|
-
/**
|
|
736
|
-
* Creates a new channel
|
|
737
|
-
*/
|
|
738
|
-
createChannel(data: {
|
|
739
|
-
id?: UUID;
|
|
740
|
-
messageServerId: UUID;
|
|
741
|
-
name: string;
|
|
742
|
-
type: string;
|
|
743
|
-
sourceType?: string;
|
|
744
|
-
sourceId?: string;
|
|
745
|
-
topic?: string;
|
|
746
|
-
metadata?: any;
|
|
747
|
-
}, participantIds?: UUID[]): Promise<{
|
|
748
|
-
id: UUID;
|
|
749
|
-
messageServerId: UUID;
|
|
750
|
-
name: string;
|
|
751
|
-
type: string;
|
|
752
|
-
sourceType?: string;
|
|
753
|
-
sourceId?: string;
|
|
754
|
-
topic?: string;
|
|
755
|
-
metadata?: any;
|
|
756
|
-
createdAt: Date;
|
|
757
|
-
updatedAt: Date;
|
|
758
|
-
}>;
|
|
759
|
-
/**
|
|
760
|
-
* Gets channels for a server
|
|
761
|
-
*/
|
|
762
|
-
getChannelsForServer(serverId: UUID): Promise<Array<{
|
|
763
|
-
id: UUID;
|
|
764
|
-
messageServerId: UUID;
|
|
765
|
-
name: string;
|
|
766
|
-
type: string;
|
|
767
|
-
sourceType?: string;
|
|
768
|
-
sourceId?: string;
|
|
769
|
-
topic?: string;
|
|
770
|
-
metadata?: any;
|
|
771
|
-
createdAt: Date;
|
|
772
|
-
updatedAt: Date;
|
|
773
|
-
}>>;
|
|
774
|
-
/**
|
|
775
|
-
* Gets channel details
|
|
776
|
-
*/
|
|
777
|
-
getChannelDetails(channelId: UUID): Promise<{
|
|
778
|
-
id: UUID;
|
|
779
|
-
messageServerId: UUID;
|
|
780
|
-
name: string;
|
|
781
|
-
type: string;
|
|
782
|
-
sourceType?: string;
|
|
783
|
-
sourceId?: string;
|
|
784
|
-
topic?: string;
|
|
785
|
-
metadata?: any;
|
|
786
|
-
createdAt: Date;
|
|
787
|
-
updatedAt: Date;
|
|
788
|
-
} | null>;
|
|
789
|
-
/**
|
|
790
|
-
* Creates a message
|
|
791
|
-
*/
|
|
792
|
-
createMessage(data: {
|
|
793
|
-
channelId: UUID;
|
|
794
|
-
authorId: UUID;
|
|
795
|
-
content: string;
|
|
796
|
-
rawMessage?: any;
|
|
797
|
-
sourceType?: string;
|
|
798
|
-
sourceId?: string;
|
|
799
|
-
metadata?: any;
|
|
800
|
-
inReplyToRootMessageId?: UUID;
|
|
801
|
-
messageId?: UUID;
|
|
802
|
-
}): Promise<{
|
|
803
|
-
id: UUID;
|
|
804
|
-
channelId: UUID;
|
|
805
|
-
authorId: UUID;
|
|
806
|
-
content: string;
|
|
807
|
-
rawMessage?: any;
|
|
808
|
-
sourceType?: string;
|
|
809
|
-
sourceId?: string;
|
|
810
|
-
metadata?: any;
|
|
811
|
-
inReplyToRootMessageId?: UUID;
|
|
812
|
-
createdAt: Date;
|
|
813
|
-
updatedAt: Date;
|
|
814
|
-
}>;
|
|
815
|
-
getMessageById(id: UUID): Promise<{
|
|
816
|
-
id: UUID;
|
|
817
|
-
channelId: UUID;
|
|
818
|
-
authorId: UUID;
|
|
819
|
-
content: string;
|
|
820
|
-
rawMessage?: any;
|
|
821
|
-
sourceType?: string;
|
|
822
|
-
sourceId?: string;
|
|
823
|
-
metadata?: any;
|
|
824
|
-
inReplyToRootMessageId?: UUID;
|
|
825
|
-
createdAt: Date;
|
|
826
|
-
updatedAt: Date;
|
|
827
|
-
}>;
|
|
828
|
-
updateMessage(id: UUID, patch: {
|
|
829
|
-
content?: string;
|
|
830
|
-
rawMessage?: any;
|
|
831
|
-
sourceType?: string;
|
|
832
|
-
sourceId?: string;
|
|
833
|
-
metadata?: any;
|
|
834
|
-
inReplyToRootMessageId?: UUID;
|
|
835
|
-
}): Promise<{
|
|
836
|
-
id: UUID;
|
|
837
|
-
channelId: UUID;
|
|
838
|
-
authorId: UUID;
|
|
839
|
-
content: string;
|
|
840
|
-
rawMessage?: any;
|
|
841
|
-
sourceType?: string;
|
|
842
|
-
sourceId?: string;
|
|
843
|
-
metadata?: any;
|
|
844
|
-
inReplyToRootMessageId?: UUID;
|
|
845
|
-
createdAt: Date;
|
|
846
|
-
updatedAt: Date;
|
|
847
|
-
} | null>;
|
|
848
|
-
/**
|
|
849
|
-
* Gets messages for a channel
|
|
850
|
-
*/
|
|
851
|
-
getMessagesForChannel(channelId: UUID, limit?: number, beforeTimestamp?: Date): Promise<Array<{
|
|
852
|
-
id: UUID;
|
|
853
|
-
channelId: UUID;
|
|
854
|
-
authorId: UUID;
|
|
855
|
-
content: string;
|
|
856
|
-
rawMessage?: any;
|
|
857
|
-
sourceType?: string;
|
|
858
|
-
sourceId?: string;
|
|
859
|
-
metadata?: any;
|
|
860
|
-
inReplyToRootMessageId?: UUID;
|
|
861
|
-
createdAt: Date;
|
|
862
|
-
updatedAt: Date;
|
|
863
|
-
}>>;
|
|
864
|
-
/**
|
|
865
|
-
* Deletes a message
|
|
866
|
-
*/
|
|
867
|
-
deleteMessage(messageId: UUID): Promise<void>;
|
|
868
|
-
/**
|
|
869
|
-
* Updates a channel
|
|
870
|
-
*/
|
|
871
|
-
updateChannel(channelId: UUID, updates: {
|
|
872
|
-
name?: string;
|
|
873
|
-
participantCentralUserIds?: UUID[];
|
|
874
|
-
metadata?: any;
|
|
875
|
-
}): Promise<{
|
|
876
|
-
id: UUID;
|
|
877
|
-
messageServerId: UUID;
|
|
878
|
-
name: string;
|
|
879
|
-
type: string;
|
|
880
|
-
sourceType?: string;
|
|
881
|
-
sourceId?: string;
|
|
882
|
-
topic?: string;
|
|
883
|
-
metadata?: any;
|
|
884
|
-
createdAt: Date;
|
|
885
|
-
updatedAt: Date;
|
|
886
|
-
}>;
|
|
887
|
-
/**
|
|
888
|
-
* Deletes a channel and all its associated data
|
|
889
|
-
*/
|
|
890
|
-
deleteChannel(channelId: UUID): Promise<void>;
|
|
891
|
-
/**
|
|
892
|
-
* Adds participants to a channel
|
|
893
|
-
*/
|
|
894
|
-
addChannelParticipants(channelId: UUID, userIds: UUID[]): Promise<void>;
|
|
895
|
-
/**
|
|
896
|
-
* Gets participants for a channel
|
|
897
|
-
*/
|
|
898
|
-
getChannelParticipants(channelId: UUID): Promise<UUID[]>;
|
|
899
|
-
/**
|
|
900
|
-
* Adds an agent to a server
|
|
901
|
-
*/
|
|
902
|
-
addAgentToServer(serverId: UUID, agentId: UUID): Promise<void>;
|
|
903
|
-
/**
|
|
904
|
-
* Gets agents for a server
|
|
905
|
-
*/
|
|
906
|
-
getAgentsForServer(serverId: UUID): Promise<UUID[]>;
|
|
907
|
-
/**
|
|
908
|
-
* Removes an agent from a server
|
|
909
|
-
*/
|
|
910
|
-
removeAgentFromServer(serverId: UUID, agentId: UUID): Promise<void>;
|
|
911
|
-
/**
|
|
912
|
-
* Finds or creates a DM channel between two users
|
|
913
|
-
*/
|
|
914
|
-
findOrCreateDmChannel(user1Id: UUID, user2Id: UUID, messageServerId: UUID): Promise<{
|
|
915
|
-
id: UUID;
|
|
916
|
-
messageServerId: UUID;
|
|
917
|
-
name: string;
|
|
918
|
-
type: string;
|
|
919
|
-
sourceType?: string;
|
|
920
|
-
sourceId?: string;
|
|
921
|
-
topic?: string;
|
|
922
|
-
metadata?: any;
|
|
923
|
-
createdAt: Date;
|
|
924
|
-
updatedAt: Date;
|
|
925
|
-
}>;
|
|
926
|
-
}
|