@productbrain/mcp 0.0.1-beta.13095 → 0.0.1-beta.13110

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.
@@ -43,7 +43,7 @@ import {
43
43
  setSessionOriented,
44
44
  startAgentSession,
45
45
  withAcceptPrompt
46
- } from "./chunk-N4GNJAW7.js";
46
+ } from "./chunk-EVK7IH5X.js";
47
47
 
48
48
  // src/server.ts
49
49
  import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -11201,17 +11201,23 @@ import { z as z34 } from "zod/v3";
11201
11201
  var QUESTION_ACTIONS = ["create", "assign", "answer", "force-close", "list"];
11202
11202
  var questionSchema = z34.object({
11203
11203
  action: z34.enum(QUESTION_ACTIONS).describe(
11204
- "'create': create a new routed question from text \u2014 the dedicated birth action; every question is born escalated to the team lead (generic entry creation and move-and-retype also pair a routing facet). 'assign': reassign ownership to a role (toRole required \u2014 no bare self-confirm, no toPerson). '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': the ack-gate read model \u2014 what you owe (or, with mine:true, every question you asked, including closed ones)."
11204
+ "'create': ask a question; toRole assigns it to that role at once, else the team lead holds it (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 the 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': the ack-gate read model \u2014 what you owe (or, with mine:true, every question you asked, including closed ones)."
11205
11205
  ),
11206
11206
  entryId: z34.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'."),
11207
11207
  text: z34.string().max(5e3).optional().describe("'create': the question text. 'answer': the answer text (mutually exclusive with answerEntryId, at most 2,000 characters)."),
11208
11208
  blocks: z34.array(z34.string().max(200)).max(50).optional().describe("'create': entry ids this question is blocking (repeatable)."),
11209
- toRole: z34.string().max(200).optional().describe("'assign': reassign to this role (human ROL-nnn form or a raw entry id) \u2014 required."),
11209
+ toRole: z34.string().max(200).optional().describe("The role (ROL-nnn or a raw entry id): optional on 'create', required on 'assign'."),
11210
11210
  reason: z34.string().max(2e3).optional().describe("'force-close': required reason."),
11211
11211
  answerEntryId: z34.string().max(200).optional().describe("'answer': point at an already-written entry instead of supplying text (mutually exclusive with text)."),
11212
11212
  mine: z34.boolean().optional().describe("'list': true for arm C (every question YOU asked, every status). Omit/false for the ack-gate view (what you owe).")
11213
11213
  });
11214
- var createVariant = z34.object({ action: z34.literal("create"), text: z34.string().min(1).max(5e3), blocks: z34.array(z34.string().max(200)).max(50).optional() });
11214
+ var createVariant = z34.object({
11215
+ action: z34.literal("create"),
11216
+ text: z34.string().min(1).max(5e3),
11217
+ blocks: z34.array(z34.string().max(200)).max(50).optional(),
11218
+ toRole: z34.string().max(200).min(1).optional()
11219
+ // TASK-1334 (RULE-706): born assigned to the role asked
11220
+ });
11215
11221
  var assignVariant = z34.object({ action: z34.literal("assign"), entryId: z34.string().max(200), toRole: z34.string().max(200).min(1) });
11216
11222
  var answerVariant = z34.object({ action: z34.literal("answer"), entryId: z34.string().max(200), text: z34.string().max(2e3).optional(), answerEntryId: z34.string().max(200).optional() });
11217
11223
  var forceCloseVariant = z34.object({ action: z34.literal("force-close"), entryId: z34.string().max(200), reason: z34.string().min(1).max(2e3) });
@@ -11224,7 +11230,7 @@ var questionActionUnion = z34.discriminatedUnion("action", [
11224
11230
  listVariant
11225
11231
  ]);
