@taiga-ai/mcp-server 0.26.0-rc.514 → 0.26.0-rc.517

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.
Files changed (2) hide show
  1. package/dist/index.js +207 -101
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -321,6 +321,7 @@ var TaigaClient = class {
321
321
  async listBuildRuns(productId, opts) {
322
322
  const params = new URLSearchParams();
323
323
  if (opts?.backlogItemId) params.set("backlogItemId", opts.backlogItemId);
324
+ if (opts?.status?.length) params.set("status", opts.status.join(","));
324
325
  if (opts?.limit) params.set("limit", String(opts.limit));
325
326
  if (opts?.cursor) params.set("cursor", opts.cursor);
326
327
  const qs = params.toString();
@@ -330,6 +331,7 @@ var TaigaClient = class {
330
331
  async listBuildRunActivity(opts) {
331
332
  const params = new URLSearchParams();
332
333
  if (opts?.active) params.set("active", "true");
334
+ if (opts?.status?.length) params.set("status", opts.status.join(","));
333
335
  if (opts?.limit) params.set("limit", String(opts.limit));
334
336
  if (opts?.cursor) params.set("cursor", opts.cursor);
335
337
  const qs = params.toString();
@@ -2472,7 +2474,7 @@ const DOCUMENT_INPUTS = Object.freeze({
2472
2474
  * reads as deleted) and fields they explain would simply be missing. So it
2473
2475
  * refuses to start, and says what to do.
2474
2476
  */
2475
- function apiLevelProblem(introspection, apiUrl, required = 3, version = SERVER_VERSION) {
2477
+ function apiLevelProblem(introspection, apiUrl, required = 4, version = SERVER_VERSION) {
2476
2478
  const offered = introspection.mcpApiLevel ?? 0;
2477
2479
  if (offered >= required) return null;
2478
2480
  return `The Taiga API at ${apiUrl} is older than @taiga-ai/mcp-server ${version} needs (API level ${offered}, needs ${required}). Run the version published for it, or wait for that API to be updated; an earlier release of this package works against it.`;
@@ -2686,7 +2688,7 @@ function setupNextStep(product) {
2686
2688
  if (product?.status !== "draft") return null;
2687
2689
  if (isImportedProduct(product)) switch (importStatusOf(product)) {
2688
2690
  case "analyzing":
2689
- case "generating_docs": return `The import is running and derives the documents from the code (taiga_wait_for_job follows its job). Then review them, and ${FINISH_DISCOVERY}`;
2691
+ case "generating_docs": return `The import is running and derives the documents from the code (taiga_wait (jobId) follows its job). Then review them, and ${FINISH_DISCOVERY}`;
2690
2692
  case "complete": return "The import is done: review the reality documents (taiga_get_product_document without type), then taiga_finish_discovery opens the product and starts planning its first initiatives (paid agent work: ask the person first).";
2691
2693
  case "failed":
2692
2694
  case "cancelled": return "The last import did not finish: taiga_start_import runs it again.";
@@ -2714,21 +2716,22 @@ const BY_ARGUMENT = {
2714
2716
  initiativeId: ITEM_ID_HINT,
2715
2717
  runId: "taiga_list_runs lists the runs, of one product or of every product the key can see.",
2716
2718
  planId: "taiga_get_plan gives the initiative's active plan and its ID.",
2717
- repositoryId: "taiga_list_product_repositories lists the product's repository links; a linkable repository id is not a link ID.",
2718
- replacesRepositoryId: "taiga_list_product_repositories lists the product's repository links.",
2719
+ linkId: "taiga_list_product_repositories lists the product's repository links; a linkable repository id is not a link ID.",
2720
+ replacesLinkId: "taiga_list_product_repositories lists the product's repository links.",
2719
2721
  linkableRepositoryId: "taiga_list_linkable_repositories lists the repositories the GitHub connection reaches, with their ids.",
2720
2722
  installationId: "taiga_list_linkable_repositories lists the connected GitHub accounts.",
2721
2723
  jobId: "A job ID is what the tool that started the job returned (taiga_request_initiatives, taiga_start_import).",
2722
2724
  factoryId: "taiga_list_factories lists the factories the key can see.",
2723
2725
  findingId: "taiga_list_findings lists a product's findings.",
2724
2726
  violationId: "taiga_get_policy_standing lists a product's policy violations.",
2725
- environmentId: "taiga_list_environments lists the product's environments with their IDs; a product ID is not one.",
2727
+ environmentId: "taiga_get_deployments lists the product's environments with their IDs; a product ID is not one.",
2726
2728
  knowledgeId: "taiga_list_knowledge lists the knowledge files.",
2727
2729
  productId: "taiga_list_products lists the products the key can see; a name is not an ID (taiga_get_product takes a slug)."
2728
2730
  };
2729
2731
  /** Where an argument means something else on one tool, or the tool's 404 needs its own word. */
2730
2732
  const BY_TOOL = {
2731
2733
  taiga_resolve_action: () => "taiga_list_action_required lists the items with their IDs.",
2734
+ taiga_get_sbom: () => "An SBOM exists once a sweep has inventoried that repository, where the licenses feature is enabled; taiga_list_packages (linkId) says whether it has packages, and taiga_list_product_repositories lists the links.",
2732
2735
  taiga_get_plan: (said) => /\bplan\b/i.test(said) ? "taiga_get_initiative's situation says whether one is being planned or failed, and names the call that asks for one (taiga_queue_initiative off the line, taiga_plan_again for a failed plan)." : ITEM_ID_HINT
2733
2736
  };
2734
2737
  /**
@@ -2741,8 +2744,8 @@ const MISSING_THING = {
2741
2744
  initiativeId: /backlog item|initiative/i,
2742
2745
  runId: /\b(build )?run\b/i,
2743
2746
  planId: /\bplan\b/i,
2744
- repositoryId: /repository link|\blink\b/i,
2745
- replacesRepositoryId: /repository link|\blink\b/i,
2747
+ linkId: /repository link|\blink\b|repository/i,
2748
+ replacesLinkId: /repository link|\blink\b/i,
2746
2749
  linkableRepositoryId: /github repository/i,
2747
2750
  installationId: /installation|account/i,
2748
2751
  jobId: /\bjob\b/i,
@@ -2823,6 +2826,7 @@ function ownArgumentLike(key, own) {
2823
2826
  const PRODUCT_WORDS = {
2824
2827
  backlogItemId: "initiativeId",
2825
2828
  buildRunId: "runId",
2829
+ productRepositoryId: "linkId",
2826
2830
  latestBuild: "latestRun"
2827
2831
  };
2828
2832
  /**
@@ -2865,7 +2869,7 @@ function inProductWords(value) {
2865
2869
  }
2866
2870
  /** The API's 404 sentence in the product's words: "Backlog item not found" is an initiative not found. */
2867
2871
  function inProductWording(said) {
2868
- return said.replace(/^Backlog item not found/i, "Initiative not found").replace(/^Build run step not found/i, "Run step not found").replace(/^Build run not found/i, "Run not found").replace(/^Custom document not found/i, "Knowledge file not found").replace(/^(Branch "[^"]*" does not exist in \S+?)\.?$/i, "$1. taiga_list_repository_branches lists the branches it has.").replace(/^This product already has a repository\. Change it instead of linking another\./i, "This product already has a repository. Pass replacesRepositoryId to swap it in one step, or taiga_unlink_repository first (taiga_list_product_repositories gives its ID).");
2872
+ return said.replace(/^Backlog item not found/i, "Initiative not found").replace(/^Build run step not found/i, "Run step not found").replace(/^Build run not found/i, "Run not found").replace(/^Custom document not found/i, "Knowledge file not found").replace(/^(Branch "[^"]*" does not exist in \S+?)\.?$/i, "$1. taiga_list_repository_branches lists the branches it has.").replace(/^This product already has a repository\. Change it instead of linking another\./i, "This product already has a repository. Pass replacesLinkId to swap it in one step, or taiga_unlink_repository first (taiga_list_product_repositories gives its ID).");
2869
2873
  }
2870
2874
  /**
2871
2875
  * A float without its binary noise: six significant digits. Delivery metrics
@@ -3304,7 +3308,7 @@ function nextStepFor(state) {
3304
3308
  if (state.linked === false) return "Link its repository (taiga_list_linkable_repositories, then taiga_link_repository), then taiga_start_import.";
3305
3309
  if (state.linked === null && state.importState === "not started") return setupNextStep(state.product);
3306
3310
  switch (state.importState) {
3307
- case "running": return "The import is running and derives the documents from the code; taiga_wait_for_job follows it.";
3311
+ case "running": return "The import is running and derives the documents from the code; taiga_wait (jobId) follows it.";
3308
3312
  case "failed": return "The last import did not finish: taiga_start_import runs it again.";
3309
3313
  case "complete":
3310
3314
  if (state.missing && state.missing.length > 0) return `The import finished but ${named(state.missing)} ${state.missing.length === 1 ? "is" : "are"} not published: taiga_get_product_document without type shows them, taiga_publish_product_document publishes a draft.`;
@@ -3783,7 +3787,7 @@ function registerProductTools(server, client) {
3783
3787
  }));
3784
3788
  server.registerTool("taiga_get_product", {
3785
3789
  title: "Get product",
3786
- description: "Read one product and its settings by ID, slug or git remote URL (git remote get-url origin; a URL linked to more than one product is refused with their IDs): name, factory, kind, autonomy, what Taiga builds (application, infrastructure, deployment) and network access, unsetMeans saying what a null setting follows. In setup, readiness says whether it can finish now and what is missing (repository, import, unpublished documents, unstamped checks), plus nextStep. For initiatives, runs and findings, use taiga_get_product_context.",
3790
+ description: "Read one product's settings only (for where it stands, use taiga_get_product_context), by ID, slug or git remote URL (git remote get-url origin; a URL linked to more than one product is refused with their IDs): name, factory, kind, autonomy, what Taiga builds (application, infrastructure, deployment) and network access, unsetMeans saying what a null setting follows. In setup, readiness says whether it can finish now and what is missing (repository, import, unpublished documents, unstamped checks), plus nextStep. For initiatives, runs and findings, use taiga_get_product_context.",
3787
3791
  inputSchema: z.object({
3788
3792
  productId: productId.optional(),
3789
3793
  slug: slug.optional(),
@@ -4135,7 +4139,7 @@ function registerJobTools(server, client) {
4135
4139
  if (!client.hasCapability("products:read")) return;
4136
4140
  server.registerTool("taiga_get_job", {
4137
4141
  title: "Get an agent job",
4138
- description: "Read one agent job, such as a taiga_request_initiatives request: status (pending, processing, completed, failed, cancelled), progress and any error. A finished initiative request lists the initiatives it added, or why none (already covered, not readable as work, outside the product, or not allowed by a policy, with the rule it conflicts with and how to decide otherwise). taiga_wait_for_job waits for it.",
4142
+ description: "Read one agent job, such as a taiga_request_initiatives request: status (pending, processing, completed, failed, cancelled), progress and any error. A finished initiative request lists the initiatives it added, or why none (already covered, not readable as work, outside the product, or not allowed by a policy, with the rule it conflicts with and how to decide otherwise). taiga_wait (jobId) waits for it.",
4139
4143
  inputSchema: z.object({ jobId: idInput("job", "the tool that started the job returned it") }),
4140
4144
  annotations: READ_ONLY
4141
4145
  }, (params) => runTool(async () => toolResult(jobReport((await client.getAgentJob(params.jobId)).data))));
@@ -4593,11 +4597,12 @@ function registerBuildTools(server, client) {
4593
4597
  if (!client.hasCapability("products:read")) return;
4594
4598
  server.registerTool("taiga_list_runs", {
4595
4599
  title: "List runs",
4596
- description: "List coding agent runs, newest first: status, branch, pull request, step progress, actions and outcome, one sentence saying how it stands: running, waiting for a person to review and merge, merged, failed, stopped, its pull request closed unmerged, or nobody waiting on it because its initiative ended. Without productId, every product's runs; active: true keeps running ones. taiga_get_run reads one; carry work on from the initiative (taiga_resume_initiative).",
4600
+ description: "List coding agent runs, newest first: status, branch, pull request, step progress, actions and outcome, one sentence saying how it stands: running, waiting for a person to review and merge, merged, failed, stopped, its pull request closed unmerged, or nobody waiting on it because its initiative ended. Without productId, every product's runs; active: true keeps running ones, and status narrows to some statuses (status: [\"failed\", \"stopped\"] for what failed). taiga_get_run reads one; carry work on from the initiative (taiga_resume_initiative).",
4597
4601
  inputSchema: z.object({
4598
4602
  productId: productId.optional(),
4599
4603
  initiativeId: idInput("initiative", "taiga_list_initiatives (query finds one by title) gives it").optional().describe("Only this initiative's runs -- get from taiga_list_initiatives"),
4600
4604
  active: z.boolean().optional().describe("Only runs the agent is executing now (cloning through reviewing; a queued pending run is not yet executing and is left out); for the org-wide list"),
4605
+ status: z.array(z.enum(BUILD_RUN_STATUSES)).min(1).optional().describe("Only runs in these statuses, such as [\"failed\", \"stopped\"]"),
4601
4606
  ...pagination
4602
4607
  }),
4603
4608
  annotations: READ_ONLY
@@ -4608,6 +4613,7 @@ function registerBuildTools(server, client) {
4608
4613
  if (productIdOf) {
4609
4614
  const result = await client.listBuildRuns(productIdOf, {
4610
4615
  backlogItemId: params.initiativeId,
4616
+ status: params.status,
4611
4617
  limit: params.limit,
4612
4618
  cursor: params.cursor
4613
4619
  });
@@ -5241,7 +5247,7 @@ function registerBacklogReads(server, client) {
5241
5247
  function registerRequest(server, client) {
5242
5248
  server.registerTool("taiga_request_initiatives", {
5243
5249
  title: "Request new initiatives",
5244
- description: "Ask an agent to turn described work into initiatives in the product's Backlog, and return the job. One piece of work becomes one initiative, a program an ordered set with dependencies. It may add none and say why (already covered, not work, outside the product, or a named policy forbids it). Omit title and description for the one next initiative the product most needs. taiga_wait_for_job gives the outcome. One request per product at a time (CONFLICT). Nothing goes on the line.",
5250
+ description: "Ask an agent to turn described work into initiatives in the product's Backlog, and return the job. One piece of work becomes one initiative, a program an ordered set with dependencies. It may add none and say why (already covered, not work, outside the product, or a named policy forbids it). Omit title and description for the one next initiative the product most needs. taiga_wait (jobId) gives the outcome. One request per product at a time (CONFLICT). Nothing goes on the line.",
5245
5251
  inputSchema: z.object({
5246
5252
  productId,
5247
5253
  title: z.string().max(500).optional().describe("What the work is, in a line"),
@@ -5453,6 +5459,77 @@ const FINDING_ROW_FIELDS = [
5453
5459
  "ignoreReason",
5454
5460
  "ignoreExpiresAt"
5455
5461
  ];
5462
+ /** Locations a folded row names before it says how many more there are. */
5463
+ const GROUP_WHERE = 5;
5464
+ /** What makes two findings one rule's: its rule id for code, infrastructure and secrets, its license verdict for a license. */
5465
+ /** The scanner's title cap (deps.py _COLUMN_CAP): a title cut there ends in "...". */
5466
+ const TITLE_CAP = 300;
5467
+ /**
5468
+ * The license verdict of a license finding's title: what follows "<package> <version>: ". A title the scanner cut
5469
+ * at its cap has no whole verdict, so it folds with nothing: two cut titles could share a prefix and differ.
5470
+ */
5471
+ function licenseVerdict(row) {
5472
+ const title = String(row["title"] ?? "");
5473
+ if (title.length >= TITLE_CAP && title.endsWith("...")) return "";
5474
+ return title.split(": ").slice(1).join(": ");
5475
+ }
5476
+ function groupKey(row) {
5477
+ const status = String(row["status"] ?? "");
5478
+ const link = String(row["productRepositoryId"] ?? "");
5479
+ if (row["kind"] === "license_violation") {
5480
+ const verdict = licenseVerdict(row);
5481
+ return verdict ? `license|${status}|${link}|${verdict}` : null;
5482
+ }
5483
+ const location = row["location"];
5484
+ const rule = typeof location?.ruleId === "string" ? location.ruleId : null;
5485
+ return rule ? `${String(row["kind"])}|${String(row["severity"])}|${status}|${link}|${rule}` : null;
5486
+ }
5487
+ /** Where one finding is, in a few characters: its path and line, or its package. */
5488
+ function whereOf(row) {
5489
+ const location = row["location"];
5490
+ if (typeof location?.path === "string") return location.line ? `${location.path}:${String(location.line)}` : location.path;
5491
+ return [row["packageName"], row["currentVersion"]].filter(Boolean).join(" ") || String(row["id"]);
5492
+ }
5493
+ /**
5494
+ * Findings of one rule or license verdict on a page, folded into one row (PRO-2941): a review read seven
5495
+ * CKV_GHA_7 rows and fifteen sharp license rows, identical but for where. The first stands for them, with
5496
+ * count, every findingId (what fix and ignore take) and the first few locations.
5497
+ */
5498
+ function grouped(rows, fold) {
5499
+ if (!fold) return rows;
5500
+ const groups = /* @__PURE__ */ new Map();
5501
+ const order = [];
5502
+ for (const row of rows) {
5503
+ const key = groupKey(row);
5504
+ if (!key) {
5505
+ order.push(row);
5506
+ continue;
5507
+ }
5508
+ if (!groups.has(key)) {
5509
+ groups.set(key, []);
5510
+ order.push(key);
5511
+ }
5512
+ groups.get(key).push(row);
5513
+ }
5514
+ return order.map((entry) => {
5515
+ if (typeof entry !== "string") return entry;
5516
+ const members = groups.get(entry);
5517
+ if (members.length === 1) return members[0];
5518
+ const where = members.map(whereOf);
5519
+ const first = members[0];
5520
+ const shared = Object.fromEntries(Object.entries(first).filter(([key, value]) => key !== "id" && members.every((member) => JSON.stringify(member[key]) === JSON.stringify(value))));
5521
+ const location = first["location"];
5522
+ const said = first["kind"] === "license_violation" ? licenseVerdict(first) : typeof location?.ruleId === "string" ? location.ruleId : String(first["title"]);
5523
+ return {
5524
+ ...shared,
5525
+ ...shared["title"] === void 0 ? { title: said } : {},
5526
+ count: members.length,
5527
+ findingIds: members.map((member) => member["id"]),
5528
+ where: where.slice(0, GROUP_WHERE),
5529
+ ...where.length > GROUP_WHERE ? { moreWhere: where.length - GROUP_WHERE } : {}
5530
+ };
5531
+ });
5532
+ }
5456
5533
  /**
5457
5534
  * Whether taiga_fix_finding would take a finding, said on the row (PRO-2800): three reviews found a dependency
5458
5535
  * marked remediableBy coding_agent with no fixed version, which the API refuses to fix. The API's own refusals,
@@ -5611,13 +5688,14 @@ function registerMaintenanceTools(server, client) {
5611
5688
  if (!client.hasCapability("products:read")) return;
5612
5689
  server.registerTool("taiga_list_findings", {
5613
5690
  title: "List maintenance findings",
5614
- description: "List what maintenance sweeps found in a product's repository: dependencies, secrets, insecure code (sast) and infrastructure. The first page opens with sweep (open counts, latest sweeps), so an old or failed sweep is not read as an all-clear. Rows: severity, tier (act_now: known exploited; urgent: likely and serious; elevated: one of the two; routine), location, remediableBy (coding_agent: a run here can fix it; upstream_only: the code is in a submodule, so the fix belongs in its own repository), fixable: false when no fixed version is known yet, breached controls and initiativeId of a fix under way. Omit status for open findings. controlId lists the findings that breach one control. taiga_get_finding reads one.",
5691
+ description: "List what maintenance sweeps found in a product's repository: dependencies, secrets, insecure code (sast) and infrastructure. The first page opens with sweep (open counts, latest sweeps), so an old or failed sweep is not read as an all-clear. Rows: severity, tier (act_now: known exploited; urgent: likely and serious; elevated: one of the two; routine), location, remediableBy (coding_agent: a run here can fix it; upstream_only: the code is in a submodule, so the fix belongs in its own repository), fixable: false when no fixed version is known yet, breached controls and initiativeId of a fix under way. Omit status for open findings. controlId lists the findings that breach one control. Findings of one rule or license verdict in one repository fold into one row per page, with count, findingIds (what fix and ignore take), where, and only the fields they share; group: false lists each. taiga_get_finding reads one.",
5615
5692
  inputSchema: z.object({
5616
5693
  productId,
5617
5694
  controlId: z.string().trim().min(1).max(40).optional().describe("Only the findings that breach this control, such as SEC-5.1 (one page, searched across all)"),
5618
5695
  status: z.enum(MAINTENANCE_FINDING_STATUSES).optional().describe("Only findings in this status; omit for the ones needing action"),
5619
5696
  severity: z.enum(MAINTENANCE_FINDING_SEVERITIES).optional().describe("Only this severity"),
5620
5697
  kind: z.enum(MAINTENANCE_FINDING_KINDS).optional().describe("Only this kind of finding"),
5698
+ group: z.boolean().optional().describe("Fold findings of one rule or license on this page into one row (default true); false lists each"),
5621
5699
  ...pagination
5622
5700
  }),
5623
5701
  annotations: READ_ONLY
@@ -5632,7 +5710,7 @@ function registerMaintenanceTools(server, client) {
5632
5710
  cursor
5633
5711
  }), "", () => [""], params.limit ?? 25, (row) => Array.isArray(row["controls"]) && row["controls"].some((c) => String(c).toUpperCase() === wanted));
5634
5712
  return toolResult({
5635
- ...page(findingRows(found.rows), null),
5713
+ ...page(grouped(findingRows(found.rows), params.group !== false), null),
5636
5714
  ...found.more ? { more: found.rows.length < (params.limit ?? 25) ? `Only the first 1000 findings were searched; narrow by status, severity or kind to reach the rest.` : "There may be more than the limit carries: raise the limit, or narrow by status, severity or kind." } : {},
5637
5715
  ...found.rows.length === 0 && !found.more ? { note: `No ${params.status ? `${params.status} ` : "open "}finding breaches ${wanted}. That is no all-clear on its own: taiga_list_findings without controlId says when the product was last swept.` } : {}
5638
5716
  });
@@ -5646,7 +5724,7 @@ function registerMaintenanceTools(server, client) {
5646
5724
  sweep: null,
5647
5725
  sweepNote: "The sweep overview could not be read: an empty list here is not an all-clear."
5648
5726
  } : sweep ? { sweep } : {},
5649
- ...page(findingRows(result.data), result.nextCursor),
5727
+ ...page(grouped(findingRows(result.data), params.group !== false), result.nextCursor),
5650
5728
  ...typeof result.totalCount === "number" ? { totalCount: result.totalCount } : {},
5651
5729
  ...params.status === void 0 && params.severity === void 0 && params.kind === void 0 && typeof result.totalCount === "number" && sweep && sweep !== "unread" && typeof sweep["openFindings"] === "number" && sweep["openFindings"] !== result.totalCount ? { totalNote: "totalCount includes findings with a fix under way (remediating) and ignored findings whose ignore has expired; sweep.openFindings counts open ones only." } : {}
5652
5730
  });
@@ -5658,13 +5736,16 @@ function registerMaintenanceTools(server, client) {
5658
5736
  productId,
5659
5737
  license: z.string().min(1).max(4096).optional().describe("Only packages carrying exactly this SPDX string"),
5660
5738
  search: z.string().min(1).max(255).optional().describe("Case-insensitive substring of the package name"),
5661
- productRepositoryId: idInput("repository", "taiga_list_product_repositories gives it", "only this repository").optional(),
5739
+ linkId: idInput("repository link", "taiga_list_product_repositories gives it", "only this repository").optional(),
5662
5740
  ...pagination
5663
5741
  }),
5664
5742
  annotations: READ_ONLY
5665
5743
  }, (params) => runTool(async () => {
5666
- const { productId: id, ...filters } = params;
5667
- const [result, summary] = await Promise.all([client.listPackages(id, filters), params.cursor === void 0 ? client.getLicenseSummary(id) : Promise.resolve(null)]);
5744
+ const { productId: id, linkId: link, ...filters } = params;
5745
+ const [result, summary] = await Promise.all([client.listPackages(id, {
5746
+ ...filters,
5747
+ ...link ? { productRepositoryId: link } : {}
5748
+ }), params.cursor === void 0 ? client.getLicenseSummary(id) : Promise.resolve(null)]);
5668
5749
  return toolResult({
5669
5750
  ...summary ? { licenses: summary.data } : {},
5670
5751
  ...page(pickFields(result.data, PACKAGE_ROW_FIELDS), result.nextCursor),
@@ -5676,10 +5757,10 @@ function registerMaintenanceTools(server, client) {
5676
5757
  description: "One repository's software bill of materials as a CycloneDX 1.5 JSON document, rendered from the stored package inventory: metadata (timestamp, tools, the repository), every package with its purl, license and scope, and the packages the repository declares directly. The whole document is returned, so for a large repository the answer is large; read taiga_list_packages when a summary is enough. NOT_FOUND where the licenses feature is not enabled, and for a repository no sweep has inventoried yet.",
5677
5758
  inputSchema: z.object({
5678
5759
  productId,
5679
- repositoryId: idInput("repository", "taiga_list_product_repositories gives it")
5760
+ linkId: idInput("repository link", "taiga_list_product_repositories gives it")
5680
5761
  }),
5681
5762
  annotations: READ_ONLY
5682
- }, (params) => runTool(async () => toolResult(await client.getSbom(params.productId, params.repositoryId))));
5763
+ }, (params) => runTool(async () => toolResult(await client.getSbom(params.productId, params.linkId))));
5683
5764
  server.registerTool("taiga_get_finding", {
5684
5765
  title: "Get a maintenance finding",
5685
5766
  description: "Read one maintenance finding: exploit likelihood (EPSS, known-exploited list), the advisory summarized (full: true for its whole record: every affected range and reference) and fixed version, code location, breached policy controls, why it ranks where it does, history (reintroduced, previously resolved) and the remediation under way. fixable: false with fixNote says taiga_fix_finding would refuse it. A secret's value is never stored, only the rule and location.",
@@ -6992,7 +7073,7 @@ function deploymentLines(rows) {
6992
7073
  };
6993
7074
  });
6994
7075
  }
6995
- const environmentId = idInput("environment", "taiga_list_environments lists them; a product ID is not one");
7076
+ const environmentId = idInput("environment", "taiga_get_deployments lists them; a product ID is not one");
6996
7077
  /** The windows the pages offer, as the schema's own values rather than a number checked afterwards. */
6997
7078
  const windowDays = z.literal([
6998
7079
  30,
@@ -7002,11 +7083,11 @@ const windowDays = z.literal([
7002
7083
  /** Whether a failure is the API's (refused, missing, unreachable) rather than a bug here. */
7003
7084
  const isApiFailure = (error) => error instanceof TaigaApiError || isNetworkFailure(error);
7004
7085
  /** A part that may fail on its own without failing the read: null and the reason, or the value. */
7005
- async function part(read) {
7086
+ async function part(read, rethrow = () => false) {
7006
7087
  try {
7007
7088
  return { value: await read() };
7008
7089
  } catch (error) {
7009
- if (!isApiFailure(error)) throw error;
7090
+ if (!isApiFailure(error) || rethrow(error)) throw error;
7010
7091
  return { unavailable: error instanceof TaigaApiError ? `${error.status}: ${error.apiMessage ?? ""}`.trim() : "unreachable" };
7011
7092
  }
7012
7093
  }
@@ -7037,7 +7118,7 @@ function registerObserveTools(server, client) {
7037
7118
  if (!client.hasCapability("products:read")) return;
7038
7119
  server.registerTool("taiga_get_deployments", {
7039
7120
  title: "Get what runs where",
7040
- description: "Read what runs in each of a product's environments and its recent deployments, newest first: commit, pull request, status, deployer and, on failure, the provider's error. What runs is the latest successful deployment, so a newer failure shows beside it. History is mirrored from the provider, including deployments made outside Taiga; syncStatus says when it last synced. environmentId narrows to one environment. Taiga never deploys.",
7121
+ description: "Read a product's environments with their IDs, what runs in each, and its recent deployments, newest first: commit, pull request, status, deployer and, on failure, the provider's error. What runs is the latest successful deployment, so a newer failure shows beside it. History is mirrored from the provider, including deployments made outside Taiga; syncStatus says when it last synced. environmentId narrows to one environment. Taiga never deploys.",
7041
7122
  inputSchema: z.object({
7042
7123
  productId,
7043
7124
  environmentId: environmentId.optional(),
@@ -7045,25 +7126,31 @@ function registerObserveTools(server, client) {
7045
7126
  }),
7046
7127
  annotations: READ_ONLY
7047
7128
  }, (params) => runTool(async () => {
7048
- const [environments, current, history, sync] = await Promise.all([
7129
+ const [environments, currentRead, historyRead, sync] = await Promise.all([
7049
7130
  allEnvironments(client, params.productId),
7050
- client.getCurrentDeployments(params.productId),
7051
- client.listDeployments(params.productId, {
7131
+ part(() => client.getCurrentDeployments(params.productId)),
7132
+ part(() => client.listDeployments(params.productId, {
7052
7133
  environmentId: params.environmentId,
7053
7134
  limit: params.limit ?? 10,
7054
7135
  cursor: params.cursor
7055
- }),
7136
+ }), (error) => Boolean(params.environmentId) && error instanceof TaigaApiError && error.status === 404),
7056
7137
  part(() => client.getDeploymentSyncStatus(params.productId))
7057
7138
  ]);
7058
- const now = current.data;
7059
- const note = environments.rows.length === 0 ? "This product has no environments yet: an environment is defined with taiga_create_environment, and its deployments are mirrored from the provider once it is." : history.data.length === 0 && !params.cursor ? "No deployments recorded yet: none was mirrored from the provider (syncStatus says when it last synced), or nothing has been deployed." : null;
7060
- const live = new Set([...now.current ?? [], ...now.deploying ?? []].map((row) => row.id));
7139
+ const now = "value" in currentRead ? currentRead.value.data : null;
7140
+ const history = "value" in historyRead ? historyRead.value : null;
7141
+ const note = environments.rows.length === 0 ? "This product has no environments yet: an environment is defined with taiga_create_environment, and its deployments are mirrored from the provider once it is." : history && history.data.length === 0 && !params.cursor ? "No deployments recorded yet: none was mirrored from the provider (syncStatus says when it last synced), or nothing has been deployed." : null;
7142
+ const live = new Set([...now?.current ?? [], ...now?.deploying ?? []].map((row) => row.id));
7143
+ const unavailable = {
7144
+ ..."unavailable" in currentRead ? { running: currentRead.unavailable } : {},
7145
+ ..."unavailable" in historyRead ? { history: historyRead.unavailable } : {}
7146
+ };
7061
7147
  return toolResult({
7062
7148
  environments: pickFields(environments.rows, ENVIRONMENT_FIELDS),
7063
7149
  ...environments.more ? { moreEnvironments: true } : {},
7064
- running: deploymentLines(now.current ?? []),
7065
- deploying: deploymentLines(now.deploying ?? []),
7066
- history: page(deploymentLines(history.data.filter((row) => !live.has(row.id))), history.nextCursor),
7150
+ running: now ? deploymentLines(now.current ?? []) : null,
7151
+ deploying: now ? deploymentLines(now.deploying ?? []) : null,
7152
+ history: history ? page(deploymentLines(history.data.filter((row) => !live.has(row.id))), history.nextCursor) : null,
7153
+ ...Object.keys(unavailable).length > 0 ? { unavailable } : {},
7067
7154
  ..."value" in sync ? { syncStatus: sync.value.data } : {
7068
7155
  syncStatus: null,
7069
7156
  syncUnavailable: sync.unavailable
@@ -7071,19 +7158,6 @@ function registerObserveTools(server, client) {
7071
7158
  ...note ? { note } : {}
7072
7159
  });
7073
7160
  }));
7074
- server.registerTool("taiga_list_environments", {
7075
- title: "List a product's environments",
7076
- description: "List a product's environments with ID, type, order and App URL. These are the environment IDs taiga_get_delivery_metrics, taiga_get_monitoring and taiga_update_environment take. taiga_get_deployments lists them too, with what runs where.",
7077
- inputSchema: z.object({ productId }),
7078
- annotations: READ_ONLY
7079
- }, (params) => runTool(async () => {
7080
- const { rows, more } = await allEnvironments(client, params.productId);
7081
- return toolResult({
7082
- data: pickFields(rows, ENVIRONMENT_FIELDS),
7083
- ...more ? { more: "More environments than this answer reads; the rest were left out." } : {},
7084
- ...rows.length === 0 ? { note: "No environment is defined yet; taiga_create_environment adds one." } : {}
7085
- });
7086
- }));
7087
7161
  server.registerTool("taiga_get_delivery_metrics", {
7088
7162
  title: "Get delivery metrics",
7089
7163
  description: "Read DORA's five delivery metrics for one environment (the page shows production) over 30, 60 or 90 days: deployment frequency, lead time, failed deployment recovery time, change-failure rate and rework rate, each with its trend against the window before and a performance band (none for rework rate). Computed from deployments, not incidents; previews and checks do not count. Under ten deployments a trend is approximate; a metric with no data says so instead of a number. Without environmentId, the product's production environment when it has exactly one.",
@@ -7103,7 +7177,7 @@ function registerObserveTools(server, client) {
7103
7177
  note: "This product has no environments, so there is nothing to measure: an environment is defined with taiga_create_environment, and its deployments are mirrored from the provider once it is."
7104
7178
  });
7105
7179
  const production = all.filter((env) => env.type === "production");
7106
- if (production.length !== 1 || more) return toolError("VALIDATION_ERROR", `Pass environmentId: the product has ${more ? "more environments than one read holds, and " : ""}${production.length === 0 ? "no" : production.length} production environment${production.length === 1 ? "" : "s"}${more ? " among the first" : ""}. taiga_list_environments lists them with their IDs.`, { environments: all.map((env) => ({
7180
+ if (production.length !== 1 || more) return toolError("VALIDATION_ERROR", `Pass environmentId: the product has ${more ? "more environments than one read holds, and " : ""}${production.length === 0 ? "no" : production.length} production environment${production.length === 1 ? "" : "s"}${more ? " among the first" : ""}. taiga_get_deployments lists them with their IDs.`, { environments: all.map((env) => ({
7107
7181
  id: env.id,
7108
7182
  name: env.name,
7109
7183
  type: env.type
@@ -7232,7 +7306,7 @@ function registerProductDocumentWrites(server, client) {
7232
7306
  }, (params) => runTool(async () => toolResult((await client.markProductDocumentReviewed(params.productId, params.type)).data)));
7233
7307
  if (canRead) server.registerTool("taiga_regenerate_product_document", {
7234
7308
  title: "Regenerate a product document",
7235
- description: "Regenerate one product document from the documents it derives from, when it is outdated or needs another pass, and return the job. The result is published and documents derived from it are marked outdated. The Specification (from the Discovery conversation) and the Look & Feel (from its concepts) are made in the web. Documents Discovery requires regenerate only while Discovery is open; the optional Service Blueprint any time. taiga_wait_for_job says when it is done.",
7309
+ description: "Regenerate one product document from the documents it derives from, when it is outdated or needs another pass, and return the job. The result is published and documents derived from it are marked outdated. The Specification (from the Discovery conversation) and the Look & Feel (from its concepts) are made in the web. Documents Discovery requires regenerate only while Discovery is open; the optional Service Blueprint any time. taiga_wait (jobId) says when it is done.",
7236
7310
  inputSchema: z.object({
7237
7311
  productId,
7238
7312
  type: generatedType
@@ -22008,7 +22082,11 @@ const GITHUB_REPOSITORY_FIELDS = [
22008
22082
  "linked",
22009
22083
  "linkedProduct"
22010
22084
  ];
22011
- const repositoryId = idInput("repository link", "taiga_list_product_repositories gives it; a linkable repository id is not one");
22085
+ /**
22086
+ * A product's link to a repository: one name for it in every tool (PRO-2941). Reviews met it as repositoryId
22087
+ * here, productRepositoryId on findings and packages, and linkableRepositoryId (a different thing) beside both.
22088
+ */
22089
+ const linkId = idInput("repository link", "taiga_list_product_repositories gives it (its id); a linkable repository id is not one");
22012
22090
  /** Round-robin over lists: the first of each, then the second of each, and so on. */
22013
22091
  function interleave(lists) {
22014
22092
  const out = [];
@@ -22072,11 +22150,11 @@ function registerRepositoryTools(server, client) {
22072
22150
  description: "List the branches of a product's linked repository, each with whether it is protected, to choose the one Taiga works on (taiga_set_repository_branch). truncated: true means there are more than listed.",
22073
22151
  inputSchema: z.object({
22074
22152
  productId,
22075
- repositoryId
22153
+ linkId
22076
22154
  }),
22077
22155
  annotations: READ_ONLY
22078
22156
  }, (params) => runTool(async () => {
22079
- const result = await client.listRepositoryBranches(params.productId, params.repositoryId);
22157
+ const result = await client.listRepositoryBranches(params.productId, params.linkId);
22080
22158
  return toolResult({
22081
22159
  data: result.data,
22082
22160
  truncated: result.truncated
@@ -22132,11 +22210,11 @@ function registerRepositoryTools(server, client) {
22132
22210
  if (!client.hasCapability("vcs:manage")) return;
22133
22211
  server.registerTool("taiga_link_repository", {
22134
22212
  title: "Link a repository to a product",
22135
- description: "Link a GitHub repository to a product (taiga_list_linkable_repositories gives its id). replacesRepositoryId swaps out the one linked now in one step (the same one changes nothing); linking while one is linked without it is refused. A managed link (isManaged) cannot be replaced or unlinked. Once linked, planning reads its code, runs open pull requests in it, sweeps scan it, and its deployment history is imported.",
22213
+ description: "Link a GitHub repository to a product (taiga_list_linkable_repositories gives its id). replacesLinkId swaps out that link in one step (the same one changes nothing). Whether a product may link more than one repository depends on the organization; when it may not, a second link is refused and the refusal says to pass replacesLinkId. A managed link (isManaged) cannot be replaced or unlinked. Once linked, planning reads its code, runs open pull requests in it, sweeps scan it, and its deployment history is imported.",
22136
22214
  inputSchema: z.object({
22137
22215
  productId,
22138
22216
  linkableRepositoryId: idInput("linkable repository", "taiga_list_linkable_repositories gives it (a row's id; not GitHub's numeric id, not a link ID)"),
22139
- replacesRepositoryId: repositoryId.optional().describe("The link this one replaces")
22217
+ replacesLinkId: linkId.optional().describe("The link this one replaces")
22140
22218
  }),
22141
22219
  annotations: OPERATE
22142
22220
  }, (params) => runTool(async () => {
@@ -22144,7 +22222,7 @@ function registerRepositoryTools(server, client) {
22144
22222
  try {
22145
22223
  linked = await client.linkRepository(params.productId, {
22146
22224
  githubRepositoryId: params.linkableRepositoryId,
22147
- ...params.replacesRepositoryId ? { replacesRepositoryId: params.replacesRepositoryId } : {}
22225
+ ...params.replacesLinkId ? { replacesRepositoryId: params.replacesLinkId } : {}
22148
22226
  });
22149
22227
  } catch (error) {
22150
22228
  const holder = await holderOf(client, error, params.productId);
@@ -22161,14 +22239,14 @@ function registerRepositoryTools(server, client) {
22161
22239
  description: "Choose the branch Taiga branches from and opens pull requests against (taiga_list_repository_branches lists them), or null for the repository's default. A protected branch is accepted, but Taiga may not be able to merge into it; the result says when it is protected. Optionally sets a label for the link.",
22162
22240
  inputSchema: z.object({
22163
22241
  productId,
22164
- repositoryId,
22242
+ linkId,
22165
22243
  baseBranch: z.string().trim().min(1).max(255).nullable().optional().describe("The branch; null for the default"),
22166
22244
  label: z.string().trim().min(1).max(100).nullable().optional().describe("A label for the link; null clears it")
22167
22245
  }),
22168
22246
  annotations: OPERATE_SETTING
22169
22247
  }, (params) => runTool(async () => {
22170
22248
  if (params.baseBranch === void 0 && params.label === void 0) return toolError("VALIDATION_ERROR", "Set baseBranch, label or both.");
22171
- const updated = (await client.updateRepository(params.productId, params.repositoryId, {
22249
+ const updated = (await client.updateRepository(params.productId, params.linkId, {
22172
22250
  ...params.baseBranch !== void 0 ? { baseBranch: params.baseBranch } : {},
22173
22251
  ...params.label !== void 0 ? { label: params.label } : {}
22174
22252
  })).data;
@@ -22180,16 +22258,16 @@ function registerRepositoryTools(server, client) {
22180
22258
  }));
22181
22259
  server.registerTool("taiga_unlink_repository", {
22182
22260
  title: "Unlink a repository from a product",
22183
- description: "Unlink a repository from a product. The product keeps its documents and initiatives, but nothing is planned against code, built or swept. The repository itself is untouched; one Taiga created for the product cannot be unlinked. To swap it, use taiga_link_repository with replacesRepositoryId.",
22261
+ description: "Unlink a repository from a product. The product keeps its documents and initiatives, but nothing is planned against code, built or swept. The repository itself is untouched; one Taiga created for the product cannot be unlinked. To swap it, use taiga_link_repository with replacesLinkId.",
22184
22262
  inputSchema: z.object({
22185
22263
  productId,
22186
- repositoryId
22264
+ linkId
22187
22265
  }),
22188
22266
  annotations: OPERATE
22189
22267
  }, (params) => runTool(async () => {
22190
- await client.unlinkRepository(params.productId, params.repositoryId);
22268
+ await client.unlinkRepository(params.productId, params.linkId);
22191
22269
  return toolResult({
22192
- repositoryId: params.repositoryId,
22270
+ linkId: params.linkId,
22193
22271
  unlinked: true
22194
22272
  });
22195
22273
  }));
@@ -22573,7 +22651,7 @@ function registerSetupTools(server, client) {
22573
22651
  }));
22574
22652
  server.registerTool("taiga_refresh_reality_documents", {
22575
22653
  title: "Refresh a product's documents from its code",
22576
- description: "Derive the reality documents again from the code on the branch Taiga works on (effectiveBranch): all, or the ones named. For a document the import misread, refresh it instead of importing again; unchanged sections are not republished. Returns the job; taiga_wait_for_job says when it is done.",
22654
+ description: "Derive the reality documents again from the code on the branch Taiga works on (effectiveBranch): all, or the ones named. For a document the import misread, refresh it instead of importing again; unchanged sections are not republished. Returns the job; taiga_wait (jobId) says when it is done.",
22577
22655
  inputSchema: z.object({
22578
22656
  productId,
22579
22657
  docTypes: z.array(z.enum(REALITY_DERIVED_DOCUMENT_TYPES)).min(1).max(REALITY_DERIVED_DOCUMENT_TYPES.length).optional().describe("The documents to refresh; omit for all")
@@ -22602,7 +22680,7 @@ function registerSetupTools(server, client) {
22602
22680
  if (!client.hasCapability("products:read")) return;
22603
22681
  server.registerTool("taiga_start_import", {
22604
22682
  title: "Import a codebase into a product",
22605
- description: "Start importing a product created for import, and return the job. Taiga reads the linked repository and derives the full document set from the code, citing the files. Then the scanners sweep it, the documents are assessed against policies, and the first initiatives are planned when Discovery finishes. Refused for a scratch product, without a linked repository, or while an import runs. taiga_wait_for_job says when it is done (it takes a while).",
22683
+ description: "Start importing a product created for import, and return the job. Taiga reads the linked repository and derives the full document set from the code, citing the files. Then the scanners sweep it, the documents are assessed against policies, and the first initiatives are planned when Discovery finishes. Refused for a scratch product, without a linked repository, or while an import runs. taiga_wait (jobId) says when it is done (it takes a while).",
22606
22684
  inputSchema: z.object({ productId }),
22607
22685
  annotations: OPERATE
22608
22686
  }, (params) => runTool(async () => {
@@ -22869,20 +22947,25 @@ function judgeBuild(until) {
22869
22947
  return null;
22870
22948
  };
22871
22949
  }
22950
+ /** What each target may be waited for. A job has one condition, finished, so it takes none. */
22951
+ const UNTIL_FOR = {
22952
+ initiative: ITEM_CONDITIONS,
22953
+ run: BUILD_CONDITIONS
22954
+ };
22955
+ const ALL_CONDITIONS = [.../* @__PURE__ */ new Set([...ITEM_CONDITIONS, ...BUILD_CONDITIONS])];
22956
+ /**
22957
+ * One tool for waiting (PRO-2941): three wait tools, one per thing waited on, were two more names in a catalogue
22958
+ * every review ranked too large. The ID says what is waited on; until says for what, refused when it does not
22959
+ * apply to that thing.
22960
+ */
22872
22961
  function registerWaitTools(server, client, options) {
22873
- if (client.hasCapability("backlog:read")) server.registerTool("taiga_wait_for_initiative", {
22874
- title: "Wait for an initiative",
22875
- description: "Wait until an initiative reaches a condition instead of polling: changed, planned, your_turn (waits on a person), pr_open (open now; merged or closed does not count), run_settled (latest run stopped moving) or done. Returns reached: true when it holds; early with stoppedBecause when only a person can move it (a flag, failed plan, plan or pull request awaiting review, a cancel); or reached: false at the timeout: call again. A condition already true answers at once. Planning takes minutes, a run up to an hour.",
22876
- inputSchema: z.object({
22877
- initiativeId: idInput("initiative", "taiga_list_initiatives (query finds one by title) gives it"),
22878
- until: z.enum(ITEM_CONDITIONS).describe("What to wait for"),
22879
- timeoutSeconds
22880
- }),
22881
- annotations: READ_ONLY
22882
- }, (params, ctx) => runTool(async () => {
22962
+ const items = client.hasCapability("backlog:read");
22963
+ const runs = client.hasCapability("products:read");
22964
+ if (!items && !runs) return;
22965
+ const waitInitiative = async (target, until, params, ctx) => {
22883
22966
  const gate = { product: void 0 };
22884
22967
  const read = async (signal) => {
22885
- const item = (await client.getBacklogItem(params.initiativeId, signal)).data;
22968
+ const item = (await client.getBacklogItem(target, signal)).data;
22886
22969
  if (gate.product === void 0 && typeof item.autoBuild !== "boolean") gate.product = client.hasCapability("products:read") ? await client.getProduct(String(item.productId), signal).then((p) => {
22887
22970
  const value = p.data.autoBuild;
22888
22971
  return typeof value === "boolean" ? value : true;
@@ -22892,48 +22975,31 @@ function registerWaitTools(server, client, options) {
22892
22975
  }) : null;
22893
22976
  return item;
22894
22977
  };
22895
- const { now, ...outcome } = await waitFor(read, judgeItem(params.until, gate), (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1e3, options, {
22978
+ const { now, ...outcome } = await waitFor(read, judgeItem(until, gate), (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1e3, options, {
22896
22979
  progressToken: ctx.mcpReq._meta?.progressToken,
22897
22980
  notify: ctx.mcpReq.notify,
22898
22981
  signal: ctx.mcpReq.signal
22899
22982
  });
22900
22983
  return toolResult({
22901
- until: params.until,
22984
+ until,
22902
22985
  ...outcome,
22903
22986
  item: now ? itemReport(now) : null
22904
22987
  });
22905
- }));
22906
- if (client.hasCapability("products:read")) server.registerTool("taiga_wait_for_run", {
22907
- title: "Wait for a run",
22908
- description: "Wait until a run reaches a condition: changed, step_done (one more step finished), pr_open (open now) or settled (in review, completed, failed, stopped). Returns reached: true when it holds; early with stoppedBecause if the run settled without it; or reached: false at the timeout: call again. A settled run answers settled at once; run is null if the first read timed out.",
22909
- inputSchema: z.object({
22910
- runId: idInput("run", "taiga_list_runs gives it"),
22911
- until: z.enum(BUILD_CONDITIONS).describe("What to wait for"),
22912
- timeoutSeconds
22913
- }),
22914
- annotations: READ_ONLY
22915
- }, (params, ctx) => runTool(async () => {
22916
- const { now, ...outcome } = await waitFor(async (signal) => (await client.getBuildRun(params.runId, signal)).data, judgeBuild(params.until), (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1e3, options, {
22988
+ };
22989
+ const waitRun = async (target, until, params, ctx) => {
22990
+ const { now, ...outcome } = await waitFor(async (signal) => (await client.getBuildRun(target, signal)).data, judgeBuild(until), (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1e3, options, {
22917
22991
  progressToken: ctx.mcpReq._meta?.progressToken,
22918
22992
  notify: ctx.mcpReq.notify,
22919
22993
  signal: ctx.mcpReq.signal
22920
22994
  });
22921
22995
  return toolResult({
22922
- until: params.until,
22996
+ until,
22923
22997
  ...outcome,
22924
22998
  run: now ? readableRow(pickFields([now], RUN_REPORT_FIELDS)[0]) : null
22925
22999
  });
22926
- }));
22927
- if (client.hasCapability("products:read")) server.registerTool("taiga_wait_for_job", {
22928
- title: "Wait for an agent job",
22929
- description: "Wait until an agent job finishes (completed, failed or cancelled). Returns the job as taiga_get_job reads it, with an initiative request's outcome, and reached: true; or reached: false at the timeout: call again to keep waiting. Most jobs take a few minutes.",
22930
- inputSchema: z.object({
22931
- jobId: idInput("job", "the tool that started the job returned it"),
22932
- timeoutSeconds
22933
- }),
22934
- annotations: READ_ONLY
22935
- }, (params, ctx) => runTool(async () => {
22936
- const { now, ...outcome } = await waitFor(async (signal) => (await client.getAgentJob(params.jobId, signal)).data, (job) => SETTLED_JOB_STATUSES.has(String(job.status)) ? { reached: true } : null, (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1e3, options, {
23000
+ };
23001
+ const waitJob = async (target, params, ctx) => {
23002
+ const { now, ...outcome } = await waitFor(async (signal) => (await client.getAgentJob(target, signal)).data, (job) => SETTLED_JOB_STATUSES.has(String(job.status)) ? { reached: true } : null, (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1e3, options, {
22937
23003
  progressToken: ctx.mcpReq._meta?.progressToken,
22938
23004
  notify: ctx.mcpReq.notify,
22939
23005
  signal: ctx.mcpReq.signal
@@ -22942,6 +23008,38 @@ function registerWaitTools(server, client, options) {
22942
23008
  ...outcome,
22943
23009
  job: now ? jobReport(now) : null
22944
23010
  });
23011
+ };
23012
+ server.registerTool("taiga_wait", {
23013
+ title: "Wait for an initiative, run or job",
23014
+ description: "Wait instead of polling, for one of: an initiative (initiativeId) to reach until: changed, planned, your_turn (waits on a person), pr_open (open now; merged or closed does not count), run_settled (latest run stopped moving) or done; a run (runId) to reach until: changed, step_done, pr_open or settled (in review, completed, failed, stopped); or an agent job (jobId) to finish, which takes no until. Returns reached: true when it holds; early with stoppedBecause when it cannot happen without a person; or reached: false at the timeout: call again. A condition already true answers at once. Planning takes minutes, a run up to an hour, most jobs a few minutes.",
23015
+ inputSchema: z.object({
23016
+ initiativeId: idInput("initiative", "taiga_list_initiatives (query finds one by title) gives it").optional(),
23017
+ runId: idInput("run", "taiga_list_runs gives it").optional(),
23018
+ jobId: idInput("job", "the tool that started the job returned it").optional(),
23019
+ until: z.enum(ALL_CONDITIONS).optional().describe("What to wait for: an initiative and a run need one"),
23020
+ timeoutSeconds
23021
+ }),
23022
+ annotations: READ_ONLY
23023
+ }, (params, ctx) => runTool(async () => {
23024
+ if ([
23025
+ "initiativeId",
23026
+ "runId",
23027
+ "jobId"
23028
+ ].filter((key) => params[key] !== void 0).length !== 1) return toolError("VALIDATION_ERROR", "Name exactly one of initiativeId, runId or jobId: the thing to wait on.");
23029
+ if (params.jobId !== void 0) {
23030
+ if (params.until !== void 0) return toolError("VALIDATION_ERROR", "A job is waited on until it finishes: leave until out.");
23031
+ if (!runs) return toolError("FORBIDDEN", "Waiting on a job needs products:read, which this key lacks.");
23032
+ return waitJob(params.jobId, params, ctx);
23033
+ }
23034
+ const kind = params.initiativeId !== void 0 ? "initiative" : "run";
23035
+ const allowed = UNTIL_FOR[kind];
23036
+ if (params.until === void 0 || !allowed.includes(params.until)) return toolError("VALIDATION_ERROR", `Waiting on ${kind === "initiative" ? "an initiative" : "a run"} takes until: ${allowed.join(", ")}.`);
23037
+ if (kind === "initiative") {
23038
+ if (!items) return toolError("FORBIDDEN", "Waiting on an initiative needs backlog:read, which this key lacks.");
23039
+ return waitInitiative(params.initiativeId, params.until, params, ctx);
23040
+ }
23041
+ if (!runs) return toolError("FORBIDDEN", "Waiting on a run needs products:read, which this key lacks.");
23042
+ return waitRun(params.runId, params.until, params, ctx);
22945
23043
  }));
22946
23044
  }
22947
23045
  //#endregion
@@ -22999,6 +23097,12 @@ function refusedArguments(args) {
22999
23097
  }));
23000
23098
  return toolError("VALIDATION_ERROR", `Invalid arguments for ${tool}. ${lines.map((line) => line.argument ? `${line.argument}: ${line.message}` : line.message).join(" ")}`, { arguments: lines });
23001
23099
  }
23100
+ /** Argument names this release replaced, and what replaced them. */
23101
+ const RENAMED_ARGUMENTS = {
23102
+ repositoryId: "linkId",
23103
+ replacesRepositoryId: "replacesLinkId",
23104
+ productRepositoryId: "linkId"
23105
+ };
23002
23106
  /**
23003
23107
  * A refused call says what to do next (PRO-2841), as a 404 already does. The
23004
23108
  * SDK validates the arguments before the handler runs, where the 404 hints
@@ -23013,6 +23117,8 @@ function withRecoveryHints(tool, schema, inputs, isRead) {
23013
23117
  const hinted = (issue) => {
23014
23118
  if (issue.code === "unrecognized_keys" && issue.keys?.length) {
23015
23119
  const pointers = issue.keys.map((key) => {
23120
+ const renamed = RENAMED_ARGUMENTS[key];
23121
+ if (renamed && (inputs.get(tool) ?? []).includes(renamed)) return `${tool} takes ${renamed}, which replaced ${key}.`;
23016
23122
  const own = ownArgumentLike(key, inputs.get(tool) ?? []);
23017
23123
  if (own) return `${tool} takes ${own}, spelled that way.`;
23018
23124
  const other = closestToolTaking(key, tool, inputs, isRead);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ai/mcp-server",
3
- "version": "0.26.0-rc.514",
3
+ "version": "0.26.0-rc.517",
4
4
  "description": "Taiga for AI coding assistants: read products, policies, initiatives and runs, and operate the line, over MCP",
5
5
  "mcpName": "ga.tai/mcp-server",
6
6
  "type": "module",