@mrrlin-dev/mcp 0.4.27 → 0.4.31

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 +68 -23
  2. package/package.json +3 -3
package/dist/bin.cjs CHANGED
@@ -20875,6 +20875,17 @@ function reapOrphanedBrowserProcesses(opts = {}) {
20875
20875
  }
20876
20876
  return { checked: candidates.length, killedPids, killedChildPids };
20877
20877
  }
20878
+ function checkBrowserBusy(opts = {}) {
20879
+ const homeDir = opts.homeDir ?? import_node_os.default.homedir();
20880
+ const { profilePath } = browserPaths(homeDir);
20881
+ const listProcesses = opts.listProcesses ?? defaultListProcesses;
20882
+ const flag = `--user-data-dir=${profilePath}`;
20883
+ const flagSpaced = `--user-data-dir ${profilePath}`;
20884
+ const holder = listProcesses().find(
20885
+ (p) => (p.command.includes(flag) || p.command.includes(flagSpaced)) && !p.command.includes("@playwright/mcp") && !p.command.includes("--type=")
20886
+ );
20887
+ return { busy: holder !== void 0, holderPid: holder?.pid ?? null };
20888
+ }
20878
20889
  function externalAgentsServeArgs() {
20879
20890
  return {
20880
20891
  command: process.execPath,
@@ -41317,24 +41328,30 @@ function createFailureLog(opts = {}) {
41317
41328
  const windowMs = opts.windowMs ?? failureLogWindowMs();
41318
41329
  const now = opts.now ?? Date.now;
41319
41330
  const lastEmit = /* @__PURE__ */ new Map();
41331
+ const KIND_NULL = "\0none";
41320
41332
  const counts = /* @__PURE__ */ new Map();
41321
41333
  let windowStartedAt = null;
41322
41334
  return {
41323
41335
  /** Decide whether this failure should be printed. Returns the suppressed count to include in
41324
41336
  * the line when it is. */
41325
41337
  shouldEmit(operation, kind) {
41326
- const prev = lastEmit.get(operation);
41327
- const sameKind = prev != null && prev.kind === kind;
41328
- const withinWindow = prev != null && now() - prev.at < windowMs;
41329
- if (sameKind && withinWindow) {
41338
+ const kindKey = kind ?? KIND_NULL;
41339
+ let byKind = lastEmit.get(operation);
41340
+ if (!byKind) {
41341
+ byKind = /* @__PURE__ */ new Map();
41342
+ lastEmit.set(operation, byKind);
41343
+ }
41344
+ const prev = byKind.get(kindKey);
41345
+ if (prev != null && now() - prev.at < windowMs) {
41330
41346
  prev.suppressed += 1;
41331
41347
  return { emit: false, suppressed: prev.suppressed };
41332
41348
  }
41333
- const suppressed = sameKind ? prev?.suppressed ?? 0 : 0;
41334
- lastEmit.set(operation, { kind, at: now(), suppressed: 0 });
41349
+ const suppressed = prev?.suppressed ?? 0;
41350
+ byKind.set(kindKey, { at: now(), suppressed: 0 });
41335
41351
  return { emit: true, suppressed };
41336
41352
  },
41337
- /** A success resets the operation's suppression state, so the next failure always prints. */
41353
+ /** A success resets the operation's suppression state for EVERY error kind, so the next failure
41354
+ * always prints regardless of which kind it is. */
41338
41355
  noteSuccess(operation) {
41339
41356
  lastEmit.delete(operation);
41340
41357
  },
@@ -41364,9 +41381,10 @@ function createFailureLog(opts = {}) {
41364
41381
  }
41365
41382
  };
41366
41383
  }
41367
- function failureLogLine(label, error51, suppressed) {
41384
+ function failureLogLine(label, error51, suppressed, note) {
41385
+ const noteText = note ? ` (${note})` : "";
41368
41386
  const tail2 = suppressed > 0 ? ` (${suppressed} identical suppressed since the last line)` : "";
41369
- return `[mrrlin-mcp director-bridge] ${label} failed: ${describeError(error51)}${tail2}
41387
+ return `[mrrlin-mcp director-bridge] ${label} failed${noteText}: ${describeError(error51)}${tail2}
41370
41388
  `;
41371
41389
  }
41372
41390
 
@@ -41386,15 +41404,12 @@ function createTokenRefresher(opts) {
41386
41404
  opts.failureLog?.noteSuccess("tokenRefresh");
41387
41405
  opts.onOk?.();
41388
41406
  } catch (error51) {
41389
- const label = "token refresh (will retry next tick)";
41407
+ const line = (suppressed) => failureLogLine("token refresh", error51, suppressed, "will retry next tick");
41390
41408
  if (opts.failureLog) {
41391
41409
  const { emit, suppressed } = opts.failureLog.shouldEmit("tokenRefresh", errorKind(error51));
41392
- if (emit) process.stderr.write(failureLogLine(label, error51, suppressed));
41410
+ if (emit) process.stderr.write(line(suppressed));
41393
41411
  } else {
41394
- process.stderr.write(
41395
- `[mrrlin-mcp director-bridge] token refresh failed (will retry next tick): ${describeError(error51)}
41396
- `
41397
- );
41412
+ process.stderr.write(line(0));
41398
41413
  }
41399
41414
  opts.onError?.(error51);
41400
41415
  }
@@ -41822,7 +41837,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
41822
41837
  }
41823
41838
 
41824
41839
  // src/_generated/version.ts
41825
- var PKG_VERSION = "0.4.27";
41840
+ var PKG_VERSION = "0.4.31";
41826
41841
 
41827
41842
  // src/api-base-url-migrate.ts
41828
41843
  var import_node_fs3 = __toESM(require("node:fs"), 1);
@@ -48862,12 +48877,14 @@ async function compactChat(input, deps) {
48862
48877
  );
48863
48878
  if (exec.ok) {
48864
48879
  const summaryNorm = normalizeWhitespace(exec.text);
48880
+ const hasSomethingToVerify = operatorMessages.length > 0;
48865
48881
  const allPresent = operatorMessages.every((op) => {
48866
48882
  const opNorm = normalizeWhitespace(op);
48867
48883
  return summaryNorm.includes(opNorm);
48868
48884
  });
48885
+ const isBlank = exec.text.trim().length === 0;
48869
48886
  const withinBudget = Buffer.byteLength(exec.text, "utf8") <= input.budgetBytes;
48870
- if (allPresent && withinBudget) {
48887
+ if (hasSomethingToVerify && allPresent && !isBlank && withinBudget) {
48871
48888
  return { kind: "summary", seed: exec.text };
48872
48889
  }
48873
48890
  }
@@ -48891,6 +48908,9 @@ async function compactChat(input, deps) {
48891
48908
  };
48892
48909
  }
48893
48910
  const seed = kept.reverse().map(renderMessage).join("\n");
48911
+ if (seed.trim().length === 0) {
48912
+ return { kind: "no-seed", note: "No chat content could be carried forward." };
48913
+ }
48894
48914
  return { kind: "raw-tail", seed };
48895
48915
  }
48896
48916
 
@@ -55171,13 +55191,15 @@ function createBridgeMessageHandler(deps) {
55171
55191
  provider: compactionSeat.id,
55172
55192
  weakModel: compactionSeat.models.weak
55173
55193
  });
55174
- const seed = result.kind === "no-seed" ? result.note : result.seed;
55194
+ const rawSeed = result.kind === "no-seed" ? result.note : result.seed;
55195
+ const seed = rawSeed.trim().length > 0 ? rawSeed : "No prior context could be carried forward.";
55175
55196
  sendForSpan({
55176
55197
  type: "compact-directive",
55177
55198
  directorSessionId: directorSessionId2,
55178
55199
  lineageId,
55179
55200
  resolvedSeat: compactionSeat.id,
55180
- seed
55201
+ seed,
55202
+ seedKind: result.kind
55181
55203
  });
55182
55204
  return;
55183
55205
  }
@@ -62615,6 +62637,17 @@ function compactProjectSnapshot(projectSlug, snapshot, maxItems) {
62615
62637
  }
62616
62638
  var ARTIFACT_PAYLOAD_BUDGET = 400;
62617
62639
  var COMMAND_OUTPUT_TAIL_LINES = 10;
62640
+ function asString(value) {
62641
+ return typeof value === "string" ? value : null;
62642
+ }
62643
+ function eventContentText(value) {
62644
+ if (typeof value === "string") return value;
62645
+ if (value === null || typeof value !== "object") return null;
62646
+ const blocks = Array.isArray(value) ? value : value.content;
62647
+ if (!Array.isArray(blocks)) return null;
62648
+ const texts = blocks.map((block) => block && typeof block === "object" ? asString(block.text) : null).filter((text) => text !== null);
62649
+ return texts.length > 0 ? texts.join("\n") : null;
62650
+ }
62618
62651
  function compactArtifactPayload(artifact) {
62619
62652
  const payload = artifact.payload ?? {};
62620
62653
  switch (artifact.kind) {
@@ -62630,10 +62663,10 @@ function compactArtifactPayload(artifact) {
62630
62663
  }
62631
62664
  case "command_output": {
62632
62665
  const event = payload.event ?? void 0;
62633
- const command = payload.command ?? event?.tool?.input?.command ?? null;
62634
- const cwd = payload.cwd ?? event?.tool?.input?.cwd ?? null;
62635
- const exitCode = payload.exitCode ?? null;
62636
- const rawOutput = payload.stdout ?? payload.output ?? event?.content ?? "";
62666
+ const command = asString(payload.command) ?? asString(event?.tool?.input?.command) ?? null;
62667
+ const cwd = asString(payload.cwd) ?? asString(event?.tool?.input?.cwd) ?? null;
62668
+ const exitCode = typeof payload.exitCode === "number" ? payload.exitCode : null;
62669
+ const rawOutput = eventContentText(payload.stdout) ?? eventContentText(payload.output) ?? eventContentText(event?.content) ?? "";
62637
62670
  const lines2 = rawOutput.split(/\r?\n/);
62638
62671
  const tail2 = lines2.slice(-COMMAND_OUTPUT_TAIL_LINES).join("\n");
62639
62672
  const firstError = lines2.find((l) => /error|fail/i.test(l)) ?? null;
@@ -64699,6 +64732,13 @@ Usage:
64699
64732
  command configure bridge wires for the
64700
64733
  [mcp_servers.mrrlin-browser] block.
64701
64734
 
64735
+ mrrlin-mcp browser-status Read-only check: is the shared browser session
64736
+ actually occupied right now? Prints
64737
+ {"busy":bool,"holderPid":number|null} to stdout.
64738
+ A building block for admission control (not yet
64739
+ wired into the scheduler or Director turn-start
64740
+ \u2014 this only answers the question).
64741
+
64702
64742
  mrrlin-mcp external-agents-serve
64703
64743
  Launch the bundled @mrrlin-dev/external-agents
64704
64744
  MCP server (multi-LLM dispatch pool). This is the
@@ -64883,6 +64923,11 @@ async function main() {
64883
64923
  process.exitCode = r.status ?? 1;
64884
64924
  return;
64885
64925
  }
64926
+ case "browser-status": {
64927
+ process.stdout.write(`${JSON.stringify(checkBrowserBusy())}
64928
+ `);
64929
+ return;
64930
+ }
64886
64931
  case "external-agents-serve": {
64887
64932
  const { command: command2, args } = externalAgentsServeArgs();
64888
64933
  const r = (0, import_node_child_process18.spawnSync)(command2, args, { stdio: "inherit", env: process.env });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.27",
3
+ "version": "0.4.31",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"
@@ -24,9 +24,9 @@
24
24
  "@mrrlin/client": "0.0.0",
25
25
  "@mrrlin/agent-client": "0.0.0",
26
26
  "@mrrlin/director-e2e": "0.0.0",
27
- "@mrrlin/wiki": "0.0.0",
28
27
  "@mrrlin/schemas": "0.0.0",
29
- "@mrrlin/tsconfig": "0.0.0"
28
+ "@mrrlin/tsconfig": "0.0.0",
29
+ "@mrrlin/wiki": "0.0.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "@iarna/toml": "^2.2.5",