@mrrlin-dev/mcp 0.4.206 → 0.4.208

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 +67 -38
  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
+ getDraftLinkV1: "getDraftLinkV1",
64316
64317
  getTaskBlockerStatusV1: "getTaskBlockerStatusV1",
64317
64318
  listTaskEvents: "listTaskEvents",
64318
64319
  listTaxonomy: "listTaxonomy",
@@ -66513,6 +66514,15 @@ var blockerStatusResponseSchema = external_exports.object({
66513
66514
  contract: external_exports.literal("task-blocker-status-v1"),
66514
66515
  active: external_exports.boolean()
66515
66516
  }).strict();
66517
+ var draftLinkPageIdSchema = external_exports.string().min(4).max(128).refine((id) => id.startsWith("WK-") && !/[^0-9]/u.test(id.slice(3)), "Invalid wiki page ID");
66518
+ var draftLinkResponseSchema = external_exports.discriminatedUnion("kind", [
66519
+ external_exports.object({
66520
+ contract: external_exports.literal("draft-link-v1"),
66521
+ kind: external_exports.literal("found"),
66522
+ specWikiPageId: draftLinkPageIdSchema.nullable()
66523
+ }).strict(),
66524
+ external_exports.object({ contract: external_exports.literal("draft-link-v1"), kind: external_exports.literal("missing") }).strict()
66525
+ ]);
66516
66526
  var linkedTaskPageIdSchema = mrrlinWikiPageIdSchema.max(128);
66517
66527
  var linkedTaskResponseSchema = external_exports.object({
66518
66528
  contract: external_exports.literal("spec-linked-task-v1"),
@@ -68912,7 +68922,7 @@ function buildTaskListPath(projectSlug, filters, view) {
68912
68922
  view: view ?? filters.view
68913
68923
  });
68914
68924
  }
