@productbrain/mcp 0.0.1-beta.7300 → 0.0.1-beta.7317

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.
@@ -4022,7 +4022,7 @@ async function handleGet(entryId) {
4022
4022
  `# ${e.entryId ? `${e.entryId}: ` : ""}${e.name}`,
4023
4023
  "",
4024
4024
  `**Status:** ${e.status}${e.workflowStatus ? ` / ${e.workflowStatus}` : ""}`,
4025
- `**Type:** ${e.canonicalKey ?? "untyped"}`
4025
+ `**Collection:** ${e.collectionSlug ?? "unknown"}`
4026
4026
  ];
4027
4027
  if (typeof e.capturedAt === "number") lines.push(`**Captured at:** ${new Date(e.capturedAt).toISOString()}`);
4028
4028
  if (e.origin) {
@@ -4129,7 +4129,7 @@ async function handleBatch(entryIds) {
4129
4129
  lines.push(`## ${entry.entryId ? `${entry.entryId}: ` : ""}${entry.name}`);
4130
4130
  lines.push("");
4131
4131
  lines.push(`**Status:** ${entry.status}${entry.workflowStatus ? ` / ${entry.workflowStatus}` : ""}`);
4132
- lines.push(`**Type:** ${entry.canonicalKey ?? "untyped"}`);
4132
+ lines.push(`**Collection:** ${entry.collectionSlug ?? "unknown"}`);
4133
4133
  if (typeof entry.capturedAt === "number") {
4134
4134
  lines.push(`**Captured at:** ${new Date(entry.capturedAt).toISOString()}`);
4135
4135
  }
@@ -4308,11 +4308,10 @@ async function handleSearch(server, query, collection, status2) {
4308
4308
  const statusDisplay = e.workflowStatus ? `${e.status} / ${e.workflowStatus}` : e.status;
4309
4309
  const slug = collMap.get(e.collectionId ?? "");
4310
4310
  const colTag = slug ? ` [${slug}]` : "";
4311
- const typeTag = e.canonicalKey ? ` (${e.canonicalKey})` : "";
4312
4311
  const desc = extractPreview(e.data, 150);
4313
4312
  const preview = desc ? `
4314
4313
  ${desc}` : "";
4315
- return `- ${id}${e.name} \`${statusDisplay}\`${colTag}${typeTag}${preview}`;
4314
+ return `- ${id}${e.name} \`${statusDisplay}\`${colTag}${preview}`;
4316
4315
  }).join("\n");
4317
4316
  const header = `## Search Result
4318
4317
 
@@ -14224,28 +14223,12 @@ All entries: \`draft\` | \`active\` | \`deprecated\` | \`archived\`
14224
14223
  - \`data\` param is merged (not replaced) \u2014 safe for partial updates
14225
14224
  `;
14226
14225
 
14227
- // src/resources/index.ts
14228
- var MODULE_DIR = dirname(fileURLToPath(import.meta.url));
14229
- var UI_VIEW_BASE_CANDIDATES = [
14230
- resolve4(MODULE_DIR, "views"),
14231
- resolve4(MODULE_DIR, "..", "views"),
14232
- resolve4(MODULE_DIR, "..", "..", "dist", "views"),
14233
- resolve4(MODULE_DIR, "..", "..", "..", "mcp-views", "dist")
14234
- ];
14235
- function formatEntryMarkdown(entry) {
14236
- const id = entry.entryId ? `${entry.entryId}: ` : "";
14237
- const lines = [`## ${id}${entry.name} [${entry.status}]`];
14238
- if (entry.data && typeof entry.data === "object") {
14239
- for (const [key, val] of Object.entries(entry.data)) {
14240
- if (val && key !== "rawData") {
14241
- lines.push(`**${key}**: ${typeof val === "string" ? val : JSON.stringify(val)}`);
14242
- }
14243
- }
14244
- }
14245
- return lines.join("\n");
14246
- }
14247
- function buildOrientationMarkdown(collections, standards, businessRules, principles) {
14226
+ // src/resources/orientationMarkdown.ts
14227
+ function buildOrientationMarkdown(collections, standards, businessRules, principles, directionLines) {
14248
14228
  const sections = ["# Product Brain \u2014 Orientation"];
14229
+ if (directionLines && directionLines.length > 0) {
14230
+ sections.push(directionLines.join("\n"));
14231
+ }
14249
14232
  sections.push(
14250
14233
  "## About Product Brain (PB)\nPB is a knowledge management system used by many product teams. This section describes how PB works \u2014 not your product.\n\n### How PB Organizes Its Tools\n- **Tools** = actions with side-effects or dynamic computation (capture, accept, search).\n- **Resources** = stable, read-only data (orientation, terminology, collection schemas).\n- **Prompts** = multi-step choreography (workflows, guided capture, deep dives).\n- Every tool, resource, and prompt works for ANY workspace \u2014 no bespoke logic.\n- Resource templates (URI params) serve workspace-specific data through generic patterns.\n- Compound tools with `action` enums keep the tool count minimal.\n\n" + DATA_HANDLING_SECTION
14251
14234
  );
@@ -14336,6 +14319,47 @@ Use \`entries action=update\` for post-creation adjustments (status changes, fie
14336
14319
  );
14337
14320
  return sections.join("\n\n---\n\n");
14338
14321
  }
14322
+ async function buildOrientationResourceText(kernelQuery2) {
14323
+ const [collectionsResult, standardsResult, rulesResult, principlesResult, orientViewResult] = await Promise.allSettled([
14324
+ kernelQuery2("chain.listCollections"),
14325
+ kernelQuery2("chain.listEntries", { collectionSlug: "standards" }),
14326
+ kernelQuery2("chain.listEntries", { collectionSlug: "business-rules" }),
14327
+ kernelQuery2("chain.listEntries", { collectionSlug: "principles" }),
14328
+ kernelQuery2("chain.getOrientView", {
14329
+ tier: "summary",
14330
+ renderMode: "json",
14331
+ invocationPath: "unknown"
14332
+ })
14333
+ ]);
14334
+ const collections = collectionsResult.status === "fulfilled" ? collectionsResult.value : null;
14335
+ const standards = standardsResult.status === "fulfilled" ? standardsResult.value : null;
14336
+ const businessRules = rulesResult.status === "fulfilled" ? rulesResult.value : null;
14337
+ const principles = principlesResult.status === "fulfilled" ? principlesResult.value : null;
14338
+ const orientView = orientViewResult.status === "fulfilled" ? orientViewResult.value : null;
14339
+ const directionLines = buildDirectionLines(orientView);
14340
+ return buildOrientationMarkdown(collections, standards, businessRules, principles, directionLines);
14341
+ }
14342
+
14343
+ // src/resources/index.ts
14344
+ var MODULE_DIR = dirname(fileURLToPath(import.meta.url));
14345
+ var UI_VIEW_BASE_CANDIDATES = [
14346
+ resolve4(MODULE_DIR, "views"),
14347
+ resolve4(MODULE_DIR, "..", "views"),
14348
+ resolve4(MODULE_DIR, "..", "..", "dist", "views"),
14349
+ resolve4(MODULE_DIR, "..", "..", "..", "mcp-views", "dist")
14350
+ ];
14351
+ function formatEntryMarkdown(entry) {
14352
+ const id = entry.entryId ? `${entry.entryId}: ` : "";
14353
+ const lines = [`## ${id}${entry.name} [${entry.status}]`];
14354
+ if (entry.data && typeof entry.data === "object") {
14355
+ for (const [key, val] of Object.entries(entry.data)) {
14356
+ if (val && key !== "rawData") {
14357
+ lines.push(`**${key}**: ${typeof val === "string" ? val : JSON.stringify(val)}`);
14358
+ }
14359
+ }
14360
+ }
14361
+ return lines.join("\n");
14362
+ }
14339
14363
  function registerResources(server) {
14340
14364
  server.resource(
14341
14365
  "agent-cheatsheet",
@@ -14351,35 +14375,9 @@ function registerResources(server) {
14351
14375
  server.resource(
14352
14376
  "chain-orientation",
14353
14377
  "productbrain://orientation",
14354
- async (uri) => {
14355
- const [collectionsResult, standardsResult, rulesResult, principlesResult] = await Promise.allSettled([
14356
- kernelQuery("chain.listCollections"),
14357
- kernelQuery("chain.listEntries", { collectionSlug: "standards" }),
14358
- kernelQuery("chain.listEntries", { collectionSlug: "business-rules" }),
14359
- kernelQuery("chain.listEntries", { collectionSlug: "principles" })
14360
- ]);
14361
- const collections = collectionsResult.status === "fulfilled" ? collectionsResult.value : null;
14362
- const standards = standardsResult.status === "fulfilled" ? standardsResult.value : null;
14363
- const businessRules = rulesResult.status === "fulfilled" ? rulesResult.value : null;
14364
- const principles = principlesResult.status === "fulfilled" ? principlesResult.value : null;
14365
- return {
14366
- contents: [{
14367
- uri: uri.href,
14368
- // `chain.listEntries`'s real return is a union (raw EntryDoc[] vs Record<string,
14369
- // unknown>[] depending on field projection, see wrapup.ts's own doc comment on this
14370
- // recurring residual) — `EntryListItem` only reads a documented subset of fields
14371
- // present on both union branches; cast rather than widen the render helper's
14372
- // signature to the full server union (PR #395, Lane C S3b annotation pass).
14373
- text: buildOrientationMarkdown(
14374
- collections,
14375
- standards,
14376
- businessRules,
14377
- principles
14378
- ),
14379
- mimeType: "text/markdown"
14380
- }]
14381
- };
14382
- }
14378
+ async (uri) => ({
14379
+ contents: [{ uri: uri.href, text: await buildOrientationResourceText(kernelQuery), mimeType: "text/markdown" }]
14380
+ })
14383
14381
  );
14384
14382
  server.resource(
14385
14383
  "chain-terminology",
@@ -14991,4 +14989,4 @@ export {
14991
14989
  createProductBrainServer,
14992
14990
  initFeatureFlags
14993
14991
  };
14994
- //# sourceMappingURL=chunk-GMV452CF.js.map
14992
+ //# sourceMappingURL=chunk-CPX4DW3V.js.map