@productbrain/mcp 0.0.1-beta.3571 → 0.0.1-beta.3574

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.
@@ -42,7 +42,7 @@ import {
42
42
  trackSessionCaptureRate,
43
43
  trackWriteBackHintServed,
44
44
  trackZeroCaptureAuditFired
45
- } from "./chunk-VCTFH2U7.js";
45
+ } from "./chunk-LSOA2AH2.js";
46
46
 
47
47
  // src/server.ts
48
48
  import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -156,6 +156,15 @@ function classifyError(err) {
156
156
  availableActions: [{ tool: "entries", description: "Search entries", parameters: { action: "search" } }]
157
157
  };
158
158
  }
159
+ if (convexCode?.startsWith("AUTHZ_")) {
160
+ return {
161
+ code: "PERMISSION_DENIED",
162
+ fn,
163
+ message: cleanMessage,
164
+ recovery: "Check permissions or use a readwrite API key.",
165
+ availableActions: [{ tool: "workspace", description: "Check key scope", parameters: { action: "whoami" } }]
166
+ };
167
+ }
159
168
  if (convexCode === "WORKSPACE_SLUG_TAKEN" || convexCode === "PERSON_ALREADY_EXISTS") {
160
169
  return {
161
170
  code: "DUPLICATE",
@@ -8843,6 +8852,27 @@ async function loadSkillBody(entryId) {
8843
8852
  });
8844
8853
  }
8845
8854
 
8855
+ // src/lib/sessionNotices.ts
8856
+ var FEEDBACK_SUBMIT_HINT = "Friction or ideas? Use `feedback action=submit` \u2014 describe how pb behaved, not your workspace content. Once screening completes, it enters the builders' triage queue.";
8857
+ function nextActionForVerb(verb) {
8858
+ switch (verb) {
8859
+ case "feedback.list":
8860
+ return { tool: "feedback", description: "Read your workspace's own feedback (all statuses)", parameters: { action: "list" } };
8861
+ case "feedback.queue":
8862
+ return { tool: "feedback", description: "Read the vendor triage queue (system admins only)", parameters: { action: "queue" } };
8863
+ default:
8864
+ return null;
8865
+ }
8866
+ }
8867
+ function noticesToNextActions(notices) {
8868
+ if (!notices || notices.length === 0) return [];
8869
+ return notices.map((n) => nextActionForVerb(n.action.verb)).filter((a) => a !== null);
8870
+ }
8871
+ function formatNoticeLines(notices) {
8872
+ if (!notices || notices.length === 0) return [];
8873
+ return notices.map((n) => `- ${n.subject} (${n.change})`);
8874
+ }
8875
+
8846
8876
  // src/tools/start_pb.ts
