@productbrain/mcp 0.0.1-beta.14196 → 0.0.1-beta.14207

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.
@@ -401,6 +401,16 @@ var ENTRY_BODY_HELP = `The detail, in Markdown. ${KEY_RESULT_BODY_HELP}`;
401
401
  var SOURCE_EXCERPT_MAX_CHARS = 4e3;
402
402
  var LABEL_DESCRIPTION_MAX_CHARS = 2e3;
403
403
  var RELATION_BATCH_MAX = 25;
404
+ var ANSWER_TEXT_MAX_CHARS = 4e3;
405
+ var ANSWER_REFUSAL_FIX = "Shorten the answer.";
406
+ function answerTextRefusal(answer2) {
407
+ if (answer2.length <= ANSWER_TEXT_MAX_CHARS) return null;
408
+ return `Answer is ${answer2.length} characters; the cap for an answer is ${ANSWER_TEXT_MAX_CHARS}. ${ANSWER_REFUSAL_FIX}`;
409
+ }
410
+ var ANSWER_POINTER_ONLY_REFUSAL = "An answer is written in full: write the answer, and add the link beside it.";
411
+ var ANSWER_EMPTY_REFUSAL = "Answer text cannot be empty.";
412
+ var ANSWER_TEXT_HELP = `The answer in full, at most ${ANSWER_TEXT_MAX_CHARS.toLocaleString("en-US")} characters.`;
413
+ var ANSWER_ENTRY_HELP = "Link an entry beside the answer text; it resolves the question. Never instead of the text.";
404
414
  function listCutLine(shown) {
405
415
  return shown > 0 ? `Only the first ${shown} entries were read.` : "No entries matched in the part of the list that was read.";
406
416
  }
@@ -11355,15 +11365,16 @@ import { z as z33 } from "zod/v3";
11355
11365
  var QUESTION_ACTIONS = ["create", "assign", "answer", "force-close", "list"];
11356
11366
  var questionSchema = z33.object({
11357
11367
  action: z33.enum(QUESTION_ACTIONS).describe(
11358
- `'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 and moves it to answered; --entry links an existing decision instead. 'force-close': Team-Lead-only escape hatch \u2014 reason required. 'list': what you owe; mine:true what you asked; role what waits on it.`
11368
+ `'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.`
11359
11369
  ),
11360
11370
  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'."),
11361
- text: z33.string().max(5e3).optional().describe("'create': the question text. 'answer': the answer text (mutually exclusive with answerEntryId, at most 2,000 characters)."),
11371
+ // 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.
11372
+ text: z33.string().max(8e3).optional().describe(`'create': the question text. 'answer': ${ANSWER_TEXT_HELP}`),
11362
11373
  blocks: z33.array(z33.string().max(200)).max(50).optional().describe("'create': entry ids this question is blocking (repeatable)."),
11363
11374
  toRole: z33.string().max(200).optional().describe("The role (ROL-nnn or a raw entry id): optional on 'create', required on 'assign'."),
11364
11375
  toTeam: z33.string().max(200).optional().describe(`'create' and 'assign', with toRole (TEAM-nnn or a raw entry id): ${QUESTION_SEAT_WORDS.teamHelp}.`),
11365
11376
  reason: z33.string().max(2e3).optional().describe("'force-close': required reason."),
11366
- answerEntryId: z33.string().max(200).optional().describe("'answer': point at an already-written entry instead of supplying text (mutually exclusive with text)."),
11377
+ answerEntryId: z33.string().max(200).optional().describe(`'answer': ${ANSWER_ENTRY_HELP}`),
11367
11378
  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)."),
11368
11379
  role: z33.string().max(200).optional().describe("'list': role id (not with mine).")
11369
11380
  });
@@ -11377,7 +11388,7 @@ var createVariant = z33.object({
11377
11388
  // DEC-2577: with Team Lead, the team whose lead is asked
11378
11389
  });
11379
11390
  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() });
