@odla-ai/harness 0.11.8 → 0.11.9

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.
@@ -7,7 +7,7 @@ import {
7
7
  createCodeRuntimeControlClient,
8
8
  createCodeRuntimeSessionSkillLoader,
9
9
  runCodeRuntimeHeartbeatLoop
10
- } from "./chunk-NUDKRYL4.js";
10
+ } from "./chunk-X5KT7NHM.js";
11
11
  import "./chunk-INL642J5.js";
12
12
  import {
13
13
  assertPinnedImage,
package/dist/node.cjs CHANGED
@@ -1704,8 +1704,9 @@ var import_node_process2 = require("process");
1704
1704
  var import_node_crypto2 = require("crypto");
1705
1705
  var ARTIFACT_PATH = /^[A-Za-z0-9_@+.,-]+(?:\/[A-Za-z0-9_@+.,-]+)*$/;
1706
1706
  var PRIVATE_ARTIFACT_PART = /^(?:\.git|\.odla|\.wrangler|\.env(?:\..+)?|\.dev\.vars|credentials(?:\..+)?\.json)$/i;
1707
- function buildRecipeContainerArgs(engine, workspaceDir, recipe2, name = `odla-recipe-${(0, import_node_crypto2.randomUUID)().slice(0, 12)}`) {
1707
+ function buildRecipeContainerArgs(engine, workspaceDir, recipe2, name = `odla-recipe-${(0, import_node_crypto2.randomUUID)().slice(0, 12)}`, dependencies = null) {
1708
1708
  assertCodeBuildRecipe(recipe2);
1709
+ const mounts = dependencies ? [dependencyMount(engine, dependencies)] : [];
1709
1710
  if (/[,\r\n]/.test(workspaceDir)) throw new TypeError("workspace path contains unsupported mount characters");
1710
1711
  const uid = typeof import_node_process2.getuid === "function" ? (0, import_node_process2.getuid)() : 1e3;
1711
1712
  const gid = typeof import_node_process2.getgid === "function" ? (0, import_node_process2.getgid)() : 1e3;
@@ -1728,6 +1729,7 @@ function buildRecipeContainerArgs(engine, workspaceDir, recipe2, name = `odla-re
1728
1729
  `--user=${uid}:${gid}`,
1729
1730
  "--tmpfs=/tmp",
1730
1731
  `--mount=type=bind,source=${workspaceDir},target=/workspace`,
1732
+ ...mounts,
1731
1733
  "--workdir=/workspace",
1732
1734
  "--env=CI=1",
1733
1735
  recipe2.image,
@@ -1749,18 +1751,28 @@ function buildRecipeContainerArgs(engine, workspaceDir, recipe2, name = `odla-re
1749
1751
  `--user=${uid}:${gid}`,
1750
1752
  `--tmpfs=/tmp:rw,noexec,nosuid,nodev,size=${limits.tmpfs}`,
1751
1753
  `--mount=type=bind,src=${workspaceDir},dst=/workspace`,
1754
+ ...mounts,
1752
1755
  "--workdir=/workspace",
1753
1756
  "--env=CI=1",
1754
1757
  recipe2.image,
1755
1758
  ...recipe2.command
1756
1759
  ];
1757
1760
  }
1758
- function createContainerRecipeExecutor(engine) {
1761
+ var LENDABLE = /* @__PURE__ */ new Set(["node_modules", "dist", "coverage"]);
1762
+ function dependencyMount(engine, dependencies) {
1763
+ const mountAs = dependencies.mountAs ?? "node_modules";
1764
+ if (!dependencies.source.startsWith("/") || /[,\r\n]/.test(dependencies.source)) {
1765
+ throw new TypeError("recipe dependency source must be an absolute path without mount separators");
1766
+ }
1767
+ if (!LENDABLE.has(mountAs)) throw new TypeError(`recipe dependencies must mount at a reserved name, not "${mountAs}"`);
1768
+ return engine === "container" ? `--mount=type=bind,source=${dependencies.source},target=/workspace/${mountAs},readonly` : `--mount=type=bind,src=${dependencies.source},dst=/workspace/${mountAs},readonly`;
1769
+ }
1770
+ function createContainerRecipeExecutor(engine, options = {}) {
1759
1771
  return {
1760
1772
  async run(input) {
1761
1773
  await verifyContainerEngineBoundary(engine);
1762
1774
  const name = `odla-recipe-${(0, import_node_crypto2.randomUUID)().slice(0, 12)}`;
1763
- const args = buildRecipeContainerArgs(engine, input.workspaceDir, input.recipe, name);
1775
+ const args = buildRecipeContainerArgs(engine, input.workspaceDir, input.recipe, name, options.dependencies ?? null);
1764
1776
  return execute(engine, args, name, input.recipe, input.signal);
1765
1777
  }
1766
1778
  };
@@ -4769,7 +4781,7 @@ var TheseusRuntimeEngine = class {
4769
4781
  this.#checkpoints = new CodeRuntimeCheckpointManager({
4770
4782
  control: options.control,
4771
4783
  recipes: options.recipes,
4772
- recipeExecutor: options.recipeExecutor ?? createContainerRecipeExecutor(options.engine),
4784
+ recipeExecutor: options.recipeExecutor ?? createContainerRecipeExecutor(options.engine, { dependencies: options.recipeDependencies ?? null }),
4773
4785
  fallbackPolicyDigest: this.#buildPolicyDigest,
4774
4786
  event: (command, event, refs) => this.#event(command, event, refs)
4775
4787
  });
@@ -4877,7 +4889,7 @@ var TheseusRuntimeEngine = class {
4877
4889
  active.done = startGoalPursuit({
4878
4890
  spec,
4879
4891
  recipes: active.recipes,
4880
- recipeExecutor: this.options.recipeExecutor ?? createContainerRecipeExecutor(this.options.engine),
4892
+ recipeExecutor: this.options.recipeExecutor ?? createContainerRecipeExecutor(this.options.engine, { dependencies: this.options.recipeDependencies ?? null }),
4881
4893
  workspace: active.workspace,
4882
4894
  baseCommitSha: active.baseCommitSha,
4883
4895
  trustedBaseDigest: active.trustedBaseDigest,