@productbrain/mcp 0.0.1-beta.15973 → 0.0.1-beta.15989

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.
@@ -3792,20 +3792,25 @@ function liveWorkPackageLines(rows, surface, now) {
3792
3792
  row: (row) => [`${surface.bullet}${liveWorkPackageRowText(row, now)}`]
3793
3793
  });
3794
3794
  }
3795
+ var inTeam = (team) => team ? ` in ${team}` : "";
3795
3796
  var OPEN_TASK_LIST_WORDS = {
3796
- heading: (roleName) => `${roleName}'s open tasks: due ones first, then those in no live work package`,
3797
+ heading: (roleName, team) => `${roleName}'s open tasks${inTeam(team)}`,
3797
3798
  separator: " \xB7 ",
3798
- inProgress: "(in progress)",
3799
3799
  noOwner: "(no owner)",
3800
3800
  /** After a task whose package parents are all done or archived, so the agent finishes it or closes it (Product Design 2026-10-30). */
3801
3801
  packageClosed: "(its package is closed)",
3802
+ under: (pkg) => `under ${pkg.name} (${pkg.entryId})`,
3803
+ /** Two or more rows share a level: nothing orders them inside it (DEC-2416). */
3804
+ tied: (levels) => `Tasks not ranked inside ${levels.join(" or ")}.`,
3802
3805
  /** Orient shows at most this many rows; the cut note names the command for the rest. */
3803
3806
  shown: 5,
3804
- more: (hidden, capped, allCommand) => `${hidden}${capped ? "+" : ""} more: ${allCommand}`,
3807
+ more: (shown, total, capped, allCommand) => `Showing ${shown} of ${total}${capped ? "+" : ""}. The rest: ${allCommand}`,
3805
3808
  allCommand: { cli: "pb tasks list", mcp: "`context action=tasks`" },
3806
- compact: (count, capped, roleName) => `${count}${capped ? "+" : ""} open task(s) of ${roleName}: due ones first, then those in no live work package`,
3809
+ compact: (count, capped, roleName, team, planned = 0) => `${count}${capped ? "+" : ""} open task(s) of ${roleName}${inTeam(team)}${planned > 0 ? `; ${planned}${capped ? "+" : ""} more under planned packages` : ""}`,
3807
3810
  /** Only for a read that was not cut: a capped read that found none prints its capped line instead, never this. */
3808
- empty: (roleName) => `${roleName} has no due tasks and no open tasks outside a live work package.`,
3811
+ empty: (roleName, team) => `${roleName} has no open tasks to list${inTeam(team)}.`,
3812
+ /** Tasks whose only live packages are planned (DEC-2459 as amended 2026-11-16): said as a number, never left out in silence. */
3813
+ underPlanned: (count, capped) => `${count}${capped ? "+" : ""} more under planned packages: counted, not listed.`,
3809
3814
  /** The tasks list's last line when another page follows. */
3810
3815
  nextPage: (command) => `More: ${command}`,
3811
3816
  /** Printed whenever the read stopped at its cap, so rows it never read are not taken for none (signed by Voice, 2026-10-30).
@@ -3825,24 +3830,29 @@ function openTaskCommand(surface, input = {}) {
3825
3830
  return `${bare}${input.role ? ` roleId=${input.role}` : ""}${input.cursor !== void 0 ? ` cursor=${input.cursor}` : ""}`;
3826
3831
  }
3827
3832
  function openTaskRowText(row) {
3828
- const w = OPEN_TASK_LIST_WORDS;
3829
- const marks = [row.inProgress && w.inProgress, row.noOwner && w.noOwner, row.packageClosed && w.packageClosed].filter(Boolean);
3830
- return `${priorityWord(row.priority)}${w.separator}${row.entryId} \u2014 ${row.name}${marks.map((m) => ` ${m}`).join("")}${row.due ? `${w.separator}${taskDueMark(row.due)}` : ""}`;
3833
+ const w = OPEN_TASK_LIST_WORDS, t = row.doneWhen ?? { ticked: 0, total: 0 };
3834
+ const marks = [row.noOwner && w.noOwner, row.packageClosed && w.packageClosed].filter(Boolean).map((m) => ` ${m}`).join("");
3835
+ const parts = [entryStatusLabel(row.inProgress ? "in_progress" : "open"), WORK_PACKAGE_LIST_WORDS.ticks(t.ticked, t.total), row.due && taskDueMark(row.due), row.under && w.under(row.under)];
3836
+ return `${priorityWord(row.priority)}${w.separator}${row.entryId} \u2014 ${row.name}${marks}${parts.filter(Boolean).map((p) => `${w.separator}${p}`).join("")}`;
3831
3837
  }
3832
3838
  function openTaskListLines(list, surface) {
3833
- const shown = Math.min(surface.shown ?? list.rows.length, list.rows.length);
3839
+ const w = OPEN_TASK_LIST_WORDS, shown = Math.min(surface.shown ?? list.rows.length, list.rows.length), rows = list.rows.slice(0, shown);
3834
3840
  const total = surface.total ?? list.rows.length;
3835
3841
  const due = list.dueCounts && total > 0 ? [TASK_DUE_WORDS.counts(list.dueCounts.overdue, list.dueCounts.dueToday, list.dueCounts.read, list.capped)] : [];
3836
- const lines = [...due, ...list.rows.slice(0, shown).map((row) => `${surface.bullet}${openTaskRowText(row)}`)];
3837
- const allCommand = surface.surface === "cli" ? OPEN_TASK_LIST_WORDS.allCommand.cli : OPEN_TASK_LIST_WORDS.allCommand.mcp;
3838
- if (total > shown) lines.push(OPEN_TASK_LIST_WORDS.more(total - shown, list.capped, allCommand));
3839
- if (list.capped) lines.push(OPEN_TASK_LIST_WORDS.capped(list.cappedAt ?? total));
3842
+ const levels = [...new Set(rows.map((row) => priorityWord(row.priority)))].filter((word) => word !== NO_PRIORITY.word && rows.filter((row) => priorityWord(row.priority) === word).length > 1);
3843
+ const lines = [...due, ...rows.map((row) => `${surface.bullet}${openTaskRowText(row)}`), ...levels.length > 0 ? [w.tied(levels)] : []];
3844
+ if (total > shown) lines.push(w.more(shown, total, list.capped, w.allCommand[surface.surface]));
3845
+ if (list.underPlanned) lines.push(w.underPlanned(list.underPlanned, list.capped));
3846
+ if (list.capped) lines.push(w.capped(list.cappedAt ?? total));
3840
3847
  return lines;
3841
3848
  }
3849
+ function openTaskLead(list, heading) {
3850
+ const w = OPEN_TASK_LIST_WORDS, r = list.role.name;
3851
+ return list.rows.length > 0 ? heading(w.heading(r, list.team)) : list.total > 0 || list.capped ? w.compact(list.total, list.capped, r, list.team) : w.empty(r, list.team);
3852
+ }
3842
3853
  function openTaskSectionLines(list, surface) {
3843
- if (!list || list.total === 0 && !list.capped) return [];
3844
- const rows = openTaskListLines(list, { bullet: surface.bullet, surface: surface.surface, shown: OPEN_TASK_LIST_WORDS.shown, total: list.total });
3845
- return [surface.heading(OPEN_TASK_LIST_WORDS.heading(list.role.name)), ...rows];
3854
+ if (!list || list.total === 0 && !list.capped && !list.underPlanned) return [];
3855
+ return [openTaskLead(list, surface.heading), ...openTaskListLines(list, { bullet: surface.bullet, surface: surface.surface, shown: OPEN_TASK_LIST_WORDS.shown, total: list.total })];
3846
3856
  }
3847
3857
  var DRAFTS_MAY_BE_MORE = "there may be more";
3848
3858
  var SEAT_DRAFTS_CUT_WORDS = {
@@ -3854,9 +3864,12 @@ var SEAT_DRAFTS_CUT_WORDS = {
3854
3864
  cliNoneBrief: `no draft of yours found, ${DRAFTS_MAY_BE_MORE}`,
3855
3865
  mcpNoneLine: `No draft of yours found; ${DRAFTS_MAY_BE_MORE}.`
3856
3866
  };
3867
+ function cleanUnder(list, clean) {
3868
+ return list && { ...list, rows: list.rows.map((r) => r.under ? { ...r, under: { entryId: clean(r.under.entryId), name: clean(r.under.name) } } : r) };
3869
+ }
3857
3870
  function openTaskCompactLines(list) {
3858
- if (!list || list.total === 0 && !list.capped) return [];
3859
- return [OPEN_TASK_LIST_WORDS.compact(list.total, list.capped, list.role.name)];
3871
+ if (!list || list.total === 0 && !list.capped && !list.underPlanned) return [];
3872
+ return [OPEN_TASK_LIST_WORDS.compact(list.total, list.capped, list.role.name, list.team, list.underPlanned)];
3860
3873
  }
3861
3874
  var nameWithId = (entry) => `${entry.name}${entry.entryId ? ` (${entry.entryId})` : ""}`;
3862
3875
  var TASKS_UNDER_WORDS = {
@@ -4774,10 +4787,9 @@ Read what a role owns with \`context action=accountable\`.`,
4774
4787
  // src/tools/openTasks.ts
4775
4788
  function formatOpenTasks(page, roleId) {
4776
4789
  const s = sanitizeSingleLineField;
4777
- const roleName = s(page.role.name);
4778
- if (page.total === 0 && !page.capped) return OPEN_TASK_LIST_WORDS.empty(roleName);
4779
4790
  const rows = page.rows.map((row) => ({ ...row, name: s(row.name), entryId: s(row.entryId) }));
4780
- const lines = [`## ${OPEN_TASK_LIST_WORDS.heading(roleName)}`, ...openTaskListLines({ ...page, rows }, { bullet: "- ", surface: "mcp" })];
4791
+ const list = cleanUnder({ ...page, role: { ...page.role, name: s(page.role.name) }, ...page.team === void 0 ? {} : { team: s(page.team) }, rows }, s);
4792
+ const lines = [openTaskLead(list, (text) => `## ${text}`), ...openTaskListLines(list, { bullet: "- ", surface: "mcp" })];
4781
4793
  if (page.nextCursor !== null) {
4782
4794
  lines.push(OPEN_TASK_LIST_WORDS.nextPage(`\`${openTaskCommand("mcp", { ...roleId ? { role: s(roleId) } : {}, cursor: page.nextCursor })}\``));
4783
4795
  }
@@ -4821,7 +4833,7 @@ async function handleOpenTasks(roleId, cursor, entryId) {
4821
4833
  var LOOKUP_ACTIONS = ["get", "batch", "history", "list", "search", "find", "people", "outcome", "readings", "accountable", "tasks", "preflight"];
4822
4834
  var statusFilterSchema = z19.union([z19.string().max(200), z19.array(z19.enum(ENTRY_STATUS_READ_WORDS)).max(5)]);
4823
4835
  var preflightLinks = z19.array(z19.object({ type: z19.string().max(200), entryId: z19.string().max(200) })).max(50).optional();
4824
- var LOOKUP_ACTION_DESCRIBE = `'get': entries in full by ID (entryIds: up to 20). '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. `;
4836
+ var LOOKUP_ACTION_DESCRIBE = `'get': entries in full by ID (entryIds: up to 20). '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 seat's open tasks, or roleId's; entryId: every task under it. 'preflight': a collection's requirements. `;
4825
4837
  var LOOKUP_TOOL_LINES = "- **get**: Full entries by ID: data, labels, relations, history. entryIds reads up to 20.\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";
4826
4838
  var lookupParams = {
4827
4839
  entryIds: z19.array(z19.string().max(200)).min(1).max(20).optional().describe("For 'get'/'batch': up to 20 entry IDs."),
@@ -6516,7 +6528,9 @@ var MORE_DRAFTS_LINE = `_${SEAT_DRAFTS_CUT_WORDS.mcpLine}_`;
6516
6528
  var NO_PLANNED_WORK = { uncommittedDrafts: [], openTensions: [] };
6517
6529
  function cleanOpenTasks(list) {
6518
6530
  const s = sanitizeSingleLineField;
6519
- return list && { ...list, role: { ...list.role, name: s(list.role.name) }, rows: list.rows.map((row) => ({ ...row, name: s(row.name), entryId: s(row.entryId) })) };
6531
+ if (!list) return void 0;
6532
+ const rows = list.rows.map((row) => ({ ...row, name: s(row.name), entryId: s(row.entryId) }));
6533
+ return cleanUnder({ ...list, role: { ...list.role, name: s(list.role.name) }, ...list.team === void 0 ? {} : { team: s(list.team) }, rows }, s);
6520
6534
  }
6521
6535
  function buildOpenTaskSection(work) {
6522
6536
  const lines = openTaskSectionLines(cleanOpenTasks(work.openTasks), { heading: (text) => `## ${text}`, bullet: "- ", surface: "mcp" });
@@ -12662,4 +12676,4 @@ export {
12662
12676
  SERVER_VERSION,
12663
12677
  createProductBrainServer
12664
12678
  };
12665
- //# sourceMappingURL=chunk-LKFTMBK5.js.map
12679
+ //# sourceMappingURL=chunk-MTOMNQHG.js.map