@mrrlin-dev/mcp 0.4.200 → 0.4.203

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 +82 -14
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -68699,6 +68699,40 @@ var accountSummaryResponseSchema = external_exports.object({
68699
68699
  }))
68700
68700
  })
68701
68701
  });
68702
+ var compactSchedulerPath = "/internal/scheduler/run-compact-v1";
68703
+ var compactSchedulerMaxBytes = 64 * 1024;
68704
+ var schedulerCount = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
68705
+ var schedulerTotals = external_exports.object({
68706
+ createdRuns: schedulerCount,
68707
+ createdProposals: schedulerCount,
68708
+ enqueuedConsensus: schedulerCount,
68709
+ enqueuedSpecDrafts: schedulerCount,
68710
+ autoApprovedSpecs: schedulerCount,
68711
+ skippedTasks: schedulerCount,
68712
+ failures: schedulerCount,
68713
+ skippedReasons: external_exports.partialRecord(external_exports.union([mrrlinStopReasonSchema, external_exports.literal("unknown")]), schedulerCount)
68714
+ }).strict();
68715
+ var schedulerGroup = (item) => external_exports.discriminatedUnion("status", [
68716
+ external_exports.object({ status: external_exports.literal("omitted") }).strict(),
68717
+ external_exports.object({ status: external_exports.literal("complete"), items: external_exports.array(item).max(1024) }).strict()
68718
+ ]);
68719
+ var schedulerIdentity = external_exports.string().min(1);
68720
+ var schedulerJobHint = external_exports.object({ projectSlug: schedulerIdentity, jobId: schedulerIdentity }).strict();
68721
+ var schedulerDate = external_exports.string().refine((value) => {
68722
+ const epoch = Date.parse(value);
68723
+ return Number.isFinite(epoch) && new Date(epoch).toISOString() === value;
68724
+ }, "Expected a canonical scheduler timestamp");
68725
+ var compactSchedulerResponseSchema = external_exports.object({
68726
+ version: external_exports.literal(1),
68727
+ evaluatedAt: schedulerDate,
68728
+ nextWakeAt: schedulerDate.nullable(),
68729
+ projectCount: schedulerCount,
68730
+ totals: schedulerTotals,
68731
+ createdRuns: schedulerGroup(external_exports.object({ projectSlug: schedulerIdentity, runId: schedulerIdentity }).strict()),
68732
+ enqueuedConsensus: schedulerGroup(schedulerJobHint),
68733
+ enqueuedSpecDrafts: schedulerGroup(schedulerJobHint),
68734
+ perProject: schedulerGroup(schedulerTotals.extend({ projectSlug: schedulerIdentity }))
68735
+ }).strict();
68702
68736
 
68703
68737
  // ../../packages/client/dist/agent-token-provider.js
68704
68738
  var AgentTokenProviderError = class extends Error {
@@ -97822,7 +97856,7 @@ async function readBounded(response, maxBytes) {
97822
97856
  reader.releaseLock();
97823
97857
  }
97824
97858
  }
97825
- function createScopedRequest(options, mode) {
97859
+ function createScopedRequest(options, mode, compactTick = false) {
97826
97860
  if (options.tokenProvider.supportsScopedExchange !== true) throw new Error("BRIDGE_SCOPED_AUTH_UNAVAILABLE");
97827
97861
  return async (callerSignal, heartbeat, absoluteDeadline) => {
97828
97862
  try {
@@ -97932,11 +97966,15 @@ function createScopedRequest(options, mode) {
97932
97966
  }));
97933
97967
  }
97934
97968
  check2("tick");
97935
- return request("tick", options.apiBaseUrl.replace(/\/$/, "") + "/internal/scheduler/run", {
97969
+ return request("tick", options.apiBaseUrl.replace(/\/$/, "") + (compactTick ? compactSchedulerPath : "/internal/scheduler/run"), {
97936
97970
  method: "POST",
97937
97971
  headers: { authorization: "Bearer " + token }
97938
97972
  }, async (response) => {
97939
97973
  if (!response.ok) return { ok: false, status: response.status };
97974
+ if (compactTick) {
97975
+ const body = JSON.parse(await readBounded(response, compactSchedulerMaxBytes));
97976
+ return { ok: true, compact: compactSchedulerResponseSchema.parse(body) };
97977
+ }
97940
97978
  return { ok: true, body: JSON.parse(await readBounded(response, TICK_MAX_BYTES)) };
97941
97979
  });
97942
97980
  });
@@ -97949,8 +97987,8 @@ function createScopedRequest(options, mode) {
97949
97987
  }
97950
97988
  };
