@productbrain/mcp 0.0.1-beta.12671 → 0.0.1-beta.12675

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.
@@ -294,6 +294,9 @@ function isRequiredCriterion(kind, c) {
294
294
  return !blocking || blocking.includes(c.id) || !c.passed && c.failedBy !== "judge";
295
295
  }
296
296
  var MARK = { met: "[x]", not_yet: "[ ]", judging: "[~]" };
297
+ function missingParentLine(parentWord) {
298
+ return parentWord ? `Link it to the ${parentWord} it belongs to.` : "Link it to what it belongs to.";
299
+ }
297
300
  var COACHING_HEADER = "Worth asking (does not block):";
298
301
  function renderChecklist(canonicalKey, criteria, judging) {
299
302
  const lines = CHECKLIST_LINES[canonicalKey];
@@ -786,7 +789,7 @@ import { z as z7 } from "zod/v3";
786
789
  import { z as z5 } from "zod/v3";
787
790
 
788
791
  // src/lib/captureTimeoutOutcome.ts
789
- var SPINE_FLOOR_EXEMPT_SENTENCE = "kept as a draft, though this workspace is not yet enforcing the spine above it \u2014 it can be accepted as-is.";
792
+ var SPINE_FLOOR_EXEMPT_SENTENCE = "kept as a draft, though this workspace does not yet require the level above it; it can be accepted as-is.";
790
793
  function draftReplyLines(name, id, spineFloor, missingFieldLines = []) {
791
794
  const lines = missingFieldLines.length > 0 ? ["", ...missingFieldLines] : [];
792
795
  if (!spineFloor) return lines;
@@ -1013,7 +1016,7 @@ var captureSinglePreviewOutputSchema = z4.object({
1013
1016
 
1014
1017
  // src/tools/smart-capture.ts
1015
1018
  var CAPTURE_LINK_OUTCOMES = ["written", "refused"];
1016
- var LINK_TYPE_DESCRIPTION = `Relation type. The spine links: ${SPINE_RUNG_LINES.join(" ")}`;
1019
+ var LINK_TYPE_DESCRIPTION = `Relation type. Each level links to the one above: ${SPINE_RUNG_LINES.join(" ")}`;
1017
1020
  var captureSchema = z5.object({
1018
1021
  collection: z5.string().optional().describe("Collection slug, e.g. 'tensions', 'rules', 'glossary', 'decisions'. Optional \u2014 the kernel classifies when omitted."),
1019
1022
  name: z5.string().describe("Display name \u2014 be specific (e.g. 'Convex adjacency list won't scale for graph traversal')"),
@@ -1415,7 +1418,7 @@ Use \`context action=get\` to inspect the existing entry, or \`entries action=up
1415
1418
  next.push({ tool: "context", description: "See its connections", parameters: { action: "find", entryId: finalEntryId } });
1416
1419
  } else {
1417
1420
  next.push({ tool: "context", description: "Review the draft alternative", parameters: { action: "get", entryId: finalEntryId } });
1418
- next.push(spineFloor && !spineFloor.exempt && !spineFloor.linkWritten ? { tool: "relations", description: "Write the spine link it owes", parameters: { action: "create", from: finalEntryId, type: spineFloor.relationType } } : { tool: "entries", description: "Accept onto Chain", parameters: { action: "accept", entryId: finalEntryId } });
1421
+ next.push(spineFloor && !spineFloor.exempt && !spineFloor.linkWritten ? { tool: "relations", description: missingParentLine(spineFloor.parentKind.replace(/_/g, " ")), parameters: { action: "create", from: finalEntryId, type: spineFloor.relationType } } : { tool: "entries", description: "Accept onto Chain", parameters: { action: "accept", entryId: finalEntryId } });
1419
1422
  }
1420
1423
  const qualityPhrase = verdictQualityPhrase(verdictResult);
1421
1424
  const summary = finalStatus === "committed" ? `Captured and accepted ${finalEntryId} (${name}) onto ${landedCollection}. ${qualityPhrase}` : `Captured ${finalEntryId} (${name}) as draft in ${landedCollection}. ${qualityPhrase}`;
@@ -3297,7 +3300,7 @@ function registerRelationsTools(server) {
3297
3300
  title: "Relations",
3298
3301
  description: `Create and delete relations between entries, each written only on request with exactly the verb you send. Read relations with the read-only \`context action=find\`.
3299
3302
 
3300
- The spine links, child to parent: ${SPINE_RUNG_LINES.join(" ")}`,
3303
+ Each level links to the one above: ${SPINE_RUNG_LINES.join(" ")}`,
3301
3304
  inputSchema: relationsSchema,
3302
3305
  // DEC-1894 / DEC-74: find lives on the read-only `context` tool; every action left here writes.
3303
3306
  annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
@@ -6839,7 +6842,7 @@ function formatWhatNeedsAttentionBrief(wna) {
6839
6842
  }
6840
6843
 
6841
6844
  // src/tools/orient-rituals.ts
6842
- var SPINE_UNAVAILABLE_LINE = "Spine check: unavailable \u2014 orient fetch failed, retry `orient`";
6845
+ var SPINE_UNAVAILABLE_LINE = "Direction check: unavailable \u2014 orient fetch failed, retry `orient`";
6843
6846
  function buildRitualsSurfaceLines(view, opts) {
6844
6847
  const lines = [""];
6845
6848
  if (opts?.fetchFailed) {
@@ -7044,7 +7047,7 @@ function registerOrientTool(server) {
7044
7047
  "orient",
7045
7048
  {
7046
7049
  title: "Orient",
7047
- description: "Task-grounded context loader. Call `session action=start` first; it opens the session and hands you the briefing.\n\nPass `task` to load the governance and context for a specific task. Orient is advice for captures, relations, accepts, ticks and questions; " + ORIENT_REQUIRED_NOTE + "\n\n**tier** (action=task): Controls payload depth.\n- `summary` (~10 KB) \u2014 compact, calibrated for task-scoped retrieval.\n- `standard` (~256 KB) \u2014 rich, suited to workspace standups.\n- `full` \u2014 complete payload, no cap. Use with deliberation.\n\nThe spine (vision, purpose, strategy highlights) is served in full and a grounding status flags when context was reduced.\n\nDefault: `standard`, with or without `task`. Explicit `tier` always wins.\n\n**mode** (action=task): `full` (default) returns full context. `brief` returns compact summary \u2014 mapped to tier=summary internally.",
7050
+ description: "Task-grounded context loader. Call `session action=start` first; it opens the session and hands you the briefing.\n\nPass `task` to load the governance and context for a specific task. Orient is advice for captures, relations, accepts, ticks and questions; " + ORIENT_REQUIRED_NOTE + "\n\n**tier** (action=task): Controls payload depth.\n- `summary` (~10 KB) \u2014 compact, calibrated for task-scoped retrieval.\n- `standard` (~256 KB) \u2014 rich, suited to workspace standups.\n- `full` \u2014 complete payload, no cap. Use with deliberation.\n\nPurpose, vision and strategy highlights are always served in full; a grounding status flags when other context was reduced.\n\nDefault: `standard`, with or without `task`. Explicit `tier` always wins.\n\n**mode** (action=task): `full` (default) returns full context. `brief` returns compact summary \u2014 mapped to tier=summary internally.",
7048
7051
  inputSchema: orientSchema,
7049
7052
  // Not read-only: a task-shaped orient marks the session oriented.
7050
7053
  annotations: { readOnlyHint: false, idempotentHint: true, openWorldHint: false }
@@ -9368,7 +9371,7 @@ function readSpineVerdict(value) {
9368
9371
  }
9369
9372
  function describeSpineStaleness(changedMemberCount, membershipTruncated = false, relationsChanged = false) {
9370
9373
  if (changedMemberCount > 0) {
9371
- const reason = `${membershipTruncated ? "at least " : ""}${changedMemberCount} entr${changedMemberCount === 1 ? "y" : "ies"} changed or joined/left the spine since this was computed`;
9374
+ const reason = `${membershipTruncated ? "at least " : ""}${changedMemberCount} entr${changedMemberCount === 1 ? "y" : "ies"} changed, joined or left the direction since this was checked`;
9372
9375
  return reason + (membershipTruncated ? "; membership scan incomplete" : "");
9373
9376
  }
9374
9377
  if (relationsChanged) {
@@ -9386,7 +9389,7 @@ async function handleSpineCheck(story, refresh = false) {
9386
9389
  const row = await kernelQuery("quality.getLatestSpineVerdict", {});
9387
9390
  const stillRunning = scheduleResult.scheduled;
9388
9391
  if (!row) {
9389
- const text = stillRunning ? "Spine check started \u2014 no prior result exists yet. It runs asynchronously (LLM calls can take 25s+ each); re-run this in a few seconds to read the result." : scheduleResult.reason === "already-in-flight" ? "A spine check is already running \u2014 no prior result exists yet. Re-run quality action=spine-check in a few seconds to read its result." : "No spine check has been run yet, and none is currently running. Pass refresh:true to start one.";
9392
+ const text = stillRunning ? "Direction check started; there is no earlier result. It can take 25 seconds or more; run this again in a few seconds to read it." : scheduleResult.reason === "already-in-flight" ? "A direction check is already running; there is no earlier result. Run quality action=spine-check again in a few seconds to read it." : "The direction has not been checked yet, and no check is running. Pass refresh:true to start one.";
9390
9393
  return {
9391
9394
  content: [{ type: "text", text }],
9392
9395
  structuredContent: success(text, {
@@ -9402,7 +9405,7 @@ async function handleSpineCheck(story, refresh = false) {
9402
9405
  if (parsed.kind === "empty") {
9403
9406
  const pending = stillRunning || scheduleResult.reason === "already-in-flight";
9404
9407
  const freshness = (row.stale ? ` Stale: ${staleReason}.` : "") + (pending ? " A check is running; re-run quality action=spine-check in a few seconds to read its result." : row.stale ? " Run quality action=spine-check refresh=true to refresh it." : "");
9405
- const text = `The last spine check found no accepted purpose, vision or strategy.${freshness}`;
9408
+ const text = `The last direction check found no accepted purpose, vision or strategy.${freshness}`;
9406
9409
  return {
9407
9410
  content: [{ type: "text", text }],
9408
9411
  structuredContent: success(text, {
@@ -9417,7 +9420,7 @@ async function handleSpineCheck(story, refresh = false) {
9417
9420
  }
9418
9421
  if (parsed.kind === "malformed") {
9419
9422
  const pending = stillRunning || scheduleResult.reason === "already-in-flight";
9420
- const text = `Stored spine verdict is malformed \u2014 ${pending ? "a check is running; re-run quality action=spine-check in a few seconds to read its result." : "run quality action=spine-check refresh=true to replace it."}`;
9423
+ const text = `The last direction check could not be read \u2014 ${pending ? "a check is running; re-run quality action=spine-check in a few seconds to read its result." : "run quality action=spine-check refresh=true to replace it."}`;
9421
9424
  return {
9422
9425
  content: [{ type: "text", text }],
9423
9426
  structuredContent: success(text, {
@@ -9431,7 +9434,7 @@ async function handleSpineCheck(story, refresh = false) {
9431
9434
  };
9432
9435
  }
9433
9436
  const { verdict: verdict2 } = parsed;
9434
- const lines = ["## Spine Check"];
9437
+ const lines = ["## Direction check"];
9435
9438
  if (stillRunning) {
9436
9439
  lines.push(`> A new check was just triggered and is still running asynchronously \u2014 the result below is from the PREVIOUS run (${new Date(row.createdAt).toISOString()}). Re-run in a few seconds for the fresh result.`, "");
9437
9440
  } else if (scheduleResult.reason === "already-in-flight") {
@@ -9472,7 +9475,7 @@ async function handleSpineCheck(story, refresh = false) {
9472
9475
  return {
9473
9476
  content: [{ type: "text", text: lines.join("\n") }],
9474
9477
  structuredContent: success(
9475
- `Spine check: structural ${s.passed ? "PASS" : "FAIL"}${verdict2.story ? `, story ${verdict2.story.passed ? "PASS" : "FAIL"} [unvalidated]` : ""}${stillRunning ? " (new run still in progress \u2014 showing previous result)" : ""}.`,
9478
+ `Direction check: structure ${s.passed ? "PASS" : "FAIL"}${verdict2.story ? `, story ${verdict2.story.passed ? "PASS" : "FAIL"} [unvalidated]` : ""}${stillRunning ? " (new run still in progress \u2014 showing previous result)" : ""}.`,
9476
9479
  {
9477
9480
  hasVerdict: true,
9478
9481
  noSpineEntries: false,
@@ -9491,13 +9494,13 @@ async function handleSpineCheck(story, refresh = false) {
9491
9494
  var QUALITY_ACTIONS = ["check", "re-evaluate", "verify-chain", "spine-check"];
9492
9495
  var qualitySchema = z26.object({
9493
9496
  action: z26.enum(QUALITY_ACTIONS).describe(
9494
- "'check': read the entry's server quality verdict (tier + criteria). 're-evaluate': trigger fresh evaluation. 'verify-chain': verify entries against the codebase (codeMapping drift, cross-references) \u2014 absorbs `verify`. 'spine-check': structural completeness of the purpose+vision+strategy spine \u2014 story:true also runs the on-demand one-story judgment."
9497
+ "'check': read the entry's server quality verdict (tier + criteria). 're-evaluate': trigger fresh evaluation. 'verify-chain': verify entries against the codebase (codeMapping drift, cross-references) \u2014 absorbs `verify`. 'spine-check': checks the direction, purpose to key results, for duplicates, unlinked entries and a strategy that refuses nothing; story:true also runs the one-story judgment."
9495
9498
  ),
9496
9499
  entryId: z26.string().max(200).optional().describe("For 'check'/'re-evaluate': entry ID, e.g. 'TEN-graph-db', '<PREFIX>-<n>'."),
9497
9500
  context: z26.enum(["capture", "commit", "review"]).default("review").optional().describe("For re-evaluate: evaluation context"),
9498
9501
  collection: z26.string().max(200).optional().describe("For 'verify-chain': collection slug to verify (default: glossary)."),
9499
9502
  mode: z26.enum(["report", "fix"]).optional().describe("For 'verify-chain': 'report' = read-only trust report (default). 'fix' = also update drifted codeMapping statuses."),
9500
- story: z26.boolean().optional().describe("For 'spine-check': also run the on-demand one-story LLM judgment (never scheduled; result labelled [unvalidated])."),
9503
+ story: z26.boolean().optional().describe("For 'spine-check': also run the one-story judgment (never scheduled; result labelled [unvalidated])."),
9501
9504
  refresh: z26.boolean().optional().describe(
9502
9505
  "For 'spine-check': force a new run even if a fresh verdict already exists. Default false \u2014 a plain call NEVER re-triggers work just to read the last result; it auto-schedules only when no run is already in flight AND the stored verdict is absent/stale/missing the requested story pass."
9503
9506
  )
@@ -9579,7 +9582,7 @@ function registerQualityTools(server) {
9579
9582
  "quality",
9580
9583
  {
9581
9584
  title: "Quality",
9582
- description: "Assess, re-evaluate, and verify entry/work package quality. Four actions:\n\n- **check**: Read the entry's server quality verdict (tier + criteria) \u2014 it does not re-score.\n- **re-evaluate**: Trigger a fresh quality evaluation. Returns heuristic verdict immediately, schedules LLM evaluation in background.\n- **verify-chain**: Verify knowledge entries against the actual codebase (codeMapping drift, cross-references) \u2014 absorbs `verify`. Produces a trust report with a trust score.\n- **spine-check**: Structural completeness of the purpose+vision+strategy spine \u2014 duplicate singletons, connectedness, per-strategy refusal heuristic; story:true also runs the on-demand one-story LLM judgment (never scheduled, result labelled [unvalidated]). Async: a plain call reads back the latest stored verdict and auto-schedules a new run ONLY when none is already in flight AND the stored one is absent/stale/missing the requested story pass \u2014 repeated polling never re-triggers work. Pass refresh:true to force a fresh run regardless.",
9585
+ description: "Assess, re-evaluate, and verify entry/work package quality. Four actions:\n\n- **check**: Read the entry's server quality verdict (tier + criteria) \u2014 it does not re-score.\n- **re-evaluate**: Trigger a fresh quality evaluation. Returns heuristic verdict immediately, schedules LLM evaluation in background.\n- **verify-chain**: Verify knowledge entries against the actual codebase (codeMapping drift, cross-references) \u2014 absorbs `verify`. Produces a trust report with a trust score.\n- **spine-check**: Checks the direction, purpose to key results, for duplicates, unlinked entries and a strategy that refuses nothing; story:true also runs the one-story judgment (never scheduled, result labelled [unvalidated]). Async: a plain call reads back the latest stored verdict and auto-schedules a new run ONLY when none is already in flight AND the stored one is absent/stale/missing the requested story pass \u2014 repeated polling never re-triggers work. Pass refresh:true to force a fresh run.",
9583
9586
  inputSchema: qualitySchema,
9584
9587
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
9585
9588
  },
@@ -11981,4 +11984,4 @@ export {
11981
11984
  SERVER_VERSION,
11982
11985
  createProductBrainServer
11983
11986
  };
11984
- //# sourceMappingURL=chunk-2ZGIDGVQ.js.map
11987
+ //# sourceMappingURL=chunk-EYOYIRSE.js.map