@mrrlin-dev/mcp 0.4.205 → 0.4.207
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 +93 -7
- 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
|
-
|
|
69046
|
+
function createFetchScope(callerSignal) {
|
|
69006
69047
|
const operation = config2.createOperation?.();
|
|
69007
69048
|
const operationSignal = operation?.signal ?? config2.operationSignal?.();
|
|
69008
|
-
const signals = [
|
|
69009
|
-
|
|
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);
|
|
@@ -89615,9 +89690,20 @@ async function runDraftSpec(ctx, input, deps) {
|
|
|
89615
89690
|
if (isTaskTerminalStatus(task.status)) return skipped("task_terminal");
|
|
89616
89691
|
if (task.specWikiPageId) return skipped("spec_already_linked", { pageId: task.specWikiPageId });
|
|
89617
89692
|
if ((task.blockedBy ?? []).length > 0) {
|
|
89618
|
-
let
|
|
89693
|
+
let hasActiveBlocker;
|
|
89619
89694
|
try {
|
|
89620
|
-
|
|
89695
|
+
const flag = process.env.MRRLIN_MCP_DRAFT_BLOCKER_STATUS_V1?.trim().toLowerCase();
|
|
89696
|
+
if (flag === "1") {
|
|
89697
|
+
const ids = blockerTaskIdsSchema.parse([...new Set(task.blockedBy)]);
|
|
89698
|
+
hasActiveBlocker = await client.getTaskBlockerStatusV1(projectSlug, ids, { signal: ctx.signal });
|
|
89699
|
+
if (typeof hasActiveBlocker !== "boolean") throw new Error("Invalid blocker status result");
|
|
89700
|
+
} else {
|
|
89701
|
+
if (flag && flag !== "0" && flag !== "false") {
|
|
89702
|
+
throw new Error("Invalid MRRLIN_MCP_DRAFT_BLOCKER_STATUS_V1");
|
|
89703
|
+
}
|
|
89704
|
+
const blockers = await client.listTasks(projectSlug);
|
|
89705
|
+
hasActiveBlocker = getActiveBlockedByIds(task.blockedBy, blockers).length > 0;
|
|
89706
|
+
}
|
|
89621
89707
|
} catch (error51) {
|
|
89622
89708
|
return {
|
|
89623
89709
|
kind: "retry",
|
|
@@ -89625,7 +89711,7 @@ async function runDraftSpec(ctx, input, deps) {
|
|
|
89625
89711
|
error: `blocker check failed for ${taskId}: ${errMessage3(error51)}`
|
|
89626
89712
|
};
|
|
89627
89713
|
}
|
|
89628
|
-
if (
|
|
89714
|
+
if (hasActiveBlocker) return skipped("blocked_by_active");
|
|
89629
89715
|
}
|
|
89630
89716
|
const autoDeploy = task.autoDeploy ?? "off";
|
|
89631
89717
|
let topology = null;
|
|
@@ -99328,7 +99414,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
99328
99414
|
}
|
|
99329
99415
|
|
|
99330
99416
|
// src/_generated/version.ts
|
|
99331
|
-
var PKG_VERSION = "0.4.
|
|
99417
|
+
var PKG_VERSION = "0.4.207";
|
|
99332
99418
|
|
|
99333
99419
|
// src/bridge-allowed-origins.ts
|
|
99334
99420
|
var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|