@mrrlin-dev/mcp 0.4.202 → 0.4.204
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 +95 -14
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -64306,6 +64306,7 @@ var openApiOperationIds = {
|
|
|
64306
64306
|
takeOverTask: "takeOverTask",
|
|
64307
64307
|
closeTaskAsWontDo: "closeTaskAsWontDo",
|
|
64308
64308
|
getWikiPage: "getWikiPage",
|
|
64309
|
+
getWikiPageLinkedTaskV1: "getWikiPageLinkedTaskV1",
|
|
64309
64310
|
listExecutionArtifacts: "listExecutionArtifacts",
|
|
64310
64311
|
listExecutionRuns: "listExecutionRuns",
|
|
64311
64312
|
listPlans: "listPlans",
|
|
@@ -66505,6 +66506,11 @@ var githubRepositorySelectionSchema = external_exports.enum(["all", "selected"])
|
|
|
66505
66506
|
var mrrlinTaskIdSchema = external_exports.string().regex(/^GT-\d+$/);
|
|
66506
66507
|
var mrrlinPlanIdSchema = external_exports.string().regex(/^PL-\d+$/);
|
|
66507
66508
|
var mrrlinWikiPageIdSchema = external_exports.string().regex(/^WK-\d+$/);
|
|
66509
|
+
var linkedTaskPageIdSchema = mrrlinWikiPageIdSchema.max(128);
|
|
66510
|
+
var linkedTaskResponseSchema = external_exports.object({
|
|
66511
|
+
contract: external_exports.literal("spec-linked-task-v1"),
|
|
66512
|
+
taskId: mrrlinTaskIdSchema.max(128).nullable()
|
|
66513
|
+
}).strict();
|
|
66508
66514
|
function nextMrrlinWikiPageId(existingIds) {
|
|
66509
66515
|
let max = 0n;
|
|
66510
66516
|
for (const id of existingIds) {
|
|
@@ -68699,6 +68705,40 @@ var accountSummaryResponseSchema = external_exports.object({
|
|
|
68699
68705
|
}))
|
|
68700
68706
|
})
|
|
68701
68707
|
});
|
|
68708
|
+
var compactSchedulerPath = "/internal/scheduler/run-compact-v1";
|
|
68709
|
+
var compactSchedulerMaxBytes = 64 * 1024;
|
|
68710
|
+
var schedulerCount = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
68711
|
+
var schedulerTotals = external_exports.object({
|
|
68712
|
+
createdRuns: schedulerCount,
|
|
68713
|
+
createdProposals: schedulerCount,
|
|
68714
|
+
enqueuedConsensus: schedulerCount,
|
|
68715
|
+
enqueuedSpecDrafts: schedulerCount,
|
|
68716
|
+
autoApprovedSpecs: schedulerCount,
|
|
68717
|
+
skippedTasks: schedulerCount,
|
|
68718
|
+
failures: schedulerCount,
|
|
68719
|
+
skippedReasons: external_exports.partialRecord(external_exports.union([mrrlinStopReasonSchema, external_exports.literal("unknown")]), schedulerCount)
|
|
68720
|
+
}).strict();
|
|
68721
|
+
var schedulerGroup = (item) => external_exports.discriminatedUnion("status", [
|
|
68722
|
+
external_exports.object({ status: external_exports.literal("omitted") }).strict(),
|
|
68723
|
+
external_exports.object({ status: external_exports.literal("complete"), items: external_exports.array(item).max(1024) }).strict()
|
|
68724
|
+
]);
|
|
68725
|
+
var schedulerIdentity = external_exports.string().min(1);
|
|
68726
|
+
var schedulerJobHint = external_exports.object({ projectSlug: schedulerIdentity, jobId: schedulerIdentity }).strict();
|
|
68727
|
+
var schedulerDate = external_exports.string().refine((value) => {
|
|
68728
|
+
const epoch = Date.parse(value);
|
|
68729
|
+
return Number.isFinite(epoch) && new Date(epoch).toISOString() === value;
|
|
68730
|
+
}, "Expected a canonical scheduler timestamp");
|
|
68731
|
+
var compactSchedulerResponseSchema = external_exports.object({
|
|
68732
|
+
version: external_exports.literal(1),
|
|
68733
|
+
evaluatedAt: schedulerDate,
|
|
68734
|
+
nextWakeAt: schedulerDate.nullable(),
|
|
68735
|
+
projectCount: schedulerCount,
|
|
68736
|
+
totals: schedulerTotals,
|
|
68737
|
+
createdRuns: schedulerGroup(external_exports.object({ projectSlug: schedulerIdentity, runId: schedulerIdentity }).strict()),
|
|
68738
|
+
enqueuedConsensus: schedulerGroup(schedulerJobHint),
|
|
68739
|
+
enqueuedSpecDrafts: schedulerGroup(schedulerJobHint),
|
|
68740
|
+
perProject: schedulerGroup(schedulerTotals.extend({ projectSlug: schedulerIdentity }))
|
|
68741
|
+
}).strict();
|
|
68702
68742
|
|
|
68703
68743
|
// ../../packages/client/dist/agent-token-provider.js
|
|
68704
68744
|
var AgentTokenProviderError = class extends Error {
|
|
@@ -69251,6 +69291,13 @@ function createMrrlinClient(config2) {
|
|
|
69251
69291
|
const body = await request(`${projectPath(projectSlug)}/tasks/${encodeURIComponent(taskId)}`);
|
|
69252
69292
|
return taskResponseSchema.parse(body).data;
|
|
69253
69293
|
},
|
|
69294
|
+
async getWikiPageLinkedTaskV1(projectSlug, pageId) {
|
|
69295
|
+
const path40 = `${projectPath(projectSlug)}/wiki/${encodeURIComponent(pageId)}/linked-task/v1`;
|
|
69296
|
+
const response = await executeFetch(path40);
|
|
69297
|
+
if (response.status !== 200)
|
|
69298
|
+
await handleResponseError(response, "GET", path40);
|
|
69299
|
+
return linkedTaskResponseSchema.parse(await response.json()).taskId;
|
|
69300
|
+
},
|
|
69254
69301
|
async getWikiPage(projectSlug, pageId) {
|
|
69255
69302
|
const body = await request(`${projectPath(projectSlug)}/wiki/${encodeURIComponent(pageId)}`);
|
|
69256
69303
|
return wikiPageResponseSchema.parse(body).data;
|
|
@@ -97822,7 +97869,7 @@ async function readBounded(response, maxBytes) {
|
|
|
97822
97869
|
reader.releaseLock();
|
|
97823
97870
|
}
|
|
97824
97871
|
}
|
|
97825
|
-
function createScopedRequest(options, mode) {
|
|
97872
|
+
function createScopedRequest(options, mode, compactTick = false) {
|
|
97826
97873
|
if (options.tokenProvider.supportsScopedExchange !== true) throw new Error("BRIDGE_SCOPED_AUTH_UNAVAILABLE");
|
|
97827
97874
|
return async (callerSignal, heartbeat, absoluteDeadline) => {
|
|
97828
97875
|
try {
|
|
@@ -97932,11 +97979,15 @@ function createScopedRequest(options, mode) {
|
|
|
97932
97979
|
}));
|
|
97933
97980
|
}
|
|
97934
97981
|
check2("tick");
|
|
97935
|
-
return request("tick", options.apiBaseUrl.replace(/\/$/, "") + "/internal/scheduler/run", {
|
|
97982
|
+
return request("tick", options.apiBaseUrl.replace(/\/$/, "") + (compactTick ? compactSchedulerPath : "/internal/scheduler/run"), {
|
|
97936
97983
|
method: "POST",
|
|
97937
97984
|
headers: { authorization: "Bearer " + token }
|
|
97938
97985
|
}, async (response) => {
|
|
97939
97986
|
if (!response.ok) return { ok: false, status: response.status };
|
|
97987
|
+
if (compactTick) {
|
|
97988
|
+
const body = JSON.parse(await readBounded(response, compactSchedulerMaxBytes));
|
|
97989
|
+
return { ok: true, compact: compactSchedulerResponseSchema.parse(body) };
|
|
97990
|
+
}
|
|
97940
97991
|
return { ok: true, body: JSON.parse(await readBounded(response, TICK_MAX_BYTES)) };
|
|
97941
97992
|
});
|
|
97942
97993
|
});
|
|
@@ -97949,8 +98000,8 @@ function createScopedRequest(options, mode) {
|
|
|
97949
98000
|
}
|
|
97950
98001
|
};
|
|
97951
98002
|
}
|
|
97952
|
-
function createScopedSchedulerRequest(options) {
|
|
97953
|
-
const request = createScopedRequest(options, "scheduler");
|
|
98003
|
+
function createScopedSchedulerRequest(options, compactTick = false) {
|
|
98004
|
+
const request = createScopedRequest(options, "scheduler", compactTick);
|
|
97954
98005
|
return async () => {
|
|
97955
98006
|
const result = await request();
|
|
97956
98007
|
if (!("ok" in result)) throw new Error("BRIDGE_SCHEDULER_REQUEST_FAILED");
|
|
@@ -99259,7 +99310,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
99259
99310
|
}
|
|
99260
99311
|
|
|
99261
99312
|
// src/_generated/version.ts
|
|
99262
|
-
var PKG_VERSION = "0.4.
|
|
99313
|
+
var PKG_VERSION = "0.4.204";
|
|
99263
99314
|
|
|
99264
99315
|
// src/bridge-allowed-origins.ts
|
|
99265
99316
|
var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|
|
@@ -101171,7 +101222,8 @@ async function attemptSchedulerTick(deps) {
|
|
|
101171
101222
|
bridgeHealth?.recordFailure("schedulerTick", new Error(`HTTP ${response.status}`));
|
|
101172
101223
|
return { nextWakeAt: null, failed: true };
|
|
101173
101224
|
}
|
|
101174
|
-
const
|
|
101225
|
+
const compact = "compact" in response ? response.compact : void 0;
|
|
101226
|
+
const body = "body" in response ? response.body : void 0;
|
|
101175
101227
|
const data = body?.data ?? {};
|
|
101176
101228
|
const results = Array.isArray(data.results) ? data.results : [];
|
|
101177
101229
|
deps.logger.logOut({
|
|
@@ -101180,9 +101232,9 @@ async function attemptSchedulerTick(deps) {
|
|
|
101180
101232
|
type: "<scheduler-tick>",
|
|
101181
101233
|
payload: {
|
|
101182
101234
|
event: "bridge.scheduler_tick",
|
|
101183
|
-
evaluatedAt: typeof data.evaluatedAt === "string" ? data.evaluatedAt : null,
|
|
101184
|
-
projectCount: typeof data.projectCount === "number" ? data.projectCount : results.length,
|
|
101185
|
-
totals: {
|
|
101235
|
+
evaluatedAt: compact?.evaluatedAt ?? (typeof data.evaluatedAt === "string" ? data.evaluatedAt : null),
|
|
101236
|
+
projectCount: compact?.projectCount ?? (typeof data.projectCount === "number" ? data.projectCount : results.length),
|
|
101237
|
+
totals: compact?.totals ?? {
|
|
101186
101238
|
createdRuns: results.reduce((sum, r) => sum + count(r.createdRuns), 0),
|
|
101187
101239
|
createdProposals: results.reduce((sum, r) => sum + count(r.createdProposals), 0),
|
|
101188
101240
|
enqueuedConsensus: results.reduce((sum, r) => sum + count(r.enqueuedConsensus), 0),
|
|
@@ -101194,7 +101246,7 @@ async function attemptSchedulerTick(deps) {
|
|
|
101194
101246
|
skippedReasons: mergeReasons(results.map((r) => tallyReasons(r.skippedTasks))),
|
|
101195
101247
|
failures: results.reduce((sum, r) => sum + count(r.failures), 0)
|
|
101196
101248
|
},
|
|
101197
|
-
perProject: results.map((r) => ({
|
|
101249
|
+
perProject: compact ? compact.perProject.status === "complete" ? compact.perProject.items : null : results.map((r) => ({
|
|
101198
101250
|
projectSlug: typeof r.projectSlug === "string" ? r.projectSlug : "unknown",
|
|
101199
101251
|
createdRuns: count(r.createdRuns),
|
|
101200
101252
|
createdProposals: count(r.createdProposals),
|
|
@@ -101205,7 +101257,13 @@ async function attemptSchedulerTick(deps) {
|
|
|
101205
101257
|
skippedReasons: tallyReasons(r.skippedTasks),
|
|
101206
101258
|
failures: count(r.failures)
|
|
101207
101259
|
})),
|
|
101208
|
-
|
|
101260
|
+
...compact ? { omitted: {
|
|
101261
|
+
createdRuns: compact.createdRuns.status === "omitted",
|
|
101262
|
+
enqueuedConsensus: compact.enqueuedConsensus.status === "omitted",
|
|
101263
|
+
enqueuedSpecDrafts: compact.enqueuedSpecDrafts.status === "omitted",
|
|
101264
|
+
perProject: compact.perProject.status === "omitted"
|
|
101265
|
+
} } : {},
|
|
101266
|
+
nextWakeAt: compact ? compact.nextWakeAt : typeof data.nextWakeAt === "string" ? data.nextWakeAt : null,
|
|
101209
101267
|
// Slice 3: partial degradation had no signal — the breaker only trips on TOTAL failure, so
|
|
101210
101268
|
// ~2 800 connect timeouts a day were invisible outside raw stderr. This rides a payload the
|
|
101211
101269
|
// operator already reads. Always present, always all three tracked operations, zeros for a
|
|
@@ -101220,10 +101278,25 @@ async function attemptSchedulerTick(deps) {
|
|
|
101220
101278
|
}
|
|
101221
101279
|
}
|
|
101222
101280
|
});
|
|
101223
|
-
|
|
101281
|
+
if (compact) {
|
|
101282
|
+
if (compact.createdRuns.status === "complete") {
|
|
101283
|
+
for (const { projectSlug, runId } of compact.createdRuns.items) {
|
|
101284
|
+
deps.dispatchEnqueued?.(projectSlug, { kind: "execution_run", runId });
|
|
101285
|
+
}
|
|
101286
|
+
}
|
|
101287
|
+
for (const group of [compact.enqueuedSpecDrafts, compact.enqueuedConsensus]) {
|
|
101288
|
+
if (group.status === "complete") {
|
|
101289
|
+
for (const { projectSlug, jobId } of group.items) {
|
|
101290
|
+
deps.dispatchEnqueued?.(projectSlug, { kind: "async_job", jobId });
|
|
101291
|
+
}
|
|
101292
|
+
}
|
|
101293
|
+
}
|
|
101294
|
+
} else {
|
|
101295
|
+
dispatchTickWork(deps, results);
|
|
101296
|
+
}
|
|
101224
101297
|
deps.failureLog?.noteSuccess("schedulerTick");
|
|
101225
101298
|
await bridgeHealth?.recordSuccess();
|
|
101226
|
-
return { nextWakeAt: typeof data.nextWakeAt === "string" ? data.nextWakeAt : null, failed: false };
|
|
101299
|
+
return { nextWakeAt: compact ? compact.nextWakeAt : typeof data.nextWakeAt === "string" ? data.nextWakeAt : null, failed: false };
|
|
101227
101300
|
} catch (error51) {
|
|
101228
101301
|
process.stderr.write(
|
|
101229
101302
|
schedulerTickFailureLine(deps, error51)
|
|
@@ -118885,6 +118958,14 @@ async function runStartupPruneSafely(prune2, log2) {
|
|
|
118885
118958
|
async function startDirectorBridge(startupDeps = {}) {
|
|
118886
118959
|
const agentSecret = readAgentSecret();
|
|
118887
118960
|
const scopedScheduler = process.env.MRRLIN_BRIDGE_SCOPED_SCHEDULER === "1";
|
|
118961
|
+
const compactTickFlag = process.env.MRRLIN_BRIDGE_COMPACT_SCHEDULER?.trim().toLowerCase();
|
|
118962
|
+
if (compactTickFlag && !["0", "1", "false"].includes(compactTickFlag)) {
|
|
118963
|
+
throw new Error("Invalid MRRLIN_BRIDGE_COMPACT_SCHEDULER");
|
|
118964
|
+
}
|
|
118965
|
+
const compactTick = compactTickFlag === "1";
|
|
118966
|
+
if (compactTick && (!agentSecret || !scopedScheduler)) {
|
|
118967
|
+
throw new Error("Compact scheduler requires a durable agent credential and scoped scheduler");
|
|
118968
|
+
}
|
|
118888
118969
|
const compactFlag = process.env.MRRLIN_BRIDGE_COMPACT_HEARTBEAT?.trim().toLowerCase();
|
|
118889
118970
|
if (compactFlag && !["0", "1", "false"].includes(compactFlag)) throw new Error("Invalid MRRLIN_BRIDGE_COMPACT_HEARTBEAT");
|
|
118890
118971
|
const compactHeartbeat = compactFlag === "1";
|
|
@@ -119869,7 +119950,7 @@ async function startDirectorBridge(startupDeps = {}) {
|
|
|
119869
119950
|
apiBaseUrl,
|
|
119870
119951
|
tokenProvider,
|
|
119871
119952
|
timeoutMs: DEFAULT_OPERATION_TIMEOUT_MS
|
|
119872
|
-
}) : async () => {
|
|
119953
|
+
}, compactTick) : async () => {
|
|
119873
119954
|
throw new Error("BRIDGE_SCHEDULER_START_FAILED");
|
|
119874
119955
|
};
|
|
119875
119956
|
}
|