@opengeni/worker-bundle 0.7.0 → 0.7.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/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/activities/agent-turn.ts +35 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/worker-bundle",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "OpenGeni worker entry: runOpenGeniWorker/createOpenGeniWorker(deps) + the un-bundled Temporal workflow source tree. An engine-distribution surface — its runtime closure includes engine-internal packages and the workflow bundle ships as on-disk TS source.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@opengeni/codex": "^0.2.1",
|
|
42
42
|
"@opengeni/config": "^0.4.0",
|
|
43
43
|
"@opengeni/contracts": "^0.9.0",
|
|
44
|
-
"@opengeni/core": "^0.4.
|
|
44
|
+
"@opengeni/core": "^0.4.6",
|
|
45
45
|
"@opengeni/db": "^0.6.1",
|
|
46
46
|
"@opengeni/documents": "^0.2.8",
|
|
47
47
|
"@opengeni/events": "^0.2.8",
|
|
48
|
-
"@opengeni/observability": "^0.
|
|
49
|
-
"@opengeni/runtime": "^0.6.
|
|
48
|
+
"@opengeni/observability": "^0.3.0",
|
|
49
|
+
"@opengeni/runtime": "^0.6.1",
|
|
50
50
|
"@opengeni/storage": "^0.2.8",
|
|
51
51
|
"@temporalio/activity": "^1.17.0",
|
|
52
52
|
"@temporalio/client": "^1.17.0",
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
normalizeSdkEvent,
|
|
51
51
|
sanitizeHistoryItemsForModel,
|
|
52
52
|
summarizeForCompaction,
|
|
53
|
+
ensureModalRegistryImage,
|
|
53
54
|
findCompactionNeededError,
|
|
54
55
|
SUMMARY_BUFFER_TOKENS,
|
|
55
56
|
type SandboxFileDownload,
|
|
@@ -406,6 +407,27 @@ export async function resolveActiveSandboxBackend(
|
|
|
406
407
|
}
|
|
407
408
|
}
|
|
408
409
|
|
|
410
|
+
/**
|
|
411
|
+
* Warm the Modal private-registry image for the image ref this turn actually
|
|
412
|
+
* resolved, not only the deployment-global OPENGENI_MODAL_IMAGE_REF warmed at
|
|
413
|
+
* worker boot. Packs can override `modalImageRef` per workspace/turn, so a
|
|
414
|
+
* private pack image must be resolved before sandbox creation or Modal falls
|
|
415
|
+
* back to the unauthenticated `fromTag` path.
|
|
416
|
+
*/
|
|
417
|
+
export async function ensureTurnModalRegistryImage(
|
|
418
|
+
runSettings: Settings,
|
|
419
|
+
sandboxCreationBackend: Settings["sandboxBackend"] | undefined,
|
|
420
|
+
ensureRegistryImage: (settings: Settings) => Promise<void> = ensureModalRegistryImage,
|
|
421
|
+
): Promise<void> {
|
|
422
|
+
if (sandboxCreationBackend !== "modal") {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
if (!runSettings.modalImageRegistrySecret || !runSettings.modalImageRef) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
await ensureRegistryImage(runSettings);
|
|
429
|
+
}
|
|
430
|
+
|
|
409
431
|
/**
|
|
410
432
|
* Decide whether to start on-turn desktop recording for THIS turn.
|
|
411
433
|
*
|
|
@@ -999,6 +1021,19 @@ export function createRunAgentTurnActivity(services: () => Promise<ActivityServi
|
|
|
999
1021
|
activeSandboxBackend === "selfhosted"
|
|
1000
1022
|
&& Boolean(activeSandboxPointer?.activeSandboxId)
|
|
1001
1023
|
&& Boolean(activeSandboxRecord?.enrollmentId);
|
|
1024
|
+
// The backend that can actually create a sandbox for this turn. In the
|
|
1025
|
+
// common path this is runSettings.sandboxBackend. A selfhosted home turn
|
|
1026
|
+
// that is NOT machine-primary falls back to the deployment cloud backend
|
|
1027
|
+
// so swap-away / flag-off degrade to a real group box.
|
|
1028
|
+
const groupBoxBackend: Settings["sandboxBackend"] =
|
|
1029
|
+
runSettings.sandboxBackend === "selfhosted" && !machinePrimary
|
|
1030
|
+
? settings.sandboxBackend
|
|
1031
|
+
: runSettings.sandboxBackend;
|
|
1032
|
+
const sandboxCreationBackend: Settings["sandboxBackend"] =
|
|
1033
|
+
settings.sandboxOwnershipEnabled && runSettings.sandboxBackend !== "none"
|
|
1034
|
+
? groupBoxBackend
|
|
1035
|
+
: runSettings.sandboxBackend;
|
|
1036
|
+
await ensureTurnModalRegistryImage(runSettings, sandboxCreationBackend);
|
|
1002
1037
|
// Computed exactly ONCE per turn and reused for BOTH the box manifest
|
|
1003
1038
|
// (resumeBoxForTurn -> establishSandboxSessionFromEnvelope, below) AND the
|
|
1004
1039
|
// agent (runtime.buildAgent, below). sandboxEnvironmentForRun mints a FRESH
|
|
@@ -1059,10 +1094,6 @@ export function createRunAgentTurnActivity(services: () => Promise<ActivityServi
|
|
|
1059
1094
|
// SelfhostedSandboxClient has no bound agentId and throws. Fall the group-box
|
|
1060
1095
|
// backend back to the deployment default cloud backend so swap-away / flag-off
|
|
1061
1096
|
// degrade to a genuine cloud box exactly like today (home=modal did).
|
|
1062
|
-
const groupBoxBackend: Settings["sandboxBackend"] =
|
|
1063
|
-
turn.sandboxBackend === "selfhosted" && !machinePrimary
|
|
1064
|
-
? settings.sandboxBackend
|
|
1065
|
-
: turn.sandboxBackend;
|
|
1066
1097
|
if (machinePrimary) {
|
|
1067
1098
|
// STAGE D D1-lite: the active sandbox is a connected machine, so DO NOT
|
|
1068
1099
|
// establish or lease a phantom Modal home box (today's path leased + BILLED
|