@mrrlin-dev/mcp 0.4.277 → 0.4.278

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 +61 -14
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -107633,7 +107633,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
107633
107633
  }
107634
107634
 
107635
107635
  // src/_generated/version.ts
107636
- var PKG_VERSION = "0.4.277";
107636
+ var PKG_VERSION = "0.4.278";
107637
107637
 
107638
107638
  // src/bridge-allowed-origins.ts
107639
107639
  var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
@@ -126268,6 +126268,26 @@ async function runExternalAgentsPruneAtStartup(deps) {
126268
126268
  }
126269
126269
  }
126270
126270
 
126271
+ // src/self-update-notice.ts
126272
+ var PREFIX2 = "II-MCPUPD-";
126273
+ function parseVersion(text2) {
126274
+ const match2 = /^(\d+)\.(\d+)\.(\d+)/.exec(text2);
126275
+ return match2 ? [Number(match2[1]), Number(match2[2]), Number(match2[3])] : null;
126276
+ }
126277
+ function atOrBelow([aMajor, aMinor, aPatch], [bMajor, bMinor, bPatch]) {
126278
+ if (aMajor !== bMajor) return aMajor < bMajor;
126279
+ if (aMinor !== bMinor) return aMinor < bMinor;
126280
+ return aPatch <= bPatch;
126281
+ }
126282
+ function staleUpdateNoticeIds(items, runningVersion) {
126283
+ const running = parseVersion(runningVersion);
126284
+ if (!running) return [];
126285
+ return items.filter((item) => item.status === "pending" && item.id.startsWith(PREFIX2)).filter((item) => {
126286
+ const offered = parseVersion(item.id.slice(PREFIX2.length));
126287
+ return offered !== null && atOrBelow(offered, running);
126288
+ }).map((item) => item.id);
126289
+ }
126290
+
126271
126291
  // src/director-bridge.ts
126272
126292
  var JSON_GPT_MODEL_REF_RE = /"(?:slug|model)"\s*:\s*"(gpt-[a-z0-9.-]+)"/gi;
126273
126293
  var DECLINED_PROPOSALS_MAX = 5;
@@ -126446,6 +126466,7 @@ function readCodexFallbackModels() {
126446
126466
  }
126447
126467
  return [...models.values()];
126448
126468
  }
