@mrrlin-dev/mcp 0.4.154 → 0.4.156
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.
- package/dist/bin.cjs +69 -29
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -38603,6 +38603,9 @@ var manualTaskClosureRequestSchema = external_exports.object({
|
|
|
38603
38603
|
reason: external_exports.string().optional()
|
|
38604
38604
|
});
|
|
38605
38605
|
|
|
38606
|
+
// ../../packages/schemas/dist/report-auth.js
|
|
38607
|
+
var encoder2 = new TextEncoder();
|
|
38608
|
+
|
|
38606
38609
|
// ../../packages/schemas/dist/index.js
|
|
38607
38610
|
var mrrlinTaskStatusSchema = external_exports.enum([
|
|
38608
38611
|
"backlog",
|
|
@@ -38775,6 +38778,18 @@ var githubRepositorySelectionSchema = external_exports.enum(["all", "selected"])
|
|
|
38775
38778
|
var mrrlinTaskIdSchema = external_exports.string().regex(/^GT-\d+$/);
|
|
38776
38779
|
var mrrlinPlanIdSchema = external_exports.string().regex(/^PL-\d+$/);
|
|
38777
38780
|
var mrrlinWikiPageIdSchema = external_exports.string().regex(/^WK-\d+$/);
|
|
38781
|
+
function nextMrrlinWikiPageId(existingIds) {
|
|
38782
|
+
let max = 0n;
|
|
38783
|
+
for (const id of existingIds) {
|
|
38784
|
+
const match = /^WK-(\d+)$/.exec(id);
|
|
38785
|
+
if (!match?.[1])
|
|
38786
|
+
continue;
|
|
38787
|
+
const n = BigInt(match[1]);
|
|
38788
|
+
if (n > max)
|
|
38789
|
+
max = n;
|
|
38790
|
+
}
|
|
38791
|
+
return `WK-${max + 1n}`;
|
|
38792
|
+
}
|
|
38778
38793
|
var mrrlinWikiPagePathSchema = external_exports.string().regex(/^\/[a-z0-9-]+\/[a-z0-9-]+$/);
|
|
38779
38794
|
var PROJECT_CONSTITUTION_PAGE = {
|
|
38780
38795
|
folder: "Memory",
|
|
@@ -40941,7 +40956,12 @@ function createMrrlinClient(config2) {
|
|
|
40941
40956
|
}
|
|
40942
40957
|
async function executeFetch(path34, init) {
|
|
40943
40958
|
const method = (init?.method ?? "GET").toUpperCase();
|
|
40944
|
-
const
|
|
40959
|
+
const dynamicHeaders = typeof config2.headers === "function" ? await config2.headers() : config2.headers;
|
|
40960
|
+
const headers = new Headers(dynamicHeaders ?? {});
|
|
40961
|
+
if (init?.headers) {
|
|
40962
|
+
const extraHeaders = new Headers(init.headers);
|
|
40963
|
+
extraHeaders.forEach((val, key) => headers.set(key, val));
|
|
40964
|
+
}
|
|
40945
40965
|
if (token && !headers.has("authorization")) {
|
|
40946
40966
|
headers.set("authorization", `Bearer ${token}`);
|
|
40947
40967
|
}
|
|
@@ -40962,10 +40982,8 @@ function createMrrlinClient(config2) {
|
|
|
40962
40982
|
if (retryAfterMs !== null && retryAfterMs > 1e4) {
|
|
40963
40983
|
return response;
|
|
40964
40984
|
}
|
|
40965
|
-
|
|
40966
|
-
|
|
40967
|
-
} catch {
|
|
40968
|
-
}
|
|
40985
|
+
void response.body?.cancel().catch(() => {
|
|
40986
|
+
});
|
|
40969
40987
|
const backoffMs = retryAfterMs ?? Math.floor(Math.random() * Math.min(2e3, 250 * Math.pow(2, attempt)));
|
|
40970
40988
|
await abortableDelay(backoffMs, init?.signal);
|
|
40971
40989
|
continue;
|
|
@@ -44164,7 +44182,7 @@ function renderContextBundle(input) {
|
|
|
44164
44182
|
const { keptRuns, keptArtifacts, keptAutonomy, anyHistoricalDropped, droppedHandles } = applyHistoricalBudgetIfNeeded(input);
|
|
44165
44183
|
sections.push(renderRunHistory(keptRuns, input.openRunId, input.compact, anyHistoricalDropped));
|
|
44166
44184
|
sections.push(renderOpenRun(input.openRunId));
|
|
44167
|
-
sections.push(renderArtifacts(keptArtifacts, input.omittedArtifactCount ?? 0, input.compact, anyHistoricalDropped, droppedHandles));
|
|
44185
|
+
sections.push(renderArtifacts(keptArtifacts, input.omittedArtifactCount ?? 0, input.compact, anyHistoricalDropped, droppedHandles, keptArtifacts.length < input.artifacts.length));
|
|
44168
44186
|
sections.push(renderAutonomyEvents(keptAutonomy, input.compact, anyHistoricalDropped));
|
|
44169
44187
|
return sections.join("\n\n");
|
|
44170
44188
|
}
|
|
@@ -44249,9 +44267,10 @@ function renderOpenRun(openRunId) {
|
|
|
44249
44267
|
return `## Open run (normative)
|
|
44250
44268
|
${openRunId ?? "(none)"}`;
|
|
44251
44269
|
}
|
|
44252
|
-
function renderArtifacts(artifacts, omittedCount, compact, anyHistoricalDropped, droppedHandles) {
|
|
44253
|
-
if (artifacts.length === 0 && omittedCount === 0)
|
|
44270
|
+
function renderArtifacts(artifacts, omittedCount, compact, anyHistoricalDropped, droppedHandles, anyArtifactDropped) {
|
|
44271
|
+
if (artifacts.length === 0 && omittedCount === 0 && !(compact && anyArtifactDropped && droppedHandles.length > 0)) {
|
|
44254
44272
|
return "## Artifacts (historical)\n(none)";
|
|
44273
|
+
}
|
|
44255
44274
|
const lines2 = ["## Artifacts (historical)"];
|
|
44256
44275
|
if (omittedCount > 0) {
|
|
44257
44276
|
lines2.push(`(+${omittedCount} older artifact${omittedCount === 1 ? "" : "s"} omitted)`);
|
|
@@ -46851,7 +46870,23 @@ async function startProviderProxy(allowedHosts, options) {
|
|
|
46851
46870
|
clientSocket.end("HTTP/1.1 403 Forbidden\r\n\r\n");
|
|
46852
46871
|
return;
|
|
46853
46872
|
}
|
|
46873
|
+
let upstreamSocket = null;
|
|
46874
|
+
let validatedAuthority = false;
|
|
46875
|
+
clientSocket.once("end", () => {
|
|
46876
|
+
if (!validatedAuthority) {
|
|
46877
|
+
upstreamSocket?.destroy();
|
|
46878
|
+
clientSocket.destroy();
|
|
46879
|
+
}
|
|
46880
|
+
});
|
|
46881
|
+
clientSocket.once("close", () => {
|
|
46882
|
+
upstreamSocket?.destroy();
|
|
46883
|
+
});
|
|
46884
|
+
clientSocket.on("error", () => {
|
|
46885
|
+
upstreamSocket?.destroy();
|
|
46886
|
+
});
|
|
46854
46887
|
import_node_dns.default.promises.lookup(targetHost, { all: true }).then((addresses) => {
|
|
46888
|
+
if (clientSocket.destroyed)
|
|
46889
|
+
return;
|
|
46855
46890
|
if (!addresses || addresses.length === 0) {
|
|
46856
46891
|
clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
|
|
46857
46892
|
return;
|
|
@@ -46864,13 +46899,12 @@ async function startProviderProxy(allowedHosts, options) {
|
|
|
46864
46899
|
}
|
|
46865
46900
|
const firstAddress = addresses[0];
|
|
46866
46901
|
if (!firstAddress) {
|
|
46867
|
-
clientSocket.end("HTTP/1.1 502 Bad Gateway
|
|
46902
|
+
clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
|
|
46868
46903
|
return;
|
|
46869
46904
|
}
|
|
46870
46905
|
const validatedIp = options?.allowPrivateUpstream ? "127.0.0.1" : firstAddress.address;
|
|
46871
46906
|
const serverSocket = import_node_net.default.connect({ host: validatedIp, port: targetPort }, () => {
|
|
46872
46907
|
clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
|
|
46873
|
-
let validatedAuthority = false;
|
|
46874
46908
|
let clientBuffer = head && head.length > 0 ? Buffer.from(head) : Buffer.alloc(0);
|
|
46875
46909
|
const validateAndPipe = (chunk) => {
|
|
46876
46910
|
if (chunk) {
|
|
@@ -46931,14 +46965,13 @@ async function startProviderProxy(allowedHosts, options) {
|
|
|
46931
46965
|
validateAndPipe();
|
|
46932
46966
|
}
|
|
46933
46967
|
});
|
|
46968
|
+
upstreamSocket = serverSocket;
|
|
46934
46969
|
serverSocket.on("error", () => {
|
|
46935
46970
|
clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
|
|
46936
46971
|
});
|
|
46937
|
-
clientSocket.on("error", () => {
|
|
46938
|
-
serverSocket.destroy();
|
|
46939
|
-
});
|
|
46940
46972
|
}).catch(() => {
|
|
46941
|
-
clientSocket.
|
|
46973
|
+
if (!clientSocket.destroyed)
|
|
46974
|
+
clientSocket.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
|
|
46942
46975
|
});
|
|
46943
46976
|
});
|
|
46944
46977
|
let assignedPort;
|
|
@@ -56893,14 +56926,7 @@ function findDuplicateLabelEnvPairs(entries) {
|
|
|
56893
56926
|
return pairs;
|
|
56894
56927
|
}
|
|
56895
56928
|
function nextWikiPageId(pages) {
|
|
56896
|
-
|
|
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}`;
|
|
56929
|
+
return nextMrrlinWikiPageId(pages.map((page) => page.id));
|
|
56904
56930
|
}
|
|
56905
56931
|
function buildDraftSpecPrompt(task, constitution, deployTarget = null) {
|
|
56906
56932
|
const budget = resolveSpecBudget(task.impact);
|
|
@@ -64033,7 +64059,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
64033
64059
|
}
|
|
64034
64060
|
|
|
64035
64061
|
// src/_generated/version.ts
|
|
64036
|
-
var PKG_VERSION = "0.4.
|
|
64062
|
+
var PKG_VERSION = "0.4.156";
|
|
64037
64063
|
|
|
64038
64064
|
// src/bridge-allowed-origins.ts
|
|
64039
64065
|
var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|
|
@@ -75689,17 +75715,31 @@ function reauthorizeRedirect(params) {
|
|
|
75689
75715
|
|
|
75690
75716
|
// src/verification-broker.ts
|
|
75691
75717
|
var TEST_CONNECT_OVERRIDE_SYMBOL = Symbol.for("mrrlin.test.connectOverride");
|
|
75718
|
+
var MAX_UNIX_SOCKET_PATH_BYTES = 103;
|
|
75719
|
+
function createBrokerSocketPath(runId, nonce, baseDirs = process.platform === "win32" ? [import_node_os19.default.tmpdir()] : [import_node_os19.default.tmpdir(), "/tmp"]) {
|
|
75720
|
+
const fileName = `b-${runId.replace(/[^a-zA-Z0-9_-]/g, "").slice(0, 24)}-${nonce.slice(0, 16)}.sock`;
|
|
75721
|
+
for (const base of baseDirs) {
|
|
75722
|
+
let dir;
|
|
75723
|
+
try {
|
|
75724
|
+
dir = import_node_fs26.default.mkdtempSync(import_node_path39.default.join(base, "mrrlin-b-"));
|
|
75725
|
+
} catch {
|
|
75726
|
+
continue;
|
|
75727
|
+
}
|
|
75728
|
+
const socketPath = import_node_path39.default.join(dir, fileName);
|
|
75729
|
+
if (process.platform === "win32" || Buffer.byteLength(socketPath) <= MAX_UNIX_SOCKET_PATH_BYTES) {
|
|
75730
|
+
import_node_fs26.default.chmodSync(dir, 448);
|
|
75731
|
+
return { dir, socketPath };
|
|
75732
|
+
}
|
|
75733
|
+
import_node_fs26.default.rmSync(dir, { recursive: true, force: true });
|
|
75734
|
+
}
|
|
75735
|
+
throw new Error(`BROKER_SOCKET_ERROR: no temp directory gives a socket path within ${MAX_UNIX_SOCKET_PATH_BYTES} bytes`);
|
|
75736
|
+
}
|
|
75692
75737
|
async function createVerificationBrokerSession(options) {
|
|
75693
75738
|
const nonce = import_node_crypto22.default.randomBytes(16).toString("hex");
|
|
75694
75739
|
let createdDir = null;
|
|
75695
75740
|
let socketPath = options.socketPath;
|
|
75696
75741
|
if (!socketPath) {
|
|
75697
|
-
createdDir =
|
|
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
|
-
);
|
|
75742
|
+
({ dir: createdDir, socketPath } = createBrokerSocketPath(options.runId, nonce));
|
|
75703
75743
|
}
|
|
75704
75744
|
try {
|
|
75705
75745
|
if (import_node_fs26.default.existsSync(socketPath)) {
|