@productbrain/mcp 0.0.1-beta.2902 → 0.0.1-beta.2949

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.
@@ -828,9 +828,7 @@ var AUTO_LINK_CONFIDENCE_THRESHOLD = 35;
828
828
  var MAX_AUTO_LINKS = 5;
829
829
  var MAX_SUGGESTIONS = 5;
830
830
  var BR_STD_ENTRY_ID_REGEX = /^(BR|STD)-\d+$/;
831
- var entryIdSchema = z2.string().regex(BR_STD_ENTRY_ID_REGEX).optional().describe(
832
- "Only for business-rules and standards. Must match BR-NNN or STD-NNN. Omit for all other collections \u2014 IDs are auto-generated."
833
- );
831
+ var entryIdSchema = z2.string().regex(BR_STD_ENTRY_ID_REGEX).optional().describe("Only for business-rules and standards. Must match BR-NNN or STD-NNN. Omit for all other collections \u2014 IDs are auto-generated.");
834
832
  var captureSchema = z2.object({
835
833
  collection: z2.string().optional().describe("Collection slug, e.g. 'tensions', 'business-rules', 'glossary', 'decisions'. Optional \u2014 classifier auto-routes when omitted."),
836
834
  name: z2.string().describe("Display name \u2014 be specific (e.g. 'Convex adjacency list won't scale for graph traversal')"),
@@ -843,21 +841,18 @@ var captureSchema = z2.object({
843
841
  to: z2.string().describe("Target entry ID (e.g. '<PREFIX>-<n>')"),
844
842
  type: z2.string().describe("Relation type (e.g. 'governs', 'related_to', 'informs')")
845
843
  })).optional().describe("Relations to create after capture. Skips auto-link discovery when provided."),
846
- autoCommit: z2.boolean().optional().describe(
847
- "If true, commits the entry immediately after capture + linking. If omitted, Open mode workspaces auto-commit by default and consensus/role modes stay draft-first."
848
- ),
844
+ autoCommit: z2.boolean().optional().describe("If true, commits the entry immediately after capture + linking. If omitted, Open mode workspaces auto-commit by default and consensus/role modes stay draft-first."),
849
845
  sourceRef: z2.string().optional().describe("URI or path of the source document backing this entry (e.g. 'meeting-2026-03-28.md', 'import://batch-5'). Stored as top-level entry field, not in data."),
850
846
  sourceExcerpt: z2.string().optional().describe("Verbatim excerpt from the source that backs this entry's claims. Stored as top-level entry field, not in data."),
851
847
  // WP-316 S3: Preview gate — dry-run mode. Returns what would happen, no DB writes.
852
848
  preview: z2.boolean().optional().describe("If true, validates the capture without writing. Returns what would happen. Default false."),
853
849
  // WP-318 S2: Pre-write grounding — run link suggestion before creating entry.
854
- suggestOnly: z2.boolean().optional().describe(
855
- "If true, runs pre-write grounding (suggestLinksForCapture) and returns a groundingReport WITHOUT creating any entry. Use to preview graph participation before accepting. Default false."
856
- ),
850
+ suggestOnly: z2.boolean().optional().describe("If true, runs pre-write grounding (suggestLinksForCapture) and returns a groundingReport WITHOUT creating any entry. Use to preview graph participation before accepting. Default false."),
857
851
  // WP-318 S2: Format for groundingReport in response.
858
- format: z2.enum(["agent", "human"]).optional().describe(
859
- "Response format for grounding data. 'agent' (default): full JSON groundingReport. 'human': compressed summary string appended to the capture summary."
860
- )
852
+ format: z2.enum(["agent", "human"]).optional().describe("Response format for grounding data. 'agent' (default): full JSON groundingReport. 'human': compressed summary string appended to the capture summary."),
853
+ // WP-513: team+role to create AS OWNER of (rung 2 only); no-op pre-rung-2.
854
+ ownerTeamEntryId: z2.string().max(200).optional().describe("Owning team entry ID/ref (rung 2)."),
855
+ ownerRoleEntryId: z2.string().max(200).optional().describe("Owning role entry ID/ref (rung 2).")
861
856
  });
