@opengeni/db 4.3.2 → 4.3.3-canary.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/canonical-human-identities.js +3 -3
- package/dist/{chunk-UVBPOGA7.js → chunk-232VC2LW.js} +2 -2
- package/dist/{chunk-DVSLOUEI.js → chunk-2ZMTQVTR.js} +2 -2
- package/dist/{chunk-AI4NC6XW.js → chunk-6TKL3GQO.js} +47 -1
- package/dist/chunk-6TKL3GQO.js.map +1 -0
- package/dist/{chunk-F4BIHJ7J.js → chunk-EYF6MH6C.js} +4 -4
- package/dist/{chunk-I4ITNMX2.js → chunk-GVZJ7XSR.js} +16 -4
- package/dist/{chunk-I4ITNMX2.js.map → chunk-GVZJ7XSR.js.map} +1 -1
- package/dist/{chunk-XBXANJQS.js → chunk-M7PSMVFF.js} +2 -2
- package/dist/{chunk-PFBUHOI5.js → chunk-QLA3UQNX.js} +3 -3
- package/dist/{chunk-YVYBAWBU.js → chunk-THJGMEK5.js} +53 -1
- package/dist/chunk-THJGMEK5.js.map +1 -0
- package/dist/{chunk-UUPY6IGP.js → chunk-UK57QA2H.js} +2 -2
- package/dist/codex-selection-diagnostics.d.ts +12 -0
- package/dist/connection-token-resolver.d.ts +2 -0
- package/dist/database.d.ts +7 -2
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/host-mcp-bindings.d.ts +3 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +345 -75
- package/dist/index.js.map +1 -1
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/mcp-operations.d.ts +95 -0
- package/dist/mcp-operations.js +95 -0
- package/dist/mcp-operations.js.map +1 -0
- package/dist/plugin-packages.d.ts +1 -0
- package/dist/provision-roles.js +1 -1
- package/dist/retained-provider-commands.js +2 -2
- package/dist/runtime-posture.d.ts +3 -3
- package/dist/sandbox-transition-wait.d.ts +10 -0
- package/dist/schema.d.ts +517 -0
- package/dist/schema.js +3 -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-mcp-progress.d.ts +8 -1
- package/dist/session-tenancy.js +3 -3
- package/dist/video-generation.js +3 -3
- package/dist/workspace-tool-defaults.js +4 -4
- package/drizzle/0459_mcp_operations.sql +396 -0
- package/drizzle/0460_host_export_message_attribution.sql +177 -0
- package/package.json +10 -6
- package/src/codex-selection-diagnostics.ts +25 -0
- package/src/computer-sessions.ts +5 -1
- package/src/connection-token-resolver.ts +2 -0
- package/src/database.ts +23 -2
- package/src/host-mcp-bindings.ts +14 -1
- package/src/index.ts +370 -60
- package/src/mcp-operations.ts +189 -0
- package/src/plugin-packages.ts +3 -0
- package/src/provision-roles.ts +6 -0
- package/src/runtime-posture.ts +50 -0
- package/src/sandbox-transition-wait.ts +45 -0
- package/src/schema.ts +46 -0
- package/src/session-mcp-progress.ts +26 -5
- package/dist/chunk-AI4NC6XW.js.map +0 -1
- package/dist/chunk-YVYBAWBU.js.map +0 -1
- /package/dist/{chunk-UVBPOGA7.js.map → chunk-232VC2LW.js.map} +0 -0
- /package/dist/{chunk-DVSLOUEI.js.map → chunk-2ZMTQVTR.js.map} +0 -0
- /package/dist/{chunk-F4BIHJ7J.js.map → chunk-EYF6MH6C.js.map} +0 -0
- /package/dist/{chunk-XBXANJQS.js.map → chunk-M7PSMVFF.js.map} +0 -0
- /package/dist/{chunk-PFBUHOI5.js.map → chunk-QLA3UQNX.js.map} +0 -0
- /package/dist/{chunk-UUPY6IGP.js.map → chunk-UK57QA2H.js.map} +0 -0
package/src/computer-sessions.ts
CHANGED
|
@@ -504,7 +504,11 @@ export async function prepareComputerSessionCreate(
|
|
|
504
504
|
state: "prepared",
|
|
505
505
|
actorSubjectId: input.actorSubjectId,
|
|
506
506
|
})
|
|
507
|
-
|
|
507
|
+
// The operation also has a workspace/operation unique index. Concurrent
|
|
508
|
+
// speculative inserts can collide there even when the primary-key
|
|
509
|
+
// arbiter would deduplicate them. Arbitrate every constraint, then use
|
|
510
|
+
// the scoped lookup and immutable request checks below to authorize replay.
|
|
511
|
+
.onConflictDoNothing()
|
|
508
512
|
.returning();
|
|
509
513
|
if (!insertedOperation) {
|
|
510
514
|
const existing = await loadOperation(tx, input.workspaceId, input.operationId);
|
|
@@ -126,6 +126,8 @@ export type ResolveConnectionCredentialResult =
|
|
|
126
126
|
connectionVersion?: number;
|
|
127
127
|
/** Metadata-only owner attribution from the immediate pre-use fence. */
|
|
128
128
|
connectionUseAttribution?: ConnectionUseAttribution;
|
|
129
|
+
/** Metadata-only equality key from current live authority; never credentials or authorization. */
|
|
130
|
+
operationAuthorityDigest?: string;
|
|
129
131
|
/**
|
|
130
132
|
* Revalidate the exact accepted attempt immediately before one target
|
|
131
133
|
* provider request. Credential lookup/refresh is a separate audited
|
package/src/database.ts
CHANGED
|
@@ -715,12 +715,24 @@ export async function withSessionActivityRlsContext<T>(
|
|
|
715
715
|
fn: (db: SessionActivityDatabase) => Promise<T>,
|
|
716
716
|
transactionConfig?: PgTransactionConfig,
|
|
717
717
|
fenceMode: "shared" | "none" = "shared",
|
|
718
|
+
organizationMembershipFence = false,
|
|
718
719
|
): Promise<T> {
|
|
719
720
|
await assertSessionActivityGateEntry(db);
|
|
720
721
|
return await withRlsContext(
|
|
721
722
|
db,
|
|
722
723
|
context,
|
|
723
724
|
async (scopedDb) => {
|
|
725
|
+
if (organizationMembershipFence) {
|
|
726
|
+
// Claim can inherit membership-fenced authority after locking sessions.
|
|
727
|
+
// Acquire membership before even a shared tenancy fence: an exclusive
|
|
728
|
+
// tenancy/control waiter can otherwise complete the same lock cycle.
|
|
729
|
+
await scopedDb.execute(sql`select pg_advisory_xact_lock(
|
|
730
|
+
hashtextextended(${`organization-membership:${context.accountId}`}, 0))`);
|
|
731
|
+
if (fenceMode === "shared") {
|
|
732
|
+
await scopedDb.execute(sql`select pg_advisory_xact_lock_shared(
|
|
733
|
+
hashtextextended(${`session-tenancy:${context.workspaceId}`}, 0))`);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
724
736
|
const gate = await beginSessionActivityGate(scopedDb, context.workspaceId);
|
|
725
737
|
const value = await fn(gate.db);
|
|
726
738
|
// The finalizer must never trust tenant GUCs that arbitrary callback code
|
|
@@ -733,7 +745,7 @@ export async function withSessionActivityRlsContext<T>(
|
|
|
733
745
|
return value;
|
|
734
746
|
},
|
|
735
747
|
transactionConfig,
|
|
736
|
-
fenceMode,
|
|
748
|
+
organizationMembershipFence ? "none" : fenceMode,
|
|
737
749
|
);
|
|
738
750
|
}
|
|
739
751
|
|
|
@@ -807,10 +819,19 @@ export async function withSessionActivitySavepoint<T>(
|
|
|
807
819
|
export async function retrySessionActivityRls<T>(
|
|
808
820
|
db: Database,
|
|
809
821
|
workspaceId: string,
|
|
810
|
-
options: IdempotentPersistenceTransactionOptions
|
|
822
|
+
options: IdempotentPersistenceTransactionOptions & {
|
|
823
|
+
/** Claim can inherit membership-fenced causal authority after locking the
|
|
824
|
+
* session. Acquire that fence before tenancy/control/session instead. An
|
|
825
|
+
* enclosing transaction must preserve this same lock prefix. */
|
|
826
|
+
organizationMembershipFence?: boolean;
|
|
827
|
+
},
|
|
811
828
|
fn: (db: SessionActivityDatabase) => Promise<T>,
|
|
812
829
|
): Promise<T> {
|
|
813
830
|
return await runIdempotentPersistenceTransaction(options, async () => {
|
|
831
|
+
if (options.organizationMembershipFence) {
|
|
832
|
+
const context = { ...(await rlsContextForWorkspace(db, workspaceId)), workspaceId };
|
|
833
|
+
return await withSessionActivityRlsContext(db, context, fn, undefined, "shared", true);
|
|
834
|
+
}
|
|
814
835
|
return await withWorkspaceSessionActivityRls(db, workspaceId, fn);
|
|
815
836
|
});
|
|
816
837
|
}
|
package/src/host-mcp-bindings.ts
CHANGED
|
@@ -588,7 +588,19 @@ export async function inheritChildHostMcpTurnAuthorities(
|
|
|
588
588
|
export async function authorizeDirectHostMcpUse(
|
|
589
589
|
db: Database,
|
|
590
590
|
request: McpCredentialsRequest,
|
|
591
|
+
/** Internal metadata observer; called only after every live authorization fence succeeds. */
|
|
592
|
+
onAuthorized?: (snapshot: HostMcpAcceptedAuthority) => void,
|
|
591
593
|
): Promise<boolean> {
|
|
594
|
+
const snapshot = await resolveDirectHostMcpUseAuthority(db, request);
|
|
595
|
+
if (!snapshot) return false;
|
|
596
|
+
onAuthorized?.(snapshot);
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
async function resolveDirectHostMcpUseAuthority(
|
|
601
|
+
db: Database,
|
|
602
|
+
request: McpCredentialsRequest,
|
|
603
|
+
): Promise<HostMcpAcceptedAuthority | false> {
|
|
592
604
|
if (!request.attemptId || !request.connectionRef.hostBinding) return false;
|
|
593
605
|
const current = await getHostMcpLiveAttempt(
|
|
594
606
|
db,
|
|
@@ -735,7 +747,8 @@ export async function authorizeDirectHostMcpUse(
|
|
|
735
747
|
return (
|
|
736
748
|
live !== null &&
|
|
737
749
|
live.id === request.turnId &&
|
|
738
|
-
live.executionGeneration === request.executionGeneration
|
|
750
|
+
live.executionGeneration === request.executionGeneration &&
|
|
751
|
+
a
|
|
739
752
|
);
|
|
740
753
|
});
|
|
741
754
|
}
|