@algosuite/vo-mcp 0.2.0-beta.73 → 0.2.0-beta.74

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.
@@ -314,21 +314,21 @@ function backupConfigOnce(configPath) {
314
314
  copyFileSync(configPath, backupPath);
315
315
  return backupPath;
316
316
  }
317
- function writeFileAtomic(path24, content) {
318
- sweepStaleTempFiles(path24);
319
- const temp = `${path24}.vo-mcp-tmp-${process.pid}-${Date.now()}`;
317
+ function writeFileAtomic(path25, content) {
318
+ sweepStaleTempFiles(path25);
319
+ const temp = `${path25}.vo-mcp-tmp-${process.pid}-${Date.now()}`;
320
320
  try {
321
321
  writeFileSync2(temp, content, { encoding: "utf8", mode: 384 });
322
- if (existsSync3(path24)) {
322
+ if (existsSync3(path25)) {
323
323
  try {
324
- chmodSync2(temp, statSync(path24).mode & 511);
324
+ chmodSync2(temp, statSync(path25).mode & 511);
325
325
  } catch {
326
326
  }
327
327
  }
328
328
  let lastErr = null;
329
329
  for (let attempt = 0; attempt < RENAME_RETRIES; attempt += 1) {
330
330
  try {
331
- renameSync(temp, path24);
331
+ renameSync(temp, path25);
332
332
  return;
333
333
  } catch (err) {
334
334
  lastErr = err;
@@ -337,7 +337,7 @@ function writeFileAtomic(path24, content) {
337
337
  sleepSync(RENAME_RETRY_MS);
338
338
  }
339
339
  }
340
- writeFileSync2(path24, content, "utf8");
340
+ writeFileSync2(path25, content, "utf8");
341
341
  try {
342
342
  unlinkSync2(temp);
343
343
  } catch {
@@ -503,8 +503,8 @@ function tablePath(line) {
503
503
  function tableSections(lines) {
504
504
  const starts = [];
505
505
  for (let index = 0; index < lines.length; index += 1) {
506
- const path24 = tablePath(lines[index] ?? "");
507
- if (path24) starts.push({ path: path24, start: index });
506
+ const path25 = tablePath(lines[index] ?? "");
507
+ if (path25) starts.push({ path: path25, start: index });
508
508
  }
509
509
  return starts.map((section, index) => ({
510
510
  ...section,
@@ -696,11 +696,11 @@ function resolveLinuxConfigHome(home, env2) {
696
696
  const configured = env2["XDG_CONFIG_HOME"]?.trim();
697
697
  return configured && isAbsolute2(configured) ? configured : join5(home, ".config");
698
698
  }
699
- function launcherIsCurrent(path24, desiredContent, label, log2) {
700
- if (!existsSync6(path24)) return false;
701
- if (readFileSync5(path24, "utf8") === desiredContent) return true;
702
- const backupPath = `${path24}.backup-${Date.now()}`;
703
- copyFileSync2(path24, backupPath);
699
+ function launcherIsCurrent(path25, desiredContent, label, log2) {
700
+ if (!existsSync6(path25)) return false;
701
+ if (readFileSync5(path25, "utf8") === desiredContent) return true;
702
+ const backupPath = `${path25}.backup-${Date.now()}`;
703
+ copyFileSync2(path25, backupPath);
704
704
  log2(` Backed up existing ${label} to: ${backupPath}`);
705
705
  return false;
706
706
  }
@@ -916,17 +916,17 @@ function resolveDesktopConfigPath(home, plat, appData) {
916
916
  }
917
917
  return join6(home, ".config", "Claude", "claude_desktop_config.json");
918
918
  }
919
- function readClaudeConfig(path24) {
920
- if (!existsSync7(path24)) return { kind: "absent", config: {}, mtimeMs: null };
919
+ function readClaudeConfig(path25) {
920
+ if (!existsSync7(path25)) return { kind: "absent", config: {}, mtimeMs: null };
921
921
  for (let attempt = 0; attempt < 3; attempt += 1) {
922
- const before = statSync3(path24).mtimeMs;
922
+ const before = statSync3(path25).mtimeMs;
923
923
  let raw;
924
924
  try {
925
- raw = readFileSync6(path24, "utf8");
925
+ raw = readFileSync6(path25, "utf8");
926
926
  } catch {
927
927
  return { kind: "invalid", config: {}, mtimeMs: before };
928
928
  }
929
- if (!existsSync7(path24) || statSync3(path24).mtimeMs !== before) continue;
929
+ if (!existsSync7(path25) || statSync3(path25).mtimeMs !== before) continue;
930
930
  const text = raw.replace(/^\uFEFF/u, "");
931
931
  if (!text.trim()) return { kind: "empty", config: {}, mtimeMs: before };
932
932
  try {
@@ -938,9 +938,9 @@ function readClaudeConfig(path24) {
938
938
  }
939
939
  return { kind: "invalid", config: {}, mtimeMs: null };
940
940
  }
941
- function writeClaudeConfig(path24, config) {
942
- mkdirSync6(dirname4(path24), { recursive: true });
943
- writeFileAtomic(path24, `${JSON.stringify(config, null, 2)}
941
+ function writeClaudeConfig(path25, config) {
942
+ mkdirSync6(dirname4(path25), { recursive: true });
943
+ writeFileAtomic(path25, `${JSON.stringify(config, null, 2)}
944
944
  `);
945
945
  }
946
946
  function carriedEntryKeys(entry) {
@@ -4250,13 +4250,13 @@ async function getTaskKnowledgeContextRequest(req, taskId, { query, knowledgeReq
4250
4250
  const canonicalQuery = canonicalizeKnowledgeContextQuery(query);
4251
4251
  if (canonicalQuery.trim()) body.query = canonicalQuery;
4252
4252
  if (typeof knowledgeRequestId === "string" && knowledgeRequestId) body.knowledge_request_id = knowledgeRequestId;
4253
- const path24 = `/api/v1/code-task/${encodeURIComponent(taskId)}/knowledge-context`;
4253
+ const path25 = `/api/v1/code-task/${encodeURIComponent(taskId)}/knowledge-context`;
4254
4254
  const timeoutMs = Math.max(Number(taskRequestTimeoutMs) || 0, MIN_KNOWLEDGE_CONTEXT_TIMEOUT_MS);
4255
4255
  for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt += 1) {
4256
4256
  let res;
4257
4257
  let cause;
4258
4258
  try {
4259
- res = await req("POST", path24, body, { timeoutMs });
4259
+ res = await req("POST", path25, body, { timeoutMs });
4260
4260
  } catch (err) {
4261
4261
  cause = err;
4262
4262
  }
@@ -4324,10 +4324,10 @@ async function getPreparedJobRequest(req, taskId, options = {}, invalidateToken
4324
4324
  if (typeof taskId !== "string" || taskId.length === 0) {
4325
4325
  return { ok: false, reason: "missing_task_id", status: 0, ...envMeta };
4326
4326
  }
4327
- const path24 = `/api/v1/code-task/${encodeURIComponent(taskId)}/prepared-job?${query}`;
4327
+ const path25 = `/api/v1/code-task/${encodeURIComponent(taskId)}/prepared-job?${query}`;
4328
4328
  let res;
4329
4329
  try {
4330
- res = await req("GET", path24, void 0, { timeoutMs });
4330
+ res = await req("GET", path25, void 0, { timeoutMs });
4331
4331
  } catch (err) {
4332
4332
  return { ok: false, reason: `transport: ${err?.message || String(err)}`, status: 0, ...envMeta };
4333
4333
  }
@@ -4427,11 +4427,11 @@ function createControlPlaneClient({
4427
4427
  if (!resolvedBaseUrl) throw new Error("VO_CONTROL_PLANE_URL is required for the code-runner daemon");
4428
4428
  const root = resolvedBaseUrl.replace(/\/+$/, "");
4429
4429
  const claimOccurrences = /* @__PURE__ */ new Map();
4430
- async function req(method, path24, body, { timeoutMs } = {}) {
4430
+ async function req(method, path25, body, { timeoutMs } = {}) {
4431
4431
  const bearer = await resolveBearer(env2);
4432
4432
  const controller = timeoutMs ? new AbortController() : null;
4433
4433
  let timeoutId;
4434
- const request = Promise.resolve(fetchImpl(`${root}${path24}`, {
4434
+ const request = Promise.resolve(fetchImpl(`${root}${path25}`, {
4435
4435
  method,
4436
4436
  headers: {
4437
4437
  "content-type": "application/json",
@@ -4444,7 +4444,7 @@ function createControlPlaneClient({
4444
4444
  const timeout = new Promise((_, reject) => {
4445
4445
  timeoutId = setTimeout(() => {
4446
4446
  controller.abort();
4447
- reject(new Error(`control-plane ${path24} timed out after ${timeoutMs}ms`));
4447
+ reject(new Error(`control-plane ${path25} timed out after ${timeoutMs}ms`));
4448
4448
  }, timeoutMs);
4449
4449
  });
4450
4450
  try {
@@ -4453,7 +4453,7 @@ function createControlPlaneClient({
4453
4453
  clearTimeout(timeoutId);
4454
4454
  }
4455
4455
  }
4456
- const taskReq = (method, path24, body, options = {}) => req(method, path24, body, { timeoutMs: taskRequestTimeoutMs, ...options });
4456
+ const taskReq = (method, path25, body, options = {}) => req(method, path25, body, { timeoutMs: taskRequestTimeoutMs, ...options });
4457
4457
  const claimGate = makeClaimGateNotice({ log: (m) => console.warn(`[code-runner ${(/* @__PURE__ */ new Date()).toISOString()}] ${m}`) });
4458
4458
  return {
4459
4459
  getClaimGate: () => claimGate.current(),
@@ -4625,8 +4625,8 @@ function createControlPlaneClient({
4625
4625
  return listAllPrOpenedTasks(taskReq);
4626
4626
  },
4627
4627
  async downloadTaskAttachment(taskId, attachmentId) {
4628
- const path24 = `/api/v1/code-task/${encodeURIComponent(taskId)}/attachment/${encodeURIComponent(attachmentId)}`;
4629
- const res = await taskReq("GET", path24);
4628
+ const path25 = `/api/v1/code-task/${encodeURIComponent(taskId)}/attachment/${encodeURIComponent(attachmentId)}`;
4629
+ const res = await taskReq("GET", path25);
4630
4630
  if (res.status === 401) cachedFirebaseToken = null;
4631
4631
  if (!res.ok) throw new Error(`attachment download failed: HTTP ${res.status}`);
4632
4632
  return Buffer.from(await res.arrayBuffer());
@@ -7960,14 +7960,14 @@ function parsePorcelainZ(out) {
7960
7960
  for (let i = 0; i < tokens.length; i += 1) {
7961
7961
  const token2 = tokens[i];
7962
7962
  if (!token2) continue;
7963
- const path24 = token2.slice(3);
7964
- if (path24) files.push(path24);
7963
+ const path25 = token2.slice(3);
7964
+ if (path25) files.push(path25);
7965
7965
  if (token2[0] === "R" || token2[0] === "C") i += 1;
7966
7966
  }
7967
7967
  return files;
7968
7968
  }
7969
- function isAgentScratch(path24) {
7970
- const normalized = String(path24 || "");
7969
+ function isAgentScratch(path25) {
7970
+ const normalized = String(path25 || "");
7971
7971
  return SCRATCH_PATTERNS.some((pattern) => pattern.test(normalized));
7972
7972
  }
7973
7973
  var SCRATCH_PATTERNS;
@@ -10303,9 +10303,9 @@ async function readSpool(spoolDir = SPOOL_DIR) {
10303
10303
  }
10304
10304
  return out;
10305
10305
  }
10306
- async function readCloudMap(path24) {
10306
+ async function readCloudMap(path25) {
10307
10307
  try {
10308
- return JSON.parse(await readFile2(path24, "utf8"));
10308
+ return JSON.parse(await readFile2(path25, "utf8"));
10309
10309
  } catch {
10310
10310
  return {};
10311
10311
  }
@@ -10606,9 +10606,9 @@ function backoffMs(streak, baseMs) {
10606
10606
  if (streak <= 0) return 0;
10607
10607
  return Math.min(baseMs * 2 ** Math.min(streak - 1, 20), MAX_BACKOFF_MS);
10608
10608
  }
10609
- async function loadState(path24) {
10609
+ async function loadState(path25) {
10610
10610
  try {
10611
- const parsed = JSON.parse(await readFile3(path24, "utf8"));
10611
+ const parsed = JSON.parse(await readFile3(path25, "utf8"));
10612
10612
  if (parsed && typeof parsed === "object" && Number.isInteger(parsed.byte_offset) && parsed.byte_offset >= 0) {
10613
10613
  return { ...parsed, byte_offset: parsed.byte_offset };
10614
10614
  }
@@ -10616,15 +10616,15 @@ async function loadState(path24) {
10616
10616
  }
10617
10617
  return { byte_offset: 0, last_event_id: null, forwarded_total: 0, rejected_total: 0, rejected_event_ids: [] };
10618
10618
  }
10619
- async function saveState(path24, state) {
10620
- await mkdir2(dirname9(path24), { recursive: true });
10621
- await writeFile3(path24, JSON.stringify(state, null, 2), "utf8");
10619
+ async function saveState(path25, state) {
10620
+ await mkdir2(dirname9(path25), { recursive: true });
10621
+ await writeFile3(path25, JSON.stringify(state, null, 2), "utf8");
10622
10622
  }
10623
- async function readNewBytes(path24, offset, max) {
10624
- const st = await stat2(path24);
10623
+ async function readNewBytes(path25, offset, max) {
10624
+ const st = await stat2(path25);
10625
10625
  if (st.size <= offset) return { buf: Buffer.alloc(0), size: st.size };
10626
10626
  const length = Math.min(st.size - offset, max);
10627
- const fh = await open(path24, "r");
10627
+ const fh = await open(path25, "r");
10628
10628
  try {
10629
10629
  const buf = Buffer.alloc(length);
10630
10630
  const { bytesRead } = await fh.read(buf, 0, length, offset);
@@ -11742,10 +11742,10 @@ function formatShadowLogLine(record) {
11742
11742
  const loud = record.unexplained_fields?.length ? "!! " : "";
11743
11743
  return `${loud}[prepared-job-shadow] ${parts.join(" ")}`;
11744
11744
  }
11745
- function appendShadowRecord(record, { path: path24 = PREPARED_JOB_SHADOW_SINK, append = appendFileSync, mkdir: mkdir5 = mkdirSync8 } = {}) {
11745
+ function appendShadowRecord(record, { path: path25 = PREPARED_JOB_SHADOW_SINK, append = appendFileSync, mkdir: mkdir5 = mkdirSync8 } = {}) {
11746
11746
  try {
11747
- mkdir5(dirname10(path24), { recursive: true });
11748
- append(path24, `${JSON.stringify(record)}
11747
+ mkdir5(dirname10(path25), { recursive: true });
11748
+ append(path25, `${JSON.stringify(record)}
11749
11749
  `, "utf8");
11750
11750
  return true;
11751
11751
  } catch {
@@ -13209,7 +13209,7 @@ function noteCiViaRest(log2) {
13209
13209
  log2("watch: CI status read via REST check-runs/status (gh's GraphQL rollup needs actions:read for checkSuite.workflowRun, which the read scope does not carry)");
13210
13210
  }
13211
13211
  async function readCommitCiViaRest(repo, sha, { run, env: env2 }) {
13212
- const api = async (path24) => JSON.parse(await run("gh", ["api", path24], { timeout: 3e4, env: env2 }) || "{}");
13212
+ const api = async (path25) => JSON.parse(await run("gh", ["api", path25], { timeout: 3e4, env: env2 }) || "{}");
13213
13213
  const rollup = [];
13214
13214
  let total = null;
13215
13215
  for (let page = 1; page <= REST_MAX_PAGES && (total === null || rollup.length < total); page += 1) {
@@ -13873,9 +13873,9 @@ function buildControlHandler({ getStatus, requestStop, allowedOrigin }) {
13873
13873
  res.end();
13874
13874
  return;
13875
13875
  }
13876
- const path24 = String(req.url || "").split("?")[0];
13876
+ const path25 = String(req.url || "").split("?")[0];
13877
13877
  res.setHeader("content-type", "application/json");
13878
- if (req.method === "GET" && path24 === "/status") {
13878
+ if (req.method === "GET" && path25 === "/status") {
13879
13879
  let status;
13880
13880
  try {
13881
13881
  status = getStatus();
@@ -13886,7 +13886,7 @@ function buildControlHandler({ getStatus, requestStop, allowedOrigin }) {
13886
13886
  res.end(JSON.stringify({ ok: true, ...status }));
13887
13887
  return;
13888
13888
  }
13889
- if (req.method === "POST" && path24 === "/stop") {
13889
+ if (req.method === "POST" && path25 === "/stop") {
13890
13890
  if (!isControlOriginAllowed(req.headers.origin, allowedOrigin) || !req.headers["x-vo-control"]) {
13891
13891
  res.statusCode = 403;
13892
13892
  res.end(JSON.stringify({ ok: false, error: "forbidden" }));
@@ -14921,9 +14921,9 @@ function operatorTierToRung(tier, difficulty, thresholds) {
14921
14921
  if (tier === "best" && difficulty >= thresholds.rungBounds.R5) return "R5";
14922
14922
  return base;
14923
14923
  }
14924
- function readCodexModelsCache({ path: path24 = DEFAULT_CODEX_MODELS_CACHE, read = readFileSync9 } = {}) {
14924
+ function readCodexModelsCache({ path: path25 = DEFAULT_CODEX_MODELS_CACHE, read = readFileSync9 } = {}) {
14925
14925
  try {
14926
- const parsed = JSON.parse(read(path24, "utf8"));
14926
+ const parsed = JSON.parse(read(path25, "utf8"));
14927
14927
  return Array.isArray(parsed?.models) ? parsed : null;
14928
14928
  } catch {
14929
14929
  return null;
@@ -15180,15 +15180,15 @@ function formatDecisionReason(decision, maxLen = 480) {
15180
15180
  const s = `[${decision.routerVersion}] ${decision.taskClass} d=${decision.difficulty} c=${decision.confidence} \u2192 ${decision.rung}/${decision.tier}${decision.effort ? ` effort=${decision.effort}` : ""} turns=${decision.maxTurns} $${decision.maxBudgetUsd}${decision.flags.length ? ` [${decision.flags.join(",")}]` : ""} :: ${decision.reasons.join("; ")}`;
15181
15181
  return s.length > maxLen ? `${s.slice(0, maxLen - 1)}\u2026` : s;
15182
15182
  }
15183
- function appendDecisionFallback(decision, { path: path24 = DECISION_FALLBACK_PATH, append = appendFileSync2, mkdir: mkdir5 = mkdirSync9, task, thresholds, roleCostInputs } = {}) {
15183
+ function appendDecisionFallback(decision, { path: path25 = DECISION_FALLBACK_PATH, append = appendFileSync2, mkdir: mkdir5 = mkdirSync9, task, thresholds, roleCostInputs } = {}) {
15184
15184
  try {
15185
- mkdir5(dirname12(path24), { recursive: true });
15186
- append(path24, `${JSON.stringify(decision)}
15185
+ mkdir5(dirname12(path25), { recursive: true });
15186
+ append(path25, `${JSON.stringify(decision)}
15187
15187
  `, "utf8");
15188
15188
  if (isRouterDecision(decision)) {
15189
15189
  try {
15190
15190
  const records = buildShadowRecords({ decision, task, thresholds: thresholds || loadThresholds(), roleCostInputs });
15191
- for (const record of records) append(path24, `${JSON.stringify(record)}
15191
+ for (const record of records) append(path25, `${JSON.stringify(record)}
15192
15192
  `, "utf8");
15193
15193
  } catch {
15194
15194
  }
@@ -16711,7 +16711,7 @@ async function processSkillTask(client, task, cfg, {
16711
16711
  resolveDispatch = resolveEffortDispatch,
16712
16712
  checkSkillCapability = ({ runner, bin, env: capabilityEnv }) => typeof runner.checkSkillCapability === "function" ? runner.checkSkillCapability({ bin, env: capabilityEnv }) : { compatible: false, reason: "resolved runner has no restricted-skill capability probe" },
16713
16713
  createScratch = () => mkdtemp2(join19(tmpdir(), "algohq-skill-task-")),
16714
- removeScratch = (path24) => rm2(path24, { recursive: true, force: true })
16714
+ removeScratch = (path25) => rm2(path25, { recursive: true, force: true })
16715
16715
  } = {}) {
16716
16716
  const id = task.code_task_id;
16717
16717
  let run = null;
@@ -18658,6 +18658,72 @@ var init_task_worktree_preparation = __esm({
18658
18658
  }
18659
18659
  });
18660
18660
 
18661
+ // ../../scripts/virtual-office/code-runner/preflight-clone-dir.mjs
18662
+ import fs14 from "node:fs";
18663
+ import path24 from "node:path";
18664
+ function sanitize2(value, fallback) {
18665
+ const cleaned = String(value || "").trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
18666
+ return cleaned || fallback;
18667
+ }
18668
+ function cloneDirForServedRepo(repoSlug, clonesRootDir) {
18669
+ if (!clonesRootDir || !path24.isAbsolute(String(clonesRootDir))) return null;
18670
+ if (!repoSlug || !VALID_REPO_SLUG2.test(String(repoSlug))) return null;
18671
+ const [owner, name] = String(repoSlug).split("/");
18672
+ if (owner === "." || owner === ".." || name === "." || name === "..") return null;
18673
+ if (owner.startsWith("-") || name.startsWith("-")) return null;
18674
+ return path24.join(clonesRootDir, `${sanitize2(owner, "owner")}__${sanitize2(name, "repo")}`);
18675
+ }
18676
+ function resolvePreflightCwd(cfg = {}, env2 = process.env) {
18677
+ const clonesRoot2 = String(env2?.VO_CODE_RUNNER_CLONES_ROOT || "").trim();
18678
+ const served = Array.isArray(cfg?.servedRepos) ? cfg.servedRepos : [];
18679
+ for (const repo of served) {
18680
+ const dir = cloneDirForServedRepo(repo, clonesRoot2);
18681
+ if (dir) return dir;
18682
+ }
18683
+ return String(env2?.VO_CODE_RUNNER_REPO || "").trim() || process.cwd();
18684
+ }
18685
+ function isGitWorkingTree(dir, { exists = fs14.existsSync } = {}) {
18686
+ if (!dir) return false;
18687
+ try {
18688
+ return exists(path24.join(dir, ".git")) === true;
18689
+ } catch {
18690
+ return false;
18691
+ }
18692
+ }
18693
+ function describeMissingClone(health, dir) {
18694
+ const note = `no git clone at ${dir} yet \u2014 the first task creates it; git fetch not probed`;
18695
+ if (!health) return health;
18696
+ if (blockingReason(health)) return { ...health, git: UNKNOWN };
18697
+ return { ...health, git: UNKNOWN, detail: `${note}; ${health.detail ?? ""}`.slice(0, 500) };
18698
+ }
18699
+ function makeServedClonePreflight({
18700
+ cfg = {},
18701
+ preflight = runHostPreflight,
18702
+ exists = fs14.existsSync
18703
+ } = {}) {
18704
+ return async function servedClonePreflight(options = {}) {
18705
+ const env2 = options.env ?? process.env;
18706
+ const dir = resolvePreflightCwd(cfg, env2);
18707
+ if (!isGitWorkingTree(dir, { exists })) {
18708
+ return describeMissingClone(await preflight({ ...options, cwd: null }), dir);
18709
+ }
18710
+ const health = await preflight({ ...options, cwd: dir });
18711
+ if (health && blockingReason(health) === health.git && NOT_A_REPOSITORY_RE.test(String(health.detail ?? ""))) {
18712
+ return describeMissingClone(await preflight({ ...options, cwd: null }), dir);
18713
+ }
18714
+ return health;
18715
+ };
18716
+ }
18717
+ var VALID_REPO_SLUG2, NOT_A_REPOSITORY_RE;
18718
+ var init_preflight_clone_dir = __esm({
18719
+ "../../scripts/virtual-office/code-runner/preflight-clone-dir.mjs"() {
18720
+ "use strict";
18721
+ init_host_preflight();
18722
+ VALID_REPO_SLUG2 = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/u;
18723
+ NOT_A_REPOSITORY_RE = /not a git repository|does not appear to be a git repos/iu;
18724
+ }
18725
+ });
18726
+
18661
18727
  // ../../scripts/virtual-office/code-runner-daemon.mjs
18662
18728
  var code_runner_daemon_exports = {};
18663
18729
  __export(code_runner_daemon_exports, {
@@ -18985,7 +19051,7 @@ async function main({ env: env2 = process.env, once: once2 = false } = {}) {
18985
19051
  const agentAvailability = makeAgentAvailabilityProvider({ onError: (e) => log(`agent probe failed: ${e.message}`) });
18986
19052
  await agentAvailability.ready();
18987
19053
  const accountUsage = makeAccountUsageProvider();
18988
- const hostGate = makeHostPreflightGate({ cwd: process.cwd(), runGit: runProcess2, runAgent: runProcess2, bin: cfg.runnerBin, agent: cfg.agent, env: env2, log });
19054
+ const hostGate = makeHostPreflightGate({ preflight: makeServedClonePreflight({ cfg }), runGit: runProcess2, runAgent: runProcess2, bin: cfg.runnerBin, agent: cfg.agent, env: env2, log });
18989
19055
  const loopTick = makeLoopTicks({ client, cfg, env: env2, log, getActive: () => active, runnerInstanceId, capacityController, localModelController: createLocalModelRemoteController({ env: env2, log }), preparedJobController: createPreparedJobRemoteController({ log }), getAgentAvailability: () => agentAvailability.get(), getAccountUsage: () => accountUsage.get(), getHostHealth: () => hostGate.get() });
18990
19056
  const backoff = makeReconnectBackoff({ baseMs: cfg.pollSec * 1e3, log });
18991
19057
  let detachedFlushRunning = false;
@@ -19129,6 +19195,7 @@ var init_code_runner_daemon = __esm({
19129
19195
  init_task_worktree_preparation();
19130
19196
  init_process_runner2();
19131
19197
  init_host_preflight();
19198
+ init_preflight_clone_dir();
19132
19199
  init_detached_economics_spool();
19133
19200
  RATE_LIMIT_RESUME_ENABLED = process.env.VO_RATE_LIMIT_RESUME !== "0";
19134
19201
  sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));