@mrrlin-dev/mcp 0.4.249 → 0.4.251

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/bin.cjs +50 -18
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -78549,9 +78549,9 @@ function createMrrlinClient(config2) {
78549
78549
  }
78550
78550
  return { id: data.id, mayDispatch: data.mayDispatch };
78551
78551
  },
78552
- async claimExecutionRun(projectSlug, runId) {
78552
+ async claimExecutionRun(projectSlug, runId, options) {
78553
78553
  try {
78554
- const body = await request(`${projectPath(projectSlug)}/execution-runs/${encodeURIComponent(runId)}/claim`, { method: "POST" });
78554
+ const body = await request(`${projectPath(projectSlug)}/execution-runs/${encodeURIComponent(runId)}/claim`, options?.progressLease ? { method: "POST", headers: { "x-mrrlin-lease-mode": "progress" } } : { method: "POST" });
78555
78555
  return executionRunClaimResponseSchema.parse(body).data;
78556
78556
  } catch (error51) {
78557
78557
  if (error51 instanceof MrrlinApiError && error51.status === 409)
@@ -101893,7 +101893,7 @@ function withAuth(options) {
101893
101893
  const authedFetch = async (input, init = {}) => {
101894
101894
  const headers = new Headers(init.headers ?? {});
101895
101895
  const bearerFile = process.env.MRRLIN_EXECUTOR_BEARER_FILE;
101896
- if (isExecutorThread() && (bearerFile || process.env.MRRLIN_EXECUTOR_RUN_ID || process.env.MRRLIN_EXECUTOR_LEASE_ID || process.env.MRRLIN_F54_PROGRESS_LEASE === "1")) {
101896
+ if (isExecutorThread() && (bearerFile || process.env.MRRLIN_EXECUTOR_RUN_ID || process.env.MRRLIN_EXECUTOR_LEASE_ID)) {
101897
101897
  if (!bearerFile) throw new Error("Executor credential is unavailable");
101898
101898
  const token2 = (await (0, import_promises12.readFile)(bearerFile, "utf8")).trim();
101899
101899
  if (!token2.startsWith("mrrlin_executor_v1.")) throw new Error("Executor credential is unavailable");
@@ -101959,7 +101959,7 @@ function pingAsyncWorkerDispatch(projectSlug, jobId) {
101959
101959
  }
101960
101960
  async function deliverBuiltIn(client, projectSlug, artifactKind, payload, extra = {}) {
101961
101961
  const capability = resolveKindCapability(artifactKind);
101962
- if (isExecutorThread() && (process.env.MRRLIN_EXECUTOR_BEARER_FILE || process.env.MRRLIN_EXECUTOR_LEASE_ID) && capability !== "wiki") {
101962
+ if (isExecutorThread() && (process.env.MRRLIN_EXECUTOR_BEARER_FILE || process.env.MRRLIN_EXECUTOR_LEASE_ID) && capability !== "wiki" && capability !== "artifacts") {
101963
101963
  throw new McpToolCodedError(
101964
101964
  "EXECUTION_RUN_EFFECT_UNAVAILABLE",
101965
101965
  "This destination cannot receive writes from an execution lease."
@@ -106855,7 +106855,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
106855
106855
  }
106856
106856
 
106857
106857
  // src/_generated/version.ts
106858
- var PKG_VERSION = "0.4.249";
106858
+ var PKG_VERSION = "0.4.251";
106859
106859
 
106860
106860
  // src/bridge-allowed-origins.ts
106861
106861
  var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
@@ -113310,6 +113310,14 @@ async function unlockColdWorkWorktreeWithGit(worktreePath, signal) {
113310
113310
  await gitOutput(worktreePath, ["worktree", "unlock", worktreePath], signal);
113311
113311
  }
113312
113312
  var COLD_WORK_RECONCILED_STATUSES = /* @__PURE__ */ new Set(["done", "failed", "cancelled", "pull_request", "dev_deploy", "prod_deploy", "handoff_queued"]);
113313
+ function resolveF74ColdWork(supervised, env = process.env) {
113314
+ const raw = (env.MRRLIN_F74_COLD_WORK_ENABLED ?? "").trim().toLowerCase();
113315
+ if (raw === "0" || raw === "false") return false;
113316
+ return raw === "1" || raw === "true" || supervised;
113317
+ }
113318
+ function f74ColdWorkPossibleOnHost(env = process.env, drainServiceInstalled = () => readDrainServiceEndpoint() !== null) {
113319
+ return resolveF74ColdWork(drainServiceInstalled(), env);
113320
+ }
113313
113321
  function defaultDrainSupervisor() {
113314
113322
  const endpoint = readDrainServiceEndpoint();
113315
113323
  if (!endpoint) return null;
@@ -113438,17 +113446,32 @@ async function releaseRestartedWorktrees(deps, projectSlug, runId) {
113438
113446
  }));
113439
113447
  }
113440
113448
  }
113441
- async function driveRun(deps, projectSlug, runId, shutdown) {
113442
- if (shutdown?.aborted) return;
113443
- const progressLease = process.env.MRRLIN_F54_PROGRESS_LEASE === "1";
113444
- if (progressLease) {
113449
+ function f54ProgressRequested(env = process.env) {
113450
+ const raw = (env.MRRLIN_F54_PROGRESS_LEASE ?? "").trim().toLowerCase();
113451
+ return raw === "1" || raw === "true";
113452
+ }
113453
+ function resolveF54ProgressLease(containable, env = process.env) {
113454
+ return f54ProgressRequested(env) && containable;
113455
+ }
113456
+ async function claimIsContainable(deps, supervisor) {
113457
+ if (deps.verifyContainment || process.platform === "win32") {
113445
113458
  try {
113446
113459
  await (deps.verifyContainment ?? verifyOwnedExecutionContainment)();
113460
+ return true;
113447
113461
  } catch {
113448
- console.warn(JSON.stringify({ event: "execution_lease_containment_unavailable", projectSlug, runId }));
113449
- return;
113462
+ return false;
113450
113463
  }
113451
113464
  }
113465
+ return process.platform === "linux" && supervisor !== null && await supervisor.healthy().catch(() => false);
113466
+ }
113467
+ async function driveRun(deps, projectSlug, runId, shutdown) {
113468
+ if (shutdown?.aborted) return;
113469
+ const supervisor = deps.drainSupervisor === void 0 ? defaultDrainSupervisor() : deps.drainSupervisor;
113470
+ const requested = f54ProgressRequested();
113471
+ const askProgress = requested ? resolveF54ProgressLease(await claimIsContainable(deps, supervisor)) : false;
113472
+ if (requested && !askProgress) {
113473
+ console.warn(JSON.stringify({ event: "execution_lease_containment_unavailable", projectSlug, runId, mode: "legacy" }));
113474
+ }
113452
113475
  const started = import_node_perf_hooks.performance.now();
113453
113476
  const wallStarted = Date.now();
113454
113477
  let elapsedHighWater = 0;
@@ -113458,8 +113481,9 @@ async function driveRun(deps, projectSlug, runId, shutdown) {
113458
113481
  };
113459
113482
  if (shutdown?.aborted) return;
113460
113483
  const claimStartedMonotonicMs = elapsed();
113461
- const claimed = await deps.client.claimExecutionRun(projectSlug, runId);
113484
+ const claimed = askProgress ? await deps.client.claimExecutionRun(projectSlug, runId, { progressLease: true }) : await deps.client.claimExecutionRun(projectSlug, runId);
113462
113485
  if (!claimed) return;
113486
+ const progressLease = askProgress && typeof claimed.executorBearer === "string" && claimed.executorBearer.length > 0;
113463
113487
  if (!claimed.leaseId) {
113464
113488
  if (progressLease) {
113465
113489
  console.warn(JSON.stringify({ event: "execution_lease_window_unavailable", projectSlug, runId }));
@@ -113484,12 +113508,15 @@ async function driveRun(deps, projectSlug, runId, shutdown) {
113484
113508
  }), 3e3, "execution_lease_setup_release_timeout").catch(() => {
113485
113509
  });
113486
113510
  };
113487
- const supervisor = deps.drainSupervisor === void 0 ? defaultDrainSupervisor() : deps.drainSupervisor;
113488
113511
  const supervision = supervisor && await supervisor.healthy().catch(() => false) ? await openDrainSupervision(client, supervisor, projectSlug, runId, leaseId) : null;
113489
113512
  if (supervision === "refused") {
113490
113513
  await releaseUnstartedClaim("drain_supervision_unavailable");
113491
113514
  return;
113492
113515
  }
113516
+ if (progressLease && !supervision && process.platform !== "win32" && !deps.verifyContainment) {
113517
+ await releaseUnstartedClaim("drain_supervision_unavailable");
113518
+ return;
113519
+ }
113493
113520
  const runDeps = supervision ? { ...deps, attemptSupervision: supervision.attempt } : deps;
113494
113521
  try {
113495
113522
  if (supervision) {
@@ -113715,7 +113742,7 @@ async function driveClaimedRun(deps, projectSlug, runId, claimed, leaseId) {
113715
113742
  const legacy = explicitLegacyTurnTimeoutMs();
113716
113743
  return legacy != null ? Math.min(legacy, remaining) : remaining;
113717
113744
  };
113718
- const f74ColdWorkEnabled = process.env.MRRLIN_F74_COLD_WORK_ENABLED === "1";
113745
+ const f74ColdWorkEnabled = resolveF74ColdWork(deps.attemptSupervision !== void 0);
113719
113746
  const f67BackgroundGateEnabled = process.env.MRRLIN_F67_BACKGROUND_GATE_ENABLED === "1";
113720
113747
  const task = await deps.client.getTask(projectSlug, claimed.taskId);
113721
113748
  deps.activeLease?.progress();
@@ -116915,6 +116942,11 @@ async function driveClaimableAsyncJob(deps, projectSlug, jobId, preClaimJob, sec
116915
116942
  try {
116916
116943
  await (deps.verifyContainment ?? verifyOwnedExecutionContainment)();
116917
116944
  } catch {
116945
+ console.warn(JSON.stringify({
116946
+ event: secureReport ? "report_job_containment_unavailable" : "async_job_containment_unavailable",
116947
+ projectSlug,
116948
+ jobId
116949
+ }));
116918
116950
  return;
116919
116951
  }
116920
116952
  if (shutdown.aborted) return;
@@ -125793,7 +125825,7 @@ function reportAutopilotLimitPause2(client, reason, resetAt) {
125793
125825
  });
125794
125826
  }
125795
125827
  async function runOrphanWorktreeSweep(client, opts) {
125796
- if (process.env.MRRLIN_F74_COLD_WORK_ENABLED === "1") return;
125828
+ if (f74ColdWorkPossibleOnHost()) return;
125797
125829
  const cutoff = Date.now() - worktreeRetentionMs();
125798
125830
  const isReapable = (worktreePath) => {
125799
125831
  try {
@@ -128177,7 +128209,7 @@ async function startBridge(startupDeps, agentSecret, startupRollback) {
128177
128209
  sink({ type: "async-result", directorSessionId, projectSlug: slug, deliveryKind, body });
128178
128210
  }
128179
128211
  };
128180
- const progressExecution = process.env.MRRLIN_F54_PROGRESS_LEASE === "1";
128212
+ const progressExecution = f54ProgressRequested();
128181
128213
  let executionStopping = false;
128182
128214
  const activeDrives = /* @__PURE__ */ new Map();
128183
128215
  const driveTracked = (slug, runId) => {
@@ -128196,7 +128228,7 @@ async function startBridge(startupDeps, agentSecret, startupRollback) {
128196
128228
  if (controller) activeDrives.set(controller, drive);
128197
128229
  };
128198
128230
  const driveRunNow = driveTracked;
128199
- const asyncShutdown = progressExecution ? new AbortController() : void 0;
128231
+ const asyncShutdown = progressExecution && process.platform === "win32" ? new AbortController() : void 0;
128200
128232
  startupRollback?.add(() => {
128201
128233
  executionStopping = true;
128202
128234
  asyncShutdown?.abort();
@@ -130370,7 +130402,7 @@ async function readCredential(path42) {
130370
130402
  }
130371
130403
  async function resolveBearer(explicitToken) {
130372
130404
  const file2 = process.env.MRRLIN_EXECUTOR_BEARER_FILE;
130373
- if (isExecutorThread() && (file2 || process.env.MRRLIN_EXECUTOR_RUN_ID || process.env.MRRLIN_EXECUTOR_LEASE_ID || process.env.MRRLIN_F54_PROGRESS_LEASE === "1")) {
130405
+ if (isExecutorThread() && (file2 || process.env.MRRLIN_EXECUTOR_RUN_ID || process.env.MRRLIN_EXECUTOR_LEASE_ID)) {
130374
130406
  if (!file2) throw new Error("STDIO_EXECUTOR_CREDENTIAL_UNAVAILABLE");
130375
130407
  const token = await readCredential(file2);
130376
130408
  if (!token?.startsWith("mrrlin_executor_v1.")) throw new Error("STDIO_EXECUTOR_CREDENTIAL_UNAVAILABLE");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.249",
3
+ "version": "0.4.251",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"