@productbrain/mcp 0.0.1-beta.7547 → 0.0.1-beta.7552

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.
@@ -781,6 +781,17 @@ ${msg}
781
781
  };
782
782
  }
783
783
 
784
+ // src/lib/statusCategories.ts
785
+ var STATUS_CATEGORIES = ["draft", "current", "past", "discarded"];
786
+ var STATUS_CATEGORY_SET = new Set(STATUS_CATEGORIES);
787
+ var TRUST_ACCEPTED_WORDS = ["accepted", "active", "current"];
788
+ function isTrustAccepted(status2) {
789
+ return TRUST_ACCEPTED_WORDS.includes(status2);
790
+ }
791
+ var TRUST_ARCHIVED_WORDS = ["archived", "deprecated", "past", "discarded"];
792
+ var ENTRY_STATUS_READ_WORDS = ["draft", ...TRUST_ACCEPTED_WORDS, ...TRUST_ARCHIVED_WORDS];
793
+ var ENTRY_STATUS_WRITE_WORDS = ["draft", "archived"];
794
+
784
795
  // src/lib/scopedCache.ts
785
796
  var ScopedCache = class {
786
797
  constructor(ttlMs, maxScopes = 100) {
@@ -2189,7 +2200,7 @@ No DB writes \u2014 call without \`preview:true\` to capture for real.${result2.
2189
2200
  coachingFromCreate = created.coaching;
2190
2201
  resolveGapsForEntry(name, created.entryId);
2191
2202
  const createdStatus = created.status;
2192
- if (createdStatus === "active" || createdStatus === "accepted") wasAutoCommittedServerSide = true;
2203
+ if (createdStatus !== void 0 && isTrustAccepted(createdStatus)) wasAutoCommittedServerSide = true;
2193
2204
  spineFloor = created.spineFloor;
2194
2205
  } catch (error) {
2195
2206
  const msg = error instanceof Error ? error.message : String(error);
@@ -2859,8 +2870,8 @@ var updateEntrySchema = z6.object({
2859
2870
  entryId: z6.string().describe("Entry ID to update, e.g. 'T-SUPPLIER', '<PREFIX>-<n>'"),
2860
2871
  name: z6.string().optional().describe("New display name"),
2861
2872
  // Chain-ID-leak guard (check:chain-id-leaks): the retired legacy-shim ticket number stays in
2862
- // the code comment above, never in this user-visible describe() string.
2863
- status: z6.enum(["draft", "active", "deprecated", "archived"]).optional().describe("Lifecycle status: draft | active | deprecated | archived. Use `workflowStatus` for collection-specific workflow values \u2014 those are no longer accepted via `status`."),
2873
+ // the code comment above, never in this user-visible describe() string. T8 (TASK-393, WP-779): narrowed to generated ENTRY_STATUS_WRITE_WORDS.
2874
+ status: z6.enum(ENTRY_STATUS_WRITE_WORDS).optional().describe(`Lifecycle status: ${ENTRY_STATUS_WRITE_WORDS.join(" | ")}. 'accepted' is set via 'commit', never 'update'; 'active'/'deprecated' are legacy words and are refused here. Use \`workflowStatus\` for collection-specific workflow values \u2014 those are no longer accepted via \`status\`.`),
2864
2875
  workflowStatus: z6.string().optional().describe("Collection workflow state. Valid values are collection-specific and server-owned \u2014 discover them via `collections action=describe` for the target collection. The server rejects invalid values and returns the valid set in the error."),
2865
2876
  data: z6.record(z6.unknown()).optional().describe("Fields to update (merged with existing data)"),
2866
2877
  order: z6.number().optional().describe("New sort order"),
@@ -2931,7 +2942,7 @@ async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowSta
2931
2942
  const wsCtx = await getWorkspaceContext();
2932
2943
  const updated = await kernelQuery("chain.getEntry", { entryId });
2933
2944
  const entryStatus = updated?.status ?? "draft";
2934
- const versionMode = entryStatus === "active" || entryStatus === "accepted" ? "published" : `saved as ${entryStatus}`;
2945
+ const versionMode = isTrustAccepted(entryStatus) ? "published" : `saved as ${entryStatus}`;
2935
2946
  const responseLines = [
2936
2947
  `# Entry Updated`,
2937
2948
  ``,
@@ -3139,7 +3150,7 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
3139
3150
  for (const w of advisoryWarnings) {
3140
3151
  lines.push(w.kind === "semantic" ? `- ${w.name} (${w.entryId}) \u2014 ${w.explanation}` : `- ${w.name} (${w.collection}, ${w.entryId}) \u2014 has 'governs' relation to ${w.governsCount} entries`);
3141
3152
  }
3142
- lines.push(preflight.source === "semantic" ? "Run context action=gather on the conflicting entries to review; use entries action=update to reconcile the two, or to mark this entry status='deprecated' if it's actually superseded." : "Run context action=gather on these entries to review; use entries action=update to reconcile the two, or to mark this entry status='deprecated' if it's actually superseded.");
3153
+ lines.push(preflight.source === "semantic" ? "Run context action=gather on the conflicting entries to review; use entries action=update to reconcile the two, or to mark this entry status='archived' if it's actually superseded." : "Run context action=gather on these entries to review; use entries action=update to reconcile the two, or to mark this entry status='archived' if it's actually superseded.");
3143
3154
  }
3144
3155
  if (coachingResult?.verdict) {
3145
3156
  try {
@@ -3738,7 +3749,7 @@ var ENTRIES_ACTIONS = [
3738
3749
  "preflight",
3739
3750
  "still-true"
3740
3751
  ];
3741
- var entriesStatusFilterSchema = z10.union([z10.string().max(200), z10.array(z10.enum(["draft", "active", "accepted", "deprecated", "archived"])).max(5)]);
3752
+ var entriesStatusFilterSchema = z10.union([z10.string().max(200), z10.array(z10.enum(ENTRY_STATUS_READ_WORDS)).max(5)]);
3742
3753
  var coherencyAcknowledgementFlatSchema = z10.object({
3743
3754
  response: z10.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
3744
3755
  entryId: z10.string().max(200).optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
@@ -3756,7 +3767,7 @@ var entriesSchema = z10.object({
3756
3767
  entryIds: z10.array(z10.string().max(200)).min(1).max(20).optional().describe("Entry IDs for 'batch', e.g. ['TYPE-strategy', 'STR-jljeg7']"),
3757
3768
  collection: z10.string().max(200).optional().describe("Collection slug \u2014 for 'list'/'search': scope filter, e.g. 'glossary', 'tracking-events'. For 'preflight': the collection the entry would be composed into (required)."),
3758
3769
  status: entriesStatusFilterSchema.optional().describe(
3759
- "For 'list': defaults to accepted entries (active/accepted); use status='draft' to discover drafts. One lifecycle value (draft|active|accepted|deprecated|archived). For 'search': one value OR an array of up to 5 (e.g. ['active','accepted']). For 'update': draft|active|deprecated|archived ONLY \u2014 'accepted' is set via 'commit', never 'update'. Workflow values use `workflowStatus` instead."
3770
+ `For 'list': defaults to accepted entries (active/accepted/current); use status='draft' to discover drafts. One lifecycle or category value (${ENTRY_STATUS_READ_WORDS.join("|")}). For 'search': one value OR an array of up to 5 (e.g. ['active','accepted']). For 'update': draft|archived ONLY \u2014 'accepted' is set via 'commit', never 'update'; 'active'/'deprecated' are legacy read-only words, refused on write. Workflow values use \`workflowStatus\` instead.`
3760
3771
  ),
3761
3772
  tag: z10.string().max(200).optional().describe("For 'list': filter by internal tag."),
3762
3773
  label: z10.string().max(200).optional().describe("For 'list': filter by label slug \u2014 matches entries across all collections."),
@@ -6339,8 +6350,8 @@ var COLLECTIONS_ACTIONS = [
6339
6350
  "label-apply",
6340
6351
  "label-remove"
6341
6352
  ];
6342
- var STATUS_CATEGORIES = ["draft", "current", "past", "discarded"];
6343
- var statusListEntrySchema = z17.object({ label: z17.string().max(200), category: z17.enum(STATUS_CATEGORIES) });
6353
+ var STATUS_CATEGORIES2 = ["draft", "current", "past", "discarded"];
6354
+ var statusListEntrySchema = z17.object({ label: z17.string().max(200), category: z17.enum(STATUS_CATEGORIES2) });
6344
6355
  var qualityCriterionSchema = z17.object({
6345
6356
  field: z17.string().max(200).describe("Entry data field key this criterion applies to, e.g. 'description', 'owner'"),
6346
6357
  // WP-480 S1: `max_length` — must mirror the Convex rule union, or the tool rejects a
@@ -14115,7 +14126,7 @@ governed_by, alternative_to, has_proposal, requests_promotion_of, resolves,
14115
14126
  anchored_to, authority_domain, domain_routed_to
14116
14127
 
14117
14128
  ## Lifecycle Status
14118
- All entries: \`draft\` | \`active\` | \`deprecated\` | \`archived\`
14129
+ Write via \`update\`: \`draft\` | \`archived\` (\`accepted\` via \`commit\`, never \`update\`). \`active\`/\`deprecated\` are legacy: readable, refused on write.
14119
14130
 
14120
14131
  ## Workflow Status (per collection)
14121
14132
  - **tensions:** open \u2192 processing \u2192 decided \u2192 closed
@@ -14911,4 +14922,4 @@ export {
14911
14922
  createProductBrainServer,
14912
14923
  initFeatureFlags
14913
14924
  };
14914
- //# sourceMappingURL=chunk-LKAOXJNJ.js.map
14925
+ //# sourceMappingURL=chunk-WRYAYGPR.js.map