@mrrlin-dev/mcp 0.4.154 → 0.4.155

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 +60 -28
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -38775,6 +38775,18 @@ var githubRepositorySelectionSchema = external_exports.enum(["all", "selected"])
38775
38775
  var mrrlinTaskIdSchema = external_exports.string().regex(/^GT-\d+$/);
38776
38776
  var mrrlinPlanIdSchema = external_exports.string().regex(/^PL-\d+$/);
38777
38777
  var mrrlinWikiPageIdSchema = external_exports.string().regex(/^WK-\d+$/);
38778
+ function nextMrrlinWikiPageId(existingIds) {
38779
+ let max = 0n;
38780
+ for (const id of existingIds) {
38781
+ const match = /^WK-(\d+)$/.exec(id);
38782
+ if (!match?.[1])
38783
+ continue;
38784
+ const n = BigInt(match[1]);
38785
+ if (n > max)
38786
+ max = n;
38787
+ }
38788
+ return `WK-${max + 1n}`;
38789
+ }
38778
38790
  var mrrlinWikiPagePathSchema = external_exports.string().regex(/^\/[a-z0-9-]+\/[a-z0-9-]+$/);
38779
38791
  var PROJECT_CONSTITUTION_PAGE = {
38780
38792
  folder: "Memory",
@@ -40962,10 +40974,8 @@ function createMrrlinClient(config2) {
40962
40974
  if (retryAfterMs !== null && retryAfterMs > 1e4) {
40963
40975
  return response;
40964
40976
  }
40965
- try {
40966
- await response.body?.cancel();
40967
- } catch {
40968
- }
40977
+ void response.body?.cancel().catch(() => {
40978
+ });
40969
40979
  const backoffMs = retryAfterMs ?? Math.floor(Math.random() * Math.min(2e3, 250 * Math.pow(2, attempt)));
40970
40980
  await abortableDelay(backoffMs, init?.signal);
40971
40981
  continue;
@@ -44164,7 +44174,7 @@ function renderContextBundle(input) {
44164
44174
  const { keptRuns, keptArtifacts, keptAutonomy, anyHistoricalDropped, droppedHandles } = applyHistoricalBudgetIfNeeded(input);
44165
44175
  sections.push(renderRunHistory(keptRuns, input.openRunId, input.compact, anyHistoricalDropped));
44166
44176
  sections.push(renderOpenRun(input.openRunId));
44167
- sections.push(renderArtifacts(keptArtifacts, input.omittedArtifactCount ?? 0, input.compact, anyHistoricalDropped, droppedHandles));
44177
+ sections.push(renderArtifacts(keptArtifacts, input.omittedArtifactCount ?? 0, input.compact, anyHistoricalDropped, droppedHandles, keptArtifacts.length < input.artifacts.length));
44168
44178
  sections.push(renderAutonomyEvents(keptAutonomy, input.compact, anyHistoricalDropped));
44169
44179
  return sections.join("\n\n");
44170
44180
  }
@@ -44249,9 +44259,10 @@ function renderOpenRun(openRunId) {
44249
44259
  return `## Open run (normative)
44250
44260
  ${openRunId ?? "(none)"}`;
44251
44261
  }
44252
- function renderArtifacts(artifacts, omittedCount, compact, anyHistoricalDropped, droppedHandles) {
44253
- if (artifacts.length === 0 && omittedCount === 0)
44262
+ function renderArtifacts(artifacts, omittedCount, compact, anyHistoricalDropped, droppedHandles, anyArtifactDropped) {
44263
+ if (artifacts.length === 0 && omittedCount === 0 && !(compact && anyArtifactDropped && droppedHandles.length > 0)) {
44254
44264
  return "## Artifacts (historical)\n(none)";
44265
+ }
44255
44266
  const lines2 = ["## Artifacts (historical)"];
44256
44267
  if (omittedCount > 0) {
44257
44268
  lines2.push(`(+${omittedCount} older artifact${omittedCount === 1 ? "" : "s"} omitted)`);
@@ -46851,7 +46862,23 @@ async function startProviderProxy(allowedHosts, options) {
46851
46862
  clientSocket.end("HTTP/1.1 403 Forbidden\r\n\r\n");
46852
46863
  return;
46853
46864
  }
46865
+ let upstreamSocket = null;
46866
+ let validatedAuthority = false;
46867
+ clientSocket.once("end", () => {
46868
+ if (!validatedAuthority) {
46869
+ upstreamSocket?.destroy();
46870
+ clientSocket.destroy();
46871
+ }
46872
+ });
46873
+ clientSocket.once("close", () => {
46874
+ upstreamSocket?.destroy();
46875
+ });
46876
+ clientSocket.on("error", () => {
46877
+ upstreamSocket?.destroy();
46878
+ });
46854
46879
  import_node_dns.default.promises.lookup(targetHost, { all: true }).then((addresses) => {
46880
+ if (clientSocket.destroyed)
46881
+ return;
46855
46882
  if (!addresses || addresses.length === 0) {
46856
46883
  clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
46857
46884
  return;
@@ -46864,13 +46891,12 @@ async function startProviderProxy(allowedHosts, options) {
46864
46891
  }
46865
46892
  const firstAddress = addresses[0];
46866
46893
  if (!firstAddress) {
46867
- clientSocket.end("HTTP/1.1 502 Bad Gateway\\r\\n\\r\\n");
46894
+ clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
46868
46895
  return;
46869
46896
  }
46870
46897
  const validatedIp = options?.allowPrivateUpstream ? "127.0.0.1" : firstAddress.address;
46871
46898
  const serverSocket = import_node_net.default.connect({ host: validatedIp, port: targetPort }, () => {
46872
46899
  clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
46873
- let validatedAuthority = false;
46874
46900
  let clientBuffer = head && head.length > 0 ? Buffer.from(head) : Buffer.alloc(0);
46875
46901
  const validateAndPipe = (chunk) => {
46876
46902
  if (chunk) {
@@ -46931,14 +46957,13 @@ async function startProviderProxy(allowedHosts, options) {
46931
46957
  validateAndPipe();
46932
46958
  }
46933
46959
  });
46960
+ upstreamSocket = serverSocket;
46934
46961
  serverSocket.on("error", () => {
46935
46962
  clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
46936
46963
  });
46937
- clientSocket.on("error", () => {
46938
- serverSocket.destroy();
46939
- });
46940
46964
  }).catch(() => {
46941
- clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
46965
+ if (!clientSocket.destroyed)
46966
+ clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
46942
46967
  });
46943
46968
  });
46944
46969
  let assignedPort;
@@ -56893,14 +56918,7 @@ function findDuplicateLabelEnvPairs(entries) {
56893
56918
  return pairs;
56894
56919
  }
56895
56920
  function nextWikiPageId(pages) {
56896
- let max = 0;
56897
- for (const page of pages) {
56898
- const match = /^WK-(\d+)$/.exec(page.id);
56899
- if (!match) continue;
56900
- const n = Number.parseInt(match[1] ?? "0", 10);
56901
- if (Number.isInteger(n) && n > max) max = n;
56902
- }
56903
- return `WK-${max + 1}`;
56921
+ return nextMrrlinWikiPageId(pages.map((page) => page.id));
56904
56922
  }
56905
56923
  function buildDraftSpecPrompt(task, constitution, deployTarget = null) {
56906
56924
  const budget = resolveSpecBudget(task.impact);
@@ -64033,7 +64051,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
64033
64051
  }
64034
64052
 
64035
64053
  // src/_generated/version.ts
64036
- var PKG_VERSION = "0.4.154";
64054
+ var PKG_VERSION = "0.4.155";
64037
64055
 
64038
64056
  // src/bridge-allowed-origins.ts
64039
64057
  var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
@@ -75689,17 +75707,31 @@ function reauthorizeRedirect(params) {
75689
75707
 
75690
75708
  // src/verification-broker.ts
75691
75709
  var TEST_CONNECT_OVERRIDE_SYMBOL = Symbol.for("mrrlin.test.connectOverride");
75710
+ var MAX_UNIX_SOCKET_PATH_BYTES = 103;
75711
+ function createBrokerSocketPath(runId, nonce, baseDirs = process.platform === "win32" ? [import_node_os19.default.tmpdir()] : [import_node_os19.default.tmpdir(), "/tmp"]) {
75712
+ const fileName = `b-${runId.replace(/[^a-zA-Z0-9_-]/g, "").slice(0, 24)}-${nonce.slice(0, 16)}.sock`;
75713
+ for (const base of baseDirs) {
75714
+ let dir;
75715
+ try {
75716
+ dir = import_node_fs26.default.mkdtempSync(import_node_path39.default.join(base, "mrrlin-b-"));
75717
+ } catch {
75718
+ continue;
75719
+ }
75720
+ const socketPath = import_node_path39.default.join(dir, fileName);
75721
+ if (process.platform === "win32" || Buffer.byteLength(socketPath) <= MAX_UNIX_SOCKET_PATH_BYTES) {
75722
+ import_node_fs26.default.chmodSync(dir, 448);
75723
+ return { dir, socketPath };
75724
+ }
75725
+ import_node_fs26.default.rmSync(dir, { recursive: true, force: true });
75726
+ }
75727
+ throw new Error(`BROKER_SOCKET_ERROR: no temp directory gives a socket path within ${MAX_UNIX_SOCKET_PATH_BYTES} bytes`);
75728
+ }
75692
75729
  async function createVerificationBrokerSession(options) {
75693
75730
  const nonce = import_node_crypto22.default.randomBytes(16).toString("hex");
75694
75731
  let createdDir = null;
75695
75732
  let socketPath = options.socketPath;
75696
75733
  if (!socketPath) {
75697
- createdDir = import_node_fs26.default.mkdtempSync(import_node_path39.default.join(import_node_os19.default.tmpdir(), "mrrlin-broker-"));
75698
- import_node_fs26.default.chmodSync(createdDir, 448);
75699
- socketPath = import_node_path39.default.join(
75700
- createdDir,
75701
- `broker-${options.runId.replace(/[^a-zA-Z0-9_-]/g, "")}-${nonce}.sock`
75702
- );
75734
+ ({ dir: createdDir, socketPath } = createBrokerSocketPath(options.runId, nonce));
75703
75735
  }
75704
75736
  try {
75705
75737
  if (import_node_fs26.default.existsSync(socketPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.154",
3
+ "version": "0.4.155",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"