@productbrain/mcp 0.0.1-beta.15376 → 0.0.1-beta.15393
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.
|
@@ -3829,6 +3829,37 @@ function openTaskCompactLines(list) {
|
|
|
3829
3829
|
if (!list || list.total === 0 && !list.capped) return [];
|
|
3830
3830
|
return [OPEN_TASK_LIST_WORDS.compact(list.total, list.capped, list.role.name)];
|
|
3831
3831
|
}
|
|
3832
|
+
var nameWithId = (entry) => `${entry.name}${entry.entryId ? ` (${entry.entryId})` : ""}`;
|
|
3833
|
+
var TASKS_UNDER_WORDS = {
|
|
3834
|
+
heading: (parent) => `Tasks under ${nameWithId(parent)}`,
|
|
3835
|
+
count: (total, statusCounts) => `${total} task${total === 1 ? "" : "s"}: ${statusCounts.map((s) => `${s.count} ${entryStatusLabel(s.status)}`).join(", ")}.`,
|
|
3836
|
+
empty: (parent) => `No task is part of ${nameWithId(parent)}.`,
|
|
3837
|
+
/** A floor ("3+") only when the count stopped at its own bound; past the list it still counts what the viewer may read. */
|
|
3838
|
+
notTasks: (count, atLeast = false) => `${count}${atLeast ? "+" : ""} other linked ${count === 1 && !atLeast ? "entry is not a task" : "entries are not tasks"}.`,
|
|
3839
|
+
/** Links come back oldest first, so what the list leaves out is the most recently linked; only tasks the viewer may read count. */
|
|
3840
|
+
cut: ({ unread, atLeast }) => atLeast ? unread === 0 ? "The read stopped early; recently linked tasks may not be listed." : `At least ${unread} of the most recently linked tasks are not listed.` : unread === 1 ? "The most recently linked task is not listed." : `The ${unread} most recently linked tasks are not listed.`,
|
|
3841
|
+
/** The cut's second sentence: the CLI's constellation reads every part_of link whole; no MCP read does yet. */
|
|
3842
|
+
cutStep: { cli: (entryId) => `Every task under it, by name: pb constellation ${entryId}`, mcp: "No MCP read lists them all yet; pb constellation does." },
|
|
3843
|
+
/** The read's refusal when an entry is named with a role or a page: the entry's list is one whole read. Each surface adds aloneFix. */
|
|
3844
|
+
alone: "A task list by entry takes no role and no cursor.",
|
|
3845
|
+
aloneFix: (command) => `List it without them: ${command}`
|
|
3846
|
+
};
|
|
3847
|
+
function taskUnderRowText(row) {
|
|
3848
|
+
const sep = OPEN_TASK_LIST_WORDS.separator, ticks = WORK_PACKAGE_LIST_WORDS.ticks(row.doneWhen.ticked, row.doneWhen.total);
|
|
3849
|
+
return `${row.entryId} \u2014 ${row.name}${sep}${entryStatusLabel(row.status)}${sep}${ticks}${row.due ? `${sep}${taskDueMark(row.due)}` : ""}`;
|
|
3850
|
+
}
|
|
3851
|
+
function tasksUnderLines(list, surface) {
|
|
3852
|
+
const w = TASKS_UNDER_WORDS, id = list.parent.entryId ?? list.parent.name;
|
|
3853
|
+
const step = surface.surface === "cli" ? w.cutStep.cli(id) : w.cutStep.mcp;
|
|
3854
|
+
const lead = list.rows.length > 0 ? [w.count(list.rows.length, list.statusCounts)] : list.cut ? [] : [w.empty(list.parent)];
|
|
3855
|
+
return [
|
|
3856
|
+
surface.heading(w.heading(list.parent)),
|
|
3857
|
+
...lead,
|
|
3858
|
+
...list.rows.map((row) => `${surface.bullet}${taskUnderRowText(row)}`),
|
|
3859
|
+
...list.notTasks > 0 ? [w.notTasks(list.notTasks, list.cut?.atLeast)] : [],
|
|
3860
|
+
...list.cut ? [`${w.cut(list.cut)} ${step}`] : []
|
|
3861
|
+
];
|
|
3862
|
+
}
|
|
3832
3863
|
|
|
3833
3864
|
// src/tools/contextLookups.ts
|
|
3834
3865
|
import { z as z19 } from "zod/v3";
|
|
@@ -4696,9 +4727,24 @@ function formatOpenTasks(page, roleId) {
|
|
|
4696
4727
|
}
|
|
4697
4728
|
return lines.join("\n");
|
|
4698
4729
|
}
|
|
4699
|
-
|
|
4730
|
+
function formatTasksUnder(list) {
|
|
4731
|
+
const s = sanitizeSingleLineField;
|
|
4732
|
+
const parent = { entryId: list.parent.entryId === null ? null : s(list.parent.entryId), name: s(list.parent.name) };
|
|
4733
|
+
const rows = list.rows.map((row) => ({ ...row, entryId: s(row.entryId), name: s(row.name), status: s(row.status) }));
|
|
4734
|
+
return tasksUnderLines({ ...list, parent, rows }, { heading: (text) => `## ${text}`, bullet: "- ", surface: "mcp" }).join("\n");
|
|
4735
|
+
}
|
|
4736
|
+
async function handleOpenTasks(roleId, cursor, entryId) {
|
|
4700
4737
|
const sessionId = getAgentSessionId();
|
|
4701
4738
|
try {
|
|
4739
|
+
if (entryId !== void 0) {
|
|
4740
|
+
const list = await kernelQuery("chain.listOpenTasks", {
|
|
4741
|
+
under: entryId,
|
|
4742
|
+
...roleId ? { roleId } : {},
|
|
4743
|
+
...cursor !== void 0 ? { cursor } : {}
|
|
4744
|
+
});
|
|
4745
|
+
const text = formatTasksUnder(list);
|
|
4746
|
+
return successResult(text, text, list);
|
|
4747
|
+
}
|
|
4702
4748
|
const page = await kernelQuery("chain.listOpenTasks", {
|
|
4703
4749
|
...roleId ? { roleId } : {},
|
|
4704
4750
|
...sessionId ? { sessionId } : {},
|
|
@@ -4709,7 +4755,8 @@ async function handleOpenTasks(roleId, cursor) {
|
|
|
4709
4755
|
} catch (err) {
|
|
4710
4756
|
const classified = classifyError(err);
|
|
4711
4757
|
const noRole = classified.message.includes(OPEN_TASK_LIST_WORDS.noSessionRole);
|
|
4712
|
-
const
|
|
4758
|
+
const alone = entryId !== void 0 && classified.message.includes(TASKS_UNDER_WORDS.alone);
|
|
4759
|
+
const recovery = noRole ? OPEN_TASK_LIST_WORDS.noRole(openTaskCommand("mcp", { role: "<ROL-n>" })) : alone ? TASKS_UNDER_WORDS.aloneFix(`context action=tasks entryId=${sanitizeSingleLineField(entryId)}`) : classified.recovery;
|
|
4713
4760
|
return failureResult(errorText({ message: classified.message, recovery }), classified.code, classified.message, recovery);
|
|
4714
4761
|
}
|
|
4715
4762
|
}
|
|
@@ -4718,7 +4765,7 @@ async function handleOpenTasks(roleId, cursor) {
|
|
|
4718
4765
|
var LOOKUP_ACTIONS = ["get", "batch", "history", "list", "search", "find", "people", "outcome", "readings", "accountable", "tasks", "preflight"];
|
|
4719
4766
|
var statusFilterSchema = z19.union([z19.string().max(200), z19.array(z19.enum(ENTRY_STATUS_READ_WORDS)).max(5)]);
|
|
4720
4767
|
var preflightLinks = z19.array(z19.object({ type: z19.string().max(200), entryId: z19.string().max(200) })).max(50).optional();
|
|
4721
|
-
var LOOKUP_ACTION_DESCRIBE = `'get': entries in full by ID (entryIds: up to 20, one call). 'batch': get with entryIds. '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 view with its objective and siblings. 'readings': its readings, newest first. 'accountable': a role's work and holders. 'tasks': your role's
|
|
4768
|
+
var LOOKUP_ACTION_DESCRIBE = `'get': entries in full by ID (entryIds: up to 20, one call). 'batch': get with entryIds. '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 view with its objective and siblings. 'readings': its readings, newest first. 'accountable': a role's work and holders. 'tasks': your role's due tasks, then those in no live package, or roleId's; entryId: every task under it. 'preflight': a collection's requirements. `;
|
|
4722
4769
|
var LOOKUP_TOOL_LINES = "- **get**: Full entries by ID: data, labels, relations, history. entryIds reads up to 20 in one call.\n- **batch**: get with entryIds.\n- **history**: Audit trail for an entry.\n- **list**: Browse entries by collection, status, tag or label; collections action=list names the slugs.\n- **search**: Full-text search; scope by collection or status.\n- **find**: An entry's direct relations, both ways; not text 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, completion), its objective and up to 5 sibling key results.\n- **readings**: A key result's readings, newest first; a replaced row names its replacement. Record with `outcome action=record`.\n- **accountable**: What a role owns, reports on, and who holds it; no roleId: every seat.\n- **preflight**: What an entry in a collection needs; saves nothing.\n";
|
|
4723
4770
|
var lookupParams = {
|
|
4724
4771
|
entryIds: z19.array(z19.string().max(200)).min(1).max(20).optional().describe("For 'get'/'batch': up to 20 entry IDs, one call."),
|
|
@@ -4769,7 +4816,7 @@ var lookupVariants = [
|
|
|
4769
4816
|
limit: z19.number().int().positive().max(200).optional(),
|
|
4770
4817
|
cursor: z19.number().optional()
|
|
4771
4818
|
}),
|
|
4772
|
-
z19.object({ action: z19.literal("tasks"), roleId: z19.string().max(200).optional(), cursor: z19.number().int().nonnegative().optional() }),
|
|
4819
|
+
z19.object({ action: z19.literal("tasks"), roleId: z19.string().max(200).optional(), cursor: z19.number().int().nonnegative().optional(), entryId: z19.string().max(200).optional() }),
|
|
4773
4820
|
z19.object({
|
|
4774
4821
|
action: z19.literal("preflight"),
|
|
4775
4822
|
collection: z19.string().max(200),
|
|
@@ -4791,7 +4838,7 @@ var LOOKUP_ACTION_SPECS = {
|
|
|
4791
4838
|
outcome: { params: ["entryId"], description: "entryId is required." },
|
|
4792
4839
|
readings: { params: ["entryId", "limit"], description: "entryId is required; limit is optional." },
|
|
4793
4840
|
accountable: { params: ["roleId", "canonicalKey", "limit", "cursor"], description: "No roleId: every seat. canonicalKey/limit/cursor need one." },
|
|
4794
|
-
tasks: { params: ["roleId", "cursor"], description: "
|
|
4841
|
+
tasks: { params: ["roleId", "cursor", "entryId"], description: "All optional: roleId names another role, cursor continues a page, entryId lists an entry's tasks." },
|
|
4795
4842
|
preflight: { params: ["collection", "canonicalKey", "links"], description: "collection is required; saves nothing." }
|
|
4796
4843
|
};
|
|
4797
4844
|
function lookupHandlers(server) {
|
|
@@ -4809,8 +4856,8 @@ function lookupHandlers(server) {
|
|
|
4809
4856
|
readings: (data) => handleOutcomeList(data.entryId, data.limit),
|
|
4810
4857
|
// DEC-1894 step 2 (TASK-1004); TASK-1447: no roleId is the seats roster, and then canonicalKey, limit and cursor have nothing to narrow
|
|
4811
4858
|
accountable: (data) => data.roleId !== void 0 ? handleRoleAccountable(data.roleId, data.canonicalKey, data.limit, data.cursor) : [data.canonicalKey, data.limit, data.cursor].some((v) => v !== void 0) ? Promise.resolve(backpressureResult("context", "accountable", LOOKUP_ACTION_SPECS.accountable, "canonicalKey, limit and cursor need a roleId.")) : handleSeatRoster(),
|
|
4812
|
-
tasks: (data) => handleOpenTasks(data.roleId, data.cursor),
|
|
4813
|
-
// DEC-2459
|
|
4859
|
+
tasks: (data) => handleOpenTasks(data.roleId, data.cursor, data.entryId),
|
|
4860
|
+
// DEC-2459; TASK-1873: entryId lists every task part_of it
|
|
4814
4861
|
preflight: (data) => handleEntryPreflight(data.collection, data.canonicalKey, data.links)
|
|
4815
4862
|
};
|
|
4816
4863
|
}
|
|
@@ -12550,4 +12597,4 @@ export {
|
|
|
12550
12597
|
SERVER_VERSION,
|
|
12551
12598
|
createProductBrainServer
|
|
12552
12599
|
};
|
|
12553
|
-
//# sourceMappingURL=chunk-
|
|
12600
|
+
//# sourceMappingURL=chunk-UFCXOQ5X.js.map
|