@productbrain/mcp 0.0.1-beta.12571 → 0.0.1-beta.12579
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.
|
@@ -214,6 +214,32 @@ var SPINE_LINKS_LINES = [
|
|
|
214
214
|
`${spineSubject(FIRST_SPINE_SUBJECT)} ${SPINE_RUNG_SEQUENCE[0].relationType} ${withArticle(kindWord(SPINE_RUNG_SEQUENCE[0].targetKey))}; informs joins no levels.`,
|
|
215
215
|
"Before accepting an entry, preflight it: it names what blocks."
|
|
216
216
|
];
|
|
217
|
+
var LINK_REFUSAL_WORDS = {
|
|
218
|
+
unlinked: "This entry links to nothing it serves.",
|
|
219
|
+
linkOrReason: "Link it to what it serves, or say why it stands alone.",
|
|
220
|
+
linkOrAnswer: "Link it to what it serves, or answer why it stands alone.",
|
|
221
|
+
linkThenSave: "Link it to what it serves, then save it again.",
|
|
222
|
+
orientFirst: "Orient this session first, then save it again.",
|
|
223
|
+
savedAnyway: "This entry links to nothing it serves yet; it was saved anyway.",
|
|
224
|
+
reasonTooShort: (chars) => `The reason it stands alone needs at least ${chars} characters.`,
|
|
225
|
+
linkRoute: "Link it to the work package, goal or principle it serves, then try again; a linked entry needs no answer.",
|
|
226
|
+
answerRoute: "Pick the answer that fits; a reason is needed only if you diverge.",
|
|
227
|
+
reasonRoute: "Say why it stands alone; your name is kept with it.",
|
|
228
|
+
notVerified: "This entry is not verified yet. Verify it, then accept it again.",
|
|
229
|
+
verifyRoute: "Verify the entry, then accept it again.",
|
|
230
|
+
personAccepts: "Only a person can accept this entry; a person accepts it in Product Brain.",
|
|
231
|
+
notAccepted: (entryId) => `${entryId} was not accepted and stays a draft.`,
|
|
232
|
+
notChanged: (entryId) => `${entryId} was not changed.`,
|
|
233
|
+
/** The refusal panel's steps (CoherencyRefusalPanel.svelte): each step's title and its retry button, carried on the payload. */
|
|
234
|
+
steps: {
|
|
235
|
+
link: { title: "Link the authorizing entry", cta: "I've linked it \u2014 retry" },
|
|
236
|
+
answer: { title: "Answer it", cta: "Record my answer, then retry", legend: "Your answer" },
|
|
237
|
+
reason: { title: "Override with a typed reason", cta: "Override & retry", label: "Typed override reason" },
|
|
238
|
+
verify: { title: "Verify the entry", cta: "I've verified it \u2014 retry" },
|
|
239
|
+
person: { title: "A human must accept it directly", cta: "I've had a human accept it \u2014 retry" }
|
|
240
|
+
},
|
|
241
|
+
heldBundle: (count) => `Nothing was accepted: ${count} ${count === 1 ? "entry links to nothing it serves" : "entries link to nothing they serve"}.`
|
|
242
|
+
};
|
|
217
243
|
var CHECKLIST_LINES = {
|
|
218
244
|
purpose: {
|
|
219
245
|
stranger_test: "Explain it so a stranger knows why this company exists",
|
|
@@ -1535,59 +1561,29 @@ function pushAppliedFieldsLines(responseLines, fieldsProvided, appliedFields, re
|
|
|
1535
1561
|
}
|
|
1536
1562
|
|
|
1537
1563
|
// src/tools/coherency-refusal.ts
|
|
1538
|
-
function
|
|
1539
|
-
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
"",
|
|
1550
|
-
refusal.reason ?? `The coherency gate refused this write on ${entryId}.`
|
|
1564
|
+
function nextLines(action, entryId, refusal) {
|
|
1565
|
+
const again = action === "accept" ? `\`entries action=accept entryId="${entryId}"\`` : "the same update again";
|
|
1566
|
+
const withParam = (param) => action === "accept" ? `\`entries action=accept entryId="${entryId}" ${param}\`` : `the same update with \`${param}\``;
|
|
1567
|
+
if (refusal.fix === "verify") return [`Next: \`entries action=verify entryId="${entryId}"\`, then ${again}.`];
|
|
1568
|
+
if (refusal.fix === "person") return [];
|
|
1569
|
+
if (refusal.fix === "orient") return [`Next: \`orient task="<your task>"\`, then ${again}.`];
|
|
1570
|
+
const routes = refusal.routes ?? {};
|
|
1571
|
+
return [
|
|
1572
|
+
`Next: \`relations action=create from="${entryId}" type="informs" to="<what it serves>"\`, then ${again}.`,
|
|
1573
|
+
...routes.acknowledge ? [`Or answer: ${withParam(`coherencyAcknowledgement={"response":"diverged","reason":"<why>"}`)}.`] : [],
|
|
1574
|
+
...routes.override ? [`Or keep it as it is: ${withParam(`steeringOverrideReason="<why>"`)}.`] : []
|
|
1551
1575
|
];
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
const routes = refusal.routes;
|
|
1559
|
-
const routeKeys = routes ? Object.keys(routes) : [];
|
|
1560
|
-
if (routeKeys.length > 0) {
|
|
1561
|
-
lines.push("", `${"#".repeat(headingLevel + 1)} Recovery routes`);
|
|
1562
|
-
const beforeRoutes = lines.length;
|
|
1563
|
-
if (routes && typeof routes.link === "object" && routes.link !== null) {
|
|
1564
|
-
const link = routes.link;
|
|
1565
|
-
lines.push(`- **link:** ${asDescription(link.description) ?? "Link the entry to the strategic spine."}`);
|
|
1566
|
-
}
|
|
1567
|
-
if (routes && typeof routes.acknowledge === "object" && routes.acknowledge !== null) {
|
|
1568
|
-
const ack = routes.acknowledge;
|
|
1569
|
-
const responses = ack.responses?.join(" | ") ?? "linked | accepted-fix | diverged";
|
|
1570
|
-
lines.push(
|
|
1571
|
-
`- **acknowledge** (\`${ack.param ?? "coherencyAcknowledgement"}\`): ${responses}${ack.minReasonChars ? ` (\u2265${ack.minReasonChars} chars for diverged)` : ""}. ${asDescription(ack.description) ?? ""}`.trim()
|
|
1572
|
-
);
|
|
1573
|
-
}
|
|
1574
|
-
if (routes && typeof routes.override === "object" && routes.override !== null) {
|
|
1575
|
-
const ov = routes.override;
|
|
1576
|
-
lines.push(
|
|
1577
|
-
`- **override** (\`${ov.param ?? "steeringOverrideReason"}\`): \u2265${ov.minChars ?? 12} chars. ${asDescription(ov.description) ?? ""}`.trim()
|
|
1578
|
-
);
|
|
1579
|
-
}
|
|
1580
|
-
if (lines.length === beforeRoutes) {
|
|
1581
|
-
lines.push(GENERIC_RECOVERY_LINE);
|
|
1582
|
-
}
|
|
1583
|
-
} else {
|
|
1584
|
-
lines.push("", GENERIC_RECOVERY_LINE);
|
|
1585
|
-
}
|
|
1576
|
+
}
|
|
1577
|
+
function coherencyRefusedResult(toolName, entryId, refusal) {
|
|
1578
|
+
const action = toolName.endsWith("action=update") ? "update" : "accept";
|
|
1579
|
+
const stays = action === "accept" ? LINK_REFUSAL_WORDS.notAccepted(entryId) : LINK_REFUSAL_WORDS.notChanged(entryId);
|
|
1580
|
+
const reason = refusal.reason ?? LINK_REFUSAL_WORDS.unlinked;
|
|
1581
|
+
const next = nextLines(action, entryId, refusal);
|
|
1586
1582
|
return failureResult(
|
|
1587
|
-
withAcceptPrompt(
|
|
1583
|
+
withAcceptPrompt([stays, reason, ...next].join("\n"), [refusal]),
|
|
1588
1584
|
"COHERENCY_REFUSED",
|
|
1589
|
-
|
|
1590
|
-
"
|
|
1585
|
+
`${stays} ${reason}`,
|
|
1586
|
+
next.join("\n") || void 0,
|
|
1591
1587
|
void 0,
|
|
1592
1588
|
{ entryId, refusal }
|
|
1593
1589
|
);
|
|
@@ -1884,7 +1880,7 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
|
|
|
1884
1880
|
|
|
1885
1881
|
**Would be blocked:** ${result2.blockingReason}` : wouldBlock ? `
|
|
1886
1882
|
|
|
1887
|
-
**Would be
|
|
1883
|
+
**Would be refused** on a real accept.` : "";
|
|
1888
1884
|
const advisoryNote = previewContradictionAdvisory ? `
|
|
1889
1885
|
|
|
1890
1886
|
\u26A0 Contradiction advisory (would be attached on a real accept): ${previewContradictionAdvisory.reason}
|
|
@@ -1941,7 +1937,7 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
|
|
|
1941
1937
|
const steeringAdvisory = typeof result2?.steeringAdvisory === "string" && result2.steeringAdvisory.trim() ? result2.steeringAdvisory : void 0;
|
|
1942
1938
|
if (steeringAdvisory) {
|
|
1943
1939
|
lines.push("");
|
|
1944
|
-
lines.push(`\u26A0
|
|
1940
|
+
lines.push(`\u26A0 ${steeringAdvisory}`);
|
|
1945
1941
|
}
|
|
1946
1942
|
const contradictionAdvisory = result2?.contradictionAdvisory;
|
|
1947
1943
|
if (contradictionAdvisory) {
|
|
@@ -11966,4 +11962,4 @@ export {
|
|
|
11966
11962
|
SERVER_VERSION,
|
|
11967
11963
|
createProductBrainServer
|
|
11968
11964
|
};
|
|
11969
|
-
//# sourceMappingURL=chunk-
|
|
11965
|
+
//# sourceMappingURL=chunk-NXO7LB4G.js.map
|