@productbrain/mcp 0.0.1-beta.15050 → 0.0.1-beta.15066

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.
@@ -5,6 +5,8 @@ import {
5
5
  PASS_SESSION_ID,
6
6
  PASTE_NOW,
7
7
  PERSON_STATUS_WORDS,
8
+ QUESTION_LINE_NEXT,
9
+ QUESTION_LINE_WORDS,
8
10
  QUESTION_SEAT_WORDS,
9
11
  QUESTION_TEAM_NEXT,
10
12
  SPINE_RUNG_SEQUENCE,
@@ -54,7 +56,7 @@ import {
54
56
  startAgentSession,
55
57
  startTimingLine,
56
58
  withAcceptPrompt
57
- } from "./chunk-K2QHPQIH.js";
59
+ } from "./chunk-QVMIF4N7.js";
58
60
 
59
61
  // src/server.ts
60
62
  import { McpServer as McpServer2 } from "@modelcontextprotocol/server";
@@ -295,6 +297,13 @@ var ANSWER_POINTER_ONLY_REFUSAL = "An answer is written in full: write the answe
295
297
  var ANSWER_EMPTY_REFUSAL = "Answer text cannot be empty.";
296
298
  var ANSWER_TEXT_HELP = `The answer in full, at most ${ANSWER_TEXT_MAX_CHARS.toLocaleString("en-US")} characters.`;
297
299
  var ANSWER_ENTRY_HELP = "Link an entry beside the answer text; it resolves the question. Never instead of the text.";
300
+ var QUESTION_LINE_MAX_CHARS = ANSWER_TEXT_MAX_CHARS;
301
+ var QUESTION_LINE_EMPTY_REFUSAL = "A line cannot be empty.";
302
+ function questionLineRefusal(line) {
303
+ if (!line) return QUESTION_LINE_EMPTY_REFUSAL;
304
+ if (line.length <= QUESTION_LINE_MAX_CHARS) return null;
305
+ return `Line is ${line.length} characters; the cap for a line is ${QUESTION_LINE_MAX_CHARS}. Shorten the line.`;
306
+ }
298
307
  function listCutLine(shown) {
299
308
  return shown > 0 ? `Only the first ${shown} entries were read.` : "No entries matched in the part of the list that was read.";
300
309
  }
@@ -1802,7 +1811,9 @@ function coherencyRefusedResult(toolName, entryId, refusal) {
1802
1811
  }
1803
1812
  function updateRefusedResult(toolName, entryId, refusal) {
1804
1813
  if (refusal.category !== "auth") return coherencyRefusedResult(`${toolName} action=update`, entryId, refusal);
1805
- const recovery = refusal.proposal?.line ?? authorityRecovery(refusal) ?? "Route this change to the accountable role or Team Lead.";
1814
+ const fix = refusal.proposal?.line ?? authorityRecovery(refusal) ?? "Route this change to the accountable role or Team Lead.";
1815
+ const recovery = typeof refusal.addLineTo === "string" ? `${fix}
1816
+ ${QUESTION_LINE_NEXT.mcp(refusal.addLineTo)}` : fix;
1806
1817
  return failureResult(
1807
1818
  `Update refused: **${entryId}**.
1808
1819
 
@@ -11566,14 +11577,14 @@ function registerConflictsTool(server) {
11566
11577
 
11567
11578
  // src/tools/question.ts
11568
11579
  import { z as z33 } from "zod/v3";
11569
- var QUESTION_ACTIONS = ["create", "assign", "answer", "force-close", "list"];
11580
+ var QUESTION_ACTIONS = ["create", "assign", "answer", "add", "force-close", "list"];
11570
11581
  var questionSchema = z33.object({
11571
11582
  action: z33.enum(QUESTION_ACTIONS).describe(
11572
- `'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. 'force-close': Team-Lead-only escape hatch \u2014 reason required. 'list': what you owe; mine:true what you asked; role what waits on it.`
11583
+ `'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.`
11573
11584
  ),
11574
11585
  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'."),
11575
11586
  // 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.
11576
- text: z33.string().max(8e3).optional().describe(`'create': the question text. 'answer': ${ANSWER_TEXT_HELP}`),
11587
+ text: z33.string().max(8e3).optional().describe(`'create': the question text. 'answer': ${ANSWER_TEXT_HELP} 'add': the line to add.`),
11577
11588
  blocks: z33.array(z33.string().max(200)).max(50).optional().describe("'create': entry ids this question is blocking (repeatable)."),
11578
11589
  toRole: z33.string().max(200).optional().describe("The role (ROL-nnn or a raw entry id): optional on 'create', required on 'assign'."),
11579
11590
  toTeam: z33.string().max(200).optional().describe(`'create' and 'assign', with toRole (TEAM-nnn or a raw entry id): ${QUESTION_SEAT_WORDS.teamHelp}.`),
@@ -11593,12 +11604,14 @@ var createVariant = z33.object({
11593
11604
  });
11594
11605
  var assignVariant = z33.object({ action: z33.literal("assign"), entryId: z33.string().max(200), toRole: z33.string().max(200).min(1), toTeam: z33.string().max(200).min(1).optional() });
11595
11606
  var answerVariant = z33.object({ action: z33.literal("answer"), entryId: z33.string().max(200), text: z33.string().optional(), answerEntryId: z33.string().max(200).optional() });
11607
+ var addVariant = z33.object({ action: z33.literal("add"), entryId: z33.string().max(200), text: z33.string() });
11596
11608
  var forceCloseVariant = z33.object({ action: z33.literal("force-close"), entryId: z33.string().max(200), reason: z33.string().min(1).max(2e3) });
11597
11609
  var listVariant = z33.object({ action: z33.literal("list"), mine: z33.boolean().optional(), role: z33.string().max(200).optional() });
11598
11610
  var questionActionUnion = z33.discriminatedUnion("action", [
11599
11611
  createVariant,
11600
11612
  assignVariant,
11601
11613
  answerVariant,
11614
+ addVariant,
11602
11615
  forceCloseVariant,
11603
11616
  listVariant
11604
11617
  ]);
@@ -11606,6 +11619,7 @@ var QUESTION_ACTION_SPECS = {
11606
11619
  create: { params: ["text", "blocks", "toRole", "toTeam"], description: "text is required; blocks, toRole and toTeam are optional; toTeam goes with toRole." },
11607
11620
  assign: { params: ["entryId", "toRole", "toTeam"], description: "entryId and toRole are both required \u2014 assign is reassign-to-a-role only; toTeam is optional." },
11608
11621
  answer: { params: ["entryId", "text", "answerEntryId"], description: "entryId and text are required; answerEntryId is optional, beside the text." },
11622
+ add: { params: ["entryId", "text"], description: "entryId and text are both required: the question you asked, and the line to add." },
11609
11623
  "force-close": { params: ["entryId", "reason"], description: "entryId and reason are both required." },
11610
11624
  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." }
11611
11625
  };
@@ -11693,6 +11707,19 @@ async function handleQuestionAnswer(entryId, text, answerEntryId) {
11693
11707
  return questionErrorResult(err, "answer", { entryId, text, answerEntryId });
11694
11708
  }
11695
11709
  }
