@opengeni/db 0.22.2 → 0.26.0
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-CYGFLLMN.js → chunk-7WTDI7Y3.js} +764 -283
- package/dist/chunk-7WTDI7Y3.js.map +1 -0
- package/dist/{chunk-BNGEN5QZ.js → chunk-KW6U54V2.js} +26 -2
- package/dist/chunk-KW6U54V2.js.map +1 -0
- package/dist/connection-token-resolver.d.ts +24 -2
- package/dist/index.d.ts +107 -5
- package/dist/index.js +7857 -3898
- package/dist/index.js.map +1 -1
- package/dist/preference-registry.d.ts +14 -0
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +3 -3
- package/dist/schema.d.ts +1659 -77
- package/dist/schema.js +13 -1
- package/dist/session-control.d.ts +7 -1
- package/dist/session-queue-commands.d.ts +8 -0
- package/dist/session-realtime-context.d.ts +56 -0
- package/dist/session-realtime-ledger.d.ts +188 -0
- package/dist/session-realtime-mirror.d.ts +51 -0
- package/dist/session-realtime-state.d.ts +2 -0
- package/dist/session-realtime-terminal.d.ts +40 -0
- package/dist/session-realtime.d.ts +59 -0
- package/dist/workspace-instruction-policies-schema.d.ts +307 -0
- package/dist/workspace-instruction-policies.d.ts +97 -7
- package/drizzle/0156_slack_reaction_trigger.sql +49 -0
- package/drizzle/0157_session_policy_role_snapshots.sql +1146 -0
- package/drizzle/0158_session_realtime_mode.sql +88 -0
- package/drizzle/0159_session_realtime_ledger.sql +198 -0
- package/drizzle/0160_session_realtime_delegation_terminal.sql +38 -0
- package/drizzle/0161_session_realtime_context_projection.sql +82 -0
- package/drizzle/0162_session_realtime_connection_promotion.sql +53 -0
- package/drizzle/0163_session_realtime_delegation_progress.sql +35 -0
- package/drizzle/0164_session_realtime_models.sql +28 -0
- package/drizzle/0165_document_authority_foundation.sql +259 -0
- package/drizzle/0166_connection_disconnect_idempotency.sql +49 -0
- package/drizzle/0167_document_index_replay_authority.sql +61 -0
- package/drizzle/0168_workspace_instruction_policy_operation_receipts.sql +44 -0
- package/package.json +4 -4
- package/src/connection-token-resolver.ts +79 -16
- package/src/index.ts +1033 -101
- package/src/preference-registry.ts +114 -6
- package/src/provision-roles.ts +12 -0
- package/src/runtime-posture.ts +12 -0
- package/src/schema.ts +486 -43
- package/src/session-control.ts +643 -21
- package/src/session-queue-commands.ts +121 -18
- package/src/session-realtime-context.ts +393 -0
- package/src/session-realtime-ledger.ts +1790 -0
- package/src/session-realtime-mirror.ts +276 -0
- package/src/session-realtime-state.ts +25 -0
- package/src/session-realtime-terminal.ts +306 -0
- package/src/session-realtime.ts +659 -0
- package/src/workspace-instruction-policies-schema.ts +71 -0
- package/src/workspace-instruction-policies.ts +568 -25
- package/dist/chunk-BNGEN5QZ.js.map +0 -1
- package/dist/chunk-CYGFLLMN.js.map +0 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { sql } from "drizzle-orm";
|
|
2
|
+
import type { WorkspaceInstructionPolicySnapshotEntry } from "@opengeni/contracts";
|
|
2
3
|
import {
|
|
3
4
|
bigint,
|
|
4
5
|
check,
|
|
5
6
|
index,
|
|
7
|
+
integer,
|
|
8
|
+
jsonb,
|
|
6
9
|
pgTable,
|
|
7
10
|
text,
|
|
8
11
|
timestamp,
|
|
@@ -18,6 +21,8 @@ export const workspaceInstructionPolicyRevisions = pgTable(
|
|
|
18
21
|
"workspace_instruction_policy_revisions",
|
|
19
22
|
{
|
|
20
23
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
24
|
+
operationId: uuid("operation_id"),
|
|
25
|
+
requestFingerprint: text("request_fingerprint"),
|
|
21
26
|
accountId: uuid("account_id").notNull(),
|
|
22
27
|
workspaceId: uuid("workspace_id").notNull(),
|
|
23
28
|
revision: bigint("revision", { mode: "number" })
|
|
@@ -35,6 +40,19 @@ export const workspaceInstructionPolicyRevisions = pgTable(
|
|
|
35
40
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
36
41
|
},
|
|
37
42
|
(table) => ({
|
|
43
|
+
workspaceOperation: uniqueIndex("workspace_instruction_policy_revisions_workspace_operation_uq")
|
|
44
|
+
.on(table.workspaceId, table.operationId)
|
|
45
|
+
.where(sql`${table.operationId} is not null`),
|
|
46
|
+
operationReceipt: check(
|
|
47
|
+
"workspace_instruction_policy_revisions_operation_receipt_chk",
|
|
48
|
+
sql`(
|
|
49
|
+
(${table.operationId} is null and ${table.requestFingerprint} is null)
|
|
50
|
+
or (
|
|
51
|
+
${table.operationId} is not null
|
|
52
|
+
and ${table.requestFingerprint} ~ '^[0-9a-f]{64}$'
|
|
53
|
+
)
|
|
54
|
+
)`,
|
|
55
|
+
),
|
|
38
56
|
workspaceRevision: uniqueIndex(
|
|
39
57
|
"workspace_instruction_policy_revisions_workspace_revision_uq",
|
|
40
58
|
).on(table.workspaceId, table.revision),
|
|
@@ -96,6 +114,8 @@ export const workspaceInstructionPolicyActivationEvents = pgTable(
|
|
|
96
114
|
"workspace_instruction_policy_activation_events",
|
|
97
115
|
{
|
|
98
116
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
117
|
+
operationId: uuid("operation_id"),
|
|
118
|
+
requestFingerprint: text("request_fingerprint"),
|
|
99
119
|
accountId: uuid("account_id").notNull(),
|
|
100
120
|
workspaceId: uuid("workspace_id").notNull(),
|
|
101
121
|
kind: text("kind").notNull(),
|
|
@@ -114,6 +134,19 @@ export const workspaceInstructionPolicyActivationEvents = pgTable(
|
|
|
114
134
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
115
135
|
},
|
|
116
136
|
(table) => ({
|
|
137
|
+
workspaceOperation: uniqueIndex("workspace_instruction_policy_events_workspace_operation_uq")
|
|
138
|
+
.on(table.workspaceId, table.operationId)
|
|
139
|
+
.where(sql`${table.operationId} is not null`),
|
|
140
|
+
operationReceipt: check(
|
|
141
|
+
"workspace_instruction_policy_events_operation_receipt_chk",
|
|
142
|
+
sql`(
|
|
143
|
+
(${table.operationId} is null and ${table.requestFingerprint} is null)
|
|
144
|
+
or (
|
|
145
|
+
${table.operationId} is not null
|
|
146
|
+
and ${table.requestFingerprint} ~ '^[0-9a-f]{64}$'
|
|
147
|
+
)
|
|
148
|
+
)`,
|
|
149
|
+
),
|
|
117
150
|
workspaceActivationVersion: uniqueIndex(
|
|
118
151
|
"workspace_instruction_policy_events_target_version_uq",
|
|
119
152
|
).on(
|
|
@@ -138,3 +171,41 @@ export const workspaceInstructionPolicyActivationEvents = pgTable(
|
|
|
138
171
|
),
|
|
139
172
|
}),
|
|
140
173
|
);
|
|
174
|
+
|
|
175
|
+
export const workspaceInstructionPolicySnapshots = pgTable(
|
|
176
|
+
"workspace_instruction_policy_snapshots",
|
|
177
|
+
{
|
|
178
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
179
|
+
accountId: uuid("account_id").notNull(),
|
|
180
|
+
workspaceId: uuid("workspace_id").notNull(),
|
|
181
|
+
sessionId: uuid("session_id").notNull(),
|
|
182
|
+
turnId: uuid("turn_id").notNull(),
|
|
183
|
+
attemptId: uuid("attempt_id").notNull(),
|
|
184
|
+
executionGeneration: integer("execution_generation").notNull(),
|
|
185
|
+
policyRole: text("policy_role"),
|
|
186
|
+
roleSource: text("role_source").notNull(),
|
|
187
|
+
entries: jsonb("entries").$type<WorkspaceInstructionPolicySnapshotEntry[]>().notNull(),
|
|
188
|
+
entryHash: text("entry_hash").notNull(),
|
|
189
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
190
|
+
},
|
|
191
|
+
(table) => ({
|
|
192
|
+
attempt: uniqueIndex("workspace_instruction_policy_snapshots_attempt_uq").on(
|
|
193
|
+
table.accountId,
|
|
194
|
+
table.workspaceId,
|
|
195
|
+
table.attemptId,
|
|
196
|
+
),
|
|
197
|
+
workspaceTimeline: index("workspace_instruction_policy_snapshots_workspace_time_idx").on(
|
|
198
|
+
table.workspaceId,
|
|
199
|
+
table.createdAt,
|
|
200
|
+
table.id,
|
|
201
|
+
),
|
|
202
|
+
entriesShape: check(
|
|
203
|
+
"workspace_instruction_policy_snapshots_entries_chk",
|
|
204
|
+
sql`jsonb_typeof(${table.entries}) = 'array' and jsonb_array_length(${table.entries}) <= 3`,
|
|
205
|
+
),
|
|
206
|
+
roleSourceValid: check(
|
|
207
|
+
"workspace_instruction_policy_snapshots_role_source_chk",
|
|
208
|
+
sql`${table.roleSource} in ('session_binding', 'metadata_fallback', 'none', 'invalid_metadata_fallback')`,
|
|
209
|
+
),
|
|
210
|
+
}),
|
|
211
|
+
);
|