@productbrain/mcp 0.0.1-beta.15511 → 0.0.1-beta.15522
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.
|
@@ -3856,8 +3856,8 @@ var TASKS_UNDER_WORDS = {
|
|
|
3856
3856
|
notTasks: (count, atLeast = false) => `${count}${atLeast ? "+" : ""} other linked ${count === 1 && !atLeast ? "entry is not a task" : "entries are not tasks"}.`,
|
|
3857
3857
|
/** Links come back oldest first, so what the list leaves out is the most recently linked; only tasks the viewer may read count. */
|
|
3858
3858
|
cut: ({ unread, atLeast }) => atLeast ? unread === 0 ? "The read stopped early; recently linked tasks may not be listed." : `At least ${unread} of the most recently linked tasks are not listed.` : unread === 1 ? "The most recently linked task is not listed." : `The ${unread} most recently linked tasks are not listed.`,
|
|
3859
|
-
/** The cut's second sentence
|
|
3860
|
-
cutStep:
|
|
3859
|
+
/** The cut's second sentence, ending in the surface's whole read of every part_of link: pb constellation, or context action=get. */
|
|
3860
|
+
cutStep: (command) => `Every task under it, by name: ${command}`,
|
|
3861
3861
|
/** The read's refusal when an entry is named with a role or a page: the entry's list is one whole read. Each surface adds aloneFix. */
|
|
3862
3862
|
alone: "A task list by entry takes no role and no cursor.",
|
|
3863
3863
|
aloneFix: (command) => `List it without them: ${command}`
|
|
@@ -3868,17 +3868,44 @@ function taskUnderRowText(row) {
|
|
|
3868
3868
|
}
|
|
3869
3869
|
function tasksUnderLines(list, surface) {
|
|
3870
3870
|
const w = TASKS_UNDER_WORDS, id = list.parent.entryId ?? list.parent.name;
|
|
3871
|
-
const
|
|
3871
|
+
const whole = surface.surface === "cli" ? `pb constellation ${id}` : `context action=get entryId="${id}"`, step = w.cutStep(whole);
|
|
3872
3872
|
const lead = list.rows.length > 0 ? [w.count(list.rows.length, list.statusCounts)] : list.cut ? [] : [w.empty(list.parent)];
|
|
3873
3873
|
return [
|
|
3874
3874
|
surface.heading(w.heading(list.parent)),
|
|
3875
3875
|
...lead,
|
|
3876
3876
|
...list.rows.map((row) => `${surface.bullet}${taskUnderRowText(row)}`),
|
|
3877
|
-
...list.notTasks > 0 ? [w.notTasks(list.notTasks, list.cut?.atLeast)] : [],
|
|
3877
|
+
...list.notTasks > 0 ? [w.notTasks(list.notTasks, list.cut?.atLeast), ` ${whole}`] : [],
|
|
3878
3878
|
...list.cut ? [`${w.cut(list.cut)} ${step}`] : []
|
|
3879
3879
|
];
|
|
3880
3880
|
}
|
|
3881
3881
|
|
|
3882
|
+
// src/lib/walkCutWords.ts
|
|
3883
|
+
var WALK_LIMITS = { perEntry: 10, entries: 100, named: 5 };
|
|
3884
|
+
var WALK_CUT_WORDS = {
|
|
3885
|
+
/** The mark both walk headers put after the counts when the walk cut. */
|
|
3886
|
+
truncated: "(TRUNCATED)",
|
|
3887
|
+
sure: (count) => `${count} ${count === 1 ? "entry has" : "entries have"} more links than the walk follows (${WALK_LIMITS.perEntry} per entry).`,
|
|
3888
|
+
unsure: (count) => `${count} ${count === 1 ? "entry may" : "entries may"} have more links; the walk stopped reading early.`,
|
|
3889
|
+
entry: (entry) => ` ${entry.name} (${entry.entryId})`,
|
|
3890
|
+
/** The rest of a group past `named`, then where every one is named on that surface (unnamedRest). */
|
|
3891
|
+
unnamed: (count, rest) => `${count} more not named. ${rest}`,
|
|
3892
|
+
unnamedRest: { cli: "Rerun it with --json to name every one.", mcp: "This answer's structured content names every one." },
|
|
3893
|
+
/** The node cap; each surface ends it with its own flags. */
|
|
3894
|
+
total: (narrow) => `Stopped at ${WALK_LIMITS.entries} entries. Narrow it with ${narrow}.`
|
|
3895
|
+
};
|
|
3896
|
+
function walkCutLines(cut, nodeCapped, surface) {
|
|
3897
|
+
const w = WALK_CUT_WORDS, lines = [];
|
|
3898
|
+
for (const sure of [true, false]) {
|
|
3899
|
+
const group = cut.filter((entry) => entry.sure === sure);
|
|
3900
|
+
if (group.length === 0) continue;
|
|
3901
|
+
lines.push(sure ? w.sure(group.length) : w.unsure(group.length));
|
|
3902
|
+
for (const entry of group.slice(0, WALK_LIMITS.named)) lines.push(w.entry(entry), ` ${surface.step(entry)}`);
|
|
3903
|
+
if (group.length > WALK_LIMITS.named) lines.push(w.unnamed(group.length - WALK_LIMITS.named, surface.rest));
|
|
3904
|
+
}
|
|
3905
|
+
if (nodeCapped) lines.push(w.total(surface.narrow));
|
|
3906
|
+
return lines;
|
|
3907
|
+
}
|
|
3908
|
+
|
|
3882
3909
|
// src/tools/contextLookups.ts
|
|
3883
3910
|
import { z as z19 } from "zod/v3";
|
|
3884
3911
|
|
|
@@ -5604,7 +5631,7 @@ async function handleChainWalk(entryId, direction, maxHops, relationType2) {
|
|
|
5604
5631
|
if (result2.error) {
|
|
5605
5632
|
return notFoundResult(entryId);
|
|
5606
5633
|
}
|
|
5607
|
-
if (result2.totalNodes <= 1) {
|
|
5634
|
+
if (result2.totalNodes <= 1 && !result2.truncated) {
|
|
5608
5635
|
return {
|
|
5609
5636
|
content: [{
|
|
5610
5637
|
type: "text",
|
|
@@ -5623,7 +5650,7 @@ Try \`context action=chain entryId="${entryId}" direction="${direction === "outg
|
|
|
5623
5650
|
const lines = [
|
|
5624
5651
|
`# Chain Walk: ${entryId}`,
|
|
5625
5652
|
`**Direction:** ${direction} | **Depth:** ${clampedHops}${relationType2 ? ` | **Type filter:** ${relationType2}` : ""}`,
|
|
5626
|
-
`**Nodes:** ${result2.totalNodes}${result2.truncated ?
|
|
5653
|
+
`**Nodes:** ${result2.totalNodes}${result2.truncated ? ` ${WALK_CUT_WORDS.truncated}` : ""} | **Edges:** ${result2.edges.length} | **Cycles:** ${result2.cycles.length}`,
|
|
5627
5654
|
""
|
|
5628
5655
|
];
|
|
5629
5656
|
const maxDepth = Math.max(...result2.nodes.map((n) => n.depth));
|
|
@@ -5651,9 +5678,9 @@ Try \`context action=chain entryId="${entryId}" direction="${direction === "outg
|
|
|
5651
5678
|
if (result2.snapshotWarning) {
|
|
5652
5679
|
lines.push("_Note: This traversal spans multiple reads (Convex action). Data consistency is not guaranteed across hops (TEN-1029)._");
|
|
5653
5680
|
}
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
}
|
|
5681
|
+
const step = (e) => `context action=${e.reach === "tasks" ? "tasks" : "get"} entryId="${e.entryId}"`;
|
|
5682
|
+
const capped = result2.nodeCapped ?? (result2.cutEntries === void 0 && result2.truncated);
|
|
5683
|
+
lines.push(...walkCutLines(result2.cutEntries ?? [], capped, { step, narrow: "relationType or a lower maxHops", rest: WALK_CUT_WORDS.unnamedRest.mcp }));
|
|
5657
5684
|
return {
|
|
5658
5685
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
5659
5686
|
structuredContent: success(
|
|
@@ -12615,4 +12642,4 @@ export {
|
|
|
12615
12642
|
SERVER_VERSION,
|
|
12616
12643
|
createProductBrainServer
|
|
12617
12644
|
};
|
|
12618
|
-
//# sourceMappingURL=chunk-
|
|
12645
|
+
//# sourceMappingURL=chunk-7XSVYYPN.js.map
|