@productbrain/mcp 0.0.1-beta.9485 → 0.0.1-beta.9487
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.
|
@@ -5931,43 +5931,8 @@ async function handleExport() {
|
|
|
5931
5931
|
import { z as z19 } from "zod/v3";
|
|
5932
5932
|
|
|
5933
5933
|
// src/tools/planned-work.ts
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
uncommittedDrafts: [],
|
|
5937
|
-
inProgressEntries: [],
|
|
5938
|
-
openTensions: []
|
|
5939
|
-
};
|
|
5940
|
-
for (const entry of allEntries) {
|
|
5941
|
-
if (entry.stratum === "system") continue;
|
|
5942
|
-
const collection = entry.collectionSlug ?? entry.collection ?? "unknown";
|
|
5943
|
-
if (entry.status === "draft") {
|
|
5944
|
-
result2.uncommittedDrafts.push({ name: entry.name, collection });
|
|
5945
|
-
}
|
|
5946
|
-
const isTension = entry.canonicalKey === "tension" || collection === "tensions";
|
|
5947
|
-
if (isTension && entry.workflowStatus === "open") {
|
|
5948
|
-
result2.openTensions.push({ name: entry.name, entryId: entry.entryId ?? entry._id });
|
|
5949
|
-
}
|
|
5950
|
-
if (entry.workflowStatus === "in-progress") {
|
|
5951
|
-
result2.inProgressEntries.push({
|
|
5952
|
-
name: entry.name,
|
|
5953
|
-
collection,
|
|
5954
|
-
entryId: entry.entryId ?? entry._id
|
|
5955
|
-
});
|
|
5956
|
-
}
|
|
5957
|
-
}
|
|
5958
|
-
return result2;
|
|
5959
|
-
}
|
|
5960
|
-
async function queryPlannedWork() {
|
|
5961
|
-
try {
|
|
5962
|
-
const allEntries = await kernelQuery("chain.listEntries", {
|
|
5963
|
-
fields: ["_id", "entryId", "name", "status", "workflowStatus", "collectionSlug", "stratum", "canonicalKey"]
|
|
5964
|
-
});
|
|
5965
|
-
if (!allEntries) return { uncommittedDrafts: [], inProgressEntries: [], openTensions: [] };
|
|
5966
|
-
return buildPlannedWork(allEntries);
|
|
5967
|
-
} catch {
|
|
5968
|
-
return { uncommittedDrafts: [], inProgressEntries: [], openTensions: [] };
|
|
5969
|
-
}
|
|
5970
|
-
}
|
|
5934
|
+
var MORE_DRAFTS_LINE = "_More drafts exist than shown. `entries action=list status=draft` lists more, but that list is capped as well; page with limit/cursor once entries list supports it._";
|
|
5935
|
+
var NO_PLANNED_WORK = { uncommittedDrafts: [], inProgressEntries: [], openTensions: [] };
|
|
5971
5936
|
function hasPlannedWork(work) {
|
|
5972
5937
|
return work.uncommittedDrafts.length > 0 || work.inProgressEntries.length > 0 || work.openTensions.length > 0;
|
|
5973
5938
|
}
|
|
@@ -5996,23 +5961,24 @@ function buildPlannedWorkSection(work, priorSessions, recoveryBlock) {
|
|
|
5996
5961
|
for (const entry of work.inProgressEntries.slice(1, 3)) {
|
|
5997
5962
|
lines.push(`- ${entry.name} (${entry.collection})`);
|
|
5998
5963
|
}
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
}
|
|
5964
|
+
const total = work.inProgressEntries.length;
|
|
5965
|
+
if (work.inProgressTruncated) lines.push(`- _...and ${total - 3}+ more in progress (${total}+ in all)_`);
|
|
5966
|
+
else if (total > 3) lines.push(`- _...and ${total - 3} more in progress_`);
|
|
6002
5967
|
}
|
|
6003
5968
|
if (work.uncommittedDrafts.length > 0) {
|
|
6004
5969
|
const count = work.uncommittedDrafts.length;
|
|
6005
|
-
const label = count === 1 ? "1 item pending" : `${count} items pending`;
|
|
5970
|
+
const label = work.draftsTruncated ? `${count}+ items pending` : count === 1 ? "1 item pending" : `${count} items pending`;
|
|
6006
5971
|
const topNames = work.uncommittedDrafts.slice(0, 3).map((d) => d.name).join(", ");
|
|
6007
5972
|
lines.push(`- **${label}** \u2014 ${topNames}${count > 3 ? ", ..." : ""}`);
|
|
5973
|
+
if (work.draftsTruncated) lines.push(` - ${MORE_DRAFTS_LINE}`);
|
|
6008
5974
|
}
|
|
6009
5975
|
if (work.openTensions.length > 0) {
|
|
6010
5976
|
const top = work.openTensions[0];
|
|
6011
5977
|
const count = work.openTensions.length;
|
|
6012
|
-
if (count === 1) {
|
|
5978
|
+
if (count === 1 && !work.openTensionsTruncated) {
|
|
6013
5979
|
lines.push(`- **Open tension: ${top.name}** \u2014 discuss or capture a decision?`);
|
|
6014
5980
|
} else {
|
|
6015
|
-
lines.push(`- **${count} open tensions** \u2014 top: ${top.name}`);
|
|
5981
|
+
lines.push(`- **${count}${work.openTensionsTruncated ? "+" : ""} open tensions** \u2014 top: ${top.name}`);
|
|
6016
5982
|
}
|
|
6017
5983
|
}
|
|
6018
5984
|
if (priorSessions.length > 0 && !hasPlannedWork(work) && !recoveryBlock) {
|
|
@@ -7255,7 +7221,7 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
7255
7221
|
lines.push(...docCompleteness.lines);
|
|
7256
7222
|
}
|
|
7257
7223
|
}
|
|
7258
|
-
const plannedWork =
|
|
7224
|
+
const plannedWork = opener.view?.plannedWork ?? NO_PLANNED_WORK;
|
|
7259
7225
|
if (hasPlannedWork(plannedWork)) {
|
|
7260
7226
|
lines.push("");
|
|
7261
7227
|
lines.push(...buildPlannedWorkSection(plannedWork, priorSessions, recoveryBlock));
|
|
@@ -7992,14 +7958,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
7992
7958
|
}
|
|
7993
7959
|
lines.push(...buildOperatingProtocol());
|
|
7994
7960
|
}
|
|
7995
|
-
|
|
7996
|
-
try {
|
|
7997
|
-
allEntries = await kernelQuery("chain.listEntries", {
|
|
7998
|
-
fields: ["_id", "entryId", "name", "status", "workflowStatus", "collectionSlug", "stratum", "canonicalKey"]
|
|
7999
|
-
}) ?? [];
|
|
8000
|
-
} catch {
|
|
8001
|
-
}
|
|
8002
|
-
const plannedWork = buildPlannedWork(allEntries);
|
|
7961
|
+
const plannedWork = orientView?.plannedWork ?? NO_PLANNED_WORK;
|
|
8003
7962
|
if (hasPlannedWork(plannedWork)) {
|
|
8004
7963
|
lines.push(...buildPlannedWorkSection(plannedWork, priorSessions, recoveryBlock));
|
|
8005
7964
|
} else if (recoveryBlock) {
|
|
@@ -13544,4 +13503,4 @@ export {
|
|
|
13544
13503
|
createProductBrainServer,
|
|
13545
13504
|
initFeatureFlags
|
|
13546
13505
|
};
|
|
13547
|
-
//# sourceMappingURL=chunk-
|
|
13506
|
+
//# sourceMappingURL=chunk-ZWG3GC7C.js.map
|