@opengeni/db 4.5.0 → 4.6.1
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/dist/index.d.ts
CHANGED
|
@@ -6392,7 +6392,10 @@ export declare function getSessionRootId(db: Database, workspaceId: string, sess
|
|
|
6392
6392
|
* before RLS is considered. Up to 63 ancestors are returned root-first; an
|
|
6393
6393
|
* invalid, cyclic, foreign, or deeper chain fails closed instead of presenting
|
|
6394
6394
|
* a partial path as if it were rooted. Descendants are capped at depth 5 and
|
|
6395
|
-
* 200 total rows, returned as a nested tree
|
|
6395
|
+
* 200 total rows, returned as a nested tree with each level newest first (as
|
|
6396
|
+
* the sidebar lists chats). The cap keeps shallower agents before deeper ones
|
|
6397
|
+
* and newer before older, so a long fleet loses its oldest grandchildren
|
|
6398
|
+
* first, never a direct child picked at random.
|
|
6396
6399
|
*/
|
|
6397
6400
|
export declare function getSessionLineage(db: Database, workspaceId: string, sessionId: string): Promise<SessionLineage | null>;
|
|
6398
6401
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2315,7 +2315,7 @@ import {
|
|
|
2315
2315
|
writeCompanyProfileLearning,
|
|
2316
2316
|
writeSessionContentBlobs,
|
|
2317
2317
|
writeSiteDataPath
|
|
2318
|
-
} from "./chunk-
|
|
2318
|
+
} from "./chunk-ZWXHVIPE.js";
|
|
2319
2319
|
import {
|
|
2320
2320
|
BROKERED_CREDENTIAL_SHAPE_HINT,
|
|
2321
2321
|
ConnectionRefreshHttpError,
|
package/dist/migrate.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/db",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.1",
|
|
4
4
|
"description": "Opengeni persistence: Drizzle schema, RLS-scoped query layer, the SQL migration runner, and role provisioning.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -121,14 +121,14 @@
|
|
|
121
121
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
|
-
"@opengeni/codemode": "4.
|
|
125
|
-
"@opengeni/codex": "4.
|
|
126
|
-
"@opengeni/config": "4.
|
|
127
|
-
"@opengeni/contracts": "4.
|
|
128
|
-
"@opengeni/network": "4.
|
|
129
|
-
"@opengeni/observability": "4.
|
|
130
|
-
"@opengeni/subscriptions": "4.
|
|
131
|
-
"@opengeni/xai-subscription": "4.
|
|
124
|
+
"@opengeni/codemode": "4.6.1",
|
|
125
|
+
"@opengeni/codex": "4.6.1",
|
|
126
|
+
"@opengeni/config": "4.6.1",
|
|
127
|
+
"@opengeni/contracts": "4.6.1",
|
|
128
|
+
"@opengeni/network": "4.6.1",
|
|
129
|
+
"@opengeni/observability": "4.6.1",
|
|
130
|
+
"@opengeni/subscriptions": "4.6.1",
|
|
131
|
+
"@opengeni/xai-subscription": "4.6.1",
|
|
132
132
|
"drizzle-orm": "^0.45.2",
|
|
133
133
|
"postgres": "^3.4.7"
|
|
134
134
|
},
|
package/src/index.ts
CHANGED
|
@@ -36914,7 +36914,10 @@ type LineageIdRow = {
|
|
|
36914
36914
|
* before RLS is considered. Up to 63 ancestors are returned root-first; an
|
|
36915
36915
|
* invalid, cyclic, foreign, or deeper chain fails closed instead of presenting
|
|
36916
36916
|
* a partial path as if it were rooted. Descendants are capped at depth 5 and
|
|
36917
|
-
* 200 total rows, returned as a nested tree
|
|
36917
|
+
* 200 total rows, returned as a nested tree with each level newest first (as
|
|
36918
|
+
* the sidebar lists chats). The cap keeps shallower agents before deeper ones
|
|
36919
|
+
* and newer before older, so a long fleet loses its oldest grandchildren
|
|
36920
|
+
* first, never a direct child picked at random.
|
|
36918
36921
|
*/
|
|
36919
36922
|
export async function getSessionLineage(
|
|
36920
36923
|
db: Database,
|
|
@@ -36971,13 +36974,13 @@ export async function getSessionLineage(
|
|
|
36971
36974
|
const ancestorRows = ancestorLineageRows.filter((row) => row.depth > 0);
|
|
36972
36975
|
|
|
36973
36976
|
const childRows = (await scopedDb.execute(sql<LineageIdRow>`
|
|
36974
|
-
with recursive descendants(id, parent_session_id, depth, path) as (
|
|
36975
|
-
select child.id, child.parent_session_id, 1, array[${sessionId}, child.id]
|
|
36977
|
+
with recursive descendants(id, parent_session_id, created_at, depth, path) as (
|
|
36978
|
+
select child.id, child.parent_session_id, child.created_at, 1, array[${sessionId}, child.id]
|
|
36976
36979
|
from ${schema.sessions} child
|
|
36977
36980
|
where child.workspace_id = ${workspaceId}
|
|
36978
36981
|
and child.parent_session_id = ${sessionId}
|
|
36979
36982
|
union all
|
|
36980
|
-
select child.id, child.parent_session_id, descendants.depth + 1, descendants.path || child.id
|
|
36983
|
+
select child.id, child.parent_session_id, child.created_at, descendants.depth + 1, descendants.path || child.id
|
|
36981
36984
|
from ${schema.sessions} child
|
|
36982
36985
|
join descendants on child.parent_session_id = descendants.id
|
|
36983
36986
|
where child.workspace_id = ${workspaceId}
|
|
@@ -36986,7 +36989,7 @@ export async function getSessionLineage(
|
|
|
36986
36989
|
)
|
|
36987
36990
|
select id, parent_session_id as "parentSessionId", depth, path, false as cycle
|
|
36988
36991
|
from descendants
|
|
36989
|
-
order by
|
|
36992
|
+
order by depth, created_at desc, id desc
|
|
36990
36993
|
limit ${descendantLimit + 1}
|
|
36991
36994
|
`)) as LineageIdRow[];
|
|
36992
36995
|
const truncated = childRows.length > descendantLimit;
|