@tablation/crew 0.131.0 → 0.131.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.
Files changed (2) hide show
  1. package/dist/cli.js +43 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -13508,6 +13508,14 @@ git -C "$m" rev-parse --verify --quiet "refs/heads/$base^{commit}" >/dev/null ||
13508
13508
  git -C "$m" cat-file -e "refs/heads/$base:$path" 2>/dev/null || exit 4
13509
13509
  git -C "$m" show "refs/heads/$base:$path"
13510
13510
  `;
13511
+ var LIST_SCRIPT = `
13512
+ set -e
13513
+ export GIT_TERMINAL_PROMPT=0
13514
+ m=${VOLUME_ROOT}/"$1"; base="$2"
13515
+ git config --global --add safe.directory '*'
13516
+ git -C "$m" rev-parse --verify --quiet "refs/heads/$base^{commit}" >/dev/null || { echo "the mirror has no branch $base" >&2; exit 3; }
13517
+ git -C "$m" ls-tree -r --name-only "refs/heads/$base"
13518
+ `;
13511
13519
  var SandboxCache = class {
13512
13520
  s;
13513
13521
  exec;
@@ -13618,6 +13626,11 @@ var SandboxCache = class {
13618
13626
  throw e;
13619
13627
  }
13620
13628
  }
13629
+ /** Every file path at the tip of `base` in the mirror (CREW-3010). Throws when the mirror or branch is absent. */
13630
+ async listFiles(repo, base) {
13631
+ const { stdout } = await this.helper(this.s.helperImage, LIST_SCRIPT, [mirrorRelPath(repo), base]);
13632
+ return stdout.split("\n").filter(Boolean);
13633
+ }
13621
13634
  /** Mirrors in the volume with their last refresh; empty when the volume does not exist. */
13622
13635
  async list() {
13623
13636
  try {
@@ -20157,6 +20170,20 @@ async function readMirrorContract(cache, repo, base) {
20157
20170
  }
20158
20171
  return null;
20159
20172
  }
20173
+ async function readMirrorWarmFiles(cache, repo, base, patterns) {
20174
+ if (patterns.length === 0) return {};
20175
+ const res = patterns.map(globToRegExp);
20176
+ const out = {};
20177
+ let total = 0;
20178
+ for (const path of (await cache.listFiles(repo, base)).filter((f) => res.some((re) => re.test(f))).sort()) {
20179
+ const content = await cache.showFile(repo, base, path);
20180
+ if (content === null) continue;
20181
+ total += content.length;
20182
+ if (total > WARM_MAX_BYTES) throw new Error(`sandbox.warm files exceed ${WARM_MAX_BYTES} bytes`);
20183
+ out[path] = content;
20184
+ }
20185
+ return out;
20186
+ }
20160
20187
  function noCheckoutReleaseNote(repo, mode) {
20161
20188
  if (mode === "external") {
20162
20189
  return `${repo}: no checkout on this ship; release.mode "external" repositories are handed off by a ship with a checkout`;
@@ -26942,10 +26969,24 @@ ${changed2.map((c) => ` - ${c}
26942
26969
  for (const c of routes) {
26943
26970
  const { settled } = await settleRepos(reposOf(c), (t) => t.name, (t) => resolveOneRepo(c, t));
26944
26971
  for (const r of settled) if (r.config.sandbox && !out.has(r.name)) {
26972
+ const patterns = r.config.sandbox.warm ?? [];
26973
+ const base = r.config.branch.base;
26945
26974
  let warm = {};
26975
+ const target = reposOf(c).find((t) => t.name === r.name);
26976
+ const noCheckout = lacksCheckout(cfg.ship, r.dir);
26977
+ const mirror = target && noCheckout ? mirrorRepoOfTarget(target) : null;
26978
+ const settings = cfg.ship.runner === "sandbox" ? cacheSettingsOf(cfg.ship.sandbox) : null;
26979
+ const source = mirror ? `the mirror of ${mirror.host}/${mirror.path} at ${base}` : `${r.dir} at ${r.config.branch.remote}/${base}`;
26980
+ let failure = "";
26946
26981
  try {
26947
- warm = readWarmFiles(r.dir, `${r.config.branch.remote}/${r.config.branch.base}`, r.config.sandbox.warm ?? []);
26948
- } catch {
26982
+ if (mirror && settings) warm = await readMirrorWarmFiles(new SandboxCache(settings), mirror, base, patterns);
26983
+ else if (!noCheckout) warm = readWarmFiles(r.dir, `${r.config.branch.remote}/${base}`, patterns);
26984
+ else failure = "no checkout and no mirror to read";
26985
+ } catch (e) {
26986
+ failure = e instanceof Error ? e.message.split("\n")[0] : String(e);
26987
+ }
26988
+ if (patterns.length > 0 && Object.keys(warm).length === 0 && firstReport(`warm-empty:${r.name}:${failure}`)) {
26989
+ emit.emit(`${r.name}: sandbox.warm declares ${patterns.join(", ")} but no file could be read from ${source}${failure ? ` (${failure})` : ""}; the image is built without warm files`);
26949
26990
  }
26950
26991
  out.set(r.name, { name: r.name, decl: intelFlavor(r.config.hooks.intel) === "serena" ? { ...r.config.sandbox, intel: "serena" } : r.config.sandbox, warm, ...wantsCodeBridge(r.config.hooks.intel) ? { bridge: readBridgeBundle() } : {} });
26951
26992
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.131.0",
3
+ "version": "0.131.1",
4
4
  "description": "A standing team of headless agents that picks work off a Tablation board, does it on a machine you control, and reports back.",
5
5
  "type": "module",
6
6
  "license": "MIT",