@productbrain/mcp 0.0.1-beta.8643 → 0.0.1-beta.8647
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.
|
@@ -7675,20 +7675,6 @@ function formatBriefingLines(view) {
|
|
|
7675
7675
|
|
|
7676
7676
|
// src/tools/orient-rituals.ts
|
|
7677
7677
|
var RULE_LISTS_EVERYONE_ONLY_LABEL = "Rules (everyone list only; run `orient mode=full` for your team and role lists):";
|
|
7678
|
-
var RULE_LISTS_UNAVAILABLE_LINE = "Rules: unavailable \u2014 rule list fetch failed, retry `orient mode=full`";
|
|
7679
|
-
function buildEveryoneOnlyRuleListsLines(ruleLists) {
|
|
7680
|
-
if (!ruleLists) return [];
|
|
7681
|
-
const everyoneOnly = {
|
|
7682
|
-
everyone: ruleLists.everyone,
|
|
7683
|
-
team: null,
|
|
7684
|
-
role: { rows: [], overCap: 0 },
|
|
7685
|
-
unassigned: ruleLists.unassigned,
|
|
7686
|
-
truncated: ruleLists.truncated,
|
|
7687
|
-
...ruleLists.namesTruncated ? { namesTruncated: true } : {}
|
|
7688
|
-
};
|
|
7689
|
-
const bucketLines = formatRuleListsLines(everyoneOnly);
|
|
7690
|
-
return [RULE_LISTS_EVERYONE_ONLY_LABEL, bucketLines.length > 0 ? bucketLines.join("\n") : "(none currently served)"];
|
|
7691
|
-
}
|
|
7692
7678
|
var SPINE_UNAVAILABLE_LINE = "Spine check: unavailable \u2014 orient fetch failed, retry `orient`";
|
|
7693
7679
|
function buildRitualsSurfaceLines(view, opts) {
|
|
7694
7680
|
const lines = [""];
|
|
@@ -7703,81 +7689,15 @@ function buildRitualsSurfaceLines(view, opts) {
|
|
|
7703
7689
|
if (view?.atCapLine) lines.push(view.atCapLine);
|
|
7704
7690
|
return lines;
|
|
7705
7691
|
}
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
function buildKeyResultLine(kr, objName) {
|
|
7716
|
-
const idPart = kr.entryId ? `${toSafeCodeSpan(sanitizeSingleLineField(kr.entryId))} ` : "";
|
|
7717
|
-
const unresolvedTag = kr.readingUnresolved ? " [reading unresolved]" : "";
|
|
7718
|
-
const values = `${krValue(kr.currentValue)} / ${krValue(kr.targetValue)} [${kr.staleness}]${unresolvedTag}`;
|
|
7719
|
-
const suffix = objName ? ` (${sanitizeSingleLineField(objName)})` : "";
|
|
7720
|
-
return `**Key result:** ${idPart}${sanitizeSingleLineField(kr.name)}${suffix}: ${values}`;
|
|
7721
|
-
}
|
|
7722
|
-
function toSafeCodeSpan(text) {
|
|
7723
|
-
const longestBacktickRun = (text.match(/`+/g) ?? []).reduce((max, run) => Math.max(max, run.length), 0);
|
|
7724
|
-
const fence = "`".repeat(longestBacktickRun + 1);
|
|
7725
|
-
const pad = text.startsWith("`") || text.endsWith("`") ? " " : "";
|
|
7726
|
-
return `${fence}${pad}${text}${pad}${fence}`;
|
|
7727
|
-
}
|
|
7728
|
-
function buildDirectionLines(view) {
|
|
7729
|
-
const purpose = view?.strategicContext?.purpose;
|
|
7730
|
-
const vision = view?.strategicContext?.vision;
|
|
7731
|
-
const productAreas = view?.strategicContext?.productAreas ?? [];
|
|
7732
|
-
const spine = view?.strategicSpine;
|
|
7733
|
-
const objectives = spine?.objectives ?? [];
|
|
7734
|
-
const orphanKeyResults = spine?.orphanKeyResults ?? [];
|
|
7735
|
-
const truncationReasons = spine?.truncationReasons ?? [];
|
|
7736
|
-
const fetchFailed = spine?.fetchFailed ?? false;
|
|
7737
|
-
const krRows = objectives.flatMap((o) => o.keyResults.map((kr) => ({ o, kr })));
|
|
7738
|
-
const strategy = (view?.strategyHighlights ?? []).filter(
|
|
7739
|
-
(e) => typeof e === "object" && e != null && typeof e.name === "string" && e.name.length > 0
|
|
7740
|
-
);
|
|
7741
|
-
const hasSomething = purpose || vision || strategy.length > 0 || productAreas.length > 0 || objectives.length > 0 || orphanKeyResults.length > 0 || truncationReasons.length > 0 || fetchFailed;
|
|
7742
|
-
if (!hasSomething) return [];
|
|
7743
|
-
const lines = ["## Strategic Context"];
|
|
7744
|
-
for (const section of spine?.order ?? DEFAULT_SPINE_ORDER) {
|
|
7745
|
-
if (section === "purpose") {
|
|
7746
|
-
if (purpose) lines.push(`**Purpose:** ${stripControlChars(purpose)}`);
|
|
7747
|
-
} else if (section === "vision") {
|
|
7748
|
-
if (vision) lines.push(`**Vision:** ${stripControlChars(vision)}`);
|
|
7749
|
-
} else if (section === "strategy") lines.push(...buildStrategyRowLines(strategy));
|
|
7750
|
-
else if (section === "product") {
|
|
7751
|
-
if (productAreas.length > 0) lines.push(`**Product areas:** ${productAreas.join(", ")}`);
|
|
7752
|
-
} else if (section === "objectives") {
|
|
7753
|
-
if (fetchFailed) lines.push("**Strategic spine:** unavailable \u2014 orient fetch failed, retry `orient`.");
|
|
7754
|
-
else if (objectives.length > 0) {
|
|
7755
|
-
for (const obj of objectives) {
|
|
7756
|
-
const idPart = obj.entryId ? `${toSafeCodeSpan(sanitizeSingleLineField(obj.entryId))} ` : "";
|
|
7757
|
-
lines.push(`**Objective:** ${idPart}${sanitizeSingleLineField(obj.name)}`);
|
|
7758
|
-
}
|
|
7759
|
-
}
|
|
7760
|
-
} else if (section === "keyResults" && !fetchFailed && (krRows.length > 0 || orphanKeyResults.length > 0 || truncationReasons.length > 0)) {
|
|
7761
|
-
for (const { o, kr } of krRows) lines.push(buildKeyResultLine(kr, o.name));
|
|
7762
|
-
if (orphanKeyResults.length > 0) {
|
|
7763
|
-
lines.push("**Key results without an objective:**");
|
|
7764
|
-
for (const kr of orphanKeyResults) lines.push(buildKeyResultLine(kr, null));
|
|
7765
|
-
}
|
|
7766
|
-
for (const reason of truncationReasons) lines.push(TRUNCATION_MESSAGES[reason]);
|
|
7767
|
-
}
|
|
7768
|
-
}
|
|
7769
|
-
return lines;
|
|
7770
|
-
}
|
|
7771
|
-
function buildStrategyRowLines(strategy) {
|
|
7772
|
-
const lines = [];
|
|
7773
|
-
for (const row of strategy) {
|
|
7774
|
-
const mark = provenanceMark(row.provenance);
|
|
7775
|
-
const rawId = row.entryId ?? row._id;
|
|
7776
|
-
const idPart = typeof rawId === "string" && rawId ? `${toSafeCodeSpan(sanitizeSingleLineField(rawId))} ` : "";
|
|
7777
|
-
const anchorSuffix = row.anchoredBy ? ` (${sanitizeSingleLineField(row.anchoredBy)})` : "";
|
|
7778
|
-
const preview = typeof row.preview === "string" && row.preview ? ` \u2014 ${stripControlChars(row.preview)}` : "";
|
|
7779
|
-
lines.push(`**Strategy:** ${mark}${idPart}${sanitizeSingleLineField(row.name)}${anchorSuffix}${preview}`);
|
|
7780
|
-
}
|
|
7692
|
+
function buildOrientBriefingLines(view, opts) {
|
|
7693
|
+
if (!view) return [];
|
|
7694
|
+
const rl = view.ruleLists ?? void 0;
|
|
7695
|
+
const ruleLists = rl && opts?.everyoneOnly ? { everyone: rl.everyone, team: null, role: { rows: [], overCap: 0 }, unassigned: rl.unassigned, truncated: rl.truncated, ...rl.namesTruncated ? { namesTruncated: true } : {} } : rl;
|
|
7696
|
+
const lines = formatBriefingLines({ facts: view.briefing ?? void 0, ruleLists, surface: "mcp" });
|
|
7697
|
+
if (!opts?.everyoneOnly || !rl) return lines;
|
|
7698
|
+
if (lines.includes("Rules:")) return lines.map((l) => l === "Rules:" ? RULE_LISTS_EVERYONE_ONLY_LABEL : l);
|
|
7699
|
+
const pull = lines.findIndex((l) => l.startsWith("Pull more:"));
|
|
7700
|
+
lines.splice(pull < 0 ? lines.length : pull, 0, RULE_LISTS_EVERYONE_ONLY_LABEL, "(none currently served)", "");
|
|
7781
7701
|
return lines;
|
|
7782
7702
|
}
|
|
7783
7703
|
async function fetchAndRenderOpenerDirection(kernelQuery2, errors, session) {
|
|
@@ -7786,7 +7706,7 @@ async function fetchAndRenderOpenerDirection(kernelQuery2, errors, session) {
|
|
|
7786
7706
|
try {
|
|
7787
7707
|
view = await kernelQuery2("chain.getOrientView", {
|
|
7788
7708
|
tier: "standard",
|
|
7789
|
-
invocationPath: "session-start",
|
|
7709
|
+
invocationPath: session?.invocationPath ?? "session-start",
|
|
7790
7710
|
// Stamps this call onto the current session/conversation/task (same as every other
|
|
7791
7711
|
// chain.getOrientView caller) so recordOrientMetric's orientCallCount/billing rollup sees it.
|
|
7792
7712
|
...session?.agentSessionId ? { sessionId: session.agentSessionId } : {},
|
|
@@ -7797,32 +7717,15 @@ async function fetchAndRenderOpenerDirection(kernelQuery2, errors, session) {
|
|
|
7797
7717
|
fetchFailed = true;
|
|
7798
7718
|
errors.push(`Direction unavailable: ${e instanceof Error ? e.message : String(e)}`);
|
|
7799
7719
|
}
|
|
7800
|
-
return [...
|
|
7720
|
+
return { lines: [...buildOrientBriefingLines(view), ...buildRitualsSurfaceLines(view, { fetchFailed: fetchFailed || view?.fetchFailed === true })], view };
|
|
7801
7721
|
}
|
|
7802
7722
|
async function buildAlreadyOrientedResult(kernelQuery2, agentSessionId, taskGroundingWarningLines2) {
|
|
7803
|
-
const
|
|
7804
|
-
|
|
7805
|
-
// conflictQueue.ts's minute-bucket convention — forces a fresh reactive result once a snooze
|
|
7806
|
-
// expires on wall-clock time alone, with no corresponding DB write to bust the cache.
|
|
7807
|
-
kernelQuery2("chain.getRitualsSurface", {
|
|
7808
|
-
now: Math.floor(Date.now() / 6e4) * 6e4
|
|
7809
|
-
}),
|
|
7810
|
-
kernelQuery2("chain.getBindingGovernanceView", {})
|
|
7811
|
-
]);
|
|
7812
|
-
const ritualsFetchFailed = ritualsSettled.status === "rejected";
|
|
7813
|
-
const rituals = ritualsSettled.status === "fulfilled" ? ritualsSettled.value : null;
|
|
7814
|
-
const ruleListsFetchFailed = bindingGovernanceSettled.status === "rejected";
|
|
7815
|
-
const ruleLists = bindingGovernanceSettled.status === "fulfilled" ? bindingGovernanceSettled.value?.ruleLists : void 0;
|
|
7816
|
-
const ritualsLines = buildRitualsSurfaceLines(rituals, { fetchFailed: ritualsFetchFailed });
|
|
7817
|
-
const ruleListsBlock = ruleListsFetchFailed ? `${RULE_LISTS_UNAVAILABLE_LINE}
|
|
7818
|
-
|
|
7819
|
-
` : ruleLists !== void 0 ? `${buildEveryoneOnlyRuleListsLines(ruleLists).join("\n")}
|
|
7820
|
-
|
|
7821
|
-
` : "";
|
|
7723
|
+
const errors = [];
|
|
7724
|
+
const { lines, view } = await fetchAndRenderOpenerDirection(kernelQuery2, errors, { agentSessionId, invocationPath: "manual-orient" });
|
|
7822
7725
|
return {
|
|
7823
7726
|
content: [{
|
|
7824
7727
|
type: "text",
|
|
7825
|
-
text: "Already oriented. Session active, writes unlocked.\n" +
|
|
7728
|
+
text: "Already oriented. Session active, writes unlocked.\n" + [...errors, ...lines].join("\n") + "\n\n" + taskGroundingWarningLines2.join("\n") + "Use `orient mode='full'` for workspace context or `orient task='...'` before substantive work."
|
|
7826
7729
|
}],
|
|
7827
7730
|
structuredContent: success(
|
|
7828
7731
|
"Already oriented. Session active, writes unlocked.",
|
|
@@ -7832,35 +7735,15 @@ async function buildAlreadyOrientedResult(kernelQuery2, agentSessionId, taskGrou
|
|
|
7832
7735
|
taskGroundingStatus: "workspace_only",
|
|
7833
7736
|
taskGroundingRequired: true,
|
|
7834
7737
|
nextStep: 'Run `orient task="describe the work"` before substantive work.',
|
|
7835
|
-
// T1's undefined-vs-null distinction: omit the key on a fetch failure, keep an explicit
|
|
7836
|
-
|
|
7837
|
-
...
|
|
7838
|
-
...
|
|
7839
|
-
...
|
|
7840
|
-
// PR #538
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
...rituals?.atCapLine !== void 0 ? { atCapLine: rituals.atCapLine } : {},
|
|
7845
|
-
// Pre-review fix 1 (TEN-3912): team/role dropped from THIS path's payload — they are
|
|
7846
|
-
// always trivial here (see the doc comment above), never this session's real rules —
|
|
7847
|
-
// and `ruleListsScope` says explicitly why, rather than shipping a shape a consumer could
|
|
7848
|
-
// misread as "this session has no team/role rules".
|
|
7849
|
-
...ruleLists ? {
|
|
7850
|
-
ruleLists: {
|
|
7851
|
-
everyone: ruleLists.everyone,
|
|
7852
|
-
unassigned: ruleLists.unassigned,
|
|
7853
|
-
truncated: ruleLists.truncated,
|
|
7854
|
-
...ruleLists.namesTruncated ? { namesTruncated: true } : {}
|
|
7855
|
-
},
|
|
7856
|
-
ruleListsScope: "everyone-only"
|
|
7857
|
-
} : {},
|
|
7858
|
-
// Round 1 review (PRRT_kwDORS4ils6mOeU8, TEN-3912): explicit `true` only on the rejection
|
|
7859
|
-
// above, mirroring the existing `fetchFailed`/`groundingStub`-style boolean flags on this
|
|
7860
|
-
// same payload (present-and-true means "this happened", omitted means "it didn't") — never
|
|
7861
|
-
// a bare `false`, never inferred from `ruleLists` being absent (a genuine no-row read also
|
|
7862
|
-
// leaves it undefined).
|
|
7863
|
-
...ruleListsFetchFailed ? { ruleListsFetchFailed: true } : {}
|
|
7738
|
+
// T1's undefined-vs-null distinction: omit the key on a fetch failure, keep an explicit null for a genuine no-row arm.
|
|
7739
|
+
...view?.directionLine !== void 0 ? { directionLine: view.directionLine } : {},
|
|
7740
|
+
...view?.verdictAskLine !== void 0 ? { verdictAskLine: view.verdictAskLine } : {},
|
|
7741
|
+
...view?.spineLine !== void 0 ? { spineLine: view.spineLine } : {},
|
|
7742
|
+
...view?.atCapLine !== void 0 ? { atCapLine: view.atCapLine } : {},
|
|
7743
|
+
// PR #538: text and structure carry the same at-cap disclosure
|
|
7744
|
+
...view?.briefing ? { briefing: view.briefing } : {},
|
|
7745
|
+
...view?.ruleLists ? { ruleLists: view.ruleLists } : {},
|
|
7746
|
+
...view ? {} : { fetchFailed: true }
|
|
7864
7747
|
}
|
|
7865
7748
|
)
|
|
7866
7749
|
};
|
|
@@ -8131,7 +8014,8 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
8131
8014
|
lines.push("");
|
|
8132
8015
|
const startShapeLine = formatShapeAdvisorySummaryLine(shapeAdvisorySummary);
|
|
8133
8016
|
if (startShapeLine) lines.push(startShapeLine, "");
|
|
8134
|
-
|
|
8017
|
+
const opener = await fetchAndRenderOpenerDirection(kernelQuery, errors, { agentSessionId, conversationId: getConversationId(), task });
|
|
8018
|
+
lines.push(...opener.lines);
|
|
8135
8019
|
lines.push("_Need a collection that doesn't exist yet? Creating one is not available through this tool. Ask a platform admin to provision it, or enable the module ontology pack that owns it._");
|
|
8136
8020
|
lines.push("");
|
|
8137
8021
|
let activeBets = [];
|
|
@@ -8141,11 +8025,10 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
8141
8025
|
} catch {
|
|
8142
8026
|
}
|
|
8143
8027
|
let governanceEntries = { principles: [], standards: [], businessRules: [] };
|
|
8144
|
-
|
|
8028
|
+
const ruleListsView = opener.view?.ruleLists ?? void 0;
|
|
8145
8029
|
let bindingGovernanceView;
|
|
8146
8030
|
try {
|
|
8147
8031
|
bindingGovernanceView = await kernelQuery("chain.getBindingGovernanceView", { task });
|
|
8148
|
-
ruleListsView = bindingGovernanceView?.ruleLists;
|
|
8149
8032
|
} catch {
|
|
8150
8033
|
}
|
|
8151
8034
|
if (task) {
|
|
@@ -8179,8 +8062,6 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
8179
8062
|
lines.push("");
|
|
8180
8063
|
}
|
|
8181
8064
|
lines.push(...buildOperatingProtocol(governanceEntries, task));
|
|
8182
|
-
const ruleLines = formatRuleListsLines(ruleListsView);
|
|
8183
|
-
if (ruleLines.length > 0) lines.push("", "Rules:", ...ruleLines);
|
|
8184
8065
|
if (coherence) {
|
|
8185
8066
|
lines.push(...coherence.lines);
|
|
8186
8067
|
}
|
|
@@ -8228,8 +8109,6 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
8228
8109
|
lines.push(
|
|
8229
8110
|
...buildOperatingProtocol({ truncated: bindingGovernanceView?._budget?.truncated === true })
|
|
8230
8111
|
);
|
|
8231
|
-
const noTaskRuleLines = formatRuleListsLines(ruleListsView);
|
|
8232
|
-
if (noTaskRuleLines.length > 0) lines.push("", "Rules:", ...noTaskRuleLines);
|
|
8233
8112
|
if (coherence) {
|
|
8234
8113
|
lines.push(...coherence.lines);
|
|
8235
8114
|
}
|
|
@@ -8546,8 +8425,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
8546
8425
|
"Full onboarding is optional: call `orient action=start` if you want guided workspace setup. If you already ran setup, continue your task without restarting it."
|
|
8547
8426
|
];
|
|
8548
8427
|
scanLines.push(...buildRitualsSurfaceLines(orientView, { fetchFailed: orientFetchFailed || orientView?.fetchFailed === true }));
|
|
8549
|
-
|
|
8550
|
-
if (blankRuleLines.length > 0) scanLines.push("", "Rules:", ...blankRuleLines);
|
|
8428
|
+
scanLines.push("", ...buildOrientBriefingLines(orientView));
|
|
8551
8429
|
let oriented = false;
|
|
8552
8430
|
let orientationStatus2 = "no_session";
|
|
8553
8431
|
if (agentSessionId && taskAsked) {
|
|
@@ -8584,7 +8462,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
8584
8462
|
lines.push("");
|
|
8585
8463
|
}
|
|
8586
8464
|
if (mode === "brief") {
|
|
8587
|
-
lines.push(...
|
|
8465
|
+
lines.push(...buildOrientBriefingLines(orientView));
|
|
8588
8466
|
if (orientView?.strategicContext) {
|
|
8589
8467
|
const sc = orientView.strategicContext;
|
|
8590
8468
|
if (sc.playingFieldCount != null && sc.playingFieldCount > 0) {
|
|
@@ -8672,8 +8550,6 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
8672
8550
|
} else {
|
|
8673
8551
|
lines.push(...buildOperatingProtocol());
|
|
8674
8552
|
}
|
|
8675
|
-
const ruleLines = formatRuleListsLines(orientView.ruleLists);
|
|
8676
|
-
if (ruleLines.length > 0) lines.push("", "Rules:", ...ruleLines);
|
|
8677
8553
|
}
|
|
8678
8554
|
let orientationStatus2 = "no_session";
|
|
8679
8555
|
if (agentSessionId && taskAsked) {
|
|
@@ -8755,6 +8631,7 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
8755
8631
|
}
|
|
8756
8632
|
lines.push("_Need a collection that doesn't exist yet? Creating one is not available through this tool. Ask a platform admin to provision it, or enable the module ontology pack that owns it._");
|
|
8757
8633
|
lines.push("");
|
|
8634
|
+
lines.push(...buildOrientBriefingLines(orientView), "");
|
|
8758
8635
|
let fullCoherenceSnapshot;
|
|
8759
8636
|
if (readiness) {
|
|
8760
8637
|
if (!sampleTruncated && readiness.gaps.length > 0) {
|
|
@@ -8779,16 +8656,10 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
8779
8656
|
if (task) {
|
|
8780
8657
|
lines.push(`Working on: **${task}**`);
|
|
8781
8658
|
lines.push("");
|
|
8782
|
-
lines.push(...buildDirectionLines(orientView));
|
|
8783
8659
|
if (orientView?.strategicContext) {
|
|
8784
8660
|
const sc = orientView.strategicContext;
|
|
8785
8661
|
if (sc.playingFieldCount != null && sc.playingFieldCount > 0) lines.push(`**Playing field (${sc.playingFieldCount}):** ${(sc.playingField ?? []).join(", ")}`);
|
|
8786
|
-
|
|
8787
|
-
const wpSingularFull = getCollectionLabel("work_package", "singular", vocabCtx);
|
|
8788
|
-
const wpPluralFull = getCollectionLabel("work_package", "plural", vocabCtx);
|
|
8789
|
-
const betLine = currentWP ? `**Current ${wpSingularFull}:** ${currentWP}. ${sc.activeWorkPackageCount} active ${wpPluralFull}.` : `No active ${wpPluralFull}.`;
|
|
8790
|
-
lines.push(`${betLine} ${sc.activeTensionCount} open tension(s).`);
|
|
8791
|
-
lines.push("");
|
|
8662
|
+
lines.push(`${sc.activeWorkPackageCount} active ${getCollectionLabel("work_package", "plural", vocabCtx)}, ${sc.activeTensionCount} open tension(s).`, "");
|
|
8792
8663
|
}
|
|
8793
8664
|
if (orientView?.continuingFrom && orientView.continuingFrom.length > 0) {
|
|
8794
8665
|
lines.push("## Continuing from");
|
|
@@ -8977,8 +8848,6 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
8977
8848
|
lines.push(...formatRecoveryBlock(recoveryBlock));
|
|
8978
8849
|
}
|
|
8979
8850
|
} else {
|
|
8980
|
-
const scNoTaskLines = buildDirectionLines(orientView);
|
|
8981
|
-
if (scNoTaskLines.length > 0) lines.push(...scNoTaskLines, "");
|
|
8982
8851
|
lines.push(...buildRitualsSurfaceLines(orientView, { fetchFailed: orientFetchFailed || orientView?.fetchFailed === true }));
|
|
8983
8852
|
if (orientView?.activeWorkPackages?.length) {
|
|
8984
8853
|
lines.push("## Active work packages \u2014 current scope");
|
|
@@ -9033,8 +8902,6 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
9033
8902
|
lines.push("");
|
|
9034
8903
|
}
|
|
9035
8904
|
}
|
|
9036
|
-
const ruleLinesFull = formatRuleListsLines(orientView?.ruleLists);
|
|
9037
|
-
if (ruleLinesFull.length > 0) lines.push("", "Rules:", ...ruleLinesFull);
|
|
9038
8905
|
const classificationGaps = readiness?.gaps?.filter((g) => g.id?.startsWith?.(PURPOSE_GAP_PREFIX)) ?? [];
|
|
9039
8906
|
if (classificationGaps.length > 0) {
|
|
9040
8907
|
lines.push("## Classification gaps");
|
|
@@ -13851,16 +13718,11 @@ Write via \`update\`: \`draft\` | \`archived\` (\`accepted\` via \`commit\`, nev
|
|
|
13851
13718
|
`;
|
|
13852
13719
|
|
|
13853
13720
|
// src/resources/orientationMarkdown.ts
|
|
13854
|
-
function buildOrientationMarkdown(collections, standards, businessRules, principles, directionLines
|
|
13721
|
+
function buildOrientationMarkdown(collections, standards, businessRules, principles, directionLines) {
|
|
13855
13722
|
const sections = ["# Product Brain \u2014 Orientation"];
|
|
13856
13723
|
if (directionLines && directionLines.length > 0) {
|
|
13857
13724
|
sections.push(directionLines.join("\n"));
|
|
13858
13725
|
}
|
|
13859
|
-
if (ruleLines && ruleLines.length > 0) {
|
|
13860
|
-
sections.push(
|
|
13861
|
-
"## Rules (delivered lists)\nEveryone/team/role rules currently served to this workspace and role (DEC-1774) \u2014 distinct from the collection-listing section below.\n\n" + ruleLines.join("\n")
|
|
13862
|
-
);
|
|
13863
|
-
}
|
|
13864
13726
|
sections.push(
|
|
13865
13727
|
"## About Product Brain (PB)\nPB is a knowledge management system used by many product teams. This section describes how PB works \u2014 not your product.\n\n### How PB Organizes Its Tools\n- **Tools** = actions with side-effects or dynamic computation (capture, accept, search).\n- **Resources** = stable, read-only data (orientation, terminology, collection schemas).\n- **Prompts** = multi-step choreography (workflows, guided capture, deep dives).\n- Every tool, resource, and prompt works for ANY workspace \u2014 no bespoke logic.\n- Resource templates (URI params) serve workspace-specific data through generic patterns.\n- Compound tools with `action` enums keep the tool count minimal.\n\n" + DATA_HANDLING_SECTION
|
|
13866
13728
|
);
|
|
@@ -13875,7 +13737,7 @@ function buildOrientationMarkdown(collections, standards, businessRules, princip
|
|
|
13875
13737
|
wsRules.push({ id: r.entryId ?? "", name: r.name, severity: r.data?.severity ?? void 0, source: "rules" });
|
|
13876
13738
|
}
|
|
13877
13739
|
if (wsRules.length > 0) {
|
|
13878
|
-
const
|
|
13740
|
+
const ruleLines = wsRules.map((r) => {
|
|
13879
13741
|
const sev = r.severity ? ` [${r.severity}]` : "";
|
|
13880
13742
|
return `- **${r.id}**: ${r.name}${sev}`;
|
|
13881
13743
|
}).join("\n");
|
|
@@ -13883,7 +13745,7 @@ function buildOrientationMarkdown(collections, standards, businessRules, princip
|
|
|
13883
13745
|
`## Your Workspace Principles & Rules (${wsRules.length} active)
|
|
13884
13746
|
These are principles, standards, and rules your team has accepted onto the Chain. Respect them during implementation.
|
|
13885
13747
|
|
|
13886
|
-
` +
|
|
13748
|
+
` + ruleLines + '\n\nUse `entries action=get entryId="<ID>"` to drill into any rule before making changes in that area.'
|
|
13887
13749
|
);
|
|
13888
13750
|
} else {
|
|
13889
13751
|
sections.push(
|
|
@@ -13968,7 +13830,6 @@ async function buildOrientationResourceText(kernelQuery2, agentSessionId) {
|
|
|
13968
13830
|
const businessRules = rulesResult.status === "fulfilled" ? rulesResult.value : null;
|
|
13969
13831
|
const principles = principlesResult.status === "fulfilled" ? principlesResult.value : null;
|
|
13970
13832
|
let directionLines;
|
|
13971
|
-
let ruleLines = [];
|
|
13972
13833
|
if (orientViewResult.status === "rejected") {
|
|
13973
13834
|
const reason = orientViewResult.reason instanceof Error ? orientViewResult.reason.message : String(orientViewResult.reason);
|
|
13974
13835
|
const normalized = sanitizeSingleLineField(reason);
|
|
@@ -13976,10 +13837,9 @@ async function buildOrientationResourceText(kernelQuery2, agentSessionId) {
|
|
|
13976
13837
|
directionLines = [`_Strategic context unavailable: the spine read failed (${truncated})_`];
|
|
13977
13838
|
} else {
|
|
13978
13839
|
const orientView = orientViewResult.value;
|
|
13979
|
-
directionLines =
|
|
13980
|
-
ruleLines = agentSessionId ? formatRuleListsLines(orientView.ruleLists) : buildEveryoneOnlyRuleListsLines(orientView.ruleLists);
|
|
13840
|
+
directionLines = buildOrientBriefingLines(orientView, { everyoneOnly: !agentSessionId });
|
|
13981
13841
|
}
|
|
13982
|
-
return buildOrientationMarkdown(collections, standards, businessRules, principles, directionLines
|
|
13842
|
+
return buildOrientationMarkdown(collections, standards, businessRules, principles, directionLines);
|
|
13983
13843
|
}
|
|
13984
13844
|
|
|
13985
13845
|
// src/resources/terminologyResource.ts
|
|
@@ -14608,4 +14468,4 @@ export {
|
|
|
14608
14468
|
createProductBrainServer,
|
|
14609
14469
|
initFeatureFlags
|
|
14610
14470
|
};
|
|
14611
|
-
//# sourceMappingURL=chunk-
|
|
14471
|
+
//# sourceMappingURL=chunk-JSKIMDXR.js.map
|