@axiom-lattice/pg-stores 1.0.34 → 1.0.36
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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +41 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/ThreadMessageQueueStore.test.ts +61 -2
- package/src/migrations/add_custom_run_config_column.ts +25 -0
- package/src/stores/PostgreSQLThreadStore.ts +17 -2
- package/src/stores/ThreadMessageQueueStore.ts +18 -30
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.36 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[32m133.26 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m247.65 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 375ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m129.31 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m247.58 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 394ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m34.
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m34.
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 11567ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m34.53 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m34.53 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 1.0.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [a8ee103]
|
|
8
|
+
- @axiom-lattice/protocols@2.1.24
|
|
9
|
+
- @axiom-lattice/core@2.1.46
|
|
10
|
+
|
|
11
|
+
## 1.0.35
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 4c4ca60: fix subagent state issue
|
|
16
|
+
- Updated dependencies [4c4ca60]
|
|
17
|
+
- @axiom-lattice/core@2.1.45
|
|
18
|
+
|
|
3
19
|
## 1.0.34
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -50,7 +50,7 @@ declare class PostgreSQLThreadStore implements ThreadStore {
|
|
|
50
50
|
/**
|
|
51
51
|
* Get all threads for a specific tenant and assistant
|
|
52
52
|
*/
|
|
53
|
-
getThreadsByAssistantId(tenantId: string, assistantId: string): Promise<Thread[]>;
|
|
53
|
+
getThreadsByAssistantId(tenantId: string, assistantId: string, metadataFilter?: Record<string, string>): Promise<Thread[]>;
|
|
54
54
|
/**
|
|
55
55
|
* Get a thread by ID for a specific tenant
|
|
56
56
|
*/
|
|
@@ -1113,7 +1113,7 @@ declare class ThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
1113
1113
|
* Add message at head of queue (high priority, e.g., STEER/Command messages)
|
|
1114
1114
|
* Uses priority=100 to ensure message is processed first
|
|
1115
1115
|
*/
|
|
1116
|
-
addMessageAtHead(
|
|
1116
|
+
addMessageAtHead(params: AddMessageParams): Promise<PendingMessage>;
|
|
1117
1117
|
/**
|
|
1118
1118
|
* Get pending messages for thread
|
|
1119
1119
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ declare class PostgreSQLThreadStore implements ThreadStore {
|
|
|
50
50
|
/**
|
|
51
51
|
* Get all threads for a specific tenant and assistant
|
|
52
52
|
*/
|
|
53
|
-
getThreadsByAssistantId(tenantId: string, assistantId: string): Promise<Thread[]>;
|
|
53
|
+
getThreadsByAssistantId(tenantId: string, assistantId: string, metadataFilter?: Record<string, string>): Promise<Thread[]>;
|
|
54
54
|
/**
|
|
55
55
|
* Get a thread by ID for a specific tenant
|
|
56
56
|
*/
|
|
@@ -1113,7 +1113,7 @@ declare class ThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
1113
1113
|
* Add message at head of queue (high priority, e.g., STEER/Command messages)
|
|
1114
1114
|
* Uses priority=100 to ensure message is processed first
|
|
1115
1115
|
*/
|
|
1116
|
-
addMessageAtHead(
|
|
1116
|
+
addMessageAtHead(params: AddMessageParams): Promise<PendingMessage>;
|
|
1117
1117
|
/**
|
|
1118
1118
|
* Get pending messages for thread
|
|
1119
1119
|
*/
|
package/dist/index.js
CHANGED
|
@@ -408,7 +408,7 @@ var PostgreSQLThreadStore = class {
|
|
|
408
408
|
/**
|
|
409
409
|
* Get all threads for a specific tenant and assistant
|
|
410
410
|
*/
|
|
411
|
-
async getThreadsByAssistantId(tenantId, assistantId) {
|
|
411
|
+
async getThreadsByAssistantId(tenantId, assistantId, metadataFilter) {
|
|
412
412
|
await this.ensureInitialized();
|
|
413
413
|
const result = await this.pool.query(
|
|
414
414
|
`
|
|
@@ -419,7 +419,15 @@ var PostgreSQLThreadStore = class {
|
|
|
419
419
|
`,
|
|
420
420
|
[tenantId, assistantId]
|
|
421
421
|
);
|
|
422
|
-
|
|
422
|
+
let threads = result.rows.map(this.mapRowToThread);
|
|
423
|
+
if (metadataFilter && Object.keys(metadataFilter).length > 0) {
|
|
424
|
+
threads = threads.filter(
|
|
425
|
+
(thread) => Object.entries(metadataFilter).every(
|
|
426
|
+
([key, value]) => thread.metadata?.[key] === value
|
|
427
|
+
)
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
return threads;
|
|
423
431
|
}
|
|
424
432
|
/**
|
|
425
433
|
* Get a thread by ID for a specific tenant
|
|
@@ -4105,6 +4113,23 @@ var addPriorityAndCommandColumns = {
|
|
|
4105
4113
|
}
|
|
4106
4114
|
};
|
|
4107
4115
|
|
|
4116
|
+
// src/migrations/add_custom_run_config_column.ts
|
|
4117
|
+
var addCustomRunConfigColumn = {
|
|
4118
|
+
version: 102,
|
|
4119
|
+
name: "add_custom_run_config_column",
|
|
4120
|
+
up: async (client) => {
|
|
4121
|
+
await client.query(`
|
|
4122
|
+
ALTER TABLE lattice_thread_message_queue
|
|
4123
|
+
ADD COLUMN IF NOT EXISTS custom_run_config JSONB
|
|
4124
|
+
`);
|
|
4125
|
+
},
|
|
4126
|
+
down: async (client) => {
|
|
4127
|
+
await client.query(
|
|
4128
|
+
"ALTER TABLE lattice_thread_message_queue DROP COLUMN IF EXISTS custom_run_config"
|
|
4129
|
+
);
|
|
4130
|
+
}
|
|
4131
|
+
};
|
|
4132
|
+
|
|
4108
4133
|
// src/migrations/alter_message_queue_id_column.ts
|
|
4109
4134
|
var alterMessageQueueIdColumn = {
|
|
4110
4135
|
version: 102,
|
|
@@ -4153,6 +4178,7 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4153
4178
|
const migrationManager = new MigrationManager(pool);
|
|
4154
4179
|
migrationManager.register(createThreadMessageQueueTable);
|
|
4155
4180
|
migrationManager.register(addPriorityAndCommandColumns);
|
|
4181
|
+
migrationManager.register(addCustomRunConfigColumn);
|
|
4156
4182
|
migrationManager.register(alterMessageQueueIdColumn);
|
|
4157
4183
|
await migrationManager.migrate();
|
|
4158
4184
|
this.initialized = true;
|
|
@@ -4169,7 +4195,7 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4169
4195
|
*/
|
|
4170
4196
|
async addMessage(params) {
|
|
4171
4197
|
const pool = this.getPool();
|
|
4172
|
-
const { threadId, tenantId, assistantId, content, type = "human", priority = 0, command, id } = params;
|
|
4198
|
+
const { threadId, tenantId, assistantId, content, type = "human", priority = 0, command, custom_run_config, id } = params;
|
|
4173
4199
|
const seqResult = await pool.query(
|
|
4174
4200
|
`SELECT COALESCE(MAX(sequence_order), 0) + 1 as next_seq
|
|
4175
4201
|
FROM lattice_thread_message_queue
|
|
@@ -4179,10 +4205,10 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4179
4205
|
const nextSeq = seqResult.rows[0].next_seq;
|
|
4180
4206
|
const result = await pool.query(
|
|
4181
4207
|
`INSERT INTO lattice_thread_message_queue
|
|
4182
|
-
(id, thread_id, tenant_id, assistant_id, message_content, message_type, sequence_order, priority, command)
|
|
4183
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
|
4208
|
+
(id, thread_id, tenant_id, assistant_id, message_content, message_type, sequence_order, priority, command, custom_run_config)
|
|
4209
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
4184
4210
|
RETURNING *`,
|
|
4185
|
-
[id || import_crypto.default.randomUUID(), threadId, tenantId, assistantId, JSON.stringify(content), type, nextSeq, priority, command ? JSON.stringify(command) : null]
|
|
4211
|
+
[id || import_crypto.default.randomUUID(), threadId, tenantId, assistantId, JSON.stringify(content), type, nextSeq, priority, command ? JSON.stringify(command) : null, custom_run_config ? JSON.stringify(custom_run_config) : null]
|
|
4186
4212
|
);
|
|
4187
4213
|
return this.rowToMessage(result.rows[0]);
|
|
4188
4214
|
}
|
|
@@ -4190,21 +4216,11 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4190
4216
|
* Add message at head of queue (high priority, e.g., STEER/Command messages)
|
|
4191
4217
|
* Uses priority=100 to ensure message is processed first
|
|
4192
4218
|
*/
|
|
4193
|
-
async addMessageAtHead(
|
|
4219
|
+
async addMessageAtHead(params) {
|
|
4194
4220
|
const pool = this.getPool();
|
|
4195
|
-
const
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
WHERE thread_id = $1
|
|
4199
|
-
LIMIT 1`,
|
|
4200
|
-
[threadId]
|
|
4201
|
-
);
|
|
4202
|
-
let tenantId = "default";
|
|
4203
|
-
let assistantId = "";
|
|
4204
|
-
if (threadResult.rows.length > 0) {
|
|
4205
|
-
tenantId = threadResult.rows[0].tenant_id;
|
|
4206
|
-
assistantId = threadResult.rows[0].assistant_id;
|
|
4207
|
-
}
|
|
4221
|
+
const { threadId, tenantId, assistantId, content, type = "human", command, custom_run_config, id } = params;
|
|
4222
|
+
const resolvedTenantId = tenantId;
|
|
4223
|
+
const resolvedAssistantId = assistantId;
|
|
4208
4224
|
const seqResult = await pool.query(
|
|
4209
4225
|
`SELECT COALESCE(MAX(sequence_order), 0) + 1 as next_seq
|
|
4210
4226
|
FROM lattice_thread_message_queue
|
|
@@ -4214,10 +4230,10 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4214
4230
|
const nextSeq = seqResult.rows[0].next_seq;
|
|
4215
4231
|
const result = await pool.query(
|
|
4216
4232
|
`INSERT INTO lattice_thread_message_queue
|
|
4217
|
-
(id, thread_id, tenant_id, assistant_id, message_content, message_type, sequence_order, priority, command)
|
|
4218
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, 100, $8)
|
|
4233
|
+
(id, thread_id, tenant_id, assistant_id, message_content, message_type, sequence_order, priority, command, custom_run_config)
|
|
4234
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, 100, $8, $9)
|
|
4219
4235
|
RETURNING *`,
|
|
4220
|
-
[id || import_crypto.default.randomUUID(), threadId,
|
|
4236
|
+
[id || import_crypto.default.randomUUID(), threadId, resolvedTenantId, resolvedAssistantId, JSON.stringify(content), type, nextSeq, command ? JSON.stringify(command) : null, custom_run_config ? JSON.stringify(custom_run_config) : null]
|
|
4221
4237
|
);
|
|
4222
4238
|
return this.rowToMessage(result.rows[0]);
|
|
4223
4239
|
}
|
|
@@ -4351,7 +4367,8 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4351
4367
|
sequence: row.sequence_order,
|
|
4352
4368
|
createdAt: new Date(row.created_at),
|
|
4353
4369
|
priority: row.priority || 0,
|
|
4354
|
-
command: row.command ? typeof row.command === "string" ? JSON.parse(row.command) : row.command : void 0
|
|
4370
|
+
command: row.command ? typeof row.command === "string" ? JSON.parse(row.command) : row.command : void 0,
|
|
4371
|
+
custom_run_config: row.custom_run_config ? typeof row.custom_run_config === "string" ? JSON.parse(row.custom_run_config) : row.custom_run_config : void 0
|
|
4355
4372
|
};
|
|
4356
4373
|
}
|
|
4357
4374
|
};
|