@mrrlin-dev/mcp 0.4.15 → 0.4.16

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 +98 -65
  2. package/package.json +4 -4
package/dist/bin.cjs CHANGED
@@ -6246,7 +6246,7 @@ var require_websocket = __commonJS({
6246
6246
  var http2 = require("http");
6247
6247
  var net = require("net");
6248
6248
  var tls = require("tls");
6249
- var { randomBytes: randomBytes4, createHash: createHash5 } = require("crypto");
6249
+ var { randomBytes: randomBytes5, createHash: createHash5 } = require("crypto");
6250
6250
  var { Duplex, Readable } = require("stream");
6251
6251
  var { URL: URL2 } = require("url");
6252
6252
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -6784,7 +6784,7 @@ var require_websocket = __commonJS({
6784
6784
  }
6785
6785
  }
6786
6786
  const defaultPort = isSecure ? 443 : 80;
6787
- const key = randomBytes4(16).toString("base64");
6787
+ const key = randomBytes5(16).toString("base64");
6788
6788
  const request = isSecure ? https.request : http2.request;
6789
6789
  const protocolSet = /* @__PURE__ */ new Set();
6790
6790
  let perMessageDeflate;
@@ -21476,7 +21476,7 @@ var import_node_http = __toESM(require("node:http"), 1);
21476
21476
  var import_node_os11 = __toESM(require("node:os"), 1);
21477
21477
  var import_node_path24 = __toESM(require("node:path"), 1);
21478
21478
  var import_node_child_process15 = require("node:child_process");
21479
- var import_node_crypto9 = __toESM(require("node:crypto"), 1);
21479
+ var import_node_crypto10 = __toESM(require("node:crypto"), 1);
21480
21480
 
21481
21481
  // src/turn-replay-buffer.ts
21482
21482
  var DEFAULT_MAX_EVENTS = 2e3;
@@ -41623,7 +41623,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
41623
41623
  }
41624
41624
 
41625
41625
  // src/_generated/version.ts
41626
- var PKG_VERSION = "0.4.15";
41626
+ var PKG_VERSION = "0.4.16";
41627
41627
 
41628
41628
  // src/api-base-url-migrate.ts
41629
41629
  var import_node_fs3 = __toESM(require("node:fs"), 1);
@@ -42312,6 +42312,7 @@ async function emitPruneLog(stateDir, daysRemoved, reasonByDay, bytesRemoved, ol
42312
42312
  }
42313
42313
 
42314
42314
  // src/telemetry/turn-aggregator.ts
42315
+ var import_node_crypto3 = require("node:crypto");
42315
42316
  var import_promises5 = require("node:fs/promises");
42316
42317
  var import_node_path10 = require("node:path");
42317
42318
  var BRIDGE_FILE_RE = /^bridge-(\d{4}-\d{2}-\d{2})\.jsonl$/;
@@ -42322,6 +42323,25 @@ var PLUMBING_COUNTER_KEY = {
42322
42323
  buffer_stats: "bufferStats",
42323
42324
  rate_limit_status: "rateLimitStatusRecords"
42324
42325
  };
42326
+ function resolveOwnSlug(records) {
42327
+ for (const rec of records) {
42328
+ const slug = rec.projection?.projectSlug;
42329
+ if (slug) return slug;
42330
+ }
42331
+ return void 0;
42332
+ }
42333
+ function inheritSlug(seeds, index) {
42334
+ let preceding;
42335
+ let following;
42336
+ for (const seed of seeds) {
42337
+ if (seed.index < index) {
42338
+ if (!preceding || seed.index > preceding.index) preceding = seed;
42339
+ } else if (seed.index > index) {
42340
+ if (!following || seed.index < following.index) following = seed;
42341
+ }
42342
+ }
42343
+ return (preceding ?? following)?.slug;
42344
+ }
42325
42345
  async function foldClosedDays(stateDir, today) {
42326
42346
  const logsDir = (0, import_node_path10.join)(stateDir, "logs");
42327
42347
  let entries;
@@ -42337,6 +42357,7 @@ async function foldClosedDays(stateDir, today) {
42337
42357
  if (day === today) continue;
42338
42358
  const raw = await (0, import_promises5.readFile)((0, import_node_path10.join)(logsDir, entry), "utf8");
42339
42359
  const groups = /* @__PURE__ */ new Map();
42360
+ let groupCounter = 0;
42340
42361
  for (const line of raw.split("\n")) {
42341
42362
  const trimmed = line.trim();
42342
42363
  if (!trimmed) continue;
@@ -42351,13 +42372,14 @@ async function foldClosedDays(stateDir, today) {
42351
42372
  const key = `${sessionId === null ? 0 : 1}:${sessionId}:${turnId === null ? 0 : 1}:${turnId}`;
42352
42373
  let group = groups.get(key);
42353
42374
  if (!group) {
42354
- group = { sessionId, turnId, records: [], projectionFailures: 0 };
42375
+ group = { sessionId, turnId, records: [], projectionFailures: 0, firstSeenIndex: groupCounter++ };
42355
42376
  groups.set(key, group);
42356
42377
  }
42357
42378
  group.records.push(rec);
42358
42379
  if (rec.projectionFailed === true) group.projectionFailures += 1;
42359
42380
  }
42360
42381
  const rowsByProject = /* @__PURE__ */ new Map();
42382
+ const pending = [];
42361
42383
  for (const group of groups.values()) {
42362
42384
  if (group.sessionId === null) continue;
42363
42385
  const records = [...group.records].sort((a, b) => {
@@ -42368,15 +42390,7 @@ async function foldClosedDays(stateDir, today) {
42368
42390
  if (bSeq === void 0) return -1;
42369
42391
  return aSeq - bSeq;
42370
42392
  });
42371
- let projectSlug;
42372
- for (const rec of records) {
42373
- const slug = rec.projection?.projectSlug;
42374
- if (slug) {
42375
- projectSlug = slug;
42376
- break;
42377
- }
42378
- }
42379
- projectSlug ??= "_unattributed";
42393
+ const ownSlug = resolveOwnSlug(records);
42380
42394
  const toolResults = records.filter((r) => r.projection?.kind === "tool_result");
42381
42395
  const toolSequence = [];
42382
42396
  for (const rec of records) {
@@ -42433,18 +42447,37 @@ async function foldClosedDays(stateDir, today) {
42433
42447
  plumbing,
42434
42448
  projectionFailures: group.projectionFailures
42435
42449
  };
42436
- const rows = rowsByProject.get(projectSlug) ?? [];
42437
- rows.push(row);
42438
- rowsByProject.set(projectSlug, rows);
42450
+ pending.push({ sessionId: group.sessionId, firstSeenIndex: group.firstSeenIndex, ownSlug, row });
42451
+ }
42452
+ const seedsBySession = /* @__PURE__ */ new Map();
42453
+ for (const item of pending) {
42454
+ if (item.ownSlug === void 0) continue;
42455
+ const seeds = seedsBySession.get(item.sessionId) ?? [];
42456
+ seeds.push({ index: item.firstSeenIndex, slug: item.ownSlug });
42457
+ seedsBySession.set(item.sessionId, seeds);
42458
+ }
42459
+ for (const item of pending) {
42460
+ const slug = item.ownSlug ?? inheritSlug(seedsBySession.get(item.sessionId) ?? [], item.firstSeenIndex) ?? // Neither the turn nor any turn of its session carries project evidence. Unchanged from
42461
+ // before this change: the partition stays `_unattributed`, and daily-uploader.ts is the one
42462
+ // that maps that partition name to MRRLIN_TELEMETRY_DEFAULT_PROJECT at upload time.
42463
+ "_unattributed";
42464
+ const rows = rowsByProject.get(slug) ?? [];
42465
+ rows.push(item.row);
42466
+ rowsByProject.set(slug, rows);
42439
42467
  }
42440
42468
  if (rowsByProject.size === 0) continue;
42441
42469
  const telemetryDir = (0, import_node_path10.join)(stateDir, "telemetry");
42442
42470
  await (0, import_promises5.mkdir)(telemetryDir, { recursive: true });
42443
42471
  for (const [slug, rows] of rowsByProject) {
42444
42472
  const finalPath = (0, import_node_path10.join)(telemetryDir, `rows-${slug}-${day}.jsonl`);
42445
- const tmpPath = `${finalPath}.tmp`;
42446
- await (0, import_promises5.writeFile)(tmpPath, rows.map((r) => JSON.stringify(r)).join("\n") + "\n", "utf8");
42447
- await (0, import_promises5.rename)(tmpPath, finalPath);
42473
+ const tmpPath = `${finalPath}.tmp-${process.pid}-${(0, import_node_crypto3.randomBytes)(6).toString("hex")}`;
42474
+ try {
42475
+ await (0, import_promises5.writeFile)(tmpPath, rows.map((r) => JSON.stringify(r)).join("\n") + "\n", "utf8");
42476
+ await (0, import_promises5.rename)(tmpPath, finalPath);
42477
+ } finally {
42478
+ await (0, import_promises5.unlink)(tmpPath).catch(() => {
42479
+ });
42480
+ }
42448
42481
  }
42449
42482
  }
42450
42483
  }
@@ -42454,7 +42487,7 @@ var import_promises6 = require("node:fs/promises");
42454
42487
  var import_node_path12 = require("node:path");
42455
42488
 
42456
42489
  // src/consensus/wiring.ts
42457
- var import_node_crypto3 = __toESM(require("node:crypto"), 1);
42490
+ var import_node_crypto4 = __toESM(require("node:crypto"), 1);
42458
42491
  var import_node_fs5 = __toESM(require("node:fs"), 1);
42459
42492
  var import_node_path11 = __toESM(require("node:path"), 1);
42460
42493
  var import_node_url2 = require("node:url");
@@ -43981,7 +44014,7 @@ You revise a deliverable to address the accepted issues so it satisfies the acce
43981
44014
  try {
43982
44015
  const diagnostics = Array.isArray(r["diagnostics"]) ? r["diagnostics"] : void 0;
43983
44016
  await client.appendExecutionArtifact(projectSlug, runId, {
43984
- id: `EA-${import_node_crypto3.default.randomUUID()}`,
44017
+ id: `EA-${import_node_crypto4.default.randomUUID()}`,
43985
44018
  kind: "verification",
43986
44019
  payload: {
43987
44020
  source: "deliverable-gate",
@@ -44539,7 +44572,7 @@ function setSelectedProvider(value) {
44539
44572
 
44540
44573
  // src/execution-consumer.ts
44541
44574
  var import_node_child_process12 = require("node:child_process");
44542
- var import_node_crypto5 = __toESM(require("node:crypto"), 1);
44575
+ var import_node_crypto6 = __toESM(require("node:crypto"), 1);
44543
44576
  var import_node_path15 = __toESM(require("node:path"), 1);
44544
44577
  var import_node_util = require("node:util");
44545
44578
 
@@ -44608,7 +44641,7 @@ function mapDeliverableGateResult(result) {
44608
44641
  }
44609
44642
 
44610
44643
  // src/async-tools/draft-spec.ts
44611
- var import_node_crypto4 = require("node:crypto");
44644
+ var import_node_crypto5 = require("node:crypto");
44612
44645
  var DRAFT_SPEC_TOOL_NAME = "draft_task_spec";
44613
44646
  var SPECS_FOLDER = "Specs";
44614
44647
  var DRAFT_SPEC_TLDR_MAX_CHARS = 300;
@@ -45091,7 +45124,7 @@ function onComplete(outcome, input) {
45091
45124
  };
45092
45125
  }
45093
45126
  const summary = outcome.error;
45094
- const hash3 = (0, import_node_crypto4.createHash)("sha256").update(summary).digest("hex").slice(0, 10);
45127
+ const hash3 = (0, import_node_crypto5.createHash)("sha256").update(summary).digest("hex").slice(0, 10);
45095
45128
  return {
45096
45129
  kind: "info",
45097
45130
  id: `II-sched-draft-failed-${input.taskId}-${hash3}`,
@@ -46411,7 +46444,7 @@ function isBridgeGeneratedArtifact(artifact) {
46411
46444
  return typeof payload === "object" && payload !== null && "event" in payload;
46412
46445
  }
46413
46446
  function newArtifactId() {
46414
- return `EA-${import_node_crypto5.default.randomUUID()}`;
46447
+ return `EA-${import_node_crypto6.default.randomUUID()}`;
46415
46448
  }
46416
46449
  var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
46417
46450
  function isBlastRadiusFloorPath(path22) {
@@ -46653,7 +46686,7 @@ async function driveRun(deps, projectSlug, runId) {
46653
46686
  if (!claimed) return;
46654
46687
  if (!claimed.leaseId) {
46655
46688
  await deps.client.createInboxItem(projectSlug, {
46656
- id: `II-${import_node_crypto5.default.randomUUID()}`,
46689
+ id: `II-${import_node_crypto6.default.randomUUID()}`,
46657
46690
  kind: "handoff",
46658
46691
  taskId: claimed.taskId,
46659
46692
  body: `Execution run ${runId} was claimed but returned no leaseId. This indicates DB/API corruption and requires operator attention.`
@@ -47624,7 +47657,7 @@ async function reconcileTaskAwaitingMerge(deps, projectSlug, task, runId, reason
47624
47657
  }
47625
47658
  try {
47626
47659
  await deps.client.createInboxItem(projectSlug, {
47627
- id: `II-${import_node_crypto5.default.randomUUID()}`,
47660
+ id: `II-${import_node_crypto6.default.randomUUID()}`,
47628
47661
  kind: "handoff",
47629
47662
  taskId: task.id,
47630
47663
  body: `Task ${task.id} (${task.title}) still needs operator follow-up: ${reason}. Mrrlin could not move the task back to Handoff needed automatically.`
@@ -47659,7 +47692,7 @@ async function notifyOperatorHandoff(deps, projectSlug, task, runId, reason) {
47659
47692
  }
47660
47693
  try {
47661
47694
  await deps.client.createInboxItem(projectSlug, {
47662
- id: `II-${import_node_crypto5.default.randomUUID()}`,
47695
+ id: `II-${import_node_crypto6.default.randomUUID()}`,
47663
47696
  kind: "handoff",
47664
47697
  taskId: task.id,
47665
47698
  body: `Execution run ${runId} for task ${task.id} (${task.title}) needs operator attention: ${reason}`
@@ -47797,7 +47830,7 @@ async function deployGateHandoff(deps, projectSlug, task, runId, reason, leaseId
47797
47830
  }).catch(() => {
47798
47831
  });
47799
47832
  await deps.client.createInboxItem(projectSlug, {
47800
- id: `II-${import_node_crypto5.default.randomUUID()}`,
47833
+ id: `II-${import_node_crypto6.default.randomUUID()}`,
47801
47834
  kind: "handoff",
47802
47835
  taskId: task.id,
47803
47836
  body: `Deploy gate for run ${runId} (task ${task.id} \u2014 ${task.title}) needs operator attention: ${reason}`
@@ -47816,7 +47849,7 @@ function maxLeaseReclaims() {
47816
47849
  }
47817
47850
 
47818
47851
  // src/async-job-consumer.ts
47819
- var import_node_crypto7 = __toESM(require("node:crypto"), 1);
47852
+ var import_node_crypto8 = __toESM(require("node:crypto"), 1);
47820
47853
 
47821
47854
  // src/async-tools/registry.ts
47822
47855
  var registry2 = /* @__PURE__ */ new Map();
@@ -47855,7 +47888,7 @@ function redact(input) {
47855
47888
  }
47856
47889
 
47857
47890
  // src/telemetry/projector.ts
47858
- var import_node_crypto6 = require("node:crypto");
47891
+ var import_node_crypto7 = require("node:crypto");
47859
47892
  function isRecord2(x) {
47860
47893
  return typeof x === "object" && x !== null;
47861
47894
  }
@@ -47896,7 +47929,7 @@ function buildProjection(payload, type, ms, telemetry) {
47896
47929
  if (typeof exitCode === "number") proj.exitCode = exitCode;
47897
47930
  const status = tool.status;
47898
47931
  if (typeof status === "string" && status.trim() !== "") {
47899
- proj.statusHash = (0, import_node_crypto6.createHash)("sha256").update(status.trim().toLowerCase()).digest("hex").slice(0, 8);
47932
+ proj.statusHash = (0, import_node_crypto7.createHash)("sha256").update(status.trim().toLowerCase()).digest("hex").slice(0, 8);
47900
47933
  }
47901
47934
  return proj;
47902
47935
  }
@@ -48211,7 +48244,7 @@ async function driveAsyncJob(deps, projectSlug, jobId) {
48211
48244
  const delivery = descriptor2.onComplete(outcome, input);
48212
48245
  if (!delivery.suppressInbox) {
48213
48246
  await deps.client.createInboxItem(projectSlug, {
48214
- id: delivery.id ?? `II-${import_node_crypto7.default.randomUUID()}`,
48247
+ id: delivery.id ?? `II-${import_node_crypto8.default.randomUUID()}`,
48215
48248
  kind: delivery.kind,
48216
48249
  body: delivery.body,
48217
48250
  ...delivery.taskId ? { taskId: delivery.taskId } : {},
@@ -48229,13 +48262,13 @@ async function deriveRequestedHash(client, toolName, input) {
48229
48262
  if (input.requestedHash) return input.requestedHash;
48230
48263
  if (toolName === "run_spec_consensus" && input.pageId) {
48231
48264
  const page = await client.getWikiPage(input.projectSlug, input.pageId);
48232
- return page.contentHash ?? import_node_crypto7.default.createHash("sha256").update(page.markdownBody).digest("hex");
48265
+ return page.contentHash ?? import_node_crypto8.default.createHash("sha256").update(page.markdownBody).digest("hex");
48233
48266
  }
48234
48267
  if (toolName === "draft_task_spec" && input.taskId) {
48235
48268
  const task = await client.getTask(input.projectSlug, input.taskId);
48236
- return task.updatedAt ?? import_node_crypto7.default.createHash("sha256").update(JSON.stringify(task)).digest("hex");
48269
+ return task.updatedAt ?? import_node_crypto8.default.createHash("sha256").update(JSON.stringify(task)).digest("hex");
48237
48270
  }
48238
- return import_node_crypto7.default.createHash("sha256").update(JSON.stringify(input)).digest("hex");
48271
+ return import_node_crypto8.default.createHash("sha256").update(JSON.stringify(input)).digest("hex");
48239
48272
  }
48240
48273
  async function runAsyncBackstopSweep(deps, drive = (slug, jobId) => driveAsyncJob(deps, slug, jobId)) {
48241
48274
  const projects = await deps.client.listProjects();
@@ -48716,7 +48749,7 @@ function createToolBusyClock(opts) {
48716
48749
  }
48717
48750
 
48718
48751
  // src/worker-token.ts
48719
- var import_node_crypto8 = require("node:crypto");
48752
+ var import_node_crypto9 = require("node:crypto");
48720
48753
  var import_node_fs11 = require("node:fs");
48721
48754
  var import_node_os8 = __toESM(require("node:os"), 1);
48722
48755
  var import_node_path19 = __toESM(require("node:path"), 1);
@@ -48747,7 +48780,7 @@ function readOrCreateWorkerToken() {
48747
48780
  if (existing) return existing;
48748
48781
  const dir = workerDir();
48749
48782
  (0, import_node_fs11.mkdirSync)(dir, { recursive: true, mode: 448 });
48750
- const token = (0, import_node_crypto8.randomBytes)(32).toString("hex");
48783
+ const token = (0, import_node_crypto9.randomBytes)(32).toString("hex");
48751
48784
  (0, import_node_fs11.writeFileSync)(workerTokenPath(), `${token}
48752
48785
  `, { encoding: "utf8", mode: 384 });
48753
48786
  return token;
@@ -48815,7 +48848,7 @@ function wrapConstructor(hashCons) {
48815
48848
  hashC.create = () => hashCons();
48816
48849
  return hashC;
48817
48850
  }
48818
- function randomBytes2(bytesLength = 32) {
48851
+ function randomBytes3(bytesLength = 32) {
48819
48852
  if (crypto5 && typeof crypto5.getRandomValues === "function") {
48820
48853
  return crypto5.getRandomValues(new Uint8Array(bytesLength));
48821
48854
  }
@@ -48854,10 +48887,10 @@ function encodeTranscript(channelId, ephemeralPhonePub, ephemeralAgentPub) {
48854
48887
 
48855
48888
  // ../../packages/director-e2e/dist/random.js
48856
48889
  function generateSecret() {
48857
- return randomBytes2(32);
48890
+ return randomBytes3(32);
48858
48891
  }
48859
48892
  function generateChannelId() {
48860
- return toBase64Url(randomBytes2(16));
48893
+ return toBase64Url(randomBytes3(16));
48861
48894
  }
48862
48895
 
48863
48896
  // ../../packages/director-e2e/dist/qr.js
@@ -50026,7 +50059,7 @@ function validateOpts(curve) {
50026
50059
  }
50027
50060
  function twistedEdwards(curveDef) {
50028
50061
  const CURVE = validateOpts(curveDef);
50029
- const { Fp: Fp2, n: CURVE_ORDER, prehash, hash: cHash, randomBytes: randomBytes4, nByteLength, h: cofactor } = CURVE;
50062
+ const { Fp: Fp2, n: CURVE_ORDER, prehash, hash: cHash, randomBytes: randomBytes5, nByteLength, h: cofactor } = CURVE;
50030
50063
  const MASK = _2n3 << BigInt(nByteLength * 8) - _1n4;
50031
50064
  const modP = Fp2.create;
50032
50065
  const uvRatio2 = CURVE.uvRatio || ((u, v) => {
@@ -50365,7 +50398,7 @@ function twistedEdwards(curveDef) {
50365
50398
  const utils = {
50366
50399
  getExtendedPublicKey,
50367
50400
  // ed25519 private keys are uniform 32b. No need to check for modulo bias, like in secp256k1.
50368
- randomPrivateKey: () => randomBytes4(Fp2.BYTES),
50401
+ randomPrivateKey: () => randomBytes5(Fp2.BYTES),
50369
50402
  /**
50370
50403
  * We're doing scalar multiplication (used in getPublicKey etc) with precomputed BASE_POINT
50371
50404
  * values. This slows down first getPublicKey() by milliseconds (see Speed section),
@@ -50580,7 +50613,7 @@ var ed25519Defaults = {
50580
50613
  Gx: BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),
50581
50614
  Gy: BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),
50582
50615
  hash: sha512,
50583
- randomBytes: randomBytes2,
50616
+ randomBytes: randomBytes3,
50584
50617
  adjustScalarBytes,
50585
50618
  // dom2
50586
50619
  // Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3.
@@ -50615,7 +50648,7 @@ var x25519 = /* @__PURE__ */ (() => montgomery({
50615
50648
  return mod(pow2(pow_p_5_8, BigInt(3), P) * b2, P);
50616
50649
  },
50617
50650
  adjustScalarBytes,
50618
- randomBytes: randomBytes2
50651
+ randomBytes: randomBytes3
50619
50652
  }))();
50620
50653
  function edwardsToMontgomeryPub(edwardsPub) {
50621
50654
  const { y } = ed25519.ExtendedPoint.fromHex(edwardsPub);
@@ -53613,9 +53646,9 @@ function readCodexFallbackModels() {
53613
53646
  return [...models.values()];
53614
53647
  }
53615
53648
  function selfUpdateInboxItemId(offeredVersion) {
53616
- if (!offeredVersion) return `II-MCPUPD-${(0, import_node_crypto9.randomUUID)()}`;
53649
+ if (!offeredVersion) return `II-MCPUPD-${(0, import_node_crypto10.randomUUID)()}`;
53617
53650
  if (/^[A-Za-z0-9._-]+$/.test(offeredVersion)) return `II-MCPUPD-${offeredVersion}`;
53618
- const hash3 = import_node_crypto9.default.createHash("sha256").update(offeredVersion).digest("hex").slice(0, 10);
53651
+ const hash3 = import_node_crypto10.default.createHash("sha256").update(offeredVersion).digest("hex").slice(0, 10);
53619
53652
  return `II-MCPUPD-${offeredVersion.replace(/[^A-Za-z0-9._-]/g, "-")}-${hash3}`;
53620
53653
  }
53621
53654
  function neutralCheckoutCwd(stateDir) {
@@ -54165,7 +54198,7 @@ function createBridgeRequestListener(opts) {
54165
54198
  res.end(JSON.stringify({ ok: false, error: "Origin not allowed." }));
54166
54199
  return;
54167
54200
  }
54168
- const nonce = import_node_crypto9.default.randomBytes(16).toString("base64url");
54201
+ const nonce = import_node_crypto10.default.randomBytes(16).toString("base64url");
54169
54202
  res.writeHead(200, { "content-type": "application/json" });
54170
54203
  res.end(JSON.stringify({ ok: true, wsUrl: `ws://${host}:${port}/ws`, token, nonce }));
54171
54204
  return;
@@ -54464,7 +54497,7 @@ function createBridgeMessageHandler(deps) {
54464
54497
  }
54465
54498
  }
54466
54499
  socket.on("message", async (data) => {
54467
- const spanId = import_node_crypto9.default.randomUUID();
54500
+ const spanId = import_node_crypto10.default.randomUUID();
54468
54501
  if (logCtx) {
54469
54502
  logCtx.span.id = spanId;
54470
54503
  logCtx.span.at = Date.now();
@@ -55042,7 +55075,7 @@ function createBridgeMessageHandler(deps) {
55042
55075
  thread.inFlight = true;
55043
55076
  pendingTurnSessions.delete(directorSessionId);
55044
55077
  thread.replay = createReplayBuffer({
55045
- turnId: (0, import_node_crypto9.randomUUID)(),
55078
+ turnId: (0, import_node_crypto10.randomUUID)(),
55046
55079
  spanId,
55047
55080
  ...deps.retentionMs !== void 0 ? { retentionMs: deps.retentionMs } : {},
55048
55081
  ...deps.ackLingerMs !== void 0 ? { ackLingerMs: deps.ackLingerMs } : {}
@@ -55689,7 +55722,7 @@ async function startDirectorBridge() {
55689
55722
  };
55690
55723
  const sessionSinks = createSessionSinkRegistry();
55691
55724
  const tombstones = /* @__PURE__ */ new Map();
55692
- const bridgeInstanceId = (0, import_node_crypto9.randomUUID)();
55725
+ const bridgeInstanceId = (0, import_node_crypto10.randomUUID)();
55693
55726
  const asyncConsumerDeps = {
55694
55727
  client,
55695
55728
  run: wrappedTurnLock.run,
@@ -55964,7 +55997,7 @@ async function startDirectorBridge() {
55964
55997
  const bridgeLogger = createBridgeLogger(config2.stateDir, process.env);
55965
55998
  let bridgeBinShaShort = "unknown00000";
55966
55999
  try {
55967
- bridgeBinShaShort = import_node_crypto9.default.createHash("sha256").update(import_node_fs17.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
56000
+ bridgeBinShaShort = import_node_crypto10.default.createHash("sha256").update(import_node_fs17.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
55968
56001
  } catch {
55969
56002
  }
55970
56003
  attachBridgeWss(server, {
@@ -56397,7 +56430,7 @@ function timingSafeTokenEqual(provided, expected) {
56397
56430
  const a = Buffer.from(provided);
56398
56431
  const b = Buffer.from(expected);
56399
56432
  if (a.length !== b.length) return false;
56400
- return import_node_crypto9.default.timingSafeEqual(a, b);
56433
+ return import_node_crypto10.default.timingSafeEqual(a, b);
56401
56434
  }
56402
56435
  function readDispatchBody(req) {
56403
56436
  return new Promise((resolve, reject) => {
@@ -56426,7 +56459,7 @@ function readOrCreateBridgeToken(stateDir) {
56426
56459
  } catch {
56427
56460
  }
56428
56461
  import_node_fs17.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
56429
- const token = import_node_crypto9.default.randomBytes(32).toString("base64url");
56462
+ const token = import_node_crypto10.default.randomBytes(32).toString("base64url");
56430
56463
  import_node_fs17.default.writeFileSync(tokenPath, `${token}
56431
56464
  `, { mode: 384 });
56432
56465
  return token;
@@ -59811,7 +59844,7 @@ var StdioServerTransport = class {
59811
59844
  };
59812
59845
 
59813
59846
  // src/tools.ts
59814
- var import_node_crypto12 = require("node:crypto");
59847
+ var import_node_crypto13 = require("node:crypto");
59815
59848
  var import_promises10 = require("node:fs/promises");
59816
59849
  var import_node_path27 = __toESM(require("node:path"), 1);
59817
59850
  var import_node_os12 = __toESM(require("node:os"), 1);
@@ -60501,7 +60534,7 @@ async function resolveActiveRunHead(input, deps) {
60501
60534
  }
60502
60535
 
60503
60536
  // src/async-tools/consensus.ts
60504
- var import_node_crypto10 = require("node:crypto");
60537
+ var import_node_crypto11 = require("node:crypto");
60505
60538
 
60506
60539
  // src/consensus/question-similarity.ts
60507
60540
  var SUPPRESSION_SIMILARITY_THRESHOLD = 0.6;
@@ -60777,9 +60810,9 @@ async function handleConsensusBlocked(result, ctx, input, resolvedTaskId) {
60777
60810
  }
60778
60811
  if (taskId) {
60779
60812
  const scopeId = taskId;
60780
- const groupId = toFile.length > 1 ? `II-${scopeId}-gate-group-${(0, import_node_crypto10.createHash)("sha256").update(toFile.map((c) => c.rawQuestion).sort().join("\n")).digest("hex").slice(0, 10)}` : void 0;
60813
+ const groupId = toFile.length > 1 ? `II-${scopeId}-gate-group-${(0, import_node_crypto11.createHash)("sha256").update(toFile.map((c) => c.rawQuestion).sort().join("\n")).digest("hex").slice(0, 10)}` : void 0;
60781
60814
  for (const clarification of toFile) {
60782
- const id = `II-${scopeId}-gate-${(0, import_node_crypto10.createHash)("sha256").update(clarification.rawQuestion).digest("hex").slice(0, 10)}`;
60815
+ const id = `II-${scopeId}-gate-${(0, import_node_crypto11.createHash)("sha256").update(clarification.rawQuestion).digest("hex").slice(0, 10)}`;
60783
60816
  try {
60784
60817
  const questionOptions = buildGateQuestionOptions(clarification.rawQuestion, clarification.category);
60785
60818
  await ctx.client.createInboxItem(input.projectSlug, {
@@ -60797,9 +60830,9 @@ async function handleConsensusBlocked(result, ctx, input, resolvedTaskId) {
60797
60830
  filedQuestionCount = toFile.length;
60798
60831
  } else if (planId) {
60799
60832
  const scopeId = planId;
60800
- const groupId = toFile.length > 1 ? `II-${scopeId}-gate-group-${(0, import_node_crypto10.createHash)("sha256").update(toFile.map((c) => c.rawQuestion).sort().join("\n")).digest("hex").slice(0, 10)}` : void 0;
60833
+ const groupId = toFile.length > 1 ? `II-${scopeId}-gate-group-${(0, import_node_crypto11.createHash)("sha256").update(toFile.map((c) => c.rawQuestion).sort().join("\n")).digest("hex").slice(0, 10)}` : void 0;
60801
60834
  for (const clarification of toFile) {
60802
- const id = `II-${scopeId}-gate-${(0, import_node_crypto10.createHash)("sha256").update(clarification.rawQuestion).digest("hex").slice(0, 10)}`;
60835
+ const id = `II-${scopeId}-gate-${(0, import_node_crypto11.createHash)("sha256").update(clarification.rawQuestion).digest("hex").slice(0, 10)}`;
60803
60836
  try {
60804
60837
  const questionOptions = buildGateQuestionOptions(clarification.rawQuestion, clarification.category);
60805
60838
  await ctx.client.createInboxItem(input.projectSlug, {
@@ -60823,7 +60856,7 @@ async function handleConsensusBlocked(result, ctx, input, resolvedTaskId) {
60823
60856
  taskId: page.taskId ?? null
60824
60857
  });
60825
60858
  const reviewHash = domainScopedReviewHash2(page.contentHash, domain2);
60826
- const baseBlockItemId = `II-${taskId}-gateblock-${(0, import_node_crypto10.createHash)("sha256").update(reviewHash).digest("hex").slice(0, 10)}`;
60859
+ const baseBlockItemId = `II-${taskId}-gateblock-${(0, import_node_crypto11.createHash)("sha256").update(reviewHash).digest("hex").slice(0, 10)}`;
60827
60860
  const reviewAgainAvailable = !taskInboxItems.some(
60828
60861
  (item) => item.id === baseBlockItemId && item.status !== "pending" && item.answer === REVIEW_AGAIN_ANSWER
60829
60862
  );
@@ -61545,7 +61578,7 @@ function createReportEvidenceDescriptor() {
61545
61578
  var reportEvidenceDescriptor = createReportEvidenceDescriptor();
61546
61579
 
61547
61580
  // src/async-tools/enqueue.ts
61548
- var import_node_crypto11 = __toESM(require("node:crypto"), 1);
61581
+ var import_node_crypto12 = __toESM(require("node:crypto"), 1);
61549
61582
  async function enqueueAsyncTool(client, descriptor2, input) {
61550
61583
  if (descriptor2.cachedResult) {
61551
61584
  const cached2 = await descriptor2.cachedResult(client, input);
@@ -61558,7 +61591,7 @@ async function enqueueAsyncTool(client, descriptor2, input) {
61558
61591
  if (active) {
61559
61592
  return { status: "already_running", jobId: active.id, message: "Already running; will notify in inbox." };
61560
61593
  }
61561
- const jobId = `AJ-${import_node_crypto11.default.randomUUID()}`;
61594
+ const jobId = `AJ-${import_node_crypto12.default.randomUUID()}`;
61562
61595
  try {
61563
61596
  await client.createAsyncJob(input.projectSlug, {
61564
61597
  id: jobId,
@@ -63138,7 +63171,7 @@ function createMrrlinTools(options) {
63138
63171
  "PRODUCED_URL_RECORD_FAILED",
63139
63172
  "Unable to record produced URL.",
63140
63173
  async (c, { projectSlug, runId, url: url2, label }) => {
63141
- const id = `EA-pu-${(0, import_node_crypto12.randomBytes)(4).toString("hex")}`;
63174
+ const id = `EA-pu-${(0, import_node_crypto13.randomBytes)(4).toString("hex")}`;
63142
63175
  const payload = label ? { url: url2, label } : { url: url2 };
63143
63176
  return await c.appendExecutionArtifact(projectSlug, runId, {
63144
63177
  id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
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",
25
24
  "@mrrlin/agent-client": "0.0.0",
26
- "@mrrlin/director-e2e": "0.0.0",
27
25
  "@mrrlin/schemas": "0.0.0",
26
+ "@mrrlin/client": "0.0.0",
28
27
  "@mrrlin/tsconfig": "0.0.0",
29
- "@mrrlin/wiki": "0.0.0"
28
+ "@mrrlin/wiki": "0.0.0",
29
+ "@mrrlin/director-e2e": "0.0.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "@iarna/toml": "^2.2.5",