11710
+ async function handleQuestionAddLine(entryId, text) {
11711
+ const refusal = questionLineRefusal(text.trim());
11712
+ if (refusal) return backpressureResult("question", "add", QUESTION_ACTION_SPECS.add, refusal);
11713
+ requireWriteAccess();
11714
+ try {
11715
+ const resolvedEntryId = await resolveEntryRef(entryId, "Entry");
11716
+ const result2 = await kernelMutation("question.addLine", { entryId: resolvedEntryId, text, sessionId: getAgentSessionId() ?? void 0 });
11717
+ const message = `${entryId}: ${stripControlChars(result2.receipt)}`;
11718
+ return successResult(message, message, result2);
11719
+ } catch (err) {
11720
+ return questionErrorResult(err, "add", { entryId, text });
11721
+ }
11722
+ }
11696
11723
  async function handleQuestionForceClose(entryId, reason2) {
11697
11724
  requireWriteAccess();
11698
11725
  try {
@@ -11746,6 +11773,7 @@ function registerQuestionTools(server) {
11746
11773
  create: (data) => handleQuestionCreate(data.text, data.blocks, data.toRole, data.toTeam),
11747
11774
  assign: (data) => handleQuestionAssign(data.entryId, data.toRole, data.toTeam),
11748
11775
  answer: (data) => handleQuestionAnswer(data.entryId, data.text, data.answerEntryId),
11776
+ add: (data) => handleQuestionAddLine(data.entryId, data.text),
11749
11777
  "force-close": (data) => handleQuestionForceClose(data.entryId, data.reason),
11750
11778
  list: (data) => handleQuestionList(data.mine, data.role)
11751
11779
  };
@@ -11753,11 +11781,12 @@ function registerQuestionTools(server) {
11753
11781
  "question",
11754
11782
  {
11755
11783
  title: "Question",
11756
- description: `Routed questions \u2014 ask a role with \`toRole\` on create and the question is assigned to it at once. ${QUESTION_SEAT_WORDS.withoutTeam} Five actions:
11784
+ 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:
11757
11785
 
11758
11786
  - **create**: ask a question from text; \`toRole\` assigns it to that role at once; \`toTeam\`: ${QUESTION_SEAT_WORDS.teamHelp}.
11759
11787
  - **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.
11760
11788
  - **answer**: close the loop. Writes \`text\` on the question as its answer, in full; \`answerEntryId\` may link an entry beside it, never instead.
11789
+ - **add**: ${QUESTION_LINE_WORDS.help} \`entryId\` and \`text\` required.
11761
11790
  - **force-close**: Team-Lead-only escape hatch (reason required) for a question that cannot otherwise be resolved.
11762
11791
  - **list**: what you owe (default); \`mine:true\` what you asked; \`role\` what waits on that role.
11763
11792
 
@@ -12410,4 +12439,4 @@ export {
12410
12439
  SERVER_VERSION,
12411
12440
  createProductBrainServer
12412
12441
  };
12413
- //# sourceMappingURL=chunk-RP6W6RAG.js.map
12442
+ //# sourceMappingURL=chunk-CQ4OF4FC.js.map