126469
+ var updateNoticesRetired = /* @__PURE__ */ new Set();
126449
126470
  function selfUpdateInboxItemId(offeredVersion) {
126450
126471
  if (!offeredVersion) return `II-MCPUPD-${(0, import_node_crypto40.randomUUID)()}`;
126451
126472
  if (/^[A-Za-z0-9._-]+$/.test(offeredVersion)) return `II-MCPUPD-${offeredVersion}`;
@@ -126484,7 +126505,8 @@ function buildThreadStartParams(msg, config2, desiredModel) {
126484
126505
  // Dogfood R2-10: GT-2's journal said all 24 spec checks ran and passed; the Director said it had not run them.
126485
126506
  "- Report a task's checks from its record (get_task journalMarkdown, run artifacts): if they say checks ran, report that and the result; never call them not run because you did not run them in this chat.",
126486
126507
  "- Mention a GT- or WK- id only if a tool returned it in this conversation (server-authoritative receipts).",
126487
- "- Reply in the operator's language for the whole turn (questions, task scopes, summaries).",
126508
+ // Dogfood R4-1: an English message got a Ukrainian reply in a project whose wiki/history was Ukrainian.
126509
+ "- Reply in the language of the operator's LATEST message for the whole turn, even if earlier chats, wiki pages or tools use another.",
126488
126510
  "- Keep chat short and human. No code blocks, DDL, terminal output, local filesystem paths, internal job/inbox UUIDs or alert markers in chat \u2014 put long content into a wiki page and link it.",
126489
126511
  "- Spec pages in folder Specs must contain `## Acceptance criteria` followed by `- [ ]` items.",
126490
126512
  "- AGNOSTIC DELIVERY MANDATE: Mrrlin is an Agnostic Delivery Platform decoupled from mandatory GitHub. Delivery is routed strictly by artifact kind: (1) document -> wiki; (2) page -> publish (web pages, landing pages, interactive HTML previews); (3) file_set -> artifacts (file uploads, bundles, build zips); (4) message -> send (outbound webhooks, Slack, notifications); (5) code_change -> repo_host (no host: local repo; register_local_checkout w/o repo; init_local_repo after a yes; a done local run lands on main (human_review: after Accept), apply_local_run retries, get_execution_run's localLanding says if it landed; NEVER edit or commit code yourself, only a code run does). NEVER stall or refuse non-code tasks by demanding a Git repository. Non-code tasks deliver directly via page (Publish) or document (Wiki). A page goes live only via a publish route, and a new project has none until the operator adds a publisher on the Integrations page: never promise or give a live link until publishing has produced one.",
@@ -128669,6 +128691,8 @@ function createBridgeMessageHandler(deps) {
128669
128691
  const updateOfferProjectSlug = msg.context?.projectSlug?.trim();
128670
128692
  if (updateOffer !== null && !updateOffer.startsWith(SELF_UPDATE_AUTH_PREFLIGHT_OFFER_PREFIX) && updateOfferProjectSlug && deps.fileUpdateInboxItem) {
128671
128693
  void deps.fileUpdateInboxItem(updateOfferProjectSlug);
128694
+ } else if (updateOffer === null && updateOfferProjectSlug && deps.retireUpdateInboxItems) {
128695
+ void deps.retireUpdateInboxItems(updateOfferProjectSlug);
128672
128696
  }
128673
128697
  let reseedPrefix = null;
128674
128698
  if (startedFreshThread && deps.buildReseedPrefix) {
@@ -129809,6 +129833,29 @@ async function startBridge(startupDeps, agentSecret, startupRollback) {
129809
129833
  errorClass: "inbox_write_failed",
129810
129834
  message: String(err?.message ?? err)
129811
129835
  })}
129836
+ `
129837
+ );
129838
+ }
129839
+ },
129840
+ retireUpdateInboxItems: async (projectSlug) => {
129841
+ if (updateNoticesRetired.has(projectSlug)) return;
129842
+ updateNoticesRetired.add(projectSlug);
129843
+ try {
129844
+ const items = await client.listInboxItems(projectSlug, { kind: "info", status: "pending" });
129845
+ for (const id of staleUpdateNoticeIds(items, PKG_VERSION)) {
129846
+ await client.decideInboxItem(projectSlug, id, {
129847
+ verdict: "acknowledged",
129848
+ decidedBy: "director",
129849
+ answer: `The bridge now runs ${PKG_VERSION}.`
129850
+ }).catch(() => {
129851
+ });
129852
+ }
129853
+ } catch (err) {
129854
+ process.stderr.write(
129855
+ `[mrrlin-mcp director-bridge] warn bridge.self_update.notice_retire_failed ${JSON.stringify({
129856
+ projectSlug,
129857
+ message: String(err?.message ?? err)
129858
+ })}
129812
129859
  `
129813
129860
  );
129814
129861
  }
@@ -133366,7 +133413,7 @@ function findBridgeAncestor(startPid, readPs, maxHops = 16) {
133366
133413
  }
133367
133414
  return null;
133368
133415
  }
133369
- var PREFIX2 = "[mrrlin-mcp restart-service]";
133416
+ var PREFIX3 = "[mrrlin-mcp restart-service]";
133370
133417
  function isOnlineBridge(entry) {
133371
133418
  if (!entry || typeof entry !== "object") return false;
133372
133419
  const e = entry;
@@ -133382,23 +133429,23 @@ function runRestartService(deps) {
133382
133429
  const { print, installedVersion } = deps;
133383
133430
  const manual = "run `pm2 restart mrrlin-bridge` yourself once nothing is running in Mrrlin";
133384
133431
  const done = (exitCode, outcome) => ({ exitCode, outcome });
133385
- print(`${PREFIX2} installed version on disk: ${installedVersion}`);
133432
+ print(`${PREFIX3} installed version on disk: ${installedVersion}`);
133386
133433
  const jlist = deps.runPm2Jlist();
133387
133434
  const askAncestor = (why) => {
133388
133435
  if (deps.platform === "win32" || !deps.findAncestorBridge) return null;
133389
133436
  const pid = deps.findAncestorBridge();
133390
133437
  if (pid === null || !Number.isInteger(pid) || pid <= 1) return null;
133391
- print(`${PREFIX2} ${why}, but this command runs inside the bridge (pid ${pid}), so that one is asked directly.`);
133438
+ print(`${PREFIX3} ${why}, but this command runs inside the bridge (pid ${pid}), so that one is asked directly.`);
133392
133439
  return signalBridges(deps, [{ pid }], false, manual);
133393
133440
  };
133394
133441
  if (jlist.status !== 0) {
133395
133442
  const viaAncestor = askAncestor("pm2's process list could not be read from here");
133396
133443
  if (viaAncestor) return viaAncestor;
133397
133444
  if (jlist.errorCode === "ENOENT") {
133398
- print(`${PREFIX2} pm2 is not installed here, so the bridge was NOT asked to reload. If you run the bridge some other way, restart it there.`);
133445
+ print(`${PREFIX3} pm2 is not installed here, so the bridge was NOT asked to reload. If you run the bridge some other way, restart it there.`);
133399
133446
  return done(1, "no_pm2");
133400
133447
  }
133401
- print(`${PREFIX2} \`pm2 jlist\` failed (status ${jlist.status ?? "none"}), so the bridge was NOT asked to reload. To restart it, ${manual}.`);
133448
+ print(`${PREFIX3} \`pm2 jlist\` failed (status ${jlist.status ?? "none"}), so the bridge was NOT asked to reload. To restart it, ${manual}.`);
133402
133449
  return done(1, "pm2_failed");
133403
133450
  }
133404
133451
  let entries;
