@productbrain/mcp 0.0.1-beta.7452 → 0.0.1-beta.7469
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-W3MMAXXC.js → chunk-FH2FDUVL.js} +2 -4
- package/dist/{chunk-W3MMAXXC.js.map → chunk-FH2FDUVL.js.map} +1 -1
- package/dist/{chunk-MJUDIDTR.js → chunk-YSYPHLXD.js} +81 -26
- package/dist/chunk-YSYPHLXD.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-TFFK25P7.js → setup-6TF45VXR.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-MJUDIDTR.js.map +0 -1
- /package/dist/{setup-TFFK25P7.js.map → setup-6TF45VXR.js.map} +0 -0
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
trackSessionCaptureRate,
|
|
42
42
|
trackWriteBackHintServed,
|
|
43
43
|
trackZeroCaptureAuditFired
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-FH2FDUVL.js";
|
|
45
45
|
|
|
46
46
|
// src/server.ts
|
|
47
47
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -7825,6 +7825,42 @@ function replaceVocabTokens(body, workspaceCtx, collectionCtxMap) {
|
|
|
7825
7825
|
});
|
|
7826
7826
|
}
|
|
7827
7827
|
|
|
7828
|
+
// src/lib/ruleListRender.ts
|
|
7829
|
+
var RULE_LIST_CONTROL_CHARS_RE = /[\x00-\x08\x0b-\x1f\x7f]/g;
|
|
7830
|
+
function sanitizeRuleListField(value) {
|
|
7831
|
+
return value.replace(RULE_LIST_CONTROL_CHARS_RE, "").replace(/\s+/g, " ").trim();
|
|
7832
|
+
}
|
|
7833
|
+
function formatRuleListRow(row) {
|
|
7834
|
+
const entryId = sanitizeRuleListField(row.entryId);
|
|
7835
|
+
const owner = row.ownerRoleId ? sanitizeRuleListField(row.ownerRoleId) : "\u2014";
|
|
7836
|
+
const team = row.teamId ? ` (team ${sanitizeRuleListField(row.teamId)})` : "";
|
|
7837
|
+
const servedAt = row.servedAt ? ` \u2014 served ${new Date(row.servedAt).toISOString()}` : "";
|
|
7838
|
+
return `${entryId} \u2014 owner ${owner}${team}${servedAt}`;
|
|
7839
|
+
}
|
|
7840
|
+
function formatRuleListBucketLines(label, bucket, truncated) {
|
|
7841
|
+
if (!bucket || bucket.rows.length === 0) return [];
|
|
7842
|
+
const lines = [`${label}:`, ...bucket.rows.map((r) => ` - ${formatRuleListRow(r)}`)];
|
|
7843
|
+
if (bucket.overCap > 0) lines.push(` (${truncated ? "at least " : ""}+${bucket.overCap} more, capped)`);
|
|
7844
|
+
return lines;
|
|
7845
|
+
}
|
|
7846
|
+
function formatRuleListsLines(ruleLists) {
|
|
7847
|
+
if (!ruleLists) return [];
|
|
7848
|
+
const lines = [
|
|
7849
|
+
...formatRuleListBucketLines("Everyone", ruleLists.everyone, ruleLists.truncated),
|
|
7850
|
+
...formatRuleListBucketLines("Team", ruleLists.team, ruleLists.truncated),
|
|
7851
|
+
...formatRuleListBucketLines("Role", ruleLists.role, ruleLists.truncated)
|
|
7852
|
+
];
|
|
7853
|
+
if (lines.length === 0 && ruleLists.unassigned === 0 && !ruleLists.truncated) return [];
|
|
7854
|
+
if (ruleLists.truncated) {
|
|
7855
|
+
lines.push("(Some Current rules may be missing from these lists \u2014 the underlying read was truncated.)");
|
|
7856
|
+
}
|
|
7857
|
+
if (ruleLists.unassigned > 0) {
|
|
7858
|
+
const atLeast = ruleLists.truncated ? "at least " : "";
|
|
7859
|
+
lines.push(`(${atLeast}${ruleLists.unassigned} rule(s) opted into a list but could not be resolved \u2014 excluded, not silently dropped.)`);
|
|
7860
|
+
}
|
|
7861
|
+
return lines;
|
|
7862
|
+
}
|
|
7863
|
+
|
|
7828
7864
|
// src/tools/start_pb.ts
|
|
7829
7865
|
import { z as z17 } from "zod/v3";
|
|
7830
7866
|
|
|
@@ -8041,24 +8077,27 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
8041
8077
|
} catch {
|
|
8042
8078
|
}
|
|
8043
8079
|
let governanceEntries = { principles: [], standards: [], businessRules: [] };
|
|
8080
|
+
let ruleListsView;
|
|
8081
|
+
let bindingGovernanceView;
|
|
8082
|
+
try {
|
|
8083
|
+
bindingGovernanceView = await kernelQuery("chain.getBindingGovernanceView", { task });
|
|
8084
|
+
ruleListsView = bindingGovernanceView?.ruleLists;
|
|
8085
|
+
} catch {
|
|
8086
|
+
}
|
|
8044
8087
|
if (task) {
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
const
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
businessRules: (bg.businessRules ?? []).map(mapGovEntry)
|
|
8059
|
-
};
|
|
8060
|
-
}
|
|
8061
|
-
} catch {
|
|
8088
|
+
const bg = bindingGovernanceView?.bindingGovernance;
|
|
8089
|
+
if (bg) {
|
|
8090
|
+
const mapGovEntry = (e) => ({
|
|
8091
|
+
entryId: e.entryId ?? void 0,
|
|
8092
|
+
name: e.name,
|
|
8093
|
+
description: typeof e.preview === "string" ? e.preview : void 0,
|
|
8094
|
+
tier: typeof e.tier === "number" ? e.tier : void 0
|
|
8095
|
+
});
|
|
8096
|
+
governanceEntries = {
|
|
8097
|
+
principles: (bg.principles ?? []).map(mapGovEntry),
|
|
8098
|
+
standards: (bg.standards ?? []).map(mapGovEntry),
|
|
8099
|
+
businessRules: (bg.businessRules ?? []).map(mapGovEntry)
|
|
8100
|
+
};
|
|
8062
8101
|
}
|
|
8063
8102
|
}
|
|
8064
8103
|
if (task) {
|
|
@@ -8073,6 +8112,8 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
8073
8112
|
lines.push("");
|
|
8074
8113
|
}
|
|
8075
8114
|
lines.push(...buildOperatingProtocol(governanceEntries, task));
|
|
8115
|
+
const ruleLines = formatRuleListsLines(ruleListsView);
|
|
8116
|
+
if (ruleLines.length > 0) lines.push("", "Rules:", ...ruleLines);
|
|
8076
8117
|
if (coherence) {
|
|
8077
8118
|
lines.push(...coherence.lines);
|
|
8078
8119
|
}
|
|
@@ -8118,6 +8159,8 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
8118
8159
|
lines.push("");
|
|
8119
8160
|
}
|
|
8120
8161
|
lines.push(...buildOperatingProtocol());
|
|
8162
|
+
const noTaskRuleLines = formatRuleListsLines(ruleListsView);
|
|
8163
|
+
if (noTaskRuleLines.length > 0) lines.push("", "Rules:", ...noTaskRuleLines);
|
|
8121
8164
|
if (coherence) {
|
|
8122
8165
|
lines.push(...coherence.lines);
|
|
8123
8166
|
}
|
|
@@ -8174,7 +8217,9 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
8174
8217
|
...agentSessionId ? { sessionId: agentSessionId } : {},
|
|
8175
8218
|
// PR #519 review round 3 (Codex P2): the rendered shape-advisory line must reach
|
|
8176
8219
|
// structuredContent too, matching orient.ts's brief/full sites.
|
|
8177
|
-
...shapeAdvisorySummary ? { shapeAdvisorySummary } : {}
|
|
8220
|
+
...shapeAdvisorySummary ? { shapeAdvisorySummary } : {},
|
|
8221
|
+
...ruleListsView ? { ruleLists: ruleListsView } : {}
|
|
8222
|
+
// TASK-436 (DEC-1774)
|
|
8178
8223
|
},
|
|
8179
8224
|
next.length > 0 ? next : void 0
|
|
8180
8225
|
)
|
|
@@ -8267,9 +8312,7 @@ var orientSchema = z18.object({
|
|
|
8267
8312
|
task: z18.string().max(2e3).optional().describe(
|
|
8268
8313
|
"For 'task': natural-language task description for task-scoped context. For 'start': what you're about to work on. When provided to 'task', orient returns scored, relevant entries for the task."
|
|
8269
8314
|
),
|
|
8270
|
-
// D1d (WP-754/TASK-204):
|
|
8271
|
-
// field optional, sanitized server-side. Domain resolution (this envelope's original purpose)
|
|
8272
|
-
// is deleted; the sole surviving consumer is `context.served` activation telemetry.
|
|
8315
|
+
// D1d (WP-754/TASK-204): matches the server's StartupResolutionSignals shape; domain resolution (original purpose) is deleted, sole survivor is `context.served` telemetry.
|
|
8273
8316
|
startupSignals: z18.object({
|
|
8274
8317
|
changedPaths: z18.array(z18.string()).max(25).optional().describe("Paths changed in the current working tree, if known (e.g. from a prior git status/diff tool call)."),
|
|
8275
8318
|
reviewedArtifactRefs: z18.array(z18.string()).max(25).optional().describe("Chain entry IDs the caller has already reviewed this session, if tracked."),
|
|
@@ -8588,6 +8631,8 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
8588
8631
|
} else {
|
|
8589
8632
|
lines.push(...buildOperatingProtocol());
|
|
8590
8633
|
}
|
|
8634
|
+
const ruleLines = formatRuleListsLines(orientView.ruleLists);
|
|
8635
|
+
if (ruleLines.length > 0) lines.push("", "Rules:", ...ruleLines);
|
|
8591
8636
|
}
|
|
8592
8637
|
let orientationStatus2 = "no_session";
|
|
8593
8638
|
if (agentSessionId && hasTaskGrounding) {
|
|
@@ -8657,8 +8702,10 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
8657
8702
|
// WP-560/TEN-2532 (Codex P2): text-parity, not text-only
|
|
8658
8703
|
// WP-622 follow-up (Copilot review PR #601, post-merge): brief structuredContent parity with full mode.
|
|
8659
8704
|
...orientView?.strategyHighlights?.length ? { strategyHighlights: orientView.strategyHighlights } : {},
|
|
8660
|
-
...orientView?.strategicSpine ? { strategicSpine: orientView.strategicSpine } : {}
|
|
8705
|
+
...orientView?.strategicSpine ? { strategicSpine: orientView.strategicSpine } : {},
|
|
8661
8706
|
// WP-771 S4 round 2 (Codex finding 4): text parity
|
|
8707
|
+
...orientView?.ruleLists ? { ruleLists: orientView.ruleLists } : {}
|
|
8708
|
+
// TASK-436 (DEC-1774)
|
|
8662
8709
|
}
|
|
8663
8710
|
)
|
|
8664
8711
|
};
|
|
@@ -8897,6 +8944,8 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
8897
8944
|
businessRules: (gov.businessRules ?? []).map(mapGovernanceEntry)
|
|
8898
8945
|
}, task));
|
|
8899
8946
|
}
|
|
8947
|
+
const ruleLines2 = formatRuleListsLines(orientView?.ruleLists);
|
|
8948
|
+
if (ruleLines2.length > 0) lines.push("", "Rules:", ...ruleLines2);
|
|
8900
8949
|
let allEntries = [];
|
|
8901
8950
|
try {
|
|
8902
8951
|
allEntries = await kernelQuery("chain.listEntries", {
|
|
@@ -9059,8 +9108,10 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
9059
9108
|
...orientView?.shapeAdvisorySummary ? { shapeAdvisorySummary: orientView.shapeAdvisorySummary } : {},
|
|
9060
9109
|
// WP-622 (Copilot review PR #601 P2): was dropped from the full-mode machine payload.
|
|
9061
9110
|
...orientView?.strategyHighlights?.length ? { strategyHighlights: orientView.strategyHighlights } : {},
|
|
9062
|
-
...orientView?.strategicSpine ? { strategicSpine: orientView.strategicSpine } : {}
|
|
9111
|
+
...orientView?.strategicSpine ? { strategicSpine: orientView.strategicSpine } : {},
|
|
9063
9112
|
// WP-771 S4 round 2 (Codex finding 4): full-mode parity
|
|
9113
|
+
...orientView?.ruleLists ? { ruleLists: orientView.ruleLists } : {}
|
|
9114
|
+
// TASK-436 (DEC-1774)
|
|
9064
9115
|
}
|
|
9065
9116
|
)
|
|
9066
9117
|
};
|
|
@@ -12225,6 +12276,8 @@ async function handleStart2(data) {
|
|
|
12225
12276
|
if (noticeLines.length > 0) {
|
|
12226
12277
|
lines.push("", "Notices:", ...noticeLines);
|
|
12227
12278
|
}
|
|
12279
|
+
const ruleLines = formatRuleListsLines(result2.ruleLists);
|
|
12280
|
+
if (ruleLines.length > 0) lines.push("", "Rules:", ...ruleLines);
|
|
12228
12281
|
const summary = `Session ${result2.sessionId} active. Workspace ${result2.workspaceName}. Write tools available after orient.`;
|
|
12229
12282
|
return {
|
|
12230
12283
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
@@ -12237,7 +12290,9 @@ async function handleStart2(data) {
|
|
|
12237
12290
|
roleName: result2.roleName,
|
|
12238
12291
|
feedbackQueueNew: result2.feedbackQueueNew,
|
|
12239
12292
|
feedbackOldestNewAt: result2.feedbackOldestNewAt,
|
|
12240
|
-
notices: result2.notices ?? []
|
|
12293
|
+
notices: result2.notices ?? [],
|
|
12294
|
+
ruleLists: result2.ruleLists
|
|
12295
|
+
// TASK-436
|
|
12241
12296
|
// Finding #16: bare `parameters: {}` lets orient's schema default kick in
|
|
12242
12297
|
// (action defaults to "task", which requires a `task` string) — the suggested
|
|
12243
12298
|
// next-action call failed validation instead of running. `action: "start"` is
|
|
@@ -14791,4 +14846,4 @@ export {
|
|
|
14791
14846
|
createProductBrainServer,
|
|
14792
14847
|
initFeatureFlags
|
|
14793
14848
|
};
|
|
14794
|
-
//# sourceMappingURL=chunk-
|
|
14849
|
+
//# sourceMappingURL=chunk-YSYPHLXD.js.map
|