@productbrain/mcp 0.0.1-beta.16127 → 0.0.1-beta.16133
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.
- package/dist/{chunk-VIEAV355.js → chunk-ROXPEU6O.js} +30 -393
- package/dist/chunk-ROXPEU6O.js.map +1 -0
- package/dist/{chunk-IZCPANIR.js → chunk-Y73LQNAA.js} +435 -2
- package/dist/chunk-Y73LQNAA.js.map +1 -0
- package/dist/cli/index.js +1 -1
- package/dist/http.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{setup-66U3NDJT.js → setup-56TYMGDW.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-IZCPANIR.js.map +0 -1
- package/dist/chunk-VIEAV355.js.map +0 -1
- /package/dist/{setup-66U3NDJT.js.map → setup-56TYMGDW.js.map} +0 -0
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ENTRY_STATUS_READ_WORDS,
|
|
3
|
+
ENTRY_STATUS_WRITE_WORDS,
|
|
2
4
|
KEY_SCOPE_WORDS,
|
|
3
5
|
KPI_KIND,
|
|
4
6
|
KernelCallError,
|
|
7
|
+
NO_PRIORITY,
|
|
8
|
+
OPEN_TASK_LIST_WORDS,
|
|
5
9
|
ORGANISATION_VALIDATION_REFUSALS,
|
|
6
10
|
PASS_SESSION_ID,
|
|
7
11
|
PASTE_NOW,
|
|
8
12
|
PERSON_STATUS_WORDS,
|
|
13
|
+
PRIORITY_LEVELS,
|
|
9
14
|
QUESTION_LINE_NEXT,
|
|
10
15
|
QUESTION_LINE_WORDS,
|
|
11
16
|
QUESTION_SEAT_WORDS,
|
|
12
17
|
QUESTION_TEAM_NEXT,
|
|
13
18
|
RIGHT_VERB_WORDS,
|
|
19
|
+
SEAT_DRAFTS_CUT_WORDS,
|
|
14
20
|
SPINE_RUNG_SEQUENCE,
|
|
15
21
|
START_DOORS,
|
|
16
22
|
START_NOTES_NOT_LOADED_LINE,
|
|
23
|
+
TASKS_UNDER_WORDS,
|
|
24
|
+
TRUST_STATUS_LABELS,
|
|
17
25
|
WORKSPACE_CLOSED,
|
|
26
|
+
WORK_PACKAGE_LIST_WORDS,
|
|
18
27
|
acceptCall,
|
|
19
28
|
appUrl,
|
|
20
29
|
authorityRecovery,
|
|
21
30
|
cacheScope,
|
|
22
31
|
classifyError,
|
|
32
|
+
cleanMarks,
|
|
33
|
+
cleanPlan,
|
|
23
34
|
closeAgentSession,
|
|
35
|
+
doneWhenTicks,
|
|
36
|
+
entryStatusLabel,
|
|
24
37
|
formatBriefingLines,
|
|
25
38
|
formatGatewaySeamSummary,
|
|
26
39
|
formatInviteSentence,
|
|
@@ -35,13 +48,23 @@ import {
|
|
|
35
48
|
getWorkspaceContext,
|
|
36
49
|
getWorkspaceId,
|
|
37
50
|
isSessionOriented,
|
|
51
|
+
isTrustAccepted,
|
|
38
52
|
kernelCall,
|
|
39
53
|
kernelCallEnvelope,
|
|
40
54
|
kernelMutation,
|
|
41
55
|
kernelQuery,
|
|
42
56
|
kindWord,
|
|
57
|
+
liveWorkPackageLines,
|
|
58
|
+
openTaskCommand,
|
|
59
|
+
openTaskCompactLines,
|
|
60
|
+
openTaskLead,
|
|
61
|
+
openTaskListLines,
|
|
62
|
+
openTaskSectionLines,
|
|
43
63
|
orientationRefusal,
|
|
44
64
|
personStatusTag,
|
|
65
|
+
planLines,
|
|
66
|
+
planRowDetails,
|
|
67
|
+
priorityOf,
|
|
45
68
|
questionSeatName,
|
|
46
69
|
recordSessionActivity,
|
|
47
70
|
requireActiveSession,
|
|
@@ -57,8 +80,10 @@ import {
|
|
|
57
80
|
setSessionOriented,
|
|
58
81
|
startAgentSession,
|
|
59
82
|
startTimingLine,
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
tasksUnderLines,
|
|
84
|
+
withAcceptPrompt,
|
|
85
|
+
workPackageListLines
|
|
86
|
+
} from "./chunk-Y73LQNAA.js";
|
|
62
87
|
|
|
63
88
|
// src/server.ts
|
|
64
89
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/server";
|
|
@@ -801,29 +826,6 @@ function entryDataLines(data) {
|
|
|
801
826
|
return [...purpose ? [`**Purpose:** ${purpose}`] : [], "", ...rest.map(([key, val]) => `**${key}:** ${typeof val === "string" ? val : JSON.stringify(val)}`)];
|
|
802
827
|
}
|
|
803
828
|
|
|
804
|
-
// src/lib/statusCategories.ts
|
|
805
|
-
var STATUS_CATEGORIES = ["draft", "current", "past", "discarded"];
|
|
806
|
-
var STATUS_CATEGORY_SET = new Set(STATUS_CATEGORIES);
|
|
807
|
-
var TRUST_ACCEPTED_WORDS = ["accepted", "active", "current"];
|
|
808
|
-
function isTrustAccepted(status2) {
|
|
809
|
-
return TRUST_ACCEPTED_WORDS.includes(status2);
|
|
810
|
-
}
|
|
811
|
-
var TRUST_ARCHIVED_WORDS = ["archived", "deprecated", "past", "discarded"];
|
|
812
|
-
var TRUST_STATUS_LABELS = {
|
|
813
|
-
draft: "Draft",
|
|
814
|
-
current: "Current",
|
|
815
|
-
// the live word every accept now stores
|
|
816
|
-
accepted: "Accepted",
|
|
817
|
-
archived: "Archived",
|
|
818
|
-
active: "Accepted",
|
|
819
|
-
deprecated: "Archived"
|
|
820
|
-
};
|
|
821
|
-
function entryStatusLabel(word) {
|
|
822
|
-
return word.split(/[_-]/).filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ");
|
|
823
|
-
}
|
|
824
|
-
var ENTRY_STATUS_READ_WORDS = ["draft", ...TRUST_ACCEPTED_WORDS, ...TRUST_ARCHIVED_WORDS];
|
|
825
|
-
var ENTRY_STATUS_WRITE_WORDS = ["draft", "archived"];
|
|
826
|
-
|
|
827
829
|
// src/gap-store.ts
|
|
828
830
|
var SESSIONLESS_KEY = "__sessionless__";
|
|
829
831
|
var sessionGaps = /* @__PURE__ */ new Map();
|
|
@@ -3670,371 +3672,6 @@ import { z as z20 } from "zod/v3";
|
|
|
3670
3672
|
// src/lib/readinessNotices.ts
|
|
3671
3673
|
var READINESS_PROVISIONAL_LINE = `The sample is incomplete: it left out ${TRUST_STATUS_LABELS.current.toLowerCase()} entries. Counts are lower bounds, apparent gaps may already be covered.`;
|
|
3672
3674
|
|
|
3673
|
-
// src/lib/priority.ts
|
|
3674
|
-
var PRIORITY_LEVELS = {
|
|
3675
|
-
urgent: { word: "Urgent", order: 1, linearInt: 1, icon: "alert", line: "Fix now: hurts customers, money or security", question: "Who is hurt, or which promise slips?" },
|
|
3676
|
-
high: { word: "High", order: 2, linearInt: 2, icon: "bars-3", line: "A goal we set is stuck without this", question: "Which goal is stuck without this?" },
|
|
3677
|
-
medium: { word: "Medium", order: 3, linearInt: 3, icon: "bars-2", line: "Helps a goal we set, but can wait", question: "Which goal does this help?" },
|
|
3678
|
-
low: { word: "Low", order: 4, linearInt: 4, icon: "bars-1", line: "Nice to have, or keeping things tidy", question: "Why can this wait?" }
|
|
3679
|
-
};
|
|
3680
|
-
var PRIORITY_TOKENS = Object.keys(PRIORITY_LEVELS);
|
|
3681
|
-
var NO_PRIORITY = { word: "No priority", order: 5, linearInt: 0, icon: "dashes", line: "Not judged yet", question: "Why clear the priority?" };
|
|
3682
|
-
function priorityOf(value) {
|
|
3683
|
-
return typeof value === "string" && Object.prototype.hasOwnProperty.call(PRIORITY_LEVELS, value) ? value : null;
|
|
3684
|
-
}
|
|
3685
|
-
|
|
3686
|
-
// src/lib/dateValidation.ts
|
|
3687
|
-
var ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/;
|
|
3688
|
-
function isValidISODate(value) {
|
|
3689
|
-
if (typeof value !== "string") return false;
|
|
3690
|
-
if (!ISO_DATE_REGEX.test(value)) return false;
|
|
3691
|
-
const parts = value.split("-");
|
|
3692
|
-
const year = Number(parts[0]);
|
|
3693
|
-
const month = Number(parts[1]);
|
|
3694
|
-
const day = Number(parts[2]);
|
|
3695
|
-
const date = new Date(year, month - 1, day);
|
|
3696
|
-
return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;
|
|
3697
|
-
}
|
|
3698
|
-
|
|
3699
|
-
// src/lib/taskDue.ts
|
|
3700
|
-
var DAY = 864e5;
|
|
3701
|
-
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
3702
|
-
var STATE_WORDS = { overdue: "Overdue", dueToday: "Due today", due: "Due" };
|
|
3703
|
-
var TASK_DUE_WORDS = {
|
|
3704
|
-
...STATE_WORDS,
|
|
3705
|
-
/** The due line on a task row: "due 7 Nov", the year only when it is not this year ("due 7 Nov 2027"). */
|
|
3706
|
-
line: (day) => `due ${day}`,
|
|
3707
|
-
/** pb get and the MCP get: "Due: 7 Nov, Overdue", "Due: today", "Due: 14 Nov". */
|
|
3708
|
-
label: (key, day) => `${STATE_WORDS.due}: ${key === "dueToday" ? "today" : day}${key === "overdue" ? `, ${STATE_WORDS.overdue}` : ""}`,
|
|
3709
|
-
/** Orient's counts line (RULE-17): the denominator is the open tasks the read judged, and a cut read says capped. */
|
|
3710
|
-
counts: (overdue, dueToday, read, capped) => `${overdue} ${STATE_WORDS.overdue}, ${dueToday} ${STATE_WORDS.dueToday} of ${read} open read${capped ? ", capped" : ""}.`
|
|
3711
|
-
};
|
|
3712
|
-
function utcDay(date) {
|
|
3713
|
-
return isValidISODate(date) ? Math.floor(Date.parse(date) / DAY) : null;
|
|
3714
|
-
}
|
|
3715
|
-
function dayText(dueDate, now) {
|
|
3716
|
-
const [year, month, day] = dueDate.split("-").map(Number);
|
|
3717
|
-
return `${day} ${MONTHS[month - 1]}${year === new Date(now).getUTCFullYear() ? "" : ` ${year}`}`;
|
|
3718
|
-
}
|
|
3719
|
-
function taskDue(input) {
|
|
3720
|
-
const due = utcDay(input.dueDate);
|
|
3721
|
-
if (!input.open || due === null) return null;
|
|
3722
|
-
const days = due - Math.floor(input.now / DAY);
|
|
3723
|
-
const key = days < 0 ? "overdue" : days === 0 ? "dueToday" : "due";
|
|
3724
|
-
const day = dayText(input.dueDate, input.now);
|
|
3725
|
-
return { key, word: STATE_WORDS[key], day, line: TASK_DUE_WORDS.line(day) };
|
|
3726
|
-
}
|
|
3727
|
-
function taskDueMark(due) {
|
|
3728
|
-
return due.key === "overdue" ? `${due.word}, ${due.line}` : due.key === "dueToday" ? due.word : due.line;
|
|
3729
|
-
}
|
|
3730
|
-
|
|
3731
|
-
// src/lib/workPackageList.ts
|
|
3732
|
-
var NOT_STARTED = "not started";
|
|
3733
|
-
var ALL_COMMAND_SAYS = "lists every live package";
|
|
3734
|
-
var WORK_PACKAGE_LIST_WORDS = {
|
|
3735
|
-
yours: "[yours]",
|
|
3736
|
-
/** Printed once under the heading when a row carries the mark, so a cold reader need not guess it (DEC-2445). */
|
|
3737
|
-
legend: "[yours] = a package your role owns",
|
|
3738
|
-
count: (shown, { team, otherTeams, noSingleOwner }, allCommand) => `Showing ${shown} of your team's ${team} live package${team === 1 ? "" : "s"}; ${otherTeams} more in other teams${noSingleOwner > 0 ? `; ${noSingleOwner} more with no single owner` : ""}. All ${team + otherTeams + noSingleOwner}: ${allCommand} (${ALL_COMMAND_SAYS})`,
|
|
3739
|
-
/** A seat's plan (TASK-1948): its first line, then every package in progress, the one next and the rest counted. */
|
|
3740
|
-
planLead: (team, n, capped) => `${team} has ${n}${capped ? "+" : ""} package${n === 1 && !capped ? "" : "s"} in progress.`,
|
|
3741
|
-
/** Two or more packages in progress share a level with no place set: only their ids order them inside it (DEC-2416, TASK-2098). */
|
|
3742
|
-
tied: (levels) => `Packages not ranked inside ${levels.join(" or ")}.`,
|
|
3743
|
-
/** The heading over the one next: the first package not started with no wait written (QUE-1480). */
|
|
3744
|
-
next: "Next",
|
|
3745
|
-
nextUnread: "The next package was not read: the read ran out of calls.",
|
|
3746
|
-
taskCounts: ({ open, done, doneWeek, weekAtLeast }) => `tasks: ${open} open, ${done} done, ${doneWeek}${weekAtLeast ? "+" : ""} done in 7 days`,
|
|
3747
|
-
notCounted: "tasks not counted",
|
|
3748
|
-
uncounted: (counted, of, capped) => `Tasks counted under ${counted} of ${of}${capped ? "+" : ""} packages in progress.`,
|
|
3749
|
-
/** The plan's last line, counted from the plan, never from the rows a door printed: with the lead it adds up to All N (RULE-17). */
|
|
3750
|
-
rest: (notGoing, next, waiting, { team, otherTeams, noSingleOwner }, capped, allCommand) => {
|
|
3751
|
-
const n = (count) => `${count}${capped ? "+" : ""}`, listed = [next && "the next", waiting > 0 && `${waiting} waiting`].filter(Boolean).join(" and ");
|
|
3752
|
-
return `${n(notGoing)} more not in progress${listed ? `, ${listed} among them` : ""}; ${n(otherTeams)} more in other teams${noSingleOwner > 0 ? `; ${n(noSingleOwner)} more with no single owner` : ""}. All ${n(team + otherTeams + noSingleOwner)}: ${allCommand} (${ALL_COMMAND_SAYS})`;
|
|
3753
|
-
},
|
|
3754
|
-
/** QUE-1484 point 6: the heading over packages not started skipped as the next for the wait each prints. */
|
|
3755
|
-
waiting: "Waiting",
|
|
3756
|
-
/** QUE-1484 point 4: what a plan row serves, names first, and the lines counting each one's packages by stage (RULE-17). */
|
|
3757
|
-
serves: (targets, cut) => `serves ${targets.join(", ")}${cut ? " and more not read" : ""}`,
|
|
3758
|
-
servesNone: "serves no key result or KPI",
|
|
3759
|
-
servesUnread: "key results or KPIs not read",
|
|
3760
|
-
/** The heading over each key result's line, as Next and Waiting head theirs (Product Design, round 2). */
|
|
3761
|
-
servesHeading: "Serves",
|
|
3762
|
-
keyResultLine: (target2, stages, atLeast) => `${target2}: ${stages.join(", ")}${atLeast ? ", and more not read" : ""}`,
|
|
3763
|
-
keyResultUncounted: (target2) => `${target2}: packages not counted`,
|
|
3764
|
-
mismatch: (notStarted, going) => `Stage and work disagree: ${notStarted} ${NOT_STARTED} with a task done in the last 7 days; ${going} in progress with none.`,
|
|
3765
|
-
/** The command each surface names at the end of the count line: every live work package of the workspace, under listHeading. */
|
|
3766
|
-
allCommand: {
|
|
3767
|
-
cli: "pb brief confidence",
|
|
3768
|
-
mcp: '`context action=brief briefType="confidence"`'
|
|
3769
|
-
},
|
|
3770
|
-
/** The heading of that command's list, so the count line and the list use one word. */
|
|
3771
|
-
listHeading: "Live work packages",
|
|
3772
|
-
/** That list's last line when it stopped at its cap; the brief has no way to continue past it. */
|
|
3773
|
-
listStops: (cap) => `More than ${cap} live packages; the list stops here.`,
|
|
3774
|
-
/** RULE-17: ticks are counted against the entry's whole done-when list. The brief's rows and the Bound scope's tasks print it. */
|
|
3775
|
-
ticks: (ticked, total) => total === 0 ? "no done-when" : `${ticked} of ${total} done-when ticked`,
|
|
3776
|
-
noStage: "no stage",
|
|
3777
|
-
/** After the ticks of a live package whose every item is ticked, so a reader closes it or adds what is left (TASK-1872). */
|
|
3778
|
-
allTicked: "(all ticked: close it, or add what is left)",
|
|
3779
|
-
/** A tension linked to a row, named and with its id so a reader can open it; each surface adds its own indent. */
|
|
3780
|
-
tension: (t) => `\u21B3 tension${t.entryId ? ` ${t.entryId}` : ""}: ${t.name}`,
|
|
3781
|
-
setOne: "Set one (urgent, high, medium or low):",
|
|
3782
|
-
/** The command each surface prints after setOne, ending the line so it pastes whole; a live priority change asks one line of why (DEC-2418). */
|
|
3783
|
-
setCommand: {
|
|
3784
|
-
cli: 'pb update <WP-ID> -f priority=high --change-reason "<why>"',
|
|
3785
|
-
mcp: '`entries action=update entryId="<WP-ID>" data={"priority":"high"} changeReason="<why>"`'
|
|
3786
|
-
}
|
|
3787
|
-
};
|
|
3788
|
-
function priorityWord(value) {
|
|
3789
|
-
const token = priorityOf(value);
|
|
3790
|
-
return token ? PRIORITY_LEVELS[token].word : NO_PRIORITY.word;
|
|
3791
|
-
}
|
|
3792
|
-
function workPackageListLines(rows, counts, surface) {
|
|
3793
|
-
const w = WORK_PACKAGE_LIST_WORDS, lines = [], plan = counts?.plan;
|
|
3794
|
-
const anyPriority = rows.some((row) => priorityOf(row.priority) !== null), live = counts ? counts.team + counts.otherTeams + counts.noSingleOwner : 0;
|
|
3795
|
-
if (counts && live > 0) lines.push(plan ? w.planLead(plan.teamName, plan.inProgress, plan.capped === true) : w.count(rows.length, counts, surface.allCommand));
|
|
3796
|
-
if (rows.some((row) => row.yours)) lines.push(w.legend);
|
|
3797
|
-
if (counts && rows.length > 0 && !anyPriority) lines.push(`${w.setOne} ${surface.setCommand}`);
|
|
3798
|
-
const going = rows.filter((row) => !row.next && !row.waiting), words = going.filter((row) => !row.placed).map((row) => priorityWord(row.priority));
|
|
3799
|
-
const tied = plan ? [...new Set(words)].filter((word) => word !== NO_PRIORITY.word && words.filter((x) => x === word).length > 1) : [];
|
|
3800
|
-
let level, tieSaid = tied.length === 0;
|
|
3801
|
-
for (const row of [...going, ...rows.filter((row2) => row2.waiting), ...rows.filter((row2) => row2.next)]) {
|
|
3802
|
-
const word = row.next ? w.next : row.waiting ? w.waiting : priorityWord(row.priority);
|
|
3803
|
-
if ((row.next || row.waiting) && !tieSaid) {
|
|
3804
|
-
lines.push(w.tied(tied));
|
|
3805
|
-
tieSaid = true;
|
|
3806
|
-
}
|
|
3807
|
-
if ((anyPriority || row.next || row.waiting) && word !== level) lines.push(surface.heading(word));
|
|
3808
|
-
level = word;
|
|
3809
|
-
lines.push(...surface.row(row, row.yours ? ` ${w.yours}` : ""));
|
|
3810
|
-
}
|
|
3811
|
-
if (!tieSaid) lines.push(w.tied(tied));
|
|
3812
|
-
if (plan?.nextUnread) lines.push(w.nextUnread);
|
|
3813
|
-
if (plan && plan.counted < plan.inProgress) lines.push(w.uncounted(plan.counted, plan.inProgress, plan.capped === true));
|
|
3814
|
-
const m = plan?.mismatch, n = (count, atLeast) => `${count}${atLeast ? "+" : ""}`;
|
|
3815
|
-
if (m && (m.notStarted > 0 || m.going > 0 || m.notStartedAtLeast || m.goingAtLeast)) lines.push(w.mismatch(n(m.notStarted, m.notStartedAtLeast), n(m.going, m.goingAtLeast)));
|
|
3816
|
-
if (plan && counts && live > 0) lines.push(w.rest(counts.team - plan.inProgress, plan.next === true, plan.waiting ?? 0, counts, plan.capped === true, surface.allCommand));
|
|
3817
|
-
if (plan?.keyResults?.length) lines.push(surface.heading(w.servesHeading), ...plan.keyResults.map((kr) => keyResultText(kr)));
|
|
3818
|
-
return lines;
|
|
3819
|
-
}
|
|
3820
|
-
function keyResultText(kr) {
|
|
3821
|
-
const w = WORK_PACKAGE_LIST_WORDS, target2 = `${kr.name} (${kr.entryId})`;
|
|
3822
|
-
return kr.stages === null ? w.keyResultUncounted(target2) : w.keyResultLine(target2, kr.stages.map((s) => `${s.count} ${entryStatusLabel(s.stage)}`), kr.atLeast === true);
|
|
3823
|
-
}
|
|
3824
|
-
function packageDetails(stage, { ticked, total }, due) {
|
|
3825
|
-
const w = WORK_PACKAGE_LIST_WORDS, sep = OPEN_TASK_LIST_WORDS.separator;
|
|
3826
|
-
return `${sep}${stage ? entryStatusLabel(stage) : w.noStage}${sep}${w.ticks(ticked, total)}${total > 0 && ticked === total ? ` ${w.allTicked}` : ""}${due ? `${sep}${taskDueMark(due)}` : ""}`;
|
|
3827
|
-
}
|
|
3828
|
-
function planRowDetails(row) {
|
|
3829
|
-
if (row.stage === void 0) return "";
|
|
3830
|
-
const w = WORK_PACKAGE_LIST_WORDS, tasks = row.tasks === null ? w.notCounted : row.tasks ? w.taskCounts(row.tasks) : "";
|
|
3831
|
-
const named = row.serves?.map((t) => `${t.name} (${t.entryId})`) ?? [];
|
|
3832
|
-
const serves = row.serves === null ? w.servesUnread : !row.serves ? "" : named.length > 0 ? w.serves(named, row.servesCut === true) : row.servesCut ? w.servesUnread : w.servesNone;
|
|
3833
|
-
const parts = [tasks, row.waiting ? waitText(row.wait, row.waitUnread) : "", serves].filter(Boolean);
|
|
3834
|
-
return `${packageDetails(row.stage, row.ticks ?? { ticked: 0, total: 0 }, row.due)}${parts.map((p) => `${OPEN_TASK_LIST_WORDS.separator}${p}`).join("")}`;
|
|
3835
|
-
}
|
|
3836
|
-
function planLines(view, surface) {
|
|
3837
|
-
if (!view) return [];
|
|
3838
|
-
const plan = cleanPlan(view.rows, view.counts, surface.clean);
|
|
3839
|
-
return [...workPackageListLines(plan.rows, plan.counts, {
|
|
3840
|
-
heading: surface.heading,
|
|
3841
|
-
setCommand: WORK_PACKAGE_LIST_WORDS.setCommand[surface.surface],
|
|
3842
|
-
allCommand: WORK_PACKAGE_LIST_WORDS.allCommand[surface.surface],
|
|
3843
|
-
row: (row, mark) => [`${surface.bullet}${row.entryId ? `${row.entryId} \u2014 ` : ""}${row.name}${mark}${planRowDetails(row)}`]
|
|
3844
|
-
}), ""];
|
|
3845
|
-
}
|
|
3846
|
-
function cleanPlan(rows, counts, clean) {
|
|
3847
|
-
const plan = counts?.plan, named = (t) => ({ ...t, entryId: clean(t.entryId), name: clean(t.name) });
|
|
3848
|
-
const keyResults = plan?.keyResults?.map((kr) => ({ ...named(kr), stages: kr.stages && kr.stages.map((s) => ({ ...s, stage: clean(s.stage) })) }));
|
|
3849
|
-
return {
|
|
3850
|
-
rows: rows.map((r) => ({
|
|
3851
|
-
...r,
|
|
3852
|
-
name: clean(r.name),
|
|
3853
|
-
entryId: r.entryId === null ? null : clean(r.entryId),
|
|
3854
|
-
...r.stage === void 0 ? {} : { stage: clean(r.stage) },
|
|
3855
|
-
...r.serves ? { serves: r.serves.map(named) } : {},
|
|
3856
|
-
...r.wait ? { wait: { ...named(r.wait), state: clean(r.wait.state) } } : {}
|
|
3857
|
-
})),
|
|
3858
|
-
counts: counts && plan ? { ...counts, plan: { ...plan, teamName: clean(plan.teamName), ...keyResults ? { keyResults } : {} } } : counts
|
|
3859
|
-
};
|
|
3860
|
-
}
|
|
3861
|
-
function doneWhenTicks(value) {
|
|
3862
|
-
const items = Array.isArray(value) ? value : [];
|
|
3863
|
-
return { ticked: items.filter((item) => typeof item === "object" && item !== null && item.done === true).length, total: items.length };
|
|
3864
|
-
}
|
|
3865
|
-
function liveWorkPackageRowText(row, now) {
|
|
3866
|
-
const due = taskDue({ dueDate: row.data?.["dueDate"], open: true, now });
|
|
3867
|
-
return `${row.entryId ? `${row.entryId} \u2014 ` : ""}${row.name}${packageDetails(row.workflowStatus, doneWhenTicks(row.data?.["doneWhen"]), due)}`;
|
|
3868
|
-
}
|
|
3869
|
-
function liveWorkPackageLines(rows, surface, now) {
|
|
3870
|
-
const marked = rows.map((row) => {
|
|
3871
|
-
const priority = priorityOf(row.data?.["priority"]);
|
|
3872
|
-
return { ...row, ...priority ? { priority } : {} };
|
|
3873
|
-
});
|
|
3874
|
-
return workPackageListLines(marked, void 0, {
|
|
3875
|
-
heading: surface.heading,
|
|
3876
|
-
setCommand: WORK_PACKAGE_LIST_WORDS.setCommand[surface.surface],
|
|
3877
|
-
allCommand: WORK_PACKAGE_LIST_WORDS.allCommand[surface.surface],
|
|
3878
|
-
row: (row) => [`${surface.bullet}${liveWorkPackageRowText(row, now)}`]
|
|
3879
|
-
});
|
|
3880
|
-
}
|
|
3881
|
-
var inTeam = (team) => team ? ` in ${team}` : "";
|
|
3882
|
-
var OPEN_TASK_LIST_WORDS = {
|
|
3883
|
-
heading: (roleName, team) => `${roleName}'s open tasks${inTeam(team)}`,
|
|
3884
|
-
separator: " \xB7 ",
|
|
3885
|
-
noOwner: "(no owner)",
|
|
3886
|
-
/** After a task whose package parents are all done or archived, so the agent finishes it or closes it (Product Design 2026-10-30). */
|
|
3887
|
-
packageClosed: "(its package is closed)",
|
|
3888
|
-
under: (pkg) => `under ${pkg.name} (${pkg.entryId})`,
|
|
3889
|
-
/** A row in progress's wait (a depends_on link), with its target's state; over when the target is done, stopped or archived. When the
|
|
3890
|
-
* same target is also what the row rests on due later, its due line follows the state, so one link is said once (TASK-2086, Voice). */
|
|
3891
|
-
waitsOn: (target2, state, due) => `waits on ${target2}, ${state}${due ? `, ${due}` : ""}`,
|
|
3892
|
-
waitOver: (target2, state) => `wait over: ${target2} is ${state}`,
|
|
3893
|
-
/** QUE-1484 point 6: a wait on an entry whose kind has no finished stage, said plainly. */
|
|
3894
|
-
waitNever: (target2, state, due) => `waits on ${target2}, ${state}${due ? `, ${due}` : ""}, which never finishes`,
|
|
3895
|
-
noWait: "no wait written",
|
|
3896
|
-
/** TASK-2086 (QUE-1519; Voice, round 2): a dated task that depends on an open entry due after it, with that entry's due line ("due 27 Nov"). */
|
|
3897
|
-
restsOn: (target2, due) => `rests on ${target2}, ${due}`,
|
|
3898
|
-
/** The read kept too few calls or bytes to look at what a dated row rests on: not the same as nothing due later. Each door adds its
|
|
3899
|
-
* command that shows the task's links (linksCommand), from the row's own id, so the step costs no read. */
|
|
3900
|
-
restsOnUnread: "what it rests on not read",
|
|
3901
|
-
linksCommand: { cli: (entryId) => `pb get ${entryId}`, mcp: (entryId) => `\`context action=get entryId="${entryId}"\`` },
|
|
3902
|
-
/** TASK-2086 (QUE-1519; Voice, round 2): after the due mark of an open task not started, its date 1 to DUE_SOON_DAYS days away. */
|
|
3903
|
-
dueSoon: (days) => `in ${days} day${days === 1 ? "" : "s"}, ${NOT_STARTED}`,
|
|
3904
|
-
/** The read kept too few calls to look for this row's wait: not the same as none. */
|
|
3905
|
-
waitUnread: "wait not read",
|
|
3906
|
-
/** Two or more rows share a level with no place set: only their ids order them inside it (DEC-2416, TASK-2098). */
|
|
3907
|
-
tied: (levels) => `Tasks not ranked inside ${levels.join(" or ")}.`,
|
|
3908
|
-
/** Orient shows at most this many rows; the cut note names the command for the rest. */
|
|
3909
|
-
shown: 5,
|
|
3910
|
-
more: (shown, total, capped, allCommand) => `Showing ${shown} of ${total}${capped ? "+" : ""}. The rest: ${allCommand}`,
|
|
3911
|
-
/** The tasks list's page, n of N, before the command for the next page (TASK-1948); N reads "N+" on a capped read, as `more` does. */
|
|
3912
|
-
page: (first, last, total, capped) => `Showing ${first}\u2013${last} of ${total}${capped ? "+" : ""}.`,
|
|
3913
|
-
allCommand: { cli: "pb tasks list", mcp: "`context action=tasks`" },
|
|
3914
|
-
compact: (count, capped, roleName, team, notStarted = 0) => `${count}${capped ? "+" : ""} open task(s) of ${roleName}${inTeam(team)}${notStarted > 0 ? `; ${notStarted}${capped ? "+" : ""} more under packages ${NOT_STARTED}` : ""}`,
|
|
3915
|
-
/** Only for a read that was not cut: a capped read that found none prints its capped line instead, never this. */
|
|
3916
|
-
empty: (roleName, team) => `${roleName} has no open tasks to list${inTeam(team)}.`,
|
|
3917
|
-
/** Tasks whose only live packages are not started (DEC-2459 as amended 2026-11-16): said as a number, never left out in silence. */
|
|
3918
|
-
underNotStarted: (count, capped) => `${count}${capped ? "+" : ""} more under packages ${NOT_STARTED}: counted, not listed.`,
|
|
3919
|
-
/** After the cap line only: the walk down the packages in progress stopped too, so a task under one may be missing (Voice, 2026-11-18). */
|
|
3920
|
-
walked: (read, of) => `Tasks read under ${read} of ${of} packages in progress. Others may be missing.`,
|
|
3921
|
-
/** The tasks list's last line when another page follows. */
|
|
3922
|
-
nextPage: (command) => `More: ${command}`,
|
|
3923
|
-
/** Printed whenever the read stopped at its cap, so rows it never read are not taken for none (signed by Voice, 2026-10-30).
|
|
3924
|
-
* The read goes newest ownership first, so what it leaves out is what the role has owned longest. */
|
|
3925
|
-
capped: (records) => `Read stopped at ${records} records; the tasks this role has owned longest are not listed.`,
|
|
3926
|
-
/** The read's refusal when no role is named and the session acts in none; each surface adds noRole with its own command. */
|
|
3927
|
-
noSessionRole: "This session acts in no role.",
|
|
3928
|
-
noRole: (command) => `Name the role: ${command}`,
|
|
3929
|
-
/** A cursor that is not a page number; the CLI refuses it rather than reading page 1. */
|
|
3930
|
-
badCursor: (value) => `Cursor ${value} is not a page number. Use the number the last page printed.`
|
|
3931
|
-
};
|
|
3932
|
-
function openTaskCommand(surface, input = {}) {
|
|
3933
|
-
if (surface === "cli") {
|
|
3934
|
-
return `${OPEN_TASK_LIST_WORDS.allCommand.cli}${input.role ? ` --role ${input.role}` : ""}${input.cursor !== void 0 ? ` --cursor ${input.cursor}` : ""}`;
|
|
3935
|
-
}
|
|
3936
|
-
const bare = OPEN_TASK_LIST_WORDS.allCommand.mcp.slice(1, -1);
|
|
3937
|
-
return `${bare}${input.role ? ` roleId=${input.role}` : ""}${input.cursor !== void 0 ? ` cursor=${input.cursor}` : ""}`;
|
|
3938
|
-
}
|
|
3939
|
-
function waitText(wait, unread, due) {
|
|
3940
|
-
const w = OPEN_TASK_LIST_WORDS;
|
|
3941
|
-
if (unread) return w.waitUnread;
|
|
3942
|
-
if (!wait) return w.noWait;
|
|
3943
|
-
const target2 = `${wait.name} (${wait.entryId})`, state = entryStatusLabel(wait.state);
|
|
3944
|
-
return wait.over ? w.waitOver(target2, state) : wait.never ? w.waitNever(target2, state, due) : w.waitsOn(target2, state, due);
|
|
3945
|
-
}
|
|
3946
|
-
function openTaskRowText(row, surface) {
|
|
3947
|
-
const w = OPEN_TASK_LIST_WORDS, t = row.doneWhen ?? { ticked: 0, total: 0 };
|
|
3948
|
-
const marks = [row.noOwner && w.noOwner, row.packageClosed && w.packageClosed].filter(Boolean).map((m) => ` ${m}`).join("");
|
|
3949
|
-
const restsDue = row.restsOn && TASK_DUE_WORDS.line(row.restsOn.day);
|
|
3950
|
-
const once = row.wait !== void 0 && row.wait.entryId === row.restsOn?.entryId;
|
|
3951
|
-
const restsOn = row.restsOn ? !once && w.restsOn(`${row.restsOn.name} (${row.restsOn.entryId})`, restsDue) : row.restsOnUnread && `${w.restsOnUnread}: ${w.linksCommand[surface](row.entryId)}`;
|
|
3952
|
-
const parts = [
|
|
3953
|
-
entryStatusLabel(row.inProgress ? "in_progress" : "open"),
|
|
3954
|
-
WORK_PACKAGE_LIST_WORDS.ticks(t.ticked, t.total),
|
|
3955
|
-
row.due && taskDueMark(row.due),
|
|
3956
|
-
row.dueSoon !== void 0 && w.dueSoon(row.dueSoon),
|
|
3957
|
-
restsOn,
|
|
3958
|
-
row.under && w.under(row.under),
|
|
3959
|
-
row.inProgress && waitText(row.wait, row.waitUnread, once ? restsDue : void 0)
|
|
3960
|
-
];
|
|
3961
|
-
return `${priorityWord(row.priority)}${w.separator}${row.entryId} \u2014 ${row.name}${marks}${parts.filter(Boolean).map((p) => `${w.separator}${p}`).join("")}`;
|
|
3962
|
-
}
|
|
3963
|
-
function openTaskListLines(list, surface) {
|
|
3964
|
-
const w = OPEN_TASK_LIST_WORDS, shown = Math.min(surface.shown ?? list.rows.length, list.rows.length), rows = list.rows.slice(0, shown);
|
|
3965
|
-
const total = surface.total ?? list.rows.length;
|
|
3966
|
-
const due = list.dueCounts && total > 0 ? [TASK_DUE_WORDS.counts(list.dueCounts.overdue, list.dueCounts.dueToday, list.dueCounts.read, list.capped)] : [];
|
|
3967
|
-
const unplaced = rows.filter((row) => !row.placed), levels = [...new Set(unplaced.map((row) => priorityWord(row.priority)))].filter((word) => word !== NO_PRIORITY.word && unplaced.filter((row) => priorityWord(row.priority) === word).length > 1);
|
|
3968
|
-
const lines = [...due, ...rows.map((row) => `${surface.bullet}${openTaskRowText(row, surface.surface)}`), ...levels.length > 0 ? [w.tied(levels)] : []];
|
|
3969
|
-
if (total > shown && surface.from === void 0) lines.push(w.more(shown, total, list.capped, w.allCommand[surface.surface]));
|
|
3970
|
-
if (total > shown && surface.from !== void 0 && shown > 0) lines.push(w.page(surface.from + 1, surface.from + shown, total, list.capped));
|
|
3971
|
-
if (list.underNotStarted) lines.push(w.underNotStarted(list.underNotStarted, list.capped));
|
|
3972
|
-
if (list.capped) lines.push(w.capped(list.cappedAt ?? total), ...list.walked ? [w.walked(list.walked.read, list.walked.of)] : []);
|
|
3973
|
-
return lines;
|
|
3974
|
-
}
|
|
3975
|
-
function openTaskLead(list, heading) {
|
|
3976
|
-
const w = OPEN_TASK_LIST_WORDS, r = list.role.name;
|
|
3977
|
-
return list.rows.length > 0 ? heading(w.heading(r, list.team)) : list.total > 0 || list.capped ? w.compact(list.total, list.capped, r, list.team) : w.empty(r, list.team);
|
|
3978
|
-
}
|
|
3979
|
-
function openTaskSectionLines(list, surface) {
|
|
3980
|
-
if (!list || list.total === 0 && !list.capped && !list.underNotStarted) return [];
|
|
3981
|
-
return [openTaskLead(list, surface.heading), ...openTaskListLines(list, { bullet: surface.bullet, surface: surface.surface, shown: OPEN_TASK_LIST_WORDS.shown, total: list.total })];
|
|
3982
|
-
}
|
|
3983
|
-
var DRAFTS_MAY_BE_MORE = "there may be more";
|
|
3984
|
-
var SEAT_DRAFTS_CUT_WORDS = {
|
|
3985
|
-
cliNote: (count) => ` (${count}+, ${DRAFTS_MAY_BE_MORE})`,
|
|
3986
|
-
mcpLine: `${DRAFTS_MAY_BE_MORE.charAt(0).toUpperCase()}${DRAFTS_MAY_BE_MORE.slice(1)} drafts than shown.`,
|
|
3987
|
-
/** The scan stopped before it found one this seat wrote: a capped scan that found none is not a zero (signed by the Team Lead of
|
|
3988
|
-
* the Product Team covering Voice, 2026-11-14T02:50Z). The CLI heading takes the note with no colon, as no rows follow it. */
|
|
3989
|
-
cliNoneNote: ` (none found, ${DRAFTS_MAY_BE_MORE})`,
|
|
3990
|
-
cliNoneBrief: `no draft of yours found, ${DRAFTS_MAY_BE_MORE}`,
|
|
3991
|
-
mcpNoneLine: `No draft of yours found; ${DRAFTS_MAY_BE_MORE}.`
|
|
3992
|
-
};
|
|
3993
|
-
function cleanMarks(list, clean) {
|
|
3994
|
-
const mark = (m) => m && { ...m, entryId: clean(m.entryId), name: clean(m.name) };
|
|
3995
|
-
return list && { ...list, rows: list.rows.map((r) => ({
|
|
3996
|
-
...r,
|
|
3997
|
-
...r.under ? { under: mark(r.under) } : {},
|
|
3998
|
-
...r.restsOn ? { restsOn: { ...mark(r.restsOn), day: clean(r.restsOn.day) } } : {},
|
|
3999
|
-
...r.wait ? { wait: { ...mark(r.wait), state: clean(r.wait.state) } } : {}
|
|
4000
|
-
})) };
|
|
4001
|
-
}
|
|
4002
|
-
function openTaskCompactLines(list) {
|
|
4003
|
-
if (!list || list.total === 0 && !list.capped && !list.underNotStarted) return [];
|
|
4004
|
-
return [OPEN_TASK_LIST_WORDS.compact(list.total, list.capped, list.role.name, list.team, list.underNotStarted)];
|
|
4005
|
-
}
|
|
4006
|
-
var nameWithId = (entry) => `${entry.name}${entry.entryId ? ` (${entry.entryId})` : ""}`;
|
|
4007
|
-
var TASKS_UNDER_WORDS = {
|
|
4008
|
-
heading: (parent) => `Tasks under ${nameWithId(parent)}`,
|
|
4009
|
-
count: (total, statusCounts) => `${total} task${total === 1 ? "" : "s"}: ${statusCounts.map((s) => `${s.count} ${entryStatusLabel(s.status)}`).join(", ")}.`,
|
|
4010
|
-
empty: (parent) => `No task is part of ${nameWithId(parent)}.`,
|
|
4011
|
-
/** A floor ("3+") only when the count stopped at its own bound; past the list it still counts what the viewer may read. */
|
|
4012
|
-
notTasks: (count, atLeast = false) => `${count}${atLeast ? "+" : ""} other linked ${count === 1 && !atLeast ? "entry is not a task" : "entries are not tasks"}.`,
|
|
4013
|
-
/** Links come back oldest first, so what the list leaves out is the most recently linked; only tasks the viewer may read count. */
|
|
4014
|
-
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.`,
|
|
4015
|
-
/** The cut's second sentence, ending in the surface's whole read of every part_of link: pb constellation, or context action=get. */
|
|
4016
|
-
cutStep: (command) => `Every task under it, by name: ${command}`,
|
|
4017
|
-
/** 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. */
|
|
4018
|
-
alone: "A task list by entry takes no role and no cursor.",
|
|
4019
|
-
aloneFix: (command) => `List it without them: ${command}`
|
|
4020
|
-
};
|
|
4021
|
-
function taskUnderRowText(row) {
|
|
4022
|
-
const sep = OPEN_TASK_LIST_WORDS.separator, ticks = WORK_PACKAGE_LIST_WORDS.ticks(row.doneWhen.ticked, row.doneWhen.total);
|
|
4023
|
-
return `${row.entryId} \u2014 ${row.name}${sep}${entryStatusLabel(row.status)}${sep}${ticks}${row.due ? `${sep}${taskDueMark(row.due)}` : ""}`;
|
|
4024
|
-
}
|
|
4025
|
-
function tasksUnderLines(list, surface) {
|
|
4026
|
-
const w = TASKS_UNDER_WORDS, id = list.parent.entryId ?? list.parent.name;
|
|
4027
|
-
const whole = surface.surface === "cli" ? `pb constellation ${id}` : `context action=get entryId="${id}"`, step = w.cutStep(whole);
|
|
4028
|
-
const lead = list.rows.length > 0 ? [w.count(list.rows.length, list.statusCounts)] : list.cut ? [] : [w.empty(list.parent)];
|
|
4029
|
-
return [
|
|
4030
|
-
surface.heading(w.heading(list.parent)),
|
|
4031
|
-
...lead,
|
|
4032
|
-
...list.rows.map((row) => `${surface.bullet}${taskUnderRowText(row)}`),
|
|
4033
|
-
...list.notTasks > 0 ? [w.notTasks(list.notTasks, list.cut?.atLeast), ` ${whole}`] : [],
|
|
4034
|
-
...list.cut ? [`${w.cut(list.cut)} ${step}`] : []
|
|
4035
|
-
];
|
|
4036
|
-
}
|
|
4037
|
-
|
|
4038
3675
|
// src/lib/walkCutWords.ts
|
|
4039
3676
|
var WALK_LIMITS = { perEntry: 10, entries: 100, named: 5 };
|
|
4040
3677
|
var WALK_CUT_WORDS = {
|
|
@@ -6246,8 +5883,8 @@ var COLLECTIONS_ACTIONS = [
|
|
|
6246
5883
|
"label-apply",
|
|
6247
5884
|
"label-remove"
|
|
6248
5885
|
];
|
|
6249
|
-
var
|
|
6250
|
-
var statusListEntrySchema = z22.object({ label: z22.string().max(200), category: z22.enum(
|
|
5886
|
+
var STATUS_CATEGORIES = ["draft", "current", "past", "discarded"];
|
|
5887
|
+
var statusListEntrySchema = z22.object({ label: z22.string().max(200), category: z22.enum(STATUS_CATEGORIES), archiveDefault: z22.boolean().optional(), resolveDefault: z22.boolean().optional() });
|
|
6251
5888
|
var qualityCriterionSchema = z22.object({
|
|
6252
5889
|
field: z22.string().max(200).describe("Entry data field key this criterion applies to, e.g. 'description', 'owner'"),
|
|
6253
5890
|
// WP-480 S1: `max_length` — must mirror the Convex rule union, or the tool rejects a
|
|
@@ -12813,4 +12450,4 @@ export {
|
|
|
12813
12450
|
SERVER_VERSION,
|
|
12814
12451
|
createProductBrainServer
|
|
12815
12452
|
};
|
|
12816
|
-
//# sourceMappingURL=chunk-
|
|
12453
|
+
//# sourceMappingURL=chunk-ROXPEU6O.js.map
|