@taiga-ai/mcp-server 0.35.0-rc.746 → 0.35.0-rc.748

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 +59 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23212,6 +23212,9 @@ const PRODUCT_DOCUMENT_DISPLAY_NAMES = {
23212
23212
  const PRODUCT_DOCUMENT_ORIGINS = ["plan", "reality"];
23213
23213
  //#endregion
23214
23214
  //#region ../../packages/types/dist/backlog.js
23215
+ /** Dispositions that end an item's pipeline life: settled work neither blocks
23216
+ * dependants nor counts toward completion denominators. */
23217
+ const SETTLED_BACKLOG_STATUSES = ["done", "canceled"];
23215
23218
  /**
23216
23219
  * The initiative's STORED state on the line board (PRO-1305, phase 1).
23217
23220
  *
@@ -23261,6 +23264,11 @@ const LINE_STATES = [
23261
23264
  "plan",
23262
23265
  "build"
23263
23266
  ];
23267
+ /** Finished work: settled by a person or a merge, or archived. The one
23268
+ * predicate every "can this still move / plan / build" guard reads. */
23269
+ function isSettledOrArchived(item) {
23270
+ return item.archivedAt != null || SETTLED_BACKLOG_STATUSES.includes(item.status);
23271
+ }
23264
23272
  /**
23265
23273
  * The columns a person can drop an initiative into by hand.
23266
23274
  *
@@ -25637,10 +25645,11 @@ function inProductWords(value) {
25637
25645
  const actions = value["actions"];
25638
25646
  if (Array.isArray(actions) && actions.some((action) => WEB_ONLY_ACTIONS.has(String(action)))) {
25639
25647
  const webOnly = actions.filter((action) => WEB_ONLY_ACTIONS.has(String(action)));
25648
+ const said = value["webOnlyActions"];
25640
25649
  value = {
25641
25650
  ...value,
25642
25651
  actions: actions.filter((action) => !WEB_ONLY_ACTIONS.has(String(action))),
25643
- webOnlyActions: webOnly
25652
+ webOnlyActions: [.../* @__PURE__ */ new Set([...Array.isArray(said) ? said : [], ...webOnly])]
25644
25653
  };
25645
25654
  }