862
857
  var batchCaptureRelationSchema = z2.object({
863
858
  to: z2.string().max(200).describe("Target entry ID already on the Chain, e.g. '<PREFIX>-<n>'."),
@@ -875,9 +870,10 @@ var batchCaptureSchema = z2.object({
875
870
  sourceRef: z2.string().max(2e3).optional().describe("URI or path of the source document backing this entry (e.g. 'meeting-2026-03-28.md', 'import://batch-5'). Stored as top-level entry field, not in data."),
876
871
  sourceExcerpt: z2.string().max(5e3).optional().describe("Verbatim excerpt from the source that backs this entry's claims. Stored as top-level entry field, not in data."),
877
872
  // TEN-957 (WP-484 S2): relations to create right after this entry is captured.
878
- relations: z2.array(batchCaptureRelationSchema).max(10).optional().describe(
879
- "Relations to create right after this entry is captured \u2014 each {to, type} links the NEW entry to an existing Chain entry."
880
- )
873
+ relations: z2.array(batchCaptureRelationSchema).max(10).optional().describe("Relations to create right after this entry is captured \u2014 each {to, type} links the NEW entry to an existing Chain entry."),
874
+ // WP-513: team+role to create THIS entry AS OWNER of (rung 2 only).
875
+ ownerTeamEntryId: z2.string().max(200).optional().describe("Owning team entry ID/ref (rung 2)."),
876
+ ownerRoleEntryId: z2.string().max(200).optional().describe("Owning role entry ID/ref (rung 2).")
881
877
  })).min(1).max(50).describe("Array of entries to capture"),
882
878
  autoCommit: z2.boolean().optional().describe(
883
879
  "If true, commits created entries immediately after linking. If omitted, Open mode workspaces commit by default and consensus/role modes stay draft-first."
@@ -1304,9 +1300,7 @@ function canonicalizeSelects(data, fields, isBet) {
1304
1300
  var CAPTURE_ACTIONS = ["capture", "batch"];
1305
1301
  var captureItemSchema = batchCaptureSchema.shape.entries.element;
1306
1302
  var captureCompoundSchema = z2.object({
1307
- action: z2.enum(CAPTURE_ACTIONS).optional().default("capture").describe(
1308
- "'capture': create a single knowledge entry (the original capture behavior). 'batch': create multiple entries in one call via `items[]` (absorbs batch-capture; each item may carry inline `relations`)."
1309
- ),
1303
+ action: z2.enum(CAPTURE_ACTIONS).optional().default("capture").describe("'capture': create a single knowledge entry (the original capture behavior). 'batch': create multiple entries in one call via `items[]` (absorbs batch-capture; each item may carry inline `relations`)."),
1310
1304
  // For 'capture' — mirrors captureSchema, relaxed to optional (batch omits these).
1311
1305
  collection: z2.string().max(200).optional().describe("For 'capture': collection slug, e.g. 'tensions', 'business-rules', 'glossary', 'decisions'. Optional \u2014 classifier auto-routes when omitted."),
1312
1306
  name: z2.string().max(500).optional().describe("For 'capture': display name \u2014 required for this action."),
@@ -1326,7 +1320,10 @@ var captureCompoundSchema = z2.object({
1326
1320
  suggestOnly: z2.boolean().optional().describe("For 'capture': if true, runs pre-write grounding and returns a groundingReport WITHOUT creating any entry."),
1327
1321
  format: z2.enum(["agent", "human"]).optional().describe("For 'capture': response format for grounding data."),
1328
1322
  // For 'batch' — mirrors batchCaptureSchema's `entries`, renamed `items` per §3.
1329
- items: z2.array(captureItemSchema).min(1).max(50).optional().describe("For 'batch': array of entries to capture, each may carry inline `relations`.")
1323
+ items: z2.array(captureItemSchema).min(1).max(50).optional().describe("For 'batch': array of entries to capture, each may carry inline `relations`."),
1324
+ // WP-513: team+role to create AS OWNER of (rung 2 only).
1325
+ ownerTeamEntryId: z2.string().max(200).optional().describe("For 'capture': owning team (rung-2)."),
1326
+ ownerRoleEntryId: z2.string().max(200).optional().describe("For 'capture': owning role (rung-2).")
1330
1327
  });
1331
1328
  var captureSingleVariant = captureSchema.extend({ action: z2.literal("capture") });
1332
1329
  var captureBatchVariant = z2.object({
@@ -1370,7 +1367,7 @@ function registerSmartCaptureTools(server) {
1370
1367
  })
1371
1368
  );
1372
1369
  }
1373
- async function handleCapture(server, { collection, name, description, context, entryId, canonicalKey, data: userData, links, autoCommit, sourceRef, sourceExcerpt, preview, suggestOnly, format }) {
1370
+ async function handleCapture(server, { collection, name, description, context, entryId, canonicalKey, data: userData, links, autoCommit, sourceRef, sourceExcerpt, preview, suggestOnly, format, ownerTeamEntryId, ownerRoleEntryId }) {
1374
1371
  requireWriteAccess();
1375
1372
  const timingStart = Date.now();
1376
1373
  const wsCtx = await getWorkspaceContext();
@@ -1596,6 +1593,9 @@ ${groundingReport.governance.map((g) => `- **${g.entryId}** ${g.name} [${g.colle
1596
1593
  ...sourceRef ? { sourceRef } : {},
1597
1594
  ...sourceExcerpt ? { sourceExcerpt } : {},
1598
1595
  ...preview ? { preview: true } : {},
1596
+ // WP-513 review round 3 (P1): rung-2 owner — no-op pre-rung-2.
1597
+ ...ownerTeamEntryId ? { ownerTeamEntryId } : {},
1598
+ ...ownerRoleEntryId ? { ownerRoleEntryId } : {},
1599
1599
  // WP-475 E1 (Codex P2 — CLI parity): user links are known UPFRONT, so the
1600
1600
  // post-relations re-evaluation below owns the single LLM run — defer the
1601
1601
  // create-time LLM schedule (deterministic, mirrors `pb capture --link`).
@@ -2498,7 +2498,10 @@ async function handleBatchCapture(server, { entries, autoCommit, preview }) {
2498
2498
  originDetailOverride: "mcp-batch-capture",
2499
2499
  ...entry.sourceRef ? { sourceRef: entry.sourceRef } : {},
2500
2500
  ...entry.sourceExcerpt ? { sourceExcerpt: entry.sourceExcerpt } : {},
2501
- ...preview ? { preview: true } : {}
2501
+ ...preview ? { preview: true } : {},
2502
+ // WP-513 review round 3 (P1): rung-2 owner — no-op pre-rung-2.
2503
+ ...entry.ownerTeamEntryId ? { ownerTeamEntryId: entry.ownerTeamEntryId } : {},
2504
+ ...entry.ownerRoleEntryId ? { ownerRoleEntryId: entry.ownerRoleEntryId } : {}
2502
2505
  });
2503
2506
  const internalId = result2.docId;
2504
2507
  const finalEntryId = result2.entryId;
@@ -10329,15 +10332,16 @@ var workflowsSchema = z17.object({
10329
10332
  workflowId: z17.string().max(200).optional().describe("Workflow ID for start, checkpoint, or get-run, e.g. 'retro', 'implementation-review'"),
10330
10333
  runId: z17.string().max(200).optional().describe("Workflow run ID: for get-run, which run to load; for checkpoint, target this run (avoids session drift \u2014 pass runId from get-run)."),
10331
10334
  roundId: z17.string().max(200).optional().describe("Round ID for checkpoint, e.g. 'what-went-well'"),
10332
- output: z17.union([z17.string(), workflowRunOutputInputSchema]).optional().describe(
10333
- "The round's output \u2014 either legacy synthesized text or a typed workflow run payload."
10334
- ),
10335
+ output: z17.union([z17.string(), workflowRunOutputInputSchema]).optional().describe("The round's output \u2014 either legacy synthesized text or a typed workflow run payload."),
10335
10336
  isFinal: z17.boolean().optional().describe("If true, finalize an existing durable workflow run from its terminal round and create the summary chain entry."),
10336
10337
  restart: z17.boolean().optional().describe("If true, start a new durable run from the workflow's first round in the current session."),
10337
10338
  summaryName: z17.string().max(500).optional().describe("Optional name for final chain entry. If omitted, the workflow summary template is used."),
10338
10339
  summaryDescription: z17.string().max(2e4).optional().describe("Optional override for the final chain entry description. Defaults to the final round output text."),
10339
10340
  summaryEntryId: z17.string().max(200).optional().describe("Link an existing entry as the run's summary instead of creating one. Used by facilitated workflows (e.g. shape) where the primary record is created by the specialized tool."),
10340
- entryId: z17.string().max(200).optional().describe("For 'load-skill': workspace-scoped skill entry id (e.g. 'SKILL-pb-setup'). Refuses non-skill entries (canonicalKey !== 'skill') with INVALID_KIND.")
10341
+ entryId: z17.string().max(200).optional().describe("For 'load-skill': workspace-scoped skill entry id (e.g. 'SKILL-pb-setup'). Refuses non-skill entries (canonicalKey !== 'skill') with INVALID_KIND."),
10342
+ // WP-513: team+role to create the finalize summary AS OWNER of (rung 2 only).
10343
+ ownerTeamEntryId: z17.string().max(200).optional().describe("For 'checkpoint' (isFinal): owning team (rung-2)."),
10344
+ ownerRoleEntryId: z17.string().max(200).optional().describe("For 'checkpoint' (isFinal): owning role (rung-2).")
10341
10345
  });
10342
10346
  var workflowsListVariant = z17.object({ action: z17.literal("list") });
10343
10347
  var workflowsGetRunVariant = z17.object({
@@ -10356,7 +10360,9 @@ var workflowsCheckpointVariant = z17.object({
10356
10360
  summaryName: z17.string().max(500).optional(),
10357
10361
  summaryDescription: z17.string().max(2e4).optional(),
10358
10362
  summaryEntryId: z17.string().max(200).optional(),
10359
- runId: z17.string().max(200).optional()
10363
+ runId: z17.string().max(200).optional(),
10364
+ ownerTeamEntryId: z17.string().max(200).optional(),
10365
+ ownerRoleEntryId: z17.string().max(200).optional()
10360
10366
  });
10361
10367
  var workflowsLoadSkillVariant = z17.object({ action: z17.literal("load-skill"), entryId: z17.string().max(200).min(1) });
10362
10368
  var workflowsActionUnion = z17.discriminatedUnion("action", [
@@ -10370,7 +10376,7 @@ var WORKFLOWS_ACTION_SPECS = {
10370
10376
  list: { params: [], description: "Browse available workflows; no params." },
10371
10377
  "get-run": { params: ["runId", "workflowId"], description: "runId or workflowId is required." },
10372
10378
  start: { params: ["workflowId"], description: "workflowId is required." },
10373
- checkpoint: { params: ["workflowId", "roundId", "output", "isFinal", "restart", "summaryName", "summaryDescription", "summaryEntryId", "runId"], description: "workflowId, roundId, and output are required." },
10379
+ checkpoint: { params: ["workflowId", "roundId", "output", "isFinal", "restart", "summaryName", "summaryDescription", "summaryEntryId", "runId", "ownerTeamEntryId", "ownerRoleEntryId"], description: "workflowId, roundId, and output are required." },
10374
10380
  "load-skill": { params: ["entryId"], description: "entryId is required." }
10375
10381
  };
10376
10382
  function formatWorkflowCard(wf) {
@@ -10448,7 +10454,9 @@ function registerWorkflowTools(server) {
10448
10454
  data.summaryName,
10449
10455
  data.summaryDescription,
10450
10456
  data.summaryEntryId,
10451
- data.runId
10457
+ data.runId,
10458
+ data.ownerTeamEntryId,
10459
+ data.ownerRoleEntryId
10452
10460
  ),
10453
10461
  "load-skill": async (data) => {
10454
10462
  const result2 = await loadSkillBody(data.entryId);
@@ -10670,7 +10678,7 @@ async function handleGetRun(runId, workflowId) {
10670
10678
  )
10671
10679
  };
10672
10680
  }
10673
- async function handleCheckpoint(workflowId, roundId, output, isFinal, restart, summaryName, summaryDescription, summaryEntryId, runId) {
10681
+ async function handleCheckpoint(workflowId, roundId, output, isFinal, restart, summaryName, summaryDescription, summaryEntryId, runId, ownerTeamEntryId, ownerRoleEntryId) {
10674
10682
  const wf = getWorkflow(workflowId);
10675
10683
  if (!wf) {
10676
10684
  return {
@@ -10834,7 +10842,10 @@ This checkpoint was NOT saved. The conversation context is preserved \u2014 cont
10834
10842
  },
10835
10843
  summaryDescription,
10836
10844
  summaryName,
10837
- resolvedCollectionSlug
10845
+ resolvedCollectionSlug,
10846
+ // WP-513 review round 3 (P1): rung-2 owner — no-op pre-rung-2.
10847
+ ...ownerTeamEntryId ? { ownerTeamEntryId } : {},
10848
+ ...ownerRoleEntryId ? { ownerRoleEntryId } : {}
10838
10849
  });
10839
10850
  lines.push(
10840
10851
  result2.summary.created ? `**Draft Created**: \`${result2.summary.entryId}\`` : `**Draft Already Exists**: \`${result2.summary.entryId}\``,
@@ -12587,7 +12598,10 @@ var chainSchema = z23.object({
12587
12598
  linkId: z23.string().max(200).optional().describe("Link to edit (for edit action): problem, insight, choice, action, outcome"),
12588
12599
  content: z23.string().max(5e4).optional().describe("New content for the link (for edit action)"),
12589
12600
  status: z23.string().max(200).optional().describe("Filter by status for list: 'draft' or 'active'"),
12590
- author: z23.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
12601
+ author: z23.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'."),
12602
+ // WP-513 review round 3 (P1): team+role to create AS OWNER of (rung 2 only) — entry ID or entryId (e.g. "TEAM-1").
12603
+ ownerTeamEntryId: z23.string().max(200).optional().describe("For 'create': owning team (rung-2 workspaces)."),
12604
+ ownerRoleEntryId: z23.string().max(200).optional().describe("For 'create': owning role (rung-2 workspaces).")
12591
12605
  });
12592
12606
  var chainVersionSchema = z23.object({
12593
12607
  action: z23.enum(["commit", "list", "diff", "revert", "history"]).describe("Action: commit a snapshot, list commits, diff two versions, revert to a version, or view history"),
@@ -12628,14 +12642,14 @@ function linkSummary(links) {
12628
12642
  return ` - **${id}**: ${preview}`;
12629
12643
  }).join("\n");
12630
12644
  }
12631
- async function handleChainCrud({ action, chainEntryId, title, chainTypeId, description, linkId, content, status: status2, author }) {
12645
+ async function handleChainCrud({ action, chainEntryId, title, chainTypeId, description, linkId, content, status: status2, author, ownerTeamEntryId, ownerRoleEntryId }) {
12632
12646
  if (action === "create") {
12633
12647
  if (!title) {
12634
12648
  return validationResult("A `title` is required to create a process.");
12635
12649
  }
12636
12650
  const result2 = await kernelMutation(
12637
12651
  "gitchain.createChain",
12638
- { title, chainTypeId, description, author }
12652
+ { title, chainTypeId, description, author, ownerTeamEntryId, ownerRoleEntryId }
12639
12653
  );
12640
12654
  return {
12641
12655
  content: [{
@@ -13139,7 +13153,10 @@ var chainCompoundSchema = z23.object({
13139
13153
  commitMessage: z23.string().max(2e3).optional().describe("For 'version.commit': commit message (required)."),
13140
13154
  versionA: z23.number().optional().describe("For 'version.diff': earlier version (required)."),
13141
13155
  versionB: z23.number().optional().describe("For 'version.diff': later version (required)."),
13142
- toVersion: z23.number().optional().describe("For 'version.revert': version number to revert to (required).")
13156
+ toVersion: z23.number().optional().describe("For 'version.revert': version number to revert to (required)."),
13157
+ // WP-513 review round 3 (P1): team+role to create AS OWNER of (rung 2 only).
13158
+ ownerTeamEntryId: z23.string().max(200).optional().describe("For 'create': owning team (rung-2 workspaces)."),
13159
+ ownerRoleEntryId: z23.string().max(200).optional().describe("For 'create': owning role (rung-2 workspaces).")
13143
13160
  });
13144
13161
  var chainReviewCompoundSchema = z23.object({
13145
13162
  action: z23.enum(CHAIN_REVIEW_ACTIONS).describe(
@@ -13203,7 +13220,7 @@ var chainReviewActionUnion = z23.discriminatedUnion("action", [
13203
13220
  chainBranchConflictsVariant
13204
13221
  ]);
13205
13222
  var CHAIN_ACTION_SPECS = {
13206
- create: { params: ["title", "chainTypeId", "description", "author"], description: "title is required." },
13223
+ create: { params: ["title", "chainTypeId", "description", "author", "ownerTeamEntryId", "ownerRoleEntryId"], description: "title is required." },
13207
13224
  get: { params: ["chainEntryId"], description: "chainEntryId is required." },
13208
13225
  list: { params: ["chainTypeId", "status"], description: "All params optional." },
13209
13226
  edit: { params: ["chainEntryId", "linkId", "content", "author"], description: "chainEntryId, linkId, and content are required." },
@@ -13286,7 +13303,10 @@ function registerGitChainTools(server) {
13286
13303
  // src/tools/maps.ts
13287
13304
  import { z as z24 } from "zod/v3";
13288
13305
  var createAudienceMapSetSchema = z24.object({
13289
- audienceEntryId: z24.string().max(200).describe("Entry ID of the audience (e.g. STR-fb7hje)")
13306
+ audienceEntryId: z24.string().max(200).describe("Entry ID of the audience (e.g. STR-fb7hje)"),
13307
+ // WP-513: team+role to create AS OWNER of (rung 2); ID or entryId (e.g. "TEAM-1"); no-op pre-rung-2.
13308
+ ownerTeamEntryId: z24.string().max(200).optional().describe("Team entry ID/ref to own the created maps (required once the workspace is on rung 2)"),
13309
+ ownerRoleEntryId: z24.string().max(200).optional().describe("Role entry ID/ref to own the created maps (required once the workspace is on rung 2)")
13290
13310
  });
13291
13311
  var mapSchema = z24.object({
13292
13312
  action: z24.enum(["create", "get", "list"]).describe("Action: create a map, get map details, or list all maps"),
@@ -13295,7 +13315,10 @@ var mapSchema = z24.object({
13295
13315
  templateId: z24.string().max(200).optional().default("lean-canvas").describe("Template slug for create: 'lean-canvas' or any composed template"),
13296
13316
  description: z24.string().max(2e4).optional().describe("Description (for create)"),
13297
13317
  slotIds: z24.array(z24.string().max(200)).max(200).optional().describe("Slot IDs to initialize (for create; auto-populated from template if omitted)"),
13298
- status: z24.string().max(200).optional().describe("Filter by status for list")
13318
+ status: z24.string().max(200).optional().describe("Filter by status for list"),
13319
+ // WP-513: team+role to create AS OWNER of (rung 2, action "create" only); no-op pre-rung-2.
13320
+ ownerTeamEntryId: z24.string().max(200).optional().describe("Team entry ID/ref to own the created map (required once the workspace is on rung 2)"),
13321
+ ownerRoleEntryId: z24.string().max(200).optional().describe("Role entry ID/ref to own the created map (required once the workspace is on rung 2)")
13299
13322
  });
13300
13323
  var mapSlotSchema = z24.object({
13301
13324
  action: z24.enum(["add", "remove", "replace", "list"]).describe("Action: add/remove/replace an ingredient in a slot, or list slot contents"),
@@ -13329,10 +13352,10 @@ function slotSummary(slots) {
13329
13352
  return ` - **${id}**: ${items}`;
13330
13353
  }).join("\n");
13331
13354
  }
13332
- async function handleCreateAudienceMapSet({ audienceEntryId }) {
13355
+ async function handleCreateAudienceMapSet({ audienceEntryId, ownerTeamEntryId, ownerRoleEntryId }) {
13333
13356
  const result2 = await kernelMutation(
13334
13357
  "maps.createAudienceMapSet",
13335
- { audienceEntryId }
13358
+ { audienceEntryId, ownerTeamEntryId, ownerRoleEntryId }
13336
13359
  );
13337
13360
  const wsCtx = await getWorkspaceContext();
13338
13361
  const lines = result2.maps.map(
@@ -13365,14 +13388,14 @@ Use map action=slot.add to add ingredients. View at /empathy, /narrowing, and /j
13365
13388
  )
13366
13389
  };
13367
13390
  }
13368
- async function handleMapCrud({ action, mapEntryId, title, templateId, description, slotIds, status: status2 }) {
13391
+ async function handleMapCrud({ action, mapEntryId, title, templateId, description, slotIds, status: status2, ownerTeamEntryId, ownerRoleEntryId }) {
13369
13392
  if (action === "create") {
13370
13393
  if (!title) {
13371
13394
  return validationResult("A `title` is required to create a map.");
13372
13395
  }
13373
13396
  const result2 = await kernelMutation(
13374
13397
  "maps.createMap",
13375
- { title, templateId, description, slotIds }
13398
+ { title, templateId, description, slotIds, ownerTeamEntryId, ownerRoleEntryId }
13376
13399
  );
13377
13400
  const wsCtx = await getWorkspaceContext();
13378
13401
  return {
@@ -13712,7 +13735,10 @@ var mapCompoundSchema = z24.object({
13712
13735
  author: z24.string().max(200).optional().describe("Who is performing the action."),
13713
13736
  commitMessage: z24.string().max(2e3).optional().describe("For 'version.commit': commit message."),
13714
13737
  query: z24.string().max(500).optional().describe("For 'suggest': search query to narrow ingredient suggestions."),
13715
- audienceEntryId: z24.string().max(200).optional().describe("For 'create-audience-set': audience entry ID (required).")
13738
+ audienceEntryId: z24.string().max(200).optional().describe("For 'create-audience-set': audience entry ID (required)."),
13739
+ // WP-513 review round 3 (P1): without these here, zod strips them before mapActionUnion ever sees them.
13740
+ ownerTeamEntryId: z24.string().max(200).optional().describe("For 'create'/'create-audience-set': owning team (rung-2 workspaces)."),
13741
+ ownerRoleEntryId: z24.string().max(200).optional().describe("For 'create'/'create-audience-set': owning role (rung-2 workspaces).")
13716
13742
  });
13717
13743
  var mapCreateVariant = mapSchema.omit({ action: true }).extend({ action: z24.literal("create") });
13718
13744
  var mapGetVariant = z24.object({ action: z24.literal("get"), mapEntryId: z24.string().max(200) });
@@ -13743,7 +13769,7 @@ var mapActionUnion = z24.discriminatedUnion("action", [
13743
13769
  mapCreateAudienceSetVariant
13744
13770
  ]);
13745
13771
  var MAP_ACTION_SPECS = {
13746
- create: { params: ["title", "templateId", "description", "slotIds"], description: "title is required." },
13772
+ create: { params: ["title", "templateId", "description", "slotIds", "ownerTeamEntryId", "ownerRoleEntryId"], description: "title is required." },
13747
13773
  get: { params: ["mapEntryId"], description: "mapEntryId is required." },
13748
13774
  list: { params: ["templateId", "status"], description: "All params optional." },
13749
13775
  "slot.add": { params: ["mapEntryId", "slotId", "ingredientEntryId", "label", "author"], description: "mapEntryId, slotId, and ingredientEntryId are required." },
@@ -13754,7 +13780,7 @@ var MAP_ACTION_SPECS = {
13754
13780
  "version.list": { params: ["mapEntryId"], description: "mapEntryId is required." },
13755
13781
  "version.history": { params: ["mapEntryId"], description: "mapEntryId is required." },
13756
13782
  suggest: { params: ["mapEntryId", "slotId", "query"], description: "mapEntryId is required." },
13757
- "create-audience-set": { params: ["audienceEntryId"], description: "audienceEntryId is required." }
13783
+ "create-audience-set": { params: ["audienceEntryId", "ownerTeamEntryId", "ownerRoleEntryId"], description: "audienceEntryId is required." }
13758
13784
  };
13759
13785
  function registerMapTools(server) {
13760
13786
  const mapHandlers = {
@@ -15608,4 +15634,4 @@ export {
15608
15634
  createProductBrainServer,
15609
15635
  initFeatureFlags
15610
15636
  };
15611
- //# sourceMappingURL=chunk-O4XY2W5W.js.map
15637
+ //# sourceMappingURL=chunk-WXBZFMDB.js.map