@mrrlin-dev/mcp 0.4.204 → 0.4.206

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 +107 -14
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -64313,6 +64313,7 @@ var openApiOperationIds = {
64313
64313
  listProjects: "listProjects",
64314
64314
  listTaskDependencies: "listTaskDependencies",
64315
64315
  listTasks: "listTasks",
64316
+ getTaskBlockerStatusV1: "getTaskBlockerStatusV1",
64316
64317
  listTaskEvents: "listTaskEvents",
64317
64318
  listTaxonomy: "listTaxonomy",
64318
64319
  listWikiPages: "listWikiPages",
@@ -66506,6 +66507,12 @@ var githubRepositorySelectionSchema = external_exports.enum(["all", "selected"])
66506
66507
  var mrrlinTaskIdSchema = external_exports.string().regex(/^GT-\d+$/);
66507
66508
  var mrrlinPlanIdSchema = external_exports.string().regex(/^PL-\d+$/);
66508
66509
  var mrrlinWikiPageIdSchema = external_exports.string().regex(/^WK-\d+$/);
66510
+ var blockerTaskIdSchema = external_exports.string().min(4).max(128).refine((id) => id.startsWith("GT-") && !/[^0-9]/u.test(id.slice(3)), "Invalid task ID");
66511
+ var blockerTaskIdsSchema = external_exports.array(blockerTaskIdSchema).min(1).max(16).refine((ids) => new Set(ids).size === ids.length, "Duplicate task ID");
66512
+ var blockerStatusResponseSchema = external_exports.object({
66513
+ contract: external_exports.literal("task-blocker-status-v1"),
66514
+ active: external_exports.boolean()
66515
+ }).strict();
66509
66516
  var linkedTaskPageIdSchema = mrrlinWikiPageIdSchema.max(128);
66510
66517
  var linkedTaskResponseSchema = external_exports.object({
66511
66518
  contract: external_exports.literal("spec-linked-task-v1"),
@@ -68905,6 +68912,40 @@ function buildTaskListPath(projectSlug, filters, view) {
68905
68912
  view: view ?? filters.view
68906
68913
  });
68907
68914
  }
68915
+ function withinBlockerStatusDeadline(operation, signal) {
68916
+ return new Promise((resolve3, reject) => {
68917
+ const aborted2 = () => reject(signal.reason);
68918
+ signal.addEventListener("abort", aborted2, { once: true });
68919
+ if (signal.aborted)
68920
+ aborted2();
68921
+ void operation.then(resolve3, reject).finally(() => signal.removeEventListener("abort", aborted2));
68922
+ });
68923
+ }
68924
+ async function readBlockerStatus(response, signal) {
68925
+ const reader = response.body?.getReader();
68926
+ if (!reader)
68927
+ throw new TypeError("Missing blocker status response body");
68928
+ const bytes3 = new Uint8Array(52);
68929
+ let length = 0;
68930
+ try {
68931
+ while (true) {
68932
+ const { done, value } = await withinBlockerStatusDeadline(reader.read(), signal);
68933
+ if (done)
68934
+ break;
68935
+ if (value.byteLength > bytes3.length - length)
68936
+ throw new RangeError("Blocker status response too large");
68937
+ bytes3.set(value, length);
68938
+ length += value.byteLength;
68939
+ }
68940
+ signal.throwIfAborted();
68941
+ const body = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes3.subarray(0, length)));
68942
+ return blockerStatusResponseSchema.parse(body).active;
68943
+ } finally {
68944
+ void reader.cancel().catch(() => {
68945
+ });
68946
+ reader.releaseLock();
68947
+ }
68948
+ }
68908
68949
  var MrrlinApiError = class extends Error {
68909
68950
  code;
68910
68951
  method;
@@ -69002,11 +69043,13 @@ function createMrrlinClient(config2) {
69002
69043
  });
69003
69044
  });
69004
69045
  }
