@productbrain/mcp 0.0.1-beta.13201 → 0.0.1-beta.13220

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.
@@ -6948,6 +6948,49 @@ function formatGapOneLiner(gap) {
6948
6948
  return `Next gap: ${prompt}`;
6949
6949
  }
6950
6950
 
6951
+ // src/lib/priority.ts
6952
+ var PRIORITY_LEVELS = {
6953
+ urgent: { word: "Urgent", order: 1, linearInt: 1, icon: "alert" },
6954
+ high: { word: "High", order: 2, linearInt: 2, icon: "bars-3" },
6955
+ medium: { word: "Medium", order: 3, linearInt: 3, icon: "bars-2" },
6956
+ low: { word: "Low", order: 4, linearInt: 4, icon: "bars-1" }
6957
+ };
6958
+ var PRIORITY_TOKENS = Object.keys(PRIORITY_LEVELS);
6959
+ var NO_PRIORITY = { word: "No priority", order: 5, linearInt: 0, icon: "dashes" };
6960
+ function priorityOf(value) {
6961
+ return typeof value === "string" && Object.prototype.hasOwnProperty.call(PRIORITY_LEVELS, value) ? value : null;
6962
+ }
6963
+
6964
+ // src/lib/workPackageList.ts
6965
+ var WORK_PACKAGE_LIST_WORDS = {
6966
+ yours: "[yours]",
6967
+ count: (shown, { team, otherTeams, noSingleOwner }) => `showing ${shown} of ${team} \xB7 other teams ${otherTeams}${noSingleOwner > 0 ? ` \xB7 no single owner ${noSingleOwner}` : ""}`,
6968
+ setOne: "Set one (urgent, high, medium or low):",
6969
+ /** The command each surface prints after setOne, ending the line so it pastes whole; a live priority change asks one line of why (DEC-2418). */
6970
+ setCommand: {
6971
+ cli: 'pb update <WP-ID> -f priority=high --change-reason "<why>"',
6972
+ mcp: '`entries action=update entryId="<WP-ID>" data={"priority":"high"} changeReason="<why>"`'
6973
+ }
6974
+ };
6975
+ function priorityWord(value) {
6976
+ const token = priorityOf(value);
6977
+ return token ? PRIORITY_LEVELS[token].word : NO_PRIORITY.word;
6978
+ }
6979
+ function workPackageListLines(rows, counts, surface) {
6980
+ const lines = [];
6981
+ const anyPriority = rows.some((row) => priorityOf(row.priority) !== null);
6982
+ if (counts) lines.push(WORK_PACKAGE_LIST_WORDS.count(rows.length, counts));
6983
+ if (counts && rows.length > 0 && !anyPriority) lines.push(`${WORK_PACKAGE_LIST_WORDS.setOne} ${surface.setCommand}`);
6984
+ let level;
6985
+ for (const row of rows) {
6986
+ const word = priorityWord(row.priority);
6987
+ if (anyPriority && word !== level) lines.push(surface.heading(word));
6988
+ level = word;
6989
+ lines.push(...surface.row(row, row.yours ? ` ${WORK_PACKAGE_LIST_WORDS.yours}` : ""));
6990
+ }
6991
+ return lines;
6992
+ }
6993
+
6951
6994
  // src/lib/canonicalRefs.ts