25646
25655
  for (const [key, inner] of Object.entries(value)) Object.defineProperty(out, PRODUCT_WORDS[key] ?? key, {
@@ -28041,8 +28050,15 @@ function readableRun(run, opts = {}) {
28041
28050
  const blocking = typeof hardening?.blockingFindings === "number" ? hardening.blockingFindings : 0;
28042
28051
  const named = Array.isArray(hardening?.blocking) ? hardening.blocking : [];
28043
28052
  const scan = scanSaid(hardening);
28053
+ const actions = Array.isArray(run["actions"]) ? run["actions"] : null;
28054
+ const cannotRetry = actions !== null && run["status"] !== "failed" && run["status"] !== "stopped" && actions.includes("retry_from_failed_step");
28055
+ const existingWebOnly = Array.isArray(run["webOnlyActions"]) ? run["webOnlyActions"] : [];
28044
28056
  return {
28045
28057
  ...rest,
28058
+ ...cannotRetry ? {
28059
+ actions: actions.filter((action) => action !== "retry_from_failed_step"),
28060
+ webOnlyActions: [.../* @__PURE__ */ new Set([...existingWebOnly, "retry_from_failed_step"])]
28061
+ } : {},
28046
28062
  ...origin === void 0 ? {} : { origin: origin === "backlog" ? "initiative" : origin },
28047
28063
  ...means ? { failedReasonMeans: means } : {},
28048
28064
  ...scan && scan.gaps + (scan.verdict === "not_scanned" ? 1 : 0) > 0 ? { scanCoverage: scan.said } : {},
@@ -28159,6 +28175,24 @@ function verificationNote(steps) {
28159
28175
  const proseSaid = prose ? `, including step ${String(prose["stepOrder"])}, which changed only documentation` : "";
28160
28176
  return `Taiga's ${always.join(" and ")} check failed after every checked step (${String(first)} to ${String(last)})${proseSaid}. A check failing from the first step on is usually one the repository or the check environment fails throughout, not one each step broke. ` + (reasons.length > 0 ? `Its reason${reasons.length === 1 ? "" : "s"}: ${reasons.slice(0, 3).join("; ")}.` : "It records no reason; each step's headline says what its own run found.");
28161
28177
  }
28178
+ /** What carrying a failed or stopped run on says, from the initiative it belongs to (PRO-1889's resume). */
28179
+ async function carryOnStep(client, run) {
28180
+ const actions = Array.isArray(run["actions"]) ? run["actions"] : [];
28181
+ const initiativeId = run["backlogItemId"];
28182
+ if (run["status"] !== "failed" && run["status"] !== "stopped" || typeof initiativeId !== "string" || !actions.some((action) => action === "resume" || action === "retry_from_failed_step")) return null;
28183
+ try {
28184
+ const item = (await client.getBacklogItem(initiativeId)).data;
28185
+ if (typeof item.status === "string" && isSettledOrArchived({
28186
+ status: item.status,
28187
+ archivedAt: typeof item.archivedAt === "string" ? item.archivedAt : null
28188
+ })) return item.archivedAt != null ? "Its initiative is archived, so there is nothing to resume; unarchive it first." : `Its initiative is ${item.status}, so there is nothing to resume; reopen it first.`;
28189
+ if (typeof item.state === "string" && item.needsHumanCause == null && item.state !== "plan" && item.state !== "build") return `Its initiative is in ${item.state}, not being built, so there is nothing to resume; move it to Queue to have the line build it (taiga_queue_initiative).`;
28190
+ return item.lifecycle?.latestBuild?.id === run["id"] ? `taiga_resume_initiative (initiativeId ${initiativeId}) carries this run on from its first unfinished step, keeping the steps already done (paid work: ask first).` : "A newer run of its initiative supersedes this one; taiga_get_initiative says what applies.";
28191
+ } catch (error) {
28192
+ if (error instanceof TaigaApiError || isNetworkFailure(error)) return null;
28193
+ throw error;
28194
+ }
28195
+ }
28162
28196
  /** readableRun for a list row. */
28163
28197
  const readableRow = (run) => readableRun(run, { row: true });
28164
28198
  /** How many products the org-wide list names; past this a row keeps its productId only. */
@@ -28295,7 +28329,7 @@ function registerBuildTools(server, client) {
28295
28329
  }));
28296
28330
  server.registerTool("taiga_get_run", {
28297
28331
  title: "Get run",
28298
- description: "Read one coding agent run, and why it failed when it did: its outcome, pull request, security pass (scanCoverage names scanners that did not run) and each step with its commit, files and checks. A failed run says where it stopped (stoppedIn) and the line of the error that says why (cause). full: true adds every step's instructions and report. lastReplan says what a request for changes did to the plan the run builds now: the steps it added, edited and dropped. Carry it on from its initiative (taiga_resume_initiative).",
28332
+ description: "Read one coding agent run, and why it failed when it did: its outcome, pull request, security pass (scanCoverage names scanners that did not run) and each step with its commit, files and checks. A failed run says where it stopped (stoppedIn) and the line of the error that says why (cause). full: true adds every step's instructions and report. lastReplan says what a request for changes did to the plan the run builds now: the steps it added, edited and dropped. A failed or stopped run's nextStep says how to carry it on (taiga_resume_initiative on its initiative).",
28299
28333
  inputSchema: object({
28300
28334
  runId,
28301
28335
  full: boolean().optional().describe("Carry each step's complete instructions and report (default false: a summary)")
@@ -28313,8 +28347,10 @@ function registerBuildTools(server, client) {
28313
28347
  };
28314
28348
  const [states, lastReplan] = await Promise.all([initiativeStates(client, [runRow]), runRow.backlogItemId && runRow.planId ? planRevisionOf(client, runRow.backlogItemId, runRow.planId) : Promise.resolve(null)]);
28315
28349
  const waitsForReview = runRow.status === "replanning" && runRow.failedReason === "steer_review";
28350
+ const nextStep = await carryOnStep(client, runRow);
28316
28351
  const readable = {
28317
28352
  ...withInitiativeState(readableRun(runRow), states),
28353
+ ...nextStep ? { nextStep } : {},
28318
28354
  ...lastReplan ? { lastReplan: {
28319
28355
  ...lastReplan,
28320
28356
  waitsForReview
@@ -28667,6 +28703,17 @@ const STAGE = {
28667
28703
  canceled: "Canceled"
28668
28704
  };
28669
28705
  /**
28706
+ * Whether a run can be carried on by taiga_resume_initiative (the API's deriveRunActions, which mirrors
28707
+ * applyUserCommand('resume')): failed or stopped, its pull request not merged, and resume or retry_from_failed_step
28708
+ * among its actions. A run absent, or one without actions (an older API), is taken to be carried on, as before.
28709
+ */
28710
+ function canCarryOn(latestBuild) {
28711
+ if (!latestBuild || typeof latestBuild !== "object") return true;
28712
+ const run = latestBuild;
28713
+ if (!Array.isArray(run.actions)) return true;
28714
+ return (run.status === "failed" || run.status === "stopped") && run.actions.some((action) => action === "resume" || action === "retry_from_failed_step");
28715
+ }
28716
+ /**
28670
28717
  * Where an initiative stands and what moves it on, in one sentence (PRO-2800).
28671
28718
  * Five fields carried it (status, state, planningStatus, needsHumanCause,
28672
28719
  * lifecycle) and a reviewing agent had to read the queue, the initiative and
@@ -28706,7 +28753,7 @@ function situationOf(item) {
28706
28753
  }
28707
28754
  const turn = life.turn === "you" ? "A person's turn" : life.turn === "agent" ? "The agent's turn" : null;
28708
28755
  const handedBack = handbackSaid(build?.reviewEscalation);
28709
- const move = life.cta === "review_pr" && handedBack ? `a person should ${handbackNextStep(build.reviewEscalation, build.provider)}` : stalled && offTheLine || offTheLineStart && life.stage !== "backlog" ? OFF_THE_LINE_MOVE : typeof life.cta === "string" ? CTA_MOVE[life.cta] : void 0;
28756
+ const move = life.cta === "review_pr" && handedBack ? `a person should ${handbackNextStep(build.reviewEscalation, build.provider)}` : stalled && offTheLine || offTheLineStart && life.stage !== "backlog" ? OFF_THE_LINE_MOVE : typeof life.cta === "string" ? life.cta === "resume_build" && !canCarryOn(build) ? CTA_MOVE["retry_build"] : CTA_MOVE[life.cta] : void 0;
28710
28757
  if (requeued) parts.push(`Nothing to do: ${REQUEUED_MOVE}.`);
28711
28758
  else if (life.cta === "view_pr") parts.push(`Nothing to do: ${move}.`);
28712
28759
  else if (turn && move) parts.push(`${turn}: ${move}.`);
@@ -29196,10 +29243,17 @@ function registerReviewGate(server, client) {
29196
29243
  function registerResume(server, client) {
29197
29244
  server.registerTool("taiga_resume_initiative", {
29198
29245
  title: "Resume initiative",
29199
- description: "Carry on an initiative the line stopped on: a failed plan is planned again, a stopped or failed run resumes from its first unfinished step. Refused when nothing is stopped; the initiative's situation says what applies.",
29246
+ description: "Carry on an initiative: a failed plan is planned again; a stopped run, or one that failed for a transient reason (server_orphan, timeout), resumes from its first unfinished step and keeps the steps already done, whether or not the line flagged it. Refused, with the action that applies, when the run cannot be resumed (its pull request closed, or nothing is left to do).",
29200
29247
  inputSchema: object({ initiativeId }),
29201
29248
  annotations: OPERATE
29202
- }, (params) => runTool(async () => outcome((await client.resumeInitiative(params.initiativeId)).data)));
29249
+ }, (params) => runTool(async () => {
29250
+ try {
29251
+ return outcome((await client.resumeInitiative(params.initiativeId)).data);
29252
+ } catch (error) {
29253
+ if (error instanceof TaigaApiError && error.status === 409 && error.details?.["applies"] === "start_over") return toolError("CONFLICT", `${error.apiMessage ?? "This run cannot be resumed."} Starting over is in the web app (the run page); taiga_move_initiative takes the initiative off the line.`, error.details);
29254
+ throw error;
29255
+ }
29256
+ }));
29203
29257
  }
29204
29258
  /**
29205
29259
  * One tool for both verdicts on a plan (PRO-3044): approving and sending back are the same review, and two tools for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ai/mcp-server",
3
- "version": "0.35.0-rc.746",
3
+ "version": "0.35.0-rc.748",
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
  "license": "UNLICENSED",