@opengeni/runtime 0.14.1 → 0.14.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.
@@ -10647,17 +10647,27 @@ function getHostDockerUser() {
10647
10647
  }
10648
10648
 
10649
10649
  // src/sandbox/providers/docker.ts
10650
+ import { isAbsolute as isAbsolute4 } from "path";
10650
10651
  var dockerProvider = {
10651
10652
  backend: "docker",
10652
10653
  descriptor: CAPABILITY_DESCRIPTORS.docker,
10653
10654
  // Local dev container — no credentials. (The dockerNetwork decoration is
10654
10655
  // applied by the factory, not here: it wraps the constructed client.)
10655
- validateCredentials() {
10656
+ validateCredentials(settings) {
10657
+ const workspaceBaseDir = settings.dockerWorkspaceBaseDir?.trim();
10658
+ if (workspaceBaseDir && !isAbsolute4(workspaceBaseDir)) {
10659
+ throw new SandboxConfigError(
10660
+ "docker",
10661
+ "OPENGENI_DOCKER_WORKSPACE_BASE_DIR must be an absolute path"
10662
+ );
10663
+ }
10656
10664
  },
10657
10665
  build({ settings, exposedPorts }) {
10666
+ const workspaceBaseDir = settings.dockerWorkspaceBaseDir?.trim();
10658
10667
  return new DockerSandboxClient({
10659
10668
  image: settings.dockerImage,
10660
- exposedPorts
10669
+ exposedPorts,
10670
+ ...workspaceBaseDir ? { workspaceBaseDir } : {}
10661
10671
  });
10662
10672
  }
10663
10673
  };
@@ -20525,7 +20535,11 @@ var RoutingSandboxSession = class {
20525
20535
  if (!s.materializeEntry) {
20526
20536
  throw new RoutingUnsupportedError("materializeEntry", this.cached?.kind ?? "unknown");
20527
20537
  }
20528
- return s.materializeEntry(args);
20538
+ await s.materializeEntry(args);
20539
+ const path = args && typeof args === "object" && typeof args.path === "string" ? args.path : null;
20540
+ if (path) {
20541
+ await assertProviderCanSeeMaterializedPath(s, path);
20542
+ }
20529
20543
  });
20530
20544
  }
20531
20545
  /** PTY support reflects the LAST-resolved backend (a synchronous probe; the SDK
@@ -20589,6 +20603,39 @@ var RoutingSandboxSession = class {
20589
20603
  return this.resolve();
20590
20604
  }
20591
20605
  };
20606
+ var MATERIALIZED_PATH_MARKER = "__OPENGENI_MATERIALIZED_PATH_VISIBLE__";
20607
+ async function assertProviderCanSeeMaterializedPath(session, path) {
20608
+ const command = `test -e ${shellSingleQuote(path)} && printf %s ${shellSingleQuote(
20609
+ MATERIALIZED_PATH_MARKER
20610
+ )}`;
20611
+ const args = {
20612
+ cmd: command,
20613
+ workdir: providerManifestRoot(session) ?? "/workspace",
20614
+ shell: "sh",
20615
+ login: false,
20616
+ tty: false
20617
+ };
20618
+ let output;
20619
+ if (session.execCommand) {
20620
+ output = await session.execCommand(args);
20621
+ } else if (session.exec) {
20622
+ output = formatExecResult(await session.exec(args));
20623
+ } else {
20624
+ throw new RoutingUnsupportedError("materializeEntry.verify", "unknown");
20625
+ }
20626
+ if (!output.includes(MATERIALIZED_PATH_MARKER)) {
20627
+ throw new Error(
20628
+ `Sandbox materialization completed but the provider cannot read the destination path: ${path}`
20629
+ );
20630
+ }
20631
+ }
20632
+ function providerManifestRoot(session) {
20633
+ const root = session.state?.manifest?.root;
20634
+ return typeof root === "string" && root.length > 0 ? root : null;
20635
+ }
20636
+ function shellSingleQuote(value) {
20637
+ return `'${value.replaceAll("'", `'"'"'`)}'`;
20638
+ }
20592
20639
 
20593
20640
  // src/sandbox/turn-tool-cancellation.ts
20594
20641
  var TURN_EXEC_YIELD_MS = 250;
@@ -24065,4 +24112,4 @@ export {
24065
24112
  collectSandboxEnvironment2 as collectSandboxEnvironment,
24066
24113
  parseExposedPorts2 as parseExposedPorts
24067
24114
  };
24068
- //# sourceMappingURL=chunk-HHWIZHQM.js.map
24115
+ //# sourceMappingURL=chunk-GQIFSLAC.js.map