@opengeni/worker-bundle 2.0.0 → 2.0.1-canary.35916963870001

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.
Files changed (33) hide show
  1. package/dist/activities/agent-turn/agent-build.d.ts +1 -0
  2. package/dist/activities/agent-turn/failure-settlement.d.ts +1 -1
  3. package/dist/activities/agent-turn/tool-environment.d.ts +34 -0
  4. package/dist/activities/codemode-dispatcher.d.ts +3 -1
  5. package/dist/activities/sandbox-lease.d.ts +3 -4
  6. package/dist/{activities-control-BOLIY3H4.js → activities-control-UF2CR2LB.js} +199 -23
  7. package/dist/activities-control-UF2CR2LB.js.map +1 -0
  8. package/dist/{activities-turn-2B3WMHBB.js → activities-turn-KBLXHBWS.js} +109 -25
  9. package/dist/activities-turn-KBLXHBWS.js.map +1 -0
  10. package/dist/{chunk-TVEE2UUC.js → chunk-K3BPAI4R.js} +12 -6
  11. package/dist/chunk-K3BPAI4R.js.map +1 -0
  12. package/dist/index.js +7 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/workflow-bundle.js +4 -1
  15. package/package.json +19 -19
  16. package/src/activities/agent-turn/agent-build.ts +5 -1
  17. package/src/activities/agent-turn/claim.ts +12 -2
  18. package/src/activities/agent-turn/errors.ts +1 -0
  19. package/src/activities/agent-turn/failure-settlement.ts +40 -8
  20. package/src/activities/agent-turn/run.ts +1 -0
  21. package/src/activities/agent-turn/sandbox-runtime.ts +25 -9
  22. package/src/activities/agent-turn/stream-attempt.ts +14 -1
  23. package/src/activities/agent-turn/tool-environment.ts +5 -0
  24. package/src/activities/codemode-dispatcher.ts +6 -0
  25. package/src/activities/knowledge-indexing.ts +124 -6
  26. package/src/activities/retained-screenshots.ts +42 -4
  27. package/src/activities/sandbox-lease.ts +141 -21
  28. package/src/sandbox-resume.ts +6 -0
  29. package/src/sandbox-routing.ts +7 -3
  30. package/src/workflows/activities.ts +14 -1
  31. package/dist/activities-control-BOLIY3H4.js.map +0 -1
  32. package/dist/activities-turn-2B3WMHBB.js.map +0 -1
  33. package/dist/chunk-TVEE2UUC.js.map +0 -1
@@ -5049,7 +5049,8 @@ import {
5049
5049
  import {
5050
5050
  effectiveSandboxLifecycle,
5051
5051
  sandboxArchiveCaptureTimeoutMs,
5052
- sandboxLifecycleTransitionWaitMs
5052
+ sandboxLifecycleTransitionWaitMs,
5053
+ sandboxWarmRateMicrosPerSecond
5053
5054
  } from "@opengeni/config";
5054
5055
  import { randomUUID as randomUUID3 } from "crypto";
5055
5056
 
@@ -5711,6 +5712,10 @@ async function resumeBoxForTurn(services, ids, kind, holderId) {
5711
5712
  holderId,
5712
5713
  subjectId: ids.sessionId,
5713
5714
  backend: ids.backend,
5715
+ warmBilling: {
5716
+ mode: settings.sandboxWarmBillingMode,
5717
+ rateMicrosPerSecond: sandboxWarmRateMicrosPerSecond(settings, ids.backend)
5718
+ },
5714
5719
  os,
5715
5720
  // IMAGE IS SHARED STATE (B3): thread the resolved image so the lease stamps it +
5716
5721
  // conflicts on a live box already running a different image. A
@@ -5795,7 +5800,8 @@ async function resumeBoxForTurn(services, ids, kind, holderId) {
5795
5800
  kind,
5796
5801
  holderId,
5797
5802
  expectedEpoch: heartbeat2.expectedEpoch,
5798
- leaseTtlMs: heartbeat2.leaseTtlMs
5803
+ leaseTtlMs: heartbeat2.leaseTtlMs,
5804
+ billingMode: services.settings.sandboxWarmBillingMode
5799
5805
  }).then(async (status) => {
5800
5806
  if (heartbeat2 !== holderLeaseHeartbeat) return;
5801
5807
  if (!status.holderAlive) {
@@ -6638,7 +6644,7 @@ function settleRetainedProcessForTurn(services, ids) {
6638
6644
  function adoptRetainedProcessAsBackgroundCommandForTurn(services, ids) {
6639
6645
  const fence = ids.workspaceMutationFence;
6640
6646
  if (!fence) return void 0;
6641
- return async ({ backend, process: process2 }) => {
6647
+ return async ({ backend, process: process2, command }) => {
6642
6648
  const durable = await getRetainedProcess(services.db, {
6643
6649
  workspaceId: ids.workspaceId,
6644
6650
  sessionId: ids.sessionId,
@@ -6656,7 +6662,7 @@ function adoptRetainedProcessAsBackgroundCommandForTurn(services, ids) {
6656
6662
  attemptId: fence.attemptId,
6657
6663
  processId: process2.id,
6658
6664
  expected: retainedProcessSettlementIdentity(durable),
6659
- command: "execCommand"
6665
+ command: command ?? "Background command"
6660
6666
  });
6661
6667
  };
6662
6668
  }
@@ -9250,7 +9256,7 @@ function providerRecoveryResult(input) {
9250
9256
  };
9251
9257
  }
9252
9258
  const providerDelay = input.retryAfterMs !== null && input.retryAfterMs !== void 0 && Number.isFinite(input.retryAfterMs) && input.retryAfterMs > 0 ? Math.ceil(input.retryAfterMs) : null;
9253
- const continueDelayMs = input.failureCode === "provider_rate_limited" ? providerDelay ?? PROVIDER_BACKPRESSURE_DELAY_MS : input.failureCode === "provider_unavailable" || input.failureCode === "upstream_connectivity_unavailable" || input.failureCode === "sandbox_command_start_unavailable" || input.failureCode === "mcp_transport_timeout" || input.failureCode === "mcp_transport_unavailable" || input.failureCode === POST_COMPACTION_CONTINUATION_EMPTY_CODE ? Math.max(
9259
+ const continueDelayMs = input.failureCode === "provider_rate_limited" ? providerDelay ?? PROVIDER_BACKPRESSURE_DELAY_MS : input.failureCode === "provider_unavailable" || input.failureCode === "upstream_connectivity_unavailable" || input.failureCode === "sandbox_command_start_unavailable" || input.failureCode === "mcp_transport_timeout" || input.failureCode === "mcp_transport_unavailable" || input.failureCode === "turn_execution_policy_definition_mismatch" || input.failureCode === POST_COMPACTION_CONTINUATION_EMPTY_CODE ? Math.max(
9254
9260
  providerDelay ?? 0,
9255
9261
  PROVIDER_CONNECTIVITY_BACKOFF_MS[Math.min(
9256
9262
  Math.max(Math.trunc(input.attemptNumber) - 1, 0),
@@ -10064,4 +10070,4 @@ export {
10064
10070
  codexUsageLimitFailurePayload,
10065
10071
  CODEX_USAGE_LIMIT_MAX_RESUME_MS
10066
10072
  };
10067
- //# sourceMappingURL=chunk-TVEE2UUC.js.map
10073
+ //# sourceMappingURL=chunk-K3BPAI4R.js.map