@@ -133406,14 +133453,14 @@ function runRestartService(deps) {
133406
133453
  const parsed = JSON.parse(jlist.stdout || "[]");
133407
133454
  entries = Array.isArray(parsed) ? parsed : [];
133408
133455
  } catch {
133409
- print(`${PREFIX2} \`pm2 jlist\` returned output that is not JSON, so the bridge was NOT asked to reload. To restart it, ${manual}.`);
133456
+ print(`${PREFIX3} \`pm2 jlist\` returned output that is not JSON, so the bridge was NOT asked to reload. To restart it, ${manual}.`);
133410
133457
  return done(1, "pm2_failed");
133411
133458
  }
133412
133459
  const bridges = entries.filter(isOnlineBridge).filter((e) => typeof e.pid === "number" && Number.isInteger(e.pid) && e.pid > 0);
133413
133460
  if (bridges.length === 0) {
133414
133461
  const viaAncestor = askAncestor("pm2 listed no running mrrlin-bridge from here");
133415
133462
  if (viaAncestor) return viaAncestor;
133416
- print(`${PREFIX2} no running mrrlin-bridge found under pm2. Start it with: mrrlin-mcp install-service`);
133463
+ print(`${PREFIX3} no running mrrlin-bridge found under pm2. Start it with: mrrlin-mcp install-service`);
133417
133464
  return done(1, "no_bridge");
133418
133465
  }
133419
133466
  const ownReal = deps.ownBinPath ? deps.realpath(deps.ownBinPath) : null;
@@ -133428,7 +133475,7 @@ function runRestartService(deps) {
133428
133475
  if (elsewhere.length > 0) {
133429
133476
  const where = elsewhere.map((b) => `pid ${b.pid}: ${String(b.pm2_env?.pm_exec_path)}`).join("; ");
133430
133477
  print(
133431
- `${PREFIX2} a running bridge uses a different copy of mrrlin-mcp (${where}) than the one just installed (${ownReal}). The install did not update it, so it was NOT asked to reload and stays on its old version. Update that copy, or re-run \`mrrlin-mcp install-service\` with this one, then run \`pm2 restart mrrlin-bridge\` once nothing is running in Mrrlin.`
133478
+ `${PREFIX3} a running bridge uses a different copy of mrrlin-mcp (${where}) than the one just installed (${ownReal}). The install did not update it, so it was NOT asked to reload and stays on its old version. Update that copy, or re-run \`mrrlin-mcp install-service\` with this one, then run \`pm2 restart mrrlin-bridge\` once nothing is running in Mrrlin.`
133432
133479
  );
133433
133480
  if (sameCopy.length === 0) return done(1, "different_install");
133434
133481
  }
@@ -133439,7 +133486,7 @@ function signalBridges(deps, sameCopy, someElsewhere, manual) {
133439
133486
  const done = (exitCode, outcome) => ({ exitCode, outcome });
133440
133487
  if (deps.platform === "win32") {
133441
133488
  print(
133442
- `${PREFIX2} Windows cannot send the reload signal, so the bridge was NOT asked to reload. The running bridge (pid ${sameCopy.map((b) => b.pid).join(", ")}) is still the old version and may not notice the new one by itself. To switch to the new version, ${manual}.`
133489
+ `${PREFIX3} Windows cannot send the reload signal, so the bridge was NOT asked to reload. The running bridge (pid ${sameCopy.map((b) => b.pid).join(", ")}) is still the old version and may not notice the new one by itself. To switch to the new version, ${manual}.`
133443
133490
  );
133444
133491
  return done(1, "signal_unsupported");
133445
133492
  }
@@ -133455,13 +133502,13 @@ function signalBridges(deps, sameCopy, someElsewhere, manual) {
133455
133502
  }
133456
133503
  }
133457
133504
  if (signalled.length === 0) {
133458
- print(`${PREFIX2} could not signal the bridge (${failed.join("; ")}). It is still running the old version. To restart it, ${manual}.`);
133505
+ print(`${PREFIX3} could not signal the bridge (${failed.join("; ")}). It is still running the old version. To restart it, ${manual}.`);
133459
133506
  return done(1, "signal_failed");
133460
133507
  }
133461
133508
  print(
133462
- `${PREFIX2} asked the running bridge (pid ${signalled.join(", ")}) to reload onto ${installedVersion}. It has NOT restarted yet. If the copy on disk differs from the one it is running, it first lets any reply or task that is running finish, then restarts by itself; if it already runs this version, nothing changes. Anything said in the meantime is still handled by the running version.`
133509
+ `${PREFIX3} asked the running bridge (pid ${signalled.join(", ")}) to reload onto ${installedVersion}. It has NOT restarted yet. If the copy on disk differs from the one it is running, it first lets any reply or task that is running finish, then restarts by itself; if it already runs this version, nothing changes. Anything said in the meantime is still handled by the running version.`
133463
133510
  );
133464
- if (failed.length > 0) print(`${PREFIX2} could not signal: ${failed.join("; ")}`);
133511
+ if (failed.length > 0) print(`${PREFIX3} could not signal: ${failed.join("; ")}`);
133465
133512
  if (someElsewhere || failed.length > 0) return done(0, "partial");
133466
133513
  return done(0, "signalled");
133467
133514
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.277",
3
+ "version": "0.4.278",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"