97951
97989
  }
97952
- function createScopedSchedulerRequest(options) {
97953
- const request = createScopedRequest(options, "scheduler");
97990
+ function createScopedSchedulerRequest(options, compactTick = false) {
97991
+ const request = createScopedRequest(options, "scheduler", compactTick);
97954
97992
  return async () => {
97955
97993
  const result = await request();
97956
97994
  if (!("ok" in result)) throw new Error("BRIDGE_SCHEDULER_REQUEST_FAILED");
@@ -99259,7 +99297,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
99259
99297
  }
99260
99298
 
99261
99299
  // src/_generated/version.ts
99262
- var PKG_VERSION = "0.4.200";
99300
+ var PKG_VERSION = "0.4.203";
99263
99301
 
99264
99302
  // src/bridge-allowed-origins.ts
99265
99303
  var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
@@ -101171,7 +101209,8 @@ async function attemptSchedulerTick(deps) {
101171
101209
  bridgeHealth?.recordFailure("schedulerTick", new Error(`HTTP ${response.status}`));
101172
101210
  return { nextWakeAt: null, failed: true };
101173
101211
  }
101174
- const body = response.body;
101212
+ const compact = "compact" in response ? response.compact : void 0;
101213
+ const body = "body" in response ? response.body : void 0;
101175
101214
  const data = body?.data ?? {};
101176
101215
  const results = Array.isArray(data.results) ? data.results : [];
101177
101216
  deps.logger.logOut({
@@ -101180,9 +101219,9 @@ async function attemptSchedulerTick(deps) {
101180
101219
  type: "<scheduler-tick>",
101181
101220
  payload: {
101182
101221
  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: {
101222
+ evaluatedAt: compact?.evaluatedAt ?? (typeof data.evaluatedAt === "string" ? data.evaluatedAt : null),
101223
+ projectCount: compact?.projectCount ?? (typeof data.projectCount === "number" ? data.projectCount : results.length),
101224
+ totals: compact?.totals ?? {
101186
101225
  createdRuns: results.reduce((sum, r) => sum + count(r.createdRuns), 0),
101187
101226
  createdProposals: results.reduce((sum, r) => sum + count(r.createdProposals), 0),
101188
101227
  enqueuedConsensus: results.reduce((sum, r) => sum + count(r.enqueuedConsensus), 0),
@@ -101194,7 +101233,7 @@ async function attemptSchedulerTick(deps) {
101194
101233
  skippedReasons: mergeReasons(results.map((r) => tallyReasons(r.skippedTasks))),
101195
101234
  failures: results.reduce((sum, r) => sum + count(r.failures), 0)
101196
101235
  },
101197
- perProject: results.map((r) => ({
101236
+ perProject: compact ? compact.perProject.status === "complete" ? compact.perProject.items : null : results.map((r) => ({
101198
101237
  projectSlug: typeof r.projectSlug === "string" ? r.projectSlug : "unknown",
101199
101238
  createdRuns: count(r.createdRuns),
101200
101239
  createdProposals: count(r.createdProposals),
@@ -101205,7 +101244,13 @@ async function attemptSchedulerTick(deps) {
101205
101244
  skippedReasons: tallyReasons(r.skippedTasks),
101206
101245
  failures: count(r.failures)
101207
101246
  })),
101208
- nextWakeAt: typeof data.nextWakeAt === "string" ? data.nextWakeAt : null,
101247
+ ...compact ? { omitted: {
101248
+ createdRuns: compact.createdRuns.status === "omitted",
101249
+ enqueuedConsensus: compact.enqueuedConsensus.status === "omitted",
101250
+ enqueuedSpecDrafts: compact.enqueuedSpecDrafts.status === "omitted",
101251
+ perProject: compact.perProject.status === "omitted"
101252
+ } } : {},
101253
+ nextWakeAt: compact ? compact.nextWakeAt : typeof data.nextWakeAt === "string" ? data.nextWakeAt : null,
101209
101254
  // Slice 3: partial degradation had no signal — the breaker only trips on TOTAL failure, so
101210
101255
  // ~2 800 connect timeouts a day were invisible outside raw stderr. This rides a payload the
101211
101256
  // operator already reads. Always present, always all three tracked operations, zeros for a
@@ -101220,10 +101265,25 @@ async function attemptSchedulerTick(deps) {
101220
101265
  }
101221
101266
  }
101222
101267
  });
101223
- dispatchTickWork(deps, results);
101268
+ if (compact) {
101269
+ if (compact.createdRuns.status === "complete") {
101270
+ for (const { projectSlug, runId } of compact.createdRuns.items) {
101271
+ deps.dispatchEnqueued?.(projectSlug, { kind: "execution_run", runId });
101272
+ }
101273
+ }
101274
+ for (const group of [compact.enqueuedSpecDrafts, compact.enqueuedConsensus]) {
101275
+ if (group.status === "complete") {
101276
+ for (const { projectSlug, jobId } of group.items) {
101277
+ deps.dispatchEnqueued?.(projectSlug, { kind: "async_job", jobId });
101278
+ }
101279
+ }
101280
+ }
101281
+ } else {
101282
+ dispatchTickWork(deps, results);
101283
+ }
101224
101284
  deps.failureLog?.noteSuccess("schedulerTick");
101225
101285
  await bridgeHealth?.recordSuccess();
101226
- return { nextWakeAt: typeof data.nextWakeAt === "string" ? data.nextWakeAt : null, failed: false };
101286
+ return { nextWakeAt: compact ? compact.nextWakeAt : typeof data.nextWakeAt === "string" ? data.nextWakeAt : null, failed: false };
101227
101287
  } catch (error51) {
101228
101288
  process.stderr.write(
101229
101289
  schedulerTickFailureLine(deps, error51)
@@ -118885,6 +118945,14 @@ async function runStartupPruneSafely(prune2, log2) {
118885
118945
  async function startDirectorBridge(startupDeps = {}) {
118886
118946
  const agentSecret = readAgentSecret();
118887
118947
  const scopedScheduler = process.env.MRRLIN_BRIDGE_SCOPED_SCHEDULER === "1";
118948
+ const compactTickFlag = process.env.MRRLIN_BRIDGE_COMPACT_SCHEDULER?.trim().toLowerCase();
118949
+ if (compactTickFlag && !["0", "1", "false"].includes(compactTickFlag)) {
118950
+ throw new Error("Invalid MRRLIN_BRIDGE_COMPACT_SCHEDULER");
118951
+ }
118952
+ const compactTick = compactTickFlag === "1";
118953
+ if (compactTick && (!agentSecret || !scopedScheduler)) {
118954
+ throw new Error("Compact scheduler requires a durable agent credential and scoped scheduler");
118955
+ }
118888
118956
  const compactFlag = process.env.MRRLIN_BRIDGE_COMPACT_HEARTBEAT?.trim().toLowerCase();
118889
118957
  if (compactFlag && !["0", "1", "false"].includes(compactFlag)) throw new Error("Invalid MRRLIN_BRIDGE_COMPACT_HEARTBEAT");
118890
118958
  const compactHeartbeat = compactFlag === "1";
@@ -119869,7 +119937,7 @@ async function startDirectorBridge(startupDeps = {}) {
119869
119937
  apiBaseUrl,
119870
119938
  tokenProvider,
119871
119939
  timeoutMs: DEFAULT_OPERATION_TIMEOUT_MS
119872
- }) : async () => {
119940
+ }, compactTick) : async () => {
119873
119941
  throw new Error("BRIDGE_SCHEDULER_START_FAILED");
119874
119942
  };
119875
119943
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.200",
3
+ "version": "0.4.203",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"