@productbrain/mcp 0.0.1-beta.8539 → 0.0.1-beta.8546

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.
@@ -2850,7 +2850,7 @@ function pushAppliedFieldsLines(responseLines, fieldsProvided, appliedFields, re
2850
2850
  // src/tools/knowledge/getHistory.ts
2851
2851
  import { z as z5 } from "zod/v3";
2852
2852
  var getHistorySchema = z5.object({
2853
- entryId: z5.string().describe("Entry ID, e.g. 'T-SUPPLIER', '<PREFIX>-<n>'")
2853
+ entryId: z5.string().describe("Entry ID, e.g. '<PREFIX>-<n>'")
2854
2854
  });
2855
2855
  async function handleGetHistory({ entryId }) {
2856
2856
  const history = await kernelQuery("chain.listEntryHistory", { entryId });
@@ -2881,7 +2881,7 @@ ${formatted}` }],
2881
2881
 
2882
2882
  // src/tools/knowledge.ts
2883
2883
  var updateEntrySchema = z6.object({
2884
- entryId: z6.string().describe("Entry ID to update, e.g. 'T-SUPPLIER', '<PREFIX>-<n>'"),
2884
+ entryId: z6.string().describe("Entry ID to update, e.g. '<PREFIX>-<n>'"),
2885
2885
  name: z6.string().optional().describe("New display name"),
2886
2886
  // Chain-ID-leak guard (check:chain-id-leaks): the retired legacy-shim ticket number stays in
2887
2887
  // the code comment above, never in this user-visible describe() string. T8 (TASK-393, WP-779): narrowed to generated ENTRY_STATUS_WRITE_WORDS.
@@ -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 } : {},
@@ -14307,7 +14304,7 @@ ${glossaryContext}
14307
14304
 
14308
14305
  For each name:
14309
14306
  1. Does it match a canonical term? If so, which one?
14310
- 2. Is there terminology drift? (e.g. using "vendor" instead of "supplier", "compliance" instead of "conformance")
14307
+ 2. Is there terminology drift? (e.g. using "customer" instead of "member", "owner" instead of "admin")
14311
14308
  3. Suggest the canonical alternative if drift is detected.
14312
14309
  4. Flag any names that don't have a corresponding glossary term (might need one).
14313
14310
 
@@ -14327,20 +14324,20 @@ function registerPrompts(server) {
14327
14324
  server.prompt(
14328
14325
  "name-check",
14329
14326
  "Check variable names, field names, or API names against the glossary for terminology alignment. Flags drift from canonical terms.",
14330
- { names: z33.string().describe("Comma-separated list of names to check (e.g. 'vendor_id, compliance_level, formulator_type')") },
14327
+ { names: z33.string().describe("Comma-separated list of names to check (e.g. 'user_id, workspace_id, entry_status')") },
14331
14328
  async ({ names }) => buildNameCheckPrompt(names)
14332
14329
  );
14333
14330
  server.prompt(
14334
14331
  "draft-decision-record",
14335
14332
  "Draft a structured decision record from a description of what was decided. Includes context from recent decisions and relevant rules.",
14336
- { context: z33.string().describe("Description of the decision (e.g. 'We decided to use MRSL v3.1 as the conformance baseline because...')") },
14333
+ { context: z33.string().describe("Description of the decision (e.g. 'We decided to keep one body field per entry because...')") },
14337
14334
  async ({ context }) => buildDraftDecisionRecordPrompt(context)
14338
14335
  );
14339
14336
  server.prompt(
14340
14337
  "draft-rule-from-context",
14341
14338
  "Draft a new business rule from an observation or discovery made while coding. Fetches existing rules for the domain to ensure consistency.",
14342
14339
  {
14343
- observation: z33.string().describe("What you observed or discovered (e.g. 'Suppliers can have multiple org types in Gateway')"),
14340
+ observation: z33.string().describe("What you observed or discovered (e.g. 'A workspace can have more than one owner role')"),
14344
14341
  domain: z33.string().describe("Which domain this rule belongs to (e.g. 'Governance & Decision-Making')")
14345
14342
  },
14346
14343
  async ({ observation, domain }) => buildDraftRuleFromContextPrompt(observation, domain)
@@ -14528,4 +14525,4 @@ export {
14528
14525
  createProductBrainServer,
14529
14526
  initFeatureFlags
14530
14527
  };
14531
- //# sourceMappingURL=chunk-3BRLMGS4.js.map
14528
+ //# sourceMappingURL=chunk-HM2EEYVT.js.map