@axiom-lattice/pg-stores 1.0.33 → 1.0.34
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 +8 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +45 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/ThreadMessageQueueStore.test.ts +36 -0
- package/src/migrations/alter_message_queue_id_column.ts +41 -0
- package/src/stores/ThreadMessageQueueStore.ts +17 -8
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.34 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[32m132.35 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m245.86 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 373ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m128.40 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m245.79 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 377ms
|
|
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 11712ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m34.60 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m34.60 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -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(threadId: string, content:
|
|
1116
|
+
addMessageAtHead(threadId: string, content: PendingMessage["content"], type?: "human" | "system", id?: string, command?: PendingMessage["command"]): Promise<PendingMessage>;
|
|
1117
1117
|
/**
|
|
1118
1118
|
* Get pending messages for thread
|
|
1119
1119
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -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(threadId: string, content:
|
|
1116
|
+
addMessageAtHead(threadId: string, content: PendingMessage["content"], type?: "human" | "system", id?: string, command?: PendingMessage["command"]): Promise<PendingMessage>;
|
|
1117
1117
|
/**
|
|
1118
1118
|
* Get pending messages for thread
|
|
1119
1119
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -4067,6 +4077,7 @@ var createThreadMessageQueueTable = {
|
|
|
4067
4077
|
};
|
|
4068
4078
|
|
|
4069
4079
|
// src/stores/ThreadMessageQueueStore.ts
|
|
4080
|
+
var import_crypto = __toESM(require("crypto"));
|
|
4070
4081
|
var import_core4 = require("@axiom-lattice/core");
|
|
4071
4082
|
|
|
4072
4083
|
// src/migrations/add_priority_command_columns.ts
|
|
@@ -4094,6 +4105,31 @@ var addPriorityAndCommandColumns = {
|
|
|
4094
4105
|
}
|
|
4095
4106
|
};
|
|
4096
4107
|
|
|
4108
|
+
// src/migrations/alter_message_queue_id_column.ts
|
|
4109
|
+
var alterMessageQueueIdColumn = {
|
|
4110
|
+
version: 102,
|
|
4111
|
+
name: "alter_message_queue_id_column",
|
|
4112
|
+
up: async (client) => {
|
|
4113
|
+
await client.query(`
|
|
4114
|
+
ALTER TABLE lattice_thread_message_queue
|
|
4115
|
+
ALTER COLUMN id DROP DEFAULT
|
|
4116
|
+
`);
|
|
4117
|
+
await client.query(`
|
|
4118
|
+
COMMENT ON COLUMN lattice_thread_message_queue.id IS
|
|
4119
|
+
'Message ID - must be provided explicitly (UUID format). Used for consistent ID across client and server.'
|
|
4120
|
+
`);
|
|
4121
|
+
},
|
|
4122
|
+
down: async (client) => {
|
|
4123
|
+
await client.query(`
|
|
4124
|
+
ALTER TABLE lattice_thread_message_queue
|
|
4125
|
+
ALTER COLUMN id SET DEFAULT gen_random_uuid()
|
|
4126
|
+
`);
|
|
4127
|
+
await client.query(`
|
|
4128
|
+
COMMENT ON COLUMN lattice_thread_message_queue.id IS NULL
|
|
4129
|
+
`);
|
|
4130
|
+
}
|
|
4131
|
+
};
|
|
4132
|
+
|
|
4097
4133
|
// src/stores/ThreadMessageQueueStore.ts
|
|
4098
4134
|
var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
4099
4135
|
constructor() {
|
|
@@ -4117,6 +4153,7 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4117
4153
|
const migrationManager = new MigrationManager(pool);
|
|
4118
4154
|
migrationManager.register(createThreadMessageQueueTable);
|
|
4119
4155
|
migrationManager.register(addPriorityAndCommandColumns);
|
|
4156
|
+
migrationManager.register(alterMessageQueueIdColumn);
|
|
4120
4157
|
await migrationManager.migrate();
|
|
4121
4158
|
this.initialized = true;
|
|
4122
4159
|
}
|
|
@@ -4132,7 +4169,7 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4132
4169
|
*/
|
|
4133
4170
|
async addMessage(params) {
|
|
4134
4171
|
const pool = this.getPool();
|
|
4135
|
-
const { threadId, tenantId, assistantId, content, type = "human", priority = 0, command } = params;
|
|
4172
|
+
const { threadId, tenantId, assistantId, content, type = "human", priority = 0, command, id } = params;
|
|
4136
4173
|
const seqResult = await pool.query(
|
|
4137
4174
|
`SELECT COALESCE(MAX(sequence_order), 0) + 1 as next_seq
|
|
4138
4175
|
FROM lattice_thread_message_queue
|
|
@@ -4142,10 +4179,10 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4142
4179
|
const nextSeq = seqResult.rows[0].next_seq;
|
|
4143
4180
|
const result = await pool.query(
|
|
4144
4181
|
`INSERT INTO lattice_thread_message_queue
|
|
4145
|
-
(thread_id, tenant_id, assistant_id, message_content, message_type, sequence_order, priority, command)
|
|
4146
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
|
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)
|
|
4147
4184
|
RETURNING *`,
|
|
4148
|
-
[threadId, tenantId, assistantId, JSON.stringify(content), type, nextSeq, priority, command ? JSON.stringify(command) : null]
|
|
4185
|
+
[id || import_crypto.default.randomUUID(), threadId, tenantId, assistantId, JSON.stringify(content), type, nextSeq, priority, command ? JSON.stringify(command) : null]
|
|
4149
4186
|
);
|
|
4150
4187
|
return this.rowToMessage(result.rows[0]);
|
|
4151
4188
|
}
|
|
@@ -4153,7 +4190,7 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4153
4190
|
* Add message at head of queue (high priority, e.g., STEER/Command messages)
|
|
4154
4191
|
* Uses priority=100 to ensure message is processed first
|
|
4155
4192
|
*/
|
|
4156
|
-
async addMessageAtHead(threadId, content, type = "system") {
|
|
4193
|
+
async addMessageAtHead(threadId, content, type = "system", id, command) {
|
|
4157
4194
|
const pool = this.getPool();
|
|
4158
4195
|
const threadResult = await pool.query(
|
|
4159
4196
|
`SELECT tenant_id, assistant_id
|
|
@@ -4177,10 +4214,10 @@ var ThreadMessageQueueStore = class _ThreadMessageQueueStore {
|
|
|
4177
4214
|
const nextSeq = seqResult.rows[0].next_seq;
|
|
4178
4215
|
const result = await pool.query(
|
|
4179
4216
|
`INSERT INTO lattice_thread_message_queue
|
|
4180
|
-
(thread_id, tenant_id, assistant_id, message_content, message_type, sequence_order, priority)
|
|
4181
|
-
VALUES ($1, $2, $3, $4, $5, $6, 100)
|
|
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)
|
|
4182
4219
|
RETURNING *`,
|
|
4183
|
-
[threadId, tenantId, assistantId, JSON.stringify(content), type, nextSeq]
|
|
4220
|
+
[id || import_crypto.default.randomUUID(), threadId, tenantId, assistantId, JSON.stringify(content), type, nextSeq, command ? JSON.stringify(command) : null]
|
|
4184
4221
|
);
|
|
4185
4222
|
return this.rowToMessage(result.rows[0]);
|
|
4186
4223
|
}
|