@opengeni/api-router 2.12.3-canary.0 → 2.12.3
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/app.js +1 -1
- package/dist/{chunk-4AQMKVQM.js → chunk-552H26YK.js} +27 -53
- package/dist/chunk-552H26YK.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/sandbox/rematerialize.d.ts +1 -1
- package/package.json +19 -19
- package/src/sandbox/rematerialize.ts +1 -33
- package/dist/chunk-4AQMKVQM.js.map +0 -1
package/dist/app.js
CHANGED
|
@@ -6536,10 +6536,6 @@ import {
|
|
|
6536
6536
|
withoutSandboxProviderIdentity,
|
|
6537
6537
|
WorkspaceArchiveIntegrityError
|
|
6538
6538
|
} from "@opengeni/runtime/sandbox";
|
|
6539
|
-
import {
|
|
6540
|
-
downloadWorkspaceArchiveSpool,
|
|
6541
|
-
WorkspaceArchiveStorageError
|
|
6542
|
-
} from "@opengeni/storage";
|
|
6543
6539
|
function hasWorkspaceArchive(envelope) {
|
|
6544
6540
|
const sessionState = envelope?.sessionState && typeof envelope.sessionState === "object" && !Array.isArray(envelope.sessionState) ? envelope.sessionState : null;
|
|
6545
6541
|
return typeof sessionState?.workspaceArchive === "string" && sessionState.workspaceArchive.length > 0 || parseWorkspaceArchiveObjectRef(sessionState?.workspaceArchiveRef) !== null;
|
|
@@ -6561,10 +6557,6 @@ async function materializeArchiveObjectRef(envelope, objectStorage) {
|
|
|
6561
6557
|
"workspace archive object storage is not configured"
|
|
6562
6558
|
);
|
|
6563
6559
|
}
|
|
6564
|
-
const descriptor = parseWorkspaceArchiveDescriptor(sessionState.workspaceArchiveMeta);
|
|
6565
|
-
if (process.platform === "linux" && descriptor?.version === 1 && descriptor.workspace.projection === "sdk_local_archive_v1") {
|
|
6566
|
-
return envelope;
|
|
6567
|
-
}
|
|
6568
6560
|
return {
|
|
6569
6561
|
...envelope,
|
|
6570
6562
|
sessionState: await inlineWorkspaceArchiveForRestore(
|
|
@@ -6655,24 +6647,6 @@ async function establishApiSandboxSpawner(input) {
|
|
|
6655
6647
|
established = await establishSandboxSessionFromEnvelope(input.settings, hydrateEnvelope, {
|
|
6656
6648
|
sessionId: input.sessionId,
|
|
6657
6649
|
recovery: "create-or-restore",
|
|
6658
|
-
...input.objectStorage ? {
|
|
6659
|
-
loadHostWorkspaceArchive: async (ref) => {
|
|
6660
|
-
try {
|
|
6661
|
-
return await downloadWorkspaceArchiveSpool(input.objectStorage, ref.key, {
|
|
6662
|
-
bytes: ref.bytes,
|
|
6663
|
-
sha256: ref.sha256
|
|
6664
|
-
});
|
|
6665
|
-
} catch (error) {
|
|
6666
|
-
if (error instanceof WorkspaceArchiveStorageError) {
|
|
6667
|
-
throw new WorkspaceArchiveIntegrityError(error.code, error.message, {
|
|
6668
|
-
retryable: error.retryable,
|
|
6669
|
-
cause: error
|
|
6670
|
-
});
|
|
6671
|
-
}
|
|
6672
|
-
throw error;
|
|
6673
|
-
}
|
|
6674
|
-
}
|
|
6675
|
-
} : {},
|
|
6676
6650
|
backendOverride: input.backend,
|
|
6677
6651
|
environment: input.environment,
|
|
6678
6652
|
onSandboxCreated: async (created) => {
|
|
@@ -57110,14 +57084,14 @@ function registerSessionRoutes(app, deps) {
|
|
|
57110
57084
|
message: "durable interactive terminals require a session-home provider lease"
|
|
57111
57085
|
});
|
|
57112
57086
|
}
|
|
57113
|
-
const
|
|
57087
|
+
const process = await getRetainedProcess(db, {
|
|
57114
57088
|
workspaceId: ctx.workspaceId,
|
|
57115
57089
|
sessionId: ctx.session.id,
|
|
57116
57090
|
processId: pty.retainedProcessId
|
|
57117
57091
|
});
|
|
57118
|
-
if (!
|
|
57092
|
+
if (!process || process.state !== "active" || process.ownerActorKind !== "direct" || process.accountId !== ctx.accountId || process.leaseId !== pty.leaseId || process.sandboxGroupId !== pty.sandboxGroupId || process.parentAdmissionId !== pty.openAdmissionId || process.leaseEpoch !== pty.leaseEpoch || process.providerBackend !== pty.providerBackend || process.providerInstanceId !== pty.providerInstanceId || process.routeKind !== pty.routeKind || process.routeTargetId !== pty.routeTargetId || process.routeEpoch !== pty.routeEpoch || process.providerSessionId !== pty.execSessionId || // Only a persistable home backend can currently be reconstructed by an
|
|
57119
57093
|
// API request without consulting the mutable active pointer.
|
|
57120
|
-
|
|
57094
|
+
process.routeTargetId !== null || handle.lease.id !== process.leaseId || handle.lease.sandboxGroupId !== process.sandboxGroupId || handle.lease.leaseEpoch !== process.leaseEpoch || handle.lease.backend !== process.providerBackend || handle.lease.instanceId !== process.providerInstanceId) {
|
|
57121
57095
|
throw new HTTPException70(409, {
|
|
57122
57096
|
message: "pty retained-process identity is stale; reopen the terminal"
|
|
57123
57097
|
});
|
|
@@ -57126,28 +57100,28 @@ function registerSessionRoutes(app, deps) {
|
|
|
57126
57100
|
accountId: ctx.accountId,
|
|
57127
57101
|
workspaceId: ctx.workspaceId,
|
|
57128
57102
|
sessionId: ctx.session.id,
|
|
57129
|
-
processId:
|
|
57103
|
+
processId: process.id
|
|
57130
57104
|
});
|
|
57131
57105
|
handle.routingSession.adoptRetainedProcess({
|
|
57132
57106
|
process: {
|
|
57133
|
-
id:
|
|
57134
|
-
providerSessionId:
|
|
57107
|
+
id: process.id,
|
|
57108
|
+
providerSessionId: process.providerSessionId,
|
|
57135
57109
|
...providerCommand ? { providerCommand } : {}
|
|
57136
57110
|
},
|
|
57137
57111
|
backend: {
|
|
57138
57112
|
sandboxId: null,
|
|
57139
|
-
leaseEpoch:
|
|
57140
|
-
providerInstanceId:
|
|
57141
|
-
activeEpoch:
|
|
57113
|
+
leaseEpoch: process.leaseEpoch,
|
|
57114
|
+
providerInstanceId: process.providerInstanceId,
|
|
57115
|
+
activeEpoch: process.routeEpoch
|
|
57142
57116
|
}
|
|
57143
57117
|
});
|
|
57144
|
-
return
|
|
57118
|
+
return process;
|
|
57145
57119
|
};
|
|
57146
|
-
const emitPtyExited = async (ctx, ptyId,
|
|
57120
|
+
const emitPtyExited = async (ctx, ptyId, process) => {
|
|
57147
57121
|
const exited = {
|
|
57148
57122
|
ptyId,
|
|
57149
|
-
exitCode:
|
|
57150
|
-
reason:
|
|
57123
|
+
exitCode: process.exitCode,
|
|
57124
|
+
reason: process.state === "exited" ? "exit" : "lost"
|
|
57151
57125
|
};
|
|
57152
57126
|
await appendAndPublishEvents4(db, bus, ctx.workspaceId, ctx.session.id, [
|
|
57153
57127
|
{ type: "terminal.pty.exited", payload: exited }
|
|
@@ -60453,12 +60427,12 @@ function registerSessionRoutes(app, deps) {
|
|
|
60453
60427
|
const opened = await service.ptyOpen(req, ptyId);
|
|
60454
60428
|
const execSessionId = opened.execSessionId;
|
|
60455
60429
|
const retained = execSessionId === null ? null : handle.routingSession.retainedProcessIdentity(execSessionId);
|
|
60456
|
-
const
|
|
60430
|
+
const process = retained ? await getRetainedProcess(db, {
|
|
60457
60431
|
workspaceId: ctx.workspaceId,
|
|
60458
60432
|
sessionId: ctx.session.id,
|
|
60459
60433
|
processId: retained.id
|
|
60460
60434
|
}) : null;
|
|
60461
|
-
if (execSessionId === null || !retained || !
|
|
60435
|
+
if (execSessionId === null || !retained || !process || process.state !== "active" || process.ownerActorKind !== "direct" || process.providerSessionId !== execSessionId || process.routeTargetId !== null || process.leaseId !== handle.lease.id || process.sandboxGroupId !== handle.lease.sandboxGroupId || process.leaseEpoch !== handle.lease.leaseEpoch || process.providerBackend !== handle.lease.backend || process.providerInstanceId !== handle.lease.instanceId) {
|
|
60462
60436
|
if (execSessionId !== null && handle.routingSession.hasRetainedProcess(execSessionId)) {
|
|
60463
60437
|
await drainOpenedPty(handle, execSessionId);
|
|
60464
60438
|
}
|
|
@@ -60467,17 +60441,17 @@ function registerSessionRoutes(app, deps) {
|
|
|
60467
60441
|
});
|
|
60468
60442
|
}
|
|
60469
60443
|
const identity = {
|
|
60470
|
-
leaseId:
|
|
60471
|
-
sandboxGroupId:
|
|
60472
|
-
retainedProcessId:
|
|
60473
|
-
openAdmissionId:
|
|
60474
|
-
execSessionId:
|
|
60475
|
-
leaseEpoch:
|
|
60476
|
-
providerBackend:
|
|
60477
|
-
providerInstanceId:
|
|
60478
|
-
routeKind:
|
|
60479
|
-
routeTargetId:
|
|
60480
|
-
routeEpoch:
|
|
60444
|
+
leaseId: process.leaseId,
|
|
60445
|
+
sandboxGroupId: process.sandboxGroupId,
|
|
60446
|
+
retainedProcessId: process.id,
|
|
60447
|
+
openAdmissionId: process.parentAdmissionId,
|
|
60448
|
+
execSessionId: process.providerSessionId,
|
|
60449
|
+
leaseEpoch: process.leaseEpoch,
|
|
60450
|
+
providerBackend: process.providerBackend,
|
|
60451
|
+
providerInstanceId: process.providerInstanceId,
|
|
60452
|
+
routeKind: process.routeKind,
|
|
60453
|
+
routeTargetId: process.routeTargetId,
|
|
60454
|
+
routeEpoch: process.routeEpoch
|
|
60481
60455
|
};
|
|
60482
60456
|
try {
|
|
60483
60457
|
await insertPtySession(db, {
|
|
@@ -76580,4 +76554,4 @@ export {
|
|
|
76580
76554
|
withDefaultEnabledCapabilityMcpTools,
|
|
76581
76555
|
workflowIdForSession4 as workflowIdForSession
|
|
76582
76556
|
};
|
|
76583
|
-
//# sourceMappingURL=chunk-
|
|
76557
|
+
//# sourceMappingURL=chunk-552H26YK.js.map
|