@productbrain/mcp 0.0.1-beta.13803 → 0.0.1-beta.13815
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.
- package/dist/{chunk-RQO4F4VT.js → chunk-AHDK7KO5.js} +70 -25
- package/dist/{chunk-RQO4F4VT.js.map → chunk-AHDK7KO5.js.map} +1 -1
- package/dist/{chunk-GZ5DC3GX.js → chunk-QLJ7VRKU.js} +19 -1
- package/dist/{chunk-GZ5DC3GX.js.map → chunk-QLJ7VRKU.js.map} +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/http.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{setup-K2ZQAM66.js → setup-337PBIIW.js} +2 -2
- package/package.json +1 -1
- /package/dist/{setup-K2ZQAM66.js.map → setup-337PBIIW.js.map} +0 -0
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
PASS_SESSION_ID,
|
|
5
5
|
PASTE_NOW,
|
|
6
6
|
PERSON_STATUS_WORDS,
|
|
7
|
+
QUESTION_SEAT_WORDS,
|
|
8
|
+
QUESTION_TEAM_NEXT,
|
|
7
9
|
SPINE_RUNG_SEQUENCE,
|
|
8
10
|
START_NOTES_NOT_LOADED_LINE,
|
|
9
11
|
WORKSPACE_CLOSED,
|
|
@@ -31,6 +33,7 @@ import {
|
|
|
31
33
|
kernelMutation,
|
|
32
34
|
kernelQuery,
|
|
33
35
|
orientationRefusal,
|
|
36
|
+
questionSeatName,
|
|
34
37
|
recordSessionActivity,
|
|
35
38
|
requireActiveSession,
|
|
36
39
|
requireVendorTriageAccess,
|
|
@@ -45,7 +48,7 @@ import {
|
|
|
45
48
|
startAgentSession,
|
|
46
49
|
startTimingLine,
|
|
47
50
|
withAcceptPrompt
|
|
48
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-QLJ7VRKU.js";
|
|
49
52
|
|
|
50
53
|
// src/server.ts
|
|
51
54
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -11220,7 +11223,17 @@ var RESOLUTION_WORDS = {
|
|
|
11220
11223
|
reasonTooLong: signed(`Keep the reason to one line of ${CONFLICT_RESOLUTION_REASON_MAX} characters or fewer.`),
|
|
11221
11224
|
target: "replaces or refines: the entry it replaces or refines, one of the two",
|
|
11222
11225
|
reason: `For unrelated: one line on why (${CONFLICT_RESOLUTION_REASON_MAX} characters at most); for an amendment: why the answer changes`,
|
|
11223
|
-
recorded: (choice2) => `Recorded: ${choice2}
|
|
11226
|
+
recorded: (choice2) => `Recorded: ${choice2}.`,
|
|
11227
|
+
/** 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.
|
|
11228
|
+
* A plus after a count means more exist than were read (RULE-17). */
|
|
11229
|
+
openHeader: (open, closed) => `Open contradictions (${open.n}${open.more ? "+" : ""})${closed ? `, ${closed.n}${closed.more ? "+" : ""} closed` : ""}`,
|
|
11230
|
+
/** The list when nothing is open (all) or nothing is unanswered (the default list); the surface adds how to see the rest. */
|
|
11231
|
+
noneOpen: "No open contradictions.",
|
|
11232
|
+
noneUnanswered: "No unanswered contradictions.",
|
|
11233
|
+
/** A stored answer as a person reads it: never the stored code. */
|
|
11234
|
+
answer: (answer2) => answer2 === "real" ? "real" : "false alarm",
|
|
11235
|
+
/** The receipt for an answer given in the older form (real or noise), on the CLI and MCP alike. */
|
|
11236
|
+
answeredAs: (answer2) => answer2 === "real" ? "Answered as real: the contradiction stays open until an entry changes." : "Answered as a false alarm: the contradiction is closed."
|
|
11224
11237
|
};
|
|
11225
11238
|
|
|
11226
11239
|
// src/tools/conflicts.ts
|
|
@@ -11232,7 +11245,7 @@ var target = z32.string().max(200).optional();
|
|
|
11232
11245
|
var reason = z32.string().max(CONFLICT_RESOLUTION_REASON_MAX, RESOLUTION_WORDS.reasonTooLong).optional();
|
|
11233
11246
|
var conflictsSchema = z32.object({
|
|
11234
11247
|
action: z32.enum(ACTIONS),
|
|
11235
|
-
mode: mode.optional().describe("list: all adds
|
|
11248
|
+
mode: mode.optional().describe("list: all adds answered and snoozed ones."),
|
|
11236
11249
|
issueId: z32.string().max(200).optional().describe("resolve: id from list."),
|
|
11237
11250
|
choice: choice.optional(),
|
|
11238
11251
|
target,
|
|
@@ -11245,15 +11258,17 @@ var conflictsActionUnion = z32.discriminatedUnion("action", [
|
|
|
11245
11258
|
]);
|
|
11246
11259
|
var CONFLICTS_ACTION_SPECS = {
|
|
11247
11260
|
list: { params: ["mode"], description: "mode: actionable by default." },
|
|
11248
|
-
resolve: { params: ["issueId", "choice", "target", "reason", "verdict"], description: "issueId and choice (or
|
|
11261
|
+
resolve: { params: ["issueId", "choice", "target", "reason", "verdict"], description: "issueId and choice (or real|noise)." }
|
|
11249
11262
|
};
|
|
11250
11263
|
async function handleConflictsList(listMode = "actionable") {
|
|
11251
11264
|
const rows = await kernelCall("conflicts.list", { mode: listMode });
|
|
11252
11265
|
const side = (name, id) => `${sanitizeSingleLineField(name)} (${id ? sanitizeSingleLineField(id) : "gone"})`;
|
|
11253
|
-
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)}` : ""));
|
|
11266
|
+
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)}` : ""));
|
|
11254
11267
|
const truncated = rows[0]?.listTruncated === true;
|
|
11255
|
-
const
|
|
11256
|
-
const
|
|
11268
|
+
const answered = rows.filter((r) => r.answered).length;
|
|
11269
|
+
const open = rows.length - answered;
|
|
11270
|
+
const count = `${open}${truncated ? "+" : ""} contradiction${open === 1 && !truncated ? "" : "s"}`;
|
|
11271
|
+
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("|")}`;
|
|
11257
11272
|
const order = rows[0]?.rankOrderNote ? [sanitizeSingleLineField(rows[0].rankOrderNote)] : [];
|
|
11258
11273
|
return successResult([summary, ...order, ...lines].join("\n"), summary, { mode: listMode, rows });
|
|
11259
11274
|
}
|
|
@@ -11274,7 +11289,7 @@ async function handleConflictsResolve(issueId, { choice: pick, target: entry, re
|
|
|
11274
11289
|
issueId,
|
|
11275
11290
|
verdict: word === "noise" ? "false_alarm" : "real"
|
|
11276
11291
|
});
|
|
11277
|
-
const message = word === "
|
|
11292
|
+
const message = RESOLUTION_WORDS.answeredAs(word === "noise" ? "false_alarm" : "real");
|
|
11278
11293
|
return successResult(message, message, { issueId, verdict: word, result: result2 });
|
|
11279
11294
|
}
|
|
11280
11295
|
function registerConflictsTool(server) {
|
|
@@ -11299,12 +11314,13 @@ import { z as z33 } from "zod/v3";
|
|
|
11299
11314
|
var QUESTION_ACTIONS = ["create", "assign", "answer", "force-close", "list"];
|
|
11300
11315
|
var questionSchema = z33.object({
|
|
11301
11316
|
action: z33.enum(QUESTION_ACTIONS).describe(
|
|
11302
|
-
|
|
11317
|
+
`'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.`
|
|
11303
11318
|
),
|
|
11304
11319
|
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'."),
|
|
11305
11320
|
text: z33.string().max(5e3).optional().describe("'create': the question text. 'answer': the answer text (mutually exclusive with answerEntryId, at most 2,000 characters)."),
|
|
11306
11321
|
blocks: z33.array(z33.string().max(200)).max(50).optional().describe("'create': entry ids this question is blocking (repeatable)."),
|
|
11307
11322
|
toRole: z33.string().max(200).optional().describe("The role (ROL-nnn or a raw entry id): optional on 'create', required on 'assign'."),
|
|
11323
|
+
toTeam: z33.string().max(200).optional().describe(`'create' and 'assign', with toRole (TEAM-nnn or a raw entry id): ${QUESTION_SEAT_WORDS.teamHelp}.`),
|
|
11308
11324
|
reason: z33.string().max(2e3).optional().describe("'force-close': required reason."),
|
|
11309
11325
|
answerEntryId: z33.string().max(200).optional().describe("'answer': point at an already-written entry instead of supplying text (mutually exclusive with text)."),
|
|
11310
11326
|
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)."),
|
|
@@ -11314,10 +11330,12 @@ var createVariant = z33.object({
|
|
|
11314
11330
|
action: z33.literal("create"),
|
|
11315
11331
|
text: z33.string().min(1).max(5e3),
|
|
11316
11332
|
blocks: z33.array(z33.string().max(200)).max(50).optional(),
|
|
11317
|
-
toRole: z33.string().max(200).min(1).optional()
|
|
11333
|
+
toRole: z33.string().max(200).min(1).optional(),
|
|
11318
11334
|
// TASK-1334 (RULE-706): born assigned to the role asked
|
|
11335
|
+
toTeam: z33.string().max(200).min(1).optional()
|
|
11336
|
+
// DEC-2577: with Team Lead, the team whose lead is asked
|
|
11319
11337
|
});
|
|
11320
|
-
var assignVariant = z33.object({ action: z33.literal("assign"), entryId: z33.string().max(200), toRole: z33.string().max(200).min(1) });
|
|
11338
|
+
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() });
|
|
11321
11339
|
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() });
|
|
11322
11340
|
var forceCloseVariant = z33.object({ action: z33.literal("force-close"), entryId: z33.string().max(200), reason: z33.string().min(1).max(2e3) });
|
|
11323
11341
|
var listVariant = z33.object({ action: z33.literal("list"), mine: z33.boolean().optional(), role: z33.string().max(200).optional() });
|
|
@@ -11329,8 +11347,8 @@ var questionActionUnion = z33.discriminatedUnion("action", [
|
|
|
11329
11347
|
listVariant
|
|
11330
11348
|
]);
|
|
11331
11349
|
var QUESTION_ACTION_SPECS = {
|
|
11332
|
-
create: { params: ["text", "blocks", "toRole"], description: "text is required; blocks and
|
|
11333
|
-
assign: { params: ["entryId", "toRole"], description: "entryId and toRole are both required \u2014 assign is reassign-to-a-role only." },
|
|
11350
|
+
create: { params: ["text", "blocks", "toRole", "toTeam"], description: "text is required; blocks, toRole and toTeam are optional; toTeam goes with toRole." },
|
|
11351
|
+
assign: { params: ["entryId", "toRole", "toTeam"], description: "entryId and toRole are both required \u2014 assign is reassign-to-a-role only; toTeam is optional." },
|
|
11334
11352
|
answer: { params: ["entryId", "text", "answerEntryId"], description: "entryId is required; supply exactly one of text or answerEntryId." },
|
|
11335
11353
|
"force-close": { params: ["entryId", "reason"], description: "entryId and reason are both required." },
|
|
11336
11354
|
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." }
|
|
@@ -11351,36 +11369,55 @@ async function displayName(id) {
|
|
|
11351
11369
|
return void 0;
|
|
11352
11370
|
}
|
|
11353
11371
|
}
|
|
11372
|
+
async function seatName(roleName, owner) {
|
|
11373
|
+
const teamName = owner.ownerIsTeamLead && owner.ownerTeamId ? await displayName(owner.ownerTeamId) : void 0;
|
|
11374
|
+
return questionSeatName(roleName, teamName, Boolean(owner.ownerIsTeamLead));
|
|
11375
|
+
}
|
|
11354
11376
|
async function renderCreateConfirmation(result2) {
|
|
11355
|
-
const
|
|
11377
|
+
const roleName = result2.ownerRoleId ? await displayName(result2.ownerRoleId) ?? `an unresolved role (\`${result2.ownerRoleId}\` \u2014 reassign it)` : result2.ownerRoleId;
|
|
11378
|
+
const leadName = roleName ? await seatName(roleName, result2) : roleName;
|
|
11356
11379
|
const base = `Asked as ${result2.questionId ?? result2.entryId}. It is with ${leadName}.`;
|
|
11357
11380
|
const blocksHint = " If something is blocked on this, add blocks:[<entry-id>...].";
|
|
11358
11381
|
const nudge = result2.nudge ? ` ${result2.nudge}` : "";
|
|
11359
11382
|
return `${base}${blocksHint}${nudge}`;
|
|
11360
11383
|
}
|
|
11361
|
-
async function handleQuestionCreate(text, blocks, toRole) {
|
|
11384
|
+
async function handleQuestionCreate(text, blocks, toRole, toTeam) {
|
|
11385
|
+
if (toTeam && !toRole) return backpressureResult("question", "create", QUESTION_ACTION_SPECS.create, `${QUESTION_SEAT_WORDS.nameRoleWithTeam} ${QUESTION_TEAM_NEXT.mcp}`);
|
|
11362
11386
|
requireWriteAccess();
|
|
11363
11387
|
try {
|
|
11364
11388
|
const resolvedBlocks = blocks ? await Promise.all(blocks.map((b) => resolveEntryRef(b, "Blocked entry"))) : void 0;
|
|
11365
11389
|
const toRoleId = toRole ? await resolveEntryRef(toRole, "Role") : void 0;
|
|
11366
|
-
const
|
|
11390
|
+
const toTeamId = toTeam ? await resolveEntryRef(toTeam, "Team") : void 0;
|
|
11391
|
+
const result2 = await kernelMutation("question.create", {
|
|
11392
|
+
text,
|
|
11393
|
+
blocks: resolvedBlocks,
|
|
11394
|
+
...toRoleId ? { toRoleId } : {},
|
|
11395
|
+
...toTeamId ? { toTeamId } : {},
|
|
11396
|
+
sessionId: getAgentSessionId() ?? void 0
|
|
11397
|
+
});
|
|
11367
11398
|
const message = await renderCreateConfirmation(result2);
|
|
11368
11399
|
return successResult(message, message, result2);
|
|
11369
11400
|
} catch (err) {
|
|
11370
|
-
return questionErrorResult(err, "create", { text, blocks, toRole });
|
|
11401
|
+
return questionErrorResult(err, "create", { text, blocks, toRole, toTeam });
|
|
11371
11402
|
}
|
|
11372
11403
|
}
|
|
11373
|
-
async function handleQuestionAssign(entryId, toRole) {
|
|
11404
|
+
async function handleQuestionAssign(entryId, toRole, toTeam) {
|
|
11374
11405
|
requireWriteAccess();
|
|
11375
11406
|
try {
|
|
11376
11407
|
const resolvedEntryId = await resolveEntryRef(entryId, "Entry");
|
|
11377
11408
|
const resolvedToRoleId = await resolveEntryRef(toRole, "Role");
|
|
11378
|
-
const
|
|
11379
|
-
const
|
|
11409
|
+
const resolvedToTeamId = toTeam ? await resolveEntryRef(toTeam, "Team") : void 0;
|
|
11410
|
+
const result2 = await kernelMutation("question.assign", {
|
|
11411
|
+
entryId: resolvedEntryId,
|
|
11412
|
+
toRoleId: resolvedToRoleId,
|
|
11413
|
+
...resolvedToTeamId ? { toTeamId: resolvedToTeamId } : {},
|
|
11414
|
+
sessionId: getAgentSessionId() ?? void 0
|
|
11415
|
+
});
|
|
11416
|
+
const who = await seatName(await displayName(result2.ownerRoleId) ?? result2.ownerRoleId ?? "the target", result2);
|
|
11380
11417
|
const message = `${entryId} reassigned to ${who}. They'll see it at their next session.`;
|
|
11381
11418
|
return successResult(message, message, result2);
|
|
11382
11419
|
} catch (err) {
|
|
11383
|
-
return questionErrorResult(err, "assign", { entryId, toRole });
|
|
11420
|
+
return questionErrorResult(err, "assign", { entryId, toRole, toTeam });
|
|
11384
11421
|
}
|
|
11385
11422
|
}
|
|
11386
11423
|
async function handleQuestionAnswer(entryId, text, answerEntryId) {
|
|
@@ -11452,8 +11489,8 @@ function questionErrorResult(err, action, params = {}) {
|
|
|
11452
11489
|
}
|
|
11453
11490
|
function registerQuestionTools(server) {
|
|
11454
11491
|
const questionHandlers = {
|
|
11455
|
-
create: (data) => handleQuestionCreate(data.text, data.blocks, data.toRole),
|
|
11456
|
-
assign: (data) => handleQuestionAssign(data.entryId, data.toRole),
|
|
11492
|
+
create: (data) => handleQuestionCreate(data.text, data.blocks, data.toRole, data.toTeam),
|
|
11493
|
+
assign: (data) => handleQuestionAssign(data.entryId, data.toRole, data.toTeam),
|
|
11457
11494
|
answer: (data) => handleQuestionAnswer(data.entryId, data.text, data.answerEntryId),
|
|
11458
11495
|
"force-close": (data) => handleQuestionForceClose(data.entryId, data.reason),
|
|
11459
11496
|
list: (data) => handleQuestionList(data.mine, data.role)
|
|
@@ -11462,7 +11499,15 @@ function registerQuestionTools(server) {
|
|
|
11462
11499
|
"question",
|
|
11463
11500
|
{
|
|
11464
11501
|
title: "Question",
|
|
11465
|
-
description:
|
|
11502
|
+
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:
|
|
11503
|
+
|
|
11504
|
+
- **create**: ask a question from text; \`toRole\` assigns it to that role at once; \`toTeam\`: ${QUESTION_SEAT_WORDS.teamHelp}.
|
|
11505
|
+
- **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.
|
|
11506
|
+
- **answer**: close the loop. Writes \`text\` on the question as its answer, or links an existing decision via \`answerEntryId\` \u2014 never both.
|
|
11507
|
+
- **force-close**: Team-Lead-only escape hatch (reason required) for a question that cannot otherwise be resolved.
|
|
11508
|
+
- **list**: what you owe (default); \`mine:true\` what you asked; \`role\` what waits on that role.
|
|
11509
|
+
|
|
11510
|
+
\`blocks\` (repeatable, on create) records what a question is holding up \u2014 pass entry ids it blocks.`,
|
|
11466
11511
|
inputSchema: questionSchema,
|
|
11467
11512
|
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false }
|
|
11468
11513
|
},
|
|
@@ -12094,4 +12139,4 @@ export {
|
|
|
12094
12139
|
SERVER_VERSION,
|
|
12095
12140
|
createProductBrainServer
|
|
12096
12141
|
};
|
|
12097
|
-
//# sourceMappingURL=chunk-
|
|
12142
|
+
//# sourceMappingURL=chunk-AHDK7KO5.js.map
|