@productbrain/mcp 0.0.1-beta.14061 → 0.0.1-beta.14077

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.
@@ -11201,26 +11201,46 @@ import { z as z32 } from "zod/v3";
11201
11201
  var CONFLICT_RESOLUTIONS = ["replaces", "refines", "unrelated"];
11202
11202
  var CONFLICT_RESOLUTION_REASON_MAX = 200;
11203
11203
  var signed = (line) => line;
11204
+ var CLASH = {
11205
+ one: "possible clash",
11206
+ many: "possible clashes",
11207
+ mayWith: "May clash with",
11208
+ check: "possible-clash check",
11209
+ kinds: { contradiction: "may contradict", supersession: "may replace" },
11210
+ /** A count by kind reads the kind's noun (QUE-527, KR-7): it names the kind of possible clash, never the flag (Voice, RULE-705 check 4). */
11211
+ kindNouns: { contradiction: ["contradiction", "contradictions"], supersession: ["supersession", "supersessions"] }
11212
+ };
11213
+ var clashKind = (kind) => CLASH.kinds[kind] ?? kind;
11214
+ var Clash = { one: CLASH.one[0].toUpperCase() + CLASH.one.slice(1), many: CLASH.many[0].toUpperCase() + CLASH.many.slice(1) };
11215
+ var clashCount = (n, more = false) => `${n}${more ? "+" : ""} ${n === 1 && !more ? CLASH.one : CLASH.many}`;
11204
11216
  var RESOLUTION_WORDS = {
11205
11217
  choose: signed(`Choose ${CONFLICT_RESOLUTIONS.slice(0, -1).join(", ")} or ${CONFLICT_RESOLUTIONS[CONFLICT_RESOLUTIONS.length - 1]}.`),
11206
11218
  both: signed("Give either the answer (real or false alarm) or the choice, not both."),
11207
11219
  reasonTooLong: signed(`Keep the reason to one line of ${CONFLICT_RESOLUTION_REASON_MAX} characters or fewer.`),
11208
11220
  target: "replaces or refines: the entry it replaces or refines, one of the two",
11209
11221
  reason: `For unrelated: one line on why (${CONFLICT_RESOLUTION_REASON_MAX} characters at most); for an amendment: why the answer changes`,
11210
- recorded: (choice2) => `Recorded: ${choice2}.`,
11222
+ /** The receipt an older backend's answer gets when it carries no line of its own (the MCP's fallback): the choice in words. */
11223
+ recorded: (choice2) => `Recorded: ${choice2 === "unrelated" ? "unrelated" : `${choice2} the other entry`}.`,
11211
11224
  /** TASK-1560 (QUE-518, QUE-501): what the propose verb does, as pb's help and the MCP tool say it (Voice signs). */
11212
- proposeHelp: "Propose the answer to a possible clash; its owner confirms it",
11213
- tool: "Possible clashes between entries: list, resolve or propose an answer.",
11214
- /** The list's header, one for the CLI and the MCP (DEC-2443): the open contradictions, then the closed ones beside them when `closed` is given.
11225
+ proposeHelp: `Propose the answer to a ${CLASH.one}; its owner confirms it`,
11226
+ /** TASK-1571 (QUE-554, DEC-2299): what only a person does, as the person-only floor says it ("Only a person answers a possible
11227
+ * clash."); the CLI and MCP read it to add their propose command to the gateway's refusal. */
11228
+ answerVerb: `answers a ${CLASH.one}`,
11229
+ /** What the CLI and MCP match the gateway's answer refusal by: stable across QUE-540's pick (see CLASH). */
11230
+ answerMatch: "answers a possible ",
11231
+ tool: `List ${CLASH.many}; propose an answer; a person answers in Cortex.`,
11232
+ /** TASK-1571 (TEN-6206): the answer verbs' help on the CLI and MCP, which the gateway now refuses for every caller (QUE-554). */
11233
+ answerHelp: "A key proposes; a person answers in Cortex.",
11234
+ /** The list's header, one for the CLI and the MCP (DEC-2443): the open possible clashes, then the closed ones beside them when `closed` is given.
11215
11235
  * A plus after a count means more exist than were read (RULE-17). */
11216
- openHeader: (open, closed) => `Open contradictions (${open.n}${open.more ? "+" : ""})${closed ? `, ${closed.n}${closed.more ? "+" : ""} closed` : ""}`,
11236
+ openHeader: (open, closed) => `Open ${CLASH.many} (${open.n}${open.more ? "+" : ""})${closed ? `, ${closed.n}${closed.more ? "+" : ""} closed` : ""}`,
11217
11237
  /** The list when nothing is open (all) or nothing is unanswered (the default list); the surface adds how to see the rest. */
11218
- noneOpen: "No open contradictions.",
11219
- noneUnanswered: "No unanswered contradictions.",
11238
+ noneOpen: `No open ${CLASH.many}.`,
11239
+ noneUnanswered: `No unanswered ${CLASH.many}.`,
11220
11240
  /** A stored answer as a person reads it: never the stored code. */
11221
11241
  answer: (answer2) => answer2 === "real" ? "real" : "false alarm",
11222
11242
  /** The receipt for an answer given in the older form (real or noise), on the CLI and MCP alike. */
11223
- answeredAs: (answer2) => answer2 === "real" ? "Answered as real: the contradiction stays open until an entry changes." : "Answered as a false alarm: the contradiction is closed."
11243
+ answeredAs: (answer2) => answer2 === "real" ? `Answered as real: the ${CLASH.one} stays open until an entry changes.` : `Answered as a false alarm: the ${CLASH.one} is closed.`
11224
11244
  };
