@productbrain/mcp 0.0.1-beta.6294 → 0.0.1-beta.6296
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.
|
@@ -9260,7 +9260,7 @@ async function handleRecordActivation({
|
|
|
9260
9260
|
// src/tools/orient.ts
|
|
9261
9261
|
var PURPOSE_GAP_PREFIX = "purpose-gap-";
|
|
9262
9262
|
var READINESS_GAPS_MAX = 50;
|
|
9263
|
-
function formatRetrievalMissLines(verdict
|
|
9263
|
+
function formatRetrievalMissLines(verdict) {
|
|
9264
9264
|
const lines = [];
|
|
9265
9265
|
if (verdict.served !== "ok") {
|
|
9266
9266
|
if (verdict.served === "miss") {
|
|
@@ -9269,18 +9269,8 @@ function formatRetrievalMissLines(verdict, domain) {
|
|
|
9269
9269
|
lines.push(`\xB7 weak serve (provisional, ${verdict.rubricVersion}): ${verdict.kind ?? "thin"}`);
|
|
9270
9270
|
}
|
|
9271
9271
|
}
|
|
9272
|
-
if (domain?.reason) lines.push(` Reason: ${domain.reason}`);
|
|
9273
|
-
if (domain?.nextAction) lines.push(` Next action: ${domain.nextAction}`);
|
|
9274
|
-
if (domain?.evidenceGap) lines.push(` Evidence gap: ${domain.evidenceGap}`);
|
|
9275
9272
|
return lines;
|
|
9276
9273
|
}
|
|
9277
|
-
function domainDetailFromRetrieval(retrieval) {
|
|
9278
|
-
if (!retrieval) return null;
|
|
9279
|
-
const reason = typeof retrieval.fallbackReason === "string" ? retrieval.fallbackReason : null;
|
|
9280
|
-
const nextAction = typeof retrieval.fallbackAction === "string" ? retrieval.fallbackAction : null;
|
|
9281
|
-
const evidenceGap = typeof retrieval.evidenceGap === "string" ? retrieval.evidenceGap : null;
|
|
9282
|
-
return reason || nextAction || evidenceGap ? { reason, nextAction, evidenceGap } : null;
|
|
9283
|
-
}
|
|
9284
9274
|
async function markOrientedWithSnapshotFallback(agentSessionId, coherenceSnapshot) {
|
|
9285
9275
|
try {
|
|
9286
9276
|
await kernelCall("agent.markOriented", {
|
|
@@ -9312,15 +9302,15 @@ var orientSchema = z22.object({
|
|
|
9312
9302
|
task: z22.string().max(2e3).optional().describe(
|
|
9313
9303
|
"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."
|
|
9314
9304
|
),
|
|
9315
|
-
|
|
9316
|
-
//
|
|
9317
|
-
//
|
|
9305
|
+
// D1d (WP-754/TASK-204): nested to match the server's StartupResolutionSignals shape, every
|
|
9306
|
+
// field optional, sanitized server-side. Domain resolution (this envelope's original purpose)
|
|
9307
|
+
// is deleted; the sole surviving consumer is `context.served` activation telemetry.
|
|
9318
9308
|
startupSignals: z22.object({
|
|
9319
9309
|
changedPaths: z22.array(z22.string()).max(25).optional().describe("Paths changed in the current working tree, if known (e.g. from a prior git status/diff tool call)."),
|
|
9320
9310
|
reviewedArtifactRefs: z22.array(z22.string()).max(25).optional().describe("Chain entry IDs the caller has already reviewed this session, if tracked."),
|
|
9321
9311
|
branchName: z22.string().max(120).optional().describe("Current git branch name, if known."),
|
|
9322
9312
|
worktreeName: z22.string().max(120).optional().describe("Current worktree/directory name, if known.")
|
|
9323
|
-
}).optional().describe("For 'task': best-effort startup signals
|
|
9313
|
+
}).optional().describe("For 'task': best-effort startup signals \u2014 changedPaths/reviewedArtifactRefs/branchName/worktreeName. All optional; omit fields you don't know."),
|
|
9324
9314
|
invocationPath: z22.enum(["session-start", "session-close", "manual-orient", "handshake", "unknown"]).optional().describe("For 'task': how this orient was invoked. Defaults to 'manual-orient' (the direct `orient task=...` call shape) when omitted."),
|
|
9325
9315
|
confirmedEntryCount: z22.number().int().min(0).optional().describe(
|
|
9326
9316
|
"For 'record-activation': confirmed-entry count from the Phase 4 capture loop. The mutation enforces >=10."
|
|
@@ -9341,7 +9331,6 @@ var orientTaskVariant = z22.object({
|
|
|
9341
9331
|
mode: z22.enum(["full", "brief"]).optional().default("full"),
|
|
9342
9332
|
tier: z22.enum(["summary", "standard", "full"]).optional(),
|
|
9343
9333
|
task: z22.string().max(2e3).optional(),
|
|
9344
|
-
scope: z22.string().max(200).optional(),
|
|
9345
9334
|
// WP-486 Slice 1 (FEAT-1371) — mirrors orientSchema's top-level declaration above; see its
|
|
9346
9335
|
// doc comment for the shape rationale.
|
|
9347
9336
|
startupSignals: z22.object({
|
|
@@ -9365,7 +9354,7 @@ var orientActionUnion = z22.discriminatedUnion("action", [
|
|
|
9365
9354
|
]);
|
|
9366
9355
|
var ORIENT_ACTION_SPECS = {
|
|
9367
9356
|
start: { params: ["task"], description: "Universal session opener; task is optional." },
|
|
9368
|
-
task: { params: ["mode", "tier", "task"
|
|
9357
|
+
task: { params: ["mode", "tier", "task"], description: "Task-grounded context loader; all params optional." },
|
|
9369
9358
|
"record-activation": {
|
|
9370
9359
|
params: ["confirmedEntryCount", "entriesAcrossCollections", "retrievalDemoConfirmed"],
|
|
9371
9360
|
description: "All three fields are required."
|
|
@@ -9397,7 +9386,6 @@ function registerOrientTool(server) {
|
|
|
9397
9386
|
mode: data.mode,
|
|
9398
9387
|
tier: data.tier,
|
|
9399
9388
|
task: data.task,
|
|
9400
|
-
scope: data.scope,
|
|
9401
9389
|
startupSignals: data.startupSignals,
|
|
9402
9390
|
invocationPath: data.invocationPath
|
|
9403
9391
|
}),
|
|
@@ -9411,7 +9399,7 @@ function registerOrientTool(server) {
|
|
|
9411
9399
|
"orient",
|
|
9412
9400
|
{
|
|
9413
9401
|
title: "Orient",
|
|
9414
|
-
description: "Workspace orientation and session bootstrapping. Three actions:\n\n- **start**: Universal opener (absorbs `start_pb`) \u2014 say 'Start PB' to begin every session. Stage-aware: fresh workspaces (blank/seeded) get the SKILL-pb-setup body verbatim; active workspaces (grounded/connected) get a standup briefing. Orients the CURRENT session \u2014 it does not create one; for writes, call `session action=start` first.\n- **task**: Task-grounded context loader (the original `orient` behavior). Use after `action=start` to load governance and context for a specific task. Completing orientation unlocks write tools.\n- **record-activation**: Chat-only activation receipt writer (absorbs `record_activation`) \u2014 closes the install-to-activation arc for chat-only surfaces.\n\n**tier** (action=task): Controls payload depth.\n- `summary` (~10 KB) \u2014 compact, calibrated for task-scoped retrieval.\n- `standard` (~256 KB) \u2014 rich, suited to workspace standups.\n- `full` \u2014 complete payload, no cap. Use with deliberation.\n\nThe spine (vision, purpose, strategy highlights) is served in full and a grounding status flags when context was reduced.\n\nDefaults: `summary` when `task` is provided; `standard` when `task` is absent. Explicit `tier` always wins.\n\n**mode** (action=task): `full` (default) returns full context. `brief` returns compact summary \u2014 mapped to tier=summary internally
|
|
9402
|
+
description: "Workspace orientation and session bootstrapping. Three actions:\n\n- **start**: Universal opener (absorbs `start_pb`) \u2014 say 'Start PB' to begin every session. Stage-aware: fresh workspaces (blank/seeded) get the SKILL-pb-setup body verbatim; active workspaces (grounded/connected) get a standup briefing. Orients the CURRENT session \u2014 it does not create one; for writes, call `session action=start` first.\n- **task**: Task-grounded context loader (the original `orient` behavior). Use after `action=start` to load governance and context for a specific task. Completing orientation unlocks write tools.\n- **record-activation**: Chat-only activation receipt writer (absorbs `record_activation`) \u2014 closes the install-to-activation arc for chat-only surfaces.\n\n**tier** (action=task): Controls payload depth.\n- `summary` (~10 KB) \u2014 compact, calibrated for task-scoped retrieval.\n- `standard` (~256 KB) \u2014 rich, suited to workspace standups.\n- `full` \u2014 complete payload, no cap. Use with deliberation.\n\nThe spine (vision, purpose, strategy highlights) is served in full and a grounding status flags when context was reduced.\n\nDefaults: `summary` when `task` is provided; `standard` when `task` is absent. Explicit `tier` always wins.\n\n**mode** (action=task): `full` (default) returns full context. `brief` returns compact summary \u2014 mapped to tier=summary internally.",
|
|
9415
9403
|
inputSchema: orientSchema,
|
|
9416
9404
|
// Mixed read/write noun (§3 R3): 'start'/'record-activation' write session state.
|
|
9417
9405
|
annotations: { readOnlyHint: false, idempotentHint: true, openWorldHint: false }
|
|
@@ -9427,12 +9415,9 @@ function registerOrientTool(server) {
|
|
|
9427
9415
|
})
|
|
9428
9416
|
);
|
|
9429
9417
|
}
|
|
9430
|
-
async function _handleOrient({ mode = "full", tier, task,
|
|
9418
|
+
async function _handleOrient({ mode = "full", tier, task, startupSignals, invocationPath }) {
|
|
9431
9419
|
const errors = [];
|
|
9432
9420
|
const callTier = tier ?? (mode === "brief" ? "summary" : void 0);
|
|
9433
|
-
if (scope && !task) {
|
|
9434
|
-
errors.push("--scope requires --task to filter governance. Scope was ignored.");
|
|
9435
|
-
}
|
|
9436
9421
|
const agentSessionId = getAgentSessionId();
|
|
9437
9422
|
if (isSessionOriented() && mode === "brief" && !task) {
|
|
9438
9423
|
return buildAlreadyOrientedResult(kernelQuery, agentSessionId, taskGroundingWarningLines());
|
|
@@ -9450,7 +9435,6 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
9450
9435
|
try {
|
|
9451
9436
|
const orientArgs = {};
|
|
9452
9437
|
if (task) orientArgs.task = task;
|
|
9453
|
-
if (scope) orientArgs.scope = scope;
|
|
9454
9438
|
if (startupSignals && Object.keys(startupSignals).length > 0) orientArgs.startupSignals = startupSignals;
|
|
9455
9439
|
if (invocationPath) {
|
|
9456
9440
|
orientArgs.invocationPath = invocationPath;
|
|
@@ -9551,10 +9535,7 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
9551
9535
|
}
|
|
9552
9536
|
lines.push("");
|
|
9553
9537
|
lines.push(...taskGroundingWarningLines(task, hasTaskGrounding));
|
|
9554
|
-
const retrievalMissLines = orientView?.retrievalMiss ? formatRetrievalMissLines(
|
|
9555
|
-
orientView.retrievalMiss,
|
|
9556
|
-
domainDetailFromRetrieval(orientView.startup?.domainRetrieval)
|
|
9557
|
-
) : [];
|
|
9538
|
+
const retrievalMissLines = orientView?.retrievalMiss ? formatRetrievalMissLines(orientView.retrievalMiss) : [];
|
|
9558
9539
|
if (retrievalMissLines.length > 0) {
|
|
9559
9540
|
lines.push(...retrievalMissLines);
|
|
9560
9541
|
lines.push("");
|
|
@@ -9586,15 +9567,6 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
9586
9567
|
const degradedLineBrief = buildDegradedPreloadsLine(orientView?.degradedPreloads);
|
|
9587
9568
|
if (degradedLineBrief) lines.push(degradedLineBrief);
|
|
9588
9569
|
lines.push(...buildRitualsSurfaceLines(orientView, { fetchFailed: orientFetchFailed || orientView?.fetchFailed === true }));
|
|
9589
|
-
if (orientView?.startup?.domainRetrieval) {
|
|
9590
|
-
const retrieval = orientView.startup.domainRetrieval;
|
|
9591
|
-
const scopedTo = retrieval.resolvedDomainSlug ? ` (${retrieval.resolvedDomainSlug})` : "";
|
|
9592
|
-
lines.push(`Domain retrieval: ${retrieval.state}${scopedTo}`);
|
|
9593
|
-
if (retrieval.activeSource) lines.push(`Active source: ${retrieval.activeSource}`);
|
|
9594
|
-
if (retrieval.directRatifiedCount != null || retrieval.inheritedRatifiedCount != null || retrieval.orgFallbackCount != null) {
|
|
9595
|
-
lines.push(`Domain relation evidence: ${retrieval.directRatifiedCount ?? 0} direct, ${retrieval.inheritedRatifiedCount ?? 0} inherited, ${retrieval.orgFallbackCount ?? 0} org fallback`);
|
|
9596
|
-
}
|
|
9597
|
-
}
|
|
9598
9570
|
if (orientView?.writeBackHints && orientView.writeBackHints.length > 0) {
|
|
9599
9571
|
lines.push("");
|
|
9600
9572
|
lines.push("Write-back hints (what to capture this session):");
|
|
@@ -9850,13 +9822,6 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
9850
9822
|
lines.push(`> \u26A0\uFE0F ${tc.groundingNote}`);
|
|
9851
9823
|
lines.push("");
|
|
9852
9824
|
}
|
|
9853
|
-
if (orientView.startup?.domainRetrieval) {
|
|
9854
|
-
const retrieval = orientView.startup.domainRetrieval;
|
|
9855
|
-
const scopedTo = retrieval.resolvedDomainSlug ? ` (${retrieval.resolvedDomainSlug})` : "";
|
|
9856
|
-
lines.push(`_Domain retrieval: ${retrieval.state}${scopedTo}_`);
|
|
9857
|
-
if (retrieval.activeSource) lines.push(`_Active source: ${retrieval.activeSource}_`);
|
|
9858
|
-
lines.push("");
|
|
9859
|
-
}
|
|
9860
9825
|
lines.push(`_Task-scoped entries (${tc.confidence} confidence, ${tc.totalFound} relevant)`);
|
|
9861
9826
|
lines.push("");
|
|
9862
9827
|
for (const e of tc.context) {
|
|
@@ -10154,7 +10119,6 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
10154
10119
|
// PR #539 review fix
|
|
10155
10120
|
// RCRT miss-alarm: machine-readable verdict, parity with the rendered prose alarm.
|
|
10156
10121
|
...orientView?.retrievalMiss ? { retrievalMiss: orientView.retrievalMiss } : {},
|
|
10157
|
-
domainRetrieval: orientView?.startup?.domainRetrieval,
|
|
10158
10122
|
orientationStatus,
|
|
10159
10123
|
nextStep: hasTaskGrounding ? void 0 : 'Run `orient task="describe the work"` before substantive work.',
|
|
10160
10124
|
...orientView?._budget ? { _budget: orientView._budget } : {},
|
|
@@ -16720,4 +16684,4 @@ export {
|
|
|
16720
16684
|
createProductBrainServer,
|
|
16721
16685
|
initFeatureFlags
|
|
16722
16686
|
};
|
|
16723
|
-
//# sourceMappingURL=chunk-
|
|
16687
|
+
//# sourceMappingURL=chunk-COH7GAUD.js.map
|