@opengeni/db 4.2.2 → 4.3.2-canary.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/canonical-human-identities.js +3 -3
- package/dist/{chunk-S4Y42VSX.js → chunk-AI4NC6XW.js} +212 -7
- package/dist/chunk-AI4NC6XW.js.map +1 -0
- package/dist/{chunk-SNLIKELL.js → chunk-DVSLOUEI.js} +2 -2
- package/dist/{chunk-6GAPAYZR.js → chunk-F4BIHJ7J.js} +562 -86
- package/dist/chunk-F4BIHJ7J.js.map +1 -0
- package/dist/{chunk-B2KR3TEM.js → chunk-I4ITNMX2.js} +2 -2
- package/dist/{chunk-MGVOYVPS.js → chunk-PFBUHOI5.js} +3 -3
- package/dist/{chunk-6Y7ZDVJ5.js → chunk-UUPY6IGP.js} +2 -2
- package/dist/{chunk-FPTI4NP4.js → chunk-UVBPOGA7.js} +2 -2
- package/dist/{chunk-7WX3R3YL.js → chunk-XBXANJQS.js} +7 -2
- package/dist/chunk-XBXANJQS.js.map +1 -0
- package/dist/{chunk-6IQ4X35Y.js → chunk-YVYBAWBU.js} +46 -1
- package/dist/chunk-YVYBAWBU.js.map +1 -0
- package/dist/connect-attempts.d.ts +60 -0
- package/dist/connection-setup-authority.d.ts +10 -0
- package/dist/connection-token-resolver.d.ts +11 -2
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/external-identities.d.ts +16 -0
- package/dist/external-identity-links.d.ts +74 -0
- package/dist/external-link-work.d.ts +51 -0
- package/dist/host-mcp-binding-match.d.ts +5 -0
- package/dist/host-mcp-bindings.d.ts +73 -0
- package/dist/host-mcp-task-authority.d.ts +47 -0
- package/dist/host-selection-identity.d.ts +6 -0
- package/dist/index.d.ts +60 -35
- package/dist/index.js +15247 -13793
- package/dist/index.js.map +1 -1
- package/dist/live-session-attempt.d.ts +275 -0
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/memory-domain.d.ts +3 -3
- package/dist/provision-roles.js +1 -1
- package/dist/retained-provider-commands.js +2 -2
- package/dist/runtime-posture.d.ts +6 -6
- package/dist/scheduled-task-revision-authority.d.ts +11 -0
- package/dist/schema.d.ts +1279 -9
- package/dist/schema.js +11 -1
- package/dist/session-background-commands.js +4 -4
- package/dist/session-command-output.js +4 -4
- package/dist/session-event-slices.js +2 -2
- package/dist/session-queue-commands.d.ts +7 -0
- package/dist/session-tenancy.d.ts +2 -0
- package/dist/session-tenancy.js +3 -3
- package/dist/video-generation.js +3 -3
- package/dist/workspace-authority.d.ts +4 -4
- package/dist/workspace-tool-defaults.js +4 -4
- package/drizzle/0437_organization_scoped_external_workspaces.sql +71 -0
- package/drizzle/0438_durable_connect_attempts.sql +95 -0
- package/drizzle/0439_external_identity_provisioning.sql +128 -0
- package/drizzle/0440_external_workspace_member_removal.sql +59 -0
- package/drizzle/0441_external_identity_membership_lifecycle.sql +163 -0
- package/drizzle/0442_external_owning_user_authority.sql +81 -0
- package/drizzle/0443_host_mcp_binding_registry.sql +93 -0
- package/drizzle/0444_host_mcp_delegations.sql +129 -0
- package/drizzle/0445_host_mcp_turn_authorities.sql +145 -0
- package/drizzle/0446_host_mcp_causal_continuation.sql +126 -0
- package/drizzle/0447_host_mcp_task_authorities.sql +264 -0
- package/drizzle/0448_host_mcp_child_authority.sql +115 -0
- package/drizzle/0449_external_identity_link_lifecycle.sql +107 -0
- package/drizzle/0450_external_identity_link_work.sql +179 -0
- package/drizzle/0451_external_link_preview_and_permission_ceiling.sql +82 -0
- package/drizzle/0452_external_link_scheduled_origin.sql +34 -0
- package/drizzle/0453_host_mcp_native_owner.sql +35 -0
- package/drizzle/0454_connect_origin_authority.sql +42 -0
- package/drizzle/0455_external_link_inventory_labels.sql +44 -0
- package/drizzle/0456_social_connection_versions.sql +14 -0
- package/drizzle/0457_canonical_session_scope_subject.sql +46 -0
- package/drizzle/0458_skill_review_wire_compatibility.sql +36 -0
- package/package.json +6 -6
- package/src/connect-attempts.ts +317 -0
- package/src/connection-authority.ts +9 -0
- package/src/connection-setup-authority.ts +35 -0
- package/src/connection-token-resolver.ts +177 -48
- package/src/external-identities.ts +70 -0
- package/src/external-identity-links.ts +364 -0
- package/src/external-link-work.ts +228 -0
- package/src/host-mcp-binding-match.ts +33 -0
- package/src/host-mcp-bindings.ts +741 -0
- package/src/host-mcp-task-authority.ts +383 -0
- package/src/host-selection-identity.ts +29 -0
- package/src/index.ts +481 -151
- package/src/live-session-attempt.ts +85 -0
- package/src/managed-human-provisioning.ts +6 -1
- package/src/memory-domain.ts +6 -11
- package/src/provision-roles.ts +3 -0
- package/src/runtime-posture.ts +47 -0
- package/src/scheduled-task-revision-authority.ts +30 -0
- package/src/schema.ts +233 -7
- package/src/session-control.ts +14 -0
- package/src/session-queue-commands.ts +11 -0
- package/src/session-tenancy.ts +7 -0
- package/src/workspace-artifacts.ts +10 -4
- package/src/workspace-authority.ts +5 -5
- package/dist/chunk-6GAPAYZR.js.map +0 -1
- package/dist/chunk-6IQ4X35Y.js.map +0 -1
- package/dist/chunk-7WX3R3YL.js.map +0 -1
- package/dist/chunk-S4Y42VSX.js.map +0 -1
- /package/dist/{chunk-SNLIKELL.js.map → chunk-DVSLOUEI.js.map} +0 -0
- /package/dist/{chunk-B2KR3TEM.js.map → chunk-I4ITNMX2.js.map} +0 -0
- /package/dist/{chunk-MGVOYVPS.js.map → chunk-PFBUHOI5.js.map} +0 -0
- /package/dist/{chunk-6Y7ZDVJ5.js.map → chunk-UUPY6IGP.js.map} +0 -0
- /package/dist/{chunk-FPTI4NP4.js.map → chunk-UVBPOGA7.js.map} +0 -0
package/src/session-tenancy.ts
CHANGED
|
@@ -95,6 +95,7 @@ export type TransitionSessionVisibilityInput = {
|
|
|
95
95
|
targetVisibility: SessionTenancyVisibility;
|
|
96
96
|
expectedAuthorityEpoch: number;
|
|
97
97
|
operationKey: string;
|
|
98
|
+
beforeCommit?: (tx: Database) => Promise<void>;
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
export type TransitionSessionVisibilityResult = {
|
|
@@ -124,6 +125,7 @@ export type ForkSessionContentInput = {
|
|
|
124
125
|
operationKey: string;
|
|
125
126
|
runtimeRequest?: ForkSessionRuntimeRequest;
|
|
126
127
|
runtimeConfiguration?: ForkSessionRuntimeConfiguration;
|
|
128
|
+
beforeCommit?: (tx: Database) => Promise<void>;
|
|
127
129
|
};
|
|
128
130
|
|
|
129
131
|
export type ForkSessionRuntimeRequest = {
|
|
@@ -469,6 +471,7 @@ export async function transitionSessionVisibility(
|
|
|
469
471
|
);
|
|
470
472
|
const result = rows[0];
|
|
471
473
|
if (!result) throw new Error("Session visibility transition returned no result");
|
|
474
|
+
await input.beforeCommit?.(scopedDb);
|
|
472
475
|
return result;
|
|
473
476
|
},
|
|
474
477
|
undefined,
|
|
@@ -545,6 +548,7 @@ export async function forkSessionContent(
|
|
|
545
548
|
);
|
|
546
549
|
const result = rows[0];
|
|
547
550
|
if (!result) throw new Error("Session fork returned no result");
|
|
551
|
+
await input.beforeCommit?.(scopedDb);
|
|
548
552
|
return result;
|
|
549
553
|
}
|
|
550
554
|
const rows = await rawRows<ForkSessionContentResult>(
|
|
@@ -577,6 +581,7 @@ export async function forkSessionContent(
|
|
|
577
581
|
);
|
|
578
582
|
const result = rows[0];
|
|
579
583
|
if (!result) throw new Error("Session fork returned no result");
|
|
584
|
+
await input.beforeCommit?.(scopedDb);
|
|
580
585
|
return result;
|
|
581
586
|
},
|
|
582
587
|
undefined,
|
|
@@ -649,6 +654,7 @@ export async function replayAppliedSessionFork(
|
|
|
649
654
|
${runtimeDigest}
|
|
650
655
|
)`,
|
|
651
656
|
);
|
|
657
|
+
await input.beforeCommit?.(scopedDb);
|
|
652
658
|
return rows[0] ?? null;
|
|
653
659
|
}
|
|
654
660
|
const rows = await rawRows<ForkSessionContentResult>(
|
|
@@ -678,6 +684,7 @@ export async function replayAppliedSessionFork(
|
|
|
678
684
|
${SESSION_TENANCY_ACTIVATION_VERSION}
|
|
679
685
|
)`,
|
|
680
686
|
);
|
|
687
|
+
await input.beforeCommit?.(scopedDb);
|
|
681
688
|
return rows[0] ?? null;
|
|
682
689
|
},
|
|
683
690
|
);
|
|
@@ -538,7 +538,11 @@ async function assertAttemptAuthority(
|
|
|
538
538
|
FOR NO KEY UPDATE OF session
|
|
539
539
|
), locked_turn AS MATERIALIZED (
|
|
540
540
|
SELECT turn.id, turn.account_id, turn.workspace_id, turn.session_id,
|
|
541
|
-
turn.active_attempt_id, turn.execution_generation,
|
|
541
|
+
turn.active_attempt_id, turn.execution_generation,
|
|
542
|
+
coalesce(
|
|
543
|
+
turn.initiating_human_subject_id,
|
|
544
|
+
case when turn.initiator_kind = 'subject' then turn.initiator_subject_id end
|
|
545
|
+
) as initiating_human_subject_id
|
|
542
546
|
FROM session_turns turn
|
|
543
547
|
JOIN locked_session session
|
|
544
548
|
ON session.id = turn.session_id
|
|
@@ -548,8 +552,10 @@ async function assertAttemptAuthority(
|
|
|
548
552
|
AND turn.active_attempt_id = ${input.sourceAttemptId}::uuid
|
|
549
553
|
AND turn.execution_generation = ${input.sourceExecutionGeneration}
|
|
550
554
|
AND turn.status IN ('running', 'requires_action', 'recovering', 'waiting_capacity')
|
|
551
|
-
AND
|
|
552
|
-
|
|
555
|
+
AND length(btrim(coalesce(
|
|
556
|
+
turn.initiating_human_subject_id,
|
|
557
|
+
case when turn.initiator_kind = 'subject' then turn.initiator_subject_id end
|
|
558
|
+
))) BETWEEN 1 AND 1024
|
|
553
559
|
FOR UPDATE OF turn
|
|
554
560
|
), locked_attempt AS MATERIALIZED (
|
|
555
561
|
SELECT attempt.id, attempt.account_id, attempt.workspace_id,
|
|
@@ -578,7 +584,7 @@ async function assertAttemptAuthority(
|
|
|
578
584
|
`)) as unknown as Array<{ id: string }>;
|
|
579
585
|
if (!rows[0]) {
|
|
580
586
|
throw new WorkspaceArtifactOperationError(
|
|
581
|
-
"Artifact mutation requires the exact active attempt and
|
|
587
|
+
"Artifact mutation requires the exact active attempt, execution generation, and immutable human authority",
|
|
582
588
|
);
|
|
583
589
|
}
|
|
584
590
|
}
|
|
@@ -54,10 +54,10 @@ import { rawRows, type Database } from "./database";
|
|
|
54
54
|
* adding a caller, that stamp is the part you have to get right; this function
|
|
55
55
|
* will happily answer `true` for any subject you scope a transaction to.
|
|
56
56
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
57
|
+
* Persisted `external_user:` subjects also have an organization membership and
|
|
58
|
+
* an exact Personal pointer. They use the same consistency check only after the
|
|
59
|
+
* API's dedicated verified external proof, never a native-cookie stamp. Other
|
|
60
|
+
* service/configured/local subjects retain the plain membership answer.
|
|
61
61
|
*/
|
|
62
62
|
export async function subjectHasLiveWorkspaceAuthorityInScope(
|
|
63
63
|
scopedDb: Database,
|
|
@@ -83,7 +83,7 @@ export async function subjectHasLiveWorkspaceAuthorityInScope(
|
|
|
83
83
|
and workspace_id = ${input.workspaceId}
|
|
84
84
|
limit 1`,
|
|
85
85
|
);
|
|
86
|
-
if (!input.subjectId.startsWith("user:")) {
|
|
86
|
+
if (!input.subjectId.startsWith("user:") && !input.subjectId.startsWith("external_user:")) {
|
|
87
87
|
return Boolean(membershipRow);
|
|
88
88
|
}
|
|
89
89
|
const [organizationMembershipResult] = await rawRows<{ result: unknown }>(
|