8847
8877
  var startPbSchema = z18.object({
8848
8878
  task: z18.string().max(2e3).optional().describe(
@@ -8852,7 +8882,6 @@ var startPbSchema = z18.object({
8852
8882
  // governance; domain-scoping is deferred to TEN-2429 (must change both together, INS-1864).
8853
8883
  });
8854
8884
  var PB_SETUP_SKILL_ENTRY_ID = "SKILL-pb-setup";
8855
- var FEEDBACK_HINT = "Friction or ideas? Use `feedback action=submit` \u2014 describe how pb behaved, not your workspace content. Once screening completes, it enters the builders' triage queue.";
8856
8885
  async function tryMarkOriented(agentSessionId, coherenceSnapshot) {
8857
8886
  if (!agentSessionId) return { oriented: false, orientationStatus: "no_session" };
8858
8887
  try {
@@ -9186,7 +9215,7 @@ async function handleStartPb({ task }) {
9186
9215
  return {
9187
9216
  content: textContent(`${result2.text}
9188
9217
 
9189
- ${FEEDBACK_HINT}`),
9218
+ ${FEEDBACK_SUBMIT_HINT}`),
9190
9219
  structuredContent: result2.structuredContent
9191
9220
  };
9192
9221
  }
@@ -9198,7 +9227,7 @@ ${FEEDBACK_HINT}`),
9198
9227
  return {
9199
9228
  content: [{ type: "text", text: `${orientResult.text}
9200
9229
 
9201
- ${FEEDBACK_HINT}` }],
9230
+ ${FEEDBACK_SUBMIT_HINT}` }],
9202
9231
  structuredContent: orientResult.structuredContent
9203
9232
  };
9204
9233
  }
@@ -13154,24 +13183,6 @@ No constellation entries were accepted.`
13154
13183
  };
13155
13184
  }
13156
13185
 
13157
- // src/lib/sessionNotices.ts
13158
- function nextActionForVerb(verb) {
13159
- switch (verb) {
13160
- case "feedback.list":
13161
- return { tool: "feedback", description: "Read your workspace's own feedback (all statuses)", parameters: { action: "list" } };
13162
- default:
13163
- return null;
13164
- }
13165
- }
13166
- function noticesToNextActions(notices) {
13167
- if (!notices || notices.length === 0) return [];
13168
- return notices.map((n) => nextActionForVerb(n.action.verb)).filter((a) => a !== null);
13169
- }
13170
- function formatNoticeLines(notices) {
13171
- if (!notices || notices.length === 0) return [];
13172
- return notices.map((n) => `- ${n.subject} (${n.change})`);
13173
- }
13174
-
13175
13186
  // src/tools/session.ts
13176
13187
  var SESSION_ACTIONS = [
13177
13188
  "start",
@@ -13263,20 +13274,10 @@ function registerSessionTools(server) {
13263
13274
  async function handleStart2() {
13264
13275
  const result2 = await startAgentSession();
13265
13276
  const lines = [];
13266
- if (result2.superseded) {
13267
- lines.push(
13268
- `Previous session superseded. Session ${result2.superseded.previousSessionId} (started ${result2.superseded.startedAt}, initiated by ${result2.superseded.initiatedBy}) was closed.`,
13269
- ""
13270
- );
13271
- }
13272
13277
  lines.push(
13273
13278
  `Session ${result2.sessionId} active. Initiated by ${result2.initiatedBy}. Workspace ${result2.workspaceName}. Scope: ${result2.toolsScope}. Write tools available after orient.`
13274
13279
  );
13275
- if (result2.feedbackQueueNew && result2.feedbackQueueNew > 0) {
13276
- const ageDays = result2.feedbackOldestNewAt ? Math.max(0, Math.floor((Date.now() - result2.feedbackOldestNewAt) / 864e5)) : null;
13277
- lines.push(`Feedback queue: ${result2.feedbackQueueNew} new (oldest ${ageDays === null ? "unknown" : `${ageDays}d`}) \u2014 feedback action=queue`);
13278
- }
13279
- lines.push("Friction or ideas? Use `feedback action=submit` \u2014 describe how pb behaved, not your workspace content. Once screening completes, it enters the builders' triage queue.");
13280
+ lines.push(FEEDBACK_SUBMIT_HINT);
13280
13281
  const noticeLines = formatNoticeLines(result2.notices);
13281
13282
  if (noticeLines.length > 0) {
13282
13283
  lines.push("", "Notices:", ...noticeLines);
@@ -13289,7 +13290,6 @@ async function handleStart2() {
13289
13290
  initiatedBy: result2.initiatedBy,
13290
13291
  workspaceName: result2.workspaceName,
13291
13292
  toolsScope: result2.toolsScope,
13292
- superseded: !!result2.superseded,
13293
13293
  feedbackQueueNew: result2.feedbackQueueNew,
13294
13294
  feedbackOldestNewAt: result2.feedbackOldestNewAt,
13295
13295
  notices: result2.notices ?? []
@@ -16702,4 +16702,4 @@ export {
16702
16702
  createProductBrainServer,
16703
16703
  initFeatureFlags
16704
16704
  };
16705
- //# sourceMappingURL=chunk-PEAWB3EE.js.map
16705
+ //# sourceMappingURL=chunk-4SY3XNA2.js.map