@productbrain/mcp 0.0.1-beta.7300 → 0.0.1-beta.7319
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
|
-
`**
|
|
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(`**
|
|
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}${
|
|
4314
|
+
return `- ${id}${e.name} \`${statusDisplay}\`${colTag}${preview}`;
|
|
4316
4315
|
}).join("\n");
|
|
4317
4316
|
const header = `## Search Result
|
|
4318
4317
|
|
|
@@ -6313,6 +6312,8 @@ var COLLECTIONS_ACTIONS = [
|
|
|
6313
6312
|
"label-apply",
|
|
6314
6313
|
"label-remove"
|
|
6315
6314
|
];
|
|
6315
|
+
var STATUS_CATEGORIES = ["draft", "current", "past", "discarded"];
|
|
6316
|
+
var statusListEntrySchema = z16.object({ label: z16.string().max(200), category: z16.enum(STATUS_CATEGORIES) });
|
|
6316
6317
|
var qualityCriterionSchema = z16.object({
|
|
6317
6318
|
field: z16.string().max(200).describe("Entry data field key this criterion applies to, e.g. 'description', 'owner'"),
|
|
6318
6319
|
// WP-480 S1: `max_length` — must mirror the Convex rule union, or the tool rejects a
|
|
@@ -6330,17 +6331,12 @@ var fieldSchema = z16.object({
|
|
|
6330
6331
|
displayHint: z16.enum(["hero", "badge", "meta", "section", "hidden", "inline-meta"]).optional().describe("V2 rendering hint: how the field should be displayed in Cortex"),
|
|
6331
6332
|
zone: z16.enum(["header", "body", "meta"]).optional().describe("V2 layout zone: where the field appears in the entry view"),
|
|
6332
6333
|
colorMap: z16.record(z16.string().max(50)).optional().describe("V2 value-to-semantic-color mapping, e.g. { critical: 'danger', low: 'success' }"),
|
|
6333
|
-
// ENT-61
|
|
6334
6334
|
accentSource: z16.boolean().optional().describe("When true, this field's colorMap value drives the card-level accent styling"),
|
|
6335
|
-
// ENT-61
|
|
6336
6335
|
iconMap: z16.record(z16.string(), z16.string().max(50)).optional().describe("Maps field values to icons (emoji/symbol), prepended to badge text"),
|
|
6337
6336
|
helpText: z16.string().max(2e3).optional().describe("Help text shown in editors and describe output"),
|
|
6338
6337
|
optionDescriptions: z16.record(z16.string().max(500)).optional().describe("Per-option guidance for select fields"),
|
|
6339
|
-
// BET-136
|
|
6340
6338
|
semanticRole: z16.enum(["problem", "appetite", "elements", "architecture", "done_when", "risks", "exclusions"]).optional().describe("Semantic role for schema-driven consumers \u2014 enables field-key-independent validation and rendering"),
|
|
6341
|
-
// BET-196
|
|
6342
6339
|
maxLength: z16.number().optional().describe("Maximum character length for field values. Three-tier resolution: explicit > displayHint > type fallback."),
|
|
6343
|
-
// BET-196
|
|
6344
6340
|
minLength: z16.number().optional().describe("Minimum character length for field values. Only explicit \u2014 no defaults.")
|
|
6345
6341
|
});
|
|
6346
6342
|
var collectionsSchema = z16.object({
|
|
@@ -6356,20 +6352,15 @@ var collectionsSchema = z16.object({
|
|
|
6356
6352
|
fields: z16.array(fieldSchema).max(200).optional().describe("Field definitions for create, or replacement schema for update (replaces all fields)"),
|
|
6357
6353
|
axis: z16.enum(["work", "none", "pending"]).optional().describe("REQUIRED for create: 'work' (needs stageLabelMap + validWorkflowStatuses), 'none', or 'pending'. For update: only settable on a non-system-stratum (custom) collection \u2014 the repair path for a legacy collection that predates the axis contract."),
|
|
6358
6354
|
stageLabelMap: z16.record(z16.string(), z16.enum(["open", "in_progress", "done", "stopped", "tag"])).optional().describe("Required when axis is 'work': maps each valid workflowStatus to a canonical stage."),
|
|
6359
|
-
// ENT-62
|
|
6360
6355
|
defaultCanonicalKey: z16.string().max(200).optional().describe("The canonical_key entries in this collection default to (e.g. 'decision', 'insight'). Consumers read from collection doc; code map is fallback."),
|
|
6361
|
-
// ENT-67
|
|
6362
6356
|
defaultWorkflowStatus: z16.string().max(200).optional().describe("Default workflowStatus for new entries. Must be in validWorkflowStatuses when set (e.g. 'hypothesis' for insights)."),
|
|
6363
|
-
// ENT-65
|
|
6364
6357
|
validWorkflowStatuses: z16.array(z16.string().max(200)).max(50).optional().describe("The allowed workflowStatus values for entries in this collection. New entries are validated against this list. Empty array means no constraint."),
|
|
6365
6358
|
// ENT-65, FEAT-200
|
|
6366
6359
|
classificationCheck: z16.string().max(500).optional().describe("LLM decision-tree check for this collection (3\u2013500 chars). Guides the classifier in routing entries here."),
|
|
6367
|
-
// ENT-65, FEAT-200
|
|
6368
6360
|
classificationPriority: z16.number().optional().describe("Classifier priority (1\u20139, lower = higher priority). Used with classificationCheck to order the decision tree."),
|
|
6369
|
-
// FEAT-301 Slice 2: quality gate criteria and usage guidance.
|
|
6370
|
-
// FEAT-257
|
|
6371
6361
|
qualityCriteria: z16.array(qualityCriterionSchema).max(50).optional().describe("Per-collection accept gate rules. 'required' rule hard-blocks accepts on empty fields; 'min_length'/'pattern' rules warn. Pass an empty array to clear all criteria."),
|
|
6372
6362
|
usageGuidance: z16.string().max(2e4).optional().describe("Plain-text guidance shown to agents and users: when to use this collection, when not to, and what makes a good entry."),
|
|
6363
|
+
statusList: z16.array(statusListEntrySchema).max(50).optional().describe(`Ordered status vocabulary: {label, category}[] (draft/current/past/discarded); draft first, exactly one 'discarded' labeled "discarded", labels unique. Re-validated server-side.`),
|
|
6373
6364
|
// For label-*
|
|
6374
6365
|
color: z16.string().max(50).optional().describe("For label-create/label-update: hex color, e.g. '#ef4444'."),
|
|
6375
6366
|
parentSlug: z16.string().max(200).optional().describe("For label-create: parent group slug for label hierarchy."),
|
|
@@ -6397,7 +6388,8 @@ var collectionsUpdateVariant = z16.object({
|
|
|
6397
6388
|
classificationCheck: z16.string().max(500).optional(),
|
|
6398
6389
|
classificationPriority: z16.number().optional(),
|
|
6399
6390
|
qualityCriteria: z16.array(qualityCriterionSchema).optional(),
|
|
6400
|
-
usageGuidance: z16.string().max(2e4).optional()
|
|
6391
|
+
usageGuidance: z16.string().max(2e4).optional(),
|
|
6392
|
+
statusList: z16.array(statusListEntrySchema).optional()
|
|
6401
6393
|
});
|
|
6402
6394
|
var collectionsAuditVariant = z16.object({ action: z16.literal("audit") });
|
|
6403
6395
|
var collectionsExportVariant = z16.object({ action: z16.literal("export") });
|
|
@@ -6440,7 +6432,7 @@ var collectionsActionUnion = z16.discriminatedUnion("action", [
|
|
|
6440
6432
|
var COLLECTIONS_ACTION_SPECS = {
|
|
6441
6433
|
list: { params: [], description: "Browse all collections; no params." },
|
|
6442
6434
|
describe: { params: ["slug"], description: "slug is required." },
|
|
6443
|
-
update: { params: ["slug", "name", "description", "purpose", "icon", "navGroup", "fields", "axis", "stageLabelMap", "defaultCanonicalKey", "defaultWorkflowStatus", "validWorkflowStatuses", "classificationCheck", "classificationPriority", "qualityCriteria", "usageGuidance"], description: "slug is required; at least one other field must be provided. axis/stageLabelMap are only settable on a non-system-stratum collection (the repair path for a legacy custom collection missing its axis declaration)." },
|
|
6435
|
+
update: { params: ["slug", "name", "description", "purpose", "icon", "navGroup", "fields", "axis", "stageLabelMap", "defaultCanonicalKey", "defaultWorkflowStatus", "validWorkflowStatuses", "classificationCheck", "classificationPriority", "qualityCriteria", "usageGuidance", "statusList"], description: "slug is required; at least one other field must be provided. axis/stageLabelMap are only settable on a non-system-stratum collection (the repair path for a legacy custom collection missing its axis declaration)." },
|
|
6444
6436
|
audit: { params: [], description: "Health report for all collections; no params." },
|
|
6445
6437
|
export: { params: [], description: "Full system_collection_definitions export; no params. Admin only." },
|
|
6446
6438
|
"label-list": { params: [], description: "List all labels; no params." },
|
|
@@ -6455,9 +6447,9 @@ function registerCollectionsTools(server) {
|
|
|
6455
6447
|
list: () => handleList2(),
|
|
6456
6448
|
describe: (data) => handleDescribe(data.slug),
|
|
6457
6449
|
update: (data) => {
|
|
6458
|
-
const hasChanges = data.name || data.description || data.purpose || data.icon || data.navGroup || data.fields || data.axis !== void 0 || data.stageLabelMap !== void 0 || data.defaultCanonicalKey !== void 0 || data.defaultWorkflowStatus !== void 0 || data.validWorkflowStatuses !== void 0 || data.classificationCheck !== void 0 || data.classificationPriority !== void 0 || data.qualityCriteria !== void 0 || data.usageGuidance !== void 0;
|
|
6450
|
+
const hasChanges = data.name || data.description || data.purpose || data.icon || data.navGroup || data.fields || data.axis !== void 0 || data.stageLabelMap !== void 0 || data.defaultCanonicalKey !== void 0 || data.defaultWorkflowStatus !== void 0 || data.validWorkflowStatuses !== void 0 || data.classificationCheck !== void 0 || data.classificationPriority !== void 0 || data.qualityCriteria !== void 0 || data.usageGuidance !== void 0 || data.statusList;
|
|
6459
6451
|
if (!hasChanges) {
|
|
6460
|
-
return Promise.resolve(validationResult("Provide at least one field to update (name, description, purpose, icon, navGroup, fields, axis, stageLabelMap, defaultCanonicalKey, defaultWorkflowStatus, validWorkflowStatuses, classificationCheck, classificationPriority, qualityCriteria, or
|
|
6452
|
+
return Promise.resolve(validationResult("Provide at least one field to update (name, description, purpose, icon, navGroup, fields, axis, stageLabelMap, defaultCanonicalKey, defaultWorkflowStatus, validWorkflowStatuses, classificationCheck, classificationPriority, qualityCriteria, usageGuidance, or statusList)."));
|
|
6461
6453
|
}
|
|
6462
6454
|
return handleUpdate(
|
|
6463
6455
|
data.slug,
|
|
@@ -6467,7 +6459,7 @@ function registerCollectionsTools(server) {
|
|
|
6467
6459
|
data.icon,
|
|
6468
6460
|
data.navGroup,
|
|
6469
6461
|
data.fields,
|
|
6470
|
-
{ axis: data.axis, stageLabelMap: data.stageLabelMap, defaultCanonicalKey: data.defaultCanonicalKey, defaultWorkflowStatus: data.defaultWorkflowStatus, validWorkflowStatuses: data.validWorkflowStatuses, classificationCheck: data.classificationCheck, classificationPriority: data.classificationPriority, qualityCriteria: data.qualityCriteria, usageGuidance: data.usageGuidance }
|
|
6462
|
+
{ axis: data.axis, stageLabelMap: data.stageLabelMap, defaultCanonicalKey: data.defaultCanonicalKey, defaultWorkflowStatus: data.defaultWorkflowStatus, validWorkflowStatuses: data.validWorkflowStatuses, classificationCheck: data.classificationCheck, classificationPriority: data.classificationPriority, qualityCriteria: data.qualityCriteria, usageGuidance: data.usageGuidance, statusList: data.statusList }
|
|
6471
6463
|
);
|
|
6472
6464
|
},
|
|
6473
6465
|
audit: () => handleAudit(),
|
|
@@ -6483,7 +6475,7 @@ function registerCollectionsTools(server) {
|
|
|
6483
6475
|
"collections",
|
|
6484
6476
|
{
|
|
6485
6477
|
title: "Collections",
|
|
6486
|
-
description: "Manage knowledge collections and workspace labels. Eleven actions:\n\n- **list**: Browse all collections \u2014 glossary, business rules, tracking events, etc. Returns slug, name, description, and field schema. Use before capture to see what exists.\n- **describe**: Full documentation for a single collection. Returns field help text, option decision guides, usage guidance, examples, and cross-references. Use when you need to understand a collection's purpose, field semantics, or option values.\n- **update**: Update an existing collection's name, description, purpose, icon, navGroup, fields, or (non-system collections only) axis/stageLabelMap. Only provide the fields you want to change. Creating a NEW collection is not offered here \u2014 ask a platform admin to provision it, or enable the module ontology pack that owns the drawer.\n- **audit**: Health report for all workspace collections. Checks classification metadata, icon presence, displayHint coverage per field, and field schema gaps vs system definitions. Returns total collections, count with issues, and per-collection issue list.\n- **export**: Full system_collection_definitions export as JSON. Includes all classification metadata (thinkingLayer, classificationPriority, classificationCheck, timelineRole, governanceRole, governanceFunction, etc.). Admin only.\n- **label-list/label-create/label-update/label-delete/label-apply/label-remove**: manage workspace labels (absorbs the `labels` tool) \u2014 list all labels, create/update/delete a label, or apply/remove a label on an entry. Labels can be applied to any entry across any collection for cross-domain filtering.",
|
|
6478
|
+
description: "Manage knowledge collections and workspace labels. Eleven actions:\n\n- **list**: Browse all collections \u2014 glossary, business rules, tracking events, etc. Returns slug, name, description, and field schema. Use before capture to see what exists.\n- **describe**: Full documentation for a single collection. Returns field help text, option decision guides, usage guidance, examples, and cross-references. Use when you need to understand a collection's purpose, field semantics, or option values.\n- **update**: Update an existing collection's name, description, purpose, icon, navGroup, fields, statusList, or (non-system collections only) axis/stageLabelMap. Only provide the fields you want to change. Creating a NEW collection is not offered here \u2014 ask a platform admin to provision it, or enable the module ontology pack that owns the drawer.\n- **audit**: Health report for all workspace collections. Checks classification metadata, icon presence, displayHint coverage per field, and field schema gaps vs system definitions. Returns total collections, count with issues, and per-collection issue list.\n- **export**: Full system_collection_definitions export as JSON. Includes all classification metadata (thinkingLayer, classificationPriority, classificationCheck, timelineRole, governanceRole, governanceFunction, etc.). Admin only.\n- **label-list/label-create/label-update/label-delete/label-apply/label-remove**: manage workspace labels (absorbs the `labels` tool) \u2014 list all labels, create/update/delete a label, or apply/remove a label on an entry. Labels can be applied to any entry across any collection for cross-domain filtering.",
|
|
6487
6479
|
inputSchema: collectionsSchema,
|
|
6488
6480
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
|
|
6489
6481
|
},
|
|
@@ -6538,6 +6530,12 @@ Valid \`workflowStatus\` values for entries in this collection:
|
|
|
6538
6530
|
${col.validWorkflowStatuses.map((s) => `- ${s}`).join("\n")}`
|
|
6539
6531
|
);
|
|
6540
6532
|
}
|
|
6533
|
+
if (col.statusList && col.statusList.length > 0) {
|
|
6534
|
+
sections.push(`
|
|
6535
|
+
## Status Vocabulary
|
|
6536
|
+
|
|
6537
|
+
${col.statusList.map((s) => `- \`${s.label}\` \u2192 ${s.category}`).join("\n")}`);
|
|
6538
|
+
}
|
|
6541
6539
|
if (col.fields.length > 0) {
|
|
6542
6540
|
const fieldDocs = col.fields.map((f) => {
|
|
6543
6541
|
const parts = [];
|
|
@@ -6587,6 +6585,8 @@ ${refList}`);
|
|
|
6587
6585
|
usageGuidance: col.usageGuidance ?? null,
|
|
6588
6586
|
// WP-480 S2: null = unconstrained by design (STD-34), not "unknown".
|
|
6589
6587
|
validWorkflowStatuses: col.validWorkflowStatuses && col.validWorkflowStatuses.length > 0 ? col.validWorkflowStatuses : null,
|
|
6588
|
+
statusList: col.statusList && col.statusList.length > 0 ? col.statusList : null,
|
|
6589
|
+
// T2: same null-means-undeclared posture
|
|
6590
6590
|
fieldCount: col.fields.length,
|
|
6591
6591
|
fields: col.fields.map((f) => ({
|
|
6592
6592
|
key: f.key,
|
|
@@ -6660,7 +6660,7 @@ async function handleUpdate(slug, name, description, purpose, icon, navGroup, fi
|
|
|
6660
6660
|
invalidateCollectionCacheForScope();
|
|
6661
6661
|
invalidateProfileCacheForScope();
|
|
6662
6662
|
invalidateHubCacheForScope();
|
|
6663
|
-
const changes = [name && "name", description && "description", purpose && "purpose", icon && "icon", navGroup && "navGroup", fields && "fields", meta.axis !== void 0 && "axis", meta.stageLabelMap !== void 0 && "stageLabelMap", meta.defaultCanonicalKey !== void 0 && "defaultCanonicalKey", meta.defaultWorkflowStatus !== void 0 && "defaultWorkflowStatus", meta.validWorkflowStatuses !== void 0 && "validWorkflowStatuses", meta.classificationCheck !== void 0 && "classificationCheck", meta.classificationPriority !== void 0 && "classificationPriority", meta.qualityCriteria !== void 0 && "qualityCriteria", meta.usageGuidance !== void 0 && "usageGuidance"].filter(Boolean).join(", ");
|
|
6663
|
+
const changes = [name && "name", description && "description", purpose && "purpose", icon && "icon", navGroup && "navGroup", fields && "fields", meta.axis !== void 0 && "axis", meta.stageLabelMap !== void 0 && "stageLabelMap", meta.defaultCanonicalKey !== void 0 && "defaultCanonicalKey", meta.defaultWorkflowStatus !== void 0 && "defaultWorkflowStatus", meta.validWorkflowStatuses !== void 0 && "validWorkflowStatuses", meta.classificationCheck !== void 0 && "classificationCheck", meta.classificationPriority !== void 0 && "classificationPriority", meta.qualityCriteria !== void 0 && "qualityCriteria", meta.usageGuidance !== void 0 && "usageGuidance", meta.statusList !== void 0 && "statusList"].filter(Boolean).join(", ");
|
|
6664
6664
|
return {
|
|
6665
6665
|
content: [{
|
|
6666
6666
|
type: "text",
|
|
@@ -14224,28 +14224,12 @@ All entries: \`draft\` | \`active\` | \`deprecated\` | \`archived\`
|
|
|
14224
14224
|
- \`data\` param is merged (not replaced) \u2014 safe for partial updates
|
|
14225
14225
|
`;
|
|
14226
14226
|
|
|
14227
|
-
// src/resources/
|
|
14228
|
-
|
|
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) {
|
|
14227
|
+
// src/resources/orientationMarkdown.ts
|
|
14228
|
+
function buildOrientationMarkdown(collections, standards, businessRules, principles, directionLines) {
|
|
14248
14229
|
const sections = ["# Product Brain \u2014 Orientation"];
|
|
14230
|
+
if (directionLines && directionLines.length > 0) {
|
|
14231
|
+
sections.push(directionLines.join("\n"));
|
|
14232
|
+
}
|
|
14249
14233
|
sections.push(
|
|
14250
14234
|
"## 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
14235
|
);
|
|
@@ -14336,6 +14320,47 @@ Use \`entries action=update\` for post-creation adjustments (status changes, fie
|
|
|
14336
14320
|
);
|
|
14337
14321
|
return sections.join("\n\n---\n\n");
|
|
14338
14322
|
}
|
|
14323
|
+
async function buildOrientationResourceText(kernelQuery2) {
|
|
14324
|
+
const [collectionsResult, standardsResult, rulesResult, principlesResult, orientViewResult] = await Promise.allSettled([
|
|
14325
|
+
kernelQuery2("chain.listCollections"),
|
|
14326
|
+
kernelQuery2("chain.listEntries", { collectionSlug: "standards" }),
|
|
14327
|
+
kernelQuery2("chain.listEntries", { collectionSlug: "business-rules" }),
|
|
14328
|
+
kernelQuery2("chain.listEntries", { collectionSlug: "principles" }),
|
|
14329
|
+
kernelQuery2("chain.getOrientView", {
|
|
14330
|
+
tier: "summary",
|
|
14331
|
+
renderMode: "json",
|
|
14332
|
+
invocationPath: "unknown"
|
|
14333
|
+
})
|
|
14334
|
+
]);
|
|
14335
|
+
const collections = collectionsResult.status === "fulfilled" ? collectionsResult.value : null;
|
|
14336
|
+
const standards = standardsResult.status === "fulfilled" ? standardsResult.value : null;
|
|
14337
|
+
const businessRules = rulesResult.status === "fulfilled" ? rulesResult.value : null;
|
|
14338
|
+
const principles = principlesResult.status === "fulfilled" ? principlesResult.value : null;
|
|
14339
|
+
const orientView = orientViewResult.status === "fulfilled" ? orientViewResult.value : null;
|
|
14340
|
+
const directionLines = buildDirectionLines(orientView);
|
|
14341
|
+
return buildOrientationMarkdown(collections, standards, businessRules, principles, directionLines);
|
|
14342
|
+
}
|
|
14343
|
+
|
|
14344
|
+
// src/resources/index.ts
|
|
14345
|
+
var MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
14346
|
+
var UI_VIEW_BASE_CANDIDATES = [
|
|
14347
|
+
resolve4(MODULE_DIR, "views"),
|
|
14348
|
+
resolve4(MODULE_DIR, "..", "views"),
|
|
14349
|
+
resolve4(MODULE_DIR, "..", "..", "dist", "views"),
|
|
14350
|
+
resolve4(MODULE_DIR, "..", "..", "..", "mcp-views", "dist")
|
|
14351
|
+
];
|
|
14352
|
+
function formatEntryMarkdown(entry) {
|
|
14353
|
+
const id = entry.entryId ? `${entry.entryId}: ` : "";
|
|
14354
|
+
const lines = [`## ${id}${entry.name} [${entry.status}]`];
|
|
14355
|
+
if (entry.data && typeof entry.data === "object") {
|
|
14356
|
+
for (const [key, val] of Object.entries(entry.data)) {
|
|
14357
|
+
if (val && key !== "rawData") {
|
|
14358
|
+
lines.push(`**${key}**: ${typeof val === "string" ? val : JSON.stringify(val)}`);
|
|
14359
|
+
}
|
|
14360
|
+
}
|
|
14361
|
+
}
|
|
14362
|
+
return lines.join("\n");
|
|
14363
|
+
}
|
|
14339
14364
|
function registerResources(server) {
|
|
14340
14365
|
server.resource(
|
|
14341
14366
|
"agent-cheatsheet",
|
|
@@ -14351,35 +14376,9 @@ function registerResources(server) {
|
|
|
14351
14376
|
server.resource(
|
|
14352
14377
|
"chain-orientation",
|
|
14353
14378
|
"productbrain://orientation",
|
|
14354
|
-
async (uri) => {
|
|
14355
|
-
|
|
14356
|
-
|
|
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
|
-
}
|
|
14379
|
+
async (uri) => ({
|
|
14380
|
+
contents: [{ uri: uri.href, text: await buildOrientationResourceText(kernelQuery), mimeType: "text/markdown" }]
|
|
14381
|
+
})
|
|
14383
14382
|
);
|
|
14384
14383
|
server.resource(
|
|
14385
14384
|
"chain-terminology",
|
|
@@ -14991,4 +14990,4 @@ export {
|
|
|
14991
14990
|
createProductBrainServer,
|
|
14992
14991
|
initFeatureFlags
|
|
14993
14992
|
};
|
|
14994
|
-
//# sourceMappingURL=chunk-
|
|
14993
|
+
//# sourceMappingURL=chunk-ONWBWDTM.js.map
|