@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 CHANGED
@@ -5,7 +5,7 @@ import { createNatsEventBus as createNatsEventBus2 } from "@opengeni/events";
5
5
  import { createObservability as createObservability2, logStartupDependencyRetry } from "@opengeni/observability";
6
6
  import { Connection, ScheduleAlreadyRunning, ScheduleOverlapPolicy, Client as TemporalClient } from "@temporalio/client";
7
7
  import { NativeConnection, Worker } from "@temporalio/worker";
8
- import { ensureModalRegistryImage } from "@opengeni/runtime";
8
+ import { ensureModalRegistryImage as ensureModalRegistryImage2 } from "@opengeni/runtime";
9
9
 
10
10
  // src/activities.ts
11
11
  import { dbSearchPath, getSettings, resolveNatsControlPlaneAuth } from "@opengeni/config";
@@ -68,6 +68,7 @@ import {
68
68
  normalizeSdkEvent,
69
69
  sanitizeHistoryItemsForModel as sanitizeHistoryItemsForModel2,
70
70
  summarizeForCompaction as summarizeForCompaction2,
71
+ ensureModalRegistryImage,
71
72
  findCompactionNeededError,
72
73
  SUMMARY_BUFFER_TOKENS as SUMMARY_BUFFER_TOKENS2
73
74
  } from "@opengeni/runtime";
@@ -2190,6 +2191,15 @@ async function resolveActiveSandboxBackend(routingOn, loadPointer, loadSandboxKi
2190
2191
  return void 0;
2191
2192
  }
2192
2193
  }
2194
+ async function ensureTurnModalRegistryImage(runSettings, sandboxCreationBackend, ensureRegistryImage = ensureModalRegistryImage) {
2195
+ if (sandboxCreationBackend !== "modal") {
2196
+ return;
2197
+ }
2198
+ if (!runSettings.modalImageRegistrySecret || !runSettings.modalImageRef) {
2199
+ return;
2200
+ }
2201
+ await ensureRegistryImage(runSettings);
2202
+ }
2193
2203
  function shouldStartOnTurnRecording(params) {
2194
2204
  return params.recordingEnabled && params.desktopEnabled && desktopCapableBackend2(params.establishedBackendId) && params.effectiveBackend !== "selfhosted";
2195
2205
  }
@@ -2508,6 +2518,9 @@ function createRunAgentTurnActivity(services) {
2508
2518
  async () => activeSandboxRecord?.kind ?? null
2509
2519
  );
2510
2520
  const machinePrimary = activeSandboxBackend === "selfhosted" && Boolean(activeSandboxPointer?.activeSandboxId) && Boolean(activeSandboxRecord?.enrollmentId);
2521
+ const groupBoxBackend = runSettings.sandboxBackend === "selfhosted" && !machinePrimary ? settings.sandboxBackend : runSettings.sandboxBackend;
2522
+ const sandboxCreationBackend = settings.sandboxOwnershipEnabled && runSettings.sandboxBackend !== "none" ? groupBoxBackend : runSettings.sandboxBackend;
2523
+ await ensureTurnModalRegistryImage(runSettings, sandboxCreationBackend);
2511
2524
  const {
2512
2525
  environment: sandboxEnvironment,
2513
2526
  gitToken: sandboxGitToken,
@@ -2527,7 +2540,6 @@ function createRunAgentTurnActivity(services) {
2527
2540
  if (settings.sandboxOwnershipEnabled && turn.sandboxBackend !== "none") {
2528
2541
  sandboxHolderId = dispatchId ?? `turn:${turnId}`;
2529
2542
  sandboxGroupId = session.sandboxGroupId;
2530
- const groupBoxBackend = turn.sandboxBackend === "selfhosted" && !machinePrimary ? settings.sandboxBackend : turn.sandboxBackend;
2531
2543
  if (machinePrimary) {
2532
2544
  const established = await establishSelfhostedTurnSession(
2533
2545
  { db, settings, bus },
@@ -4788,7 +4800,7 @@ async function createOpenGeniWorker(options = {}) {
4788
4800
  const observability = options.activityDependencies?.observability ?? createObservability2(settings, { component: "worker" });
4789
4801
  await retryStartupDependency(
4790
4802
  "Modal private-registry image",
4791
- () => ensureModalRegistryImage(settings),
4803
+ () => ensureModalRegistryImage2(settings),
4792
4804
  {
4793
4805
  ...startupRetryOptions(settings),
4794
4806
  onRetry: (event) => logStartupDependencyRetry(observability, event)