@opengeni/runtime 2.4.2-canary.1 → 2.4.3-canary.0

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.
@@ -20588,9 +20588,9 @@ function decodePage(prior, input, terminal) {
20588
20588
  };
20589
20589
  }
20590
20590
  var ModalCommandControl = class _ModalCommandControl {
20591
- constructor(client, sandboxId, root, environment = {}) {
20591
+ constructor(client, sandboxIdentity, root, environment = {}) {
20592
20592
  this.client = client;
20593
- this.sandboxId = sandboxId;
20593
+ this.sandboxIdentity = sandboxIdentity;
20594
20594
  this.root = root;
20595
20595
  this.environment = environment;
20596
20596
  }
@@ -20599,16 +20599,19 @@ var ModalCommandControl = class _ModalCommandControl {
20599
20599
  throw new Error("Modal command control requires the verified 0.9.0 SDK contract");
20600
20600
  return new _ModalCommandControl(commandControlPlane(client), sandboxId, root, environment);
20601
20601
  }
20602
+ get sandboxId() {
20603
+ return typeof this.sandboxIdentity === "function" ? this.sandboxIdentity() : this.sandboxIdentity;
20604
+ }
20602
20605
  async start(args, signal) {
20603
20606
  signal?.throwIfAborted();
20604
20607
  const workdir = posix2.resolve(this.root, args.workdir ?? this.root);
20605
20608
  if (workdir !== this.root && !workdir.startsWith(`${this.root.replace(/\/$/u, "")}/`))
20606
20609
  throw new Error("Command workdir is outside the sandbox workspace");
20607
- const task = await this.client.sandboxGetTaskId(
20608
- { sandboxId: this.sandboxId },
20609
- signal ? { signal } : void 0
20610
- );
20610
+ const sandboxId = this.sandboxId;
20611
+ const task = await this.client.sandboxGetTaskId({ sandboxId }, signal ? { signal } : void 0);
20611
20612
  if (!task.taskId || task.taskResult) throw new Error("Modal command task is unavailable");
20613
+ if (sandboxId !== this.sandboxId)
20614
+ throw new Error("Modal sandbox changed during command preparation");
20612
20615
  const login = args.shell ? args.login ?? true : false;
20613
20616
  let command = [args.shell ?? "/bin/sh", login ? "-lc" : "-c", args.cmd];
20614
20617
  if (args.runAs) {
@@ -20655,7 +20658,7 @@ var ModalCommandControl = class _ModalCommandControl {
20655
20658
  if (!result.execId) throw new Error("Modal command start returned no execution identity");
20656
20659
  return {
20657
20660
  kind: "modal-control-v1",
20658
- sandboxId: this.sandboxId,
20661
+ sandboxId,
20659
20662
  taskId: task.taskId,
20660
20663
  execId: result.execId,
20661
20664
  ...args.tty ? { pty: true } : {},
@@ -21070,7 +21073,11 @@ function installOpenGeniModalSnapshotPolicy(session) {
21070
21073
  profile: mutable.modal.profile,
21071
21074
  ...mutable.modal.logger ? { logger: mutable.modal.logger } : {}
21072
21075
  },
21073
- mutable.state.sandboxId,
21076
+ () => {
21077
+ const sandboxId = mutable.state?.sandboxId;
21078
+ if (!sandboxId) throw new Error("Modal session sandbox identity is unavailable");
21079
+ return sandboxId;
21080
+ },
21074
21081
  mutable.state.manifest.root,
21075
21082
  () => mutable.state?.environment ?? {}
21076
21083
  )
@@ -36115,4 +36122,4 @@ export {
36115
36122
  collectSandboxEnvironment2 as collectSandboxEnvironment,
36116
36123
  parseExposedPorts2 as parseExposedPorts
36117
36124
  };
36118
- //# sourceMappingURL=chunk-7DAVK6Y5.js.map
36125
+ //# sourceMappingURL=chunk-WATBACLT.js.map