@productbrain/mcp 0.0.1-beta.15884 → 0.0.1-beta.15897

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.
@@ -3091,6 +3091,7 @@ async function handleGet(entryId) {
3091
3091
  function entryCard(e) {
3092
3092
  const conflictLabel = e.possibleConflict?.label;
3093
3093
  const epistemic = deriveEpistemicStatus(toEpistemicInput(e));
3094
+ const clashLines = Object.fromEntries(["contradictionLines", "possibleClashes"].filter((k) => Array.isArray(e[k])).map((k) => [k, e[k].map(String)]));
3094
3095
  const lines = [
3095
3096
  // under the status, the kernel's Due, Replaced by and Changed by lines (DEC-2663; DEC-2006; TASK-1674)
3096
3097
  `# ${e.entryId ? `${e.entryId}: ` : ""}${e.name}`,
@@ -3098,7 +3099,9 @@ function entryCard(e) {
3098
3099
  `**Status:** ${e.status}${e.workflowStatus ? ` / ${e.workflowStatus}` : ""}`,
3099
3100
  ...[e.dueLine, e.replacedLine, e.changedLine].flatMap((l) => typeof l === "string" ? [sanitizeSingleLineField(l)] : []),
3100
3101
  ...typeof conflictLabel === "string" ? [`\u26A0 ${sanitizeSingleLineField(conflictLabel)}`] : [],
3102
+ ...Object.values(clashLines).flat().map((l) => `${/^ */.exec(l)[0]}${sanitizeSingleLineField(l)}`),
3101
3103
  `**Collection:** ${e.collectionSlug ?? "unknown"}`
3104
+ // the clash lines as pb get prints them
3102
3105
  ];
3103
3106
  if (typeof e.capturedAt === "number") lines.push(`**Captured at:** ${new Date(e.capturedAt).toISOString()}`);
3104
3107
  if (e.origin) {
@@ -3120,9 +3123,7 @@ function entryCard(e) {
3120
3123
  const visibleData = sanitizeEntryData(e.data);
3121
3124
  const filteredData = visibleData && whySourceKey ? Object.keys(visibleData).filter((k) => k !== whySourceKey).length > 0 ? Object.fromEntries(Object.entries(visibleData).filter(([k]) => k !== whySourceKey)) : void 0 : visibleData;
3122
3125
  lines.push(...entryDataLines(filteredData));
3123
- if (Array.isArray(e.tags) && e.tags.length > 0) {
3124
- lines.push("", `**Tags:** ${e.tags.join(", ")}`);
3125
- }
3126
+ if (Array.isArray(e.tags) && e.tags.length > 0) lines.push("", `**Tags:** ${e.tags.join(", ")}`);
3126
3127
  if (Array.isArray(e.labels) && e.labels.length > 0) {
3127
3128
  const labels = e.labels;
3128
3129
  lines.push("", `**Labels:** ${labels.map((l) => `\`${l.slug ?? l.name}\``).join(", ")}`);
@@ -3160,6 +3161,7 @@ function entryCard(e) {
3160
3161
  // DEC-2257: the Team Lead holding a role with no one seated
3161
3162
  ...restsOnChanged.length > 0 ? { restsOnChanged } : {},
3162
3163
  ...typeof conflictLabel === "string" ? { possibleConflict: e.possibleConflict } : {},
3164
+ ...clashLines,
3163
3165
  // TEN-2191: surface the WHY and its quality in the structured payload too.
3164
3166
  ...why.length > 0 ? { why } : {},
3165
3167
  ...e.whyQuality ? { whyQuality: String(e.whyQuality) } : {},
@@ -10615,9 +10617,9 @@ function formatQuestionAckGateBlock(notice) {
10615
10617
  lines.push(`- ${questions.length} open question${questions.length === 1 ? "" : "s"} need you before you continue.`);
10616
10618
  for (const q of questions) lines.push(...formatQuestionBrief(q));
10617
10619
  lines.push(" Deal with each question above before proceeding.");
10618
- if (notice.payload?.truncated) {
10619
- lines.push(" (This list may be incomplete \u2014 you may have more open questions than shown.)");
10620
- }
10620
+ if (notice.payload?.note) lines.push(` ${safe(notice.payload.note)}`);
10621
+ else if (notice.payload?.truncated) lines.push(" (This list may be incomplete \u2014 you may have more open questions than shown.)");
10622
+ if (notice.payload?.otherTeams) lines.push(` ${safe(notice.payload.otherTeams)}`);
10621
10623
  return lines;
10622
10624
  }
10623
10625
  function formatNoticeLines(notices) {
@@ -11791,7 +11793,7 @@ import { z as z33 } from "zod/v3";
11791
11793
  var QUESTION_ACTIONS = ["create", "assign", "answer", "add", "force-close", "list"];
11792
11794
  var questionSchema = z33.object({
11793
11795
  action: z33.enum(QUESTION_ACTIONS).describe(
11794
- `'create': ask a question; toRole assigns it to that role at once. ${QUESTION_SEAT_WORDS.withoutTeam} (generic entry creation and move-and-retype also pair a routing facet). 'assign': reassign to a role (toRole required); the asker may do this once while a team lead holds it. 'answer': close the loop \u2014 writes the answer on the question in full and moves it to answered; answerEntryId may link an entry beside it. 'add': ${QUESTION_LINE_WORDS.help} 'force-close': Team-Lead-only escape hatch \u2014 reason required. 'list': what you owe; mine:true what you asked; role what waits on it.`
11796
+ `'create': ask a question; toRole assigns it to that role at once. ${QUESTION_SEAT_WORDS.withoutTeam} (generic entry creation and move-and-retype also pair a routing facet). 'assign': reassign to a role (toRole required); the asker may do this once while a team lead holds it. 'answer': writes the full answer and moves it to answered; answerEntryId may link an entry beside it. 'add': ${QUESTION_LINE_WORDS.help} 'force-close': Team-Lead-only escape hatch \u2014 reason required. 'list': what you owe; mine:true what you asked; role what waits on it.`
11795
11797
  ),
11796
11798
  entryId: z33.string().max(200).optional().describe("Target question's id (human TEN-nnn form or a raw entry id). Required for every action except 'create'/'list'."),
11797
11799
  // Well above the answer cap, so an over-cap answer reaches the handler and reads the door's refusal; create keeps 5,000 in its variant.
@@ -11801,8 +11803,9 @@ var questionSchema = z33.object({
11801
11803
  toTeam: z33.string().max(200).optional().describe(`'create' and 'assign', with toRole (TEAM-nnn or a raw entry id): ${QUESTION_SEAT_WORDS.teamHelp}.`),
11802
11804
  reason: z33.string().max(2e3).optional().describe("'force-close': required reason."),
11803
11805
  answerEntryId: z33.string().max(200).optional().describe(`'answer': ${ANSWER_ENTRY_HELP}`),
11804
- mine: z33.boolean().optional().describe("'list': true for arm C (every question YOU asked, every status). Omit/false for the ack-gate view (what you owe)."),
11805
- role: z33.string().max(200).optional().describe("'list': role id (not with mine).")
11806
+ mine: z33.boolean().optional().describe("'list': true for every question you asked, any status; omit for what you owe."),
11807
+ role: z33.string().max(200).optional().describe("'list': role id (not with mine)."),
11808
+ team: z33.string().max(200).optional().describe("'list': Team Lead rows' team; no role: one you lead (TEAM-n); not with mine.")
11806
11809
  });
11807
11810
  var createVariant = z33.object({
11808
11811
  action: z33.literal("create"),
@@ -11817,7 +11820,7 @@ var assignVariant = z33.object({ action: z33.literal("assign"), entryId: z33.str
11817
11820
  var answerVariant = z33.object({ action: z33.literal("answer"), entryId: z33.string().max(200), text: z33.string().optional(), answerEntryId: z33.string().max(200).optional() });
11818
11821
  var addVariant = z33.object({ action: z33.literal("add"), entryId: z33.string().max(200), text: z33.string() });
11819
11822
  var forceCloseVariant = z33.object({ action: z33.literal("force-close"), entryId: z33.string().max(200), reason: z33.string().min(1).max(2e3) });
11820
- var listVariant = z33.object({ action: z33.literal("list"), mine: z33.boolean().optional(), role: z33.string().max(200).optional() });
11823
+ var listVariant = z33.object({ action: z33.literal("list"), mine: z33.boolean().optional(), role: z33.string().max(200).optional(), team: z33.string().max(200).optional() });
11821
11824
  var questionActionUnion = z33.discriminatedUnion("action", [
11822
11825
  createVariant,
11823
11826
  assignVariant,
@@ -11832,7 +11835,7 @@ var QUESTION_ACTION_SPECS = {
11832
11835
  answer: { params: ["entryId", "text", "answerEntryId"], description: "entryId and text are required; answerEntryId is optional, beside the text." },
11833
11836
  add: { params: ["entryId", "text"], description: "entryId and text are both required: the question you asked, and the line to add." },
11834
11837
  "force-close": { params: ["entryId", "reason"], description: "entryId and reason are both required." },
11835
- list: { params: ["mine", "role"], description: "mine and role are optional, not together \u2014 omit both for what you owe, mine:true for what you asked, role for what waits on that role." }
11838
+ list: { params: ["mine", "role", "team"], description: "mine and role are optional, not together \u2014 omit both for what you owe, mine:true for what you asked, role for what waits on that role." }
11836
11839
  };
11837
11840
  var HUMAN_ID_PATTERN = /^[A-Za-z]+-\d+$/;
11838
11841
  async function resolveEntryRef(raw, label2) {
@@ -11942,27 +11945,35 @@ async function handleQuestionForceClose(entryId, reason2) {
11942
11945
  return questionErrorResult(err, "force-close", { entryId, reason: reason2 });
11943
11946
  }
11944
11947
  }
11945
- async function handleQuestionList(mine, role) {
11948
+ async function handleQuestionList(mine, role, team) {
11946
11949
  try {
11947
- const result2 = await kernelQuery("question.list", { mine, ...role !== void 0 ? { role } : {} });
11950
+ const sessionId = getAgentSessionId() ?? void 0;
11951
+ const result2 = await kernelQuery("question.list", {
11952
+ mine,
11953
+ ...role !== void 0 ? { role } : {},
11954
+ ...team !== void 0 ? { team } : {},
11955
+ ...sessionId ? { sessionId } : {}
11956
+ });
11948
11957
  const rows = result2.questions;
11958
+ const otherTeams = result2.otherTeams ? `
11959
+ ${stripControlChars(result2.otherTeams)}` : "";
11949
11960
  if (rows.length === 0) {
11950
- const message2 = result2.role ? stripControlChars(result2.note ?? "") : mine ? "You haven't asked any questions yet." : "No open questions.";
11961
+ const message2 = (result2.role || result2.note ? stripControlChars(result2.note ?? "") : mine ? "You haven't asked any questions yet." : "No open questions.") + otherTeams;
11951
11962
  return successResult(message2, message2, { ...result2, action: "list" });
11952
11963
  }
11953
11964
  const lines = rows.map((r) => {
11954
11965
  const outcomeSuffix = mine && r.outcome ? ` \u2014 ${stripControlChars(r.outcome)}` : "";
11955
11966
  const judgeSuffix = !mine && r.judgeSentence ? ` \u2014 ${stripControlChars(r.judgeSentence)}` : "";
11956
- return `[${stripControlChars(r.entryId)}] ${stripControlChars(r.question)} \u2014 ${stripControlChars(r.stateLabel)} \u2014 ${stripControlChars(r.why)} \u2014 ${stripControlChars(r.domain)} \u2014 ${stripControlChars(r.withLabel)} \u2014 ${r.ageDays}d${outcomeSuffix}${judgeSuffix}`;
11967
+ return `[${stripControlChars(r.entryId)}] ${stripControlChars(r.question)} \u2014 ${stripControlChars(r.stateLabel)} \u2014 ${stripControlChars(r.why)} \u2014 ${stripControlChars(r.team ?? "\u2014")} \u2014 ${stripControlChars(r.withLabel)} \u2014 ${r.ageDays}d${outcomeSuffix}${judgeSuffix}`;
11957
11968
  });
11958
- const truncationNote = result2.role ? result2.note ? `
11969
+ const truncationNote = result2.role || result2.note ? result2.note ? `
11959
11970
  ${stripControlChars(result2.note)}` : "" : result2.truncated ? `
11960
11971
  (${mine ? "showing your most recent questions only \u2014 older ones exist but are not shown" : "this list may be incomplete \u2014 some obligations may not be shown"})` : "";
11961
11972
  const message = `${rows.length} question${rows.length === 1 ? "" : "s"}:
11962
- ${lines.join("\n")}${truncationNote}`;
11973
+ ${lines.join("\n")}${truncationNote}${otherTeams}`;
11963
11974
  return successResult(message, message, { ...result2, action: "list" });
11964
11975
  } catch (err) {
11965
- return questionErrorResult(err, "list", { mine, role });
11976
+ return questionErrorResult(err, "list", { mine, role, team });
11966
11977
  }
11967
11978
  }
11968
11979
  function questionErrorResult(err, action, params = {}) {
@@ -11986,7 +11997,7 @@ function registerQuestionTools(server) {
11986
11997
  answer: (data) => handleQuestionAnswer(data.entryId, data.text, data.answerEntryId),
11987
11998
  add: (data) => handleQuestionAddLine(data.entryId, data.text),
11988
11999
  "force-close": (data) => handleQuestionForceClose(data.entryId, data.reason),
11989
- list: (data) => handleQuestionList(data.mine, data.role)
12000
+ list: (data) => handleQuestionList(data.mine, data.role, data.team)
11990
12001
  };
11991
12002
  server.registerTool(
11992
12003
  "question",
@@ -11995,7 +12006,7 @@ function registerQuestionTools(server) {
11995
12006
  description: `Routed questions \u2014 ask a role with \`toRole\` on create and the question is assigned to it at once. ${QUESTION_SEAT_WORDS.withoutTeam} Six actions:
11996
12007
 
11997
12008
  - **create**: ask a question from text; \`toRole\` assigns it to that role at once; \`toTeam\`: ${QUESTION_SEAT_WORDS.teamHelp}.
11998
- - **assign**: reassign to a role (\`toRole\` required, \`toTeam\` as on create); the asker may reassign their own question once while a team lead holds it.
12009
+ - **assign**: reassign to a role (\`toRole\` required, \`toTeam\` as on create); the asker may, once, while a team lead holds it.
11999
12010
  - **answer**: close the loop. Writes \`text\` on the question as its answer, in full; \`answerEntryId\` may link an entry beside it, never instead.
12000
12011
  - **add**: ${QUESTION_LINE_WORDS.help} \`entryId\` and \`text\` required.
12001
12012
  - **force-close**: Team-Lead-only escape hatch (reason required) for a question that cannot otherwise be resolved.
@@ -12650,4 +12661,4 @@ export {
12650
12661
  SERVER_VERSION,
12651
12662
  createProductBrainServer
12652
12663
  };
12653
- //# sourceMappingURL=chunk-FQT4BHTR.js.map
12664
+ //# sourceMappingURL=chunk-RLADPZ3R.js.map