68915
- function withinBlockerStatusDeadline(operation, signal) {
68925
+ function withinBoundedReadDeadline(operation, signal) {
68916
68926
  return new Promise((resolve3, reject) => {
68917
68927
  const aborted2 = () => reject(signal.reason);
68918
68928
  signal.addEventListener("abort", aborted2, { once: true });
@@ -68921,25 +68931,25 @@ function withinBlockerStatusDeadline(operation, signal) {
68921
68931
  void operation.then(resolve3, reject).finally(() => signal.removeEventListener("abort", aborted2));
68922
68932
  });
68923
68933
  }
68924
- async function readBlockerStatus(response, signal) {
68934
+ async function readBoundedJson(response, signal, maxBytes) {
68925
68935
  const reader = response.body?.getReader();
68926
68936
  if (!reader)
68927
- throw new TypeError("Missing blocker status response body");
68928
- const bytes3 = new Uint8Array(52);
68937
+ throw new TypeError("Missing bounded response body");
68938
+ const bytes3 = new Uint8Array(maxBytes);
68929
68939
  let length = 0;
68930
68940
  try {
68931
68941
  while (true) {
68932
- const { done, value } = await withinBlockerStatusDeadline(reader.read(), signal);
68942
+ const { done, value } = await withinBoundedReadDeadline(reader.read(), signal);
68933
68943
  if (done)
68934
68944
  break;
68935
68945
  if (value.byteLength > bytes3.length - length)
68936
- throw new RangeError("Blocker status response too large");
68946
+ throw new RangeError("Bounded response too large");
68937
68947
  bytes3.set(value, length);
68938
68948
  length += value.byteLength;
68939
68949
  }
68940
68950
  signal.throwIfAborted();
68941
68951
  const body = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes3.subarray(0, length)));
68942
- return blockerStatusResponseSchema.parse(body).active;
68952
+ return body;
68943
68953
  } finally {
68944
68954
  void reader.cancel().catch(() => {
68945
68955
  });
@@ -69132,6 +69142,35 @@ function createMrrlinClient(config2) {
69132
69142
  message
69133
69143
  });
69134
69144
  }
69145
+ async function requestBoundedJson(path40, maxBytes, caller) {
69146
+ const deadline = AbortSignal.timeout(3e4);
69147
+ const callerSignal = caller ? AbortSignal.any([caller, deadline]) : deadline;
69148
+ const scope = createFetchScope(callerSignal);
69149
+ const signal = scope.signal ?? callerSignal;
69150
+ signal.throwIfAborted();
69151
+ const pending = executeFetch(path40, { cache: "no-store" }, scope);
69152
+ void pending.then((response2) => {
69153
+ if (signal.aborted)
69154
+ void response2.body?.cancel().catch(() => {
69155
+ });
69156
+ }, () => {
69157
+ });
69158
+ const response = await withinBoundedReadDeadline(pending, signal);
69159
+ if (response.status !== 200) {
69160
+ void response.body?.cancel().catch(() => {
69161
+ });
69162
+ throw new MrrlinApiError({
69163
+ code: `HTTP_${response.status}`,
69164
+ status: response.status,
69165
+ method: "GET",
69166
+ path: path40,
69167
+ message: `Bounded read request failed: ${response.status}`,
69168
+ responseBody: "",
69169
+ violations: null
69170
+ });
69171
+ }
69172
+ return readBoundedJson(response, signal, maxBytes);
69173
+ }
69135
69174
  async function request(path40, init) {
69136
69175
  const method = init?.method ?? "GET";
69137
69176
  const response = await executeFetch(path40, init);
@@ -69338,33 +69377,12 @@ function createMrrlinClient(config2) {
69338
69377
  const ids = blockerTaskIdsSchema.parse(taskIds);
69339
69378
  const query = new URLSearchParams(ids.map((id) => ["taskId", id]));
69340
69379
  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);
69380
+ const body = await requestBoundedJson(path40, 52, options?.signal);
69381
+ return blockerStatusResponseSchema.parse(body).active;
69382
+ },
69383
+ async getDraftLinkV1(projectSlug, taskId, options) {
69384
+ const path40 = `${projectPath(projectSlug)}/tasks/${encodeURIComponent(taskId)}/draft-link/v1`;
69385
+ return draftLinkResponseSchema.parse(await requestBoundedJson(path40, 256, options?.signal));
69368
69386
  },
69369
69387
  async getWikiPageLinkedTaskV1(projectSlug, pageId) {
69370
69388
  const path40 = `${projectPath(projectSlug)}/wiki/${encodeURIComponent(pageId)}/linked-task/v1`;
@@ -89690,9 +89708,20 @@ async function runDraftSpec(ctx, input, deps) {
89690
89708
  if (isTaskTerminalStatus(task.status)) return skipped("task_terminal");
89691
89709
  if (task.specWikiPageId) return skipped("spec_already_linked", { pageId: task.specWikiPageId });
89692
89710
  if ((task.blockedBy ?? []).length > 0) {
89693
- let blockers;
89711
+ let hasActiveBlocker;
89694
89712
  try {
89695
- blockers = await client.listTasks(projectSlug);
89713
+ const flag = process.env.MRRLIN_MCP_DRAFT_BLOCKER_STATUS_V1?.trim().toLowerCase();
89714
+ if (flag === "1") {
89715
+ const ids = blockerTaskIdsSchema.parse([...new Set(task.blockedBy)]);
89716
+ hasActiveBlocker = await client.getTaskBlockerStatusV1(projectSlug, ids, { signal: ctx.signal });
89717
+ if (typeof hasActiveBlocker !== "boolean") throw new Error("Invalid blocker status result");
89718
+ } else {
89719
+ if (flag && flag !== "0" && flag !== "false") {
89720
+ throw new Error("Invalid MRRLIN_MCP_DRAFT_BLOCKER_STATUS_V1");
89721
+ }
89722
+ const blockers = await client.listTasks(projectSlug);
89723
+ hasActiveBlocker = getActiveBlockedByIds(task.blockedBy, blockers).length > 0;
89724
+ }
89696
89725
  } catch (error51) {
89697
89726
  return {
89698
89727
  kind: "retry",
@@ -89700,7 +89729,7 @@ async function runDraftSpec(ctx, input, deps) {
89700
89729
  error: `blocker check failed for ${taskId}: ${errMessage3(error51)}`
89701
89730
  };
89702
89731
  }
89703
- if (getActiveBlockedByIds(task.blockedBy, blockers).length > 0) return skipped("blocked_by_active");
89732
+ if (hasActiveBlocker) return skipped("blocked_by_active");
89704
89733
  }
89705
89734
  const autoDeploy = task.autoDeploy ?? "off";
89706
89735
  let topology = null;
@@ -99403,7 +99432,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
99403
99432
  }
99404
99433
 
99405
99434
  // src/_generated/version.ts
99406
- var PKG_VERSION = "0.4.206";
99435
+ var PKG_VERSION = "0.4.208";
99407
99436
 
99408
99437
  // src/bridge-allowed-origins.ts
99409
99438
  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.206",
3
+ "version": "0.4.208",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"