6952
6995
  function getCollectionLabel(canonicalKey, form, workspaceCtx, collectionCtx) {
6953
6996
  const wsLabels = workspaceCtx?.collectionLabels?.[canonicalKey];
@@ -7191,15 +7234,16 @@ async function _handleOrient({ mode: mode2 = "full", tier, task, startupSignals,
7191
7234
  const degradedLineBrief = buildDegradedPreloadsLine(orientView?.degradedPreloads);
7192
7235
  if (degradedLineBrief) lines.push(degradedLineBrief);
7193
7236
  lines.push(...buildRitualsSurfaceLines(orientView, { fetchFailed: orientFetchFailed || orientView?.fetchFailed === true }));
7194
- const briefActiveWps = orientView?.activeWorkPackages ?? [];
7195
- if (briefActiveWps.length > 0) {
7196
- for (const e of briefActiveWps) {
7237
+ lines.push(...workPackageListLines(orientView?.activeWorkPackages ?? [], orientView?.strategicContext?.workPackageTeamCounts, {
7238
+ heading: (word) => `${word}:`,
7239
+ setCommand: WORK_PACKAGE_LIST_WORDS.setCommand.mcp,
7240
+ row: (e, mark) => {
7197
7241
  const tensions = e.linkedTensions;
7198
7242
  const tensionPart = tensions?.length ? ` \u2014 ${tensions.map((t) => `${t.entryId ?? t.name} (${t.severity ?? "\u2014"})`).join(", ")}` : "";
7199
7243
  const originPart = e.origin ? ` (origin: ${e.origin})` : "";
7200
- lines.push(`- \`${e.entryId ?? e._id}\` ${e.name}${originPart}${tensionPart}${coherencyCheckTag(e.coherencyCheckStatus)}`);
7244
+ return [`- \`${e.entryId ?? e._id}\` ${e.name}${originPart}${tensionPart}${mark}${coherencyCheckTag(e.coherencyCheckStatus)}`];
7201
7245
  }
7202
- }
7246
+ }));
7203
7247
  if (orientView?.trustMetrics) {
7204
7248
  const tm = orientView.trustMetrics;
7205
7249
  if (tm.unverified > 0 || tm.verified > 0) {
@@ -7329,14 +7373,14 @@ async function _handleOrient({ mode: mode2 = "full", tier, task, startupSignals,
7329
7373
  if (readiness.gaps.length > 5) lines.push(`_...and ${readiness.gaps.length - 5} more gap(s) \u2014 see structuredContent.data.readinessGaps._`);
7330
7374
  lines.push("");
7331
7375
  }
7332
- const fmt = (e) => {
7376
+ const fmt = (e, yoursMark = "") => {
7333
7377
  const type = e.canonicalKey ?? "generic";
7334
7378
  const stratum = e.stratum ?? "?";
7335
7379
  const originPart = e.origin ? ` (origin: ${e.origin})` : "";
7336
7380
  const mark = provenanceMark(e.provenance);
7337
7381
  const anchorSuffix = e.anchoredBy ? ` (${e.anchoredBy})` : "";
7338
7382
  const coherencyPart = coherencyCheckTag(e.coherencyCheckStatus);
7339
- return `- ${mark}\`${e.entryId ?? e._id}\` [${type} \xB7 ${stratum}] ${e.name}${anchorSuffix}${originPart}${coherencyPart}`;
7383
+ return `- ${mark}\`${e.entryId ?? e._id}\` [${type} \xB7 ${stratum}] ${e.name}${anchorSuffix}${originPart}${yoursMark}${coherencyPart}`;
7340
7384
  };
7341
7385
  const fullCoherence = await buildCoherenceSection();
7342
7386
  if (fullCoherence) {
@@ -7457,22 +7501,23 @@ async function _handleOrient({ mode: mode2 = "full", tier, task, startupSignals,
7457
7501
  }
7458
7502
  }
7459
7503
  if (orientView) {
7460
- const fullActiveWps = orientView.activeWorkPackages ?? [];
7461
- if (fullActiveWps.length > 0) {
7504
+ const fullActiveWps = orientView.activeWorkPackages ?? [], teamCounts = orientView.strategicContext?.workPackageTeamCounts;
7505
+ if (fullActiveWps.length > 0 || teamCounts) {
7462
7506
  lines.push("## Active work packages \u2014 current scope");
7463
7507
  lines.push("_Work outside these work packages requires explicit user confirmation._");
7464
7508
  lines.push("");
7465
- for (const e of fullActiveWps) {
7466
- lines.push(fmt(e));
7467
- const tensions = e.linkedTensions;
7468
- if (tensions?.length) {
7469
- const tensionLines = tensions.map((t) => {
7509
+ lines.push(...workPackageListLines(fullActiveWps, teamCounts, {
7510
+ // DEC-2426
7511
+ heading: (word) => `**${word}**`,
7512
+ setCommand: WORK_PACKAGE_LIST_WORDS.setCommand.mcp,
7513
+ row: (e, mark) => {
7514
+ const tensionLines = (e.linkedTensions ?? []).map((t) => {
7470
7515
  const meta = [t.severity, t.priority].filter(Boolean).join(", ");
7471
7516
  return `\`${t.entryId ?? t.name}\` (${t.name}${meta ? `, ${meta}` : ""})`;
7472
7517
  });
7473
- lines.push(` Tensions: ${tensionLines.join("; ")}`);
7518
+ return [fmt(e, mark), ...tensionLines.length ? [` Tensions: ${tensionLines.join("; ")}`] : []];
7474
7519
  }
7475
- }
7520
+ }));
7476
7521
  lines.push("");
7477
7522
  }
7478
7523
  const fullActiveGoals = orientView.activeGoals ?? [];
@@ -11994,4 +12039,4 @@ export {
11994
12039
  SERVER_VERSION,
11995
12040
  createProductBrainServer
11996
12041
  };
11997
- //# sourceMappingURL=chunk-GHVPPBME.js.map
12042
+ //# sourceMappingURL=chunk-NSKSK6LK.js.map