@productbrain/mcp 0.0.1-beta.14531 → 0.0.1-beta.14543
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,83 @@ 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
|
+
kpis: { word: "KPI", tier: "outcome" },
|
|
240
|
+
// TASK-1683 (DEC-2655): a KPI's name is one label line, as a key result's
|
|
241
|
+
sops: { word: "SOP", tier: "working" },
|
|
242
|
+
rules: { word: "rule", tier: "rule" },
|
|
243
|
+
teams: { word: "team", tier: "other" },
|
|
244
|
+
labels: { word: "label", tier: "other" }
|
|
245
|
+
};
|
|
246
|
+
function isAcronym(word) {
|
|
247
|
+
return /^(?=[0-9]*[A-Z])[A-Z0-9]{2,}s?$/.test(word);
|
|
248
|
+
}
|
|
249
|
+
var alphanumericCore = (token) => token.match(/[A-Za-z0-9]+/)?.[0] ?? "";
|
|
250
|
+
function withArticle(word) {
|
|
251
|
+
const first = alphanumericCore(word);
|
|
252
|
+
const vowelSound = isAcronym(first) ? /^[AEFHILMNORSX]/.test(first) : /^[aeiou]/i.test(word);
|
|
253
|
+
return `${vowelSound ? "an" : "a"} ${word}`;
|
|
254
|
+
}
|
|
255
|
+
function kindsWithCap(cap) {
|
|
256
|
+
const words = Object.values(NAME_KINDS).filter((k) => ENTRY_NAME_CAPS[k.tier] === cap && k.tier !== "other").map((k) => k.word);
|
|
257
|
+
return words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} or ${words[words.length - 1]}`;
|
|
258
|
+
}
|
|
259
|
+
function nameLimitsSentence() {
|
|
260
|
+
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);
|
|
261
|
+
const clauses = caps.map((cap, i) => `${cap}${cap === ENTRY_NAME_CAPS.rule ? " bytes" : i === 0 ? " characters" : ""} for ${withArticle(kindsWithCap(cap))}`);
|
|
262
|
+
return `At most ${[...clauses, `${ENTRY_NAME_CAPS.other} for any other kind`].join(", ")}.`;
|
|
263
|
+
}
|
|
264
|
+
var ENTRY_NAME_HELP = `A short name. ${nameLimitsSentence()}`;
|
|
265
|
+
var ENTRY_BODY_CAPS = {
|
|
266
|
+
"key-results": { word: "key result", max: 4e3 }
|
|
267
|
+
};
|
|
268
|
+
var KEY_RESULT_BODY_HELP = `For a key result, open with what counts toward it; at most ${ENTRY_BODY_CAPS["key-results"].max} characters.`;
|
|
269
|
+
var ENTRY_BODY_HELP = `The detail, in Markdown. ${KEY_RESULT_BODY_HELP}`;
|
|
270
|
+
var SOURCE_EXCERPT_MAX_CHARS = 4e3;
|
|
271
|
+
var LABEL_DESCRIPTION_MAX_CHARS = 2e3;
|
|
272
|
+
var REASON_MAX_LENGTH = 200;
|
|
273
|
+
var REASON_LENGTH_FIX = `Keep the reason to one line of at most ${REASON_MAX_LENGTH} characters.`;
|
|
274
|
+
var REASON_WITHOUT_REPLACES = "A reason goes only with the entry this one replaces. Nothing was accepted.";
|
|
275
|
+
var RELATION_BATCH_MAX = 25;
|
|
276
|
+
var BATCH_GET_CHUNK = 4;
|
|
277
|
+
async function readInChunks(ids, read) {
|
|
278
|
+
const chunks = Array.from({ length: Math.ceil(ids.length / BATCH_GET_CHUNK) }, (_, i) => ids.slice(i * BATCH_GET_CHUNK, (i + 1) * BATCH_GET_CHUNK));
|
|
279
|
+
return (await Promise.all(chunks.map(read))).flat();
|
|
280
|
+
}
|
|
281
|
+
var ANSWER_TEXT_MAX_CHARS = 4e3;
|
|
282
|
+
var ANSWER_REFUSAL_FIX = "Shorten the answer.";
|
|
283
|
+
function answerTextRefusal(answer2) {
|
|
284
|
+
if (answer2.length <= ANSWER_TEXT_MAX_CHARS) return null;
|
|
285
|
+
return `Answer is ${answer2.length} characters; the cap for an answer is ${ANSWER_TEXT_MAX_CHARS}. ${ANSWER_REFUSAL_FIX}`;
|
|
286
|
+
}
|
|
287
|
+
var ANSWER_POINTER_ONLY_REFUSAL = "An answer is written in full: write the answer, and add the link beside it.";
|
|
288
|
+
var ANSWER_EMPTY_REFUSAL = "Answer text cannot be empty.";
|
|
289
|
+
var ANSWER_TEXT_HELP = `The answer in full, at most ${ANSWER_TEXT_MAX_CHARS.toLocaleString("en-US")} characters.`;
|
|
290
|
+
var ANSWER_ENTRY_HELP = "Link an entry beside the answer text; it resolves the question. Never instead of the text.";
|
|
291
|
+
function listCutLine(shown) {
|
|
292
|
+
return shown > 0 ? `Only the first ${shown} entries were read.` : "No entries matched in the part of the list that was read.";
|
|
293
|
+
}
|
|
294
|
+
var LIST_COUNTS_OF_ROWS_READ = "The counts here are of the rows read.";
|
|
295
|
+
|
|
222
296
|
// src/lib/checklist.ts
|
|
223
297
|
var FIRST_SPINE_SUBJECT = "work_package";
|
|
224
298
|
var kindWord = (kind) => kind.replace(/_/g, " ");
|
|
225
|
-
var withArticle = (word) => `${/^[aeiou]/i.test(word) ? "an" : "a"} ${word}`;
|
|
226
299
|
var spineSubject = (kind, label2 = kindWord) => {
|
|
227
300
|
const words = withArticle(label2(kind));
|
|
228
301
|
return words[0].toUpperCase() + words.slice(1);
|
|
@@ -394,68 +467,6 @@ function resolveEffectiveCollection(result2, preview, fallbackCollection) {
|
|
|
394
467
|
return preview && result2 && isPreviewCreateEntryResult(result2) ? result2.collection ?? fallbackCollection : fallbackCollection;
|
|
395
468
|
}
|
|
396
469
|
|
|
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
470
|
// src/lib/listEntries.ts
|
|
460
471
|
var NARROW_IN_MCP = "Narrow it with context action=list collection=<slug> or status=<word>.";
|
|
461
472
|
async function listEntriesWithCut(args, next = LIST_COUNTS_OF_ROWS_READ) {
|
|
@@ -12407,4 +12418,4 @@ export {
|
|
|
12407
12418
|
SERVER_VERSION,
|
|
12408
12419
|
createProductBrainServer
|
|
12409
12420
|
};
|
|
12410
|
-
//# sourceMappingURL=chunk-
|
|
12421
|
+
//# sourceMappingURL=chunk-VHTLMRKD.js.map
|