@mrrlin-dev/mcp 0.4.28 → 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 +45 -23
  2. package/package.json +4 -4
package/dist/bin.cjs CHANGED
@@ -41328,24 +41328,30 @@ function createFailureLog(opts = {}) {
41328
41328
  const windowMs = opts.windowMs ?? failureLogWindowMs();
41329
41329
  const now = opts.now ?? Date.now;
41330
41330
  const lastEmit = /* @__PURE__ */ new Map();
41331
+ const KIND_NULL = "\0none";
41331
41332
  const counts = /* @__PURE__ */ new Map();
41332
41333
  let windowStartedAt = null;
41333
41334
  return {
41334
41335
  /** Decide whether this failure should be printed. Returns the suppressed count to include in
41335
41336
  * the line when it is. */
41336
41337
  shouldEmit(operation, kind) {
41337
- const prev = lastEmit.get(operation);
41338
- const sameKind = prev != null && prev.kind === kind;
41339
- const withinWindow = prev != null && now() - prev.at < windowMs;
41340
- 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) {
41341
41346
  prev.suppressed += 1;
41342
41347
  return { emit: false, suppressed: prev.suppressed };
41343
41348
  }
41344
- const suppressed = sameKind ? prev?.suppressed ?? 0 : 0;
41345
- lastEmit.set(operation, { kind, at: now(), suppressed: 0 });
41349
+ const suppressed = prev?.suppressed ?? 0;
41350
+ byKind.set(kindKey, { at: now(), suppressed: 0 });
41346
41351
  return { emit: true, suppressed };
41347
41352
  },
41348
- /** 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. */
41349
41355
  noteSuccess(operation) {
41350
41356
  lastEmit.delete(operation);
41351
41357
  },
@@ -41375,9 +41381,10 @@ function createFailureLog(opts = {}) {
41375
41381
  }
41376
41382
  };
41377
41383
  }