11226
11232
  var QUESTION_ACTION_SPECS = {
11227
- create: { params: ["text", "blocks"], description: "text is required; blocks is optional." },
11233
+ create: { params: ["text", "blocks", "toRole"], description: "text is required; blocks and toRole are optional." },
11228
11234
  assign: { params: ["entryId", "toRole"], description: "entryId and toRole are both required \u2014 assign is reassign-to-a-role only." },
11229
11235
  answer: { params: ["entryId", "text", "answerEntryId"], description: "entryId is required; supply exactly one of text or answerEntryId." },
11230
11236
  "force-close": { params: ["entryId", "reason"], description: "entryId and reason are both required." },
@@ -11253,15 +11259,16 @@ async function renderCreateConfirmation(result2) {
11253
11259
  const nudge = result2.nudge ? ` ${result2.nudge}` : "";
11254
11260
  return `${base}${blocksHint}${nudge}`;
11255
11261
  }
11256
- async function handleQuestionCreate(text, blocks) {
11262
+ async function handleQuestionCreate(text, blocks, toRole) {
11257
11263
  requireWriteAccess();
11258
11264
  try {
11259
11265
  const resolvedBlocks = blocks ? await Promise.all(blocks.map((b) => resolveEntryRef(b, "Blocked entry"))) : void 0;
11260
- const result2 = await kernelMutation("question.create", { text, blocks: resolvedBlocks, sessionId: getAgentSessionId() ?? void 0 });
11266
+ const toRoleId = toRole ? await resolveEntryRef(toRole, "Role") : void 0;
11267
+ const result2 = await kernelMutation("question.create", { text, blocks: resolvedBlocks, ...toRoleId ? { toRoleId } : {}, sessionId: getAgentSessionId() ?? void 0 });
11261
11268
  const message = await renderCreateConfirmation(result2);
11262
11269
  return successResult(message, message, result2);
11263
11270
  } catch (err) {
11264
- return questionErrorResult(err, "create", { text, blocks });
11271
+ return questionErrorResult(err, "create", { text, blocks, toRole });
11265
11272
  }
11266
11273
  }
11267
11274
  async function handleQuestionAssign(entryId, toRole) {
@@ -11345,7 +11352,7 @@ function questionErrorResult(err, action, params = {}) {
11345
11352
  }
11346
11353
  function registerQuestionTools(server) {
11347
11354
  const questionHandlers = {
11348
- create: (data) => handleQuestionCreate(data.text, data.blocks),
11355
+ create: (data) => handleQuestionCreate(data.text, data.blocks, data.toRole),
11349
11356
  assign: (data) => handleQuestionAssign(data.entryId, data.toRole),
11350
11357
  answer: (data) => handleQuestionAnswer(data.entryId, data.text, data.answerEntryId),
11351
11358
  "force-close": (data) => handleQuestionForceClose(data.entryId, data.reason),
@@ -11355,7 +11362,7 @@ function registerQuestionTools(server) {
11355
11362
  "question",
11356
11363
  {
11357
11364
  title: "Question",
11358
- description: "Routed questions \u2014 a question is born with no owner and escalates straight to the team lead; the team lead reassigns it to a role. Five actions:\n\n- **create**: create a new routed question from text. Always born escalated to the team lead \u2014 there is no domain-owner suggestion any more.\n- **assign**: reassign ownership to a role (`toRole` required \u2014 no self-confirm, no person-only reassignment).\n- **answer**: close the loop. Writes `text` on the question as its answer, or links an existing decision via `answerEntryId` \u2014 never both.\n- **force-close**: Team-Lead-only escape hatch (reason required) for a question that cannot otherwise be resolved.\n- **list**: the ack-gate read model \u2014 what you owe (`mine:false`, the default), or (`mine:true`) every question you asked, including closed ones, with its outcome.\n\n`blocks` (repeatable, on create) records what a question is holding up \u2014 pass entry ids it blocks.",
11365
+ description: "Routed questions \u2014 ask a role with `toRole` on create and the question is assigned to it at once; otherwise the team lead holds it. Five actions:\n\n- **create**: ask a question from text; `toRole` assigns it to that role at once, otherwise the team lead holds it.\n- **assign**: reassign to a role (`toRole` required); the asker may reassign their own question once while the team lead holds it.\n- **answer**: close the loop. Writes `text` on the question as its answer, or links an existing decision via `answerEntryId` \u2014 never both.\n- **force-close**: Team-Lead-only escape hatch (reason required) for a question that cannot otherwise be resolved.\n- **list**: the ack-gate read model \u2014 what you owe (`mine:false`, the default), or (`mine:true`) every question you asked, including closed ones, with its outcome.\n\n`blocks` (repeatable, on create) records what a question is holding up \u2014 pass entry ids it blocks.",
11359
11366
  inputSchema: questionSchema,
11360
11367
  annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false }
11361
11368
  },
@@ -11987,4 +11994,4 @@ export {
11987
11994
  SERVER_VERSION,
11988
11995
  createProductBrainServer
11989
11996
  };
11990
- //# sourceMappingURL=chunk-MGQVHOVI.js.map
11997
+ //# sourceMappingURL=chunk-GHVPPBME.js.map