11225
11245
 
11226
11246
  // src/tools/conflicts.ts
@@ -11246,23 +11266,32 @@ var conflictsActionUnion = z32.discriminatedUnion("action", [
11246
11266
  ]);
11247
11267
  var CONFLICTS_ACTION_SPECS = {
11248
11268
  list: { params: ["mode"], description: "mode: actionable by default." },
11249
- resolve: { params: ["issueId", "choice", "target", "reason", "verdict"], description: "issueId and choice (or real|noise)." },
11269
+ resolve: { params: ["issueId", "choice", "target", "reason", "verdict"], description: RESOLUTION_WORDS.answerHelp },
11250
11270
  propose: { params: ["issueId", "choice", "target", "reason"], description: "issueId and choice; the owner confirms it." }
11251
11271
  };
11252
11272
  async function handleConflictsList(listMode = "actionable") {
11253
11273
  const rows = await kernelCall("conflicts.list", { mode: listMode });
11254
11274
  const side = (name, id) => `${sanitizeSingleLineField(name)} (${id ? sanitizeSingleLineField(id) : "gone"})`;
11255
- const lines = rows.map((r) => `${r.id} \xB7 ${side(r.entryAName, r.entryAId)} \u2194 ${side(r.entryBName, r.entryBId)} \xB7 ${r.conflictType} ${r.confidence.toFixed(2)}${r.rankLabel ? ` \xB7 ${sanitizeSingleLineField(r.rankLabel)}` : ""} \xB7 ${sanitizeSingleLineField(r.explanation)}` + (r.guidance ? ` \xB7 ${sanitizeSingleLineField(r.guidance)}` : "") + (r.resolvedLine ? ` \xB7 ${sanitizeSingleLineField(r.resolvedLine)}` : "") + // who answered and how (DEC-2443)
11275
+ const lines = rows.map((r) => `${r.id} \xB7 ${side(r.entryAName, r.entryAId)} \u2194 ${side(r.entryBName, r.entryBId)} \xB7 ${clashKind(r.conflictType)} ${r.confidence.toFixed(2)}${r.rankLabel ? ` \xB7 ${sanitizeSingleLineField(r.rankLabel)}` : ""} \xB7 ${sanitizeSingleLineField(r.explanation)}` + (r.guidance ? ` \xB7 ${sanitizeSingleLineField(r.guidance)}` : "") + (r.resolvedLine ? ` \xB7 ${sanitizeSingleLineField(r.resolvedLine)}` : "") + // who answered and how (DEC-2443)
11256
11276
  (r.proposedLine ? ` \xB7 ${sanitizeSingleLineField(r.proposedLine)}` : ""));
11257
11277
  const truncated = rows[0]?.listTruncated === true;
11258
11278
  const answered = rows.filter((r) => r.answered).length;
11259
11279
  const open = rows.length - answered;
11260
- const count = `${open}${truncated ? "+" : ""} contradiction${open === 1 && !truncated ? "" : "s"}`;
11261
- const summary = rows.length === 0 ? listMode === "all" ? RESOLUTION_WORDS.noneOpen : `${RESOLUTION_WORDS.noneUnanswered} mode=all shows answered and snoozed ones.` : listMode === "all" ? RESOLUTION_WORDS.openHeader({ n: open, more: truncated }, answered > 0 || rows[0]?.closedTruncated ? { n: answered, more: rows[0]?.closedTruncated === true } : void 0) : `${count}. Resolve one: conflicts action=resolve issueId=<id> choice=${CONFLICT_RESOLUTIONS.join("|")}`;
11280
+ const count = clashCount(open, truncated);
11281
+ const summary = rows.length === 0 ? listMode === "all" ? RESOLUTION_WORDS.noneOpen : `${RESOLUTION_WORDS.noneUnanswered} mode=all shows answered and snoozed ones.` : listMode === "all" ? RESOLUTION_WORDS.openHeader({ n: open, more: truncated }, answered > 0 || rows[0]?.closedTruncated ? { n: answered, more: rows[0]?.closedTruncated === true } : void 0) : `${count}. Propose an answer for its owner to confirm: conflicts action=propose issueId=<id> choice=${CONFLICT_RESOLUTIONS.join("|")}`;
11262
11282
  const order = rows[0]?.rankOrderNote ? [sanitizeSingleLineField(rows[0].rankOrderNote)] : [];
11263
11283
  return successResult([summary, ...order, ...lines].join("\n"), summary, { mode: listMode, rows });
11264
11284
  }
11265
- async function handleConflictsResolve(issueId, { choice: pick, target: entry, reason: why, verdict: word }) {
11285
+ var PROPOSE_INSTEAD = (refusal, issueId) => `${refusal} Propose it: conflicts action=propose issueId=${issueId} choice=${CONFLICT_RESOLUTIONS.join("|")}`;
11286
+ async function handleConflictsResolve(issueId, args) {
11287
+ try {
11288
+ return await resolveOnce(issueId, args);
11289
+ } catch (err) {
11290
+ if (err instanceof Error && err.message.includes(RESOLUTION_WORDS.answerMatch)) return validationResult(PROPOSE_INSTEAD(err.message, issueId));
11291
+ throw err;
11292
+ }
11293
+ }
11294
+ async function resolveOnce(issueId, { choice: pick, target: entry, reason: why, verdict: word }) {
11266
11295
  if (!pick === !word) return validationResult(pick ? RESOLUTION_WORDS.both : RESOLUTION_WORDS.choose);
11267
11296
  requireWriteAccess();
11268
11297
  if (pick) {
@@ -11303,7 +11332,8 @@ function registerConflictsTool(server) {
11303
11332
  propose: (data) => handleConflictsPropose(data.issueId, data)
11304
11333
  };
11305
11334
  server.registerTool("conflicts", {
11306
- title: "Conflicts",
11335
+ title: "Possible clashes",
11336
+ // a literal for scripts/generate-public-docs.mjs; conflicts.test.ts pins it to Clash.many (TASK-1556)
11307
11337
  description: RESOLUTION_WORDS.tool,
11308
11338
  inputSchema: conflictsSchema,
11309
11339
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
@@ -12143,4 +12173,4 @@ export {
12143
12173
  SERVER_VERSION,
12144
12174
  createProductBrainServer
12145
12175
  };
12146
- //# sourceMappingURL=chunk-NTWUV44F.js.map
12176
+ //# sourceMappingURL=chunk-6MEZEOBQ.js.map