41378
- function failureLogLine(label, error51, suppressed) {
41384
+ function failureLogLine(label, error51, suppressed, note) {
41385
+ const noteText = note ? ` (${note})` : "";
41379
41386
  const tail2 = suppressed > 0 ? ` (${suppressed} identical suppressed since the last line)` : "";
41380
- return `[mrrlin-mcp director-bridge] ${label} failed: ${describeError(error51)}${tail2}
41387
+ return `[mrrlin-mcp director-bridge] ${label} failed${noteText}: ${describeError(error51)}${tail2}
41381
41388
  `;
41382
41389
  }
41383
41390
 
@@ -41397,15 +41404,12 @@ function createTokenRefresher(opts) {
41397
41404
  opts.failureLog?.noteSuccess("tokenRefresh");
41398
41405
  opts.onOk?.();
41399
41406
  } catch (error51) {
41400
- const label = "token refresh (will retry next tick)";
41407
+ const line = (suppressed) => failureLogLine("token refresh", error51, suppressed, "will retry next tick");
41401
41408
  if (opts.failureLog) {
41402
41409
  const { emit, suppressed } = opts.failureLog.shouldEmit("tokenRefresh", errorKind(error51));
41403
- if (emit) process.stderr.write(failureLogLine(label, error51, suppressed));
41410
+ if (emit) process.stderr.write(line(suppressed));
41404
41411
  } else {
41405
- process.stderr.write(
41406
- `[mrrlin-mcp director-bridge] token refresh failed (will retry next tick): ${describeError(error51)}
41407
- `
41408
- );
41412
+ process.stderr.write(line(0));
41409
41413
  }
41410
41414
  opts.onError?.(error51);
41411
41415
  }
@@ -41833,7 +41837,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
41833
41837
  }
41834
41838
 
41835
41839
  // src/_generated/version.ts
41836
- var PKG_VERSION = "0.4.28";
41840
+ var PKG_VERSION = "0.4.31";
41837
41841
 
41838
41842
  // src/api-base-url-migrate.ts
41839
41843
  var import_node_fs3 = __toESM(require("node:fs"), 1);
@@ -48873,12 +48877,14 @@ async function compactChat(input, deps) {
48873
48877
  );
48874
48878
  if (exec.ok) {
48875
48879
  const summaryNorm = normalizeWhitespace(exec.text);
48880
+ const hasSomethingToVerify = operatorMessages.length > 0;
48876
48881
  const allPresent = operatorMessages.every((op) => {
48877
48882
  const opNorm = normalizeWhitespace(op);
48878
48883
  return summaryNorm.includes(opNorm);
48879
48884
  });
48885
+ const isBlank = exec.text.trim().length === 0;
48880
48886
  const withinBudget = Buffer.byteLength(exec.text, "utf8") <= input.budgetBytes;
48881
- if (allPresent && withinBudget) {
48887
+ if (hasSomethingToVerify && allPresent && !isBlank && withinBudget) {
48882
48888
  return { kind: "summary", seed: exec.text };
48883
48889
  }
48884
48890
  }
@@ -48902,6 +48908,9 @@ async function compactChat(input, deps) {
48902
48908
  };
48903
48909
  }
48904
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
+ }
48905
48914
  return { kind: "raw-tail", seed };
48906
48915
  }
48907
48916
 
@@ -55182,13 +55191,15 @@ function createBridgeMessageHandler(deps) {
55182
55191
  provider: compactionSeat.id,
55183
55192
  weakModel: compactionSeat.models.weak
55184
55193
  });
55185
- 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.";
55186
55196
  sendForSpan({
55187
55197
  type: "compact-directive",
55188
55198
  directorSessionId: directorSessionId2,
55189
55199
  lineageId,
55190
55200
  resolvedSeat: compactionSeat.id,
55191
- seed
55201
+ seed,
55202
+ seedKind: result.kind
55192
55203
  });
55193
55204
  return;
55194
55205
  }
@@ -62626,6 +62637,17 @@ function compactProjectSnapshot(projectSlug, snapshot, maxItems) {
62626
62637
  }
62627
62638
  var ARTIFACT_PAYLOAD_BUDGET = 400;
62628
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
+ }
62629
62651
  function compactArtifactPayload(artifact) {
62630
62652
  const payload = artifact.payload ?? {};
62631
62653
  switch (artifact.kind) {
@@ -62641,10 +62663,10 @@ function compactArtifactPayload(artifact) {
62641
62663
  }
62642
62664
  case "command_output": {
62643
62665
  const event = payload.event ?? void 0;
62644
- const command = payload.command ?? event?.tool?.input?.command ?? null;
62645
- const cwd = payload.cwd ?? event?.tool?.input?.cwd ?? null;
62646
- const exitCode = payload.exitCode ?? null;
62647
- 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) ?? "";
62648
62670
  const lines2 = rawOutput.split(/\r?\n/);
62649
62671
  const tail2 = lines2.slice(-COMMAND_OUTPUT_TAIL_LINES).join("\n");
62650
62672
  const firstError = lines2.find((l) => /error|fail/i.test(l)) ?? null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.28",
3
+ "version": "0.4.31",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"
@@ -21,12 +21,12 @@
21
21
  "@types/ws": "^8.18.1",
22
22
  "esbuild": "^0.24.0",
23
23
  "tsx": "^4.22.3",
24
+ "@mrrlin/client": "0.0.0",
24
25
  "@mrrlin/agent-client": "0.0.0",
25
26
  "@mrrlin/director-e2e": "0.0.0",
26
- "@mrrlin/client": "0.0.0",
27
+ "@mrrlin/schemas": "0.0.0",
27
28
  "@mrrlin/tsconfig": "0.0.0",
28
- "@mrrlin/wiki": "0.0.0",
29
- "@mrrlin/schemas": "0.0.0"
29
+ "@mrrlin/wiki": "0.0.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "@iarna/toml": "^2.2.5",