@opengeni/db 0.31.1 → 0.36.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/browser-auth.d.ts +209 -1
- package/dist/browser-downloads.d.ts +51 -0
- package/dist/browser-identities.d.ts +11 -2
- package/dist/browser-sessions.d.ts +83 -1
- package/dist/browser-state-artifacts.d.ts +75 -1
- package/dist/canonical-human-identities.d.ts +48 -0
- package/dist/canonical-human-identities.js +28 -0
- package/dist/canonical-human-identities.js.map +1 -0
- package/dist/capability-integrations.d.ts +8 -6
- package/dist/{chunk-MWDVXQOL.js → chunk-5KTIEDX7.js} +5773 -4212
- package/dist/chunk-5KTIEDX7.js.map +1 -0
- package/dist/chunk-FPVAD4CO.js +117 -0
- package/dist/chunk-FPVAD4CO.js.map +1 -0
- package/dist/chunk-GYO7ED2Q.js +259 -0
- package/dist/chunk-GYO7ED2Q.js.map +1 -0
- package/dist/{chunk-F5FT7BEZ.js → chunk-HSOWSYOX.js} +2 -2
- package/dist/{chunk-YHZXQ7HP.js → chunk-VKLB2ZGI.js} +446 -19
- package/dist/chunk-VKLB2ZGI.js.map +1 -0
- package/dist/{chunk-NBE6CHRI.js → chunk-VTPRIXKG.js} +49 -9
- package/dist/chunk-VTPRIXKG.js.map +1 -0
- package/dist/{chunk-ISI2TIUG.js → chunk-Z7VYMNPZ.js} +76 -4
- package/dist/chunk-Z7VYMNPZ.js.map +1 -0
- package/dist/database.d.ts +5 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/index.d.ts +467 -29
- package/dist/index.js +23247 -16232
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +23 -7
- package/dist/integration-bindings.d.ts +24 -24
- package/dist/integration-facets.d.ts +99 -0
- package/dist/interaction-revisions.d.ts +11 -0
- package/dist/interaction-schema.d.ts +698 -34
- package/dist/persistence-errors.d.ts +8 -0
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +8 -7
- package/dist/schema.d.ts +9464 -5412
- package/dist/schema.js +51 -9
- package/dist/session-control.d.ts +29 -3
- package/dist/session-tenancy.d.ts +44 -0
- package/dist/session-tenancy.js +16 -0
- package/dist/session-tenancy.js.map +1 -0
- package/dist/slack-task-policy-schema.d.ts +847 -0
- package/dist/slack-task-policy.d.ts +65 -0
- package/dist/task-notes-schema.d.ts +924 -0
- package/dist/task-notes.d.ts +85 -0
- package/dist/video-generation.d.ts +9 -0
- package/dist/video-generation.js +5 -3
- package/dist/xai-subscription.d.ts +326 -0
- package/drizzle/0212_browser_state_transfer_hardening.sql +560 -0
- package/drizzle/0213_browser_interaction_authority.sql +67 -0
- package/drizzle/0214_browser_download_saves.sql +34 -0
- package/drizzle/0215_browser_controller_host.sql +385 -0
- package/drizzle/0216_browser_auth_health_evidence.sql +137 -0
- package/drizzle/0217_external_browser_auth_operations.sql +22 -0
- package/drizzle/0218_organization_tenancy_foundation.sql +299 -0
- package/drizzle/0219_organization_tenancy_managed_human_provisioning.sql +317 -0
- package/drizzle/0219_site_auth_maintenance_sessions.sql +234 -0
- package/drizzle/0220_memory_slack_append_only_cascade.sql +38 -0
- package/drizzle/0220_session_channels.sql +54 -0
- package/drizzle/0221_sessions_channel_index.sql +5 -0
- package/drizzle/0222_session_visibility_authority_epochs.sql +158 -0
- package/drizzle/0222_sessions_channel_fk.sql +89 -0
- package/drizzle/0223_pending_tool_event_output.sql +55 -0
- package/drizzle/0223_sessions_channel_fk_validate.sql +118 -0
- package/drizzle/0224_slack_post_outcome_reconciliation.sql +123 -0
- package/drizzle/0225_session_visibility_fork_activation.sql +1363 -0
- package/drizzle/0226_personal_codex_authority_foundation.sql +365 -0
- package/drizzle/0227_slack_native_actions.sql +145 -0
- package/drizzle/0228_interaction_controller_data_plane.sql +14 -0
- package/drizzle/0228_slack_task_policy.sql +400 -0
- package/drizzle/0229_slack_inbox_file_fact.sql +10 -0
- package/drizzle/0230_user_scoped_variable_sets_rigs.sql +84 -0
- package/drizzle/0231_integration_definition_identity_cutover.sql +271 -0
- package/drizzle/0232_integration_facet_authority_cutover.sql +610 -0
- package/drizzle/0233_skill_and_integration_authority_cutover.sql +1162 -0
- package/drizzle/0234_xai_subscription_authority.sql +1139 -0
- package/drizzle/0235_canonical_human_login_bindings.sql +920 -0
- package/drizzle/0236_browser_identity_lifecycle.sql +39 -0
- package/drizzle/0236_session_visibility_slack_policy.sql +72 -0
- package/drizzle/0237_interaction_transition_reaper.sql +263 -0
- package/drizzle/0238_goal_persistence_policy.sql +471 -0
- package/drizzle/0238_recover_unclaimed_session_turns.sql +307 -0
- package/drizzle/0238_supergrok_realtime_model.sql +29 -0
- package/drizzle/0239_supergrok_video_funding.sql +50 -0
- package/drizzle/0239_task_tree_notes.sql +990 -0
- package/package.json +13 -5
- package/src/browser-auth.ts +2600 -123
- package/src/browser-downloads.ts +517 -0
- package/src/browser-identities.ts +220 -3
- package/src/browser-sessions.ts +334 -45
- package/src/browser-state-artifacts.ts +402 -12
- package/src/canonical-human-identities.ts +317 -0
- package/src/capability-integrations.ts +121 -213
- package/src/database.ts +41 -1
- package/src/index.ts +4625 -411
- package/src/insights.ts +109 -28
- package/src/integration-bindings.ts +101 -101
- package/src/{integration-features.ts → integration-facets.ts} +187 -184
- package/src/interaction-revisions.ts +33 -3
- package/src/interaction-schema.ts +311 -8
- package/src/pack-components.ts +43 -43
- package/src/pack-installations.ts +0 -43
- package/src/persistence-errors.ts +60 -1
- package/src/plugin-packages.ts +9 -9
- package/src/provision-roles.ts +232 -0
- package/src/runtime-posture.ts +227 -14
- package/src/schema.ts +1188 -75
- package/src/session-control.ts +122 -37
- package/src/session-queue-commands.ts +78 -1
- package/src/session-tenancy.ts +188 -0
- package/src/session-tool-call-settlement.ts +9 -3
- package/src/slack-task-policy-schema.ts +130 -0
- package/src/slack-task-policy.ts +341 -0
- package/src/task-notes-schema.ts +135 -0
- package/src/task-notes.ts +178 -0
- package/src/video-generation.ts +90 -12
- package/src/workspace-artifacts.ts +1 -1
- package/src/xai-subscription.ts +1887 -0
- package/dist/chunk-ISI2TIUG.js.map +0 -1
- package/dist/chunk-MWDVXQOL.js.map +0 -1
- package/dist/chunk-NBE6CHRI.js.map +0 -1
- package/dist/chunk-YHZXQ7HP.js.map +0 -1
- package/dist/integration-features.d.ts +0 -99
- /package/dist/{chunk-F5FT7BEZ.js.map → chunk-HSOWSYOX.js.map} +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
-- deployment-mode: rolling
|
|
2
|
+
-- Validate only the staged NOT VALID constraint. PostgreSQL performs this scan
|
|
3
|
+
-- with SHARE UPDATE EXCLUSIVE rather than retaining the column-addition
|
|
4
|
+
-- transaction's ACCESS EXCLUSIVE lock across the populated sessions table.
|
|
5
|
+
SET LOCAL lock_timeout = '5s';
|
|
6
|
+
SET LOCAL statement_timeout = '10min';
|
|
7
|
+
|
|
8
|
+
DO $migration$
|
|
9
|
+
DECLARE
|
|
10
|
+
same_name_count integer;
|
|
11
|
+
exact_count integer;
|
|
12
|
+
validated_exact_count integer;
|
|
13
|
+
constraint_name text;
|
|
14
|
+
constraint_validated boolean;
|
|
15
|
+
BEGIN
|
|
16
|
+
SELECT count(*)::integer
|
|
17
|
+
INTO same_name_count
|
|
18
|
+
FROM pg_catalog.pg_constraint AS constraint_row
|
|
19
|
+
WHERE constraint_row.conrelid = 'sessions'::regclass
|
|
20
|
+
AND constraint_row.conname IN ('sessions_channel_id_fk', 'sessions_channel_id_fkey');
|
|
21
|
+
|
|
22
|
+
SELECT count(*)::integer
|
|
23
|
+
INTO exact_count
|
|
24
|
+
FROM pg_catalog.pg_constraint AS constraint_row
|
|
25
|
+
JOIN pg_catalog.pg_attribute AS local_column
|
|
26
|
+
ON local_column.attrelid = constraint_row.conrelid
|
|
27
|
+
AND local_column.attnum = constraint_row.conkey[1]
|
|
28
|
+
JOIN pg_catalog.pg_attribute AS referenced_column
|
|
29
|
+
ON referenced_column.attrelid = constraint_row.confrelid
|
|
30
|
+
AND referenced_column.attnum = constraint_row.confkey[1]
|
|
31
|
+
WHERE constraint_row.conrelid = 'sessions'::regclass
|
|
32
|
+
AND constraint_row.confrelid = 'channels'::regclass
|
|
33
|
+
AND constraint_row.contype = 'f'
|
|
34
|
+
AND constraint_row.conname IN ('sessions_channel_id_fk', 'sessions_channel_id_fkey')
|
|
35
|
+
AND cardinality(constraint_row.conkey) = 1
|
|
36
|
+
AND cardinality(constraint_row.confkey) = 1
|
|
37
|
+
AND local_column.attname = 'channel_id'
|
|
38
|
+
AND referenced_column.attname = 'id'
|
|
39
|
+
AND constraint_row.confdeltype = 'n'
|
|
40
|
+
AND constraint_row.confupdtype = 'a'
|
|
41
|
+
AND constraint_row.confmatchtype = 's'
|
|
42
|
+
AND NOT constraint_row.condeferrable
|
|
43
|
+
AND NOT constraint_row.condeferred;
|
|
44
|
+
|
|
45
|
+
IF same_name_count <> exact_count OR exact_count <> 1 THEN
|
|
46
|
+
RAISE EXCEPTION
|
|
47
|
+
'expected exactly one compatible sessions channel foreign key, found % compatible among % named constraints',
|
|
48
|
+
exact_count,
|
|
49
|
+
same_name_count;
|
|
50
|
+
END IF;
|
|
51
|
+
|
|
52
|
+
SELECT constraint_row.conname, constraint_row.convalidated
|
|
53
|
+
INTO constraint_name, constraint_validated
|
|
54
|
+
FROM pg_catalog.pg_constraint AS constraint_row
|
|
55
|
+
JOIN pg_catalog.pg_attribute AS local_column
|
|
56
|
+
ON local_column.attrelid = constraint_row.conrelid
|
|
57
|
+
AND local_column.attnum = constraint_row.conkey[1]
|
|
58
|
+
JOIN pg_catalog.pg_attribute AS referenced_column
|
|
59
|
+
ON referenced_column.attrelid = constraint_row.confrelid
|
|
60
|
+
AND referenced_column.attnum = constraint_row.confkey[1]
|
|
61
|
+
WHERE constraint_row.conrelid = 'sessions'::regclass
|
|
62
|
+
AND constraint_row.confrelid = 'channels'::regclass
|
|
63
|
+
AND constraint_row.contype = 'f'
|
|
64
|
+
AND constraint_row.conname IN ('sessions_channel_id_fk', 'sessions_channel_id_fkey')
|
|
65
|
+
AND cardinality(constraint_row.conkey) = 1
|
|
66
|
+
AND cardinality(constraint_row.confkey) = 1
|
|
67
|
+
AND local_column.attname = 'channel_id'
|
|
68
|
+
AND referenced_column.attname = 'id'
|
|
69
|
+
AND constraint_row.confdeltype = 'n'
|
|
70
|
+
AND constraint_row.confupdtype = 'a'
|
|
71
|
+
AND constraint_row.confmatchtype = 's'
|
|
72
|
+
AND NOT constraint_row.condeferrable
|
|
73
|
+
AND NOT constraint_row.condeferred;
|
|
74
|
+
|
|
75
|
+
IF NOT constraint_validated THEN
|
|
76
|
+
EXECUTE format(
|
|
77
|
+
'ALTER TABLE "sessions" VALIDATE CONSTRAINT %I',
|
|
78
|
+
constraint_name
|
|
79
|
+
);
|
|
80
|
+
END IF;
|
|
81
|
+
|
|
82
|
+
SELECT
|
|
83
|
+
count(*)::integer,
|
|
84
|
+
count(*) FILTER (WHERE constraint_row.convalidated)::integer
|
|
85
|
+
INTO exact_count, validated_exact_count
|
|
86
|
+
FROM pg_catalog.pg_constraint AS constraint_row
|
|
87
|
+
JOIN pg_catalog.pg_attribute AS local_column
|
|
88
|
+
ON local_column.attrelid = constraint_row.conrelid
|
|
89
|
+
AND local_column.attnum = constraint_row.conkey[1]
|
|
90
|
+
JOIN pg_catalog.pg_attribute AS referenced_column
|
|
91
|
+
ON referenced_column.attrelid = constraint_row.confrelid
|
|
92
|
+
AND referenced_column.attnum = constraint_row.confkey[1]
|
|
93
|
+
WHERE constraint_row.conrelid = 'sessions'::regclass
|
|
94
|
+
AND constraint_row.confrelid = 'channels'::regclass
|
|
95
|
+
AND constraint_row.contype = 'f'
|
|
96
|
+
AND constraint_row.conname IN ('sessions_channel_id_fk', 'sessions_channel_id_fkey')
|
|
97
|
+
AND cardinality(constraint_row.conkey) = 1
|
|
98
|
+
AND cardinality(constraint_row.confkey) = 1
|
|
99
|
+
AND local_column.attname = 'channel_id'
|
|
100
|
+
AND referenced_column.attname = 'id'
|
|
101
|
+
AND constraint_row.confdeltype = 'n'
|
|
102
|
+
AND constraint_row.confupdtype = 'a'
|
|
103
|
+
AND constraint_row.confmatchtype = 's'
|
|
104
|
+
AND NOT constraint_row.condeferrable
|
|
105
|
+
AND NOT constraint_row.condeferred;
|
|
106
|
+
|
|
107
|
+
SELECT count(*)::integer
|
|
108
|
+
INTO same_name_count
|
|
109
|
+
FROM pg_catalog.pg_constraint AS constraint_row
|
|
110
|
+
WHERE constraint_row.conrelid = 'sessions'::regclass
|
|
111
|
+
AND constraint_row.conname IN ('sessions_channel_id_fk', 'sessions_channel_id_fkey');
|
|
112
|
+
|
|
113
|
+
IF same_name_count <> 1 OR exact_count <> 1 OR validated_exact_count <> 1 THEN
|
|
114
|
+
RAISE EXCEPTION
|
|
115
|
+
'sessions channel foreign key validation did not produce exactly one validated exact constraint';
|
|
116
|
+
END IF;
|
|
117
|
+
END
|
|
118
|
+
$migration$;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
-- deployment-mode: rolling
|
|
2
|
+
-- Slack does not guarantee that chat.postMessage retries are deduplicated by
|
|
3
|
+
-- client_msg_id. Split pre-provider admission from unknown provider outcomes,
|
|
4
|
+
-- and fence rolling old writers from reclaiming an unknown outcome for resend.
|
|
5
|
+
|
|
6
|
+
ALTER TABLE "slack_bot_post_operations"
|
|
7
|
+
ADD COLUMN IF NOT EXISTS "claim_mode" text;
|
|
8
|
+
|
|
9
|
+
CREATE OR REPLACE FUNCTION opengeni_private.fence_slack_bot_post_claim_mode()
|
|
10
|
+
RETURNS trigger
|
|
11
|
+
LANGUAGE plpgsql
|
|
12
|
+
AS $function$
|
|
13
|
+
DECLARE
|
|
14
|
+
acquires_claim boolean;
|
|
15
|
+
BEGIN
|
|
16
|
+
IF NEW."claim_holder_id" IS NULL THEN
|
|
17
|
+
NEW."claim_mode" := NULL;
|
|
18
|
+
RETURN NEW;
|
|
19
|
+
END IF;
|
|
20
|
+
|
|
21
|
+
IF TG_OP = 'INSERT' THEN
|
|
22
|
+
-- Rolling old writers insert directly at provider_started. They remain
|
|
23
|
+
-- compatible for their first attempt, but any abandoned attempt is fenced
|
|
24
|
+
-- by the UPDATE branch below.
|
|
25
|
+
IF NEW."claim_mode" IS NULL AND NEW."status" IN ('pending', 'provider_started') THEN
|
|
26
|
+
NEW."claim_mode" := 'send';
|
|
27
|
+
END IF;
|
|
28
|
+
RETURN NEW;
|
|
29
|
+
END IF;
|
|
30
|
+
|
|
31
|
+
acquires_claim :=
|
|
32
|
+
OLD."claim_holder_id" IS NULL
|
|
33
|
+
OR OLD."claim_holder_id" IS DISTINCT FROM NEW."claim_holder_id"
|
|
34
|
+
OR OLD."claim_expires_at" IS NULL
|
|
35
|
+
OR OLD."claim_expires_at" <= statement_timestamp();
|
|
36
|
+
|
|
37
|
+
IF acquires_claim AND OLD."status" IN ('provider_started', 'outcome_unknown') THEN
|
|
38
|
+
IF NEW."status" <> 'outcome_unknown' OR NEW."claim_mode" <> 'reconcile' THEN
|
|
39
|
+
RAISE EXCEPTION
|
|
40
|
+
'Slack post outcome requires reconciliation before another provider mutation'
|
|
41
|
+
USING ERRCODE = '23514';
|
|
42
|
+
END IF;
|
|
43
|
+
ELSIF acquires_claim AND OLD."status" = 'pending' AND NEW."claim_mode" IS NULL THEN
|
|
44
|
+
-- A rolling old writer may safely claim a request that never crossed the
|
|
45
|
+
-- provider-admission boundary.
|
|
46
|
+
NEW."claim_mode" := 'send';
|
|
47
|
+
END IF;
|
|
48
|
+
|
|
49
|
+
RETURN NEW;
|
|
50
|
+
END;
|
|
51
|
+
$function$;
|
|
52
|
+
|
|
53
|
+
REVOKE ALL ON FUNCTION opengeni_private.fence_slack_bot_post_claim_mode() FROM PUBLIC;
|
|
54
|
+
|
|
55
|
+
DROP TRIGGER IF EXISTS slack_bot_post_operations_claim_mode_fence
|
|
56
|
+
ON "slack_bot_post_operations";
|
|
57
|
+
CREATE TRIGGER slack_bot_post_operations_claim_mode_fence
|
|
58
|
+
BEFORE INSERT OR UPDATE ON "slack_bot_post_operations"
|
|
59
|
+
FOR EACH ROW
|
|
60
|
+
EXECUTE FUNCTION opengeni_private.fence_slack_bot_post_claim_mode();
|
|
61
|
+
|
|
62
|
+
UPDATE "slack_bot_post_operations"
|
|
63
|
+
SET "claim_mode" = 'send'
|
|
64
|
+
WHERE "claim_holder_id" IS NOT NULL
|
|
65
|
+
AND "claim_mode" IS NULL
|
|
66
|
+
AND "status" = 'provider_started';
|
|
67
|
+
|
|
68
|
+
ALTER TABLE "slack_bot_post_operations"
|
|
69
|
+
DROP CONSTRAINT IF EXISTS "slack_bot_post_operations_status_check",
|
|
70
|
+
DROP CONSTRAINT IF EXISTS "slack_bot_post_operations_identity_check",
|
|
71
|
+
DROP CONSTRAINT IF EXISTS "slack_bot_post_operations_completion_check";
|
|
72
|
+
|
|
73
|
+
ALTER TABLE "slack_bot_post_operations"
|
|
74
|
+
ADD CONSTRAINT "slack_bot_post_operations_status_check"
|
|
75
|
+
CHECK ("status" IN ('pending', 'provider_started', 'outcome_unknown', 'completed'))
|
|
76
|
+
NOT VALID,
|
|
77
|
+
ADD CONSTRAINT "slack_bot_post_operations_identity_check"
|
|
78
|
+
CHECK (
|
|
79
|
+
"client_message_id" = "operation_id"
|
|
80
|
+
AND length("target_id") BETWEEN 1 AND 64
|
|
81
|
+
AND "request_digest" ~ '^[0-9a-f]{64}$'
|
|
82
|
+
AND "attempt_count" > 0
|
|
83
|
+
AND (
|
|
84
|
+
(
|
|
85
|
+
"claim_holder_id" IS NULL
|
|
86
|
+
AND "claim_expires_at" IS NULL
|
|
87
|
+
AND "claim_mode" IS NULL
|
|
88
|
+
)
|
|
89
|
+
OR (
|
|
90
|
+
"claim_holder_id" IS NOT NULL
|
|
91
|
+
AND "claim_expires_at" IS NOT NULL
|
|
92
|
+
AND (
|
|
93
|
+
("claim_mode" = 'send' AND "status" IN ('pending', 'provider_started'))
|
|
94
|
+
OR ("claim_mode" = 'reconcile' AND "status" = 'outcome_unknown')
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
) NOT VALID,
|
|
99
|
+
ADD CONSTRAINT "slack_bot_post_operations_completion_check"
|
|
100
|
+
CHECK (
|
|
101
|
+
(
|
|
102
|
+
"status" <> 'completed'
|
|
103
|
+
AND "slack_channel_id" IS NULL
|
|
104
|
+
AND "slack_message_timestamp" IS NULL
|
|
105
|
+
AND "completed_at" IS NULL
|
|
106
|
+
)
|
|
107
|
+
OR (
|
|
108
|
+
"status" = 'completed'
|
|
109
|
+
AND "claim_holder_id" IS NULL
|
|
110
|
+
AND "claim_expires_at" IS NULL
|
|
111
|
+
AND "claim_mode" IS NULL
|
|
112
|
+
AND "slack_channel_id" IS NOT NULL
|
|
113
|
+
AND "slack_message_timestamp" IS NOT NULL
|
|
114
|
+
AND "completed_at" IS NOT NULL
|
|
115
|
+
)
|
|
116
|
+
) NOT VALID;
|
|
117
|
+
|
|
118
|
+
ALTER TABLE "slack_bot_post_operations"
|
|
119
|
+
VALIDATE CONSTRAINT "slack_bot_post_operations_status_check";
|
|
120
|
+
ALTER TABLE "slack_bot_post_operations"
|
|
121
|
+
VALIDATE CONSTRAINT "slack_bot_post_operations_identity_check";
|
|
122
|
+
ALTER TABLE "slack_bot_post_operations"
|
|
123
|
+
VALIDATE CONSTRAINT "slack_bot_post_operations_completion_check";
|