@productbrain/mcp 0.0.1-beta.6046 → 0.0.1-beta.6055

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.
@@ -9112,6 +9112,41 @@ function formatAdoptDiscoveryLine(display) {
9112
9112
  return [`- ${display} open question${display === "1" ? "" : "s"} you raised have no owner yet \u2014 use \`question action=adopt\` to route one.`];
9113
9113
  }
9114
9114
 
9115
+ // src/lib/terminalStatuses.ts
9116
+ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
9117
+ "shipped",
9118
+ "resolved",
9119
+ "done",
9120
+ "closed",
9121
+ "decided",
9122
+ "deprecated",
9123
+ // WP-707 S1 round-3 sign-off (P1, PRRT_kwDORS4ils6eVtHg): the questions drawer this PR revives
9124
+ // declares validWorkflowStatuses ['open','investigating','answered','dropped'] — before this
9125
+ // PR, questions were shelved as 'tension' so confidence.ts's QUESTION_SLUGS (['questions'])
9126
+ // matched nothing and questionResolutionRate defaulted to 1. Reviving the drawer without this
9127
+ // entry makes resolvedQuestions always empty (0/N), so any workspace with ≥3 questions goes
9128
+ // PERMANENTLY red and every answered question with ≥3 downstream stays a whatsNext critical
9129
+ // blocker forever, even after being answered. 'dropped' is pre-existing on objectives/
9130
+ // key-results/work-packages/chains (already terminal there) but becomes newly reachable via
9131
+ // this PR's two new drawers — same additive edit, taken together per the sign-off ruling.
9132
+ "answered",
9133
+ "dropped"
9134
+ ]);
9135
+
9136
+ // src/lib/rankActiveBets.ts
9137
+ function betWorkflowPriority(e) {
9138
+ if (e.workflowStatus === "building") return 2;
9139
+ if (e.workflowStatus === "shaped") return 1;
9140
+ return 0;
9141
+ }
9142
+ function rankActiveBets(entries) {
9143
+ return [...entries].sort((a, b) => {
9144
+ const p = betWorkflowPriority(b) - betWorkflowPriority(a);
9145
+ if (p !== 0) return p;
9146
+ return (b.updatedAt ?? 0) - (a.updatedAt ?? 0);
9147
+ });
9148
+ }
9149
+
9115
9150
  // src/tools/start_pb.ts
9116
9151
  var startPbSchema = z20.object({
9117
9152
  task: z20.string().max(2e3).optional().describe(
@@ -9143,10 +9178,8 @@ async function tryMarkOriented(agentSessionId, coherenceSnapshot) {
9143
9178
  }
9144
9179
  }
9145
9180
  }
9146
- function isActiveNowBet(e) {
9147
- const status2 = e.status ?? e.data?.status;
9148
- const horizon = e.data?.horizon;
9149
- return status2 === "active" && horizon === "now";
9181
+ function isActiveBet(e) {
9182
+ return !TERMINAL_STATUSES.has(e.workflowStatus ?? "");
9150
9183
  }
9151
9184
  async function buildSetupResponse(agentSessionId, sampleTruncated) {
9152
9185
  await kernelMutation(
@@ -9230,7 +9263,7 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
9230
9263
  let activeBets = [];
9231
9264
  try {
9232
9265
  const betsEntries = await kernelQuery("chain.listEntries", { collectionSlug: "work-packages" });
9233
- activeBets = (betsEntries ?? []).filter((e) => isActiveNowBet(e)).map((e) => ({ name: e.name, entryId: e.entryId ?? null })).slice(0, 8);
9266
+ activeBets = rankActiveBets((betsEntries ?? []).filter((e) => isActiveBet(e))).map((e) => ({ name: e.name, entryId: e.entryId ?? null })).slice(0, 8);
9234
9267
  } catch {
9235
9268
  }
9236
9269
  let governanceEntries = { principles: [], standards: [], businessRules: [] };
@@ -17006,4 +17039,4 @@ export {
17006
17039
  createProductBrainServer,
17007
17040
  initFeatureFlags
17008
17041
  };
17009
- //# sourceMappingURL=chunk-GGJNU6VM.js.map
17042
+ //# sourceMappingURL=chunk-M2DL3H3W.js.map