69005
- async function executeFetch(path40, init) {
69046
+ function createFetchScope(callerSignal) {
69006
69047
  const operation = config2.createOperation?.();
69007
69048
  const operationSignal = operation?.signal ?? config2.operationSignal?.();
69008
- const signals = [init?.signal, operationSignal].filter((value) => Boolean(value));
69009
- const signal = signals.length ? AbortSignal.any(signals) : void 0;
69049
+ const signals = [callerSignal, operationSignal].filter((value) => Boolean(value));
69050
+ return { operation, signal: signals.length ? AbortSignal.any(signals) : void 0 };
69051
+ }
69052
+ async function executeFetch(path40, init, { operation, signal } = createFetchScope(init?.signal)) {
69010
69053
  const method = (init?.method ?? "GET").toUpperCase();
69011
69054
  if (signal?.aborted)
69012
69055
  throw new DOMException("The user aborted a request.", "AbortError");
@@ -69291,6 +69334,38 @@ function createMrrlinClient(config2) {
69291
69334
  const body = await request(`${projectPath(projectSlug)}/tasks/${encodeURIComponent(taskId)}`);
69292
69335
  return taskResponseSchema.parse(body).data;
69293
69336
  },
69337
+ async getTaskBlockerStatusV1(projectSlug, taskIds, options) {
69338
+ const ids = blockerTaskIdsSchema.parse(taskIds);
69339
+ const query = new URLSearchParams(ids.map((id) => ["taskId", id]));
69340
+ const path40 = `${projectPath(projectSlug)}/task-blocker-status/v1?${query}`;
69341
+ const deadline = AbortSignal.timeout(3e4);
69342
+ const callerSignal = options?.signal ? AbortSignal.any([options.signal, deadline]) : deadline;
69343
+ const scope = createFetchScope(callerSignal);
69344
+ const signal = scope.signal ?? callerSignal;
69345
+ signal.throwIfAborted();
69346
+ const pending = executeFetch(path40, { cache: "no-store" }, scope);
69347
+ void pending.then((response2) => {
69348
+ if (signal.aborted)
69349
+ void response2.body?.cancel().catch(() => {
69350
+ });
69351
+ }, () => {
69352
+ });
69353
+ const response = await withinBlockerStatusDeadline(pending, signal);
69354
+ if (response.status !== 200) {
69355
+ void response.body?.cancel().catch(() => {
69356
+ });
69357
+ throw new MrrlinApiError({
69358
+ code: `HTTP_${response.status}`,
69359
+ status: response.status,
69360
+ method: "GET",
69361
+ path: path40,
69362
+ message: `Blocker status request failed: ${response.status}`,
69363
+ responseBody: "",
69364
+ violations: null
69365
+ });
69366
+ }
69367
+ return readBlockerStatus(response, signal);
69368
+ },
69294
69369
  async getWikiPageLinkedTaskV1(projectSlug, pageId) {
69295
69370
  const path40 = `${projectPath(projectSlug)}/wiki/${encodeURIComponent(pageId)}/linked-task/v1`;
69296
69371
  const response = await executeFetch(path40);
@@ -77229,16 +77304,28 @@ function telemetryDay(now = /* @__PURE__ */ new Date()) {
77229
77304
  }
77230
77305
 
77231
77306
  // src/consensus/resolve-gated-task.ts
77232
- async function resolveGatedTaskId(client, projectSlug, page) {
77233
- const tasks = await client.listTasks(projectSlug);
77234
- const linking = tasks.find((t) => t.specWikiPageId === page.id);
77235
- if (linking) {
77236
- if (page.taskId !== linking.id) {
77307
+ function useLinkedTaskLookupV1(value = process.env.MRRLIN_MCP_LINKED_TASK_V1) {
77308
+ const flag = value?.trim().toLowerCase();
77309
+ if (!flag || flag === "0" || flag === "false") return false;
77310
+ if (flag === "1") return true;
77311
+ throw new Error("Invalid MRRLIN_MCP_LINKED_TASK_V1");
77312
+ }
77313
+ async function resolveGatedTaskId(client, projectSlug, page, useV1 = useLinkedTaskLookupV1()) {
77314
+ let linkingId;
77315
+ if (useV1) {
77316
+ if (!client.getWikiPageLinkedTaskV1) throw new Error("Linked task lookup v1 is unavailable");
77317
+ linkingId = await client.getWikiPageLinkedTaskV1(projectSlug, page.id);
77318
+ } else {
77319
+ const tasks = await client.listTasks(projectSlug);
77320
+ linkingId = tasks.find((task) => task.specWikiPageId === page.id)?.id ?? null;
77321
+ }
77322
+ if (linkingId !== null) {
77323
+ if (page.taskId !== linkingId) {
77237
77324
  throw new Error(
77238
- `spec page ${page.id} is linked by task ${linking.id} (tasks.spec_wiki_page_id) but its wiki_pages.task_id back-pointer is ${page.taskId === null ? "null" : page.taskId} \u2014 refusing to gate with a drifted identity`
77325
+ `spec page ${page.id} is linked by task ${linkingId} (tasks.spec_wiki_page_id) but its wiki_pages.task_id back-pointer is ${page.taskId === null ? "null" : page.taskId} \u2014 refusing to gate with a drifted identity`
77239
77326
  );
77240
77327
  }
77241
- return linking.id;
77328
+ return linkingId;
77242
77329
  }
77243
77330
  return page.taskId;
77244
77331
  }
@@ -77248,8 +77335,13 @@ function domainScopedReviewHash2(rawHash, domain2) {
77248
77335
  return domainScopedReviewHash(rawHash, domain2);
77249
77336
  }
77250
77337
  async function resolveSpecDomains(client, projectSlug, page) {
77338
+ const useV1 = useLinkedTaskLookupV1();
77339
+ const linkedTaskId = useV1 ? await resolveGatedTaskId(client, projectSlug, page, true) : void 0;
77340
+ return resolveSpecDomainsForTask(client, projectSlug, page, linkedTaskId);
77341
+ }
77342
+ async function resolveSpecDomainsForTask(client, projectSlug, page, linkedTaskId) {
77251
77343
  try {
77252
- const taskId = await resolveGatedTaskId(client, projectSlug, page);
77344
+ const taskId = linkedTaskId === void 0 ? await resolveGatedTaskId(client, projectSlug, page, false) : linkedTaskId;
77253
77345
  if (taskId !== null) {
77254
77346
  const task = await client.getTask(projectSlug, taskId);
77255
77347
  const taskRecord = task;
@@ -77277,11 +77369,12 @@ async function resolveSpecDomain(client, projectSlug, page) {
77277
77369
  return normalizeDomain(domains);
77278
77370
  }
77279
77371
  async function resolveCurrentSpecReview(client, projectSlug, page) {
77280
- const taskId = await resolveGatedTaskId(client, projectSlug, page);
77372
+ const useV1 = useLinkedTaskLookupV1();
77373
+ const taskId = await resolveGatedTaskId(client, projectSlug, page, useV1);
77281
77374
  const task = taskId !== null ? await client.getTask(projectSlug, taskId) : null;
77282
77375
  const scope = task ? mixedCodeReviewScope(task) : void 0;
77283
77376
  if (scope) return { taskId, reviewHash: mixedCodeSpecReviewHash(scope, page), mixedCode: true };
77284
- const domains = task?.domains ?? await resolveSpecDomains(client, projectSlug, page);
77377
+ const domains = task?.domains ?? await resolveSpecDomainsForTask(client, projectSlug, page, useV1 ? taskId : void 0);
77285
77378
  return { taskId, reviewHash: domainScopedReviewHash2(page.contentHash, domains), mixedCode: false };
77286
77379
  }
77287
77380
 
@@ -99310,7 +99403,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
99310
99403
  }
99311
99404
 
99312
99405
  // src/_generated/version.ts
99313
- var PKG_VERSION = "0.4.204";
99406
+ var PKG_VERSION = "0.4.206";
99314
99407
 
99315
99408
  // src/bridge-allowed-origins.ts
99316
99409
  var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.204",
3
+ "version": "0.4.206",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"