@axiom-lattice/pg-stores 1.0.66 → 1.0.68
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +16 -0
- package/README.md +76 -309
- package/dist/index.d.mts +491 -474
- package/dist/index.d.ts +491 -474
- package/dist/index.js +3987 -3982
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3999 -3994
- package/dist/index.mjs.map +1 -1
- package/examples/database-config-store.example.ts +1 -3
- package/package.json +3 -3
- package/src/__tests__/ThreadMessageQueueStore.test.ts +5 -53
- package/src/createPgStoreConfig.ts +47 -0
- package/src/index.ts +2 -0
- package/src/stores/ThreadMessageQueueStore.ts +57 -79
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/pg-stores@1.0.
|
|
2
|
+
> @axiom-lattice/pg-stores@1.0.68 build /home/runner/work/agentic/agentic/packages/pg-stores
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m204.37 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m377.59 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 523ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m199.35 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m377.44 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 527ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 13443ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m48.13 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m48.13 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 1.0.68
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [176bfe8]
|
|
8
|
+
- @axiom-lattice/core@2.1.77
|
|
9
|
+
|
|
10
|
+
## 1.0.67
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 6ff5bd5: fix issue
|
|
15
|
+
- Updated dependencies [6ff5bd5]
|
|
16
|
+
- @axiom-lattice/core@2.1.76
|
|
17
|
+
- @axiom-lattice/protocols@2.1.39
|
|
18
|
+
|
|
3
19
|
## 1.0.66
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,341 +1,108 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
-
PostgreSQL
|
|
3
|
+
PostgreSQL store implementations for the Axiom Lattice framework.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
This package provides PostgreSQL-based store implementations that conform to the store interfaces. It can be used with the `StoreLatticeManager` from `@axiom-lattice/core` to register and manage PostgreSQL-based store services.
|
|
8
|
-
|
|
9
|
-
## Features
|
|
10
|
-
|
|
11
|
-
- **ThreadStore**: PostgreSQL implementation for thread management
|
|
12
|
-
- **AssistantStore**: PostgreSQL implementation for assistant management
|
|
13
|
-
- **Migration System**: Automatic schema migration with version tracking
|
|
14
|
-
- **Type Safety**: Full TypeScript support with proper type definitions
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
pnpm add @axiom-lattice/pg-stores
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Prerequisites
|
|
23
|
-
|
|
24
|
-
- PostgreSQL database (version 12 or higher)
|
|
25
|
-
- Node.js 18 or higher
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
### Basic Usage - Register ThreadStore
|
|
5
|
+
## Quick Start
|
|
30
6
|
|
|
31
7
|
```typescript
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
// Create and initialize ThreadStore with connection string
|
|
36
|
-
const threadStore = new PostgreSQLThreadStore({
|
|
37
|
-
poolConfig: process.env.DATABASE_URL || "postgresql://localhost:5432/mydb",
|
|
38
|
-
});
|
|
8
|
+
import { configureStores } from "@axiom-lattice/core";
|
|
9
|
+
import { createPgStoreConfig } from "@axiom-lattice/pg-stores";
|
|
10
|
+
import { PostgresSaver } from "@langchain/langgraph-checkpoint-postgres";
|
|
39
11
|
|
|
40
|
-
//
|
|
41
|
-
|
|
12
|
+
// One connection string creates all PG stores
|
|
13
|
+
const stores = createPgStoreConfig(process.env.DATABASE_URL);
|
|
42
14
|
|
|
43
|
-
// Register
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const threadStore2 = new PostgreSQLThreadStore({
|
|
48
|
-
poolConfig: {
|
|
49
|
-
host: process.env.DB_HOST || "localhost",
|
|
50
|
-
port: parseInt(process.env.DB_PORT || "5432"),
|
|
51
|
-
database: process.env.DB_NAME || "mydb",
|
|
52
|
-
user: process.env.DB_USER,
|
|
53
|
-
password: process.env.DB_PASSWORD,
|
|
54
|
-
},
|
|
15
|
+
// Register all stores in one call
|
|
16
|
+
await configureStores({
|
|
17
|
+
...stores,
|
|
18
|
+
checkpoint: PostgresSaver.fromConnString(process.env.DATABASE_URL),
|
|
55
19
|
});
|
|
56
|
-
|
|
57
|
-
await threadStore2.initialize();
|
|
58
|
-
registerStoreLattice("threads", "thread", threadStore2);
|
|
59
20
|
```
|
|
60
21
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
import { PostgreSQLAssistantStore } from "@axiom-lattice/pg-stores";
|
|
65
|
-
import { registerStoreLattice, getStoreLattice } from "@axiom-lattice/core";
|
|
66
|
-
|
|
67
|
-
// Create and initialize AssistantStore with connection string
|
|
68
|
-
const assistantStore = new PostgreSQLAssistantStore({
|
|
69
|
-
poolConfig: process.env.DATABASE_URL || "postgresql://localhost:5432/mydb",
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// Ensure initialization (migrations run automatically)
|
|
73
|
-
await assistantStore.initialize();
|
|
74
|
-
|
|
75
|
-
// Register to StoreLatticeManager
|
|
76
|
-
registerStoreLattice("assistants", "assistant", assistantStore);
|
|
77
|
-
|
|
78
|
-
// Get and use the store (with type safety)
|
|
79
|
-
const storeLattice = getStoreLattice("assistants", "assistant");
|
|
80
|
-
const assistantStoreInstance = storeLattice.store; // TypeScript knows this is AssistantStore
|
|
81
|
-
|
|
82
|
-
// Create an assistant
|
|
83
|
-
const assistant = await assistantStoreInstance.createAssistant(
|
|
84
|
-
"assistant-123",
|
|
85
|
-
{
|
|
86
|
-
name: "My Assistant",
|
|
87
|
-
description: "A helpful assistant",
|
|
88
|
-
graphDefinition: {
|
|
89
|
-
/* ... */
|
|
90
|
-
},
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
// Get all assistants
|
|
95
|
-
const assistants = await assistantStoreInstance.getAllAssistants();
|
|
22
|
+
## `createPgStoreConfig`
|
|
96
23
|
|
|
97
|
-
|
|
98
|
-
const foundAssistant = await assistantStoreInstance.getAssistantById(
|
|
99
|
-
"assistant-123"
|
|
100
|
-
);
|
|
24
|
+
Factory function that creates all PG store instances from a single connection string. Returns an object ready to spread into `configureStores()`.
|
|
101
25
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
26
|
+
```typescript
|
|
27
|
+
function createPgStoreConfig(connectionString: string): {
|
|
28
|
+
workspace: PostgreSQLWorkspaceStore;
|
|
29
|
+
project: PostgreSQLProjectStore;
|
|
30
|
+
eval: PostgreSQLEvalStore;
|
|
31
|
+
user: PostgreSQLUserStore;
|
|
32
|
+
tenant: PostgreSQLTenantStore;
|
|
33
|
+
userTenantLink: PostgreSQLUserTenantLinkStore;
|
|
34
|
+
channelBinding: ChannelBindingStore;
|
|
35
|
+
channelInstallation: PostgreSQLChannelInstallationStore;
|
|
36
|
+
thread: PostgreSQLThreadStore;
|
|
37
|
+
database: PostgreSQLDatabaseConfigStore;
|
|
38
|
+
metrics: PostgreSQLMetricsServerConfigStore;
|
|
39
|
+
mcp: PostgreSQLMcpServerConfigStore;
|
|
40
|
+
assistant: PostgreSQLAssistantStore;
|
|
41
|
+
workflowTracking: PostgreSQLWorkflowTrackingStore;
|
|
42
|
+
threadMessageQueue: ThreadMessageQueueStore;
|
|
43
|
+
schedule: PostgreSQLScheduleStorage;
|
|
44
|
+
}
|
|
112
45
|
```
|
|
113
46
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const threadStore = storeLattice.store; // TypeScript knows this is ThreadStore
|
|
117
|
-
|
|
118
|
-
// Create a thread
|
|
119
|
-
const thread = await threadStore.createThread("assistant-123", "thread-456", {
|
|
120
|
-
metadata: { title: "My Thread" },
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// Get threads by assistant
|
|
124
|
-
const threads = await threadStore.getThreadsByAssistantId("assistant-123");
|
|
47
|
+
Stores with `autoMigrate: true`: eval, channelBinding, channelInstallation, workflowTracking, threadMessageQueue.
|
|
48
|
+
All others use `autoMigrate: false` (manual `initialize()` via `configureStores`).
|
|
125
49
|
|
|
126
|
-
|
|
127
|
-
const foundThread = await threadStore.getThreadById(
|
|
128
|
-
"assistant-123",
|
|
129
|
-
"thread-456"
|
|
130
|
-
);
|
|
50
|
+
## Individual Store Usage
|
|
131
51
|
|
|
132
|
-
|
|
133
|
-
const updatedThread = await threadStore.updateThread(
|
|
134
|
-
"assistant-123",
|
|
135
|
-
"thread-456",
|
|
136
|
-
{ metadata: { title: "Updated Title" } }
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
// Delete thread
|
|
140
|
-
await threadStore.deleteThread("assistant-123", "thread-456");
|
|
141
|
-
|
|
142
|
-
````
|
|
143
|
-
|
|
144
|
-
### Direct Usage (Without Registration)
|
|
52
|
+
If you only need specific stores, construct them directly:
|
|
145
53
|
|
|
146
54
|
```typescript
|
|
147
|
-
import {
|
|
55
|
+
import { configureStores } from "@axiom-lattice/core";
|
|
56
|
+
import { PostgreSQLThreadStore, PostgreSQLAssistantStore } from "@axiom-lattice/pg-stores";
|
|
148
57
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
poolConfig: process.env.DATABASE_URL
|
|
152
|
-
autoMigrate: true, // Default: true
|
|
58
|
+
await configureStores({
|
|
59
|
+
thread: new PostgreSQLThreadStore({ poolConfig: process.env.DATABASE_URL }),
|
|
60
|
+
assistant: new PostgreSQLAssistantStore({ poolConfig: process.env.DATABASE_URL }),
|
|
153
61
|
});
|
|
62
|
+
```
|
|
154
63
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
64
|
+
## Available Stores
|
|
65
|
+
|
|
66
|
+
| Store | Class | Description |
|
|
67
|
+
|-------|-------|-------------|
|
|
68
|
+
| thread | `PostgreSQLThreadStore` | Thread CRUD |
|
|
69
|
+
| assistant | `PostgreSQLAssistantStore` | Assistant CRUD |
|
|
70
|
+
| skill | `PostgreSQLSkillStore` | Skill storage |
|
|
71
|
+
| workspace | `PostgreSQLWorkspaceStore` | Workspace management |
|
|
72
|
+
| project | `PostgreSQLProjectStore` | Project management |
|
|
73
|
+
| database | `PostgreSQLDatabaseConfigStore` | DB connection configs |
|
|
74
|
+
| metrics | `PostgreSQLMetricsServerConfigStore` | Metrics server configs |
|
|
75
|
+
| mcp | `PostgreSQLMcpServerConfigStore` | MCP server configs |
|
|
76
|
+
| user | `PostgreSQLUserStore` | User storage |
|
|
77
|
+
| tenant | `PostgreSQLTenantStore` | Tenant storage |
|
|
78
|
+
| userTenantLink | `PostgreSQLUserTenantLinkStore` | User-tenant links |
|
|
79
|
+
| threadMessageQueue | `ThreadMessageQueueStore` | Message queue persistence |
|
|
80
|
+
| workflowTracking | `PostgreSQLWorkflowTrackingStore` | Workflow run tracking |
|
|
81
|
+
| eval | `PostgreSQLEvalStore` | Evaluation storage |
|
|
82
|
+
| channelInstallation | `PostgreSQLChannelInstallationStore` | Channel installations |
|
|
83
|
+
| channelBinding | `ChannelBindingStore` | Sender-to-agent bindings |
|
|
84
|
+
| schedule | `PostgreSQLScheduleStorage` | Scheduled task persistence |
|
|
85
|
+
|
|
86
|
+
## Constructor Options
|
|
87
|
+
|
|
88
|
+
All stores accept the same options pattern:
|
|
166
89
|
|
|
167
90
|
```typescript
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
poolConfig: process.env.DATABASE_URL || "postgresql://localhost:5432/mydb",
|
|
173
|
-
autoMigrate: false,
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
// Manually run migrations when ready
|
|
177
|
-
await threadStore.initialize();
|
|
91
|
+
interface StoreOptions {
|
|
92
|
+
poolConfig: string | PoolConfig; // Connection string or PoolConfig object
|
|
93
|
+
autoMigrate?: boolean; // Run migrations automatically (default: true)
|
|
94
|
+
}
|
|
178
95
|
```
|
|
179
96
|
|
|
180
97
|
## Migration System
|
|
181
98
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
1. Creates the `lattice_schema_migrations` table to track applied migrations
|
|
185
|
-
2. Applies pending migrations in order
|
|
186
|
-
3. Tracks migration versions to prevent duplicate applications
|
|
187
|
-
|
|
188
|
-
### How Migrations Work
|
|
189
|
-
|
|
190
|
-
Migrations run automatically when you create a store instance (unless `autoMigrate: false`):
|
|
99
|
+
Each store manages its own schema migrations via `MigrationManager`. Migrations run during `initialize()`.
|
|
191
100
|
|
|
192
101
|
```typescript
|
|
193
|
-
//
|
|
194
|
-
const
|
|
102
|
+
// Manual control
|
|
103
|
+
const store = new PostgreSQLThreadStore({
|
|
195
104
|
poolConfig: process.env.DATABASE_URL,
|
|
196
|
-
autoMigrate:
|
|
105
|
+
autoMigrate: false,
|
|
197
106
|
});
|
|
198
|
-
|
|
199
|
-
await threadStore.initialize(); // Migrations are applied here
|
|
107
|
+
await store.initialize(); // Migrations applied here
|
|
200
108
|
```
|
|
201
|
-
|
|
202
|
-
### Migration Structure
|
|
203
|
-
|
|
204
|
-
Migrations are defined with:
|
|
205
|
-
|
|
206
|
-
- **version**: Sequential version number (must be unique)
|
|
207
|
-
- **name**: Descriptive migration name
|
|
208
|
-
- **up**: Migration function to apply changes (creates/modifies tables)
|
|
209
|
-
- **down**: Optional rollback function (for undoing migrations)
|
|
210
|
-
|
|
211
|
-
### Using MigrationManager Directly
|
|
212
|
-
|
|
213
|
-
For more control, you can use `MigrationManager` directly:
|
|
214
|
-
|
|
215
|
-
```typescript
|
|
216
|
-
import { Pool } from "pg";
|
|
217
|
-
import { MigrationManager } from "@axiom-lattice/pg-stores";
|
|
218
|
-
import { createThreadsTable } from "@axiom-lattice/pg-stores";
|
|
219
|
-
|
|
220
|
-
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
221
|
-
const migrationManager = new MigrationManager(pool);
|
|
222
|
-
|
|
223
|
-
// Register migrations
|
|
224
|
-
migrationManager.register(createThreadsTable);
|
|
225
|
-
|
|
226
|
-
// Apply pending migrations
|
|
227
|
-
await migrationManager.migrate();
|
|
228
|
-
|
|
229
|
-
// Check current version
|
|
230
|
-
const version = await migrationManager.getCurrentVersion();
|
|
231
|
-
|
|
232
|
-
// Rollback last migration (if down migration exists)
|
|
233
|
-
await migrationManager.rollback();
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### Current Migrations
|
|
237
|
-
|
|
238
|
-
- **ThreadStore Version 1**: `create_threads_table` - Creates the threads table with indexes
|
|
239
|
-
- **AssistantStore Version 1**: `create_assistants_table` - Creates the assistants table with indexes
|
|
240
|
-
|
|
241
|
-
For detailed migration usage, see [MIGRATION_GUIDE.md](./MIGRATION_GUIDE.md).
|
|
242
|
-
|
|
243
|
-
## Database Schema
|
|
244
|
-
|
|
245
|
-
### lattice_threads Table
|
|
246
|
-
|
|
247
|
-
```sql
|
|
248
|
-
CREATE TABLE lattice_threads (
|
|
249
|
-
id VARCHAR(255) NOT NULL,
|
|
250
|
-
assistant_id VARCHAR(255) NOT NULL,
|
|
251
|
-
metadata JSONB DEFAULT '{}',
|
|
252
|
-
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
253
|
-
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
254
|
-
PRIMARY KEY (id, assistant_id)
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
CREATE INDEX idx_lattice_threads_assistant_id ON lattice_threads(assistant_id);
|
|
258
|
-
CREATE INDEX idx_lattice_threads_created_at ON lattice_threads(created_at DESC);
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### lattice_assistants Table
|
|
262
|
-
|
|
263
|
-
```sql
|
|
264
|
-
CREATE TABLE lattice_assistants (
|
|
265
|
-
id VARCHAR(255) PRIMARY KEY,
|
|
266
|
-
name VARCHAR(255) NOT NULL,
|
|
267
|
-
description TEXT,
|
|
268
|
-
graph_definition JSONB NOT NULL,
|
|
269
|
-
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
270
|
-
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
CREATE INDEX idx_lattice_assistants_name ON lattice_assistants(name);
|
|
274
|
-
CREATE INDEX idx_lattice_assistants_created_at ON lattice_assistants(created_at DESC);
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
## Configuration
|
|
278
|
-
|
|
279
|
-
The PostgreSQL store can be configured via:
|
|
280
|
-
|
|
281
|
-
1. **Constructor options**: Pass `poolConfig` (connection string or PoolConfig object) and `autoMigrate` directly
|
|
282
|
-
2. **Environment variables**:
|
|
283
|
-
- `DATABASE_URL` - PostgreSQL connection string (recommended)
|
|
284
|
-
- `DB_HOST` - Database host (if using PoolConfig object)
|
|
285
|
-
- `DB_PORT` - Database port (if using PoolConfig object)
|
|
286
|
-
- `DB_USER` - Database user (if using PoolConfig object)
|
|
287
|
-
- `DB_PASSWORD` - Database password (if using PoolConfig object)
|
|
288
|
-
- `DB_NAME` - Database name (if using PoolConfig object)
|
|
289
|
-
|
|
290
|
-
### PoolConfig Options
|
|
291
|
-
|
|
292
|
-
You can pass either:
|
|
293
|
-
|
|
294
|
-
- **Connection string**: `"postgresql://user:password@host:port/database"`
|
|
295
|
-
- **PoolConfig object**: `{ host, port, database, user, password, ... }` (see [pg PoolConfig](https://node-postgres.com/api/pool) for all options)
|
|
296
|
-
|
|
297
|
-
## API Reference
|
|
298
|
-
|
|
299
|
-
### ThreadStore Interface
|
|
300
|
-
|
|
301
|
-
```typescript
|
|
302
|
-
interface ThreadStore {
|
|
303
|
-
getThreadsByAssistantId(assistantId: string): Promise<Thread[]>;
|
|
304
|
-
getThreadById(
|
|
305
|
-
assistantId: string,
|
|
306
|
-
threadId: string
|
|
307
|
-
): Promise<Thread | undefined>;
|
|
308
|
-
createThread(
|
|
309
|
-
assistantId: string,
|
|
310
|
-
threadId: string,
|
|
311
|
-
data: CreateThreadRequest
|
|
312
|
-
): Promise<Thread>;
|
|
313
|
-
updateThread(
|
|
314
|
-
assistantId: string,
|
|
315
|
-
threadId: string,
|
|
316
|
-
updates: Partial<CreateThreadRequest>
|
|
317
|
-
): Promise<Thread | null>;
|
|
318
|
-
deleteThread(assistantId: string, threadId: string): Promise<boolean>;
|
|
319
|
-
hasThread(assistantId: string, threadId: string): Promise<boolean>;
|
|
320
|
-
}
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### AssistantStore Interface
|
|
324
|
-
|
|
325
|
-
```typescript
|
|
326
|
-
interface AssistantStore {
|
|
327
|
-
getAllAssistants(): Promise<Assistant[]>;
|
|
328
|
-
getAssistantById(id: string): Promise<Assistant | undefined>;
|
|
329
|
-
createAssistant(id: string, data: CreateAssistantRequest): Promise<Assistant>;
|
|
330
|
-
updateAssistant(
|
|
331
|
-
id: string,
|
|
332
|
-
updates: Partial<CreateAssistantRequest>
|
|
333
|
-
): Promise<Assistant | null>;
|
|
334
|
-
deleteAssistant(id: string): Promise<boolean>;
|
|
335
|
-
hasAssistant(id: string): Promise<boolean>;
|
|
336
|
-
}
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
## License
|
|
340
|
-
|
|
341
|
-
MIT
|