@productbrain/mcp 0.0.1-beta.8532 → 0.0.1-beta.8543

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.
@@ -8316,7 +8316,7 @@ function taskGroundingWarningLines(task, hasTaskGrounding = false) {
8316
8316
  if (task) {
8317
8317
  return [
8318
8318
  "## Task grounding incomplete",
8319
- "_A task was provided, but task-scoped governance/context did not load. Write tools stay locked until the task produces grounded context._",
8319
+ "_A task was provided, but task-scoped governance/context did not load. nothing in the Chain matched it._",
8320
8320
  "",
8321
8321
  'Refine the task and rerun `orient task="describe the work"` or use `context action="gather"` for deeper task context.',
8322
8322
  ""
@@ -8418,6 +8418,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
8418
8418
  recoveryBlock = orientView.recoveryBlock ?? null;
8419
8419
  }
8420
8420
  const hasTaskGrounding = Boolean(task && (orientView?.taskContext?.context?.length ?? 0) > 0);
8421
+ const taskAsked = orientView?.taskMeaningful === true && !orientFetchFailed && !orientView.degradedPreloads?.some((d) => d === "gather" || d === "governanceLoadRejected");
8421
8422
  let allCollections = [];
8422
8423
  try {
8423
8424
  allCollections = await kernelQuery("chain.listCollections") ?? [];
@@ -8446,15 +8447,11 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
8446
8447
  if (blankRuleLines.length > 0) scanLines.push("", "Rules:", ...blankRuleLines);
8447
8448
  let oriented = false;
8448
8449
  let orientationStatus2 = "no_session";
8449
- if (agentSessionId) {
8450
- try {
8451
- await kernelCall("agent.markOriented", { sessionId: agentSessionId });
8452
- setSessionOriented(true);
8453
- oriented = true;
8454
- orientationStatus2 = "complete";
8455
- } catch {
8456
- orientationStatus2 = "failed";
8457
- }
8450
+ if (agentSessionId && taskAsked) {
8451
+ oriented = await markOrientedWithSnapshotFallback(agentSessionId);
8452
+ orientationStatus2 = oriented ? "complete" : "failed";
8453
+ } else if (agentSessionId) {
8454
+ orientationStatus2 = "task_required";
8458
8455
  }
8459
8456
  const blankRuleListsExtra = orientView?.ruleLists ? { ruleLists: orientView.ruleLists } : {};
8460
8457
  const blankResult = {
@@ -8576,7 +8573,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
8576
8573
  if (ruleLines.length > 0) lines.push("", "Rules:", ...ruleLines);
8577
8574
  }
8578
8575
  let orientationStatus2 = "no_session";
8579
- if (agentSessionId && hasTaskGrounding) {
8576
+ if (agentSessionId && taskAsked) {
8580
8577
  const orientedOk = await markOrientedWithSnapshotFallback(agentSessionId, coherenceSnapshot);
8581
8578
  if (orientedOk) {
8582
8579
  orientationStatus2 = "complete";
@@ -8616,7 +8613,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
8616
8613
  {
8617
8614
  mode: "brief",
8618
8615
  sampleTruncated,
8619
- oriented: hasTaskGrounding ? isSessionOriented() : false,
8616
+ oriented: taskAsked ? isSessionOriented() : false,
8620
8617
  sessionId: agentSessionId,
8621
8618
  taskGroundingStatus: hasTaskGrounding ? "task_scoped" : task ? "missing_task_context" : "workspace_only",
8622
8619
  taskGroundingRequired: !hasTaskGrounding,
@@ -8637,7 +8634,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
8637
8634
  // RCRT miss-alarm: machine-readable verdict for structuredContent consumers (parity with the rendered prose alarm).
8638
8635
  ...orientView?.retrievalMiss ? { retrievalMiss: orientView.retrievalMiss } : {},
8639
8636
  orientationStatus: orientationStatus2,
8640
- nextStep: hasTaskGrounding ? void 0 : 'Run `orient task="describe the work"` before substantive work.',
8637
+ nextStep: taskAsked ? void 0 : 'Run `orient task="describe the work"` before substantive work.',
8641
8638
  ...orientView?._budget ? { _budget: orientView._budget } : {},
8642
8639
  ...orientView?.shapeAdvisorySummary ? { shapeAdvisorySummary: orientView.shapeAdvisorySummary } : {},
8643
8640
  // WP-560/TEN-2532 (Codex P2): text-parity, not text-only
@@ -8951,7 +8948,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
8951
8948
  lines.push("");
8952
8949
  }
8953
8950
  let orientationStatus = "no_session";
8954
- if (agentSessionId && hasTaskGrounding) {
8951
+ if (agentSessionId && taskAsked) {
8955
8952
  const orientedOk = await markOrientedWithSnapshotFallback(agentSessionId, fullCoherenceSnapshot);
8956
8953
  if (orientedOk) {
8957
8954
  orientationStatus = "complete";
@@ -8999,7 +8996,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
8999
8996
  sampleTruncated,
9000
8997
  // Rendered "## Gaps" text caps at 5; this carries more, itself capped at READINESS_GAPS_MAX with an explicit truncated/total pair (round 11).
9001
8998
  ...!sampleTruncated && (readiness?.gaps?.length ?? 0) > 0 ? { readinessGaps: readiness.gaps.slice(0, READINESS_GAPS_MAX), ...readiness.gaps.length > READINESS_GAPS_MAX ? { readinessGapsTruncated: true, readinessGapsTotal: readiness.gaps.length } : {} } : {},
9002
- oriented: hasTaskGrounding ? isSessionOriented() : false,
8999
+ oriented: taskAsked ? isSessionOriented() : false,
9003
9000
  sessionId: agentSessionId,
9004
9001
  taskGroundingStatus: hasTaskGrounding ? "task_scoped" : task ? "missing_task_context" : "workspace_only",
9005
9002
  taskGroundingRequired: !hasTaskGrounding,
@@ -9020,7 +9017,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
9020
9017
  // RCRT miss-alarm: machine-readable verdict, parity with the rendered prose alarm.
9021
9018
  ...orientView?.retrievalMiss ? { retrievalMiss: orientView.retrievalMiss } : {},
9022
9019
  orientationStatus,
9023
- nextStep: hasTaskGrounding ? void 0 : 'Run `orient task="describe the work"` before substantive work.',
9020
+ nextStep: taskAsked ? void 0 : 'Run `orient task="describe the work"` before substantive work.',
9024
9021
  ...orientView?._budget ? { _budget: orientView._budget } : {},
9025
9022
  // WP-560/TEN-2532 (Codex P2): shape-advisory line must reach structuredContent, not just text.
9026
9023
  ...orientView?.shapeAdvisorySummary ? { shapeAdvisorySummary: orientView.shapeAdvisorySummary } : {},
@@ -14528,4 +14525,4 @@ export {
14528
14525
  createProductBrainServer,
14529
14526
  initFeatureFlags
14530
14527
  };
14531
- //# sourceMappingURL=chunk-3BRLMGS4.js.map
14528
+ //# sourceMappingURL=chunk-NKK5TZHB.js.map