@productbrain/mcp 0.0.1-beta.13401 → 0.0.1-beta.13404

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.
@@ -3574,12 +3574,22 @@ function openTaskRowText(row) {
3574
3574
  }
3575
3575
  function openTaskListLines(list, surface) {
3576
3576
  const shown = Math.min(surface.shown ?? list.rows.length, list.rows.length);
3577
+ const total = surface.total ?? list.rows.length;
3577
3578
  const lines = list.rows.slice(0, shown).map((row) => `${surface.bullet}${openTaskRowText(row)}`);
3578
3579
  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));
3580
+ if (total > shown) lines.push(OPEN_TASK_LIST_WORDS.more(total - shown, list.capped, allCommand));
3581
+ if (list.capped) lines.push(OPEN_TASK_LIST_WORDS.capped(list.cappedAt ?? total));
3581
3582
  return lines;
3582
3583
  }
3584
+ function openTaskSectionLines(list, surface) {
3585
+ if (!list || list.total === 0 && !list.capped) return [];
3586
+ const rows = openTaskListLines(list, { bullet: surface.bullet, surface: surface.surface, shown: OPEN_TASK_LIST_WORDS.shown, total: list.total });
3587
+ return [surface.heading(OPEN_TASK_LIST_WORDS.heading(list.role.name)), ...rows];
3588
+ }
3589
+ function openTaskCompactLines(list) {
3590
+ if (!list || list.total === 0 && !list.capped) return [];
3591
+ return [OPEN_TASK_LIST_WORDS.compact(list.total, list.capped, list.role.name)];
3592
+ }
3583
3593
 
3584
3594
  // src/tools/documents.ts
3585
3595
  import { z as z15 } from "zod/v3";
@@ -6206,9 +6216,20 @@ import { z as z24 } from "zod/v3";
6206
6216
 
6207
6217
  // src/tools/planned-work.ts
6208
6218
  var MORE_DRAFTS_LINE = "_More drafts exist than shown. `context action=list status=draft` lists more, but that list is capped as well; page with limit/cursor once context list supports it._";
6209
- var NO_PLANNED_WORK = { uncommittedDrafts: [], inProgressEntries: [], openTensions: [] };
6219
+ var NO_PLANNED_WORK = { uncommittedDrafts: [], openTensions: [] };
6220
+ function cleanOpenTasks(list) {
6221
+ const s = sanitizeSingleLineField;
6222
+ 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) })) };
6223
+ }
6224
+ function buildOpenTaskSection(work) {
6225
+ const lines = openTaskSectionLines(cleanOpenTasks(work.openTasks), { heading: (text) => `## ${text}`, bullet: "- ", surface: "mcp" });
6226
+ return lines.length > 0 ? [...lines, ""] : [];
6227
+ }
6228
+ function openTaskCountLines(work) {
6229
+ return openTaskCompactLines(cleanOpenTasks(work.openTasks));
6230
+ }
6210
6231
  function hasPlannedWork(work) {
6211
- return work.uncommittedDrafts.length > 0 || work.inProgressEntries.length > 0 || work.openTensions.length > 0;
6232
+ return work.uncommittedDrafts.length > 0 || work.openTensions.length > 0;
6212
6233
  }
6213
6234
  function formatRecoveryBlock(block) {
6214
6235
  const fmt = (items, overflow) => items.map((e) => `${e.entryId} [${e.collection}] ${e.name}`).join(", ") + (overflow && overflow > 0 ? ` (+${overflow} more)` : "");
@@ -6229,16 +6250,6 @@ function buildPlannedWorkSection(work, priorSessions, recoveryBlock) {
6229
6250
  const lines = [];
6230
6251
  lines.push("## Continue from where you left off");
6231
6252
  lines.push("");
6232
- if (work.inProgressEntries.length > 0) {
6233
- const top = work.inProgressEntries[0];
6234
- lines.push(`- **Active: ${top.name}** (${top.collection}) \u2014 want to continue?`);
6235
- for (const entry of work.inProgressEntries.slice(1, 3)) {
6236
- lines.push(`- ${entry.name} (${entry.collection})`);
6237
- }
6238
- const total = work.inProgressEntries.length;
6239
- if (work.inProgressTruncated) lines.push(`- _...and ${total - 3}+ more in progress (${total}+ in all)_`);
6240
- else if (total > 3) lines.push(`- _...and ${total - 3} more in progress_`);
6241
- }
6242
6253
  if (work.uncommittedDrafts.length > 0) {
6243
6254
  const count = work.uncommittedDrafts.length;
6244
6255
  const label = `${work.draftsTruncated ? `${count}+` : count} draft(s) of yours pending`;
@@ -7300,7 +7311,7 @@ async function _handleOrient({ mode: mode2 = "full", tier, task, startupSignals,
7300
7311
  ...(e.linkedTensions ?? []).map((t) => ` ${WORK_PACKAGE_LIST_WORDS.tension(t)}`)
7301
7312
  ]
7302
7313
  // DEC-2445: no origin tag; tensions by id
7303
- }));
7314
+ }), ...openTaskCountLines(orientView?.plannedWork ?? NO_PLANNED_WORK));
7304
7315
  if (orientView?.trustMetrics) {
7305
7316
  const tm = orientView.trustMetrics;
7306
7317
  if (tm.unverified > 0 || tm.verified > 0) {
@@ -7570,9 +7581,9 @@ async function _handleOrient({ mode: mode2 = "full", tier, task, startupSignals,
7570
7581
  allCommand: WORK_PACKAGE_LIST_WORDS.allCommand.mcp,
7571
7582
  row: (e, mark) => [fmt({ ...e, origin: void 0 }, mark), ...(e.linkedTensions ?? []).map((t) => ` ${WORK_PACKAGE_LIST_WORDS.tension(t)}`)]
7572
7583
  // DEC-2445
7573
- }));
7574
- lines.push("");
7584
+ }), "");
7575
7585
  }
7586
+ lines.push(...buildOpenTaskSection(orientView.plannedWork ?? NO_PLANNED_WORK));
7576
7587
  const fullActiveGoals = orientView.activeGoals ?? [];
7577
7588
  if (fullActiveGoals.length > 0) {
7578
7589
  lines.push("## Active goals");
@@ -7625,11 +7636,10 @@ async function _handleOrient({ mode: mode2 = "full", tier, task, startupSignals,
7625
7636
  lines.push("## Active work packages \u2014 current scope");
7626
7637
  lines.push("_Work outside these work packages requires explicit user confirmation._");
7627
7638
  lines.push("");
7628
- for (const e of orientView.activeWorkPackages) {
7629
- lines.push(fmt(e));
7630
- }
7639
+ for (const e of orientView.activeWorkPackages) lines.push(fmt(e));
7631
7640
  lines.push("");
7632
7641
  }
7642
+ lines.push(...buildOpenTaskSection(orientView?.plannedWork ?? NO_PLANNED_WORK));
7633
7643
  lines.push(...formatInitiativeStatusLines(orientView?.initiativeStatus));
7634
7644
  lines.push(...formatWorkstreamHealthLines(orientView?.workstreamHealth));
7635
7645
  lines.push(...formatWhatNeedsAttentionLines(orientView?.whatNeedsAttention));
@@ -12126,4 +12136,4 @@ export {
12126
12136
  SERVER_VERSION,
12127
12137
  createProductBrainServer
12128
12138
  };
12129
- //# sourceMappingURL=chunk-RCA7LAMZ.js.map
12139
+ //# sourceMappingURL=chunk-TLIDUU5X.js.map