@opengeni/db 0.2.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.
Files changed (66) hide show
  1. package/dist/chunk-57MLICFR.js +121 -0
  2. package/dist/chunk-57MLICFR.js.map +1 -0
  3. package/dist/chunk-OGCE6O2X.js +52 -0
  4. package/dist/chunk-OGCE6O2X.js.map +1 -0
  5. package/dist/chunk-PSX56ZTL.js +1093 -0
  6. package/dist/chunk-PSX56ZTL.js.map +1 -0
  7. package/dist/chunk-PZ5AY32C.js +10 -0
  8. package/dist/chunk-PZ5AY32C.js.map +1 -0
  9. package/dist/index.d.ts +8 -0
  10. package/dist/index.js +5165 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/migrate.d.ts +40 -0
  13. package/dist/migrate.js +10 -0
  14. package/dist/migrate.js.map +1 -0
  15. package/dist/provision-roles.d.ts +2063 -0
  16. package/dist/provision-roles.js +8 -0
  17. package/dist/provision-roles.js.map +1 -0
  18. package/dist/schema-CaeZQAJQ.d.ts +9705 -0
  19. package/dist/schema.d.ts +3 -0
  20. package/dist/schema.js +110 -0
  21. package/dist/schema.js.map +1 -0
  22. package/drizzle/0000_initial.sql +179 -0
  23. package/drizzle/0001_workspace_auth_billing.sql +590 -0
  24. package/drizzle/0002_packs_and_social.sql +99 -0
  25. package/drizzle/0003_capability_catalog.sql +73 -0
  26. package/drizzle/0004_workspace_environments.sql +65 -0
  27. package/drizzle/0005_session_goals.sql +45 -0
  28. package/drizzle/0006_workspace_packs.sql +31 -0
  29. package/drizzle/0007_session_history_items.sql +66 -0
  30. package/drizzle/0008_session_first_party_mcp_permissions.sql +5 -0
  31. package/drizzle/0009_goal_sessions_first_party_goals_manage.sql +34 -0
  32. package/drizzle/0010_session_parent_linkage.sql +30 -0
  33. package/drizzle/0011_context_compaction.sql +33 -0
  34. package/drizzle/0012_compaction_summary_fractional_position.sql +19 -0
  35. package/drizzle/0013_session_compact_requested.sql +16 -0
  36. package/drizzle/0014_repair_orphaned_function_call_results.sql +125 -0
  37. package/drizzle/0015_workspace_agent_instructions.sql +17 -0
  38. package/drizzle/0016_session_create_idempotency.sql +27 -0
  39. package/drizzle/0017_sandbox_leases.sql +313 -0
  40. package/drizzle/0018_sandbox_os.sql +89 -0
  41. package/drizzle/0019_session_stream_acknowledgments.sql +94 -0
  42. package/drizzle/0020_session_recordings.sql +88 -0
  43. package/drizzle/0021_sandbox_pty_sessions.sql +70 -0
  44. package/drizzle/0022_sandbox_lease_terminal_url.sql +32 -0
  45. package/drizzle/0023_session_title.sql +19 -0
  46. package/drizzle/0024_codex_subscription_credentials.sql +51 -0
  47. package/drizzle/0024_sandboxes_enrollments_metrics.sql +262 -0
  48. package/drizzle/0025_device_enrollment_requests.sql +142 -0
  49. package/drizzle/0026_device_enrollment_user_code_resolver.sql +47 -0
  50. package/drizzle/0027_session_working_dir.sql +24 -0
  51. package/drizzle/0028_codex_multi_account.sql +85 -0
  52. package/drizzle/0029_session_history_item_producer.sql +31 -0
  53. package/drizzle/0030_agent_run_state_frozen_codex.sql +35 -0
  54. package/drizzle/0031_codex_usage_cache.sql +21 -0
  55. package/drizzle/0032_codex_account_cooldown.sql +18 -0
  56. package/drizzle/0033_codex_connector_cache.sql +20 -0
  57. package/drizzle/0034_sandbox_lease_image.sql +21 -0
  58. package/drizzle/meta/_journal.json +167 -0
  59. package/package.json +66 -0
  60. package/src/codex-token-resolver.ts +247 -0
  61. package/src/environment-crypto.ts +51 -0
  62. package/src/event-payload-sanitizer.ts +89 -0
  63. package/src/index.ts +7776 -0
  64. package/src/migrate.ts +95 -0
  65. package/src/provision-roles.ts +198 -0
  66. package/src/schema.ts +1110 -0
