@kammcs/buildit-mcp 0.0.0-stage → 0.2.0

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.
@@ -0,0 +1,1413 @@
1
+ /**
2
+ * Tolerant schemas for the agent API's responses: unknown fields are kept, unknown enum values pass, and string formats aren't checked, because the API's v1 only grows.
3
+ *
4
+ * GENERATED by scripts/generate.ts from openapi/openapi.json (agent API
5
+ * 1.2.0). Do not edit: change the contract, then run
6
+ * `npm run generate`.
7
+ */
8
+ import { z } from 'zod';
9
+ /** A string enum that also accepts values added to the API later. */
10
+ function openEnum(_values) {
11
+ return z.string();
12
+ }
13
+ export const AllowedTransitionSchema = z.looseObject({
14
+ to: z.string(),
15
+ required_fields: z.array(z.string()),
16
+ admins_only: z.boolean(),
17
+ });
18
+ export const ChannelNameSchema = z.string();
19
+ export const ChannelRefSchema = z.string();
20
+ export const ChannelVisibilitySchema = openEnum(['public', 'private']);
21
+ export const ColorSchema = z.string();
22
+ export const CommentBodySchema = z.string();
23
+ export const CompleteSprintRequestSchema = z.looseObject({
24
+ carry_to: openEnum(['next', 'new', 'backlog']).optional(),
25
+ });
26
+ export const CursorSchema = z.string();
27
+ export const CustomValueInSchema = z
28
+ .union([z.string(), z.number(), z.boolean(), z.array(z.string())])
29
+ .nullable();
30
+ export const DateSchema = z.string();
31
+ export const DevelopmentBranchSchema = z.looseObject({
32
+ name: z.string(),
33
+ state: openEnum(['active', 'deleted']),
34
+ repo: z.string(),
35
+ url: z.string(),
36
+ });
37
+ export const EmptyRequestSchema = z.looseObject({});
38
+ export const EntityKindSchema = openEnum([
39
+ 'project',
40
+ 'item',
41
+ 'initiative',
42
+ 'status',
43
+ 'type',
44
+ 'label',
45
+ 'field',
46
+ 'option',
47
+ 'user',
48
+ 'sprint',
49
+ 'release',
50
+ 'workflow',
51
+ 'link',
52
+ 'comment',
53
+ 'page',
54
+ 'channel',
55
+ 'message',
56
+ 'plan',
57
+ 'route',
58
+ ]);
59
+ export const EstimateSchema = z.number();
60
+ export const EstimateScaleSchema = openEnum(['none', 'points', 'tshirt']);
61
+ export const FeedbackDeviceSchema = z.looseObject({
62
+ app: z.string().nullable(),
63
+ build: z.string().nullable(),
64
+ platform: z.string().nullable(),
65
+ os: z.string().nullable(),
66
+ form: z.string().nullable(),
67
+ });
68
+ export const FieldKindSchema = openEnum([
69
+ 'text',
70
+ 'number',
71
+ 'date',
72
+ 'single_select',
73
+ 'multi_select',
74
+ 'member',
75
+ 'multi_member',
76
+ 'url',
77
+ 'checkbox',
78
+ ]);
79
+ export const InitiativeKeySchema = z.string();
80
+ export const InitiativeRefSchema = z.string();
81
+ export const ItemCountsSchema = z.looseObject({
82
+ not_started: z.number(),
83
+ started: z.number(),
84
+ done: z.number(),
85
+ canceled: z.number(),
86
+ });
87
+ export const ItemKeySchema = z.string();
88
+ export const ItemLevelSchema = openEnum(['epic', 'standard', 'subtask']);
89
+ export const ItemRefSchema = z.string();
90
+ export const ItemTitleSchema = z.string();
91
+ export const LabelRefSchema = z.string();
92
+ export const LinkCountsSchema = z.looseObject({
93
+ blocks: z.number(),
94
+ blocked_by: z.number(),
95
+ relates: z.number(),
96
+ duplicates: z.number(),
97
+ duplicated_by: z.number(),
98
+ blocked_by_open: z.number(),
99
+ });
100
+ export const LinkKindSchema = openEnum([
101
+ 'blocks',
102
+ 'blocked_by',
103
+ 'relates',
104
+ 'duplicates',
105
+ 'duplicated_by',
106
+ ]);
107
+ export const LocaleSchema = openEnum(['en', 'es-419', 'fr-CA', 'sr-Cyrl', 'sr-Latn']);
108
+ export const MarkdownDescriptionSchema = z.string();
109
+ export const MessageKindSchema = openEnum([
110
+ 'text',
111
+ 'system',
112
+ 'call',
113
+ 'meeting',
114
+ 'work_item',
115
+ 'thread_broadcast',
116
+ ]);
117
+ export const NameRefSchema = z.string();
118
+ export const NewProjectKeySchema = z.string();
119
+ export const OrgRoleSchema = openEnum(['owner', 'admin', 'member', 'guest']);
120
+ export const PageBodySchema = z.string();
121
+ export const PageSearchMatchSchema = z.looseObject({
122
+ score: z.number(),
123
+ title_highlight: z.string(),
124
+ snippet: z.string().nullable(),
125
+ });
126
+ export const PageTitleSchema = z.string();
127
+ export const PlanActionSchema = openEnum([
128
+ 'delete_item',
129
+ 'move_item',
130
+ 'bulk_update',
131
+ 'archive_status',
132
+ 'workflow_change',
133
+ 'work_type_change',
134
+ 'field_change',
135
+ 'label_change',
136
+ ]);
137
+ export const PlanHandleSchema = z.string();
138
+ export const PrioritySchema = openEnum(['none', 'low', 'medium', 'high', 'urgent']);
139
+ export const ProjectKeySchema = z.string();
140
+ export const ProjectRefSchema = z.string();
141
+ export const ProjectTemplateSchema = openEnum([
142
+ 'software_scrum',
143
+ 'software_kanban',
144
+ 'design',
145
+ 'ops',
146
+ 'marketing',
147
+ ]);
148
+ export const RateLimitsSchema = z.looseObject({
149
+ requests_per_minute: z.number(),
150
+ user_requests_per_minute: z.number(),
151
+ writes_per_minute: z.number(),
152
+ writes_per_day: z.number(),
153
+ org_requests_per_minute: z.number(),
154
+ });
155
+ export const ReleaseRefSchema = z.string();
156
+ export const ReleaseStatusSchema = openEnum(['unreleased', 'released', 'archived']);
157
+ export const ScopeSchema = openEnum([
158
+ 'projects:read',
159
+ 'projects:write',
160
+ 'projects:delete',
161
+ 'projects:admin',
162
+ 'pages:read',
163
+ 'pages:write',
164
+ 'chat:read',
165
+ ]);
166
+ export const SearchMatchSchema = z.looseObject({
167
+ score: z.number(),
168
+ title_highlight: z.string(),
169
+ snippet: z.string().nullable(),
170
+ });
171
+ export const SprintRefSchema = z.string();
172
+ export const SprintStateSchema = openEnum(['planned', 'active', 'completed']);
173
+ export const StatusCategorySchema = openEnum(['not_started', 'started', 'done', 'canceled']);
174
+ export const TimestampSchema = z.string();
175
+ export const TransitionMoveSchema = z.looseObject({
176
+ to: z.string(),
177
+ to_id: z.string(),
178
+ required_fields: z.array(z.string()),
179
+ admins_only: z.boolean(),
180
+ });
181
+ export const UserRefSchema = z.string();
182
+ export const UuidSchema = z.string();
183
+ export const WorkflowRefSchema = z.string();
184
+ export const AddCommentRequestSchema = z.looseObject({
185
+ body: CommentBodySchema,
186
+ idempotency_key: UuidSchema.optional(),
187
+ });
188
+ export const AddLinkRequestSchema = z.looseObject({ kind: LinkKindSchema, target: ItemRefSchema });
189
+ export const ArchiveStatusArgsSchema = z.looseObject({
190
+ project: ProjectRefSchema,
191
+ workflow: WorkflowRefSchema.optional(),
192
+ status: NameRefSchema,
193
+ replacement: NameRefSchema,
194
+ });
195
+ export const BoardColumnSchema = z.looseObject({
196
+ id: UuidSchema,
197
+ name: z.string(),
198
+ position: z.number(),
199
+ wip_limit: z.number().nullable(),
200
+ statuses: z.array(z.string()),
201
+ });
202
+ export const ChannelBriefSchema = z.looseObject({ id: UuidSchema, name: z.string() });
203
+ export const CreateChannelRequestSchema = z.looseObject({
204
+ name: ChannelNameSchema,
205
+ description: z.string().optional(),
206
+ visibility: ChannelVisibilitySchema,
207
+ members: z.array(UserRefSchema).optional(),
208
+ idempotency_key: UuidSchema.optional(),
209
+ });
210
+ export const CreatePageRequestSchema = z.looseObject({
211
+ title: PageTitleSchema,
212
+ body: PageBodySchema.optional(),
213
+ parent_id: UuidSchema.optional(),
214
+ position: z.number().optional(),
215
+ idempotency_key: UuidSchema.optional(),
216
+ });
217
+ export const CreateProjectRequestSchema = z.looseObject({
218
+ channel: ChannelRefSchema,
219
+ key: NewProjectKeySchema,
220
+ template: ProjectTemplateSchema.optional(),
221
+ sprints_enabled: z.boolean().optional(),
222
+ releases_enabled: z.boolean().optional(),
223
+ estimate_scale: EstimateScaleSchema.optional(),
224
+ estimate_values: z.array(z.number()).optional(),
225
+ idempotency_key: UuidSchema.optional(),
226
+ });
227
+ export const CreateReleaseRequestSchema = z.looseObject({
228
+ name: z.string(),
229
+ description: z.string().optional(),
230
+ start_date: DateSchema.optional(),
231
+ target_date: DateSchema.optional(),
232
+ });
233
+ export const CreateSprintRequestSchema = z.looseObject({
234
+ name: z.string(),
235
+ goal: z.string().optional(),
236
+ starts_on: DateSchema.optional(),
237
+ ends_on: DateSchema.optional(),
238
+ });
239
+ export const CustomValuesInSchema = z.record(z.string(), CustomValueInSchema);
240
+ export const DeleteItemArgsSchema = z.looseObject({ item: ItemRefSchema });
241
+ export const DescriptionEditSchema = z.union([
242
+ z.looseObject({
243
+ mode: z.literal('replace'),
244
+ text: MarkdownDescriptionSchema,
245
+ description_version: z.number(),
246
+ }),
247
+ z.looseObject({ mode: z.literal('append'), text: MarkdownDescriptionSchema }),
248
+ ]);
249
+ export const DevelopmentCommitSchema = z.looseObject({
250
+ sha: z.string(),
251
+ title: z.string().nullable(),
252
+ repo: z.string(),
253
+ url: z.string(),
254
+ author: z.string().nullable(),
255
+ committed_at: TimestampSchema,
256
+ });
257
+ export const DevelopmentPullRequestSchema = z.looseObject({
258
+ number: z.number(),
259
+ title: z.string().nullable(),
260
+ state: openEnum(['open', 'draft', 'merged', 'closed']),
261
+ repo: z.string(),
262
+ url: z.string(),
263
+ author: z.string().nullable(),
264
+ updated_at: TimestampSchema,
265
+ });
266
+ export const ErrorSchema = z.looseObject({
267
+ error: z.union([
268
+ z.looseObject({
269
+ code: z.literal('bad_request'),
270
+ message: z.string(),
271
+ hint: z.string().optional(),
272
+ details: z.looseObject({}),
273
+ }),
274
+ z.looseObject({
275
+ code: z.literal('token_invalid'),
276
+ message: z.string(),
277
+ hint: z.string().optional(),
278
+ details: z.looseObject({}),
279
+ }),
280
+ z.looseObject({
281
+ code: z.literal('token_expired'),
282
+ message: z.string(),
283
+ hint: z.string().optional(),
284
+ details: z.looseObject({ expired_at: z.string() }),
285
+ }),
286
+ z.looseObject({
287
+ code: z.literal('token_revoked'),
288
+ message: z.string(),
289
+ hint: z.string().optional(),
290
+ details: z.looseObject({ revoked_at: z.string() }),
291
+ }),
292
+ z.looseObject({
293
+ code: z.literal('token_suspended'),
294
+ message: z.string(),
295
+ hint: z.string().optional(),
296
+ details: z.looseObject({}),
297
+ }),
298
+ z.looseObject({
299
+ code: z.literal('agent_access_off'),
300
+ message: z.string(),
301
+ hint: z.string().optional(),
302
+ details: z.looseObject({}),
303
+ }),
304
+ z.looseObject({
305
+ code: z.literal('projects_off'),
306
+ message: z.string(),
307
+ hint: z.string().optional(),
308
+ details: z.looseObject({}),
309
+ }),
310
+ z.looseObject({
311
+ code: z.literal('scope_missing'),
312
+ message: z.string(),
313
+ hint: z.string().optional(),
314
+ details: z.looseObject({
315
+ scope: openEnum([
316
+ 'projects:read',
317
+ 'projects:write',
318
+ 'projects:delete',
319
+ 'projects:admin',
320
+ 'pages:read',
321
+ 'pages:write',
322
+ 'chat:read',
323
+ ]),
324
+ granted: z.array(openEnum([
325
+ 'projects:read',
326
+ 'projects:write',
327
+ 'projects:delete',
328
+ 'projects:admin',
329
+ 'pages:read',
330
+ 'pages:write',
331
+ 'chat:read',
332
+ ])),
333
+ }),
334
+ }),
335
+ z.looseObject({
336
+ code: z.literal('outside_limits'),
337
+ message: z.string(),
338
+ hint: z.string().optional(),
339
+ details: z.looseObject({ kind: openEnum(['project', 'channel']), ref: z.string() }),
340
+ }),
341
+ z.looseObject({
342
+ code: z.literal('forbidden'),
343
+ message: z.string(),
344
+ hint: z.string().optional(),
345
+ details: z.looseObject({
346
+ reason: openEnum(['admins_only', 'not_in_channel', 'not_reporter', 'guest', 'other']),
347
+ }),
348
+ }),
349
+ z.looseObject({
350
+ code: z.literal('archived'),
351
+ message: z.string(),
352
+ hint: z.string().optional(),
353
+ details: z.looseObject({ kind: EntityKindSchema, ref: z.string() }),
354
+ }),
355
+ z.looseObject({
356
+ code: z.literal('not_found'),
357
+ message: z.string(),
358
+ hint: z.string().optional(),
359
+ details: z.looseObject({ kind: EntityKindSchema, ref: z.string() }),
360
+ }),
361
+ z.looseObject({
362
+ code: z.literal('method_not_allowed'),
363
+ message: z.string(),
364
+ hint: z.string().optional(),
365
+ details: z.looseObject({ allowed: z.array(openEnum(['GET', 'POST', 'PATCH', 'DELETE'])) }),
366
+ }),
367
+ z.looseObject({
368
+ code: z.literal('conflict'),
369
+ message: z.string(),
370
+ hint: z.string().optional(),
371
+ details: z.looseObject({
372
+ kind: openEnum(['item', 'description', 'page']),
373
+ current: z.looseObject({
374
+ version: z.number().optional(),
375
+ description_version: z.number().optional(),
376
+ }),
377
+ }),
378
+ }),
379
+ z.looseObject({
380
+ code: z.literal('idempotency_conflict'),
381
+ message: z.string(),
382
+ hint: z.string().optional(),
383
+ details: z.looseObject({ idempotency_key: z.string() }),
384
+ }),
385
+ z.looseObject({
386
+ code: z.literal('plan_used'),
387
+ message: z.string(),
388
+ hint: z.string().optional(),
389
+ details: z.looseObject({ handle: z.string(), used_at: z.string() }),
390
+ }),
391
+ z.looseObject({
392
+ code: z.literal('plan_stale'),
393
+ message: z.string(),
394
+ hint: z.string().optional(),
395
+ details: z.looseObject({
396
+ handle: z.string(),
397
+ changed: z.array(z.looseObject({ kind: EntityKindSchema, ref: z.string() })),
398
+ }),
399
+ }),
400
+ z.looseObject({
401
+ code: z.literal('plan_expired'),
402
+ message: z.string(),
403
+ hint: z.string().optional(),
404
+ details: z.looseObject({ handle: z.string() }),
405
+ }),
406
+ z.looseObject({
407
+ code: z.literal('body_too_large'),
408
+ message: z.string(),
409
+ hint: z.string().optional(),
410
+ details: z.looseObject({ max_bytes: z.number() }),
411
+ }),
412
+ z.looseObject({
413
+ code: z.literal('validation'),
414
+ message: z.string(),
415
+ hint: z.string().optional(),
416
+ details: z.looseObject({
417
+ fields: z.array(z.looseObject({ path: z.string(), message: z.string() })),
418
+ }),
419
+ }),
420
+ z.looseObject({
421
+ code: z.literal('image_layout_invalid'),
422
+ message: z.string(),
423
+ hint: z.string().optional(),
424
+ details: z.looseObject({
425
+ fields: z.array(z.looseObject({ path: z.string(), message: z.string() })),
426
+ }),
427
+ }),
428
+ z.looseObject({
429
+ code: z.literal('ambiguous'),
430
+ message: z.string(),
431
+ hint: z.string().optional(),
432
+ details: z.looseObject({
433
+ kind: EntityKindSchema,
434
+ ref: z.string(),
435
+ candidates: z.array(z.looseObject({ id: z.string(), label: z.string() })),
436
+ }),
437
+ }),
438
+ z.looseObject({
439
+ code: z.literal('transition_not_allowed'),
440
+ message: z.string(),
441
+ hint: z.string().optional(),
442
+ details: z.looseObject({
443
+ from: z.string(),
444
+ to: z.string(),
445
+ allowed: z.array(z.string()),
446
+ required_fields: z.array(z.string()),
447
+ admins_only: z.boolean(),
448
+ moves: z.array(TransitionMoveSchema).optional(),
449
+ }),
450
+ }),
451
+ z.looseObject({
452
+ code: z.literal('field_required'),
453
+ message: z.string(),
454
+ hint: z.string().optional(),
455
+ details: z.looseObject({ fields: z.array(z.string()) }),
456
+ }),
457
+ z.looseObject({
458
+ code: z.literal('bulk_too_large'),
459
+ message: z.string(),
460
+ hint: z.string().optional(),
461
+ details: z.looseObject({ max: z.literal(50), count: z.number() }),
462
+ }),
463
+ z.looseObject({
464
+ code: z.literal('limit_reached'),
465
+ message: z.string(),
466
+ hint: z.string().optional(),
467
+ details: z.looseObject({
468
+ limit: openEnum([
469
+ 'types',
470
+ 'workflows',
471
+ 'statuses',
472
+ 'fields',
473
+ 'labels',
474
+ 'options',
475
+ 'members',
476
+ 'items',
477
+ ]),
478
+ max: z.number(),
479
+ }),
480
+ }),
481
+ z.looseObject({
482
+ code: z.literal('rate_limited'),
483
+ message: z.string(),
484
+ hint: z.string().optional(),
485
+ details: z.looseObject({
486
+ retry_after: z.number(),
487
+ bucket: openEnum([
488
+ 'token_requests_per_minute',
489
+ 'token_writes_per_minute',
490
+ 'token_writes_per_day',
491
+ 'org_requests_per_minute',
492
+ 'user_requests_per_minute',
493
+ ]),
494
+ }),
495
+ }),
496
+ z.looseObject({
497
+ code: z.literal('internal'),
498
+ message: z.string(),
499
+ hint: z.string().optional(),
500
+ details: z.looseObject({}),
501
+ }),
502
+ z.looseObject({
503
+ code: z.literal('unavailable'),
504
+ message: z.string(),
505
+ hint: z.string().optional(),
506
+ details: z.looseObject({}),
507
+ }),
508
+ z.looseObject({
509
+ code: z.literal('release_archived'),
510
+ message: z.string(),
511
+ hint: z.string().optional(),
512
+ details: z.looseObject({ ref: z.string() }),
513
+ }),
514
+ z.looseObject({
515
+ code: z.literal('release_not_released'),
516
+ message: z.string(),
517
+ hint: z.string().optional(),
518
+ details: z.looseObject({ ref: z.string() }),
519
+ }),
520
+ ]),
521
+ });
522
+ export const FeedbackSchema = z.looseObject({
523
+ reporter_name: z.string().nullable(),
524
+ org_name: z.string(),
525
+ org_label: z.string(),
526
+ kind: openEnum(['bug', 'feature']),
527
+ severity: openEnum(['blocker', 'annoying', 'minor']),
528
+ device: FeedbackDeviceSchema,
529
+ plus_ones: z.number(),
530
+ state: openEnum(['open', 'org_off', 'org_deleted', 'reporter_gone', 'blocked', 'ended']),
531
+ });
532
+ export const FieldChangeArgsSchema = z.union([
533
+ z.looseObject({
534
+ op: z.literal('create'),
535
+ project: ProjectRefSchema,
536
+ name: z.string(),
537
+ kind: FieldKindSchema,
538
+ options: z
539
+ .array(z.looseObject({
540
+ id: z.string().optional(),
541
+ label: z.string(),
542
+ color: ColorSchema.nullable().optional(),
543
+ }))
544
+ .optional(),
545
+ types: z.array(NameRefSchema).nullable().optional(),
546
+ required_on_create: z.boolean().optional(),
547
+ position: z.number().optional(),
548
+ }),
549
+ z.looseObject({
550
+ op: z.literal('update'),
551
+ project: ProjectRefSchema,
552
+ field: NameRefSchema,
553
+ name: z.string().optional(),
554
+ options: z
555
+ .array(z.looseObject({
556
+ id: z.string().optional(),
557
+ label: z.string(),
558
+ color: ColorSchema.nullable().optional(),
559
+ }))
560
+ .optional(),
561
+ types: z.array(NameRefSchema).nullable().optional(),
562
+ required_on_create: z.boolean().optional(),
563
+ position: z.number().optional(),
564
+ }),
565
+ z.looseObject({ op: z.literal('archive'), project: ProjectRefSchema, field: NameRefSchema }),
566
+ z.looseObject({ op: z.literal('restore'), project: ProjectRefSchema, field: NameRefSchema }),
567
+ ]);
568
+ export const FieldOptionSchema = z.looseObject({
569
+ id: z.string(),
570
+ label: z.string(),
571
+ color: ColorSchema.nullable(),
572
+ });
573
+ export const InitiativeBriefSchema = z.looseObject({
574
+ id: UuidSchema,
575
+ key: InitiativeKeySchema,
576
+ name: z.string(),
577
+ });
578
+ export const ItemBriefSchema = z.looseObject({
579
+ id: UuidSchema,
580
+ key: ItemKeySchema,
581
+ title: z.string(),
582
+ });
583
+ export const LabelSchema = z.looseObject({
584
+ id: UuidSchema,
585
+ name: z.string(),
586
+ color: ColorSchema.nullable(),
587
+ });
588
+ export const LabelChangeArgsSchema = z.union([
589
+ z.looseObject({
590
+ op: z.literal('create'),
591
+ project: ProjectRefSchema,
592
+ name: z.string(),
593
+ color: ColorSchema.optional(),
594
+ }),
595
+ z.looseObject({
596
+ op: z.literal('update'),
597
+ project: ProjectRefSchema,
598
+ label: LabelRefSchema,
599
+ name: z.string().optional(),
600
+ color: ColorSchema.nullable().optional(),
601
+ }),
602
+ z.looseObject({ op: z.literal('delete'), project: ProjectRefSchema, label: LabelRefSchema }),
603
+ ]);
604
+ export const MessageAuthorSchema = z.looseObject({
605
+ id: UuidSchema,
606
+ display_name: z.string(),
607
+ email: z.string().nullable(),
608
+ type: openEnum(['user', 'app']),
609
+ });
610
+ export const MetaResponseSchema = z.looseObject({
611
+ api_version: z.string(),
612
+ min_mcp_version: z.string(),
613
+ deprecations: z.array(z.looseObject({
614
+ operation: z.string(),
615
+ note: z.string(),
616
+ removed_after: DateSchema.nullable(),
617
+ })),
618
+ operations: z.array(z.string()).optional(),
619
+ });
620
+ export const MoveItemArgsSchema = z.looseObject({
621
+ item: ItemRefSchema,
622
+ project: ProjectRefSchema,
623
+ type: NameRefSchema.optional(),
624
+ status: NameRefSchema.optional(),
625
+ });
626
+ export const OrgMemberSchema = z.looseObject({
627
+ id: UuidSchema,
628
+ display_name: z.string(),
629
+ email: z.string().nullable(),
630
+ role: OrgRoleSchema,
631
+ });
632
+ export const PlanEffectSchema = z.looseObject({
633
+ op: openEnum([
634
+ 'create',
635
+ 'update',
636
+ 'archive',
637
+ 'restore',
638
+ 'delete',
639
+ 'move',
640
+ 'transition',
641
+ 'relabel',
642
+ ]),
643
+ kind: openEnum(['item', 'workflow', 'status', 'transition', 'type', 'field', 'option', 'label']),
644
+ target: z.string(),
645
+ id: UuidSchema.nullable(),
646
+ before: z.unknown(),
647
+ after: z.unknown(),
648
+ });
649
+ export const PlanningItemsRequestSchema = z.looseObject({ items: z.array(ItemRefSchema) });
650
+ export const ProjectBriefSchema = z.looseObject({
651
+ id: UuidSchema,
652
+ key: ProjectKeySchema,
653
+ name: z.string(),
654
+ });
655
+ export const ProjectMemberSchema = z.looseObject({
656
+ id: UuidSchema,
657
+ display_name: z.string(),
658
+ email: z.string().nullable(),
659
+ role: OrgRoleSchema,
660
+ is_project_admin: z.boolean(),
661
+ });
662
+ export const ProjectTypeSchema = z.looseObject({
663
+ id: UuidSchema,
664
+ name: z.string(),
665
+ system_key: z.string().nullable(),
666
+ level: ItemLevelSchema,
667
+ icon: z.string().nullable(),
668
+ color: ColorSchema.nullable(),
669
+ workflow: z.looseObject({ id: UuidSchema, name: z.string() }),
670
+ });
671
+ export const RankPositionSchema = z.looseObject({
672
+ before: ItemRefSchema.optional(),
673
+ after: ItemRefSchema.optional(),
674
+ });
675
+ export const ReleaseSchema = z.looseObject({
676
+ id: UuidSchema,
677
+ name: z.string(),
678
+ description: z.string().nullable(),
679
+ status: ReleaseStatusSchema,
680
+ start_date: DateSchema.nullable(),
681
+ target_date: DateSchema.nullable(),
682
+ released_at: TimestampSchema.nullable(),
683
+ notes_page_id: UuidSchema.nullable(),
684
+ item_count: z.number(),
685
+ done_count: z.number(),
686
+ });
687
+ export const ReleaseBriefSchema = z.looseObject({
688
+ id: UuidSchema,
689
+ name: z.string(),
690
+ status: ReleaseStatusSchema,
691
+ });
692
+ export const ReleaseNotesRequestSchema = z.looseObject({
693
+ locale: LocaleSchema.optional(),
694
+ page_version: z.number().optional(),
695
+ });
696
+ export const ReleaseNotesResponseSchema = z.looseObject({
697
+ page_id: UuidSchema.nullable(),
698
+ page_version: z.number().nullable(),
699
+ created: z.boolean(),
700
+ overwrote_edits: z.boolean(),
701
+ needs_confirmation: z.boolean(),
702
+ markdown: z.string().optional(),
703
+ });
704
+ export const ReleaseVersionRequestSchema = z.looseObject({
705
+ released_on: DateSchema.optional(),
706
+ move_open_to: ReleaseRefSchema.optional(),
707
+ });
708
+ export const RemoveLinkResponseSchema = z.looseObject({ id: UuidSchema, removed: z.boolean() });
709
+ export const SprintSchema = z.looseObject({
710
+ id: UuidSchema,
711
+ number: z.number(),
712
+ name: z.string(),
713
+ goal: z.string().nullable(),
714
+ state: SprintStateSchema,
715
+ starts_on: DateSchema.nullable(),
716
+ ends_on: DateSchema.nullable(),
717
+ started_at: TimestampSchema.nullable(),
718
+ completed_at: TimestampSchema.nullable(),
719
+ item_count: z.number(),
720
+ done_count: z.number(),
721
+ });
722
+ export const SprintBoardMoveSchema = z.looseObject({
723
+ id: UuidSchema,
724
+ key: ItemKeySchema,
725
+ title: z.string(),
726
+ from: z.string(),
727
+ to: z.string(),
728
+ });
729
+ export const SprintBriefSchema = z.looseObject({
730
+ id: UuidSchema,
731
+ number: z.number(),
732
+ name: z.string(),
733
+ state: SprintStateSchema,
734
+ });
735
+ export const SprintNotMovedSchema = z.looseObject({
736
+ id: UuidSchema,
737
+ key: ItemKeySchema,
738
+ title: z.string(),
739
+ status: z.string(),
740
+ reason: openEnum(['no_board_status', 'transition_not_allowed', 'required_fields', 'admins_only']),
741
+ required_fields: z.array(z.string()),
742
+ });
743
+ export const StartSprintRequestSchema = z.looseObject({
744
+ starts_on: DateSchema.optional(),
745
+ ends_on: DateSchema.optional(),
746
+ goal: z.string().optional(),
747
+ });
748
+ export const StatusBriefSchema = z.looseObject({
749
+ id: UuidSchema,
750
+ name: z.string(),
751
+ category: StatusCategorySchema,
752
+ });
753
+ export const TypeBriefSchema = z.looseObject({
754
+ id: UuidSchema,
755
+ name: z.string(),
756
+ level: ItemLevelSchema,
757
+ });
758
+ export const UpdatePageRequestSchema = z.looseObject({
759
+ version: z.number(),
760
+ title: PageTitleSchema.optional(),
761
+ body: PageBodySchema.optional(),
762
+ parent_id: UuidSchema.nullable().optional(),
763
+ position: z.number().optional(),
764
+ });
765
+ export const UpdateReleaseRequestSchema = z.looseObject({
766
+ name: z.string().optional(),
767
+ description: z.string().nullable().optional(),
768
+ start_date: DateSchema.nullable().optional(),
769
+ target_date: DateSchema.nullable().optional(),
770
+ released_on: DateSchema.optional(),
771
+ });
772
+ export const UserSchema = z.looseObject({
773
+ id: UuidSchema,
774
+ display_name: z.string(),
775
+ email: z.string().nullable(),
776
+ });
777
+ export const WorkTypeChangeArgsSchema = z.union([
778
+ z.looseObject({
779
+ op: z.literal('create'),
780
+ name: z.string(),
781
+ level: ItemLevelSchema.optional(),
782
+ icon: z.string().optional(),
783
+ color: ColorSchema.optional(),
784
+ position: z.number().optional(),
785
+ add_to_project: z
786
+ .looseObject({ project: ProjectRefSchema, workflow: WorkflowRefSchema })
787
+ .optional(),
788
+ }),
789
+ z.looseObject({
790
+ op: z.literal('update'),
791
+ type: NameRefSchema,
792
+ name: z.string().optional(),
793
+ icon: z.string().nullable().optional(),
794
+ color: ColorSchema.nullable().optional(),
795
+ position: z.number().optional(),
796
+ }),
797
+ z.looseObject({ op: z.literal('archive'), type: NameRefSchema }),
798
+ z.looseObject({ op: z.literal('restore'), type: NameRefSchema }),
799
+ ]);
800
+ export const WorkflowDefStatusSchema = z.looseObject({
801
+ id: UuidSchema,
802
+ name: z.string().nullable().optional(),
803
+ system_key: openEnum([
804
+ 'backlog',
805
+ 'todo',
806
+ 'in_progress',
807
+ 'in_review',
808
+ 'done',
809
+ 'canceled',
810
+ 'triage',
811
+ 'wont_fix',
812
+ 'requested',
813
+ 'briefed',
814
+ 'changes_requested',
815
+ 'approved',
816
+ 'new',
817
+ 'triaged',
818
+ 'waiting_on_requester',
819
+ 'resolved',
820
+ 'wont_do',
821
+ 'waiting',
822
+ 'reported',
823
+ 'investigating',
824
+ 'mitigated',
825
+ ])
826
+ .nullable()
827
+ .optional(),
828
+ category: StatusCategorySchema,
829
+ color: ColorSchema.nullable().optional(),
830
+ position: z.number().nullable().optional(),
831
+ is_initial: z.boolean().nullable().optional(),
832
+ board_column_id: UuidSchema.nullable().optional(),
833
+ archived_at: TimestampSchema.nullable().optional(),
834
+ });
835
+ export const WorkflowDefTransitionSchema = z.looseObject({
836
+ id: UuidSchema,
837
+ from_status_id: UuidSchema.nullable().optional(),
838
+ to_status_id: UuidSchema,
839
+ required_fields: z.array(z.string()).nullable().optional(),
840
+ admins_only: z.boolean().nullable().optional(),
841
+ });
842
+ export const WorkflowStatusSchema = z.looseObject({
843
+ id: UuidSchema,
844
+ name: z.string(),
845
+ system_key: z.string().nullable(),
846
+ category: StatusCategorySchema,
847
+ color: ColorSchema.nullable(),
848
+ position: z.number(),
849
+ is_initial: z.boolean(),
850
+ board_column: z.string().nullable(),
851
+ allowed: z.array(AllowedTransitionSchema),
852
+ });
853
+ export const BulkPatchSchema = z.looseObject({
854
+ status: NameRefSchema.optional(),
855
+ assignee: UserRefSchema.nullable().optional(),
856
+ priority: PrioritySchema.optional(),
857
+ start_date: DateSchema.nullable().optional(),
858
+ due_date: DateSchema.nullable().optional(),
859
+ estimate: EstimateSchema.nullable().optional(),
860
+ sprint: SprintRefSchema.nullable().optional(),
861
+ fix_release: ReleaseRefSchema.nullable().optional(),
862
+ parent: ItemRefSchema.nullable().optional(),
863
+ initiative: InitiativeRefSchema.nullable().optional(),
864
+ labels: z.array(LabelRefSchema).optional(),
865
+ add_labels: z.array(LabelRefSchema).optional(),
866
+ remove_labels: z.array(LabelRefSchema).optional(),
867
+ custom: CustomValuesInSchema.optional(),
868
+ });
869
+ export const ChannelSchema = z.looseObject({
870
+ id: UuidSchema,
871
+ name: z.string(),
872
+ description: z.string().nullable(),
873
+ visibility: openEnum(['public', 'private']),
874
+ is_org_wide: z.boolean(),
875
+ is_archived: z.boolean(),
876
+ project: ProjectBriefSchema.nullable(),
877
+ last_message_at: TimestampSchema.nullable(),
878
+ });
879
+ export const CommentSchema = z.looseObject({
880
+ id: UuidSchema,
881
+ author: UserSchema.nullable(),
882
+ body: z.string(),
883
+ mentions: z.array(UserSchema),
884
+ created_at: TimestampSchema,
885
+ edited_at: TimestampSchema.nullable(),
886
+ via_agent: z.string().nullable(),
887
+ });
888
+ export const CompleteSprintResponseSchema = z.looseObject({
889
+ sprint: SprintSchema,
890
+ committed_count: z.number(),
891
+ committed_points: z.number(),
892
+ completed_count: z.number(),
893
+ completed_points: z.number(),
894
+ carried_count: z.number(),
895
+ carried_to: SprintBriefSchema.nullable(),
896
+ });
897
+ export const CreateItemRequestSchema = z.looseObject({
898
+ project: ProjectRefSchema.optional(),
899
+ type: NameRefSchema.optional(),
900
+ title: ItemTitleSchema,
901
+ description: MarkdownDescriptionSchema.optional(),
902
+ parent: ItemRefSchema.optional(),
903
+ status: NameRefSchema.optional(),
904
+ assignee: UserRefSchema.optional(),
905
+ priority: PrioritySchema.optional(),
906
+ labels: z.array(LabelRefSchema).optional(),
907
+ estimate: EstimateSchema.optional(),
908
+ start_date: DateSchema.optional(),
909
+ due_date: DateSchema.optional(),
910
+ sprint: SprintRefSchema.optional(),
911
+ fix_release: ReleaseRefSchema.optional(),
912
+ initiative: InitiativeRefSchema.optional(),
913
+ custom: CustomValuesInSchema.optional(),
914
+ position: RankPositionSchema.optional(),
915
+ idempotency_key: UuidSchema.optional(),
916
+ });
917
+ export const CustomValueOutSchema = z.union([
918
+ z.string(),
919
+ z.number(),
920
+ z.boolean(),
921
+ z.array(z.string()),
922
+ UserSchema,
923
+ z.array(UserSchema),
924
+ ]);
925
+ export const DevelopmentSchema = z.looseObject({
926
+ pull_requests: z.array(DevelopmentPullRequestSchema),
927
+ branches: z.array(DevelopmentBranchSchema),
928
+ commits: z.array(DevelopmentCommitSchema),
929
+ counts: z.looseObject({ pull_requests: z.number(), branches: z.number(), commits: z.number() }),
930
+ });
931
+ export const FieldDefSchema = z.looseObject({
932
+ id: UuidSchema,
933
+ name: z.string(),
934
+ kind: FieldKindSchema,
935
+ options: z.array(FieldOptionSchema),
936
+ types: z.array(z.string()).nullable(),
937
+ required_on_create: z.boolean(),
938
+ position: z.number(),
939
+ });
940
+ export const HistoryEventSchema = z.looseObject({
941
+ id: z.number(),
942
+ at: TimestampSchema,
943
+ actor: UserSchema.nullable(),
944
+ via_agent: z.string().nullable(),
945
+ kind: openEnum(['created', 'changed', 'moved', 'linked', 'unlinked', 'deleted', 'imported']),
946
+ field: z.string().nullable(),
947
+ old: z.unknown(),
948
+ new: z.unknown(),
949
+ old_label: z.string().nullable(),
950
+ new_label: z.string().nullable(),
951
+ });
952
+ export const ItemSummarySchema = z.looseObject({
953
+ id: UuidSchema,
954
+ key: ItemKeySchema,
955
+ number: z.number(),
956
+ project: ProjectBriefSchema,
957
+ type: TypeBriefSchema,
958
+ status: StatusBriefSchema,
959
+ title: z.string(),
960
+ priority: PrioritySchema,
961
+ assignee: UserSchema.nullable(),
962
+ reporter: UserSchema.nullable(),
963
+ parent: ItemBriefSchema.nullable(),
964
+ initiative: InitiativeBriefSchema.nullable(),
965
+ labels: z.array(LabelSchema),
966
+ estimate: z.number().nullable(),
967
+ start_date: DateSchema.nullable(),
968
+ due_date: DateSchema.nullable(),
969
+ sprint: SprintBriefSchema.nullable(),
970
+ fix_release: ReleaseBriefSchema.nullable(),
971
+ rank: z.string(),
972
+ version: z.number(),
973
+ description_version: z.number(),
974
+ created_at: TimestampSchema,
975
+ updated_at: TimestampSchema,
976
+ started_at: TimestampSchema.nullable(),
977
+ completed_at: TimestampSchema.nullable(),
978
+ canceled_at: TimestampSchema.nullable(),
979
+ });
980
+ export const LinkedItemSchema = z.looseObject({
981
+ id: UuidSchema,
982
+ key: ItemKeySchema,
983
+ title: z.string(),
984
+ status: StatusBriefSchema,
985
+ });
986
+ export const ListMembersResponseSchema = z.looseObject({
987
+ items: z.array(OrgMemberSchema),
988
+ next_cursor: z.string().nullable(),
989
+ });
990
+ export const ListProjectMembersResponseSchema = z.looseObject({
991
+ items: z.array(ProjectMemberSchema),
992
+ next_cursor: z.string().nullable(),
993
+ });
994
+ export const ListReleasesResponseSchema = z.looseObject({
995
+ items: z.array(ReleaseSchema),
996
+ next_cursor: z.string().nullable(),
997
+ });
998
+ export const ListSprintsResponseSchema = z.looseObject({
999
+ items: z.array(SprintSchema),
1000
+ next_cursor: z.string().nullable(),
1001
+ });
1002
+ export const MeResponseSchema = z.looseObject({
1003
+ user: UserSchema,
1004
+ org: z.looseObject({ id: UuidSchema, name: z.string(), test: z.boolean().optional() }),
1005
+ token: z.looseObject({
1006
+ id: UuidSchema,
1007
+ name: z.string(),
1008
+ scopes: z.array(ScopeSchema),
1009
+ expires_at: TimestampSchema,
1010
+ created_at: TimestampSchema,
1011
+ limits: z.looseObject({
1012
+ projects: z.array(ProjectBriefSchema).nullable(),
1013
+ channels: z.array(ChannelBriefSchema).nullable(),
1014
+ }),
1015
+ }),
1016
+ features: z.looseObject({ projects: z.boolean() }),
1017
+ projects: z.array(ProjectBriefSchema),
1018
+ rate_limits: RateLimitsSchema,
1019
+ });
1020
+ export const MessageSchema = z.looseObject({
1021
+ id: UuidSchema,
1022
+ channel_id: UuidSchema,
1023
+ author: MessageAuthorSchema.nullable(),
1024
+ kind: MessageKindSchema,
1025
+ body: z.string(),
1026
+ code: z.string().nullable(),
1027
+ code_language: z.string().nullable(),
1028
+ file: z
1029
+ .looseObject({
1030
+ id: UuidSchema,
1031
+ name: z.string(),
1032
+ type: z.string(),
1033
+ duration_ms: z.number().nullable(),
1034
+ })
1035
+ .nullable(),
1036
+ photos: z.array(z.looseObject({
1037
+ id: UuidSchema,
1038
+ name: z.string(),
1039
+ type: z.string(),
1040
+ alt: z.string().nullable(),
1041
+ duration_ms: z.number().nullable(),
1042
+ })),
1043
+ mentions: z.array(UserSchema),
1044
+ reply_count: z.number(),
1045
+ last_reply_at: TimestampSchema.nullable(),
1046
+ created_at: TimestampSchema,
1047
+ edited_at: TimestampSchema.nullable(),
1048
+ deleted: z.boolean(),
1049
+ via_agent: z.string().nullable(),
1050
+ });
1051
+ export const PageSchema = z.looseObject({
1052
+ id: UuidSchema,
1053
+ title: z.string(),
1054
+ parent_id: UuidSchema.nullable(),
1055
+ position: z.number(),
1056
+ is_home: z.boolean(),
1057
+ version: z.number(),
1058
+ updated_at: TimestampSchema,
1059
+ updated_by: UserSchema.nullable(),
1060
+ updated_via_agent: z.string().nullable(),
1061
+ channel: ChannelBriefSchema,
1062
+ body: z.string(),
1063
+ created_at: TimestampSchema,
1064
+ created_by: UserSchema.nullable(),
1065
+ });
1066
+ export const PageSearchResultSchema = z.looseObject({
1067
+ id: UuidSchema,
1068
+ title: z.string(),
1069
+ parent_id: UuidSchema.nullable(),
1070
+ channel: ChannelBriefSchema,
1071
+ updated_at: TimestampSchema,
1072
+ match: PageSearchMatchSchema,
1073
+ });
1074
+ export const PageSummarySchema = z.looseObject({
1075
+ id: UuidSchema,
1076
+ title: z.string(),
1077
+ parent_id: UuidSchema.nullable(),
1078
+ position: z.number(),
1079
+ is_home: z.boolean(),
1080
+ version: z.number(),
1081
+ updated_at: TimestampSchema,
1082
+ updated_by: UserSchema.nullable(),
1083
+ updated_via_agent: z.string().nullable(),
1084
+ });
1085
+ export const PlanPreviewSchema = z.looseObject({
1086
+ summary: z.string(),
1087
+ effects: z.array(PlanEffectSchema),
1088
+ item_count: z.number(),
1089
+ warnings: z.array(z.string()),
1090
+ });
1091
+ export const ProjectSummarySchema = z.looseObject({
1092
+ id: UuidSchema,
1093
+ key: ProjectKeySchema,
1094
+ name: z.string(),
1095
+ channel: ChannelBriefSchema,
1096
+ archived: z.boolean(),
1097
+ template_key: z.string(),
1098
+ sprints_enabled: z.boolean(),
1099
+ releases_enabled: z.boolean(),
1100
+ estimate_scale: EstimateScaleSchema,
1101
+ item_counts: ItemCountsSchema,
1102
+ });
1103
+ export const RankItemRequestSchema = RankPositionSchema;
1104
+ export const ReleaseItemsResponseSchema = z.looseObject({
1105
+ release: ReleaseSchema,
1106
+ changed: z.array(ItemBriefSchema),
1107
+ });
1108
+ export const ReleaseResponseSchema = z.looseObject({ release: ReleaseSchema });
1109
+ export const SprintItemsResponseSchema = z.looseObject({
1110
+ sprint: SprintSchema,
1111
+ changed: z.array(ItemBriefSchema),
1112
+ });
1113
+ export const SprintResponseSchema = z.looseObject({ sprint: SprintSchema });
1114
+ export const StartSprintResponseSchema = z.looseObject({
1115
+ sprint: SprintSchema,
1116
+ moved_to_board: z.array(SprintBoardMoveSchema),
1117
+ not_moved: z.array(SprintNotMovedSchema),
1118
+ });
1119
+ export const TransitionSetSchema = z.looseObject({
1120
+ assignee: UserRefSchema.nullable().optional(),
1121
+ estimate: EstimateSchema.nullable().optional(),
1122
+ due_date: DateSchema.nullable().optional(),
1123
+ sprint: SprintRefSchema.nullable().optional(),
1124
+ fix_release: ReleaseRefSchema.nullable().optional(),
1125
+ custom: CustomValuesInSchema.optional(),
1126
+ });
1127
+ export const UpdateItemRequestSchema = z.looseObject({
1128
+ if_version: z.number().optional(),
1129
+ title: ItemTitleSchema.optional(),
1130
+ description: DescriptionEditSchema.optional(),
1131
+ type: NameRefSchema.optional(),
1132
+ status: NameRefSchema.optional(),
1133
+ parent: ItemRefSchema.nullable().optional(),
1134
+ assignee: UserRefSchema.nullable().optional(),
1135
+ priority: PrioritySchema.optional(),
1136
+ labels: z.array(LabelRefSchema).optional(),
1137
+ add_labels: z.array(LabelRefSchema).optional(),
1138
+ remove_labels: z.array(LabelRefSchema).optional(),
1139
+ estimate: EstimateSchema.nullable().optional(),
1140
+ start_date: DateSchema.nullable().optional(),
1141
+ due_date: DateSchema.nullable().optional(),
1142
+ sprint: SprintRefSchema.nullable().optional(),
1143
+ fix_release: ReleaseRefSchema.nullable().optional(),
1144
+ initiative: InitiativeRefSchema.nullable().optional(),
1145
+ custom: CustomValuesInSchema.optional(),
1146
+ });
1147
+ export const WorkTypeSchema = z.looseObject({
1148
+ id: UuidSchema,
1149
+ name: z.string(),
1150
+ system_key: z.string().nullable(),
1151
+ level: ItemLevelSchema,
1152
+ icon: z.string().nullable(),
1153
+ color: ColorSchema.nullable(),
1154
+ position: z.number(),
1155
+ archived: z.boolean(),
1156
+ projects: z.array(z.looseObject({
1157
+ project: ProjectBriefSchema,
1158
+ workflow: z.looseObject({ id: UuidSchema, name: z.string() }),
1159
+ })),
1160
+ });
1161
+ export const WorkflowDefinitionSchema = z.looseObject({
1162
+ workflow: z.looseObject({
1163
+ id: UuidSchema,
1164
+ name: z.string(),
1165
+ restrict_transitions: z.boolean().nullable().optional(),
1166
+ system_key: openEnum(['default', 'bug', 'incident']).nullable().optional(),
1167
+ }),
1168
+ statuses: z.array(WorkflowDefStatusSchema).optional(),
1169
+ transitions: z.array(WorkflowDefTransitionSchema).optional(),
1170
+ type_ids: z.array(UuidSchema).optional(),
1171
+ replacements: z.record(UuidSchema, UuidSchema).optional(),
1172
+ });
1173
+ export const WorkflowSummarySchema = z.looseObject({
1174
+ id: UuidSchema,
1175
+ name: z.string(),
1176
+ system_key: z.string().nullable(),
1177
+ restrict_transitions: z.boolean(),
1178
+ types: z.array(z.string()),
1179
+ statuses: z.array(WorkflowStatusSchema),
1180
+ });
1181
+ export const AddCommentResponseSchema = z.looseObject({
1182
+ comment: CommentSchema,
1183
+ created: z.boolean(),
1184
+ });
1185
+ export const BulkUpdateArgsSchema = z.looseObject({
1186
+ items: z.array(ItemRefSchema),
1187
+ patch: BulkPatchSchema,
1188
+ });
1189
+ export const CreateChannelResponseSchema = z.looseObject({
1190
+ channel: ChannelSchema,
1191
+ members: z.array(UserSchema),
1192
+ created: z.boolean(),
1193
+ });
1194
+ export const CreatePageResponseSchema = z.looseObject({ page: PageSchema, created: z.boolean() });
1195
+ export const CreatePlanResponseSchema = z.looseObject({
1196
+ handle: PlanHandleSchema,
1197
+ action: PlanActionSchema,
1198
+ preview: PlanPreviewSchema,
1199
+ expires_at: TimestampSchema,
1200
+ });
1201
+ export const CreateProjectResponseSchema = z.looseObject({
1202
+ project: ProjectSummarySchema,
1203
+ created: z.boolean(),
1204
+ });
1205
+ export const CustomFieldValueSchema = z.looseObject({
1206
+ field_id: UuidSchema,
1207
+ field: z.string(),
1208
+ kind: FieldKindSchema,
1209
+ value: CustomValueOutSchema,
1210
+ });
1211
+ export const DescribeProjectResponseSchema = z.looseObject({
1212
+ project: z.looseObject({
1213
+ id: UuidSchema,
1214
+ key: ProjectKeySchema,
1215
+ name: z.string(),
1216
+ channel: ChannelBriefSchema,
1217
+ archived: z.boolean(),
1218
+ template_key: z.string(),
1219
+ sprints_enabled: z.boolean(),
1220
+ releases_enabled: z.boolean(),
1221
+ estimate_scale: EstimateScaleSchema,
1222
+ item_counts: ItemCountsSchema,
1223
+ estimate_values: z.array(z.number()),
1224
+ time_zone: z.string(),
1225
+ default_type: z.string().nullable(),
1226
+ }),
1227
+ types: z.array(ProjectTypeSchema),
1228
+ workflows: z.array(WorkflowSummarySchema),
1229
+ board_columns: z.array(BoardColumnSchema),
1230
+ labels: z.array(LabelSchema),
1231
+ fields: z.array(FieldDefSchema),
1232
+ members: z.array(ProjectMemberSchema),
1233
+ });
1234
+ export const GetWorkflowResponseSchema = z.looseObject({
1235
+ project: ProjectBriefSchema,
1236
+ workflow: WorkflowSummarySchema,
1237
+ board_columns: z.array(z.looseObject({ id: UuidSchema, name: z.string() })),
1238
+ fields: z.array(z.looseObject({ id: UuidSchema, name: z.string() })),
1239
+ types: z.array(z.looseObject({ id: UuidSchema, name: z.string() })),
1240
+ workflow_def: WorkflowDefinitionSchema,
1241
+ });
1242
+ export const ItemHistoryResponseSchema = z.looseObject({
1243
+ items: z.array(HistoryEventSchema),
1244
+ next_cursor: z.string().nullable(),
1245
+ });
1246
+ export const LinkSchema = z.looseObject({
1247
+ id: UuidSchema,
1248
+ kind: LinkKindSchema,
1249
+ item: LinkedItemSchema.nullable(),
1250
+ });
1251
+ export const ListChannelMessagesResponseSchema = z.looseObject({
1252
+ items: z.array(MessageSchema),
1253
+ next_cursor: z.string().nullable(),
1254
+ });
1255
+ export const ListChannelsResponseSchema = z.looseObject({
1256
+ items: z.array(ChannelSchema),
1257
+ next_cursor: z.string().nullable(),
1258
+ });
1259
+ export const ListCommentsResponseSchema = z.looseObject({
1260
+ items: z.array(CommentSchema),
1261
+ next_cursor: z.string().nullable(),
1262
+ });
1263
+ export const ListPagesResponseSchema = z.looseObject({
1264
+ items: z.array(PageSummarySchema),
1265
+ next_cursor: z.string().nullable(),
1266
+ });
1267
+ export const ListProjectsResponseSchema = z.looseObject({
1268
+ items: z.array(ProjectSummarySchema),
1269
+ next_cursor: z.string().nullable(),
1270
+ });
1271
+ export const ListWorkTypesResponseSchema = z.looseObject({ items: z.array(WorkTypeSchema) });
1272
+ export const PageResponseSchema = z.looseObject({ page: PageSchema });
1273
+ export const PlanResultSchema = z.union([
1274
+ z.looseObject({ action: z.literal('delete_item'), deleted: z.array(ItemBriefSchema) }),
1275
+ z.looseObject({
1276
+ action: z.literal('move_item'),
1277
+ item: ItemSummarySchema,
1278
+ old_key: ItemKeySchema,
1279
+ }),
1280
+ z.looseObject({ action: z.literal('bulk_update'), items: z.array(ItemSummarySchema) }),
1281
+ z.looseObject({ action: z.literal('archive_status'), moved_items: z.number() }),
1282
+ z.looseObject({ action: z.literal('workflow_change'), workflow_id: UuidSchema }),
1283
+ z.looseObject({ action: z.literal('work_type_change'), type_id: UuidSchema }),
1284
+ z.looseObject({ action: z.literal('field_change'), field_id: UuidSchema }),
1285
+ z.looseObject({ action: z.literal('label_change'), label_id: UuidSchema }),
1286
+ ]);
1287
+ export const RankItemResponseSchema = z.looseObject({ item: ItemSummarySchema });
1288
+ export const SearchPagesResponseSchema = z.looseObject({
1289
+ items: z.array(PageSearchResultSchema),
1290
+ next_cursor: z.string().nullable(),
1291
+ });
1292
+ export const ThreadResponseSchema = z.looseObject({
1293
+ root: MessageSchema,
1294
+ replies: z.array(MessageSchema),
1295
+ next_cursor: z.string().nullable(),
1296
+ });
1297
+ export const TransitionItemRequestSchema = z.looseObject({
1298
+ status: NameRefSchema,
1299
+ comment: CommentBodySchema.optional(),
1300
+ set: TransitionSetSchema.optional(),
1301
+ if_version: z.number().optional(),
1302
+ });
1303
+ export const TransitionItemResponseSchema = z.looseObject({
1304
+ item: ItemSummarySchema,
1305
+ comment: CommentSchema.nullable(),
1306
+ });
1307
+ export const WorkflowChangeArgsSchema = z.looseObject({
1308
+ project: ProjectRefSchema,
1309
+ workflow_def: WorkflowDefinitionSchema,
1310
+ });
1311
+ export const AddLinkResponseSchema = z.looseObject({ link: LinkSchema, created: z.boolean() });
1312
+ export const ApplyPlanResponseSchema = z.looseObject({
1313
+ handle: PlanHandleSchema,
1314
+ action: PlanActionSchema,
1315
+ applied_at: TimestampSchema,
1316
+ result: PlanResultSchema,
1317
+ });
1318
+ export const CreatePlanRequestSchema = z.union([
1319
+ z.looseObject({ action: z.literal('delete_item'), args: DeleteItemArgsSchema }),
1320
+ z.looseObject({ action: z.literal('move_item'), args: MoveItemArgsSchema }),
1321
+ z.looseObject({ action: z.literal('bulk_update'), args: BulkUpdateArgsSchema }),
1322
+ z.looseObject({ action: z.literal('archive_status'), args: ArchiveStatusArgsSchema }),
1323
+ z.looseObject({ action: z.literal('workflow_change'), args: WorkflowChangeArgsSchema }),
1324
+ z.looseObject({ action: z.literal('work_type_change'), args: WorkTypeChangeArgsSchema }),
1325
+ z.looseObject({ action: z.literal('field_change'), args: FieldChangeArgsSchema }),
1326
+ z.looseObject({ action: z.literal('label_change'), args: LabelChangeArgsSchema }),
1327
+ ]);
1328
+ export const ItemDetailSchema = z.looseObject({
1329
+ id: UuidSchema,
1330
+ key: ItemKeySchema,
1331
+ number: z.number(),
1332
+ project: ProjectBriefSchema,
1333
+ type: TypeBriefSchema,
1334
+ status: StatusBriefSchema,
1335
+ title: z.string(),
1336
+ priority: PrioritySchema,
1337
+ assignee: UserSchema.nullable(),
1338
+ reporter: UserSchema.nullable(),
1339
+ parent: ItemBriefSchema.nullable(),
1340
+ initiative: InitiativeBriefSchema.nullable(),
1341
+ labels: z.array(LabelSchema),
1342
+ estimate: z.number().nullable(),
1343
+ start_date: DateSchema.nullable(),
1344
+ due_date: DateSchema.nullable(),
1345
+ sprint: SprintBriefSchema.nullable(),
1346
+ fix_release: ReleaseBriefSchema.nullable(),
1347
+ rank: z.string(),
1348
+ version: z.number(),
1349
+ description_version: z.number(),
1350
+ created_at: TimestampSchema,
1351
+ updated_at: TimestampSchema,
1352
+ started_at: TimestampSchema.nullable(),
1353
+ completed_at: TimestampSchema.nullable(),
1354
+ canceled_at: TimestampSchema.nullable(),
1355
+ description: z.string(),
1356
+ description_truncated: z.boolean(),
1357
+ description_offset: z.number().optional(),
1358
+ description_next_offset: z.number().nullable().optional(),
1359
+ description_length: z.number().optional(),
1360
+ custom: z.array(CustomFieldValueSchema),
1361
+ });
1362
+ export const ItemSearchResultSchema = z.looseObject({
1363
+ id: UuidSchema,
1364
+ key: ItemKeySchema,
1365
+ number: z.number(),
1366
+ project: ProjectBriefSchema,
1367
+ type: TypeBriefSchema,
1368
+ status: StatusBriefSchema,
1369
+ title: z.string(),
1370
+ priority: PrioritySchema,
1371
+ assignee: UserSchema.nullable(),
1372
+ reporter: UserSchema.nullable(),
1373
+ parent: ItemBriefSchema.nullable(),
1374
+ initiative: InitiativeBriefSchema.nullable(),
1375
+ labels: z.array(LabelSchema),
1376
+ estimate: z.number().nullable(),
1377
+ start_date: DateSchema.nullable(),
1378
+ due_date: DateSchema.nullable(),
1379
+ sprint: SprintBriefSchema.nullable(),
1380
+ fix_release: ReleaseBriefSchema.nullable(),
1381
+ rank: z.string(),
1382
+ version: z.number(),
1383
+ description_version: z.number(),
1384
+ created_at: TimestampSchema,
1385
+ updated_at: TimestampSchema,
1386
+ started_at: TimestampSchema.nullable(),
1387
+ completed_at: TimestampSchema.nullable(),
1388
+ canceled_at: TimestampSchema.nullable(),
1389
+ match: SearchMatchSchema.optional(),
1390
+ link_counts: LinkCountsSchema.optional(),
1391
+ activity_at: TimestampSchema.optional(),
1392
+ description: z.string().optional(),
1393
+ custom: z.array(CustomFieldValueSchema).optional(),
1394
+ });
1395
+ export const CreateItemResponseSchema = z.looseObject({
1396
+ item: ItemDetailSchema,
1397
+ created: z.boolean(),
1398
+ });
1399
+ export const GetItemResponseSchema = z.looseObject({
1400
+ item: ItemDetailSchema,
1401
+ children: z.array(ItemSummarySchema),
1402
+ links: z.array(LinkSchema),
1403
+ comments: z.array(CommentSchema),
1404
+ comments_next_cursor: z.string().nullable(),
1405
+ history: z.array(HistoryEventSchema).optional(),
1406
+ development: DevelopmentSchema.optional(),
1407
+ feedback: FeedbackSchema.optional(),
1408
+ });
1409
+ export const ItemWriteResponseSchema = z.looseObject({ item: ItemDetailSchema });
1410
+ export const SearchItemsResponseSchema = z.looseObject({
1411
+ items: z.array(ItemSearchResultSchema),
1412
+ next_cursor: z.string().nullable(),
1413
+ });