@taiga-ai/mcp-server 0.18.0-dev.450 → 0.19.0-dev.451

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.
package/src/tools/wait.ts CHANGED
@@ -8,6 +8,8 @@ import { READ_ONLY } from './annotations.js';
8
8
  import { isNetworkFailure, runTool, toolResult } from './errors.js';
9
9
  import { SETTLED_JOB_STATUSES, jobReport } from './jobs.js';
10
10
  import { criteriaCounts, pickFields } from './summarize.js';
11
+ import { situationOf } from './backlogs.js';
12
+ import { readableRun } from './builds.js';
11
13
 
12
14
  /**
13
15
  * Waiting without a timer. A model in an editor has no clock: to learn that
@@ -285,7 +287,9 @@ function judgeItem(until: ItemCondition, gate: GateDefault) {
285
287
  /** The initiative as a wait reports it: where it is, whose turn, its latest run and its criteria. */
286
288
  function itemReport(item: Item) {
287
289
  const run = latestBuildOf(item);
290
+ const situation = situationOf(item);
288
291
  return {
292
+ ...(situation ? { situation } : {}),
289
293
  ...pickFields(
290
294
  [item],
291
295
  ['id', 'title', 'state', 'planningStatus', 'needsHumanCause', 'needsHumanDetail', 'autoBuild']
@@ -320,6 +324,8 @@ const RUN_REPORT_FIELDS = [
320
324
  'prState',
321
325
  'prDraft',
322
326
  'prMerged',
327
+ 'prNumber',
328
+ 'baseBranch',
323
329
  'actions',
324
330
  ] as const;
325
331
 
@@ -348,7 +354,7 @@ function judgeBuild(until: BuildCondition) {
348
354
  export function registerWaitTools(server: McpServer, client: TaigaClient, options: WaitOptions) {
349
355
  if (client.hasCapability('backlog:read')) {
350
356
  server.registerTool(
351
- 'taiga_wait_for_backlog_item',
357
+ 'taiga_wait_for_initiative',
352
358
  {
353
359
  title: 'Wait for an initiative',
354
360
  description:
@@ -364,7 +370,7 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
364
370
  'settled answers run_settled at once; item is null when not even the first read answered in time. ' +
365
371
  'Planning takes minutes and a build up to an hour.',
366
372
  inputSchema: z.object({
367
- itemId: idInput('backlog item', 'taiga_list_backlog_items (query finds one by title) gives it'),
373
+ initiativeId: idInput('initiative', 'taiga_list_initiatives (query finds one by title) gives it'),
368
374
  until: z.enum(ITEM_CONDITIONS).describe('What to wait for'),
369
375
  timeoutSeconds,
370
376
  }),
@@ -374,7 +380,7 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
374
380
  runTool(async () => {
375
381
  const gate: GateDefault = { product: undefined };
376
382
  const read = async (signal: AbortSignal) => {
377
- const item = (await client.getBacklogItem(params.itemId, signal)).data;
383
+ const item = (await client.getBacklogItem(params.initiativeId, signal)).data;
378
384
  // The product's default, once, when this initiative has no gate of its own to answer with.
379
385
  if (gate.product === undefined && typeof item.autoBuild !== 'boolean') {
380
386
  gate.product = client.hasCapability('products:read')
@@ -413,7 +419,7 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
413
419
 
414
420
  if (client.hasCapability('products:read')) {
415
421
  server.registerTool(
416
- 'taiga_wait_for_build',
422
+ 'taiga_wait_for_run',
417
423
  {
418
424
  title: 'Wait for a run',
419
425
  description:
@@ -425,7 +431,7 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
425
431
  'call again to keep waiting. Conditions are states: a run already settled answers settled at once; run ' +
426
432
  'is null when not even the first read answered in time.',
427
433
  inputSchema: z.object({
428
- buildId: idInput('build run', 'taiga_list_builds gives it'),
434
+ runId: idInput('run', 'taiga_list_runs gives it'),
429
435
  until: z.enum(BUILD_CONDITIONS).describe('What to wait for'),
430
436
  timeoutSeconds,
431
437
  }),
@@ -434,7 +440,7 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
434
440
  (params, ctx) =>
435
441
  runTool(async () => {
436
442
  const result = await waitFor(
437
- async (signal) => (await client.getBuildRun(params.buildId, signal)).data,
443
+ async (signal) => (await client.getBuildRun(params.runId, signal)).data,
438
444
  judgeBuild(params.until),
439
445
  (params.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS) * 1000,
440
446
  options,
@@ -448,7 +454,7 @@ export function registerWaitTools(server: McpServer, client: TaigaClient, option
448
454
  return toolResult({
449
455
  until: params.until,
450
456
  ...outcome,
451
- run: now ? pickFields([now], RUN_REPORT_FIELDS)[0] : null,
457
+ run: now ? readableRun(pickFields([now], RUN_REPORT_FIELDS)[0]!) : null,
452
458
  });
453
459
  })
454
460
  );