@opengeni/db 4.0.0-canary.1 → 4.0.0-canary.2
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-2HGYCAXN.js → chunk-B5Y3TCSP.js} +2 -2
- package/dist/{chunk-A5RFBEZR.js → chunk-CQF6G4IF.js} +3 -3
- package/dist/{chunk-FVZINOBB.js → chunk-DUB3LUVM.js} +21 -9
- package/dist/chunk-DUB3LUVM.js.map +1 -0
- package/dist/{chunk-YVDQDD33.js → chunk-L2QFSPFP.js} +2 -2
- package/dist/{chunk-47LKLIIK.js → chunk-NPKBYGAK.js} +2 -2
- package/dist/{chunk-XAKQCOF3.js → chunk-PWJJKCTF.js} +11 -1
- package/dist/chunk-PWJJKCTF.js.map +1 -0
- package/dist/{chunk-I6YPQMAL.js → chunk-VU2IK37Y.js} +2 -2
- package/dist/{chunk-ZQ32COTC.js → chunk-XIYAXH47.js} +2 -2
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +191 -16
- package/dist/index.js.map +1 -1
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/schema.d.ts +51 -0
- package/dist/schema.js +1 -1
- package/dist/session-background-commands.d.ts +6 -0
- 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-tenancy.js +3 -3
- package/dist/video-generation.js +3 -3
- package/drizzle/0419_background_command_launch_authority.sql +56 -0
- package/package.json +6 -6
- package/src/index.ts +264 -10
- package/src/schema.ts +10 -0
- package/src/session-background-commands.ts +33 -0
- package/dist/chunk-FVZINOBB.js.map +0 -1
- package/dist/chunk-XAKQCOF3.js.map +0 -1
- /package/dist/{chunk-2HGYCAXN.js.map → chunk-B5Y3TCSP.js.map} +0 -0
- /package/dist/{chunk-A5RFBEZR.js.map → chunk-CQF6G4IF.js.map} +0 -0
- /package/dist/{chunk-YVDQDD33.js.map → chunk-L2QFSPFP.js.map} +0 -0
- /package/dist/{chunk-47LKLIIK.js.map → chunk-NPKBYGAK.js.map} +0 -0
- /package/dist/{chunk-I6YPQMAL.js.map → chunk-VU2IK37Y.js.map} +0 -0
- /package/dist/{chunk-ZQ32COTC.js.map → chunk-XIYAXH47.js.map} +0 -0
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
getCanonicalHumanIdentityProjection,
|
|
12
12
|
synchronizeCanonicalHumanLoginBindings,
|
|
13
13
|
validateCanonicalHumanSession
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-NPKBYGAK.js";
|
|
15
|
+
import "./chunk-XIYAXH47.js";
|
|
16
|
+
import "./chunk-PWJJKCTF.js";
|
|
17
17
|
import "./chunk-PZ5AY32C.js";
|
|
18
18
|
export {
|
|
19
19
|
CanonicalHumanIdentityAuthorityError,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
withWorkspaceRls,
|
|
6
6
|
withWorkspaceSubjectRls,
|
|
7
7
|
withWorkspaceSubjectSessionActivityRls
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XIYAXH47.js";
|
|
9
9
|
|
|
10
10
|
// src/session-tenancy.ts
|
|
11
11
|
import { createHash } from "crypto";
|
|
@@ -481,4 +481,4 @@ export {
|
|
|
481
481
|
forkSessionContent,
|
|
482
482
|
replayAppliedSessionFork
|
|
483
483
|
};
|
|
484
|
-
//# sourceMappingURL=chunk-
|
|
484
|
+
//# sourceMappingURL=chunk-B5Y3TCSP.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
rawRows,
|
|
3
3
|
withRlsContext,
|
|
4
4
|
withWorkspaceRls
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-XIYAXH47.js";
|
|
6
6
|
import {
|
|
7
7
|
connections,
|
|
8
8
|
creditLedgerEntries,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
workspaceVideoGenerationPolicies,
|
|
15
15
|
workspaceVideoGenerationQuotas,
|
|
16
16
|
workspaces
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-PWJJKCTF.js";
|
|
18
18
|
|
|
19
19
|
// src/video-generation.ts
|
|
20
20
|
import {
|
|
@@ -992,4 +992,4 @@ export {
|
|
|
992
992
|
mediaGenerationResultForStoredOperation,
|
|
993
993
|
getVideoGenerationOperationSummary
|
|
994
994
|
};
|
|
995
|
-
//# sourceMappingURL=chunk-
|
|
995
|
+
//# sourceMappingURL=chunk-CQF6G4IF.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cancelUnacceptedVideoGenerationsForToolCallsInTransaction
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CQF6G4IF.js";
|
|
4
4
|
import {
|
|
5
5
|
nestedPostgresSqlState,
|
|
6
6
|
withRlsContext,
|
|
7
7
|
withSessionActivityRlsContext
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XIYAXH47.js";
|
|
9
9
|
import {
|
|
10
10
|
LOSSLESS_CONTENT_CODEC_VERSION,
|
|
11
11
|
auditEvents,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
workspaceControlEvents,
|
|
33
33
|
workspaceInferenceControls,
|
|
34
34
|
workspaces
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-PWJJKCTF.js";
|
|
36
36
|
|
|
37
37
|
// src/session-background-commands.ts
|
|
38
38
|
import { SessionCommandFailure } from "@opengeni/contracts";
|
|
@@ -3409,7 +3409,12 @@ async function insertManagedSessionBackgroundCommandInTransaction(db, input) {
|
|
|
3409
3409
|
accountId: sandboxRetainedProcesses.accountId,
|
|
3410
3410
|
workspaceId: sandboxRetainedProcesses.workspaceId,
|
|
3411
3411
|
sessionId: sandboxRetainedProcesses.sessionId,
|
|
3412
|
-
state: sandboxRetainedProcesses.state
|
|
3412
|
+
state: sandboxRetainedProcesses.state,
|
|
3413
|
+
ownerActorKind: sandboxRetainedProcesses.ownerActorKind,
|
|
3414
|
+
ownerActorId: sandboxRetainedProcesses.ownerActorId,
|
|
3415
|
+
ownerTurnId: sandboxRetainedProcesses.ownerTurnId,
|
|
3416
|
+
ownerAttemptId: sandboxRetainedProcesses.ownerAttemptId,
|
|
3417
|
+
ownerExecutionGeneration: sandboxRetainedProcesses.ownerExecutionGeneration
|
|
3413
3418
|
}).from(sandboxRetainedProcesses).where(eq4(sandboxRetainedProcesses.id, input.retainedProcessId)).for("update").limit(1);
|
|
3414
3419
|
if (!process || process.accountId !== input.accountId || process.workspaceId !== input.workspaceId || process.sessionId !== input.sessionId || process.state !== "active") {
|
|
3415
3420
|
throw new Error("Managed background command requires its exact active retained process");
|
|
@@ -3422,14 +3427,18 @@ async function insertManagedSessionBackgroundCommandInTransaction(db, input) {
|
|
|
3422
3427
|
provider: "managed",
|
|
3423
3428
|
state: "running",
|
|
3424
3429
|
retainedProcessId: input.retainedProcessId,
|
|
3425
|
-
commandPreview: commandPreview(input.command)
|
|
3430
|
+
commandPreview: commandPreview(input.command),
|
|
3431
|
+
launchTurnId: input.turnId ?? null,
|
|
3432
|
+
launchAttemptId: input.attemptId ?? null,
|
|
3433
|
+
launchExecutionGeneration: input.executionGeneration ?? null
|
|
3426
3434
|
}).onConflictDoUpdate({
|
|
3427
3435
|
target: sessionBackgroundCommands.retainedProcessId,
|
|
3428
3436
|
targetWhere: sql4`${sessionBackgroundCommands.retainedProcessId} is not null`,
|
|
3429
3437
|
set: { updatedAt: /* @__PURE__ */ new Date() }
|
|
3430
3438
|
}).returning();
|
|
3431
3439
|
if (!row) throw new Error("Managed background command adoption returned no row");
|
|
3432
|
-
|
|
3440
|
+
const legacyReplayMatches = row.launchTurnId === null && row.launchAttemptId === null && row.launchExecutionGeneration === null && process.ownerActorKind === "turn" && process.ownerActorId === input.attemptId && process.ownerTurnId === input.turnId && process.ownerAttemptId === input.attemptId && process.ownerExecutionGeneration === input.executionGeneration;
|
|
3441
|
+
if (row.accountId !== input.accountId || row.workspaceId !== input.workspaceId || row.sessionId !== input.sessionId || !legacyReplayMatches && (row.launchTurnId !== (input.turnId ?? null) || row.launchAttemptId !== (input.attemptId ?? null) || row.launchExecutionGeneration !== (input.executionGeneration ?? null)) || row.provider !== "managed" || row.retainedProcessId !== input.retainedProcessId) {
|
|
3433
3442
|
throw new Error("Managed background command adoption conflicted with another identity");
|
|
3434
3443
|
}
|
|
3435
3444
|
return mapCommand(row);
|
|
@@ -3446,7 +3455,10 @@ async function insertConnectedMachineSessionBackgroundCommandInTransaction(db, i
|
|
|
3446
3455
|
enrollmentId: input.enrollmentId,
|
|
3447
3456
|
connectionInstanceId: input.connectionInstanceId,
|
|
3448
3457
|
opId: input.opId,
|
|
3449
|
-
commandPreview: commandPreview(input.command)
|
|
3458
|
+
commandPreview: commandPreview(input.command),
|
|
3459
|
+
launchTurnId: input.turnId ?? null,
|
|
3460
|
+
launchAttemptId: input.attemptId ?? null,
|
|
3461
|
+
launchExecutionGeneration: input.executionGeneration ?? null
|
|
3450
3462
|
}).onConflictDoUpdate({
|
|
3451
3463
|
target: [
|
|
3452
3464
|
sessionBackgroundCommands.controlWorkspaceId,
|
|
@@ -3458,7 +3470,7 @@ async function insertConnectedMachineSessionBackgroundCommandInTransaction(db, i
|
|
|
3458
3470
|
set: { updatedAt: /* @__PURE__ */ new Date() }
|
|
3459
3471
|
}).returning();
|
|
3460
3472
|
if (!row) throw new Error("Connected Machine background command adoption returned no row");
|
|
3461
|
-
if (row.accountId !== input.accountId || row.workspaceId !== input.workspaceId || row.sessionId !== input.sessionId || row.provider !== "connected_machine" || row.controlWorkspaceId !== input.controlWorkspaceId || row.enrollmentId !== input.enrollmentId || row.connectionInstanceId !== input.connectionInstanceId || row.opId !== input.opId) {
|
|
3473
|
+
if (row.accountId !== input.accountId || row.workspaceId !== input.workspaceId || row.sessionId !== input.sessionId || row.launchTurnId !== (input.turnId ?? null) || row.launchAttemptId !== (input.attemptId ?? null) || row.launchExecutionGeneration !== (input.executionGeneration ?? null) || row.provider !== "connected_machine" || row.controlWorkspaceId !== input.controlWorkspaceId || row.enrollmentId !== input.enrollmentId || row.connectionInstanceId !== input.connectionInstanceId || row.opId !== input.opId) {
|
|
3462
3474
|
throw new Error(
|
|
3463
3475
|
"Connected Machine background command adoption conflicted with another identity"
|
|
3464
3476
|
);
|
|
@@ -4130,4 +4142,4 @@ export {
|
|
|
4130
4142
|
autoResumeSessionBranchInTransaction,
|
|
4131
4143
|
mutateWorkspaceControlInTransaction
|
|
4132
4144
|
};
|
|
4133
|
-
//# sourceMappingURL=chunk-
|
|
4145
|
+
//# sourceMappingURL=chunk-DUB3LUVM.js.map
|