@productbrain/mcp 0.0.1-beta.14530 → 0.0.1-beta.14536

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.
@@ -219,10 +219,79 @@ function servedSchema(schema) {
219
219
  return schema;
220
220
  }
221
221
 
222
+ // src/lib/limits.ts
223
+ var ENTRY_BODY_MAX_CHARS = 15e4;
224
+ var RULE_TITLE_MAX_BYTES = 110;
225
+ var ENTRY_NAME_CAPS = { outcome: 40, working: 80, rule: RULE_TITLE_MAX_BYTES, direction: 250, other: 250 };
226
+ var ENTRY_NAME_MAX_CHARS = Math.max(...Object.values(ENTRY_NAME_CAPS));
227
+ var NAME_KINDS = {
228
+ decisions: { word: "decision", tier: "working" },
229
+ tensions: { word: "tension", tier: "working" },
230
+ insights: { word: "insight", tier: "working" },
231
+ tasks: { word: "task", tier: "working" },
232
+ questions: { word: "question", tier: "working" },
233
+ "work-packages": { word: "work package", tier: "working" },
234
+ purpose: { word: "purpose", tier: "direction" },
235
+ vision: { word: "vision", tier: "direction" },
236
+ strategy: { word: "strategy", tier: "direction" },
237
+ objectives: { word: "objective", tier: "outcome" },
238
+ "key-results": { word: "key result", tier: "outcome" },
239
+ rules: { word: "rule", tier: "rule" },
240
+ teams: { word: "team", tier: "other" },
241
+ labels: { word: "label", tier: "other" }
242
+ };
243
+ function isAcronym(word) {
244
+ return /^(?=[0-9]*[A-Z])[A-Z0-9]{2,}s?$/.test(word);
245
+ }
246
+ function withArticle(word) {
247
+ const first = word.split(/[^A-Za-z0-9]/)[0] ?? "";
248
+ const vowelSound = isAcronym(first) ? /^[AEFHILMNORSX]/.test(first) : /^[aeiou]/i.test(word);
249
+ return `${vowelSound ? "an" : "a"} ${word}`;
250
+ }
251
+ function kindsWithCap(cap) {
252
+ const words = Object.values(NAME_KINDS).filter((k) => ENTRY_NAME_CAPS[k.tier] === cap && k.tier !== "other").map((k) => k.word);
253
+ return words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} or ${words[words.length - 1]}`;
254
+ }
255
+ function nameLimitsSentence() {
256
+ const caps = [...new Set(Object.values(NAME_KINDS).map((k) => ENTRY_NAME_CAPS[k.tier]))].filter((cap) => cap !== ENTRY_NAME_CAPS.other).sort((a, b) => a - b);
257
+ const clauses = caps.map((cap, i) => `${cap}${cap === ENTRY_NAME_CAPS.rule ? " bytes" : i === 0 ? " characters" : ""} for ${withArticle(kindsWithCap(cap))}`);
258
+ return `At most ${[...clauses, `${ENTRY_NAME_CAPS.other} for any other kind`].join(", ")}.`;
259
+ }
260
+ var ENTRY_NAME_HELP = `A short name. ${nameLimitsSentence()}`;
261
+ var ENTRY_BODY_CAPS = {
262
+ "key-results": { word: "key result", max: 4e3 }
263
+ };
264
+ var KEY_RESULT_BODY_HELP = `For a key result, open with what counts toward it; at most ${ENTRY_BODY_CAPS["key-results"].max} characters.`;
265
+ var ENTRY_BODY_HELP = `The detail, in Markdown. ${KEY_RESULT_BODY_HELP}`;
266
+ var SOURCE_EXCERPT_MAX_CHARS = 4e3;
267
+ var LABEL_DESCRIPTION_MAX_CHARS = 2e3;
268
+ var REASON_MAX_LENGTH = 200;
269
+ var REASON_LENGTH_FIX = `Keep the reason to one line of at most ${REASON_MAX_LENGTH} characters.`;
270
+ var REASON_WITHOUT_REPLACES = "A reason goes only with the entry this one replaces. Nothing was accepted.";
271
+ var RELATION_BATCH_MAX = 25;
272
+ var BATCH_GET_CHUNK = 4;
273
+ async function readInChunks(ids, read) {
274
+ const chunks = Array.from({ length: Math.ceil(ids.length / BATCH_GET_CHUNK) }, (_, i) => ids.slice(i * BATCH_GET_CHUNK, (i + 1) * BATCH_GET_CHUNK));
275
+ return (await Promise.all(chunks.map(read))).flat();
276
+ }
277
+ var ANSWER_TEXT_MAX_CHARS = 4e3;
278
+ var ANSWER_REFUSAL_FIX = "Shorten the answer.";
279
+ function answerTextRefusal(answer2) {
280
+ if (answer2.length <= ANSWER_TEXT_MAX_CHARS) return null;
281
+ return `Answer is ${answer2.length} characters; the cap for an answer is ${ANSWER_TEXT_MAX_CHARS}. ${ANSWER_REFUSAL_FIX}`;
282
+ }
283
+ var ANSWER_POINTER_ONLY_REFUSAL = "An answer is written in full: write the answer, and add the link beside it.";
284
+ var ANSWER_EMPTY_REFUSAL = "Answer text cannot be empty.";
285
+ var ANSWER_TEXT_HELP = `The answer in full, at most ${ANSWER_TEXT_MAX_CHARS.toLocaleString("en-US")} characters.`;
286
+ var ANSWER_ENTRY_HELP = "Link an entry beside the answer text; it resolves the question. Never instead of the text.";
287
+ function listCutLine(shown) {
288
+ return shown > 0 ? `Only the first ${shown} entries were read.` : "No entries matched in the part of the list that was read.";
289
+ }
290
+ var LIST_COUNTS_OF_ROWS_READ = "The counts here are of the rows read.";
291
+
222
292
  // src/lib/checklist.ts
223
293
  var FIRST_SPINE_SUBJECT = "work_package";
224
294
  var kindWord = (kind) => kind.replace(/_/g, " ");
225
- var withArticle = (word) => `${/^[aeiou]/i.test(word) ? "an" : "a"} ${word}`;
226
295
  var spineSubject = (kind, label2 = kindWord) => {
227
296
  const words = withArticle(label2(kind));
228
297
  return words[0].toUpperCase() + words.slice(1);
@@ -394,68 +463,6 @@ function resolveEffectiveCollection(result2, preview, fallbackCollection) {
394
463
  return preview && result2 && isPreviewCreateEntryResult(result2) ? result2.collection ?? fallbackCollection : fallbackCollection;
395
464
  }
396
465
 
397
- // src/lib/limits.ts
398
- var ENTRY_BODY_MAX_CHARS = 15e4;
399
- var RULE_TITLE_MAX_BYTES = 110;
400
- var ENTRY_NAME_CAPS = { outcome: 40, working: 80, rule: RULE_TITLE_MAX_BYTES, direction: 250, other: 250 };
401
- var ENTRY_NAME_MAX_CHARS = Math.max(...Object.values(ENTRY_NAME_CAPS));
402
- var NAME_KINDS = {
403
- decisions: { word: "decision", tier: "working" },
404
- tensions: { word: "tension", tier: "working" },
405
- insights: { word: "insight", tier: "working" },
406
- tasks: { word: "task", tier: "working" },
407
- questions: { word: "question", tier: "working" },
408
- "work-packages": { word: "work package", tier: "working" },
409
- purpose: { word: "purpose", tier: "direction" },
410
- vision: { word: "vision", tier: "direction" },
411
- strategy: { word: "strategy", tier: "direction" },
412
- objectives: { word: "objective", tier: "outcome" },
413
- "key-results": { word: "key result", tier: "outcome" },
414
- rules: { word: "rule", tier: "rule" },
415
- teams: { word: "team", tier: "other" },
416
- labels: { word: "label", tier: "other" }
417
- };
418
- function kindsWithCap(cap) {
419
- const words = Object.values(NAME_KINDS).filter((k) => ENTRY_NAME_CAPS[k.tier] === cap && k.tier !== "other").map((k) => k.word);
420
- return words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} or ${words[words.length - 1]}`;
421
- }
422
- function nameLimitsSentence() {
423
- const caps = [...new Set(Object.values(NAME_KINDS).map((k) => ENTRY_NAME_CAPS[k.tier]))].filter((cap) => cap !== ENTRY_NAME_CAPS.other).sort((a, b) => a - b);
424
- const clauses = caps.map((cap, i) => `${cap}${cap === ENTRY_NAME_CAPS.rule ? " bytes" : i === 0 ? " characters" : ""} for ${/^[aeiou]/.test(kindsWithCap(cap)) ? "an" : "a"} ${kindsWithCap(cap)}`);
425
- return `At most ${[...clauses, `${ENTRY_NAME_CAPS.other} for any other kind`].join(", ")}.`;
426
- }
427
- var ENTRY_NAME_HELP = `A short name. ${nameLimitsSentence()}`;
428
- var ENTRY_BODY_CAPS = {
429
- "key-results": { word: "key result", max: 4e3 }
430
- };
431
- var KEY_RESULT_BODY_HELP = `For a key result, open with what counts toward it; at most ${ENTRY_BODY_CAPS["key-results"].max} characters.`;
432
- var ENTRY_BODY_HELP = `The detail, in Markdown. ${KEY_RESULT_BODY_HELP}`;
433
- var SOURCE_EXCERPT_MAX_CHARS = 4e3;
434
- var LABEL_DESCRIPTION_MAX_CHARS = 2e3;
435
- var REASON_MAX_LENGTH = 200;
436
- var REASON_LENGTH_FIX = `Keep the reason to one line of at most ${REASON_MAX_LENGTH} characters.`;
437
- var REASON_WITHOUT_REPLACES = "A reason goes only with the entry this one replaces. Nothing was accepted.";
438
- var RELATION_BATCH_MAX = 25;
439
- var BATCH_GET_CHUNK = 4;
440
- async function readInChunks(ids, read) {
441
- const chunks = Array.from({ length: Math.ceil(ids.length / BATCH_GET_CHUNK) }, (_, i) => ids.slice(i * BATCH_GET_CHUNK, (i + 1) * BATCH_GET_CHUNK));
442
- return (await Promise.all(chunks.map(read))).flat();
443
- }
444
- var ANSWER_TEXT_MAX_CHARS = 4e3;
445
- var ANSWER_REFUSAL_FIX = "Shorten the answer.";
446
- function answerTextRefusal(answer2) {
447
- if (answer2.length <= ANSWER_TEXT_MAX_CHARS) return null;
448
- return `Answer is ${answer2.length} characters; the cap for an answer is ${ANSWER_TEXT_MAX_CHARS}. ${ANSWER_REFUSAL_FIX}`;
449
- }
450
- var ANSWER_POINTER_ONLY_REFUSAL = "An answer is written in full: write the answer, and add the link beside it.";
451
- var ANSWER_EMPTY_REFUSAL = "Answer text cannot be empty.";
452
- var ANSWER_TEXT_HELP = `The answer in full, at most ${ANSWER_TEXT_MAX_CHARS.toLocaleString("en-US")} characters.`;
453
- var ANSWER_ENTRY_HELP = "Link an entry beside the answer text; it resolves the question. Never instead of the text.";
454
- function listCutLine(shown) {
455
- return shown > 0 ? `Only the first ${shown} entries were read.` : "No entries matched in the part of the list that was read.";
456
- }
457
- var LIST_COUNTS_OF_ROWS_READ = "The counts here are of the rows read.";
458
-
459
466
  // src/lib/listEntries.ts
