@productbrain/mcp 0.0.1-beta.7169 → 0.0.1-beta.7194
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.
|
@@ -6710,7 +6710,7 @@ async function handleExport() {
|
|
|
6710
6710
|
}
|
|
6711
6711
|
|
|
6712
6712
|
// src/tools/orient.ts
|
|
6713
|
-
import { z as
|
|
6713
|
+
import { z as z19 } from "zod/v3";
|
|
6714
6714
|
|
|
6715
6715
|
// src/tools/planned-work.ts
|
|
6716
6716
|
function buildPlannedWork(allEntries) {
|
|
@@ -7601,16 +7601,6 @@ function buildRitualsSurfaceLines(view, opts) {
|
|
|
7601
7601
|
if (view?.atCapLine) lines.push(view.atCapLine);
|
|
7602
7602
|
return lines;
|
|
7603
7603
|
}
|
|
7604
|
-
async function fetchAndRenderSetupSpineLine(kernelQuery2) {
|
|
7605
|
-
try {
|
|
7606
|
-
const view = await kernelQuery2("chain.getRitualsSurface", {
|
|
7607
|
-
now: Math.floor(Date.now() / 6e4) * 6e4
|
|
7608
|
-
});
|
|
7609
|
-
return view?.spineLine ? [view.spineLine] : [];
|
|
7610
|
-
} catch {
|
|
7611
|
-
return [SPINE_UNAVAILABLE_LINE];
|
|
7612
|
-
}
|
|
7613
|
-
}
|
|
7614
7604
|
var DEFAULT_SPINE_ORDER = ["purpose", "vision", "strategy", "product", "objectives", "keyResults"];
|
|
7615
7605
|
var TRUNCATION_MESSAGES = {
|
|
7616
7606
|
objectives_capped: "(more objectives exist than shown)",
|
|
@@ -7815,22 +7805,7 @@ function replaceVocabTokens(body, workspaceCtx, collectionCtxMap) {
|
|
|
7815
7805
|
}
|
|
7816
7806
|
|
|
7817
7807
|
// src/tools/start_pb.ts
|
|
7818
|
-
import { z as z18 } from "zod/v3";
|
|
7819
|
-
|
|
7820
|
-
// src/tools/skills.ts
|
|
7821
7808
|
import { z as z17 } from "zod/v3";
|
|
7822
|
-
var skillsSchema = z17.object({
|
|
7823
|
-
entryId: z17.string().min(1).describe(
|
|
7824
|
-
"Workspace-scoped skill entry id (e.g. 'SKILL-pb-setup'). The tool refuses non-skill entries (canonicalKey !== 'skill') with INVALID_KIND."
|
|
7825
|
-
)
|
|
7826
|
-
});
|
|
7827
|
-
async function loadSkillBody(entryId) {
|
|
7828
|
-
const workspaceId = await getWorkspaceId();
|
|
7829
|
-
return await kernelQuery("setup.getSkillBody", {
|
|
7830
|
-
workspaceId,
|
|
7831
|
-
entryId
|
|
7832
|
-
});
|
|
7833
|
-
}
|
|
7834
7809
|
|
|
7835
7810
|
// src/lib/sessionNotices.ts
|
|
7836
7811
|
var ANSI_AND_CONTROL_RE2 = /\x1b\[[0-9;]*[A-Za-z]|\x1b\][^\x07]*\x07|\x1b[^[\]0-9;A-Za-z]?|[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g;
|
|
@@ -7961,14 +7936,13 @@ function rankActiveBets(entries) {
|
|
|
7961
7936
|
}
|
|
7962
7937
|
|
|
7963
7938
|
// src/tools/start_pb.ts
|
|
7964
|
-
var startPbSchema =
|
|
7965
|
-
task:
|
|
7966
|
-
"What you're about to work on (e.g. 'implementing auth middleware').
|
|
7939
|
+
var startPbSchema = z17.object({
|
|
7940
|
+
task: z17.string().max(2e3).optional().describe(
|
|
7941
|
+
"What you're about to work on (e.g. 'implementing auth middleware'). Filters governance to show relevant principles, standards, and business rules \u2014 for every workspace state, including a fresh one."
|
|
7967
7942
|
)
|
|
7968
7943
|
// TEN-2431: no `scope` param — start_pb's governance matches orient's scope-BLIND RENDERED
|
|
7969
7944
|
// governance; domain-scoping is deferred to TEN-2429 (must change both together, INS-1864).
|
|
7970
7945
|
});
|
|
7971
|
-
var PB_SETUP_SKILL_ENTRY_ID = "SKILL-pb-setup";
|
|
7972
7946
|
async function tryMarkOriented(agentSessionId, coherenceSnapshot) {
|
|
7973
7947
|
if (!agentSessionId) return { oriented: false, orientationStatus: "no_session" };
|
|
7974
7948
|
try {
|
|
@@ -7994,35 +7968,6 @@ async function tryMarkOriented(agentSessionId, coherenceSnapshot) {
|
|
|
7994
7968
|
function isActiveBet(e) {
|
|
7995
7969
|
return !TERMINAL_STATUSES.has(e.workflowStatus ?? "");
|
|
7996
7970
|
}
|
|
7997
|
-
async function buildSetupResponse(agentSessionId, sampleTruncated) {
|
|
7998
|
-
await kernelMutation(
|
|
7999
|
-
"setup.stampMcpOnlySurface",
|
|
8000
|
-
{}
|
|
8001
|
-
);
|
|
8002
|
-
const skill = await loadSkillBody(PB_SETUP_SKILL_ENTRY_ID);
|
|
8003
|
-
const { oriented, orientationStatus } = await tryMarkOriented(agentSessionId);
|
|
8004
|
-
const spineLines = await fetchAndRenderSetupSpineLine(kernelQuery);
|
|
8005
|
-
return {
|
|
8006
|
-
text: `${skill.body}${spineLines.length > 0 ? `
|
|
8007
|
-
${spineLines.join("\n")}` : ""}${sampleTruncated ? `
|
|
8008
|
-
${READINESS_PROVISIONAL_LINE} Reuse existing knowledge when following setup.` : ""}`,
|
|
8009
|
-
structuredContent: success(
|
|
8010
|
-
`pb-setup ready. Delivering SKILL-pb-setup body (${skill.body.length} chars).`,
|
|
8011
|
-
{
|
|
8012
|
-
bootstrap: "pb-setup",
|
|
8013
|
-
skillEntryId: skill.entryId,
|
|
8014
|
-
skillBody: skill.body,
|
|
8015
|
-
stage: "setup",
|
|
8016
|
-
sampleTruncated,
|
|
8017
|
-
oriented,
|
|
8018
|
-
orientationStatus,
|
|
8019
|
-
...agentSessionId ? { sessionId: agentSessionId } : {},
|
|
8020
|
-
...spineLines[0] !== void 0 ? { spineLine: spineLines[0] } : {},
|
|
8021
|
-
instructions: "Read skillBody and follow it; use entries/orient MCP tools per PAT-227."
|
|
8022
|
-
}
|
|
8023
|
-
)
|
|
8024
|
-
};
|
|
8025
|
-
}
|
|
8026
7971
|
async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
8027
7972
|
let priorSessions = [];
|
|
8028
7973
|
let recoveryBlock = null;
|
|
@@ -8250,15 +8195,6 @@ async function handleStartPb({ task }) {
|
|
|
8250
8195
|
} catch {
|
|
8251
8196
|
errors.push("Readiness check unavailable \u2014 showing workspace summary.");
|
|
8252
8197
|
}
|
|
8253
|
-
if (stage === "blank" || stage === "seeded") {
|
|
8254
|
-
const result2 = await buildSetupResponse(agentSessionId, sampleTruncated);
|
|
8255
|
-
return {
|
|
8256
|
-
content: textContent(`${result2.text}
|
|
8257
|
-
|
|
8258
|
-
${FEEDBACK_SUBMIT_HINT}`),
|
|
8259
|
-
structuredContent: result2.structuredContent
|
|
8260
|
-
};
|
|
8261
|
-
}
|
|
8262
8198
|
if (!sampleTruncated && (stage === "grounded" || stage === "connected")) {
|
|
8263
8199
|
void kernelMutation("chain.setOnboardingCompleted", {}).catch(() => {
|
|
8264
8200
|
});
|
|
@@ -8273,15 +8209,15 @@ ${FEEDBACK_SUBMIT_HINT}` }],
|
|
|
8273
8209
|
}
|
|
8274
8210
|
|
|
8275
8211
|
// src/tools/record_activation.ts
|
|
8276
|
-
import { z as
|
|
8277
|
-
var recordActivationSchema =
|
|
8278
|
-
confirmedEntryCount:
|
|
8212
|
+
import { z as z18 } from "zod/v3";
|
|
8213
|
+
var recordActivationSchema = z18.object({
|
|
8214
|
+
confirmedEntryCount: z18.number().int().min(0).describe(
|
|
8279
8215
|
"Confirmed-entry count from the Phase 4 capture loop. The mutation enforces >=10."
|
|
8280
8216
|
),
|
|
8281
|
-
entriesAcrossCollections:
|
|
8217
|
+
entriesAcrossCollections: z18.number().int().min(0).describe(
|
|
8282
8218
|
"Number of distinct collections those entries span. The mutation enforces >=2 (diversity soft-gate)."
|
|
8283
8219
|
),
|
|
8284
|
-
retrievalDemoConfirmed:
|
|
8220
|
+
retrievalDemoConfirmed: z18.boolean().describe(
|
|
8285
8221
|
"True if the retrieval round-trip ran successfully in Phase 4. The mutation rejects false."
|
|
8286
8222
|
)
|
|
8287
8223
|
});
|
|
@@ -8345,63 +8281,63 @@ async function markOrientedWithSnapshotFallback(agentSessionId, coherenceSnapsho
|
|
|
8345
8281
|
}
|
|
8346
8282
|
}
|
|
8347
8283
|
var ORIENT_ACTIONS = ["start", "task", "record-activation"];
|
|
8348
|
-
var orientSchema =
|
|
8349
|
-
action:
|
|
8284
|
+
var orientSchema = z19.object({
|
|
8285
|
+
action: z19.enum(ORIENT_ACTIONS).optional().default("task").describe(
|
|
8350
8286
|
"'start': universal session opener (absorbs start_pb) \u2014 stage-aware setup skill or standup briefing. 'task': task-grounded context loader \u2014 the original orient behavior. 'record-activation': chat-only activation receipt writer (absorbs record_activation)."
|
|
8351
8287
|
),
|
|
8352
|
-
mode:
|
|
8353
|
-
tier:
|
|
8288
|
+
mode: z19.enum(["full", "brief"]).optional().default("full").describe("For 'task': full = full context (default). brief = compact summary for mid-session re-orientation. Prefer using the `tier` param for depth control."),
|
|
8289
|
+
tier: z19.enum(["summary", "standard", "full"]).optional().describe(
|
|
8354
8290
|
"For 'task': payload depth. Defaults to summary (~10 KB) when task is provided; standard (~256 KB) when task is absent. Pass summary, standard, or full to override."
|
|
8355
8291
|
),
|
|
8356
|
-
task:
|
|
8292
|
+
task: z19.string().max(2e3).optional().describe(
|
|
8357
8293
|
"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."
|
|
8358
8294
|
),
|
|
8359
8295
|
// D1d (WP-754/TASK-204): nested to match the server's StartupResolutionSignals shape, every
|
|
8360
8296
|
// field optional, sanitized server-side. Domain resolution (this envelope's original purpose)
|
|
8361
8297
|
// is deleted; the sole surviving consumer is `context.served` activation telemetry.
|
|
8362
|
-
startupSignals:
|
|
8363
|
-
changedPaths:
|
|
8364
|
-
reviewedArtifactRefs:
|
|
8365
|
-
branchName:
|
|
8366
|
-
worktreeName:
|
|
8298
|
+
startupSignals: z19.object({
|
|
8299
|
+
changedPaths: z19.array(z19.string()).max(25).optional().describe("Paths changed in the current working tree, if known (e.g. from a prior git status/diff tool call)."),
|
|
8300
|
+
reviewedArtifactRefs: z19.array(z19.string()).max(25).optional().describe("Chain entry IDs the caller has already reviewed this session, if tracked."),
|
|
8301
|
+
branchName: z19.string().max(120).optional().describe("Current git branch name, if known."),
|
|
8302
|
+
worktreeName: z19.string().max(120).optional().describe("Current worktree/directory name, if known.")
|
|
8367
8303
|
}).optional().describe("For 'task': best-effort startup signals \u2014 changedPaths/reviewedArtifactRefs/branchName/worktreeName. All optional; omit fields you don't know."),
|
|
8368
|
-
invocationPath:
|
|
8369
|
-
confirmedEntryCount:
|
|
8304
|
+
invocationPath: z19.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."),
|
|
8305
|
+
confirmedEntryCount: z19.number().int().min(0).optional().describe(
|
|
8370
8306
|
"For 'record-activation': confirmed-entry count from the Phase 4 capture loop. The mutation enforces >=10."
|
|
8371
8307
|
),
|
|
8372
|
-
entriesAcrossCollections:
|
|
8308
|
+
entriesAcrossCollections: z19.number().int().min(0).optional().describe(
|
|
8373
8309
|
"For 'record-activation': number of distinct collections those entries span. The mutation enforces >=2 (diversity soft-gate)."
|
|
8374
8310
|
),
|
|
8375
|
-
retrievalDemoConfirmed:
|
|
8311
|
+
retrievalDemoConfirmed: z19.boolean().optional().describe(
|
|
8376
8312
|
"For 'record-activation': true if the retrieval round-trip ran successfully in Phase 4. The mutation rejects false."
|
|
8377
8313
|
)
|
|
8378
8314
|
});
|
|
8379
|
-
var orientStartVariant =
|
|
8380
|
-
action:
|
|
8381
|
-
task:
|
|
8315
|
+
var orientStartVariant = z19.object({
|
|
8316
|
+
action: z19.literal("start"),
|
|
8317
|
+
task: z19.string().max(2e3).optional()
|
|
8382
8318
|
});
|
|
8383
|
-
var orientTaskVariant =
|
|
8384
|
-
action:
|
|
8385
|
-
mode:
|
|
8386
|
-
tier:
|
|
8387
|
-
task:
|
|
8319
|
+
var orientTaskVariant = z19.object({
|
|
8320
|
+
action: z19.literal("task"),
|
|
8321
|
+
mode: z19.enum(["full", "brief"]).optional().default("full"),
|
|
8322
|
+
tier: z19.enum(["summary", "standard", "full"]).optional(),
|
|
8323
|
+
task: z19.string().max(2e3).optional(),
|
|
8388
8324
|
// WP-486 Slice 1 (FEAT-1371) — mirrors orientSchema's top-level declaration above; see its
|
|
8389
8325
|
// doc comment for the shape rationale.
|
|
8390
|
-
startupSignals:
|
|
8391
|
-
changedPaths:
|
|
8392
|
-
reviewedArtifactRefs:
|
|
8393
|
-
branchName:
|
|
8394
|
-
worktreeName:
|
|
8326
|
+
startupSignals: z19.object({
|
|
8327
|
+
changedPaths: z19.array(z19.string()).max(25).optional(),
|
|
8328
|
+
reviewedArtifactRefs: z19.array(z19.string()).max(25).optional(),
|
|
8329
|
+
branchName: z19.string().max(120).optional(),
|
|
8330
|
+
worktreeName: z19.string().max(120).optional()
|
|
8395
8331
|
}).optional(),
|
|
8396
|
-
invocationPath:
|
|
8332
|
+
invocationPath: z19.enum(["session-start", "session-close", "manual-orient", "handshake", "unknown"]).optional()
|
|
8397
8333
|
});
|
|
8398
|
-
var orientRecordActivationVariant =
|
|
8399
|
-
action:
|
|
8400
|
-
confirmedEntryCount:
|
|
8401
|
-
entriesAcrossCollections:
|
|
8402
|
-
retrievalDemoConfirmed:
|
|
8334
|
+
var orientRecordActivationVariant = z19.object({
|
|
8335
|
+
action: z19.literal("record-activation"),
|
|
8336
|
+
confirmedEntryCount: z19.number().int().min(0),
|
|
8337
|
+
entriesAcrossCollections: z19.number().int().min(0),
|
|
8338
|
+
retrievalDemoConfirmed: z19.boolean()
|
|
8403
8339
|
});
|
|
8404
|
-
var orientActionUnion =
|
|
8340
|
+
var orientActionUnion = z19.discriminatedUnion("action", [
|
|
8405
8341
|
orientStartVariant,
|
|
8406
8342
|
orientTaskVariant,
|
|
8407
8343
|
orientRecordActivationVariant
|
|
@@ -9188,6 +9124,21 @@ async function _handleOrient({ mode = "full", tier, task, startupSignals, invoca
|
|
|
9188
9124
|
// src/tools/workflows.ts
|
|
9189
9125
|
import { z as z21 } from "zod/v3";
|
|
9190
9126
|
|
|
9127
|
+
// src/tools/skills.ts
|
|
9128
|
+
import { z as z20 } from "zod/v3";
|
|
9129
|
+
var skillsSchema = z20.object({
|
|
9130
|
+
entryId: z20.string().min(1).describe(
|
|
9131
|
+
"Workspace-scoped skill entry id (e.g. 'SKILL-pb-setup'). The tool refuses non-skill entries (canonicalKey !== 'skill') with INVALID_KIND."
|
|
9132
|
+
)
|
|
9133
|
+
});
|
|
9134
|
+
async function loadSkillBody(entryId) {
|
|
9135
|
+
const workspaceId = await getWorkspaceId();
|
|
9136
|
+
return await kernelQuery("setup.getSkillBody", {
|
|
9137
|
+
workspaceId,
|
|
9138
|
+
entryId
|
|
9139
|
+
});
|
|
9140
|
+
}
|
|
9141
|
+
|
|
9191
9142
|
// src/workflows/descriptor.ts
|
|
9192
9143
|
function cloneWorkflowQuestion(question) {
|
|
9193
9144
|
return {
|
|
@@ -15006,4 +14957,4 @@ export {
|
|
|
15006
14957
|
createProductBrainServer,
|
|
15007
14958
|
initFeatureFlags
|
|
15008
14959
|
};
|
|
15009
|
-
//# sourceMappingURL=chunk-
|
|
14960
|
+
//# sourceMappingURL=chunk-CT47VFGP.js.map
|