@axiom-lattice/pg-stores 3.1.12 → 3.1.14
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 +17 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/PostgreSQLAgentWebAppStore.test.ts +18 -0
- package/src/__tests__/PostgreSQLProjectRoomMessageStore.test.ts +25 -0
- package/src/createPgStoreConfig.ts +2 -0
- package/src/migrations/project_room_message_retention_migration.ts +23 -0
- package/src/stores/PostgreSQLAgentWebAppStore.ts +10 -1
- package/src/stores/PostgreSQLProjectRoomMessageStore.ts +25 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/pg-stores@3.1.
|
|
2
|
+
> @axiom-lattice/pg-stores@3.1.14 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
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m399.60 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m728.88 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 625ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m391.39 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m728.51 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 664ms
|
|
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 14015ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m82.14 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m82.14 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 3.1.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 693a1ab: Add `quickPrompts` (up to 6 `{ label, text }` suggestions) to Agent Web App appearance, with strict server validation, Console form editing, store round-tripping, and runtime bootstrap passthrough for the chat empty state.
|
|
8
|
+
- Updated dependencies [693a1ab]
|
|
9
|
+
- Updated dependencies [d36a7b6]
|
|
10
|
+
- @axiom-lattice/protocols@4.3.0
|
|
11
|
+
- @axiom-lattice/core@4.2.14
|
|
12
|
+
|
|
13
|
+
## 3.1.13
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [669fadb]
|
|
18
|
+
- @axiom-lattice/core@4.2.13
|
|
19
|
+
|
|
3
20
|
## 3.1.12
|
|
4
21
|
|
|
5
22
|
### 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
|
@@ -6724,8 +6724,11 @@ function isScope(value) {
|
|
|
6724
6724
|
function isFeatures(value) {
|
|
6725
6725
|
return isRecord(value) && typeof value.projectSelector === "boolean" && typeof value.modelSelector === "boolean" && typeof value.threadManagement === "boolean" && typeof value.attachments === "boolean" && typeof value.hitl === "boolean" && typeof value.genUI === "boolean" && (value.files === void 0 || typeof value.files === "boolean");
|
|
6726
6726
|
}
|
|
6727
|
+
function isQuickPrompt(value) {
|
|
6728
|
+
return isRecord(value) && typeof value.label === "string" && typeof value.text === "string";
|
|
6729
|
+
}
|
|
6727
6730
|
function isAppearance(value) {
|
|
6728
|
-
return isRecord(value) && (value.title === void 0 || typeof value.title === "string") && (value.welcomeMessage === void 0 || typeof value.welcomeMessage === "string") && (value.primaryColor === void 0 || typeof value.primaryColor === "string");
|
|
6731
|
+
return isRecord(value) && (value.title === void 0 || typeof value.title === "string") && (value.welcomeMessage === void 0 || typeof value.welcomeMessage === "string") && (value.primaryColor === void 0 || typeof value.primaryColor === "string") && (value.quickPrompts === void 0 || Array.isArray(value.quickPrompts) && value.quickPrompts.every(isQuickPrompt));
|
|
6729
6732
|
}
|
|
6730
6733
|
function isIdentity(value) {
|
|
6731
6734
|
if (value === null || value === void 0) return true;
|
|
@@ -10001,6 +10004,22 @@ var createProjectRoomReadStates = {
|
|
|
10001
10004
|
}
|
|
10002
10005
|
};
|
|
10003
10006
|
|
|
10007
|
+
// src/migrations/project_room_message_retention_migration.ts
|
|
10008
|
+
var addProjectRoomMessageRetentionIndex = {
|
|
10009
|
+
version: 179,
|
|
10010
|
+
name: "add_project_room_message_retention_index",
|
|
10011
|
+
up: async (client) => {
|
|
10012
|
+
await client.query(`
|
|
10013
|
+
CREATE INDEX IF NOT EXISTS idx_lattice_project_room_messages_chat_created
|
|
10014
|
+
ON lattice_project_room_messages (created_at)
|
|
10015
|
+
WHERE source IN ('user', 'agent')
|
|
10016
|
+
`);
|
|
10017
|
+
},
|
|
10018
|
+
down: async (client) => {
|
|
10019
|
+
await client.query("DROP INDEX IF EXISTS idx_lattice_project_room_messages_chat_created");
|
|
10020
|
+
}
|
|
10021
|
+
};
|
|
10022
|
+
|
|
10004
10023
|
// src/migrations/user_push_subscription_migration.ts
|
|
10005
10024
|
var createUserPushSubscriptions = {
|
|
10006
10025
|
version: 178,
|
|
@@ -10845,6 +10864,30 @@ var PostgreSQLProjectRoomMessageStore = class {
|
|
|
10845
10864
|
);
|
|
10846
10865
|
return result.rows[0]?.count ?? 0;
|
|
10847
10866
|
}
|
|
10867
|
+
/**
|
|
10868
|
+
* Deletes one bounded batch of chat messages older than a horizon.
|
|
10869
|
+
*
|
|
10870
|
+
* @param input Exclusive upper time bound and requested batch size (clamped to 1..1000).
|
|
10871
|
+
* @returns The number of deleted rows.
|
|
10872
|
+
* @remarks Only `source IN ('user','agent')` rows are eligible; task/system events are retained.
|
|
10873
|
+
*/
|
|
10874
|
+
async deleteChatOlderThan(input) {
|
|
10875
|
+
if (!(input.before instanceof Date) || Number.isNaN(input.before.getTime())) {
|
|
10876
|
+
throw new RangeError("Project room message retention horizon date is invalid");
|
|
10877
|
+
}
|
|
10878
|
+
const limit = Math.min(1e3, Math.max(1, Math.trunc(Number.isFinite(input.limit) ? input.limit : 1)));
|
|
10879
|
+
const result = await this.pool.query(
|
|
10880
|
+
`DELETE FROM lattice_project_room_messages
|
|
10881
|
+
WHERE ctid IN (
|
|
10882
|
+
SELECT ctid FROM lattice_project_room_messages
|
|
10883
|
+
WHERE created_at < $1 AND source IN ('user','agent')
|
|
10884
|
+
ORDER BY created_at ASC
|
|
10885
|
+
LIMIT $2
|
|
10886
|
+
)`,
|
|
10887
|
+
[input.before, limit]
|
|
10888
|
+
);
|
|
10889
|
+
return result.rowCount ?? 0;
|
|
10890
|
+
}
|
|
10848
10891
|
parameters(input) {
|
|
10849
10892
|
return [
|
|
10850
10893
|
input.id,
|
|
@@ -11022,6 +11065,7 @@ async function createPgStoreConfig(connectionString) {
|
|
|
11022
11065
|
mm.register(addAgentWebAppsIdentity);
|
|
11023
11066
|
mm.register(createProjectRoomReadStates);
|
|
11024
11067
|
mm.register(createUserPushSubscriptions);
|
|
11068
|
+
mm.register(addProjectRoomMessageRetentionIndex);
|
|
11025
11069
|
await mm.migrate();
|
|
11026
11070
|
const checkpoint = import_langgraph_checkpoint_postgres.PostgresSaver.fromConnString(connectionString);
|
|
11027
11071
|
checkpoint.setup().catch((err) => {
|