@@ -0,0 +1,85 @@
1
+ -- 0028_codex_multi_account.sql
2
+ -- Multi-account P1: N Codex subscriptions per workspace + a per-workspace active
3
+ -- pointer + per-session pin/actual. Additive; relaxes (does not drop) uniqueness.
4
+ --
5
+ -- Runs under the runner's pg_advisory_lock(727458), so no app traffic observes
6
+ -- the relaxed window or the NO FORCE backfill window below.
7
+
8
+ -- 1. Per-account label/email metadata (plaintext, non-secret).
9
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "label" text;
10
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "account_email" text;
11
+
12
+ -- 2. Relax one-per-workspace -> one-per-(workspace, chatgpt account).
13
+ DROP INDEX IF EXISTS "codex_subscription_credentials_workspace_idx";
14
+ CREATE UNIQUE INDEX IF NOT EXISTS "codex_subscription_credentials_ws_account_idx"
15
+ ON "codex_subscription_credentials" ("workspace_id", "chatgpt_account_id")
16
+ WHERE "chatgpt_account_id" IS NOT NULL;
17
+ CREATE INDEX IF NOT EXISTS "codex_subscription_credentials_workspace_lookup_idx"
18
+ ON "codex_subscription_credentials" ("workspace_id");
19
+
20
+ -- 3. Per-session pin + actual. FK ON DELETE SET NULL (degrade, never dangle/cascade).
21
+ ALTER TABLE "sessions" ADD COLUMN IF NOT EXISTS "codex_pinned_credential_id" uuid;
22
+ ALTER TABLE "sessions" ADD COLUMN IF NOT EXISTS "codex_last_credential_id" uuid;
23
+ DO $$
24
+ BEGIN
25
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'sessions_codex_pinned_credential_fk') THEN
26
+ ALTER TABLE "sessions"
27
+ ADD CONSTRAINT "sessions_codex_pinned_credential_fk"
28
+ FOREIGN KEY ("codex_pinned_credential_id")
29
+ REFERENCES "codex_subscription_credentials"("id") ON DELETE SET NULL;
30
+ END IF;
31
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'sessions_codex_last_credential_fk') THEN
32
+ ALTER TABLE "sessions"
33
+ ADD CONSTRAINT "sessions_codex_last_credential_fk"
34
+ FOREIGN KEY ("codex_last_credential_id")
35
+ REFERENCES "codex_subscription_credentials"("id") ON DELETE SET NULL;
36
+ END IF;
37
+ END $$;
38
+
39
+ -- 4. The per-workspace active-pointer table (created WITHOUT force-rls yet).
40
+ CREATE TABLE IF NOT EXISTS "codex_rotation_settings" (
41
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
42
+ "account_id" uuid NOT NULL REFERENCES "managed_accounts"("id") ON DELETE CASCADE,
43
+ "workspace_id" uuid NOT NULL REFERENCES "workspaces"("id") ON DELETE CASCADE,
44
+ "active_credential_id" uuid
45
+ REFERENCES "codex_subscription_credentials"("id") ON DELETE SET NULL,
46
+ "rotation_enabled" boolean NOT NULL DEFAULT false,
47
+ "rotation_strategy" text NOT NULL DEFAULT 'most_remaining',
48
+ "created_at" timestamptz NOT NULL DEFAULT now(),
49
+ "updated_at" timestamptz NOT NULL DEFAULT now()
50
+ );
51
+ CREATE UNIQUE INDEX IF NOT EXISTS "codex_rotation_settings_workspace_idx"
52
+ ON "codex_rotation_settings" ("workspace_id");
53
+
54
+ -- 5. Backfill: every existing single credential becomes its workspace's ACTIVE
55
+ -- account. Reads a FORCE-RLS table as owner -> drop FORCE around it (precedent 0009).
56
+ ALTER TABLE "codex_subscription_credentials" NO FORCE ROW LEVEL SECURITY;
57
+ INSERT INTO "codex_rotation_settings" ("account_id", "workspace_id", "active_credential_id", "rotation_enabled")
58
+ SELECT c."account_id", c."workspace_id", c."id", false
59
+ FROM "codex_subscription_credentials" c
60
+ ON CONFLICT ("workspace_id") DO NOTHING;
61
+ UPDATE "codex_subscription_credentials" SET "label" = "plan_type"
62
+ WHERE "label" IS NULL AND "plan_type" IS NOT NULL; -- cosmetic seed; route backfills email on next connect
63
+ ALTER TABLE "codex_subscription_credentials" FORCE ROW LEVEL SECURITY;
64
+
65
+ -- 6. RLS on the new table — verbatim from 0024_codex_subscription_credentials.sql:31-44.
66
+ ALTER TABLE "codex_rotation_settings" ENABLE ROW LEVEL SECURITY;
67
+ ALTER TABLE "codex_rotation_settings" FORCE ROW LEVEL SECURITY;
68
+ DO $$
69
+ BEGIN
70
+ IF EXISTS (SELECT 1 FROM pg_policies
71
+ WHERE schemaname = current_schema() AND tablename = 'codex_rotation_settings' AND policyname = 'workspace_isolation') THEN
72
+ DROP POLICY workspace_isolation ON "codex_rotation_settings";
73
+ END IF;
74
+ END $$;
75
+ CREATE POLICY workspace_isolation ON "codex_rotation_settings"
76
+ USING (opengeni_private.workspace_rls_visible(account_id, workspace_id))
77
+ WITH CHECK (opengeni_private.workspace_rls_visible(account_id, workspace_id));
78
+
79
+ -- 7. Re-grant (verbatim from 0024:46-51).
80
+ DO $$
81
+ BEGIN
82
+ IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'opengeni_app') THEN
83
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO opengeni_app;
84
+ END IF;
85
+ END $$;
@@ -0,0 +1,31 @@
1
+ -- 0029_session_history_item_producer.sql
2
+ -- Cross-account encrypted-reasoning strip (multi-account codex, on top of P1).
3
+ --
4
+ -- Codex-subscription turns round-trip `reasoning.encrypted_content` — an opaque
5
+ -- blob minted by the ChatGPT/Codex backend that is account/org-bound. After a
6
+ -- manual switch from codex account A to B, the next turn on B replays history
7
+ -- items whose encrypted reasoning was minted by A, which B rejects (400). We tag
8
+ -- every conversation-truth row with the codex account that produced it so the
9
+ -- read path can drop the encrypted reasoning of any item NOT produced by the
10
+ -- turn's CURRENT codex account (message content is fully preserved).
11
+ --
12
+ -- Nullable, no FK: provenance must OUTLIVE the account's hard-disconnect (an
13
+ -- ON DELETE SET NULL would erase the tag). NULL = produced on the non-codex /
14
+ -- Azure path, or before this column existed (a legacy row replayed onto a codex
15
+ -- turn then has NULL != the live codex id, so it is stripped — defensive and
16
+ -- harmless: at most one turn of lost chain-of-thought continuity, never content).
17
+ --
18
+ -- Additive; every existing + new row defaults NULL, so non-codex and
19
+ -- single-account flows are byte-identical no-ops. Runs under the runner's
20
+ -- pg_advisory_lock(727458).
21
+ ALTER TABLE "session_history_items"
22
+ ADD COLUMN IF NOT EXISTS "producer_codex_credential_id" uuid;
23
+
24
+ -- Re-grant on the new column (idempotent; mirrors the boilerplate in earlier
25
+ -- migrations so a fresh opengeni_app role can read/write the added column).
26
+ DO $$
27
+ BEGIN
28
+ IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'opengeni_app') THEN
29
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO opengeni_app;
30
+ END IF;
31
+ END $$;
@@ -0,0 +1,35 @@
1
+ -- 0030_agent_run_state_frozen_codex.sql
2
+ -- Cross-account encrypted-reasoning strip on the run-state REPLAY paths
3
+ -- (HOLE C of the multi-account verify): record which codex account froze a run
4
+ -- state so a resume on a DIFFERENT account can neutralize the frozen, account/
5
+ -- org-bound reasoning before replaying it.
6
+ --
7
+ -- The serialized RunState blob (used by the approval-decision resume and the
8
+ -- items-mode run-state fallback) round-trips `reasoning.encrypted_content` —
9
+ -- minted by the ChatGPT/Codex backend and bound to the producing account/org —
10
+ -- and the foreign reasoning ids the Responses backend validates. Unlike
11
+ -- session_history_items, the blob carries NO per-item producer tag, so we cannot
12
+ -- decide foreign-ness per item. Instead we stamp the freezing account on the
13
+ -- run-state row: when a turn resumes a state whose codex account differs from
14
+ -- the resuming turn's codex account, the replay path strips every reasoning
15
+ -- item's account-bound identity (encrypted_content + provider id) from the blob.
16
+ --
17
+ -- Nullable, no FK: provenance must OUTLIVE the account's hard-disconnect (an
18
+ -- ON DELETE SET NULL would erase the tag). NULL = frozen on the non-codex /
19
+ -- Azure path, or before this column existed. NULL frozen + NULL resume (the
20
+ -- non-codex / single-account case) compares equal, so those replays are
21
+ -- byte-identical no-ops.
22
+ --
23
+ -- Additive; every existing + new row defaults NULL. Runs under the runner's
24
+ -- pg_advisory_lock(727458).
25
+ ALTER TABLE "agent_run_states"
26
+ ADD COLUMN IF NOT EXISTS "frozen_codex_credential_id" uuid;
27
+
28
+ -- Re-grant on the new column (idempotent; mirrors the boilerplate in earlier
29
+ -- migrations so a fresh opengeni_app role can read/write the added column).
30
+ DO $$
31
+ BEGIN
32
+ IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'opengeni_app') THEN
33
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO opengeni_app;
34
+ END IF;
35
+ END $$;
@@ -0,0 +1,21 @@
1
+ -- 0031_codex_usage_cache.sql
2
+ -- Multi-account P2: per-account usage cache columns on codex_subscription_credentials.
3
+ -- All five are PLAINTEXT metadata (used_percent + reset timing) snapshotted from
4
+ -- GET /wham/usage; they NEVER hold a token or any secret. RLS is row-level, so the
5
+ -- existing workspace_isolation policy already covers them — NO policy change.
6
+ -- Additive only (mirrors 0028's style). Runs under the runner's advisory lock.
7
+
8
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "primary_used_percent" integer;
9
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "primary_reset_at" timestamptz;
10
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "secondary_used_percent" integer;
11
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "secondary_reset_at" timestamptz;
12
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "usage_checked_at" timestamptz;
13
+
14
+ -- Re-grant (verbatim from 0024:46-51 / 0028:79-85) so opengeni_app keeps DML on
15
+ -- the altered table after the column additions.
16
+ DO $$
17
+ BEGIN
18
+ IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'opengeni_app') THEN
19
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO opengeni_app;
20
+ END IF;
21
+ END $$;
@@ -0,0 +1,18 @@
1
+ -- 0032_codex_account_cooldown.sql
2
+ -- Multi-account P3 (auto-rotation): one cooldown column on codex_subscription_credentials.
3
+ -- `exhausted_until` is PLAINTEXT metadata (a timestamp), NEVER a token or secret. It marks
4
+ -- an account as cooling-down until its usage cap resets, so the rotation engine deterministically
5
+ -- skips a just-rotated-off account until then (no immediate re-pick, no thrash). The column
6
+ -- self-clears via the now() comparison at read time — no sweeper. RLS is row-level, so the
7
+ -- existing workspace_isolation policy already covers it — NO policy change. Additive only
8
+ -- (mirrors 0031's style). Runs under the runner's advisory lock.
9
+
10
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "exhausted_until" timestamptz;
11
+
12
+ -- Re-grant (verbatim from 0031:17-22) so opengeni_app keeps DML on the altered table.
13
+ DO $$
14
+ BEGIN
15
+ IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'opengeni_app') THEN
16
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO opengeni_app;
17
+ END IF;
18
+ END $$;
@@ -0,0 +1,20 @@
1
+ -- 0033_codex_connector_cache.sql
2
+ -- Multi-account P4 (Part B): per-account connector-set cache on codex_subscription_credentials.
3
+ -- Both columns are PLAINTEXT metadata (the ORIGINAL-dotted connector namespaces the account
4
+ -- exposes via codex_apps, e.g. {github,gmail,linear}, plus a freshness clock); they NEVER hold a
5
+ -- token or any secret. The rotation ranker PREFERS (never requires) a target whose connector set
6
+ -- covers the leaving account's set, so a switch doesn't strand a session mid-connector. RLS is
7
+ -- row-level, so the existing workspace_isolation policy already covers them — NO policy change.
8
+ -- Both nullable (null ⇒ never probed = unknown to the ranker). Additive only (mirrors 0031/0032's
9
+ -- style). Runs under the runner's advisory lock.
10
+
11
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "connector_namespaces" text[];
12
+ ALTER TABLE "codex_subscription_credentials" ADD COLUMN IF NOT EXISTS "connectors_checked_at" timestamptz;
13
+
14
+ -- Re-grant (verbatim from 0031/0032) so opengeni_app keeps DML on the altered table.
15
+ DO $$
16
+ BEGIN
17
+ IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'opengeni_app') THEN
18
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO opengeni_app;
19
+ END IF;
20
+ END $$;
@@ -0,0 +1,21 @@
1
+ -- 0034_sandbox_lease_image.sql
2
+ -- IMAGE IS SHARED STATE (B3): stamp the container image the group box runs on the lease.
3
+ -- A shared box (sandbox:{groupId} / the default SHARE placement) is ONE filesystem across
4
+ -- N sessions, so every session that attaches must run the SAME image. This column records
5
+ -- the image the live box was created with; a resume whose resolved image DIFFERS is a
6
+ -- conflict — a SOLO holder recreates the box on the new image (force cold + re-stamp),
7
+ -- N-holders are rejected at the lease layer (SandboxImageConflictError). Nullable (a
8
+ -- legacy/cold row reads NULL = "image unknown", which never conflicts) — additive only,
9
+ -- forward-only, no backfill. Mirrors 0022's re-grant boilerplate. Runs under the runner's
10
+ -- advisory lock.
11
+
12
+ ALTER TABLE "sandbox_leases" ADD COLUMN IF NOT EXISTS "image" text;
13
+
14
+ -- Re-grant on the new column (idempotent; mirrors the boilerplate in 0018/0022 so a
15
+ -- fresh opengeni_app role can read/write the added column).
16
+ DO $$
17
+ BEGIN
18
+ IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'opengeni_app') THEN
19
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO opengeni_app;
20
+ END IF;
21
+ END $$;
@@ -0,0 +1,167 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1765000000000,
9
+ "tag": "0000_initial",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1781136000000,
16
+ "tag": "0001_workspace_auth_billing",
17
+ "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1781200000000,
23
+ "tag": "0002_packs_and_social",
24
+ "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "7",
29
+ "when": 1781200600000,
30
+ "tag": "0003_capability_catalog",
31
+ "breakpoints": true
32
+ },
33
+ {
34
+ "idx": 4,
35
+ "version": "7",
36
+ "when": 1781201200000,
37
+ "tag": "0004_workspace_environments",
38
+ "breakpoints": true
39
+ },
40
+ {
41
+ "idx": 5,
42
+ "version": "7",
43
+ "when": 1781201800000,
44
+ "tag": "0005_session_goals",
45
+ "breakpoints": true
46
+ },
47
+ {
48
+ "idx": 6,
49
+ "version": "7",
50
+ "when": 1781481600000,
51
+ "tag": "0006_workspace_packs",
52
+ "breakpoints": true
53
+ },
54
+ {
55
+ "idx": 7,
56
+ "version": "7",
57
+ "when": 1781568000000,
58
+ "tag": "0007_session_history_items",
59
+ "breakpoints": true
60
+ },
61
+ {
62
+ "idx": 8,
63
+ "version": "7",
64
+ "when": 1781654400000,
65
+ "tag": "0008_session_first_party_mcp_permissions",
66
+ "breakpoints": true
67
+ },
68
+ {
69
+ "idx": 9,
70
+ "version": "7",
71
+ "when": 1781740800000,
72
+ "tag": "0009_goal_sessions_first_party_goals_manage",
73
+ "breakpoints": true
74
+ },
75
+ {
76
+ "idx": 10,
77
+ "version": "7",
78
+ "when": 1781827200000,
79
+ "tag": "0010_session_parent_linkage",
80
+ "breakpoints": true
81
+ },
82
+ {
83
+ "idx": 11,
84
+ "version": "7",
85
+ "when": 1781913600000,
86
+ "tag": "0011_context_compaction",
87
+ "breakpoints": true
88
+ },
89
+ {
90
+ "idx": 12,
91
+ "version": "7",
92
+ "when": 1782000000000,
93
+ "tag": "0012_compaction_summary_fractional_position",
94
+ "breakpoints": true
95
+ },
96
+ {
97
+ "idx": 13,
98
+ "version": "7",
99
+ "when": 1782086400000,
100
+ "tag": "0013_session_compact_requested",
101
+ "breakpoints": true
102
+ },
103
+ {
104
+ "idx": 14,
105
+ "version": "7",
106
+ "when": 1782172800000,
107
+ "tag": "0014_repair_orphaned_function_call_results",
108
+ "breakpoints": true
109
+ },
110
+ {
111
+ "idx": 15,
112
+ "version": "7",
113
+ "when": 1782259200000,
114
+ "tag": "0015_workspace_agent_instructions",
115
+ "breakpoints": true
116
+ },
117
+ {
118
+ "idx": 16,
119
+ "version": "7",
120
+ "when": 1782345600000,
121
+ "tag": "0016_session_create_idempotency",
122
+ "breakpoints": true
123
+ },
124
+ {
125
+ "idx": 17,
126
+ "version": "7",
127
+ "when": 1782432000000,
128
+ "tag": "0017_sandbox_leases",
129
+ "breakpoints": true
130
+ },
131
+ {
132
+ "idx": 18,
133
+ "version": "7",
134
+ "when": 1782518400000,
135
+ "tag": "0018_sandbox_os",
136
+ "breakpoints": true
137
+ },
138
+ {
139
+ "idx": 19,
140
+ "version": "7",
141
+ "when": 1782604800000,
142
+ "tag": "0019_session_stream_acknowledgments",
143
+ "breakpoints": true
144
+ },
145
+ {
146
+ "idx": 20,
147
+ "version": "7",
148
+ "when": 1782691200000,
149
+ "tag": "0020_session_recordings",
150
+ "breakpoints": true
151
+ },
152
+ {
153
+ "idx": 21,
154
+ "version": "7",
155
+ "when": 1782777600000,
156
+ "tag": "0021_sandbox_pty_sessions",
157
+ "breakpoints": true
158
+ },
159
+ {
160
+ "idx": 22,
161
+ "version": "7",
162
+ "when": 1782864000000,
163
+ "tag": "0022_sandbox_lease_terminal_url",
164
+ "breakpoints": true
165
+ }
166
+ ]
167
+ }
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@opengeni/db",
3
+ "version": "0.2.0",
4
+ "description": "OpenGeni persistence: Drizzle schema, RLS-scoped query layer, the SQL migration runner, and role provisioning.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Cloudgeni-ai/opengeni.git",
9
+ "directory": "packages/db"
10
+ },
11
+ "type": "module",
12
+ "sideEffects": false,
13
+ "main": "./dist/index.js",
14
+ "module": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ },
21
+ "./schema": {
22
+ "types": "./dist/schema.d.ts",
23
+ "import": "./dist/schema.js"
24
+ },
25
+ "./migrate": {
26
+ "types": "./dist/migrate.d.ts",
27
+ "import": "./dist/migrate.js"
28
+ },
29
+ "./provision-roles": {
30
+ "types": "./dist/provision-roles.d.ts",
31
+ "import": "./dist/provision-roles.js"
32
+ }
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "src",
37
+ "drizzle"
38
+ ],
39
+ "engines": {
40
+ "node": ">=18"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "provenance": true
45
+ },
46
+ "scripts": {
47
+ "generate": "drizzle-kit generate",
48
+ "migrate": "bun src/migrate.ts",
49
+ "provision-roles": "bun src/provision-roles.ts",
50
+ "typecheck": "tsc --noEmit",
51
+ "build": "tsup"
52
+ },
53
+ "dependencies": {
54
+ "@opengeni/codex": "^0.2.0",
55
+ "@opengeni/config": "^0.2.0",
56
+ "@opengeni/contracts": "^0.3.0",
57
+ "drizzle-orm": "^0.45.2",
58
+ "postgres": "^3.4.7"
59
+ },
60
+ "devDependencies": {
61
+ "@opengeni/testing": "workspace:*",
62
+ "drizzle-kit": "^0.31.8",
63
+ "tsup": "^8.5.0",
64
+ "typescript": "^6.0.3"
65
+ }
66
+ }