@axiom-lattice/pg-stores 1.0.34 → 1.0.35

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/pg-stores@1.0.34 build /home/runner/work/agentic/agentic/packages/pg-stores
2
+ > @axiom-lattice/pg-stores@1.0.35 build /home/runner/work/agentic/agentic/packages/pg-stores
3
3
  > tsup src/index.ts --format cjs,esm --dts --sourcemap
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,13 +8,13 @@
8
8
  CLI Target: es2020
9
9
  CJS Build start
10
10
  ESM Build start
11
- CJS dist/index.js 132.35 KB
12
- CJS dist/index.js.map 245.86 KB
13
- CJS ⚡️ Build success in 373ms
14
- ESM dist/index.mjs 128.40 KB
15
- ESM dist/index.mjs.map 245.79 KB
16
- ESM ⚡️ Build success in 377ms
11
+ ESM dist/index.mjs 129.31 KB
12
+ ESM dist/index.mjs.map 247.58 KB
13
+ ESM ⚡️ Build success in 343ms
14
+ CJS dist/index.js 133.26 KB
15
+ CJS dist/index.js.map 247.65 KB
16
+ CJS ⚡️ Build success in 357ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 11712ms
19
- DTS dist/index.d.ts 34.60 KB
20
- DTS dist/index.d.mts 34.60 KB
18
+ DTS ⚡️ Build success in 11746ms
19
+ DTS dist/index.d.ts 34.53 KB
20
+ DTS dist/index.d.mts 34.53 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @axiom-lattice/pg-stores
2
2
 
3
+ ## 1.0.35
4
+
5
+ ### Patch Changes
6
+
7
+ - 4c4ca60: fix subagent state issue
8
+ - Updated dependencies [4c4ca60]
9
+ - @axiom-lattice/core@2.1.45
10
+
3
11
  ## 1.0.34
4
12
 
5
13
  ### 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(threadId: string, content: PendingMessage["content"], type?: "human" | "system", id?: string, command?: PendingMessage["command"]): Promise<PendingMessage>;
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(threadId: string, content: PendingMessage["content"], type?: "human" | "system", id?: string, command?: PendingMessage["command"]): Promise<PendingMessage>;
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
- return result.rows.map(this.mapRowToThread);
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(threadId, content, type = "system", id, command) {
4219
+ async addMessageAtHead(params) {
4194
4220
  const pool = this.getPool();
4195
- const threadResult = await pool.query(
4196
- `SELECT tenant_id, assistant_id
4197
- FROM lattice_thread_message_queue
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, tenantId, assistantId, JSON.stringify(content), type, nextSeq, command ? JSON.stringify(command) : null]
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
  };