@productbrain/mcp 0.0.1-beta.24 → 0.0.1-beta.26
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.
|
@@ -1103,7 +1103,21 @@ async function queryPlannedWork() {
|
|
|
1103
1103
|
function hasPlannedWork(work) {
|
|
1104
1104
|
return work.uncommittedDrafts.length > 0 || work.inProgressEntries.length > 0 || work.openTensions.length > 0;
|
|
1105
1105
|
}
|
|
1106
|
-
function
|
|
1106
|
+
function formatRecoveryBlock(block) {
|
|
1107
|
+
const fmt = (items, overflow) => items.map((e) => `${e.entryId} [${e.collection}] ${e.name}`).join(", ") + (overflow && overflow > 0 ? ` (+${overflow} more)` : "");
|
|
1108
|
+
const lines = [
|
|
1109
|
+
"## Previous Session Recovery",
|
|
1110
|
+
"",
|
|
1111
|
+
`Session ${block.sessionId} \u2014 ${block.date}, ${block.duration}, status: ${block.status}`,
|
|
1112
|
+
`Created (${block.created.length + (block.createdOverflow ?? 0)}): ${fmt(block.created, block.createdOverflow)}`,
|
|
1113
|
+
`Modified (${block.modified.length + (block.modifiedOverflow ?? 0)}): ${fmt(block.modified, block.modifiedOverflow)}`,
|
|
1114
|
+
`Drafts needing attention (${block.draftsNeedingAttention.length + (block.draftsOverflow ?? 0)}): ${fmt(block.draftsNeedingAttention, block.draftsOverflow)}`,
|
|
1115
|
+
`Relations created: ${block.relationsCreated}`,
|
|
1116
|
+
""
|
|
1117
|
+
];
|
|
1118
|
+
return lines;
|
|
1119
|
+
}
|
|
1120
|
+
function buildPlannedWorkSection(work, priorSessions, recoveryBlock) {
|
|
1107
1121
|
if (!hasPlannedWork(work) && priorSessions.length === 0) return [];
|
|
1108
1122
|
const lines = [];
|
|
1109
1123
|
lines.push("## Continue from where you left off");
|
|
@@ -1133,7 +1147,7 @@ function buildPlannedWorkSection(work, priorSessions) {
|
|
|
1133
1147
|
lines.push(`- **${count} open tensions** \u2014 top: ${top.name}`);
|
|
1134
1148
|
}
|
|
1135
1149
|
}
|
|
1136
|
-
if (priorSessions.length > 0 && !hasPlannedWork(work)) {
|
|
1150
|
+
if (priorSessions.length > 0 && !hasPlannedWork(work) && !recoveryBlock) {
|
|
1137
1151
|
const last = priorSessions[0];
|
|
1138
1152
|
const date = new Date(last.startedAt).toISOString().split("T")[0];
|
|
1139
1153
|
const created = Array.isArray(last.entriesCreated) ? last.entriesCreated.length : last.entriesCreated ?? 0;
|
|
@@ -1142,6 +1156,10 @@ function buildPlannedWorkSection(work, priorSessions) {
|
|
|
1142
1156
|
lines.push(`- **Last session** (${date}): ${created} created, ${modified} modified`);
|
|
1143
1157
|
}
|
|
1144
1158
|
}
|
|
1159
|
+
if (recoveryBlock) {
|
|
1160
|
+
lines.push("");
|
|
1161
|
+
lines.push(...formatRecoveryBlock(recoveryBlock));
|
|
1162
|
+
}
|
|
1145
1163
|
lines.push("");
|
|
1146
1164
|
return lines;
|
|
1147
1165
|
}
|
|
@@ -1362,9 +1380,12 @@ function registerHealthTools(server) {
|
|
|
1362
1380
|
errors.push(`Workspace: ${e.message}`);
|
|
1363
1381
|
}
|
|
1364
1382
|
let priorSessions = [];
|
|
1383
|
+
let recoveryBlock = null;
|
|
1365
1384
|
if (wsCtx) {
|
|
1366
1385
|
try {
|
|
1367
|
-
|
|
1386
|
+
const sessionsResult = await mcpQuery("agent.recentSessions", { limit: 3 });
|
|
1387
|
+
priorSessions = sessionsResult?.sessions ?? [];
|
|
1388
|
+
recoveryBlock = sessionsResult?.recoveryBlock ?? null;
|
|
1368
1389
|
} catch {
|
|
1369
1390
|
}
|
|
1370
1391
|
}
|
|
@@ -1400,6 +1421,9 @@ function registerHealthTools(server) {
|
|
|
1400
1421
|
if (orientEntries?.strategicContext) {
|
|
1401
1422
|
const sc = orientEntries.strategicContext;
|
|
1402
1423
|
if (sc.vision) lines.push(`Vision: ${sc.vision}`);
|
|
1424
|
+
if (sc.productAreaCount != null && sc.productAreaCount > 0) {
|
|
1425
|
+
lines.push(`Product areas (${sc.productAreaCount}): ${(sc.productAreas ?? []).join(", ")}`);
|
|
1426
|
+
}
|
|
1403
1427
|
lines.push(`${sc.activeBetCount} active bet(s), ${sc.activeTensionCount} tension(s).`);
|
|
1404
1428
|
}
|
|
1405
1429
|
if (orientEntries?.taskContext && orientEntries.taskContext.context.length > 0) {
|
|
@@ -1412,7 +1436,10 @@ function registerHealthTools(server) {
|
|
|
1412
1436
|
lines.push(`- \`${e.entryId ?? e._id}\` ${e.name}${tensionPart}`);
|
|
1413
1437
|
}
|
|
1414
1438
|
}
|
|
1415
|
-
if (
|
|
1439
|
+
if (recoveryBlock) {
|
|
1440
|
+
lines.push("");
|
|
1441
|
+
lines.push(...formatRecoveryBlock(recoveryBlock));
|
|
1442
|
+
} else if (priorSessions.length > 0) {
|
|
1416
1443
|
const last = priorSessions[0];
|
|
1417
1444
|
const date = new Date(last.startedAt).toISOString().split("T")[0];
|
|
1418
1445
|
const created = Array.isArray(last.entriesCreated) ? last.entriesCreated.length : last.entriesCreated ?? 0;
|
|
@@ -1482,6 +1509,9 @@ function registerHealthTools(server) {
|
|
|
1482
1509
|
const sc = orientEntries.strategicContext;
|
|
1483
1510
|
lines.push("## Strategic Context");
|
|
1484
1511
|
if (sc.vision) lines.push(`**Vision:** ${sc.vision}`);
|
|
1512
|
+
if (sc.productAreaCount != null && sc.productAreaCount > 0) {
|
|
1513
|
+
lines.push(`**Product areas (${sc.productAreaCount}):** ${(sc.productAreas ?? []).join(", ")}`);
|
|
1514
|
+
}
|
|
1485
1515
|
const betLine = sc.currentBet ? `**Current bet:** ${sc.currentBet}. ${sc.activeBetCount} active bet(s).` : "No active bets.";
|
|
1486
1516
|
lines.push(`${betLine} ${sc.activeTensionCount} open tension(s).`);
|
|
1487
1517
|
lines.push("");
|
|
@@ -1555,10 +1585,10 @@ function registerHealthTools(server) {
|
|
|
1555
1585
|
}
|
|
1556
1586
|
const plannedWork = await queryPlannedWork();
|
|
1557
1587
|
if (hasPlannedWork(plannedWork)) {
|
|
1558
|
-
lines.push(...buildPlannedWorkSection(plannedWork, priorSessions));
|
|
1588
|
+
lines.push(...buildPlannedWorkSection(plannedWork, priorSessions, recoveryBlock));
|
|
1559
1589
|
} else {
|
|
1560
1590
|
const briefingItems = [];
|
|
1561
|
-
if (priorSessions.length > 0) {
|
|
1591
|
+
if (priorSessions.length > 0 && !recoveryBlock) {
|
|
1562
1592
|
const last = priorSessions[0];
|
|
1563
1593
|
const date = new Date(last.startedAt).toISOString().split("T")[0];
|
|
1564
1594
|
const created = Array.isArray(last.entriesCreated) ? last.entriesCreated.length : last.entriesCreated ?? 0;
|
|
@@ -1575,6 +1605,10 @@ function registerHealthTools(server) {
|
|
|
1575
1605
|
}
|
|
1576
1606
|
lines.push("");
|
|
1577
1607
|
}
|
|
1608
|
+
if (recoveryBlock) {
|
|
1609
|
+
lines.push("");
|
|
1610
|
+
lines.push(...formatRecoveryBlock(recoveryBlock));
|
|
1611
|
+
}
|
|
1578
1612
|
}
|
|
1579
1613
|
lines.push("What would you like to work on?");
|
|
1580
1614
|
lines.push("");
|
|
@@ -4024,8 +4058,11 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors) {
|
|
|
4024
4058
|
const wsFullCtx = await getWorkspaceContext();
|
|
4025
4059
|
const { ageDays, isNeglected } = computeWorkspaceAge(wsFullCtx.createdAt);
|
|
4026
4060
|
let priorSessions = [];
|
|
4061
|
+
let recoveryBlock = null;
|
|
4027
4062
|
try {
|
|
4028
|
-
|
|
4063
|
+
const sessionsResult = await mcpQuery("agent.recentSessions", { limit: 3 });
|
|
4064
|
+
priorSessions = sessionsResult?.sessions ?? [];
|
|
4065
|
+
recoveryBlock = sessionsResult?.recoveryBlock ?? null;
|
|
4029
4066
|
} catch {
|
|
4030
4067
|
}
|
|
4031
4068
|
let openTensions = [];
|
|
@@ -4080,10 +4117,10 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors) {
|
|
|
4080
4117
|
const plannedWork = await queryPlannedWork();
|
|
4081
4118
|
if (hasPlannedWork(plannedWork)) {
|
|
4082
4119
|
lines.push("");
|
|
4083
|
-
lines.push(...buildPlannedWorkSection(plannedWork, priorSessions));
|
|
4120
|
+
lines.push(...buildPlannedWorkSection(plannedWork, priorSessions, recoveryBlock));
|
|
4084
4121
|
} else {
|
|
4085
4122
|
const briefingItems = [];
|
|
4086
|
-
if (priorSessions.length > 0) {
|
|
4123
|
+
if (priorSessions.length > 0 && !recoveryBlock) {
|
|
4087
4124
|
const last = priorSessions[0];
|
|
4088
4125
|
const date = new Date(last.startedAt).toISOString().split("T")[0];
|
|
4089
4126
|
const created = Array.isArray(last.entriesCreated) ? last.entriesCreated.length : last.entriesCreated ?? 0;
|
|
@@ -4101,6 +4138,10 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors) {
|
|
|
4101
4138
|
}
|
|
4102
4139
|
lines.push("");
|
|
4103
4140
|
}
|
|
4141
|
+
if (recoveryBlock) {
|
|
4142
|
+
lines.push("");
|
|
4143
|
+
lines.push(...formatRecoveryBlock(recoveryBlock));
|
|
4144
|
+
}
|
|
4104
4145
|
}
|
|
4105
4146
|
lines.push("What would you like to work on?");
|
|
4106
4147
|
lines.push("");
|
|
@@ -4686,4 +4727,4 @@ export {
|
|
|
4686
4727
|
SERVER_VERSION,
|
|
4687
4728
|
createProductBrainServer
|
|
4688
4729
|
};
|
|
4689
|
-
//# sourceMappingURL=chunk-
|
|
4730
|
+
//# sourceMappingURL=chunk-PVWT5LIB.js.map
|