460
467
  var NARROW_IN_MCP = "Narrow it with context action=list collection=<slug> or status=<word>.";
461
468
  async function listEntriesWithCut(args, next = LIST_COUNTS_OF_ROWS_READ) {
@@ -574,33 +581,16 @@ function readEntryBody(data, proseKey) {
574
581
  }
575
582
 
576
583
  // src/tools/knowledge-helpers.ts
577
- var EPISTEMIC_COLLECTIONS = /* @__PURE__ */ new Set(["insights", "assumptions"]);
578
584
  function deriveEpistemicStatus(entry) {
579
585
  const coll = entry.collectionName?.toLowerCase();
580
- if (!coll || !EPISTEMIC_COLLECTIONS.has(coll)) return null;
586
+ if (coll !== "insights") return null;
581
587
  const relations = entry.relations ?? [];
582
588
  const hasValidates = relations.some(
583
589
  (r) => r.type === "validates" && r.direction === "incoming"
584
590
  );
585
- const hasInvalidates = relations.some(
586
- (r) => r.type === "invalidates" && r.direction === "incoming"
587
- );
588
591
  const evidenceCount = relations.filter(
589
592
  (r) => (r.type === "validates" || r.type === "invalidates") && r.direction === "incoming"
590
593
  ).length;
591
- if (coll === "assumptions") {
592
- const ws2 = entry.workflowStatus;
593
- if (ws2 === "invalidated" || hasInvalidates) {
594
- return { level: "invalidated", reason: "Disproved by linked counter-evidence" };
595
- }
596
- if (ws2 === "validated" || hasValidates && ws2 !== "untested") {
597
- return { level: "validated", reason: `${evidenceCount} evidence link${evidenceCount !== 1 ? "s" : ""}` };
598
- }
599
- if (ws2 === "testing") {
600
- return { level: "testing", reason: "Experiment in progress" };
601
- }
602
- return { level: "untested", reason: "No evidence linked", action: 'Link evidence via `relations action=create type="validates"`' };
603
- }
604
594
  const ws = entry.workflowStatus;
605
595
  if (ws === "validated" && hasValidates) {
606
596
  return { level: "validated", reason: `${evidenceCount} evidence link${evidenceCount !== 1 ? "s" : ""}` };
@@ -615,7 +605,7 @@ function deriveEpistemicStatus(entry) {
615
605
  };
616
606
  }
617
607
  function formatEpistemicLine(es) {
618
- const icon = es.level === "validated" ? "\u2713" : es.level === "evidenced" ? "\u25CE" : es.level === "hypothesis" ? "\u25B3" : es.level === "untested" ? "?" : es.level === "testing" ? "\u25CE" : "\u2715";
608
+ const icon = es.level === "validated" ? "\u2713" : es.level === "evidenced" ? "\u25CE" : "\u25B3";
619
609
  const suffix = es.action ? ` ${es.action}` : "";
620
610
  return `**Confidence:** ${icon} ${es.level} \u2014 ${es.reason}.${suffix}`;
621
611
  }
@@ -2151,7 +2141,7 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
2151
2141
  const replaced = result2?.replaced;
2152
2142
  if (replaced) lines.push("", replaced.line, ...replaced.nextAccept ? [`Next: ${acceptCall(replaced.nextAccept)}.`] : []);
2153
2143
  const epistemic = deriveEpistemicStatus(toEpistemicInput(entry));
2154
- if (epistemic && (epistemic.level === "hypothesis" || epistemic.level === "untested")) {
2144
+ if (epistemic?.level === "hypothesis") {
2155
2145
  lines.push("");
2156
2146
  lines.push(`\u26A0 ${formatEpistemicLine(epistemic)}`);
2157
2147
  if (epistemic.action) {
@@ -4647,7 +4637,6 @@ function annotateStaleNames(text) {
4647
4637
  function epistemicCollectionHint(collectionName) {
4648
4638
  const lc = collectionName.toLowerCase();
4649
4639
  if (lc === "insights") return " \u2014 _verify confidence with `context action=get`_";
4650
- if (lc === "assumptions") return " \u2014 _check evidence strength with `context action=get`_";
4651
4640
  return "";
4652
4641
  }
4653
4642
  var CONTEXT_ACTIONS = [...LOOKUP_ACTIONS, "gather", "build", "neighborhood", "changes", "chain", "cross-cut", "incremental", "brief"];
@@ -6939,7 +6928,7 @@ function formatBetConstellationLines(constellationEntries, constellationBetName)
6939
6928
  const betName = constellationBetName ?? "Matched work package";
6940
6929
  const lines = [
6941
6930
  `## Work Package Constellation \u2014 ${betName}`,
6942
- "_Decisions, tensions, and features related to the matched work package._",
6931
+ "_Decisions and tensions related to the matched work package._",
6943
6932
  ""
6944
6933
  ];
6945
6934
  const bySlug = /* @__PURE__ */ new Map();
@@ -6948,7 +6937,7 @@ function formatBetConstellationLines(constellationEntries, constellationBetName)
6948
6937
  list.push(e);
6949
6938
  bySlug.set(e.collectionSlug, list);
6950
6939
  }
6951
- const order = ["decisions", "tensions", "features"];
6940
+ const order = ["decisions", "tensions"];
6952
6941
  for (const slug of order) {
6953
6942
  const entries = bySlug.get(slug);
6954
6943
  if (!entries?.length) continue;
@@ -12425,4 +12414,4 @@ export {
12425
12414
  SERVER_VERSION,
12426
12415
  createProductBrainServer
12427
12416
  };
12428
- //# sourceMappingURL=chunk-WZYAEAIO.js.map
12417
+ //# sourceMappingURL=chunk-QKL3WYAK.js.map