@productbrain/mcp 0.0.1-beta.15203 → 0.0.1-beta.15211

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.
@@ -9,6 +9,7 @@ import {
9
9
  QUESTION_LINE_WORDS,
10
10
  QUESTION_SEAT_WORDS,
11
11
  QUESTION_TEAM_NEXT,
12
+ RIGHT_VERB_WORDS,
12
13
  SPINE_RUNG_SEQUENCE,
13
14
  START_DOORS,
14
15
  START_NOTES_NOT_LOADED_LINE,
@@ -56,7 +57,7 @@ import {
56
57
  startAgentSession,
57
58
  startTimingLine,
58
59
  withAcceptPrompt
59
- } from "./chunk-6V5ZOAJH.js";
60
+ } from "./chunk-MPNHOXHU.js";
60
61
 
61
62
  // src/server.ts
62
63
  import { McpServer as McpServer2 } from "@modelcontextprotocol/server";
@@ -4339,7 +4340,7 @@ function formatSeatRoster(roster, clean, readOne) {
4339
4340
  }
4340
4341
 
4341
4342
  // src/tools/role.ts
4342
- var ROLE_ACTIONS = ["seat", "unseat", "release_move", "accept_move", "refuse_move", "move_work"];
4343
+ var ROLE_ACTIONS = ["seat", "unseat", "release_move", "accept_move", "refuse_move", "move_work", "give_right", "withdraw_right"];
4343
4344
  var ROLE_READS_MOVED = {
4344
4345
  accountable: "role only writes. Read what a role owns and who holds it with the read-only context tool: context action=accountable roleId=..."
4345
4346
  };
