@axiom-lattice/pg-stores 3.1.11 → 3.1.13

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@3.1.11 build /home/runner/work/agentic/agentic/packages/pg-stores
2
+ > @axiom-lattice/pg-stores@3.1.13 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
- ESM dist/index.mjs 389.59 KB
12
- ESM dist/index.mjs.map 725.25 KB
13
- ESM ⚡️ Build success in 943ms
14
- CJS dist/index.js 397.80 KB
15
- CJS dist/index.js.map 725.61 KB
16
- CJS ⚡️ Build success in 959ms
11
+ CJS dist/index.js 399.36 KB
12
+ CJS dist/index.js.map 728.38 KB
13
+ CJS ⚡️ Build success in 593ms
14
+ ESM dist/index.mjs 391.15 KB
15
+ ESM dist/index.mjs.map 728.02 KB
16
+ ESM ⚡️ Build success in 631ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 19109ms
19
- DTS dist/index.d.ts 81.71 KB
20
- DTS dist/index.d.mts 81.71 KB
18
+ DTS ⚡️ Build success in 11532ms
19
+ DTS dist/index.d.ts 82.14 KB
20
+ DTS dist/index.d.mts 82.14 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @axiom-lattice/pg-stores
2
2
 
3
+ ## 3.1.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [669fadb]
8
+ - @axiom-lattice/core@4.2.13
9
+
10
+ ## 3.1.12
11
+
12
+ ### Patch Changes
13
+
14
+ - b11b823: fix version
15
+ - Updated dependencies [b11b823]
16
+ - @axiom-lattice/core@4.2.12
17
+ - @axiom-lattice/protocols@4.2.3
18
+
3
19
  ## 3.1.11
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1636,6 +1636,17 @@ declare class PostgreSQLProjectRoomMessageStore implements ProjectRoomMessageSto
1636
1636
  after: Date;
1637
1637
  excludeAuthorUserId?: string;
1638
1638
  }): Promise<number>;
1639
+ /**
1640
+ * Deletes one bounded batch of chat messages older than a horizon.
1641
+ *
1642
+ * @param input Exclusive upper time bound and requested batch size (clamped to 1..1000).
1643
+ * @returns The number of deleted rows.
1644
+ * @remarks Only `source IN ('user','agent')` rows are eligible; task/system events are retained.
1645
+ */
1646
+ deleteChatOlderThan(input: {
1647
+ before: Date;
1648
+ limit: number;
1649
+ }): Promise<number>;
1639
1650
  private parameters;
1640
1651
  }
1641
1652
 
package/dist/index.d.ts CHANGED
@@ -1636,6 +1636,17 @@ declare class PostgreSQLProjectRoomMessageStore implements ProjectRoomMessageSto
1636
1636
  after: Date;
1637
1637
  excludeAuthorUserId?: string;
1638
1638
  }): Promise<number>;
1639
+ /**
1640
+ * Deletes one bounded batch of chat messages older than a horizon.
1641
+ *
1642
+ * @param input Exclusive upper time bound and requested batch size (clamped to 1..1000).
1643
+ * @returns The number of deleted rows.
1644
+ * @remarks Only `source IN ('user','agent')` rows are eligible; task/system events are retained.
1645
+ */
1646
+ deleteChatOlderThan(input: {
1647
+ before: Date;
1648
+ limit: number;
1649
+ }): Promise<number>;
1639
1650
  private parameters;
1640
1651
  }
1641
1652
 
package/dist/index.js CHANGED
@@ -10001,6 +10001,22 @@ var createProjectRoomReadStates = {
10001
10001
  }
10002
10002
  };
10003
10003
 
10004
+ // src/migrations/project_room_message_retention_migration.ts
10005
+ var addProjectRoomMessageRetentionIndex = {
10006
+ version: 179,
10007
+ name: "add_project_room_message_retention_index",
10008
+ up: async (client) => {
10009
+ await client.query(`
10010
+ CREATE INDEX IF NOT EXISTS idx_lattice_project_room_messages_chat_created
10011
+ ON lattice_project_room_messages (created_at)
10012
+ WHERE source IN ('user', 'agent')
10013
+ `);
10014
+ },
10015
+ down: async (client) => {
10016
+ await client.query("DROP INDEX IF EXISTS idx_lattice_project_room_messages_chat_created");
10017
+ }
10018
+ };
10019
+
10004
10020
  // src/migrations/user_push_subscription_migration.ts
10005
10021
  var createUserPushSubscriptions = {
10006
10022
  version: 178,
@@ -10845,6 +10861,30 @@ var PostgreSQLProjectRoomMessageStore = class {
10845
10861
  );
10846
10862
  return result.rows[0]?.count ?? 0;
10847
10863
  }
10864
+ /**
10865
+ * Deletes one bounded batch of chat messages older than a horizon.
10866
+ *
10867
+ * @param input Exclusive upper time bound and requested batch size (clamped to 1..1000).
10868
+ * @returns The number of deleted rows.
10869
+ * @remarks Only `source IN ('user','agent')` rows are eligible; task/system events are retained.
10870
+ */
10871
+ async deleteChatOlderThan(input) {
10872
+ if (!(input.before instanceof Date) || Number.isNaN(input.before.getTime())) {
10873
+ throw new RangeError("Project room message retention horizon date is invalid");
10874
+ }
10875
+ const limit = Math.min(1e3, Math.max(1, Math.trunc(Number.isFinite(input.limit) ? input.limit : 1)));
10876
+ const result = await this.pool.query(
10877
+ `DELETE FROM lattice_project_room_messages
10878
+ WHERE ctid IN (
10879
+ SELECT ctid FROM lattice_project_room_messages
10880
+ WHERE created_at < $1 AND source IN ('user','agent')
10881
+ ORDER BY created_at ASC
10882
+ LIMIT $2
10883
+ )`,
10884
+ [input.before, limit]
10885
+ );
10886
+ return result.rowCount ?? 0;
10887
+ }
10848
10888
  parameters(input) {
10849
10889
  return [
10850
10890
  input.id,
@@ -11022,6 +11062,7 @@ async function createPgStoreConfig(connectionString) {
11022
11062
  mm.register(addAgentWebAppsIdentity);
11023
11063
  mm.register(createProjectRoomReadStates);
11024
11064
  mm.register(createUserPushSubscriptions);
11065
+ mm.register(addProjectRoomMessageRetentionIndex);
11025
11066
  await mm.migrate();
11026
11067
  const checkpoint = import_langgraph_checkpoint_postgres.PostgresSaver.fromConnString(connectionString);
11027
11068
  checkpoint.setup().catch((err) => {