@productbrain/mcp 0.0.1-beta.5984 → 0.0.1-beta.5993
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.
|
@@ -3104,11 +3104,11 @@ Use \`entries action=get\` to inspect the existing entry, or \`entries action=up
|
|
|
3104
3104
|
try {
|
|
3105
3105
|
const readiness = await kernelQuery("chain.workspaceReadiness");
|
|
3106
3106
|
if (readiness?.sampleTruncated) {
|
|
3107
|
-
lines.push("", `## Workspace Readiness
|
|
3107
|
+
lines.push("", `## Workspace Readiness (provisional sample)`, READINESS_PROVISIONAL_LINE);
|
|
3108
3108
|
} else if (readiness && readiness.gaps && readiness.gaps.length > 0) {
|
|
3109
3109
|
const topGaps = readiness.gaps.slice(0, 2);
|
|
3110
3110
|
lines.push("");
|
|
3111
|
-
lines.push(`## Workspace Readiness
|
|
3111
|
+
lines.push(`## Workspace Readiness`);
|
|
3112
3112
|
for (const gap of topGaps) {
|
|
3113
3113
|
lines.push(`- _${gap.label}:_ ${gap.guidance}`);
|
|
3114
3114
|
}
|
|
@@ -7294,8 +7294,7 @@ function formatSteeringBrief(result2) {
|
|
|
7294
7294
|
}
|
|
7295
7295
|
lines.push(`${delta.newEntries.length} new entries since last steering brief${delta.truncated ? " (TRUNCATED)" : ""}`);
|
|
7296
7296
|
lines.push("");
|
|
7297
|
-
lines.push(
|
|
7298
|
-
lines.push(`Score: **${readiness.score}%**${readiness.sampleTruncated ? " (provisional sample)" : ""} (${readiness.passedChecks}/${readiness.totalChecks} checks passed)`);
|
|
7297
|
+
if (readiness.sampleTruncated || readiness.gaps.length > 0) lines.push(`## Workspace Readiness${readiness.sampleTruncated ? " (provisional sample)" : ""}`);
|
|
7299
7298
|
if (readiness.sampleTruncated) lines.push(READINESS_PROVISIONAL_LINE);
|
|
7300
7299
|
if (!readiness.sampleTruncated && readiness.gaps.length > 0) {
|
|
7301
7300
|
lines.push("");
|
|
@@ -7314,7 +7313,7 @@ function formatSteeringBrief(result2) {
|
|
|
7314
7313
|
return {
|
|
7315
7314
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
7316
7315
|
structuredContent: success(
|
|
7317
|
-
`Steering brief: ${changes.entries.length} changes, ${delta.newEntries.length} new entries
|
|
7316
|
+
`Steering brief: ${changes.entries.length} changes, ${delta.newEntries.length} new entries.${readiness.sampleTruncated ? " (provisional sample; gaps unverified)" : ""}`,
|
|
7318
7317
|
{ ...result2, trustFilterActive: true }
|
|
7319
7318
|
)
|
|
7320
7319
|
};
|
|
@@ -8962,32 +8961,6 @@ function coherencyCheckTag(status2) {
|
|
|
8962
8961
|
}
|
|
8963
8962
|
|
|
8964
8963
|
// src/lib/gapToPrompt.ts
|
|
8965
|
-
function cleanLabel(label) {
|
|
8966
|
-
return label.replace(/ has entries$/i, "").replace(/ coverage$/i, "").replace(/^Strategy — /i, "");
|
|
8967
|
-
}
|
|
8968
|
-
function progressFrame(ctx) {
|
|
8969
|
-
if (ctx.passedChecks === 0) {
|
|
8970
|
-
return "Your Brain is just getting started.";
|
|
8971
|
-
}
|
|
8972
|
-
if (ctx.passedChecks === 1) {
|
|
8973
|
-
return "Your Brain has one area covered so far.";
|
|
8974
|
-
}
|
|
8975
|
-
if (ctx.score >= 70) {
|
|
8976
|
-
return `Your Brain covers ${ctx.passedChecks} areas \u2014 almost there.`;
|
|
8977
|
-
}
|
|
8978
|
-
return `Your Brain covers ${ctx.passedChecks} of ${ctx.totalChecks} areas.`;
|
|
8979
|
-
}
|
|
8980
|
-
function formatTopGapPrompt(gap, remaining, ctx) {
|
|
8981
|
-
const prompt = gap.capabilityGuidance ?? gap.guidance;
|
|
8982
|
-
const label = cleanLabel(gap.label);
|
|
8983
|
-
const lines = [
|
|
8984
|
-
progressFrame(ctx),
|
|
8985
|
-
remaining > 0 ? `The biggest gap right now: **${label}**.` : `One area would strengthen it: **${label}**.`,
|
|
8986
|
-
"",
|
|
8987
|
-
prompt
|
|
8988
|
-
];
|
|
8989
|
-
return lines.join("\n");
|
|
8990
|
-
}
|
|
8991
8964
|
function formatGapOneLiner(gap) {
|
|
8992
8965
|
if (!gap) return null;
|
|
8993
8966
|
const prompt = gap.capabilityGuidance ?? gap.guidance;
|
|
@@ -9170,19 +9143,6 @@ function isActiveNowBet(e) {
|
|
|
9170
9143
|
const horizon = e.data?.horizon;
|
|
9171
9144
|
return status2 === "active" && horizon === "now";
|
|
9172
9145
|
}
|
|
9173
|
-
function computeWorkspaceAge(createdAt) {
|
|
9174
|
-
if (!createdAt) return { ageDays: 0, isNeglected: false };
|
|
9175
|
-
const ageDays = Math.floor((Date.now() - createdAt) / (1e3 * 60 * 60 * 24));
|
|
9176
|
-
return { ageDays, isNeglected: ageDays >= 30 };
|
|
9177
|
-
}
|
|
9178
|
-
function pickNextTensionPrompt(openTensions) {
|
|
9179
|
-
if (openTensions.length === 0) return null;
|
|
9180
|
-
const t = openTensions[0];
|
|
9181
|
-
return {
|
|
9182
|
-
action: `Open tension: ${t.name}`,
|
|
9183
|
-
cta: "Want to discuss this tension or capture a decision about it?"
|
|
9184
|
-
};
|
|
9185
|
-
}
|
|
9186
9146
|
async function buildSetupResponse(agentSessionId, sampleTruncated) {
|
|
9187
9147
|
await kernelMutation(
|
|
9188
9148
|
"setup.stampMcpOnlySurface",
|
|
@@ -9213,7 +9173,6 @@ ${READINESS_PROVISIONAL_LINE} Reuse existing knowledge when following setup.` :
|
|
|
9213
9173
|
};
|
|
9214
9174
|
}
|
|
9215
9175
|
async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
9216
|
-
const { ageDays, isNeglected } = computeWorkspaceAge(wsCtx.createdAt ?? null);
|
|
9217
9176
|
let priorSessions = [];
|
|
9218
9177
|
let recoveryBlock = null;
|
|
9219
9178
|
try {
|
|
@@ -9241,9 +9200,7 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
9241
9200
|
errors.push(`Readiness: ${e instanceof Error ? e.message : String(e)}`);
|
|
9242
9201
|
}
|
|
9243
9202
|
const lines = [];
|
|
9244
|
-
const isLowReadiness = readiness !== null && !readiness.sampleTruncated && readiness.score < 50;
|
|
9245
9203
|
if (readiness?.sampleTruncated) lines.push(READINESS_PROVISIONAL_LINE, "");
|
|
9246
|
-
const showExistingContext = readiness !== null && (readiness.sampleTruncated || readiness.score >= 50);
|
|
9247
9204
|
const stage = readiness?.stage ?? null;
|
|
9248
9205
|
const captureBehaviorNote = wsCtx.governanceMode === "open" ? "_In Open mode, user-authored captures are accepted immediately unless you ask me to keep them as drafts._" : "_Everything I capture stays pending until you confirm._";
|
|
9249
9206
|
const coherence = await buildCoherenceSection();
|
|
@@ -9262,158 +9219,118 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
9262
9219
|
lines.push("");
|
|
9263
9220
|
const startShapeLine = formatShapeAdvisorySummaryLine(shapeAdvisorySummary);
|
|
9264
9221
|
if (startShapeLine) lines.push(startShapeLine, "");
|
|
9265
|
-
if (isLowReadiness && isNeglected) {
|
|
9266
|
-
const stageNote = stage ? ` and is still at the **${stage}** stage` : "";
|
|
9267
|
-
lines.push(`Your workspace has been around for ${ageDays} days${stageNote}.`);
|
|
9268
|
-
lines.push("Let's close the gaps \u2014 or if the current structure doesn't fit, we can reshape it.");
|
|
9269
|
-
lines.push("");
|
|
9270
|
-
} else if (isLowReadiness) {
|
|
9271
|
-
lines.push("Let's get your workspace active.");
|
|
9272
|
-
lines.push("");
|
|
9273
|
-
}
|
|
9274
9222
|
lines.push(...await fetchAndRenderOpenerDirection(kernelQuery, errors, { agentSessionId, conversationId: getConversationId(), task }));
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9223
|
+
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._");
|
|
9224
|
+
lines.push("");
|
|
9225
|
+
let activeBets = [];
|
|
9226
|
+
try {
|
|
9227
|
+
const betsEntries = await kernelQuery("chain.listEntries", { collectionSlug: "work-packages" });
|
|
9228
|
+
activeBets = (betsEntries ?? []).filter((e) => isActiveNowBet(e)).map((e) => ({ name: e.name, entryId: e.entryId ?? null })).slice(0, 8);
|
|
9229
|
+
} catch {
|
|
9230
|
+
}
|
|
9231
|
+
let governanceEntries = { principles: [], standards: [], businessRules: [] };
|
|
9232
|
+
if (task) {
|
|
9233
|
+
try {
|
|
9234
|
+
const view = await kernelQuery("chain.getBindingGovernanceView", { task });
|
|
9235
|
+
const bg = view?.bindingGovernance;
|
|
9236
|
+
if (bg) {
|
|
9237
|
+
const mapGovEntry = (e) => ({
|
|
9238
|
+
entryId: e.entryId ?? void 0,
|
|
9239
|
+
name: e.name,
|
|
9240
|
+
description: typeof e.preview === "string" ? e.preview : void 0,
|
|
9241
|
+
tier: typeof e.tier === "number" ? e.tier : void 0
|
|
9242
|
+
});
|
|
9243
|
+
governanceEntries = {
|
|
9244
|
+
principles: (bg.principles ?? []).map(mapGovEntry),
|
|
9245
|
+
standards: (bg.standards ?? []).map(mapGovEntry),
|
|
9246
|
+
businessRules: (bg.businessRules ?? []).map(mapGovEntry)
|
|
9247
|
+
};
|
|
9248
|
+
}
|
|
9249
|
+
} catch {
|
|
9250
|
+
}
|
|
9251
|
+
}
|
|
9252
|
+
if (task) {
|
|
9253
|
+
if (activeBets.length > 0) {
|
|
9285
9254
|
lines.push("");
|
|
9286
|
-
lines.push(
|
|
9255
|
+
lines.push("## Active work packages \u2014 current scope");
|
|
9256
|
+
lines.push("_Work outside these work packages requires explicit user confirmation._");
|
|
9287
9257
|
lines.push("");
|
|
9288
|
-
const
|
|
9289
|
-
|
|
9290
|
-
const parts = [];
|
|
9291
|
-
if (remainingGaps > 0) parts.push(`${remainingGaps} more area${remainingGaps === 1 ? "" : "s"} to cover`);
|
|
9292
|
-
if (openTensions.length > 0) parts.push(`${openTensions.length} open tension${openTensions.length === 1 ? "" : "s"}`);
|
|
9293
|
-
lines.push(`_${parts.join(" and ")} \u2014 ask for full status to see everything._`);
|
|
9294
|
-
lines.push("");
|
|
9295
|
-
}
|
|
9296
|
-
} else {
|
|
9297
|
-
const tensionPrompt = pickNextTensionPrompt(openTensions);
|
|
9298
|
-
if (tensionPrompt) {
|
|
9299
|
-
lines.push(`**${tensionPrompt.action}**`);
|
|
9300
|
-
lines.push(tensionPrompt.cta);
|
|
9301
|
-
lines.push("");
|
|
9258
|
+
for (const e of activeBets) {
|
|
9259
|
+
lines.push(`- \`${e.entryId ?? e.name}\` ${e.name}`);
|
|
9302
9260
|
}
|
|
9261
|
+
lines.push("");
|
|
9303
9262
|
}
|
|
9304
|
-
lines.push(
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
let activeBets = [];
|
|
9308
|
-
try {
|
|
9309
|
-
const betsEntries = await kernelQuery("chain.listEntries", { collectionSlug: "work-packages" });
|
|
9310
|
-
activeBets = (betsEntries ?? []).filter((e) => isActiveNowBet(e)).map((e) => ({ name: e.name, entryId: e.entryId ?? null })).slice(0, 8);
|
|
9311
|
-
} catch {
|
|
9263
|
+
lines.push(...buildOperatingProtocol(governanceEntries, task));
|
|
9264
|
+
if (coherence) {
|
|
9265
|
+
lines.push(...coherence.lines);
|
|
9312
9266
|
}
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
const bg = view?.bindingGovernance;
|
|
9318
|
-
if (bg) {
|
|
9319
|
-
const mapGovEntry = (e) => ({
|
|
9320
|
-
entryId: e.entryId ?? void 0,
|
|
9321
|
-
name: e.name,
|
|
9322
|
-
description: typeof e.preview === "string" ? e.preview : void 0,
|
|
9323
|
-
tier: typeof e.tier === "number" ? e.tier : void 0
|
|
9324
|
-
});
|
|
9325
|
-
governanceEntries = {
|
|
9326
|
-
principles: (bg.principles ?? []).map(mapGovEntry),
|
|
9327
|
-
standards: (bg.standards ?? []).map(mapGovEntry),
|
|
9328
|
-
businessRules: (bg.businessRules ?? []).map(mapGovEntry)
|
|
9329
|
-
};
|
|
9330
|
-
}
|
|
9331
|
-
} catch {
|
|
9267
|
+
if (allCollections.length > 0) {
|
|
9268
|
+
const docCompleteness = buildDocCompletenessSection(allCollections);
|
|
9269
|
+
if (docCompleteness.errorCount > 0 || docCompleteness.warningCount > 0) {
|
|
9270
|
+
lines.push(...docCompleteness.lines);
|
|
9332
9271
|
}
|
|
9333
9272
|
}
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
lines.push("");
|
|
9337
|
-
lines.push("## Active work packages \u2014 current scope");
|
|
9338
|
-
lines.push("_Work outside these work packages requires explicit user confirmation._");
|
|
9339
|
-
lines.push("");
|
|
9340
|
-
for (const e of activeBets) {
|
|
9341
|
-
lines.push(`- \`${e.entryId ?? e.name}\` ${e.name}`);
|
|
9342
|
-
}
|
|
9343
|
-
lines.push("");
|
|
9344
|
-
}
|
|
9345
|
-
lines.push(...buildOperatingProtocol(governanceEntries, task));
|
|
9346
|
-
if (coherence) {
|
|
9347
|
-
lines.push(...coherence.lines);
|
|
9348
|
-
}
|
|
9349
|
-
if (allCollections.length > 0) {
|
|
9350
|
-
const docCompleteness = buildDocCompletenessSection(allCollections);
|
|
9351
|
-
if (docCompleteness.errorCount > 0 || docCompleteness.warningCount > 0) {
|
|
9352
|
-
lines.push(...docCompleteness.lines);
|
|
9353
|
-
}
|
|
9354
|
-
}
|
|
9355
|
-
const plannedWork = await queryPlannedWork();
|
|
9356
|
-
if (hasPlannedWork(plannedWork)) {
|
|
9357
|
-
lines.push("");
|
|
9358
|
-
lines.push(...buildPlannedWorkSection(plannedWork, priorSessions, recoveryBlock));
|
|
9359
|
-
} else if (recoveryBlock) {
|
|
9360
|
-
lines.push("");
|
|
9361
|
-
lines.push(...formatRecoveryBlock(recoveryBlock));
|
|
9362
|
-
}
|
|
9363
|
-
try {
|
|
9364
|
-
const allEntries = await kernelQuery(
|
|
9365
|
-
"chain.listEntries",
|
|
9366
|
-
{ fields: ["seededByPlatform", "collectionId"] }
|
|
9367
|
-
);
|
|
9368
|
-
const committed = (allEntries ?? []).filter((e) => !e.seededByPlatform);
|
|
9369
|
-
const committedCollections = new Set(committed.map((e) => e.collectionId));
|
|
9370
|
-
if (committed.length >= 10 && committedCollections.size >= 3) {
|
|
9371
|
-
lines.push("");
|
|
9372
|
-
lines.push(`_Context sample: ${committed.length} accepted/active entries across ${committedCollections.size} collections._`);
|
|
9373
|
-
}
|
|
9374
|
-
} catch {
|
|
9375
|
-
}
|
|
9273
|
+
const plannedWork = await queryPlannedWork();
|
|
9274
|
+
if (hasPlannedWork(plannedWork)) {
|
|
9376
9275
|
lines.push("");
|
|
9377
|
-
lines.push(
|
|
9276
|
+
lines.push(...buildPlannedWorkSection(plannedWork, priorSessions, recoveryBlock));
|
|
9277
|
+
} else if (recoveryBlock) {
|
|
9378
9278
|
lines.push("");
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9279
|
+
lines.push(...formatRecoveryBlock(recoveryBlock));
|
|
9280
|
+
}
|
|
9281
|
+
try {
|
|
9282
|
+
const allEntries = await kernelQuery(
|
|
9283
|
+
"chain.listEntries",
|
|
9284
|
+
{ fields: ["seededByPlatform", "collectionId"] }
|
|
9285
|
+
);
|
|
9286
|
+
const committed = (allEntries ?? []).filter((e) => !e.seededByPlatform);
|
|
9287
|
+
const committedCollections = new Set(committed.map((e) => e.collectionId));
|
|
9288
|
+
if (committed.length >= 10 && committedCollections.size >= 3) {
|
|
9388
9289
|
lines.push("");
|
|
9290
|
+
lines.push(`_Context sample: ${committed.length} accepted/active entries across ${committedCollections.size} collections._`);
|
|
9389
9291
|
}
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
const created = Array.isArray(last.entriesCreated) ? last.entriesCreated.length : last.entriesCreated ?? 0;
|
|
9404
|
-
const modified = Array.isArray(last.entriesModified) ? last.entriesModified.length : last.entriesModified ?? 0;
|
|
9405
|
-
lines.push(`_Last session (${date}): ${created} created, ${modified} modified._`);
|
|
9406
|
-
lines.push("");
|
|
9292
|
+
} catch {
|
|
9293
|
+
}
|
|
9294
|
+
lines.push("");
|
|
9295
|
+
lines.push(`Working on: **${task}**`);
|
|
9296
|
+
lines.push("");
|
|
9297
|
+
} else {
|
|
9298
|
+
if (activeBets.length > 0) {
|
|
9299
|
+
lines.push("");
|
|
9300
|
+
lines.push("## Active work packages \u2014 current scope");
|
|
9301
|
+
lines.push("_Work outside these work packages requires explicit user confirmation._");
|
|
9302
|
+
lines.push("");
|
|
9303
|
+
for (const e of activeBets) {
|
|
9304
|
+
lines.push(`- \`${e.entryId ?? e.name}\` ${e.name}`);
|
|
9407
9305
|
}
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9306
|
+
lines.push("");
|
|
9307
|
+
}
|
|
9308
|
+
lines.push(...buildOperatingProtocol());
|
|
9309
|
+
if (coherence) {
|
|
9310
|
+
lines.push(...coherence.lines);
|
|
9311
|
+
}
|
|
9312
|
+
if (allCollections.length > 0) {
|
|
9313
|
+
const docCompleteness = buildDocCompletenessSection(allCollections);
|
|
9314
|
+
if (docCompleteness.errorCount > 0 || docCompleteness.warningCount > 0) {
|
|
9315
|
+
lines.push(...docCompleteness.lines);
|
|
9411
9316
|
}
|
|
9412
|
-
|
|
9317
|
+
}
|
|
9318
|
+
if (priorSessions.length > 0 && !recoveryBlock) {
|
|
9319
|
+
const last = priorSessions[0];
|
|
9320
|
+
const date = last.startedAt ? new Date(last.startedAt).toISOString().split("T")[0] : "unknown";
|
|
9321
|
+
const created = Array.isArray(last.entriesCreated) ? last.entriesCreated.length : last.entriesCreated ?? 0;
|
|
9322
|
+
const modified = Array.isArray(last.entriesModified) ? last.entriesModified.length : last.entriesModified ?? 0;
|
|
9323
|
+
lines.push(`_Last session (${date}): ${created} created, ${modified} modified._`);
|
|
9413
9324
|
lines.push("");
|
|
9414
|
-
|
|
9325
|
+
}
|
|
9326
|
+
if (recoveryBlock) {
|
|
9415
9327
|
lines.push("");
|
|
9328
|
+
lines.push(...formatRecoveryBlock(recoveryBlock));
|
|
9416
9329
|
}
|
|
9330
|
+
lines.push(captureBehaviorNote);
|
|
9331
|
+
lines.push("");
|
|
9332
|
+
lines.push("**What are you working on?** Tell me and I'll load relevant governance and context.");
|
|
9333
|
+
lines.push("");
|
|
9417
9334
|
}
|
|
9418
9335
|
if (errors.length > 0) {
|
|
9419
9336
|
lines.push("## Errors");
|
|
@@ -9440,7 +9357,6 @@ async function buildOrientResponse(wsCtx, agentSessionId, errors, task) {
|
|
|
9440
9357
|
{
|
|
9441
9358
|
stage,
|
|
9442
9359
|
sampleTruncated: readiness?.sampleTruncated ?? null,
|
|
9443
|
-
readinessScore: readiness?.score ?? null,
|
|
9444
9360
|
totalGaps: gapCount,
|
|
9445
9361
|
openTensions: openTensions.length,
|
|
9446
9362
|
oriented,
|
|
@@ -9780,12 +9696,6 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
9780
9696
|
});
|
|
9781
9697
|
}
|
|
9782
9698
|
}
|
|
9783
|
-
let openTensions = [];
|
|
9784
|
-
try {
|
|
9785
|
-
const tensions = await kernelQuery("chain.listEntries", { collectionSlug: "tensions" });
|
|
9786
|
-
openTensions = (tensions ?? []).filter((e) => e.workflowStatus === "open");
|
|
9787
|
-
} catch {
|
|
9788
|
-
}
|
|
9789
9699
|
let allCollections = [];
|
|
9790
9700
|
try {
|
|
9791
9701
|
allCollections = await kernelQuery("chain.listCollections") ?? [];
|
|
@@ -9826,7 +9736,7 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
9826
9736
|
content: [{ type: "text", text: scanLines.join("\n") }],
|
|
9827
9737
|
structuredContent: success(
|
|
9828
9738
|
"No accepted user-authored entries found. Follow the spine guidance for your task; full onboarding is optional.",
|
|
9829
|
-
{ stage: "blank",
|
|
9739
|
+
{ stage: "blank", oriented, orientationStatus: orientationStatus2, redirectHint: "Optional full onboarding: `orient action=start`. Continue an existing task using the spine guidance." },
|
|
9830
9740
|
task ? [] : [{ tool: "orient", description: "Optional full workspace onboarding", parameters: { action: "start" } }]
|
|
9831
9741
|
)
|
|
9832
9742
|
};
|
|
@@ -9834,7 +9744,6 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
9834
9744
|
return blankResult;
|
|
9835
9745
|
}
|
|
9836
9746
|
const lines = sampleTruncated ? [READINESS_PROVISIONAL_LINE, ""] : [];
|
|
9837
|
-
const isLowReadiness = !sampleTruncated && readiness && readiness.score < 50;
|
|
9838
9747
|
const stageQualifier = sampleTruncated ? " (provisional sample)" : "";
|
|
9839
9748
|
if (wsCtx) {
|
|
9840
9749
|
lines.push(`# ${wsCtx.workspaceName}`);
|
|
@@ -9854,7 +9763,7 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
9854
9763
|
lines.push("");
|
|
9855
9764
|
}
|
|
9856
9765
|
if (mode === "brief") {
|
|
9857
|
-
const briefStage = readiness?.stage ??
|
|
9766
|
+
const briefStage = readiness?.stage ?? "unknown";
|
|
9858
9767
|
lines.push(`Brain stage: ${briefStage}${stageQualifier}`);
|
|
9859
9768
|
lines.push(...buildDirectionLines(orientView));
|
|
9860
9769
|
if (orientView?.strategicContext) {
|
|
@@ -10051,43 +9960,10 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
10051
9960
|
return briefResult;
|
|
10052
9961
|
}
|
|
10053
9962
|
const orientStage = readiness?.stage ?? "seeded";
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
if (ageDays >= 30) {
|
|
10057
|
-
lines.push(`Your workspace has been around for ${ageDays} days and is still at the **${orientStage}${stageQualifier}** stage.`);
|
|
10058
|
-
lines.push("Let's close the gaps \u2014 or if the current structure doesn't fit, we can reshape it.");
|
|
10059
|
-
lines.push("");
|
|
10060
|
-
}
|
|
10061
|
-
}
|
|
9963
|
+
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._");
|
|
9964
|
+
lines.push("");
|
|
10062
9965
|
let fullCoherenceSnapshot;
|
|
10063
|
-
if (
|
|
10064
|
-
const scLRLines = buildDirectionLines(orientView);
|
|
10065
|
-
if (scLRLines.length > 0) lines.push(...scLRLines, "");
|
|
10066
|
-
const captureBehaviorNote = (readiness?.governanceMode ?? wsCtx?.governanceMode ?? "open") === "open" ? "_In Open mode, captures are accepted automatically unless you ask me to keep them as drafts._" : "_Everything stays as a draft until you confirm._";
|
|
10067
|
-
const gaps = readiness.gaps ?? [];
|
|
10068
|
-
if (gaps.length > 0) {
|
|
10069
|
-
const gapCtx = {
|
|
10070
|
-
stage: orientStage,
|
|
10071
|
-
passedChecks: readiness.passedChecks ?? 0,
|
|
10072
|
-
totalChecks: readiness.totalChecks ?? 0,
|
|
10073
|
-
score: readiness.score ?? 0
|
|
10074
|
-
};
|
|
10075
|
-
lines.push(formatTopGapPrompt(gaps[0], gaps.length - 1, gapCtx));
|
|
10076
|
-
lines.push("");
|
|
10077
|
-
lines.push(captureBehaviorNote);
|
|
10078
|
-
lines.push("");
|
|
10079
|
-
const remainingGaps = gaps.length - 1;
|
|
10080
|
-
if (remainingGaps > 0 || openTensions.length > 0) {
|
|
10081
|
-
const parts = [];
|
|
10082
|
-
if (remainingGaps > 0) parts.push(`${remainingGaps} more area${remainingGaps === 1 ? "" : "s"} to cover`);
|
|
10083
|
-
if (openTensions.length > 0) parts.push(`${openTensions.length} open tension${openTensions.length === 1 ? "" : "s"}`);
|
|
10084
|
-
lines.push(`_${parts.join(" and ")} \u2014 ask for full status to see everything._`);
|
|
10085
|
-
lines.push("");
|
|
10086
|
-
}
|
|
10087
|
-
}
|
|
10088
|
-
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._");
|
|
10089
|
-
lines.push("");
|
|
10090
|
-
} else if (readiness) {
|
|
9966
|
+
if (readiness) {
|
|
10091
9967
|
const fmt = (e) => {
|
|
10092
9968
|
const type = e.canonicalKey ?? "generic";
|
|
10093
9969
|
const stratum = e.stratum ?? "?";
|
|
@@ -10448,7 +10324,7 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
|
|
|
10448
10324
|
const fullResult = {
|
|
10449
10325
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
10450
10326
|
structuredContent: success(
|
|
10451
|
-
`Oriented (full). Stage: ${orientStage}${stageQualifier}. ${sampleTruncated ? "Provisional readiness sample." :
|
|
10327
|
+
`Oriented (full). Stage: ${orientStage}${stageQualifier}. ${sampleTruncated ? "Provisional readiness sample." : (readiness?.gaps?.length ?? 0) > 0 ? "Gaps remain." : "Ready."}`,
|
|
10452
10328
|
{
|
|
10453
10329
|
mode: "full",
|
|
10454
10330
|
stage: orientStage,
|
|
@@ -14809,17 +14685,14 @@ var STAGE_DESCRIPTIONS = {
|
|
|
14809
14685
|
};
|
|
14810
14686
|
async function handleWorkspaceStatus() {
|
|
14811
14687
|
const result2 = await kernelQuery("chain.workspaceReadiness");
|
|
14812
|
-
const {
|
|
14813
|
-
const scoringVersion = result2.scoringVersion ?? "v1";
|
|
14688
|
+
const { checks, gaps, stats, governanceMode } = result2;
|
|
14814
14689
|
const stage = result2.stage ?? "seeded";
|
|
14815
14690
|
const stageLabel = `${STAGE_LABELS[stage] ?? stage}${result2.sampleTruncated ? " (provisional sample)" : ""}`;
|
|
14816
14691
|
const stageDescription = result2.sampleTruncated ? READINESS_PROVISIONAL_LINE : STAGE_DESCRIPTIONS[stage] ?? "";
|
|
14817
|
-
const scoreBar = "\u2588".repeat(Math.round(score / 10)) + "\u2591".repeat(10 - Math.round(score / 10));
|
|
14818
14692
|
const lines = [
|
|
14819
14693
|
`# Brain Status: ${stageLabel}`,
|
|
14820
14694
|
`_${stageDescription}_`,
|
|
14821
14695
|
"",
|
|
14822
|
-
`${scoreBar} ${stageLabel} \xB7 ${score}%`,
|
|
14823
14696
|
`**Governance:** ${governanceMode ?? "open"}${(governanceMode ?? "open") !== "open" ? " (accepts require proposal)" : ""}`,
|
|
14824
14697
|
"",
|
|
14825
14698
|
"## Sampled counts",
|
|
@@ -14855,11 +14728,11 @@ async function handleWorkspaceStatus() {
|
|
|
14855
14728
|
const statusData = {
|
|
14856
14729
|
stage,
|
|
14857
14730
|
sampleTruncated: result2.sampleTruncated ?? null,
|
|
14858
|
-
scoringVersion,
|
|
14859
|
-
readinessScore: score,
|
|
14860
14731
|
activeEntries: stats.activeCount,
|
|
14861
14732
|
totalRelations: stats.totalRelations,
|
|
14862
14733
|
orphanedEntries: stats.orphanedCount,
|
|
14734
|
+
// Every check (pass + fail), not just the passing ones the text renders — DEC-1690's fact list.
|
|
14735
|
+
checks: checks.map((c) => ({ label: c.label, passed: c.passed, current: c.current, required: c.required })),
|
|
14863
14736
|
gaps: gaps.map((g) => ({
|
|
14864
14737
|
id: g.id,
|
|
14865
14738
|
label: g.label,
|
|
@@ -14870,7 +14743,7 @@ async function handleWorkspaceStatus() {
|
|
|
14870
14743
|
return {
|
|
14871
14744
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
14872
14745
|
structuredContent: success(
|
|
14873
|
-
`Brain: ${stageLabel}
|
|
14746
|
+
`Brain: ${stageLabel}. ${stats.activeCount} accepted/active entries in the sample, ${gaps.length} ${result2.sampleTruncated ? "potential gap(s); absence unverified" : "gap(s)"}.`,
|
|
14874
14747
|
statusData
|
|
14875
14748
|
)
|
|
14876
14749
|
};
|
|
@@ -14923,20 +14796,15 @@ var organisationHealthSchema = z30.object({
|
|
|
14923
14796
|
disagreements: z30.number(),
|
|
14924
14797
|
abstentions: z30.number(),
|
|
14925
14798
|
agreementRate: z30.number(),
|
|
14926
|
-
flags: z30.array(z30.object({
|
|
14927
|
-
collection: z30.string(),
|
|
14928
|
-
count: z30.number(),
|
|
14929
|
-
suggestedCollection: z30.string()
|
|
14930
|
-
}))
|
|
14799
|
+
flags: z30.array(z30.object({ collection: z30.string(), count: z30.number(), suggestedCollection: z30.string() }))
|
|
14931
14800
|
});
|
|
14932
14801
|
var healthStatusOutputSchema = z30.object({
|
|
14933
14802
|
stage: z30.enum(["blank", "seeded", "grounded", "connected"]).optional().default("seeded"),
|
|
14934
14803
|
sampleTruncated: z30.boolean().nullable().optional(),
|
|
14935
|
-
scoringVersion: z30.enum(["v1", "v2"]).optional().default("v1"),
|
|
14936
|
-
readinessScore: z30.number(),
|
|
14937
14804
|
activeEntries: z30.number(),
|
|
14938
14805
|
totalRelations: z30.number(),
|
|
14939
14806
|
orphanedEntries: z30.number(),
|
|
14807
|
+
checks: z30.array(z30.object({ label: z30.string(), passed: z30.boolean(), current: z30.number(), required: z30.number() })),
|
|
14940
14808
|
gaps: z30.array(z30.object({ id: z30.string(), label: z30.string(), guidance: z30.string() })),
|
|
14941
14809
|
organisationHealth: organisationHealthSchema.optional()
|
|
14942
14810
|
});
|
|
@@ -15254,7 +15122,7 @@ function registerWorkspaceTools(server) {
|
|
|
15254
15122
|
"workspace",
|
|
15255
15123
|
{
|
|
15256
15124
|
title: "Workspace",
|
|
15257
|
-
description: "Diagnostics, session identity, usage, and governance proposals for the current workspace. Nine actions:\n\n- **check**: Verify connectivity \u2014 workspace, collections, entries, latency.\n- **whoami**: Session identity \u2014 workspace ID, slug, name.\n- **status**: Workspace readiness \u2014
|
|
15125
|
+
description: "Diagnostics, session identity, usage, and governance proposals for the current workspace. Nine actions:\n\n- **check**: Verify connectivity \u2014 workspace, collections, entries, latency.\n- **whoami**: Session identity \u2014 workspace ID, slug, name.\n- **status**: Workspace readiness \u2014 checks (pass/fail), gaps, stats (entries, relations, orphans).\n- **audit**: Session audit log \u2014 last N backend calls with summary.\n- **self-test**: Validate all registered tool schemas.\n- **usage**: LLM usage and cost summary \u2014 spend, tokens, model/feature breakdown (absorbs `get-usage-summary`).\n- **proposals-list**: List open consent proposals awaiting review (absorbs `governance-proposals` action=list).\n- **proposals-respond**: Approve or reject a consent proposal (absorbs `governance-proposals` action=respond).\n- **proposals-count**: Count open consent proposals for badge/notification display (absorbs `governance-proposals` action=count).",
|
|
15258
15126
|
inputSchema: workspaceSchema,
|
|
15259
15127
|
// Mixed read/write noun (§3 R3): proposals-respond writes; every other action reads.
|
|
15260
15128
|
annotations: { readOnlyHint: false, idempotentHint: true, openWorldHint: false }
|
|
@@ -17129,4 +16997,4 @@ export {
|
|
|
17129
16997
|
createProductBrainServer,
|
|
17130
16998
|
initFeatureFlags
|
|
17131
16999
|
};
|
|
17132
|
-
//# sourceMappingURL=chunk-
|
|
17000
|
+
//# sourceMappingURL=chunk-HYVIULEC.js.map
|