@@ -4355,7 +4356,7 @@ var roleSchema = z18.object({
4355
4356
  "'seat': the name of a person who has no login yet; a placeholder person is created once and reused for the same exact name. Refused when the name belongs to someone with an account."
4356
4357
  ),
4357
4358
  teamId: z18.string().max(200).optional().describe(
4358
- "'seat' / 'unseat': the team, by chain id or entry id. Only needed for Team Lead, which lives in every team; any other role is seated in its home team. 'release_move': the team it moves to."
4359
+ `'seat' / 'unseat': the team, by chain id or entry id. Only needed for Team Lead, which lives in every team; any other role is seated in its home team. 'release_move': the team it moves to. 'give_right' / 'withdraw_right': ${RIGHT_VERB_WORDS.withdrawTeam}.`
4359
4360
  ),
4360
4361
  onMyAuthority: z18.boolean().optional().describe(
4361
4362
  "'seat', Team Lead only: as the team's Team Lead, seat a second Team Lead who holds the seat on your authority until you unseat them."
@@ -4393,13 +4394,17 @@ var moveWorkVariant = z18.object({
4393
4394
  dryRun: z18.boolean().optional(),
4394
4395
  page: z18.number().int().min(1).optional()
4395
4396
  });
4397
+ var giveRightVariant = z18.object({ action: z18.literal("give_right"), roleId: z18.string().max(200), teamId: z18.string().max(200) });
4398
+ var withdrawRightVariant = z18.object({ action: z18.literal("withdraw_right"), teamId: z18.string().max(200) });
4396
4399
  var roleActionUnion = z18.discriminatedUnion("action", [
4397
4400
  seatVariant,
4398
4401
  unseatVariant,
4399
4402
  releaseMoveVariant,
4400
4403
  acceptMoveVariant,
4401
4404
  refuseMoveVariant,
4402
- moveWorkVariant
4405
+ moveWorkVariant,
4406
+ giveRightVariant,
4407
+ withdrawRightVariant
4403
4408
  ]);
4404
4409
  var ROLE_ACTION_SPECS = {
4405
4410
  seat: {
@@ -4410,7 +4415,9 @@ var ROLE_ACTION_SPECS = {
4410
4415
  release_move: { params: ["childId", "teamId"], description: "childId and teamId (the team it moves to) are required." },
4411
4416
  accept_move: { params: ["childId"], description: "childId is required." },
4412
4417
  refuse_move: { params: ["childId", "why"], description: "childId and why are required." },
4413
- move_work: { params: ["fromRoleId", "toRoleId", "dryRun", "page"], description: "fromRoleId is required; toRoleId, dryRun and page are optional." }
4418
+ move_work: { params: ["fromRoleId", "toRoleId", "dryRun", "page"], description: "fromRoleId is required; toRoleId, dryRun and page are optional." },
4419
+ give_right: { params: ["roleId", "teamId"], description: "roleId and teamId are required." },
4420
+ withdraw_right: { params: ["teamId"], description: "teamId is required." }
4414
4421
  };
4415
4422
  function formatHeld(result2) {
4416
4423
  return [
@@ -4538,6 +4545,26 @@ async function handleMoveWork(params) {
4538
4545
  return roleErrorResult(err, "move_work", params);
4539
4546
  }
4540
4547
  }
4548
+ function callRight(action, params, sessionId) {
4549
+ if (action === "give_right") return kernelMutation("organisation.right.give", { roleRef: params.roleId, teamRef: params.teamId, sessionId });
4550
+ return kernelMutation("organisation.right.withdraw", { teamRef: params.teamId, sessionId });
4551
+ }
4552
+ async function handleRight(action, params) {
4553
+ try {
4554
+ requireWriteAccess();
4555
+ const raw = await callRight(action, params, getAgentSessionId());
4556
+ if (raw.outcome === "refused") {
4557
+ const refused = returnedRefusal(raw.refusal, null, sanitizeSingleLineField);
4558
+ const code = ORGANISATION_VALIDATION_REFUSALS.has(raw.refusal.code) ? "VALIDATION_ERROR" : "PERMISSION_DENIED";
4559
+ return failureResult(errorText(refused), code, refused.message, refused.recovery, void 0, raw);
4560
+ }
4561
+ const message = sanitizeSingleLineField(raw.line);
4562
+ return successResult(message, message, raw);
4563
+ } catch (err) {
4564
+ const { code, message, recovery, availableActions } = classifyError(err);
4565
+ return failureResult(errorText({ message, recovery }), code, message, recovery, availableActions);
4566
+ }
4567
+ }
4541
4568
  function roleErrorResult(err, action, params = {}) {
4542
4569
  const classified = classifyError(err);
4543
4570
  const definedParams = Object.fromEntries(Object.entries(params).filter(([, v]) => v !== void 0));
@@ -4559,13 +4586,23 @@ function registerRoleTools(server) {
4559
4586
  release_move: (data) => handleMove("release_move", data),
4560
4587
  accept_move: (data) => handleMove("accept_move", data),
4561
4588
  refuse_move: (data) => handleMove("refuse_move", data),
4562
- move_work: (data) => handleMoveWork(data)
4589
+ move_work: (data) => handleMoveWork(data),
4590
+ give_right: (data) => handleRight("give_right", data),
4591
+ withdraw_right: (data) => handleRight("withdraw_right", data)
4563
4592
  };
4564
4593
  server.registerTool(
4565
4594
  "role",
4566
4595
  {
4567
4596
  title: "Role",
4568
- description: "Workspace roles \u2014 who holds a role, where it sits and what it owns. Six actions:\n\n- **seat**: put a person in this role, by person id or email, or by `newPersonName` for someone with no login yet (a placeholder person, created once per exact name). The role's home team is used; name `teamId` only for Team Lead. A held role refuses a second holder and names the holder; the person keeps their other roles in the team. Needs the team's Team Lead. With `replace`, the lead above replaces a team's Team Lead in one write. The lead directly above a team also decides who leads it. With `onMyAuthority`, the team's Team Lead seats a second Team Lead on their own authority; unseating them revokes it.\n- **unseat**: take this role from a person; their other roles in the team stay. The last active Team Lead of a team is refused. Invite a person, or take them out of a team, with the `people` tool.\n- **release_move** / **accept_move** / **refuse_move**: move a role or team (`childId`) to a team whose Team Lead is another seat. Acting as Team Lead of its current team, release it toward `teamId`; acting as Team Lead of that team, accept it, or refuse it with `why` (it stays, and a tension goes to its current team's Team Lead).\n- **move_work**: move every open item `fromRoleId` owns (drafts, current entries, open questions) to `toRoleId`, each checked as a one-entry ownership change; an item the receiver may not own goes to the nearest Team Lead of the old role's home team, and past items stay as history. Each call moves a capped number and says how many remain; call again to finish. `dryRun` lists the open items (name, kind, status, summary), 200 a page with how many of how many are listed, decides no destination and changes nothing; pass `page` for the next.\n\nRead what a role owns with `context action=accountable`.",
4597
+ description: `Workspace roles \u2014 who holds a role, where it sits and what it owns. Eight actions:
4598
+
4599
+ - **seat**: put a person in this role, by person id or email, or by \`newPersonName\` for someone with no login yet (a placeholder person, created once per exact name). The role's home team is used; name \`teamId\` only for Team Lead. A held role refuses a second holder and names the holder; the person keeps their other roles in the team. Needs the team's Team Lead. With \`replace\`, the lead above replaces a team's Team Lead in one write. The lead directly above a team also decides who leads it. With \`onMyAuthority\`, the team's Team Lead seats a second Team Lead on their own authority; unseating them revokes it.
4600
+ - **unseat**: take this role from a person; their other roles in the team stay. The last active Team Lead of a team is refused. Invite a person, or take them out of a team, with the \`people\` tool.
4601
+ - **release_move** / **accept_move** / **refuse_move**: move a role or team (\`childId\`) to a team whose Team Lead is another seat. Acting as Team Lead of its current team, release it toward \`teamId\`; acting as Team Lead of that team, accept it, or refuse it with \`why\` (it stays, and a tension goes to its current team's Team Lead).
4602
+ - **move_work**: move every open item \`fromRoleId\` owns (drafts, current entries, open questions) to \`toRoleId\`, each checked as a one-entry ownership change; an item the receiver may not own goes to the nearest Team Lead of the old role's home team, and past items stay as history. Each call moves a capped number and says how many remain; call again to finish. \`dryRun\` lists the open items (name, kind, status, summary), 200 a page with how many of how many are listed, decides no destination and changes nothing; pass \`page\` for the next.
4603
+ - **give_right** / **withdraw_right**: ${RIGHT_VERB_WORDS.group}.
4604
+
4605
+ Read what a role owns with \`context action=accountable\`.`,
4569
4606
  inputSchema: roleSchema,
4570
4607
  // The hints describe the whole tool, so they say the most it can do: unseat removes a role and can
4571
4608
  // delete a membership row (destructive), and a repeated seat still writes history and audit rows
@@ -12460,4 +12497,4 @@ export {
12460
12497
  SERVER_VERSION,
12461
12498
  createProductBrainServer
12462
12499
  };
12463
- //# sourceMappingURL=chunk-HKNA2CGK.js.map
12500
+ //# sourceMappingURL=chunk-X7LW6NEZ.js.map