@opengeni/db 0.13.4 → 0.14.3
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/{chunk-IQOXTFKA.js → chunk-DW24CKCT.js} +22 -10
- package/dist/chunk-DW24CKCT.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +492 -145
- package/dist/index.js.map +1 -1
- package/dist/provision-roles.d.ts +70 -15
- package/dist/{schema-SbaSoRdr.d.ts → schema-DhkRhcuQ.d.ts} +52 -16
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +1 -1
- package/drizzle/0134_session_first_party_mcp_tools.sql +15 -0
- package/drizzle/0135_durable_machine_input_batches.sql +359 -0
- package/drizzle/0136_unified_session_tool_policy.sql +109 -0
- package/package.json +3 -3
- package/src/index.ts +642 -151
- package/src/schema.ts +28 -10
- package/src/session-queue-commands.ts +30 -54
- package/dist/chunk-IQOXTFKA.js.map +0 -1
|
@@ -933,10 +933,12 @@ var sessions = pgTable2(
|
|
|
933
933
|
// Non-default first-party MCP token permissions (manager-style sessions);
|
|
934
934
|
// null means the fixed worker default set in @opengeni/runtime.
|
|
935
935
|
firstPartyMcpPermissions: jsonb("first_party_mcp_permissions").$type(),
|
|
936
|
-
//
|
|
937
|
-
//
|
|
938
|
-
|
|
939
|
-
|
|
936
|
+
// Exact model-visible first-party tool selection. All catalogued tools are
|
|
937
|
+
// selected by default; [] intentionally selects no broad-server tools.
|
|
938
|
+
firstPartyMcpTools: jsonb("first_party_mcp_tools").$type().notNull(),
|
|
939
|
+
// Durable tool-policy origin. Migration 0136 removes the old null/legacy
|
|
940
|
+
// representation so every session has one explicit policy mode.
|
|
941
|
+
toolPolicy: jsonb("tool_policy").$type().notNull(),
|
|
940
942
|
// Optimistic-concurrency fence for durable session tool-policy writes.
|
|
941
943
|
toolPolicyVersion: integer("tool_policy_version").notNull().default(1),
|
|
942
944
|
// The manager session that spawned this one via session_create. Set only
|
|
@@ -1865,14 +1867,15 @@ var sessionSystemUpdates = pgTable2(
|
|
|
1865
1867
|
summary: text2("summary").notNull(),
|
|
1866
1868
|
payload: jsonb("payload").$type().notNull().default({}),
|
|
1867
1869
|
lineage: jsonb("lineage").$type().notNull().default({}),
|
|
1868
|
-
// pending
|
|
1869
|
-
//
|
|
1870
|
-
// a genuinely new pending update arrives; delivered/cancelled/failed are
|
|
1871
|
-
// terminal for that delivery attempt.
|
|
1870
|
+
// pending is visible queue truth; delivered means its exact model-memory
|
|
1871
|
+
// batch was durably claimed. Terminal cancellation/supersession is explicit.
|
|
1872
1872
|
state: text2("state").notNull().default("pending"),
|
|
1873
1873
|
deliveredTurnId: uuid2("delivered_turn_id").references(() => sessionTurns.id, {
|
|
1874
1874
|
onDelete: "set null"
|
|
1875
1875
|
}),
|
|
1876
|
+
// Migration owns the forward FK to session_history_items, declared later.
|
|
1877
|
+
// Every member of one claimed batch points at the exact model-memory row.
|
|
1878
|
+
deliveredHistoryItemId: uuid2("delivered_history_item_id"),
|
|
1876
1879
|
deliveredAt: timestamp2("delivered_at", { withTimezone: true }),
|
|
1877
1880
|
createdAt: timestamp2("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
1878
1881
|
},
|
|
@@ -1887,7 +1890,7 @@ var sessionSystemUpdates = pgTable2(
|
|
|
1887
1890
|
),
|
|
1888
1891
|
stateValid: check2(
|
|
1889
1892
|
"system_updates_state_check",
|
|
1890
|
-
sql2`${table.state} in ('pending', '
|
|
1893
|
+
sql2`${table.state} in ('pending', 'delivered', 'cancelled', 'superseded', 'failed')`
|
|
1891
1894
|
),
|
|
1892
1895
|
dedupe: uniqueIndex2("session_system_updates_dedupe_uq").on(
|
|
1893
1896
|
table.workspaceId,
|
|
@@ -1899,6 +1902,15 @@ var sessionSystemUpdates = pgTable2(
|
|
|
1899
1902
|
table.sessionId,
|
|
1900
1903
|
table.state,
|
|
1901
1904
|
table.createdAt
|
|
1905
|
+
),
|
|
1906
|
+
onePendingSteer: uniqueIndex2("session_system_updates_one_pending_steer_idx").on(table.workspaceId, table.sessionId).where(sql2`${table.kind} = 'agent_steer_instruction' and ${table.state} = 'pending'`),
|
|
1907
|
+
deliveryHistoryValid: check2(
|
|
1908
|
+
"session_system_updates_delivery_history_check",
|
|
1909
|
+
sql2`(
|
|
1910
|
+
(${table.state} = 'delivered' and ${table.deliveredHistoryItemId} is not null)
|
|
1911
|
+
or
|
|
1912
|
+
(${table.state} <> 'delivered' and ${table.deliveredHistoryItemId} is null)
|
|
1913
|
+
)`
|
|
1902
1914
|
)
|
|
1903
1915
|
})
|
|
1904
1916
|
);
|
|
@@ -4031,4 +4043,4 @@ export {
|
|
|
4031
4043
|
rigChanges,
|
|
4032
4044
|
schema_exports
|
|
4033
4045
|
};
|
|
4034
|
-
//# sourceMappingURL=chunk-
|
|
4046
|
+
//# sourceMappingURL=chunk-DW24CKCT.js.map
|