@productbrain/mcp 0.0.1-beta.13387 → 0.0.1-beta.13398
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-4V3HSEFI.js → chunk-ORWPRGU4.js} +87 -8
- package/dist/chunk-ORWPRGU4.js.map +1 -0
- package/dist/{chunk-MFILU7JL.js → chunk-S7OWUKP7.js} +2 -1
- package/dist/chunk-S7OWUKP7.js.map +1 -0
- package/dist/cli/index.js +1 -1
- package/dist/http.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{setup-7QKRR4GH.js → setup-QB4A5L2G.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-4V3HSEFI.js.map +0 -1
- package/dist/chunk-MFILU7JL.js.map +0 -1
- /package/dist/{setup-7QKRR4GH.js.map → setup-QB4A5L2G.js.map} +0 -0
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
setSessionOriented,
|
|
44
44
|
startAgentSession,
|
|
45
45
|
withAcceptPrompt
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-S7OWUKP7.js";
|
|
47
47
|
|
|
48
48
|
// src/server.ts
|
|
49
49
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -3535,6 +3535,51 @@ function workPackageListLines(rows, counts, surface) {
|
|
|
3535
3535
|
}
|
|
3536
3536
|
return lines;
|
|
3537
3537
|
}
|
|
3538
|
+
var OPEN_TASK_LIST_WORDS = {
|
|
3539
|
+
heading: (roleName) => `${roleName}'s open tasks, not in a live package`,
|
|
3540
|
+
separator: " \xB7 ",
|
|
3541
|
+
inProgress: "(in progress)",
|
|
3542
|
+
noOwner: "(no owner)",
|
|
3543
|
+
/** After a task whose package parents are all done or archived, so the agent finishes it or closes it (Product Design 2026-10-30). */
|
|
3544
|
+
packageClosed: "(its package is closed)",
|
|
3545
|
+
/** Orient shows at most this many rows; the cut note names the command for the rest. */
|
|
3546
|
+
shown: 5,
|
|
3547
|
+
more: (hidden, capped, allCommand) => `${hidden}${capped ? "+" : ""} more: ${allCommand}`,
|
|
3548
|
+
allCommand: { cli: "pb tasks list", mcp: "`context action=tasks`" },
|
|
3549
|
+
compact: (count, capped, roleName) => `${count}${capped ? "+" : ""} open task(s) of ${roleName}, not in a live package`,
|
|
3550
|
+
/** Only for a read that was not cut: a capped read that found none prints its capped line instead, never this. */
|
|
3551
|
+
empty: (roleName) => `${roleName} has no open tasks outside a live package.`,
|
|
3552
|
+
/** The tasks list's last line when another page follows. */
|
|
3553
|
+
nextPage: (command) => `More: ${command}`,
|
|
3554
|
+
/** Printed whenever the read stopped at its cap, so rows it never read are not taken for none (signed by Voice, 2026-10-30).
|
|
3555
|
+
* The read goes newest ownership first, so what it leaves out is what the role has owned longest. */
|
|
3556
|
+
capped: (records) => `Read stopped at ${records} records; the tasks this role has owned longest are not listed.`,
|
|
3557
|
+
/** The read's refusal when no role is named and the session acts in none; each surface adds noRole with its own command. */
|
|
3558
|
+
noSessionRole: "This session acts in no role.",
|
|
3559
|
+
noRole: (command) => `Name the role: ${command}`,
|
|
3560
|
+
/** A cursor that is not a page number; the CLI refuses it rather than reading page 1. */
|
|
3561
|
+
badCursor: (value) => `Cursor ${value} is not a page number. Use the number the last page printed.`
|
|
3562
|
+
};
|
|
3563
|
+
function openTaskCommand(surface, input = {}) {
|
|
3564
|
+
if (surface === "cli") {
|
|
3565
|
+
return `${OPEN_TASK_LIST_WORDS.allCommand.cli}${input.role ? ` --role ${input.role}` : ""}${input.cursor !== void 0 ? ` --cursor ${input.cursor}` : ""}`;
|
|
3566
|
+
}
|
|
3567
|
+
const bare = OPEN_TASK_LIST_WORDS.allCommand.mcp.slice(1, -1);
|
|
3568
|
+
return `${bare}${input.role ? ` roleId=${input.role}` : ""}${input.cursor !== void 0 ? ` cursor=${input.cursor}` : ""}`;
|
|
3569
|
+
}
|
|
3570
|
+
function openTaskRowText(row) {
|
|
3571
|
+
const w = OPEN_TASK_LIST_WORDS;
|
|
3572
|
+
const marks = [row.inProgress && w.inProgress, row.noOwner && w.noOwner, row.packageClosed && w.packageClosed].filter(Boolean);
|
|
3573
|
+
return `${priorityWord(row.priority)}${w.separator}${row.entryId} \u2014 ${row.name}${marks.map((m) => ` ${m}`).join("")}`;
|
|
3574
|
+
}
|
|
3575
|
+
function openTaskListLines(list, surface) {
|
|
3576
|
+
const shown = Math.min(surface.shown ?? list.rows.length, list.rows.length);
|
|
3577
|
+
const lines = list.rows.slice(0, shown).map((row) => `${surface.bullet}${openTaskRowText(row)}`);
|
|
3578
|
+
const allCommand = surface.surface === "cli" ? OPEN_TASK_LIST_WORDS.allCommand.cli : OPEN_TASK_LIST_WORDS.allCommand.mcp;
|
|
3579
|
+
if (list.rows.length > shown) lines.push(OPEN_TASK_LIST_WORDS.more(list.rows.length - shown, list.capped, allCommand));
|
|
3580
|
+
if (list.capped) lines.push(OPEN_TASK_LIST_WORDS.capped(list.cappedAt ?? list.rows.length));
|
|
3581
|
+
return lines;
|
|
3582
|
+
}
|
|
3538
3583
|
|
|
3539
3584
|
// src/tools/documents.ts
|
|
3540
3585
|
import { z as z15 } from "zod/v3";
|
|
@@ -4361,16 +4406,46 @@ function registerRoleTools(server) {
|
|
|
4361
4406
|
);
|
|
4362
4407
|
}
|
|
4363
4408
|
|
|
4409
|
+
// src/tools/openTasks.ts
|
|
4410
|
+
function formatOpenTasks(page, roleId) {
|
|
4411
|
+
const s = sanitizeSingleLineField;
|
|
4412
|
+
const roleName = s(page.role.name);
|
|
4413
|
+
if (page.total === 0 && !page.capped) return OPEN_TASK_LIST_WORDS.empty(roleName);
|
|
4414
|
+
const rows = page.rows.map((row) => ({ ...row, name: s(row.name), entryId: s(row.entryId) }));
|
|
4415
|
+
const lines = [`## ${OPEN_TASK_LIST_WORDS.heading(roleName)}`, ...openTaskListLines({ ...page, rows }, { bullet: "- ", surface: "mcp" })];
|
|
4416
|
+
if (page.nextCursor !== null) {
|
|
4417
|
+
lines.push(OPEN_TASK_LIST_WORDS.nextPage(`\`${openTaskCommand("mcp", { ...roleId ? { role: s(roleId) } : {}, cursor: page.nextCursor })}\``));
|
|
4418
|
+
}
|
|
4419
|
+
return lines.join("\n");
|
|
4420
|
+
}
|
|
4421
|
+
async function handleOpenTasks(roleId, cursor) {
|
|
4422
|
+
const sessionId = getAgentSessionId();
|
|
4423
|
+
try {
|
|
4424
|
+
const page = await kernelQuery("chain.listOpenTasks", {
|
|
4425
|
+
...roleId ? { roleId } : {},
|
|
4426
|
+
...sessionId ? { sessionId } : {},
|
|
4427
|
+
...cursor !== void 0 ? { cursor } : {}
|
|
4428
|
+
});
|
|
4429
|
+
const message = formatOpenTasks(page, roleId);
|
|
4430
|
+
return successResult(message, message, page);
|
|
4431
|
+
} catch (err) {
|
|
4432
|
+
const classified = classifyError(err);
|
|
4433
|
+
const noRole = classified.message.includes(OPEN_TASK_LIST_WORDS.noSessionRole);
|
|
4434
|
+
const recovery = noRole ? OPEN_TASK_LIST_WORDS.noRole(openTaskCommand("mcp", { role: "<ROL-n>" })) : classified.recovery;
|
|
4435
|
+
return failureResult(errorText({ message: classified.message, recovery }), classified.code, classified.message, recovery);
|
|
4436
|
+
}
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4364
4439
|
// src/tools/contextLookups.ts
|
|
4365
|
-
var LOOKUP_ACTIONS = ["get", "batch", "history", "list", "search", "find", "people", "outcome", "readings", "accountable", "preflight"];
|
|
4440
|
+
var LOOKUP_ACTIONS = ["get", "batch", "history", "list", "search", "find", "people", "outcome", "readings", "accountable", "tasks", "preflight"];
|
|
4366
4441
|
var statusFilterSchema = z20.union([z20.string().max(200), z20.array(z20.enum(ENTRY_STATUS_READ_WORDS)).max(5)]);
|
|
4367
4442
|
var preflightLinks = z20.array(z20.object({ type: z20.string().max(200), entryId: z20.string().max(200) })).max(50).optional();
|
|
4368
|
-
var LOOKUP_ACTION_DESCRIBE = `'get': one entry in full by ID. 'batch': up to 20 entries by ID. 'history': audit trail for an entry. 'list': browse entries with filters (${TRUST_STATUS_LABELS.current.toLowerCase()} entries by default). 'search': full-text search across entries. 'find': an entry's direct relations (direction
|
|
4443
|
+
var LOOKUP_ACTION_DESCRIBE = `'get': one entry in full by ID. 'batch': up to 20 entries by ID. 'history': audit trail for an entry. 'list': browse entries with filters (${TRUST_STATUS_LABELS.current.toLowerCase()} entries by default). 'search': full-text search across entries. 'find': an entry's direct relations (see direction). 'people': the workspace's members with name, email and status. 'outcome': a key result's derived view, its objective and sibling key results. 'readings': its readings, newest first. 'accountable': what a role owns and who holds it. 'tasks': your role's open tasks outside a package, or roleId's. 'preflight': a collection's requirements. `;
|
|
4369
4444
|
var LOOKUP_TOOL_LINES = "- **get**: Fetch a single entry by ID \u2014 full record with data, labels, relations, history.\n- **batch**: Fetch multiple entries (max 20) in one call. Same shape as get per entry.\n- **history**: Audit trail for an entry.\n- **list**: Browse entries with optional filters (collection, status, tag, label). Use collections action=list first to discover slugs.\n- **search**: Full-text search across entries. Scope by collection or filter by status.\n- **find**: An entry's direct relations, incoming and outgoing. NOT full-text search (use search).\n- **people**: The workspace's members: name, email, status, role. Max 200.\n- **outcome**: A key result's derived view (current, progress, pace, staleness, recorded completion) with its objective and up to 5 sibling key results.\n- **readings**: A key result's readings, newest first; superseded rows are marked with their replacement. Record one with `outcome action=record`.\n- **accountable**: What a role owns, reports on, and who holds it.\n- **preflight**: What an entry in a collection needs before you compose it. Saves nothing.\n";
|
|
4370
4445
|
var lookupParams = {
|
|
4371
|
-
entryIds: z20.array(z20.string().max(200)).min(1).max(20).optional().describe("For 'batch': entry IDs
|
|
4446
|
+
entryIds: z20.array(z20.string().max(200)).min(1).max(20).optional().describe("For 'batch': entry IDs."),
|
|
4372
4447
|
collection: z20.string().max(200).optional().describe("For 'list'/'search': collection slug, e.g. 'glossary', 'tracking-events'. Required for 'preflight'."),
|
|
4373
|
-
query: z20.string().min(2).max(500).optional().describe("For 'search': search text
|
|
4448
|
+
query: z20.string().min(2).max(500).optional().describe("For 'search': search text."),
|
|
4374
4449
|
// 'active'/'accepted'/'current' are the same trust level (DEC-1575/DEC-1788) — all enumerated, never one substituted.
|
|
4375
4450
|
status: statusFilterSchema.optional().describe(
|
|
4376
4451
|
`For 'list': defaults to ${TRUST_STATUS_LABELS.current.toLowerCase()} entries (active/accepted/current); use status='draft' to discover drafts. One lifecycle or category value (${ENTRY_STATUS_READ_WORDS.join("|")}). For 'search': one value OR an array of up to 5 (e.g. ['active','accepted']).`
|
|
@@ -4378,9 +4453,9 @@ var lookupParams = {
|
|
|
4378
4453
|
tag: z20.string().max(200).optional().describe("For 'list': filter by internal tag."),
|
|
4379
4454
|
label: z20.string().max(200).optional().describe("For 'list': filter by label slug \u2014 matches entries across all collections."),
|
|
4380
4455
|
limit: z20.number().int().positive().max(200).optional().describe("For 'readings'/'accountable': max rows (default and maximum 200)."),
|
|
4381
|
-
roleId: z20.string().max(200).optional().describe("For 'accountable': the role's id
|
|
4456
|
+
roleId: z20.string().max(200).optional().describe("For 'accountable' (required) and 'tasks': the role's id."),
|
|
4382
4457
|
canonicalKey: z20.string().max(200).optional().describe("For 'accountable'/'preflight': one kind, e.g. tension."),
|
|
4383
|
-
cursor: z20.number().optional().describe("For 'accountable': nextCursor of an earlier page."),
|
|
4458
|
+
cursor: z20.number().optional().describe("For 'accountable'/'tasks': nextCursor of an earlier page."),
|
|
4384
4459
|
links: preflightLinks.describe("For 'preflight': proposed links.")
|
|
4385
4460
|
};
|
|
4386
4461
|
var lookupVariants = [
|
|
@@ -4416,6 +4491,7 @@ var lookupVariants = [
|
|
|
4416
4491
|
limit: z20.number().int().positive().max(200).optional(),
|
|
4417
4492
|
cursor: z20.number().optional()
|
|
4418
4493
|
}),
|
|
4494
|
+
z20.object({ action: z20.literal("tasks"), roleId: z20.string().max(200).optional(), cursor: z20.number().int().nonnegative().optional() }),
|
|
4419
4495
|
z20.object({
|
|
4420
4496
|
action: z20.literal("preflight"),
|
|
4421
4497
|
collection: z20.string().max(200),
|
|
@@ -4437,6 +4513,7 @@ var LOOKUP_ACTION_SPECS = {
|
|
|
4437
4513
|
outcome: { params: ["entryId"], description: "entryId is required." },
|
|
4438
4514
|
readings: { params: ["entryId", "limit"], description: "entryId is required; limit is optional." },
|
|
4439
4515
|
accountable: { params: ["roleId", "canonicalKey", "limit", "cursor"], description: "roleId is required; canonicalKey/limit/cursor are optional." },
|
|
4516
|
+
tasks: { params: ["roleId", "cursor"], description: "Both optional: roleId names another role, cursor continues a page." },
|
|
4440
4517
|
preflight: { params: ["collection", "canonicalKey", "links"], description: "collection is required; saves nothing." }
|
|
4441
4518
|
};
|
|
4442
4519
|
function lookupHandlers(server) {
|
|
@@ -4454,6 +4531,8 @@ function lookupHandlers(server) {
|
|
|
4454
4531
|
readings: (data) => handleOutcomeList(data.entryId, data.limit),
|
|
4455
4532
|
accountable: (data) => handleRoleAccountable(data.roleId, data.canonicalKey, data.limit, data.cursor),
|
|
4456
4533
|
// DEC-1894 step 2 (TASK-1004)
|
|
4534
|
+
tasks: (data) => handleOpenTasks(data.roleId, data.cursor),
|
|
4535
|
+
// DEC-2459
|
|
4457
4536
|
preflight: (data) => handleEntryPreflight(data.collection, data.canonicalKey, data.links)
|
|
4458
4537
|
};
|
|
4459
4538
|
}
|
|
@@ -12047,4 +12126,4 @@ export {
|
|
|
12047
12126
|
SERVER_VERSION,
|
|
12048
12127
|
createProductBrainServer
|
|
12049
12128
|
};
|
|
12050
|
-
//# sourceMappingURL=chunk-
|
|
12129
|
+
//# sourceMappingURL=chunk-ORWPRGU4.js.map
|