@mrrlin-dev/mcp 0.4.219 → 0.4.220
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 +66 -64
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -89031,64 +89031,60 @@ async function handleConsensusBlocked(result, ctx, input, resolvedTaskId) {
|
|
|
89031
89031
|
}
|
|
89032
89032
|
}
|
|
89033
89033
|
}
|
|
89034
|
-
|
|
89035
|
-
|
|
89036
|
-
|
|
89037
|
-
|
|
89038
|
-
|
|
89039
|
-
|
|
89040
|
-
|
|
89041
|
-
|
|
89042
|
-
|
|
89043
|
-
|
|
89044
|
-
|
|
89045
|
-
|
|
89046
|
-
|
|
89047
|
-
|
|
89048
|
-
|
|
89049
|
-
|
|
89050
|
-
|
|
89051
|
-
|
|
89052
|
-
|
|
89053
|
-
|
|
89054
|
-
|
|
89055
|
-
|
|
89056
|
-
|
|
89057
|
-
|
|
89058
|
-
|
|
89059
|
-
|
|
89034
|
+
const confirmedQuestionIds = /* @__PURE__ */ new Set();
|
|
89035
|
+
let clarificationDeliveryIncomplete = false;
|
|
89036
|
+
const scopeId = taskId ?? planId;
|
|
89037
|
+
if (toFile.length > 0 && scopeId) {
|
|
89038
|
+
const clarificationKey = taskId ? result.evaluatedClarificationKey : void 0;
|
|
89039
|
+
const prefix = clarificationKey ? mixedCodeClarificationIdPrefix(scopeId, clarificationKey) : `II-${scopeId}-gate-`;
|
|
89040
|
+
const groupId = toFile.length > 1 ? `${prefix}group-${(0, import_node_crypto10.createHash)("sha256").update(toFile.map((c) => c.rawQuestion).sort().join("\n")).digest("hex").slice(0, 10)}` : void 0;
|
|
89041
|
+
const questions = toFile.map((clarification) => ({
|
|
89042
|
+
id: `${prefix}${(0, import_node_crypto10.createHash)("sha256").update(clarification.rawQuestion).digest("hex").slice(0, 10)}`,
|
|
89043
|
+
kind: "question",
|
|
89044
|
+
...taskId ? { taskId } : { planId: scopeId },
|
|
89045
|
+
body: humanizeClarificationBody(clarification),
|
|
89046
|
+
origin: "gate",
|
|
89047
|
+
questionOptions: buildGateQuestionOptions(clarification.rawQuestion, clarification.category),
|
|
89048
|
+
...groupId ? { groupId } : {}
|
|
89049
|
+
}));
|
|
89050
|
+
const matchesQuestion = (item, question) => {
|
|
89051
|
+
if (!item?.id || item.projectSlug !== input.projectSlug || item.kind !== "question" || item.origin !== "gate" || item.status !== "pending" || item.taskId !== taskId || item.planId !== planId || item.body !== question.body) return false;
|
|
89052
|
+
if (taskId && mixedCodeClarificationKeyFromId(taskId, item.id) !== clarificationKey) return false;
|
|
89053
|
+
const expected = question.questionOptions;
|
|
89054
|
+
const stored = item.questionOptions;
|
|
89055
|
+
if (!expected) return stored === null || stored === void 0;
|
|
89056
|
+
return stored?.length === expected.length && expected.every((option) => stored.some((actual) => actual.answer === option.answer && actual.label === option.label && actual.description === option.description));
|
|
89057
|
+
};
|
|
89058
|
+
const uncertain = [];
|
|
89059
|
+
for (const question of questions) {
|
|
89060
|
+
let item;
|
|
89061
|
+
try {
|
|
89062
|
+
item = await ctx.client.createInboxItem(input.projectSlug, question);
|
|
89063
|
+
} catch {
|
|
89064
|
+
uncertain.push(question);
|
|
89065
|
+
continue;
|
|
89060
89066
|
}
|
|
89061
|
-
|
|
89062
|
-
|
|
89063
|
-
|
|
89064
|
-
|
|
89065
|
-
|
|
89066
|
-
|
|
89067
|
-
|
|
89068
|
-
|
|
89069
|
-
|
|
89070
|
-
|
|
89071
|
-
|
|
89072
|
-
|
|
89073
|
-
|
|
89074
|
-
|
|
89075
|
-
questionOptions,
|
|
89076
|
-
...groupId ? { groupId } : {}
|
|
89077
|
-
});
|
|
89078
|
-
} catch (err) {
|
|
89079
|
-
const errObj = err;
|
|
89080
|
-
const isConflict = errObj?.status === 409 || errObj?.statusCode === 409 || errObj?.code === "23505" || String(errObj?.message ?? "").includes("already exists") || String(errObj?.message ?? "").includes("duplicate key");
|
|
89081
|
-
if (!isConflict) {
|
|
89082
|
-
throw err;
|
|
89083
|
-
}
|
|
89084
|
-
}
|
|
89067
|
+
if (matchesQuestion(item, question)) confirmedQuestionIds.add(item.id);
|
|
89068
|
+
else clarificationDeliveryIncomplete = true;
|
|
89069
|
+
}
|
|
89070
|
+
if (uncertain.length > 0) {
|
|
89071
|
+
const pending = await ctx.client.listInboxItems(input.projectSlug, {
|
|
89072
|
+
...taskId ? { taskId } : {},
|
|
89073
|
+
kind: "question",
|
|
89074
|
+
status: "pending",
|
|
89075
|
+
limit: 100
|
|
89076
|
+
}).catch(() => []);
|
|
89077
|
+
for (const question of uncertain) {
|
|
89078
|
+
const item = pending.find((candidate) => matchesQuestion(candidate, question));
|
|
89079
|
+
if (item) confirmedQuestionIds.add(item.id);
|
|
89080
|
+
else clarificationDeliveryIncomplete = true;
|
|
89085
89081
|
}
|
|
89086
|
-
filedQuestionCount = toFile.length;
|
|
89087
89082
|
}
|
|
89088
89083
|
}
|
|
89084
|
+
const filedQuestionCount = confirmedQuestionIds.size;
|
|
89089
89085
|
const existingQuestionCount = result.pendingReviewQuestionIds?.length ?? 0;
|
|
89090
89086
|
let gateBlockQuestionAvailable;
|
|
89091
|
-
if (filedQuestionCount === 0 && existingQuestionCount === 0 && diagnostics.length === 0 && taskId && page) {
|
|
89087
|
+
if (!clarificationDeliveryIncomplete && filedQuestionCount === 0 && existingQuestionCount === 0 && diagnostics.length === 0 && taskId && page) {
|
|
89092
89088
|
const domain2 = await resolveSpecDomain(ctx.client, input.projectSlug, {
|
|
89093
89089
|
id: page.id,
|
|
89094
89090
|
taskId: page.taskId ?? null
|
|
@@ -89125,7 +89121,9 @@ async function handleConsensusBlocked(result, ctx, input, resolvedTaskId) {
|
|
|
89125
89121
|
}
|
|
89126
89122
|
}
|
|
89127
89123
|
let error51;
|
|
89128
|
-
if (
|
|
89124
|
+
if (clarificationDeliveryIncomplete) {
|
|
89125
|
+
error51 = filedQuestionCount === 0 ? "No open clarification questions could be confirmed in the Inbox." : `Confirmed ${filedQuestionCount} open clarification question${filedQuestionCount === 1 ? "" : "s"} in the Inbox. Some questions could not be confirmed.`;
|
|
89126
|
+
} else if (filedQuestionCount > 0) {
|
|
89129
89127
|
error51 = `Consensus blocked on ${filedQuestionCount} clarification(s); filed as operator question(s).`;
|
|
89130
89128
|
} else if (existingQuestionCount > 0) {
|
|
89131
89129
|
error51 = `Consensus still needs ${existingQuestionCount} pending clarification(s) answered in the spec.`;
|
|
@@ -89146,17 +89144,19 @@ async function handleConsensusBlocked(result, ctx, input, resolvedTaskId) {
|
|
|
89146
89144
|
if (gateBlockQuestionAvailable === false) {
|
|
89147
89145
|
error51 += " No open decision question could be confirmed in the Inbox.";
|
|
89148
89146
|
}
|
|
89149
|
-
if (result.escalation && gateBlockQuestionAvailable !== false) {
|
|
89147
|
+
if (result.escalation && !clarificationDeliveryIncomplete && gateBlockQuestionAvailable !== false) {
|
|
89150
89148
|
error51 += ` (reason: ${result.escalation.diagnosis})`;
|
|
89151
89149
|
}
|
|
89152
89150
|
const isRelationshipDiagnostic = isSeedAbsence || result.diagnostics?.some((d) => d.kind === "spec_identity_mismatch") || result.escalation?.diagnosis === "spec_identity_mismatch";
|
|
89153
|
-
const
|
|
89151
|
+
const attemptedClarifications = Boolean(scopeId && toFile.length > 0);
|
|
89152
|
+
const deliveryTaskId = attemptedClarifications || gateBlockQuestionAvailable !== void 0 ? taskId : resolvedTaskId;
|
|
89154
89153
|
return {
|
|
89155
89154
|
kind: "failed",
|
|
89156
89155
|
failureReason: "consensus_blocked",
|
|
89157
89156
|
error: error51,
|
|
89158
|
-
filedQuestionCount: filedQuestionCount
|
|
89159
|
-
...
|
|
89157
|
+
filedQuestionCount: attemptedClarifications ? filedQuestionCount : existingQuestionCount,
|
|
89158
|
+
...clarificationDeliveryIncomplete ? { clarificationDeliveryIncomplete } : {},
|
|
89159
|
+
...gateBlockQuestionAvailable !== void 0 ? { gateBlockQuestionAvailable } : {},
|
|
89160
89160
|
finalReviewedHash: isRelationshipDiagnostic ? null : result.evaluatedReviewHash ?? result.evaluatedSnapshot?.contentHash ?? null,
|
|
89161
89161
|
...deliveryTaskId ? { taskId: deliveryTaskId } : {}
|
|
89162
89162
|
};
|
|
@@ -89303,7 +89303,7 @@ async function run2(ctx, input, builders = defaultNativeSpecGateBuilders) {
|
|
|
89303
89303
|
};
|
|
89304
89304
|
}
|
|
89305
89305
|
}
|
|
89306
|
-
function onComplete(outcome, input) {
|
|
89306
|
+
function onComplete(outcome, input, context) {
|
|
89307
89307
|
if (outcome.kind === "superseded") {
|
|
89308
89308
|
return {
|
|
89309
89309
|
kind: "info",
|
|
@@ -89343,7 +89343,7 @@ ${findings.map((f) => `\u2022 ${f}`).join("\n")}` : "";
|
|
|
89343
89343
|
body: taskRef ? `The reviewers agreed on this spec \u2014 ${roster}.${findingsBlock}` : `The reviewers agreed on this spec (Specs/${input.pageId}) \u2014 ${roster}.${findingsBlock}`
|
|
89344
89344
|
};
|
|
89345
89345
|
}
|
|
89346
|
-
if (outcome.kind === "failed" && (outcome.filedQuestionCount ?? 0) > 0) {
|
|
89346
|
+
if (outcome.kind === "failed" && !outcome.clarificationDeliveryIncomplete && (outcome.filedQuestionCount ?? 0) > 0) {
|
|
89347
89347
|
const n = outcome.filedQuestionCount ?? 0;
|
|
89348
89348
|
return {
|
|
89349
89349
|
kind: "info",
|
|
@@ -89361,10 +89361,11 @@ ${findings.map((f) => `\u2022 ${f}`).join("\n")}` : "";
|
|
|
89361
89361
|
};
|
|
89362
89362
|
}
|
|
89363
89363
|
const handoffTaskRef = taskRef ? ` (${taskRef})` : "";
|
|
89364
|
-
const
|
|
89364
|
+
const incompleteDelivery = outcome.kind === "failed" && (outcome.clarificationDeliveryIncomplete || outcome.gateBlockQuestionAvailable === false);
|
|
89365
|
+
const handoffSuffix = incompleteDelivery && context ? `job-${(0, import_node_crypto10.createHash)("sha256").update(JSON.stringify([context.projectSlug, context.jobId, context.createdAt])).digest("hex").slice(0, 32)}` : "finalReviewedHash" in outcome && outcome.finalReviewedHash ? outcome.finalReviewedHash.slice(0, 8) : "init";
|
|
89365
89366
|
return {
|
|
89366
89367
|
kind: "handoff",
|
|
89367
|
-
id: `II-SPEC-STOPPED-${input.pageId}-${
|
|
89368
|
+
id: `II-SPEC-STOPPED-${input.pageId}-${handoffSuffix}`,
|
|
89368
89369
|
...taskId ? { taskId } : {},
|
|
89369
89370
|
body: `The spec review stopped for Specs/${input.pageId}${handoffTaskRef}. ${outcome.error} Review the spec or consult the Director to update it.`
|
|
89370
89371
|
};
|
|
@@ -99672,7 +99673,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
99672
99673
|
}
|
|
99673
99674
|
|
|
99674
99675
|
// src/_generated/version.ts
|
|
99675
|
-
var PKG_VERSION = "0.4.
|
|
99676
|
+
var PKG_VERSION = "0.4.220";
|
|
99676
99677
|
|
|
99677
99678
|
// src/bridge-allowed-origins.ts
|
|
99678
99679
|
var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|
|
@@ -108783,6 +108784,7 @@ async function driveClaimableAsyncJob(deps, projectSlug, jobId, preClaimJob, sec
|
|
|
108783
108784
|
if (reportAction && (claimed?.leaseId !== ownedClaim?.leaseId || claimed?.status !== "running")) return;
|
|
108784
108785
|
if (shutdown?.aborted || !claimed || !claimed.leaseId) return;
|
|
108785
108786
|
const leaseId = claimed.leaseId;
|
|
108787
|
+
const completionContext = { projectSlug: claimed.projectSlug, jobId: claimed.id, createdAt: claimed.createdAt };
|
|
108786
108788
|
const ownership = reportAction ? new AbortController() : void 0;
|
|
108787
108789
|
if (ownership) shutdown = shutdown ? AbortSignal.any([shutdown, ownership.signal]) : ownership.signal;
|
|
108788
108790
|
let validUntil = claimStart + (ownedClaim?.leaseRemainingMs ?? 0);
|
|
@@ -108909,7 +108911,7 @@ async function driveClaimableAsyncJob(deps, projectSlug, jobId, preClaimJob, sec
|
|
|
108909
108911
|
beginning = true;
|
|
108910
108912
|
if (heartbeatPending) await heartbeatPending;
|
|
108911
108913
|
if (!checkOwnership()) return;
|
|
108912
|
-
const delivery2 = outcome.kind === "superseded" ? void 0 : descriptor2.onComplete(outcome, input);
|
|
108914
|
+
const delivery2 = outcome.kind === "superseded" ? void 0 : descriptor2.onComplete(outcome, input, completionContext);
|
|
108913
108915
|
if (delivery2 && !delivery2.suppressInbox && delivery2.kind !== "info" && delivery2.kind !== "handoff") {
|
|
108914
108916
|
throw new Error("Unsupported report evidence delivery kind");
|
|
108915
108917
|
}
|
|
@@ -108966,7 +108968,7 @@ async function driveClaimableAsyncJob(deps, projectSlug, jobId, preClaimJob, sec
|
|
|
108966
108968
|
}
|
|
108967
108969
|
}
|
|
108968
108970
|
if (shutdown?.aborted) return;
|
|
108969
|
-
const delivery = descriptor2.onComplete(outcome, input);
|
|
108971
|
+
const delivery = descriptor2.onComplete(outcome, input, completionContext);
|
|
108970
108972
|
if (!delivery.suppressInbox) {
|
|
108971
108973
|
await deps.client.createInboxItem(projectSlug, {
|
|
108972
108974
|
id: delivery.id ?? `II-${import_node_crypto27.default.randomUUID()}`,
|