11380
- var answerVariant = z33.object({ action: z33.literal("answer"), entryId: z33.string().max(200), text: z33.string().max(2e3).optional(), answerEntryId: z33.string().max(200).optional() });
11391
+ var answerVariant = z33.object({ action: z33.literal("answer"), entryId: z33.string().max(200), text: z33.string().optional(), answerEntryId: z33.string().max(200).optional() });
11381
11392
  var forceCloseVariant = z33.object({ action: z33.literal("force-close"), entryId: z33.string().max(200), reason: z33.string().min(1).max(2e3) });
11382
11393
  var listVariant = z33.object({ action: z33.literal("list"), mine: z33.boolean().optional(), role: z33.string().max(200).optional() });
11383
11394
  var questionActionUnion = z33.discriminatedUnion("action", [
@@ -11390,7 +11401,7 @@ var questionActionUnion = z33.discriminatedUnion("action", [
11390
11401
  var QUESTION_ACTION_SPECS = {
11391
11402
  create: { params: ["text", "blocks", "toRole", "toTeam"], description: "text is required; blocks, toRole and toTeam are optional; toTeam goes with toRole." },
11392
11403
  assign: { params: ["entryId", "toRole", "toTeam"], description: "entryId and toRole are both required \u2014 assign is reassign-to-a-role only; toTeam is optional." },
11393
- answer: { params: ["entryId", "text", "answerEntryId"], description: "entryId is required; supply exactly one of text or answerEntryId." },
11404
+ answer: { params: ["entryId", "text", "answerEntryId"], description: "entryId and text are required; answerEntryId is optional, beside the text." },
11394
11405
  "force-close": { params: ["entryId", "reason"], description: "entryId and reason are both required." },
11395
11406
  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." }
11396
11407
  };
@@ -11462,12 +11473,8 @@ async function handleQuestionAssign(entryId, toRole, toTeam) {
11462
11473
  }
11463
11474
  }
11464
11475
  async function handleQuestionAnswer(entryId, text, answerEntryId) {
11465
- if (text === void 0 && answerEntryId === void 0) {
11466
- return backpressureResult("question", "answer", QUESTION_ACTION_SPECS.answer, "Give the answer as text, or point at an entry with --entry <id>.");
11467
- }
11468
- if (text !== void 0 && answerEntryId !== void 0) {
11469
- return backpressureResult("question", "answer", QUESTION_ACTION_SPECS.answer, "Use either answer text or --entry, not both.");
11470
- }
11476
+ const refusal = text === void 0 ? answerEntryId === void 0 ? ANSWER_EMPTY_REFUSAL : ANSWER_POINTER_ONLY_REFUSAL : text.trim() ? answerTextRefusal(text.trim()) : ANSWER_EMPTY_REFUSAL;
11477
+ if (refusal) return backpressureResult("question", "answer", QUESTION_ACTION_SPECS.answer, refusal);
11471
11478
  requireWriteAccess();
11472
11479
  try {
11473
11480
  const resolvedEntryId = await resolveEntryRef(entryId, "Entry");
@@ -11544,7 +11551,7 @@ function registerQuestionTools(server) {
11544
11551
 
11545
11552
  - **create**: ask a question from text; \`toRole\` assigns it to that role at once; \`toTeam\`: ${QUESTION_SEAT_WORDS.teamHelp}.
11546
11553
  - **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.
11547
- - **answer**: close the loop. Writes \`text\` on the question as its answer, or links an existing decision via \`answerEntryId\` \u2014 never both.
11554
+ - **answer**: close the loop. Writes \`text\` on the question as its answer, in full; \`answerEntryId\` may link an entry beside it, never instead.
11548
11555
  - **force-close**: Team-Lead-only escape hatch (reason required) for a question that cannot otherwise be resolved.
11549
11556
  - **list**: what you owe (default); \`mine:true\` what you asked; \`role\` what waits on that role.
11550
11557
 
@@ -12179,4 +12186,4 @@ export {
12179
12186
  SERVER_VERSION,
12180
12187
  createProductBrainServer
12181
12188
  };
12182
- //# sourceMappingURL=chunk-DFRGOBY5.js.map
12189
+ //# sourceMappingURL=chunk-3N3TYFXZ.js.map