kantban-cli 0.1.15 → 0.1.16

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,3149 @@
1
+ // src/lib/gate-config.ts
2
+ import { load, JSON_SCHEMA } from "js-yaml";
3
+
4
+ // ../types/dist/api-response.js
5
+ import { z } from "zod";
6
+ var ApiErrorSchema = z.object({
7
+ success: z.literal(false),
8
+ error: z.object({ code: z.string(), message: z.string() })
9
+ });
10
+
11
+ // ../types/dist/common.js
12
+ import { z as z2 } from "zod";
13
+ var IdSchema = z2.string().uuid();
14
+ var SortOrderSchema = z2.enum(["asc", "desc"]);
15
+ var PaginationParamsSchema = z2.object({
16
+ page: z2.coerce.number().int().min(1).default(1),
17
+ limit: z2.coerce.number().int().min(1).max(100).default(20),
18
+ sort_by: z2.string().optional(),
19
+ sort_order: SortOrderSchema.default("asc")
20
+ });
21
+ var TimestampsSchema = z2.object({
22
+ created_at: z2.string().datetime({ offset: true }),
23
+ updated_at: z2.string().datetime({ offset: true })
24
+ });
25
+
26
+ // ../types/dist/user.schema.js
27
+ import { z as z3 } from "zod";
28
+ var UserProfileSchema = z3.object({
29
+ id: z3.string().uuid(),
30
+ display_name: z3.string().min(1),
31
+ avatar_url: z3.string().url().nullable(),
32
+ created_at: z3.string().datetime({ offset: true }),
33
+ updated_at: z3.string().datetime({ offset: true })
34
+ });
35
+ var CreateUserProfileSchema = z3.object({
36
+ display_name: z3.string().min(1),
37
+ avatar_url: z3.string().url().nullable().optional()
38
+ });
39
+ var UpdateUserProfileSchema = z3.object({
40
+ display_name: z3.string().min(1).optional(),
41
+ avatar_url: z3.string().url().nullable().optional()
42
+ });
43
+
44
+ // ../types/dist/project.schema.js
45
+ import { z as z4 } from "zod";
46
+
47
+ // ../types/dist/palette.js
48
+ var PALETTE_KEYS = [
49
+ "red-500",
50
+ "orange-500",
51
+ "amber-500",
52
+ "yellow-500",
53
+ "lime-500",
54
+ "green-500",
55
+ "emerald-500",
56
+ "teal-500",
57
+ "cyan-500",
58
+ "sky-500",
59
+ "blue-500",
60
+ "indigo-500",
61
+ "violet-500",
62
+ "purple-500",
63
+ "fuchsia-500",
64
+ "pink-500",
65
+ "rose-500",
66
+ "stone-500",
67
+ "zinc-500"
68
+ ];
69
+
70
+ // ../types/dist/project.schema.js
71
+ var ProjectRoleSchema = z4.enum(["owner", "admin", "editor", "viewer"]);
72
+ var ProjectSchema = z4.object({
73
+ id: z4.string().uuid(),
74
+ name: z4.string().min(1),
75
+ owner_id: z4.string().uuid(),
76
+ icon: z4.string().nullable().default(null),
77
+ color: z4.string().nullable().default(null),
78
+ ticket_prefix: z4.string().regex(/^[A-Z]{2,10}$/),
79
+ ticket_counter: z4.number().int().nonnegative(),
80
+ created_at: z4.string().datetime({ offset: true }),
81
+ updated_at: z4.string().datetime({ offset: true })
82
+ });
83
+ var ProjectWithRoleSchema = ProjectSchema.extend({
84
+ role: ProjectRoleSchema
85
+ });
86
+ var CreateProjectSchema = z4.object({
87
+ name: z4.string().trim().min(1).max(100),
88
+ ticket_prefix: z4.string().regex(/^[A-Z]{2,10}$/)
89
+ });
90
+ var IconSchema = z4.string().min(1).refine((val) => val.length <= 3 || val.includes("/") || val.includes("."), "Must be 1-3 character initials or a storage path");
91
+ var UpdateProjectSchema = z4.object({
92
+ name: z4.string().trim().min(1).max(100).optional(),
93
+ icon: IconSchema.nullable().optional(),
94
+ color: z4.enum(PALETTE_KEYS).nullable().optional(),
95
+ ticket_prefix: z4.string().regex(/^[A-Z]{2,10}$/).optional()
96
+ });
97
+ var DeleteProjectPreviewSchema = z4.object({
98
+ boards: z4.number().int().nonnegative(),
99
+ tickets: z4.number().int().nonnegative(),
100
+ documents: z4.number().int().nonnegative(),
101
+ doc_spaces: z4.number().int().nonnegative(),
102
+ fields: z4.number().int().nonnegative(),
103
+ members: z4.number().int().nonnegative(),
104
+ conversations: z4.number().int().nonnegative()
105
+ });
106
+
107
+ // ../types/dist/project-member.schema.js
108
+ import { z as z5 } from "zod";
109
+ var ProjectMemberSchema = z5.object({
110
+ id: z5.string().uuid(),
111
+ project_id: z5.string().uuid(),
112
+ user_id: z5.string().uuid(),
113
+ role: ProjectRoleSchema,
114
+ created_at: z5.string().datetime({ offset: true }),
115
+ updated_at: z5.string().datetime({ offset: true })
116
+ });
117
+ var ProjectMemberWithProfileSchema = ProjectMemberSchema.extend({
118
+ user: UserProfileSchema
119
+ });
120
+ var UpdateProjectMemberSchema = z5.object({
121
+ role: z5.enum(["admin", "editor", "viewer"])
122
+ });
123
+
124
+ // ../types/dist/project-invitation.schema.js
125
+ import { z as z6 } from "zod";
126
+ var InvitationStatusSchema = z6.enum(["pending", "accepted", "declined", "revoked"]);
127
+ var ProjectInvitationSchema = z6.object({
128
+ id: z6.string().uuid(),
129
+ project_id: z6.string().uuid(),
130
+ invited_by: z6.string().uuid(),
131
+ email: z6.string().email(),
132
+ role: z6.enum(["admin", "editor", "viewer"]),
133
+ token: z6.string(),
134
+ status: InvitationStatusSchema,
135
+ expires_at: z6.string().datetime({ offset: true }),
136
+ created_at: z6.string().datetime({ offset: true }),
137
+ updated_at: z6.string().datetime({ offset: true })
138
+ });
139
+ var ProjectInvitationWithInviterSchema = ProjectInvitationSchema.extend({
140
+ inviter: UserProfileSchema
141
+ });
142
+ var CreateProjectInvitationSchema = z6.object({
143
+ email: z6.string().email(),
144
+ role: z6.enum(["admin", "editor", "viewer"]).default("editor")
145
+ });
146
+
147
+ // ../types/dist/board.schema.js
148
+ import { z as z8 } from "zod";
149
+
150
+ // ../types/dist/board-member.schema.js
151
+ import { z as z7 } from "zod";
152
+ var BoardRoleSchema = z7.enum(["owner", "admin", "editor", "viewer"]);
153
+ var BoardMemberSchema = z7.object({
154
+ id: z7.string().uuid(),
155
+ board_id: z7.string().uuid(),
156
+ user_id: z7.string().uuid(),
157
+ role: BoardRoleSchema,
158
+ created_at: z7.string().datetime({ offset: true }),
159
+ updated_at: z7.string().datetime({ offset: true })
160
+ });
161
+ var BoardMemberWithProfileSchema = BoardMemberSchema.extend({
162
+ user: UserProfileSchema
163
+ });
164
+ var UpdateBoardMemberSchema = z7.object({
165
+ role: z7.enum(["admin", "editor", "viewer"])
166
+ });
167
+ var AddBoardMemberSchema = z7.object({
168
+ user_id: z7.string().uuid(),
169
+ role: z7.enum(["admin", "editor", "viewer"])
170
+ });
171
+
172
+ // ../types/dist/board.schema.js
173
+ var BoardVisibilitySchema = z8.enum(["public", "private"]);
174
+ var BoardSchema = z8.object({
175
+ id: z8.string().uuid(),
176
+ project_id: z8.string().uuid(),
177
+ name: z8.string().min(1),
178
+ visibility: BoardVisibilitySchema,
179
+ icon: z8.string().nullable().default(null),
180
+ color: z8.string().nullable().default(null),
181
+ circuit_breaker_threshold: z8.number().int().positive().nullable().default(null),
182
+ circuit_breaker_target_id: z8.string().uuid().nullable().default(null),
183
+ created_at: z8.string().datetime({ offset: true }),
184
+ updated_at: z8.string().datetime({ offset: true })
185
+ });
186
+ var BoardWithRoleSchema = BoardSchema.extend({
187
+ role: BoardRoleSchema
188
+ });
189
+ var CreateBoardSchema = z8.object({
190
+ name: z8.string().min(1).max(100),
191
+ create_default_columns: z8.boolean().optional().default(false),
192
+ visibility: BoardVisibilitySchema.optional().default("private")
193
+ });
194
+ var IconSchema2 = z8.string().min(1).refine((val) => val.length <= 3 || val.includes("/") || val.includes("."), "Must be 1-3 character initials or a storage path");
195
+ var UpdateBoardSchema = z8.object({
196
+ name: z8.string().min(1).max(100).optional(),
197
+ visibility: BoardVisibilitySchema.optional(),
198
+ icon: IconSchema2.nullable().optional(),
199
+ color: z8.enum(PALETTE_KEYS).nullable().optional(),
200
+ circuit_breaker_threshold: z8.number().int().positive().nullable().optional(),
201
+ circuit_breaker_target_id: z8.string().uuid().nullable().optional()
202
+ });
203
+ var TicketActionSchema = z8.enum(["move_to_backlog", "archive", "delete"]);
204
+ var DeleteBoardBodySchema = z8.object({
205
+ ticket_action: TicketActionSchema.default("move_to_backlog")
206
+ });
207
+ var DeleteBoardPreviewSchema = z8.object({
208
+ tickets: z8.number().int().nonnegative(),
209
+ columns: z8.number().int().nonnegative(),
210
+ transition_rules: z8.number().int().nonnegative()
211
+ });
212
+
213
+ // ../types/dist/column.schema.js
214
+ import { z as z9 } from "zod";
215
+ var ColumnTypeSchema = z9.enum(["start", "in_progress", "done", "default", "evaluator"]);
216
+ var ArchiveModeSchema = z9.enum(["off", "immediate", "delayed", "manual"]);
217
+ var ColumnSchema = z9.object({
218
+ id: z9.string().uuid(),
219
+ board_id: z9.string().uuid(),
220
+ name: z9.string().min(1),
221
+ color: z9.string(),
222
+ position: z9.number().int(),
223
+ description: z9.string().nullable(),
224
+ column_type: ColumnTypeSchema,
225
+ wip_limit: z9.number().int().nullable(),
226
+ default_assignee_id: z9.string().uuid().nullable(),
227
+ archive_mode: ArchiveModeSchema.default("off"),
228
+ archive_delay_hours: z9.number().positive().nullable().default(null),
229
+ archive_overflow_limit: z9.number().int().positive().nullable().default(null),
230
+ prompt_document_id: z9.string().uuid().nullable().default(null),
231
+ goal: z9.string().nullable().default(null),
232
+ agent_config: z9.record(z9.string(), z9.unknown()).nullable().default(null),
233
+ created_at: z9.string().datetime({ offset: true }),
234
+ updated_at: z9.string().datetime({ offset: true })
235
+ });
236
+ var CreateColumnSchema = z9.object({
237
+ name: z9.string().min(1).max(100),
238
+ color: z9.string().optional()
239
+ });
240
+ var UpdateColumnSchema = z9.object({
241
+ name: z9.string().min(1).max(100).optional(),
242
+ color: z9.string().optional(),
243
+ description: z9.string().nullable().optional(),
244
+ column_type: ColumnTypeSchema.optional(),
245
+ wip_limit: z9.number().int().nullable().optional(),
246
+ default_assignee_id: z9.string().uuid().nullable().optional(),
247
+ archive_mode: ArchiveModeSchema.optional(),
248
+ archive_delay_hours: z9.number().positive().nullable().optional(),
249
+ archive_overflow_limit: z9.number().int().positive().nullable().optional(),
250
+ prompt_document_id: z9.string().uuid().nullable().optional(),
251
+ goal: z9.string().max(1e3).nullable().optional(),
252
+ agent_config: z9.record(z9.string(), z9.unknown()).nullable().optional()
253
+ }).superRefine((data, ctx) => {
254
+ if (data.archive_mode === "delayed" && data.archive_delay_hours == null) {
255
+ ctx.addIssue({
256
+ code: z9.ZodIssueCode.custom,
257
+ message: "archive_delay_hours is required when archive_mode is delayed",
258
+ path: ["archive_delay_hours"]
259
+ });
260
+ }
261
+ });
262
+ var ReorderColumnsSchema = z9.array(z9.object({
263
+ id: z9.string().uuid(),
264
+ position: z9.number().int().nonnegative()
265
+ }));
266
+ var DeleteColumnBodySchema = z9.object({
267
+ ticket_action: TicketActionSchema.default("move_to_backlog")
268
+ });
269
+ var DeleteColumnPreviewSchema = z9.object({
270
+ tickets: z9.number().int().nonnegative(),
271
+ transition_rules_broken: z9.number().int().nonnegative(),
272
+ field_requirements_broken: z9.number().int().nonnegative()
273
+ });
274
+
275
+ // ../types/dist/ticket.schema.js
276
+ import { z as z10 } from "zod";
277
+ var TicketSchema = z10.object({
278
+ id: z10.string().uuid(),
279
+ board_id: z10.string().uuid().nullable(),
280
+ column_id: z10.string().uuid().nullable(),
281
+ project_id: z10.string().uuid(),
282
+ ticket_number: z10.number().int().positive(),
283
+ title: z10.string().min(1).max(500),
284
+ description: z10.string().max(1e4),
285
+ position: z10.number().int(),
286
+ assignee_id: z10.string().uuid().nullable(),
287
+ reporter_id: z10.string().uuid(),
288
+ custom_fields: z10.record(z10.string(), z10.unknown()).default({}),
289
+ created_at: z10.string().datetime({ offset: true }),
290
+ updated_at: z10.string().datetime({ offset: true }),
291
+ archived_at: z10.string().datetime({ offset: true }).nullable().default(null),
292
+ column_entered_at: z10.string().datetime({ offset: true }).nullable().default(null),
293
+ first_active_at: z10.string().datetime({ offset: true }).nullable().default(null),
294
+ done_at: z10.string().datetime({ offset: true }).nullable().default(null),
295
+ backward_transitions: z10.number().int().default(0),
296
+ parent_id: z10.string().uuid().nullable().default(null)
297
+ });
298
+ var TicketWithProfilesSchema = TicketSchema.extend({
299
+ assignee: UserProfileSchema.nullable(),
300
+ reporter: UserProfileSchema
301
+ });
302
+ var CreateTicketSchema = z10.object({
303
+ board_id: z10.string().uuid().nullable().optional().default(null),
304
+ column_id: z10.string().uuid().nullable().optional().default(null),
305
+ title: z10.string().min(1).max(500),
306
+ description: z10.string().max(1e4).optional(),
307
+ assignee_id: z10.string().uuid().nullable().optional(),
308
+ field_values: z10.record(z10.string(), z10.unknown()).optional(),
309
+ parent_id: z10.string().uuid().nullable().optional()
310
+ });
311
+ var UpdateTicketSchema = z10.object({
312
+ title: z10.string().min(1).max(500).optional(),
313
+ description: z10.string().max(1e4).optional(),
314
+ assignee_id: z10.string().uuid().nullable().optional(),
315
+ parent_id: z10.string().uuid().nullable().optional()
316
+ });
317
+ var MoveTicketSchema = z10.object({
318
+ column_id: z10.string().uuid().nullable(),
319
+ position: z10.number().int().nonnegative(),
320
+ handoff: z10.record(z10.string(), z10.unknown()).optional(),
321
+ force: z10.boolean().optional().default(false),
322
+ field_values: z10.record(z10.string(), z10.unknown()).optional().describe("Map of field name \u2192 value. Names are resolved to field IDs server-side.")
323
+ });
324
+ var MoveToBoardSchema = z10.object({
325
+ board_id: z10.string().uuid(),
326
+ column_id: z10.string().uuid()
327
+ });
328
+ var CreateBacklogTicketSchema = z10.object({
329
+ title: z10.string().min(1).max(500),
330
+ description: z10.string().max(1e4).optional(),
331
+ assignee_id: z10.string().uuid().nullable().optional()
332
+ });
333
+ var ReorderTicketsSchema = z10.array(z10.object({
334
+ id: z10.string().uuid(),
335
+ column_id: z10.string().uuid().nullable(),
336
+ position: z10.number().int().nonnegative()
337
+ }));
338
+ var DeleteTicketPreviewSchema = z10.object({
339
+ comments: z10.number().int().nonnegative(),
340
+ attachments: z10.number().int().nonnegative()
341
+ });
342
+
343
+ // ../types/dist/comment.schema.js
344
+ import { z as z11 } from "zod";
345
+ var CommentSchema = z11.object({
346
+ id: z11.string().uuid(),
347
+ ticket_id: z11.string().uuid(),
348
+ author_id: z11.string().uuid(),
349
+ body: z11.string().min(1),
350
+ created_at: z11.string().datetime({ offset: true }),
351
+ updated_at: z11.string().datetime({ offset: true }),
352
+ pinned: z11.boolean().default(false)
353
+ });
354
+ var CommentWithAuthorSchema = CommentSchema.extend({
355
+ author: UserProfileSchema
356
+ });
357
+ var CreateCommentSchema = z11.object({
358
+ body: z11.string().min(1).max(1e4)
359
+ });
360
+ var UpdateCommentSchema = z11.object({
361
+ body: z11.string().min(1).max(1e4).optional(),
362
+ pinned: z11.boolean().optional()
363
+ });
364
+
365
+ // ../types/dist/jobs.schema.js
366
+ import { z as z12 } from "zod";
367
+ var WelcomeEmailJobDataSchema = z12.object({
368
+ userId: z12.string().uuid(),
369
+ email: z12.string().email(),
370
+ displayName: z12.string()
371
+ });
372
+ var InvitationEmailJobDataSchema = z12.object({
373
+ email: z12.string().email(),
374
+ projectName: z12.string(),
375
+ token: z12.string(),
376
+ role: z12.string(),
377
+ invitedBy: z12.string().uuid()
378
+ });
379
+
380
+ // ../types/dist/upload.schema.js
381
+ import { z as z13 } from "zod";
382
+ var UploadResultSchema = z13.object({
383
+ path: z13.string(),
384
+ url: z13.string().url().nullable()
385
+ });
386
+
387
+ // ../types/dist/ticket-attachment.schema.js
388
+ import { z as z14 } from "zod";
389
+ var TicketAttachmentSchema = z14.object({
390
+ id: z14.string().uuid(),
391
+ ticket_id: z14.string().uuid(),
392
+ uploader_id: z14.string().uuid(),
393
+ storage_path: z14.string().min(1),
394
+ file_name: z14.string().min(1),
395
+ mime_type: z14.string().min(1),
396
+ file_size: z14.number().int().positive(),
397
+ created_at: z14.string().datetime({ offset: true })
398
+ });
399
+ var TicketAttachmentWithUrlSchema = TicketAttachmentSchema.extend({
400
+ url: z14.string()
401
+ });
402
+ var CreateTicketAttachmentSchema = z14.object({
403
+ storage_path: z14.string().min(1),
404
+ file_name: z14.string().min(1),
405
+ mime_type: z14.string().min(1),
406
+ file_size: z14.number().int().positive()
407
+ });
408
+
409
+ // ../types/dist/board-ws.schema.js
410
+ import { z as z22 } from "zod";
411
+
412
+ // ../types/dist/field-definition.schema.js
413
+ import { z as z15 } from "zod";
414
+ var FieldTypeSchema = z15.enum([
415
+ "short_text",
416
+ "long_text",
417
+ "rich_text",
418
+ "number",
419
+ "date",
420
+ "single_select",
421
+ "multi_select",
422
+ "checkbox",
423
+ "user",
424
+ "ticket_link",
425
+ "document_link",
426
+ "github_pr"
427
+ ]);
428
+ var CreateFieldTypeSchema = z15.enum([
429
+ "short_text",
430
+ "long_text",
431
+ "rich_text",
432
+ "number",
433
+ "date",
434
+ "single_select",
435
+ "multi_select",
436
+ "checkbox",
437
+ "user",
438
+ "document_link",
439
+ "github_pr"
440
+ ]);
441
+ var SelectOptionSchema = z15.object({
442
+ id: z15.string().uuid(),
443
+ label: z15.string().min(1).max(100),
444
+ color: z15.string()
445
+ });
446
+ var FieldConfigSchema = z15.object({
447
+ placeholder: z15.string().optional(),
448
+ max_length: z15.number().int().positive().optional(),
449
+ regex: z15.string().optional(),
450
+ min: z15.number().optional(),
451
+ max: z15.number().optional(),
452
+ decimals: z15.number().int().min(0).optional(),
453
+ unit: z15.string().optional(),
454
+ allow_past: z15.boolean().optional(),
455
+ allow_time: z15.boolean().optional(),
456
+ options: z15.array(SelectOptionSchema).optional(),
457
+ max_selections: z15.number().int().positive().optional(),
458
+ default_checked: z15.boolean().optional(),
459
+ scope: z15.enum(["board", "project"]).optional(),
460
+ show_checks: z15.boolean().optional(),
461
+ show_reviews: z15.boolean().optional()
462
+ }).default({});
463
+ var FieldDefinitionSchema = z15.object({
464
+ id: z15.string().uuid(),
465
+ project_id: z15.string().uuid(),
466
+ name: z15.string().min(1).max(100),
467
+ type: FieldTypeSchema,
468
+ config: FieldConfigSchema,
469
+ position: z15.number().int(),
470
+ created_at: z15.string().datetime({ offset: true }),
471
+ updated_at: z15.string().datetime({ offset: true })
472
+ });
473
+ var CreateFieldDefinitionSchema = z15.object({
474
+ name: z15.string().min(1).max(100),
475
+ type: FieldTypeSchema,
476
+ config: FieldConfigSchema.optional()
477
+ });
478
+ var UpdateFieldDefinitionSchema = z15.object({
479
+ name: z15.string().min(1).max(100).optional(),
480
+ config: FieldConfigSchema.optional(),
481
+ position: z15.number().int().optional()
482
+ });
483
+ var ReorderFieldDefinitionsSchema = z15.object({
484
+ items: z15.array(z15.object({
485
+ id: z15.string().uuid(),
486
+ position: z15.number().int()
487
+ }))
488
+ });
489
+ var DeleteFieldDefinitionPreviewSchema = z15.object({
490
+ tickets_affected: z15.number().int().nonnegative(),
491
+ field_values: z15.number().int().nonnegative(),
492
+ board_overrides: z15.number().int().nonnegative()
493
+ });
494
+
495
+ // ../types/dist/field-override.schema.js
496
+ import { z as z16 } from "zod";
497
+ var BoardFieldOverrideSchema = z16.object({
498
+ id: z16.string().uuid(),
499
+ board_id: z16.string().uuid(),
500
+ field_id: z16.string().uuid(),
501
+ is_enabled: z16.boolean(),
502
+ is_required: z16.boolean(),
503
+ show_on_card: z16.boolean(),
504
+ position: z16.number().int().nullable(),
505
+ default_value: z16.unknown().nullable(),
506
+ extra_options: z16.array(SelectOptionSchema).nullable(),
507
+ created_at: z16.string().datetime({ offset: true }),
508
+ updated_at: z16.string().datetime({ offset: true })
509
+ });
510
+ var UpsertFieldOverrideSchema = z16.object({
511
+ is_enabled: z16.boolean().optional(),
512
+ is_required: z16.boolean().optional(),
513
+ show_on_card: z16.boolean().optional(),
514
+ position: z16.number().int().nullable().optional(),
515
+ default_value: z16.unknown().nullable().optional(),
516
+ extra_options: z16.array(SelectOptionSchema).nullable().optional()
517
+ });
518
+ var MergedFieldSchema = FieldDefinitionSchema.extend({
519
+ is_enabled: z16.boolean().default(true),
520
+ is_required: z16.boolean().default(false),
521
+ show_on_card: z16.boolean().default(false),
522
+ effective_position: z16.number().int(),
523
+ default_value: z16.unknown().nullable().default(null),
524
+ extra_options: z16.array(SelectOptionSchema).default([]),
525
+ all_options: z16.array(SelectOptionSchema).default([])
526
+ });
527
+
528
+ // ../types/dist/transition-rule.schema.js
529
+ import { z as z17 } from "zod";
530
+ var TransitionRuleStatusSchema = z17.enum(["active", "broken"]);
531
+ var TransitionRuleSchema = z17.object({
532
+ id: z17.string().uuid(),
533
+ board_id: z17.string().uuid(),
534
+ from_column_id: z17.string().uuid().nullable(),
535
+ to_column_id: z17.string().uuid().nullable(),
536
+ from_tombstone_id: z17.string().uuid().nullable(),
537
+ to_tombstone_id: z17.string().uuid().nullable(),
538
+ status: TransitionRuleStatusSchema,
539
+ instruction: z17.string().nullable(),
540
+ created_at: z17.string().datetime({ offset: true }),
541
+ updated_at: z17.string().datetime({ offset: true })
542
+ });
543
+ var TransitionRuleWithTombstoneSchema = TransitionRuleSchema.extend({
544
+ from_tombstone_name: z17.string().nullable().default(null),
545
+ to_tombstone_name: z17.string().nullable().default(null)
546
+ });
547
+ var BulkUpsertTransitionRulesSchema = z17.object({
548
+ rules: z17.array(z17.object({
549
+ from_column_id: z17.string().uuid().nullable(),
550
+ to_column_id: z17.string().uuid(),
551
+ instruction: z17.string().nullable().optional()
552
+ }))
553
+ });
554
+
555
+ // ../types/dist/signal.schema.js
556
+ import { z as z18 } from "zod";
557
+ var SignalScopeTypeSchema = z18.enum(["project", "board", "column", "ticket"]);
558
+ var SignalSourceSchema = z18.enum(["human", "agent"]);
559
+ var SignalSchema = z18.object({
560
+ id: z18.string().uuid(),
561
+ project_id: z18.string().uuid(),
562
+ scope_type: SignalScopeTypeSchema,
563
+ scope_id: z18.string().uuid(),
564
+ content: z18.string().min(1),
565
+ source: SignalSourceSchema,
566
+ created_by: z18.string().uuid().nullable(),
567
+ session_id: z18.string().uuid().nullable(),
568
+ iteration: z18.number().int().nullable(),
569
+ created_at: z18.string().datetime({ offset: true }),
570
+ updated_at: z18.string().datetime({ offset: true })
571
+ });
572
+ var CreateSignalSchema = z18.object({
573
+ scopeType: SignalScopeTypeSchema,
574
+ scopeId: z18.string().uuid(),
575
+ content: z18.string().min(1).max(5e3)
576
+ });
577
+ var UpdateSignalSchema = z18.object({
578
+ content: z18.string().min(1).max(5e3)
579
+ });
580
+ var PromoteSignalSchema = z18.object({
581
+ newScopeType: SignalScopeTypeSchema,
582
+ newScopeId: z18.string().uuid()
583
+ });
584
+
585
+ // ../types/dist/pipeline-session.schema.js
586
+ import { z as z19 } from "zod";
587
+ var InvocationTypeSchema = z19.enum(["heavy", "light", "advisor", "stuck_detection", "orchestrator", "replanner"]);
588
+ var ExitReasonSchema = z19.enum(["moved", "stalled", "error", "max_iterations", "stopped", "deleted"]);
589
+ var PipelineSessionSchema = z19.object({
590
+ id: z19.string().uuid(),
591
+ project_id: z19.string().uuid(),
592
+ board_id: z19.string().uuid(),
593
+ ticket_id: z19.string().uuid().nullable(),
594
+ column_id: z19.string().uuid().nullable(),
595
+ run_id: z19.string().min(1).max(128),
596
+ session_id: z19.string().min(1).max(128),
597
+ model: z19.string().min(1).max(100),
598
+ invocation_type: InvocationTypeSchema,
599
+ iteration: z19.number().int().nullable(),
600
+ tokens_in: z19.number().int().nonnegative(),
601
+ tokens_out: z19.number().int().nonnegative(),
602
+ tool_call_count: z19.number().int().nonnegative(),
603
+ duration_ms: z19.number().int().nonnegative(),
604
+ exit_reason: ExitReasonSchema.nullable(),
605
+ started_at: z19.string().datetime({ offset: true }),
606
+ ended_at: z19.string().datetime({ offset: true }).nullable(),
607
+ created_at: z19.string().datetime({ offset: true }),
608
+ updated_at: z19.string().datetime({ offset: true }).nullable()
609
+ });
610
+ var CreatePipelineSessionSchema = z19.object({
611
+ project_id: z19.string().uuid(),
612
+ board_id: z19.string().uuid(),
613
+ ticket_id: z19.string().uuid().nullable(),
614
+ column_id: z19.string().uuid().nullable(),
615
+ run_id: z19.string().min(1).max(128),
616
+ session_id: z19.string().min(1).max(128),
617
+ model: z19.string().min(1).max(100),
618
+ invocation_type: InvocationTypeSchema,
619
+ iteration: z19.number().int().nullable().optional(),
620
+ started_at: z19.string().datetime({ offset: true }).optional()
621
+ });
622
+ var UpdatePipelineSessionSchema = z19.object({
623
+ tokens_in: z19.number().int().nonnegative(),
624
+ tokens_out: z19.number().int().nonnegative(),
625
+ tool_call_count: z19.number().int().nonnegative(),
626
+ duration_ms: z19.number().int().nonnegative(),
627
+ exit_reason: ExitReasonSchema.nullable(),
628
+ ended_at: z19.string().datetime({ offset: true })
629
+ });
630
+ var PipelineSessionQuerySchema = z19.object({
631
+ ticketId: z19.string().uuid().optional(),
632
+ boardId: z19.string().uuid().optional(),
633
+ sessionId: z19.string().optional(),
634
+ limit: z19.coerce.number().int().min(1).max(100).optional().default(50),
635
+ cursor: z19.string().optional()
636
+ });
637
+
638
+ // ../types/dist/firing-constraint.schema.js
639
+ import { z as z20 } from "zod";
640
+ var FiringConstraintSubjectTypeSchema = z20.enum([
641
+ "column.ticket_count",
642
+ "column.active_loops",
643
+ "column.wip_remaining",
644
+ "column.last_fired_at",
645
+ "board.total_active_loops",
646
+ "board.circuit_breaker_count",
647
+ "backlog.ticket_count",
648
+ "ticket.field_value",
649
+ "time.hour"
650
+ ]);
651
+ var FiringConstraintOperatorSchema = z20.enum(["lt", "lte", "gt", "gte", "eq", "neq"]);
652
+ var FiringConstraintScopeSchema = z20.enum(["column", "ticket"]);
653
+ var FiringConstraintSchema = z20.object({
654
+ id: z20.string().uuid(),
655
+ project_id: z20.string().uuid(),
656
+ board_id: z20.string().uuid(),
657
+ column_id: z20.string().uuid().nullable(),
658
+ name: z20.string().min(1).max(200),
659
+ description: z20.string().nullable(),
660
+ enabled: z20.boolean(),
661
+ subject_type: FiringConstraintSubjectTypeSchema,
662
+ subject_ref: z20.string().nullable(),
663
+ subject_param: z20.string().nullable(),
664
+ operator: FiringConstraintOperatorSchema,
665
+ value: z20.union([z20.number(), z20.string(), z20.boolean()]),
666
+ scope: FiringConstraintScopeSchema,
667
+ notify: z20.boolean(),
668
+ position: z20.number().int(),
669
+ fail_open: z20.boolean(),
670
+ system: z20.boolean(),
671
+ created_at: z20.string().datetime({ offset: true }),
672
+ updated_at: z20.string().datetime({ offset: true })
673
+ });
674
+ var CreateFiringConstraintSchema = z20.object({
675
+ column_id: z20.string().uuid().nullable().optional(),
676
+ name: z20.string().min(1).max(200),
677
+ description: z20.string().nullable().optional(),
678
+ subject_type: FiringConstraintSubjectTypeSchema,
679
+ subject_ref: z20.string().nullable().optional(),
680
+ subject_param: z20.string().nullable().optional(),
681
+ operator: FiringConstraintOperatorSchema,
682
+ value: z20.union([z20.number(), z20.string(), z20.boolean()]),
683
+ scope: FiringConstraintScopeSchema.default("column"),
684
+ notify: z20.boolean().default(false),
685
+ enabled: z20.boolean().default(true),
686
+ fail_open: z20.boolean().default(false),
687
+ system: z20.boolean().default(false)
688
+ });
689
+ var UpdateFiringConstraintSchema = z20.object({
690
+ column_id: z20.string().uuid().nullable().optional(),
691
+ name: z20.string().min(1).max(200).optional(),
692
+ description: z20.string().nullable().optional(),
693
+ enabled: z20.boolean().optional(),
694
+ subject_type: FiringConstraintSubjectTypeSchema.optional(),
695
+ subject_ref: z20.string().nullable().optional(),
696
+ subject_param: z20.string().nullable().optional(),
697
+ operator: FiringConstraintOperatorSchema.optional(),
698
+ value: z20.union([z20.number(), z20.string(), z20.boolean()]).optional(),
699
+ scope: FiringConstraintScopeSchema.optional(),
700
+ notify: z20.boolean().optional(),
701
+ position: z20.number().int().optional(),
702
+ fail_open: z20.boolean().optional()
703
+ });
704
+ var EvaluateFiringConstraintResultSchema = z20.object({
705
+ constraint_id: z20.string().uuid(),
706
+ name: z20.string(),
707
+ column_id: z20.string().uuid().nullable(),
708
+ passed: z20.boolean(),
709
+ resolved_value: z20.union([z20.number(), z20.string(), z20.boolean()]).nullable(),
710
+ threshold: z20.object({
711
+ operator: z20.string(),
712
+ value: z20.union([z20.number(), z20.string(), z20.boolean()])
713
+ }),
714
+ error: z20.string().optional()
715
+ });
716
+ var EvaluateFiringConstraintsResponseSchema = z20.object({
717
+ board_id: z20.string().uuid(),
718
+ results: z20.array(EvaluateFiringConstraintResultSchema),
719
+ summary: z20.object({
720
+ total: z20.number().int(),
721
+ passed: z20.number().int(),
722
+ failed: z20.number().int(),
723
+ errors: z20.number().int()
724
+ })
725
+ });
726
+
727
+ // ../types/dist/pipeline-event.schema.js
728
+ import { z as z21 } from "zod";
729
+ var PipelineEventLayerSchema = z21.enum([
730
+ "gate",
731
+ "advisor",
732
+ "evaluator",
733
+ "constraint",
734
+ "cost",
735
+ "session",
736
+ "replanner"
737
+ ]);
738
+ var PipelineEventSeveritySchema = z21.enum(["info", "warning", "failure"]);
739
+ var PipelineEventSchema = z21.object({
740
+ id: z21.string().uuid(),
741
+ project_id: z21.string().uuid(),
742
+ board_id: z21.string().uuid(),
743
+ ticket_id: z21.string().uuid().nullable(),
744
+ column_id: z21.string().uuid().nullable(),
745
+ run_id: z21.string().nullable(),
746
+ session_id: z21.string().nullable(),
747
+ layer: PipelineEventLayerSchema,
748
+ event_type: z21.string().min(1).max(100),
749
+ severity: PipelineEventSeveritySchema,
750
+ summary: z21.string().min(1).max(1e3),
751
+ detail: z21.record(z21.unknown()).nullable(),
752
+ iteration: z21.number().int().nullable(),
753
+ created_at: z21.string().datetime({ offset: true })
754
+ });
755
+ var CreatePipelineEventSchema = z21.object({
756
+ board_id: z21.string().uuid(),
757
+ ticket_id: z21.string().uuid().nullable().optional(),
758
+ column_id: z21.string().uuid().nullable().optional(),
759
+ run_id: z21.string().nullable().optional(),
760
+ session_id: z21.string().nullable().optional(),
761
+ layer: PipelineEventLayerSchema,
762
+ event_type: z21.string().min(1).max(100),
763
+ severity: PipelineEventSeveritySchema,
764
+ summary: z21.string().min(1).max(1e3),
765
+ detail: z21.record(z21.unknown()).nullable().optional(),
766
+ iteration: z21.number().int().nullable().optional()
767
+ });
768
+ var CreatePipelineEventBatchSchema = z21.object({
769
+ events: z21.array(CreatePipelineEventSchema).min(1).max(100)
770
+ });
771
+
772
+ // ../types/dist/board-ws.schema.js
773
+ var WsActorSchema = z22.object({
774
+ id: z22.string().uuid(),
775
+ displayName: z22.string()
776
+ }).nullable();
777
+ var WsBoardSubscribeSchema = z22.object({
778
+ type: z22.literal("board:subscribe"),
779
+ payload: z22.object({
780
+ boardId: z22.string().uuid(),
781
+ projectId: z22.string().uuid()
782
+ })
783
+ });
784
+ var WsBoardUnsubscribeSchema = z22.object({
785
+ type: z22.literal("board:unsubscribe"),
786
+ payload: z22.object({
787
+ boardId: z22.string().uuid()
788
+ })
789
+ });
790
+ var pipelineIdString = z22.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/);
791
+ var WsPipelineStreamClientSchema = z22.object({
792
+ type: z22.literal("pipeline:stream"),
793
+ payload: z22.object({
794
+ boardId: z22.string().uuid(),
795
+ ticketId: z22.string().uuid().nullable(),
796
+ columnId: z22.string().uuid().nullable(),
797
+ runId: pipelineIdString,
798
+ sessionId: pipelineIdString,
799
+ event: z22.record(z22.unknown())
800
+ })
801
+ });
802
+ var WsPipelineSessionStartClientSchema = z22.object({
803
+ type: z22.literal("pipeline:session-start"),
804
+ payload: z22.object({
805
+ boardId: z22.string().uuid(),
806
+ ticketId: z22.string().uuid().nullable(),
807
+ columnId: z22.string().uuid().nullable(),
808
+ runId: pipelineIdString,
809
+ sessionId: pipelineIdString,
810
+ model: z22.string(),
811
+ invocationType: InvocationTypeSchema,
812
+ iteration: z22.number().int().nullable()
813
+ })
814
+ });
815
+ var WsPipelineSessionEndClientSchema = z22.object({
816
+ type: z22.literal("pipeline:session-end"),
817
+ payload: z22.object({
818
+ boardId: z22.string().uuid(),
819
+ runId: pipelineIdString,
820
+ exitReason: ExitReasonSchema.nullable(),
821
+ tokensIn: z22.number().int().nonnegative(),
822
+ tokensOut: z22.number().int().nonnegative(),
823
+ toolCallCount: z22.number().int().nonnegative(),
824
+ durationMs: z22.number().int().nonnegative()
825
+ })
826
+ });
827
+ var WsPipelineStoppedClientSchema = z22.object({
828
+ type: z22.literal("pipeline:stopped"),
829
+ payload: z22.object({
830
+ boardId: z22.string().uuid()
831
+ })
832
+ });
833
+ var WsBoardClientEvents = [
834
+ WsBoardSubscribeSchema,
835
+ WsBoardUnsubscribeSchema,
836
+ WsPipelineStreamClientSchema,
837
+ WsPipelineSessionStartClientSchema,
838
+ WsPipelineSessionEndClientSchema,
839
+ WsPipelineStoppedClientSchema
840
+ ];
841
+ var WsBoardUpdatedSchema = z22.object({
842
+ type: z22.literal("board:updated"),
843
+ payload: z22.object({
844
+ board: BoardWithRoleSchema,
845
+ actor: WsActorSchema
846
+ })
847
+ });
848
+ var WsBoardDeletedSchema = z22.object({
849
+ type: z22.literal("board:deleted"),
850
+ payload: z22.object({
851
+ boardId: z22.string().uuid(),
852
+ actor: WsActorSchema
853
+ })
854
+ });
855
+ var WsBoardSubscribedSchema = z22.object({
856
+ type: z22.literal("board:subscribed"),
857
+ payload: z22.object({
858
+ boardId: z22.string().uuid()
859
+ })
860
+ });
861
+ var WsBoardUnsubscribedSchema = z22.object({
862
+ type: z22.literal("board:unsubscribed"),
863
+ payload: z22.object({
864
+ boardId: z22.string().uuid()
865
+ })
866
+ });
867
+ var WsBoardAccessRevokedSchema = z22.object({
868
+ type: z22.literal("board:access-revoked"),
869
+ payload: z22.object({
870
+ boardId: z22.string().uuid(),
871
+ reason: z22.string()
872
+ })
873
+ });
874
+ var WsColumnCreatedSchema = z22.object({
875
+ type: z22.literal("column:created"),
876
+ payload: z22.object({
877
+ boardId: z22.string().uuid(),
878
+ column: ColumnSchema,
879
+ actor: WsActorSchema
880
+ })
881
+ });
882
+ var WsColumnUpdatedSchema = z22.object({
883
+ type: z22.literal("column:updated"),
884
+ payload: z22.object({
885
+ boardId: z22.string().uuid(),
886
+ column: ColumnSchema,
887
+ actor: WsActorSchema
888
+ })
889
+ });
890
+ var WsColumnDeletedSchema = z22.object({
891
+ type: z22.literal("column:deleted"),
892
+ payload: z22.object({
893
+ columnId: z22.string().uuid(),
894
+ ticketAction: z22.enum(["delete", "archive", "move_to_backlog"]),
895
+ ticketIds: z22.array(z22.string().uuid()),
896
+ actor: WsActorSchema
897
+ })
898
+ });
899
+ var WsColumnReorderedSchema = z22.object({
900
+ type: z22.literal("column:reordered"),
901
+ payload: z22.object({
902
+ boardId: z22.string().uuid(),
903
+ columns: z22.array(z22.object({ id: z22.string().uuid(), position: z22.number().int() })),
904
+ actor: WsActorSchema
905
+ })
906
+ });
907
+ var WsTicketCreatedSchema = z22.object({
908
+ type: z22.literal("ticket:created"),
909
+ payload: z22.object({
910
+ boardId: z22.string().uuid(),
911
+ columnId: z22.string().uuid().nullable(),
912
+ ticket: TicketWithProfilesSchema,
913
+ actor: WsActorSchema
914
+ })
915
+ });
916
+ var WsTicketUpdatedSchema = z22.object({
917
+ type: z22.literal("ticket:updated"),
918
+ payload: z22.object({
919
+ boardId: z22.string().uuid(),
920
+ ticket: TicketWithProfilesSchema,
921
+ actor: WsActorSchema
922
+ })
923
+ });
924
+ var WsTicketDeletedSchema = z22.object({
925
+ type: z22.literal("ticket:deleted"),
926
+ payload: z22.object({
927
+ boardId: z22.string().uuid(),
928
+ ticketId: z22.string().uuid(),
929
+ actor: WsActorSchema
930
+ })
931
+ });
932
+ var WsTicketMovedSchema = z22.object({
933
+ type: z22.literal("ticket:moved"),
934
+ payload: z22.object({
935
+ boardId: z22.string().uuid(),
936
+ ticket: TicketWithProfilesSchema,
937
+ fromColumnId: z22.string().uuid().nullable(),
938
+ actor: WsActorSchema
939
+ })
940
+ });
941
+ var WsTicketReorderedSchema = z22.object({
942
+ type: z22.literal("ticket:reordered"),
943
+ payload: z22.object({
944
+ boardId: z22.string().uuid(),
945
+ tickets: z22.array(z22.object({
946
+ id: z22.string().uuid(),
947
+ columnId: z22.string().uuid().nullable(),
948
+ position: z22.number().int()
949
+ })),
950
+ actor: WsActorSchema
951
+ })
952
+ });
953
+ var WsTicketArchivedSchema = z22.object({
954
+ type: z22.literal("ticket:archived"),
955
+ payload: z22.object({
956
+ boardId: z22.string().uuid(),
957
+ ticketId: z22.string().uuid(),
958
+ archivedAt: z22.string().datetime({ offset: true }),
959
+ actor: WsActorSchema
960
+ })
961
+ });
962
+ var WsTicketUnarchivedSchema = z22.object({
963
+ type: z22.literal("ticket:unarchived"),
964
+ payload: z22.object({
965
+ ticket: TicketWithProfilesSchema,
966
+ actor: WsActorSchema
967
+ })
968
+ });
969
+ var WsTicketBulkArchivedSchema = z22.object({
970
+ type: z22.literal("ticket:bulk-archived"),
971
+ payload: z22.object({
972
+ columnId: z22.string().uuid(),
973
+ ticketIds: z22.array(z22.string().uuid()),
974
+ actor: WsActorSchema
975
+ })
976
+ });
977
+ var WsCommentCreatedSchema = z22.object({
978
+ type: z22.literal("comment:created"),
979
+ payload: z22.object({
980
+ boardId: z22.string().uuid(),
981
+ ticketId: z22.string().uuid(),
982
+ comment: CommentWithAuthorSchema,
983
+ actor: WsActorSchema
984
+ })
985
+ });
986
+ var WsCommentUpdatedSchema = z22.object({
987
+ type: z22.literal("comment:updated"),
988
+ payload: z22.object({
989
+ boardId: z22.string().uuid(),
990
+ ticketId: z22.string().uuid(),
991
+ comment: CommentWithAuthorSchema,
992
+ actor: WsActorSchema
993
+ })
994
+ });
995
+ var WsCommentDeletedSchema = z22.object({
996
+ type: z22.literal("comment:deleted"),
997
+ payload: z22.object({
998
+ boardId: z22.string().uuid(),
999
+ ticketId: z22.string().uuid(),
1000
+ commentId: z22.string().uuid(),
1001
+ actor: WsActorSchema
1002
+ })
1003
+ });
1004
+ var WsAttachmentCreatedSchema = z22.object({
1005
+ type: z22.literal("attachment:created"),
1006
+ payload: z22.object({
1007
+ boardId: z22.string().uuid(),
1008
+ ticketId: z22.string().uuid(),
1009
+ attachment: TicketAttachmentWithUrlSchema,
1010
+ actor: WsActorSchema
1011
+ })
1012
+ });
1013
+ var WsAttachmentDeletedSchema = z22.object({
1014
+ type: z22.literal("attachment:deleted"),
1015
+ payload: z22.object({
1016
+ boardId: z22.string().uuid(),
1017
+ ticketId: z22.string().uuid(),
1018
+ attachmentId: z22.string().uuid(),
1019
+ actor: WsActorSchema
1020
+ })
1021
+ });
1022
+ var WsFieldValueUpdatedSchema = z22.object({
1023
+ type: z22.literal("field-value:updated"),
1024
+ payload: z22.object({
1025
+ ticketId: z22.string().uuid(),
1026
+ fieldId: z22.string().uuid(),
1027
+ value: z22.unknown(),
1028
+ customFields: z22.record(z22.string(), z22.unknown()),
1029
+ actor: WsActorSchema
1030
+ })
1031
+ });
1032
+ var WsFieldValueRemovedSchema = z22.object({
1033
+ type: z22.literal("field-value:removed"),
1034
+ payload: z22.object({
1035
+ ticketId: z22.string().uuid(),
1036
+ fieldId: z22.string().uuid(),
1037
+ customFields: z22.record(z22.string(), z22.unknown()),
1038
+ actor: WsActorSchema
1039
+ })
1040
+ });
1041
+ var WsFieldDefinitionCreatedSchema = z22.object({
1042
+ type: z22.literal("field-definition:created"),
1043
+ payload: z22.object({
1044
+ projectId: z22.string().uuid(),
1045
+ field: FieldDefinitionSchema,
1046
+ actor: WsActorSchema
1047
+ })
1048
+ });
1049
+ var WsFieldDefinitionUpdatedSchema = z22.object({
1050
+ type: z22.literal("field-definition:updated"),
1051
+ payload: z22.object({
1052
+ projectId: z22.string().uuid(),
1053
+ field: FieldDefinitionSchema,
1054
+ actor: WsActorSchema
1055
+ })
1056
+ });
1057
+ var WsFieldDefinitionDeletedSchema = z22.object({
1058
+ type: z22.literal("field-definition:deleted"),
1059
+ payload: z22.object({
1060
+ projectId: z22.string().uuid(),
1061
+ fieldId: z22.string().uuid(),
1062
+ actor: WsActorSchema
1063
+ })
1064
+ });
1065
+ var WsFieldDefinitionReorderedSchema = z22.object({
1066
+ type: z22.literal("field-definition:reordered"),
1067
+ payload: z22.object({
1068
+ projectId: z22.string().uuid(),
1069
+ fields: z22.array(z22.object({ id: z22.string().uuid(), position: z22.number().int() })),
1070
+ actor: WsActorSchema
1071
+ })
1072
+ });
1073
+ var WsFieldOverrideUpdatedSchema = z22.object({
1074
+ type: z22.literal("field-override:updated"),
1075
+ payload: z22.object({
1076
+ boardId: z22.string().uuid(),
1077
+ fieldOverride: BoardFieldOverrideSchema,
1078
+ actor: WsActorSchema
1079
+ })
1080
+ });
1081
+ var WsFieldOverrideDeletedSchema = z22.object({
1082
+ type: z22.literal("field-override:deleted"),
1083
+ payload: z22.object({
1084
+ boardId: z22.string().uuid(),
1085
+ fieldId: z22.string().uuid(),
1086
+ actor: WsActorSchema
1087
+ })
1088
+ });
1089
+ var WsTransitionRulesUpdatedSchema = z22.object({
1090
+ type: z22.literal("transition-rules:updated"),
1091
+ payload: z22.object({
1092
+ boardId: z22.string().uuid(),
1093
+ rules: z22.array(TransitionRuleSchema),
1094
+ actor: WsActorSchema
1095
+ })
1096
+ });
1097
+ var WsBoardMemberAddedSchema = z22.object({
1098
+ type: z22.literal("board-member:added"),
1099
+ payload: z22.object({
1100
+ boardId: z22.string().uuid(),
1101
+ member: BoardMemberWithProfileSchema,
1102
+ actor: WsActorSchema
1103
+ })
1104
+ });
1105
+ var WsBoardMemberUpdatedSchema = z22.object({
1106
+ type: z22.literal("board-member:updated"),
1107
+ payload: z22.object({
1108
+ boardId: z22.string().uuid(),
1109
+ member: BoardMemberWithProfileSchema,
1110
+ actor: WsActorSchema
1111
+ })
1112
+ });
1113
+ var WsBoardMemberRemovedSchema = z22.object({
1114
+ type: z22.literal("board-member:removed"),
1115
+ payload: z22.object({
1116
+ boardId: z22.string().uuid(),
1117
+ userId: z22.string().uuid(),
1118
+ actor: WsActorSchema
1119
+ })
1120
+ });
1121
+ var WsBacklogTicketAddedSchema = z22.object({
1122
+ type: z22.literal("backlog:ticket-added"),
1123
+ payload: z22.object({
1124
+ ticket: TicketWithProfilesSchema,
1125
+ actor: WsActorSchema
1126
+ })
1127
+ });
1128
+ var WsBacklogTicketRemovedSchema = z22.object({
1129
+ type: z22.literal("backlog:ticket-removed"),
1130
+ payload: z22.object({
1131
+ ticketId: z22.string().uuid(),
1132
+ actor: WsActorSchema
1133
+ })
1134
+ });
1135
+ var WsBacklogTicketUpdatedSchema = z22.object({
1136
+ type: z22.literal("backlog:ticket-updated"),
1137
+ payload: z22.object({
1138
+ ticket: TicketWithProfilesSchema,
1139
+ actor: WsActorSchema
1140
+ })
1141
+ });
1142
+ var WsBacklogTicketArchivedSchema = z22.object({
1143
+ type: z22.literal("backlog:ticket-archived"),
1144
+ payload: z22.object({
1145
+ ticketId: z22.string().uuid(),
1146
+ actor: WsActorSchema
1147
+ })
1148
+ });
1149
+ var WsBacklogTicketUnarchivedSchema = z22.object({
1150
+ type: z22.literal("backlog:ticket-unarchived"),
1151
+ payload: z22.object({
1152
+ ticket: TicketWithProfilesSchema,
1153
+ actor: WsActorSchema
1154
+ })
1155
+ });
1156
+ var WsBacklogTicketsAddedSchema = z22.object({
1157
+ type: z22.literal("backlog:tickets-added"),
1158
+ payload: z22.object({
1159
+ ticketIds: z22.array(z22.string().uuid()),
1160
+ projectId: z22.string().uuid()
1161
+ })
1162
+ });
1163
+ var WsBoardlistCreatedSchema = z22.object({
1164
+ type: z22.literal("boardlist:created"),
1165
+ payload: z22.object({
1166
+ projectId: z22.string().uuid(),
1167
+ board: BoardSchema,
1168
+ actor: WsActorSchema
1169
+ })
1170
+ });
1171
+ var WsBoardlistUpdatedSchema = z22.object({
1172
+ type: z22.literal("boardlist:updated"),
1173
+ payload: z22.object({
1174
+ projectId: z22.string().uuid(),
1175
+ board: BoardSchema.partial().extend({ id: z22.string().uuid() }),
1176
+ actor: WsActorSchema
1177
+ })
1178
+ });
1179
+ var WsBoardlistDeletedSchema = z22.object({
1180
+ type: z22.literal("boardlist:deleted"),
1181
+ payload: z22.object({
1182
+ projectId: z22.string().uuid(),
1183
+ boardId: z22.string().uuid(),
1184
+ actor: WsActorSchema
1185
+ })
1186
+ });
1187
+ var WsSignalCreatedSchema = z22.object({
1188
+ type: z22.literal("signal:created"),
1189
+ payload: z22.object({
1190
+ signal: SignalSchema,
1191
+ actor: WsActorSchema
1192
+ })
1193
+ });
1194
+ var WsSignalUpdatedSchema = z22.object({
1195
+ type: z22.literal("signal:updated"),
1196
+ payload: z22.object({
1197
+ signal: SignalSchema,
1198
+ actor: WsActorSchema
1199
+ })
1200
+ });
1201
+ var WsSignalDeletedSchema = z22.object({
1202
+ type: z22.literal("signal:deleted"),
1203
+ payload: z22.object({
1204
+ signalId: z22.string().uuid(),
1205
+ actor: WsActorSchema
1206
+ })
1207
+ });
1208
+ var WsSignalPromotedSchema = z22.object({
1209
+ type: z22.literal("signal:promoted"),
1210
+ payload: z22.object({
1211
+ signal: SignalSchema,
1212
+ actor: WsActorSchema
1213
+ })
1214
+ });
1215
+ var WsFiringConstraintCreatedSchema = z22.object({
1216
+ type: z22.literal("firing_constraint:created"),
1217
+ payload: z22.object({
1218
+ boardId: z22.string().uuid(),
1219
+ constraint: FiringConstraintSchema,
1220
+ actor: WsActorSchema
1221
+ })
1222
+ });
1223
+ var WsFiringConstraintUpdatedSchema = z22.object({
1224
+ type: z22.literal("firing_constraint:updated"),
1225
+ payload: z22.object({
1226
+ boardId: z22.string().uuid(),
1227
+ constraint: FiringConstraintSchema,
1228
+ actor: WsActorSchema
1229
+ })
1230
+ });
1231
+ var WsFiringConstraintDeletedSchema = z22.object({
1232
+ type: z22.literal("firing_constraint:deleted"),
1233
+ payload: z22.object({
1234
+ boardId: z22.string().uuid(),
1235
+ constraintId: z22.string().uuid(),
1236
+ actor: WsActorSchema
1237
+ })
1238
+ });
1239
+ var WsPipelineStreamSchema = z22.object({
1240
+ type: z22.literal("pipeline:stream"),
1241
+ payload: z22.object({
1242
+ boardId: z22.string().uuid(),
1243
+ ticketId: z22.string().uuid().nullable(),
1244
+ columnId: z22.string().uuid().nullable(),
1245
+ runId: pipelineIdString,
1246
+ sessionId: pipelineIdString,
1247
+ event: z22.record(z22.unknown())
1248
+ })
1249
+ });
1250
+ var WsPipelineSessionStartSchema = z22.object({
1251
+ type: z22.literal("pipeline:session-start"),
1252
+ payload: z22.object({
1253
+ boardId: z22.string().uuid(),
1254
+ ticketId: z22.string().uuid().nullable(),
1255
+ columnId: z22.string().uuid().nullable(),
1256
+ runId: pipelineIdString,
1257
+ sessionId: pipelineIdString,
1258
+ model: z22.string(),
1259
+ invocationType: InvocationTypeSchema,
1260
+ iteration: z22.number().int().nullable()
1261
+ })
1262
+ });
1263
+ var WsPipelineSessionEndSchema = z22.object({
1264
+ type: z22.literal("pipeline:session-end"),
1265
+ payload: z22.object({
1266
+ boardId: z22.string().uuid(),
1267
+ runId: pipelineIdString,
1268
+ exitReason: ExitReasonSchema.nullable(),
1269
+ tokensIn: z22.number().int().nonnegative(),
1270
+ tokensOut: z22.number().int().nonnegative(),
1271
+ toolCallCount: z22.number().int().nonnegative(),
1272
+ durationMs: z22.number().int().nonnegative()
1273
+ })
1274
+ });
1275
+ var WsPipelineStoppedSchema = z22.object({
1276
+ type: z22.literal("pipeline:stopped"),
1277
+ payload: z22.object({
1278
+ boardId: z22.string().uuid()
1279
+ })
1280
+ });
1281
+ var WsPipelineEventSchema = z22.object({
1282
+ type: z22.literal("pipeline:event"),
1283
+ payload: PipelineEventSchema
1284
+ });
1285
+ var WsBoardServerEvents = [
1286
+ WsBoardUpdatedSchema,
1287
+ WsBoardDeletedSchema,
1288
+ WsBoardSubscribedSchema,
1289
+ WsBoardUnsubscribedSchema,
1290
+ WsBoardAccessRevokedSchema,
1291
+ WsColumnCreatedSchema,
1292
+ WsColumnUpdatedSchema,
1293
+ WsColumnDeletedSchema,
1294
+ WsColumnReorderedSchema,
1295
+ WsTicketCreatedSchema,
1296
+ WsTicketUpdatedSchema,
1297
+ WsTicketDeletedSchema,
1298
+ WsTicketMovedSchema,
1299
+ WsTicketReorderedSchema,
1300
+ WsTicketArchivedSchema,
1301
+ WsTicketUnarchivedSchema,
1302
+ WsTicketBulkArchivedSchema,
1303
+ WsCommentCreatedSchema,
1304
+ WsCommentUpdatedSchema,
1305
+ WsCommentDeletedSchema,
1306
+ WsAttachmentCreatedSchema,
1307
+ WsAttachmentDeletedSchema,
1308
+ WsFieldValueUpdatedSchema,
1309
+ WsFieldValueRemovedSchema,
1310
+ WsFieldDefinitionCreatedSchema,
1311
+ WsFieldDefinitionUpdatedSchema,
1312
+ WsFieldDefinitionDeletedSchema,
1313
+ WsFieldDefinitionReorderedSchema,
1314
+ WsFieldOverrideUpdatedSchema,
1315
+ WsFieldOverrideDeletedSchema,
1316
+ WsTransitionRulesUpdatedSchema,
1317
+ WsBoardMemberAddedSchema,
1318
+ WsBoardMemberUpdatedSchema,
1319
+ WsBoardMemberRemovedSchema,
1320
+ WsBacklogTicketAddedSchema,
1321
+ WsBacklogTicketRemovedSchema,
1322
+ WsBacklogTicketUpdatedSchema,
1323
+ WsBacklogTicketArchivedSchema,
1324
+ WsBacklogTicketUnarchivedSchema,
1325
+ WsBacklogTicketsAddedSchema,
1326
+ WsBoardlistCreatedSchema,
1327
+ WsBoardlistUpdatedSchema,
1328
+ WsBoardlistDeletedSchema,
1329
+ WsSignalCreatedSchema,
1330
+ WsSignalUpdatedSchema,
1331
+ WsSignalDeletedSchema,
1332
+ WsSignalPromotedSchema,
1333
+ WsFiringConstraintCreatedSchema,
1334
+ WsFiringConstraintUpdatedSchema,
1335
+ WsFiringConstraintDeletedSchema,
1336
+ WsPipelineStreamSchema,
1337
+ WsPipelineSessionStartSchema,
1338
+ WsPipelineSessionEndSchema,
1339
+ WsPipelineStoppedSchema,
1340
+ WsPipelineEventSchema
1341
+ ];
1342
+
1343
+ // ../types/dist/chat.schema.js
1344
+ import { z as z24 } from "zod";
1345
+
1346
+ // ../types/dist/call.schema.js
1347
+ import { z as z23 } from "zod";
1348
+ var CallTypeSchema = z23.enum(["audio", "screen_share"]);
1349
+ var CallStatusSchema = z23.enum(["ringing", "active", "ended", "missed"]);
1350
+ var UserStatusSchema = z23.enum(["online", "away", "in_call", "dnd", "offline"]);
1351
+ var CallSessionSchema = z23.object({
1352
+ id: z23.string().uuid(),
1353
+ project_id: z23.string().uuid(),
1354
+ conversation_id: z23.string().uuid().nullable(),
1355
+ status: CallStatusSchema,
1356
+ created_by: z23.string().uuid(),
1357
+ livekit_room_name: z23.string(),
1358
+ started_at: z23.string().datetime({ offset: true }).nullable(),
1359
+ ended_at: z23.string().datetime({ offset: true }).nullable(),
1360
+ created_at: z23.string().datetime({ offset: true })
1361
+ });
1362
+ var CallParticipantSchema = z23.object({
1363
+ id: z23.string().uuid(),
1364
+ session_id: z23.string().uuid(),
1365
+ user_id: z23.string().uuid(),
1366
+ joined_at: z23.string().datetime({ offset: true }).nullable(),
1367
+ left_at: z23.string().datetime({ offset: true }).nullable()
1368
+ });
1369
+ var CallParticipantWithProfileSchema = CallParticipantSchema.extend({
1370
+ user: UserProfileSchema
1371
+ });
1372
+ var CallSessionWithParticipantsSchema = CallSessionSchema.extend({
1373
+ participants: z23.array(CallParticipantWithProfileSchema),
1374
+ creator: UserProfileSchema
1375
+ });
1376
+ var StartCallSchema = z23.object({
1377
+ conversationId: z23.string().uuid().optional(),
1378
+ participantIds: z23.array(z23.string().uuid()).min(1).max(4)
1379
+ });
1380
+ var JoinCallSchema = z23.object({
1381
+ sessionId: z23.string().uuid()
1382
+ });
1383
+ var CallTokenResponseSchema = z23.object({
1384
+ token: z23.string(),
1385
+ wsUrl: z23.string(),
1386
+ roomName: z23.string(),
1387
+ sessionId: z23.string().uuid()
1388
+ });
1389
+ var WsCallStartSchema = z23.object({
1390
+ type: z23.literal("call:start"),
1391
+ payload: StartCallSchema.extend({
1392
+ projectId: z23.string().uuid()
1393
+ })
1394
+ });
1395
+ var WsCallAcceptSchema = z23.object({
1396
+ type: z23.literal("call:accept"),
1397
+ payload: z23.object({ sessionId: z23.string().uuid() })
1398
+ });
1399
+ var WsCallDeclineSchema = z23.object({
1400
+ type: z23.literal("call:decline"),
1401
+ payload: z23.object({ sessionId: z23.string().uuid() })
1402
+ });
1403
+ var WsCallLeaveSchema = z23.object({
1404
+ type: z23.literal("call:leave"),
1405
+ payload: z23.object({ sessionId: z23.string().uuid() })
1406
+ });
1407
+ var WsCallEndSchema = z23.object({
1408
+ type: z23.literal("call:end"),
1409
+ payload: z23.object({ sessionId: z23.string().uuid() })
1410
+ });
1411
+ var WsStatusSetSchema = z23.object({
1412
+ type: z23.literal("status:set"),
1413
+ payload: z23.object({ status: z23.enum(["online", "away", "dnd"]) })
1414
+ });
1415
+ var WsServerCallRingSchema = z23.object({
1416
+ type: z23.literal("call:ring"),
1417
+ payload: z23.object({
1418
+ sessionId: z23.string().uuid(),
1419
+ projectId: z23.string().uuid(),
1420
+ conversationId: z23.string().uuid().nullable(),
1421
+ callerId: z23.string().uuid(),
1422
+ callerName: z23.string(),
1423
+ participantIds: z23.array(z23.string().uuid())
1424
+ })
1425
+ });
1426
+ var WsServerCallStartedSchema = z23.object({
1427
+ type: z23.literal("call:started"),
1428
+ payload: z23.object({
1429
+ sessionId: z23.string().uuid(),
1430
+ projectId: z23.string().uuid(),
1431
+ conversationId: z23.string().uuid().nullable()
1432
+ })
1433
+ });
1434
+ var WsServerCallParticipantJoinedSchema = z23.object({
1435
+ type: z23.literal("call:participant-joined"),
1436
+ payload: z23.object({
1437
+ sessionId: z23.string().uuid(),
1438
+ userId: z23.string().uuid(),
1439
+ displayName: z23.string()
1440
+ })
1441
+ });
1442
+ var WsServerCallParticipantLeftSchema = z23.object({
1443
+ type: z23.literal("call:participant-left"),
1444
+ payload: z23.object({
1445
+ sessionId: z23.string().uuid(),
1446
+ userId: z23.string().uuid()
1447
+ })
1448
+ });
1449
+ var WsServerCallEndedSchema = z23.object({
1450
+ type: z23.literal("call:ended"),
1451
+ payload: z23.object({
1452
+ sessionId: z23.string().uuid(),
1453
+ projectId: z23.string().uuid()
1454
+ })
1455
+ });
1456
+ var WsServerCallDeclinedSchema = z23.object({
1457
+ type: z23.literal("call:declined"),
1458
+ payload: z23.object({
1459
+ sessionId: z23.string().uuid(),
1460
+ userId: z23.string().uuid()
1461
+ })
1462
+ });
1463
+ var WsServerCallMissedSchema = z23.object({
1464
+ type: z23.literal("call:missed"),
1465
+ payload: z23.object({
1466
+ sessionId: z23.string().uuid(),
1467
+ projectId: z23.string().uuid(),
1468
+ callerId: z23.string().uuid(),
1469
+ callerName: z23.string()
1470
+ })
1471
+ });
1472
+ var WsServerStatusUpdateSchema = z23.object({
1473
+ type: z23.literal("status:update"),
1474
+ payload: z23.object({
1475
+ userId: z23.string().uuid(),
1476
+ status: UserStatusSchema
1477
+ })
1478
+ });
1479
+
1480
+ // ../types/dist/chat.schema.js
1481
+ var ChatConversationTypeSchema = z24.enum(["group", "direct"]);
1482
+ var PushPlatformSchema = z24.enum(["web", "ios", "android"]);
1483
+ var ChatConversationSchema = z24.object({
1484
+ id: z24.string().uuid(),
1485
+ project_id: z24.string().uuid(),
1486
+ type: ChatConversationTypeSchema,
1487
+ name: z24.string().nullable(),
1488
+ created_by: z24.string().uuid(),
1489
+ created_at: z24.string().datetime({ offset: true }),
1490
+ updated_at: z24.string().datetime({ offset: true })
1491
+ });
1492
+ var MessagePreviewSchema = z24.object({
1493
+ id: z24.string().uuid(),
1494
+ body: z24.string(),
1495
+ sender_id: z24.string().uuid(),
1496
+ created_at: z24.string().datetime({ offset: true })
1497
+ });
1498
+ var ChatConversationWithPreviewSchema = ChatConversationSchema.extend({
1499
+ lastMessage: MessagePreviewSchema.nullable(),
1500
+ unreadCount: z24.number().int().min(0),
1501
+ participants: z24.array(UserProfileSchema),
1502
+ projectName: z24.string(),
1503
+ muted_at: z24.string().datetime({ offset: true }).nullable(),
1504
+ pinned_at: z24.string().datetime({ offset: true }).nullable(),
1505
+ enter_sends_override: z24.boolean().nullable().default(null)
1506
+ });
1507
+ var ChatParticipantSchema = z24.object({
1508
+ id: z24.string().uuid(),
1509
+ conversation_id: z24.string().uuid(),
1510
+ user_id: z24.string().uuid(),
1511
+ joined_at: z24.string().datetime({ offset: true }),
1512
+ left_at: z24.string().datetime({ offset: true }).nullable(),
1513
+ deleted_at: z24.string().datetime({ offset: true }).nullable(),
1514
+ muted_at: z24.string().datetime({ offset: true }).nullable(),
1515
+ pinned_at: z24.string().datetime({ offset: true }).nullable(),
1516
+ enter_sends_override: z24.boolean().nullable().default(null)
1517
+ });
1518
+ var ChatParticipantWithProfileSchema = ChatParticipantSchema.extend({
1519
+ user: UserProfileSchema
1520
+ });
1521
+ var ChatMessageSchema = z24.object({
1522
+ id: z24.string().uuid(),
1523
+ conversation_id: z24.string().uuid(),
1524
+ sender_id: z24.string().uuid(),
1525
+ body: z24.string().min(1).max(4e3),
1526
+ attachment_url: z24.string().nullable(),
1527
+ attachment_type: z24.string().nullable(),
1528
+ mentions: z24.array(z24.string().uuid()),
1529
+ reply_to_id: z24.string().uuid().nullable().default(null),
1530
+ created_at: z24.string().datetime({ offset: true }),
1531
+ updated_at: z24.string().datetime({ offset: true }),
1532
+ deleted_at: z24.string().datetime({ offset: true }).nullable()
1533
+ });
1534
+ var ReplyPreviewSchema = z24.object({
1535
+ id: z24.string().uuid(),
1536
+ sender_id: z24.string().uuid(),
1537
+ sender_name: z24.string(),
1538
+ body: z24.string()
1539
+ });
1540
+ var ReactionAggregateSchema = z24.object({
1541
+ emoji: z24.string().min(1),
1542
+ count: z24.number().int().min(1),
1543
+ userIds: z24.array(z24.string().uuid())
1544
+ });
1545
+ var ChatMessageWithReactionsSchema = ChatMessageSchema.extend({
1546
+ sender: UserProfileSchema,
1547
+ reactions: z24.array(ReactionAggregateSchema),
1548
+ reply_to: ReplyPreviewSchema.nullable().default(null)
1549
+ });
1550
+ var ChatReactionSchema = z24.object({
1551
+ id: z24.string().uuid(),
1552
+ message_id: z24.string().uuid(),
1553
+ user_id: z24.string().uuid(),
1554
+ emoji: z24.string().min(1),
1555
+ created_at: z24.string().datetime({ offset: true })
1556
+ });
1557
+ var ChatReadCursorSchema = z24.object({
1558
+ id: z24.string().uuid(),
1559
+ conversation_id: z24.string().uuid(),
1560
+ user_id: z24.string().uuid(),
1561
+ last_read_message_id: z24.string().uuid(),
1562
+ last_read_at: z24.string().datetime({ offset: true })
1563
+ });
1564
+ var PushSubscriptionSchema = z24.object({
1565
+ id: z24.string().uuid(),
1566
+ user_id: z24.string().uuid(),
1567
+ platform: PushPlatformSchema,
1568
+ token: z24.string().min(1),
1569
+ created_at: z24.string().datetime({ offset: true }),
1570
+ updated_at: z24.string().datetime({ offset: true })
1571
+ });
1572
+ var NotificationPreferencesSchema = z24.object({
1573
+ id: z24.string(),
1574
+ user_id: z24.string().uuid(),
1575
+ push_enabled: z24.boolean(),
1576
+ push_dms: z24.boolean(),
1577
+ push_group: z24.boolean(),
1578
+ push_mentions: z24.boolean(),
1579
+ quiet_hours_start: z24.string().nullable(),
1580
+ quiet_hours_end: z24.string().nullable(),
1581
+ updated_at: z24.string().datetime({ offset: true }),
1582
+ chat_enter_sends: z24.boolean().default(true)
1583
+ });
1584
+ var CreateDMSchema = z24.object({
1585
+ type: z24.literal("direct"),
1586
+ participantId: z24.string().uuid()
1587
+ });
1588
+ var CreateGroupSchema = z24.object({
1589
+ type: z24.literal("group"),
1590
+ name: z24.string().min(1).max(50).refine((n) => n.toLowerCase() !== "general", { message: 'The name "general" is reserved' }),
1591
+ participantIds: z24.array(z24.string().uuid()).min(2)
1592
+ });
1593
+ var CreateConversationSchema = z24.discriminatedUnion("type", [
1594
+ CreateDMSchema,
1595
+ CreateGroupSchema
1596
+ ]);
1597
+ var SendMessageSchema = z24.object({
1598
+ conversationId: z24.string().uuid(),
1599
+ body: z24.string().max(4e3),
1600
+ attachmentUrl: z24.string().optional(),
1601
+ attachmentType: z24.string().optional(),
1602
+ mentions: z24.array(z24.string().uuid()).optional(),
1603
+ replyToId: z24.string().uuid().optional()
1604
+ }).refine((d) => d.body.length > 0 || !!d.attachmentUrl, { message: "Either body or attachmentUrl is required" });
1605
+ var UpdateMessageSchema = z24.object({
1606
+ messageId: z24.string().uuid(),
1607
+ body: z24.string().min(1).max(4e3)
1608
+ });
1609
+ var CreatePushSubscriptionSchema = z24.object({
1610
+ platform: PushPlatformSchema,
1611
+ token: z24.string().min(1)
1612
+ });
1613
+ var UpdateNotificationPreferencesSchema = z24.object({
1614
+ push_enabled: z24.boolean().optional(),
1615
+ push_dms: z24.boolean().optional(),
1616
+ push_group: z24.boolean().optional(),
1617
+ push_mentions: z24.boolean().optional(),
1618
+ quiet_hours_start: z24.string().nullable().optional(),
1619
+ quiet_hours_end: z24.string().nullable().optional(),
1620
+ chat_enter_sends: z24.boolean().optional()
1621
+ });
1622
+ var WsMessageSendSchema = z24.object({
1623
+ type: z24.literal("message:send"),
1624
+ payload: SendMessageSchema
1625
+ });
1626
+ var WsMessageEditSchema = z24.object({
1627
+ type: z24.literal("message:edit"),
1628
+ payload: UpdateMessageSchema
1629
+ });
1630
+ var WsMessageDeleteSchema = z24.object({
1631
+ type: z24.literal("message:delete"),
1632
+ payload: z24.object({ messageId: z24.string().uuid() })
1633
+ });
1634
+ var WsTypingStartSchema = z24.object({
1635
+ type: z24.literal("typing:start"),
1636
+ payload: z24.object({ conversationId: z24.string().uuid() })
1637
+ });
1638
+ var WsTypingStopSchema = z24.object({
1639
+ type: z24.literal("typing:stop"),
1640
+ payload: z24.object({ conversationId: z24.string().uuid() })
1641
+ });
1642
+ var WsReactionAddSchema = z24.object({
1643
+ type: z24.literal("reaction:add"),
1644
+ payload: z24.object({ messageId: z24.string().uuid(), emoji: z24.string().min(1) })
1645
+ });
1646
+ var WsReactionRemoveSchema = z24.object({
1647
+ type: z24.literal("reaction:remove"),
1648
+ payload: z24.object({ messageId: z24.string().uuid(), emoji: z24.string().min(1) })
1649
+ });
1650
+ var WsCursorUpdateSchema = z24.object({
1651
+ type: z24.literal("cursor:update"),
1652
+ payload: z24.object({
1653
+ conversationId: z24.string().uuid(),
1654
+ lastReadMessageId: z24.string().uuid()
1655
+ })
1656
+ });
1657
+ var WsPingSchema = z24.object({
1658
+ type: z24.literal("ping"),
1659
+ payload: z24.object({})
1660
+ });
1661
+ var WsChatClientEvents = [
1662
+ WsMessageSendSchema,
1663
+ WsMessageEditSchema,
1664
+ WsMessageDeleteSchema,
1665
+ WsTypingStartSchema,
1666
+ WsTypingStopSchema,
1667
+ WsReactionAddSchema,
1668
+ WsReactionRemoveSchema,
1669
+ WsCursorUpdateSchema,
1670
+ WsPingSchema,
1671
+ WsCallStartSchema,
1672
+ WsCallAcceptSchema,
1673
+ WsCallDeclineSchema,
1674
+ WsCallLeaveSchema,
1675
+ WsCallEndSchema,
1676
+ WsStatusSetSchema
1677
+ ];
1678
+ var WsClientEventSchema = z24.discriminatedUnion("type", [
1679
+ ...WsChatClientEvents,
1680
+ ...WsBoardClientEvents
1681
+ ]);
1682
+ var WsServerMessageNewSchema = z24.object({
1683
+ type: z24.literal("message:new"),
1684
+ payload: z24.object({ projectId: z24.string().uuid(), message: ChatMessageWithReactionsSchema })
1685
+ });
1686
+ var WsServerMessageUpdatedSchema = z24.object({
1687
+ type: z24.literal("message:updated"),
1688
+ payload: z24.object({ projectId: z24.string().uuid(), message: ChatMessageWithReactionsSchema })
1689
+ });
1690
+ var WsServerMessageDeletedSchema = z24.object({
1691
+ type: z24.literal("message:deleted"),
1692
+ payload: z24.object({ projectId: z24.string().uuid(), messageId: z24.string().uuid(), conversationId: z24.string().uuid() })
1693
+ });
1694
+ var WsServerTypingUpdateSchema = z24.object({
1695
+ type: z24.literal("typing:update"),
1696
+ payload: z24.object({
1697
+ projectId: z24.string().uuid(),
1698
+ conversationId: z24.string().uuid(),
1699
+ userId: z24.string().uuid(),
1700
+ isTyping: z24.boolean()
1701
+ })
1702
+ });
1703
+ var WsServerPresenceJoinSchema = z24.object({
1704
+ type: z24.literal("presence:join"),
1705
+ payload: z24.object({ userId: z24.string().uuid(), projectId: z24.string().uuid() })
1706
+ });
1707
+ var WsServerPresenceLeaveSchema = z24.object({
1708
+ type: z24.literal("presence:leave"),
1709
+ payload: z24.object({ userId: z24.string().uuid(), projectId: z24.string().uuid() })
1710
+ });
1711
+ var WsServerPresenceStateSchema = z24.object({
1712
+ type: z24.literal("presence:state"),
1713
+ payload: z24.object({
1714
+ online: z24.array(z24.string().uuid()),
1715
+ statuses: z24.record(z24.string(), UserStatusSchema).optional()
1716
+ })
1717
+ });
1718
+ var WsServerReactionAddedSchema = z24.object({
1719
+ type: z24.literal("reaction:added"),
1720
+ payload: z24.object({
1721
+ projectId: z24.string().uuid(),
1722
+ messageId: z24.string().uuid(),
1723
+ reaction: z24.object({
1724
+ userId: z24.string().uuid(),
1725
+ emoji: z24.string().min(1)
1726
+ })
1727
+ })
1728
+ });
1729
+ var WsServerReactionRemovedSchema = z24.object({
1730
+ type: z24.literal("reaction:removed"),
1731
+ payload: z24.object({
1732
+ projectId: z24.string().uuid(),
1733
+ messageId: z24.string().uuid(),
1734
+ userId: z24.string().uuid(),
1735
+ emoji: z24.string().min(1)
1736
+ })
1737
+ });
1738
+ var WsServerCursorUpdatedSchema = z24.object({
1739
+ type: z24.literal("cursor:updated"),
1740
+ payload: z24.object({
1741
+ projectId: z24.string().uuid(),
1742
+ conversationId: z24.string().uuid(),
1743
+ userId: z24.string().uuid(),
1744
+ lastReadMessageId: z24.string().uuid()
1745
+ })
1746
+ });
1747
+ var WsServerPongSchema = z24.object({
1748
+ type: z24.literal("pong"),
1749
+ payload: z24.object({})
1750
+ });
1751
+ var WsServerErrorSchema = z24.object({
1752
+ type: z24.literal("error"),
1753
+ payload: z24.object({ code: z24.string(), message: z24.string() })
1754
+ });
1755
+ var WsServerSubscriptionUpdateSchema = z24.object({
1756
+ type: z24.literal("subscription:update"),
1757
+ payload: z24.object({
1758
+ projectId: z24.string().uuid(),
1759
+ action: z24.enum(["added", "removed"]),
1760
+ project: z24.object({
1761
+ id: z24.string().uuid(),
1762
+ name: z24.string(),
1763
+ role: z24.string()
1764
+ }).optional()
1765
+ })
1766
+ });
1767
+ var WsServerConversationCreatedSchema = z24.object({
1768
+ type: z24.literal("conversation:created"),
1769
+ payload: z24.object({
1770
+ conversation: ChatConversationWithPreviewSchema
1771
+ })
1772
+ });
1773
+ var WsServerConversationUpdatedSchema = z24.object({
1774
+ type: z24.literal("conversation:updated"),
1775
+ payload: z24.object({
1776
+ conversationId: z24.string().uuid(),
1777
+ changes: z24.object({
1778
+ name: z24.string().optional(),
1779
+ participantsAdded: z24.array(z24.string().uuid()).optional(),
1780
+ participantsRemoved: z24.array(z24.string().uuid()).optional()
1781
+ })
1782
+ })
1783
+ });
1784
+ var WsServerConversationDeletedSchema = z24.object({
1785
+ type: z24.literal("conversation:deleted"),
1786
+ payload: z24.object({
1787
+ conversationId: z24.string().uuid(),
1788
+ projectId: z24.string().uuid()
1789
+ })
1790
+ });
1791
+ var WsServerUnreadSyncSchema = z24.object({
1792
+ type: z24.literal("unread:sync"),
1793
+ payload: z24.object({
1794
+ projects: z24.array(z24.object({ projectId: z24.string().uuid(), count: z24.number().int().min(0) })),
1795
+ conversations: z24.array(z24.object({ conversationId: z24.string().uuid(), count: z24.number().int().min(0) }))
1796
+ })
1797
+ });
1798
+ var WsServerDocumentCreatedSchema = z24.object({
1799
+ type: z24.literal("document:created"),
1800
+ payload: z24.object({
1801
+ projectId: z24.string().uuid(),
1802
+ spaceId: z24.string().uuid(),
1803
+ document: z24.object({ id: z24.string().uuid(), title: z24.string() })
1804
+ })
1805
+ });
1806
+ var WsServerDocumentUpdatedSchema = z24.object({
1807
+ type: z24.literal("document:updated"),
1808
+ payload: z24.object({
1809
+ projectId: z24.string().uuid(),
1810
+ spaceId: z24.string().uuid(),
1811
+ document: z24.object({ id: z24.string().uuid(), title: z24.string() })
1812
+ })
1813
+ });
1814
+ var WsServerDocumentDeletedSchema = z24.object({
1815
+ type: z24.literal("document:deleted"),
1816
+ payload: z24.object({
1817
+ projectId: z24.string().uuid(),
1818
+ spaceId: z24.string().uuid(),
1819
+ documentId: z24.string().uuid()
1820
+ })
1821
+ });
1822
+ var WsServerSpaceCreatedSchema = z24.object({
1823
+ type: z24.literal("space:created"),
1824
+ payload: z24.object({
1825
+ projectId: z24.string().uuid(),
1826
+ space: z24.object({ id: z24.string().uuid(), name: z24.string() })
1827
+ })
1828
+ });
1829
+ var WsServerSpaceUpdatedSchema = z24.object({
1830
+ type: z24.literal("space:updated"),
1831
+ payload: z24.object({
1832
+ projectId: z24.string().uuid(),
1833
+ space: z24.object({ id: z24.string().uuid(), name: z24.string() })
1834
+ })
1835
+ });
1836
+ var WsServerSpaceDeletedSchema = z24.object({
1837
+ type: z24.literal("space:deleted"),
1838
+ payload: z24.object({
1839
+ projectId: z24.string().uuid(),
1840
+ spaceId: z24.string().uuid()
1841
+ })
1842
+ });
1843
+ var WsChatServerEvents = [
1844
+ WsServerMessageNewSchema,
1845
+ WsServerMessageUpdatedSchema,
1846
+ WsServerMessageDeletedSchema,
1847
+ WsServerTypingUpdateSchema,
1848
+ WsServerPresenceJoinSchema,
1849
+ WsServerPresenceLeaveSchema,
1850
+ WsServerPresenceStateSchema,
1851
+ WsServerReactionAddedSchema,
1852
+ WsServerReactionRemovedSchema,
1853
+ WsServerCursorUpdatedSchema,
1854
+ WsServerPongSchema,
1855
+ WsServerErrorSchema,
1856
+ WsServerSubscriptionUpdateSchema,
1857
+ WsServerConversationCreatedSchema,
1858
+ WsServerConversationUpdatedSchema,
1859
+ WsServerConversationDeletedSchema,
1860
+ WsServerUnreadSyncSchema,
1861
+ WsServerDocumentCreatedSchema,
1862
+ WsServerDocumentUpdatedSchema,
1863
+ WsServerDocumentDeletedSchema,
1864
+ WsServerSpaceCreatedSchema,
1865
+ WsServerSpaceUpdatedSchema,
1866
+ WsServerSpaceDeletedSchema,
1867
+ WsServerCallRingSchema,
1868
+ WsServerCallStartedSchema,
1869
+ WsServerCallParticipantJoinedSchema,
1870
+ WsServerCallParticipantLeftSchema,
1871
+ WsServerCallEndedSchema,
1872
+ WsServerCallDeclinedSchema,
1873
+ WsServerCallMissedSchema,
1874
+ WsServerStatusUpdateSchema
1875
+ ];
1876
+ var WsServerEventSchema = z24.discriminatedUnion("type", [
1877
+ ...WsChatServerEvents,
1878
+ ...WsBoardServerEvents
1879
+ ]);
1880
+
1881
+ // ../types/dist/api-token.schema.js
1882
+ import { z as z25 } from "zod";
1883
+ var ApiTokenMetadataSchema = z25.object({
1884
+ id: z25.string().uuid(),
1885
+ name: z25.string().min(1),
1886
+ token_prefix: z25.string(),
1887
+ last_used_at: z25.string().datetime({ offset: true }).nullable(),
1888
+ created_at: z25.string().datetime({ offset: true })
1889
+ });
1890
+ var GenerateApiTokenResponseSchema = z25.object({
1891
+ id: z25.string().uuid(),
1892
+ name: z25.string().min(1),
1893
+ token_prefix: z25.string(),
1894
+ token: z25.string(),
1895
+ created_at: z25.string().datetime({ offset: true })
1896
+ });
1897
+ var CreateApiTokenBodySchema = z25.object({
1898
+ name: z25.string().min(1).max(100).optional().default("Claude Code")
1899
+ });
1900
+
1901
+ // ../types/dist/doc-space.schema.js
1902
+ import { z as z26 } from "zod";
1903
+ var DocSpaceSchema = z26.object({
1904
+ id: z26.string().uuid(),
1905
+ project_id: z26.string().uuid(),
1906
+ name: z26.string().min(1).max(100),
1907
+ prefix: z26.string().regex(/^[A-Z]{2,10}$/),
1908
+ doc_counter: z26.number().int().nonnegative(),
1909
+ created_at: z26.string().datetime({ offset: true }),
1910
+ updated_at: z26.string().datetime({ offset: true })
1911
+ });
1912
+ var DocSpaceWithCountSchema = DocSpaceSchema.extend({
1913
+ document_count: z26.number().int().nonnegative(),
1914
+ can_write: z26.boolean()
1915
+ });
1916
+ var CreateDocSpaceSchema = z26.object({
1917
+ name: z26.string().trim().min(1).max(100),
1918
+ prefix: z26.string().regex(/^[A-Z]{2,10}$/)
1919
+ });
1920
+ var UpdateDocSpaceSchema = z26.object({
1921
+ name: z26.string().trim().min(1).max(100).optional(),
1922
+ prefix: z26.string().regex(/^[A-Z]{2,10}$/).optional()
1923
+ });
1924
+ var DocumentActionSchema = z26.enum(["delete", "move"]);
1925
+ var DeleteDocSpaceBodySchema = z26.object({
1926
+ document_action: DocumentActionSchema.default("delete"),
1927
+ target_space_id: z26.string().uuid().optional()
1928
+ }).superRefine((data, ctx) => {
1929
+ if (data.document_action === "move" && !data.target_space_id) {
1930
+ ctx.addIssue({
1931
+ code: z26.ZodIssueCode.custom,
1932
+ message: "target_space_id is required when document_action is move",
1933
+ path: ["target_space_id"]
1934
+ });
1935
+ }
1936
+ });
1937
+ var DeleteDocSpacePreviewSchema = z26.object({
1938
+ documents: z26.number().int().nonnegative()
1939
+ });
1940
+
1941
+ // ../types/dist/document.schema.js
1942
+ import { z as z27 } from "zod";
1943
+ var DocumentSchema = z27.object({
1944
+ id: z27.string().uuid(),
1945
+ space_id: z27.string().uuid(),
1946
+ project_id: z27.string().uuid(),
1947
+ parent_id: z27.string().uuid().nullable(),
1948
+ doc_number: z27.number().int().positive(),
1949
+ title: z27.string().min(1).max(500),
1950
+ content: z27.string(),
1951
+ position: z27.number().int(),
1952
+ created_by: z27.string().uuid(),
1953
+ updated_by: z27.string().uuid(),
1954
+ created_at: z27.string().datetime({ offset: true }),
1955
+ updated_at: z27.string().datetime({ offset: true })
1956
+ });
1957
+ var DocumentWithProfilesSchema = DocumentSchema.extend({
1958
+ creator: UserProfileSchema,
1959
+ updater: UserProfileSchema
1960
+ });
1961
+ var DocumentTreeNodeSchema = DocumentSchema.extend({
1962
+ children: z27.lazy(() => DocumentTreeNodeSchema.array())
1963
+ });
1964
+ var CreateDocumentSchema = z27.object({
1965
+ title: z27.string().trim().min(1).max(500),
1966
+ content: z27.string().optional().default(""),
1967
+ parent_id: z27.string().uuid().nullable().optional().default(null)
1968
+ });
1969
+ var UpdateDocumentSchema = z27.object({
1970
+ title: z27.string().trim().min(1).max(500).optional(),
1971
+ content: z27.string().optional()
1972
+ });
1973
+ var MoveDocumentSchema = z27.object({
1974
+ parent_id: z27.string().uuid().nullable().optional(),
1975
+ position: z27.number().int().nonnegative().optional()
1976
+ });
1977
+ var DeleteDocumentPreviewSchema = z27.object({
1978
+ child_documents: z27.number().int().nonnegative()
1979
+ });
1980
+
1981
+ // ../types/dist/search.schema.js
1982
+ import { z as z28 } from "zod";
1983
+ var SearchResultTypeSchema = z28.enum(["ticket", "document", "message"]);
1984
+ var SearchResultSchema = z28.object({
1985
+ type: SearchResultTypeSchema,
1986
+ id: z28.string().uuid(),
1987
+ display_id: z28.string().nullable(),
1988
+ project_id: z28.string().uuid(),
1989
+ project_name: z28.string(),
1990
+ title: z28.string(),
1991
+ snippet: z28.string(),
1992
+ meta: z28.record(z28.string(), z28.unknown()).optional()
1993
+ });
1994
+ var SearchQuerySchema = z28.object({
1995
+ q: z28.string().min(2),
1996
+ type: SearchResultTypeSchema.optional(),
1997
+ project_id: z28.string().uuid().optional(),
1998
+ limit: z28.coerce.number().int().min(1).max(50).optional().default(20)
1999
+ });
2000
+ var SearchResponseSchema = z28.object({
2001
+ results: z28.array(SearchResultSchema),
2002
+ total: z28.number().int().nonnegative()
2003
+ });
2004
+ var MentionResultTypeSchema = z28.enum(["ticket", "document", "user"]);
2005
+ var MentionResultSchema = z28.object({
2006
+ type: MentionResultTypeSchema,
2007
+ id: z28.string().uuid(),
2008
+ displayId: z28.string(),
2009
+ title: z28.string(),
2010
+ avatarUrl: z28.string().optional()
2011
+ });
2012
+
2013
+ // ../types/dist/entity-reference.schema.js
2014
+ import { z as z29 } from "zod";
2015
+ var EntityReferenceSourceTypeSchema = z29.enum(["ticket", "document", "comment", "chat_message"]);
2016
+ var EntityReferenceTargetTypeSchema = z29.enum(["ticket", "document"]);
2017
+ var EntityReferenceSchema = z29.object({
2018
+ id: z29.string().uuid(),
2019
+ source_type: EntityReferenceSourceTypeSchema,
2020
+ source_id: z29.string().uuid(),
2021
+ target_type: EntityReferenceTargetTypeSchema,
2022
+ target_id: z29.string().uuid(),
2023
+ project_id: z29.string().uuid(),
2024
+ created_at: z29.string().datetime({ offset: true })
2025
+ });
2026
+ var BacklinkSchema = z29.object({
2027
+ source_type: EntityReferenceSourceTypeSchema,
2028
+ source_id: z29.string().uuid(),
2029
+ display_id: z29.string(),
2030
+ title: z29.string()
2031
+ });
2032
+ var BacklinksResponseSchema = z29.object({
2033
+ backlinks: z29.array(BacklinkSchema),
2034
+ total: z29.number().int().nonnegative()
2035
+ });
2036
+ var ResolveResultSchema = z29.object({
2037
+ type: EntityReferenceTargetTypeSchema,
2038
+ id: z29.string().uuid(),
2039
+ boardId: z29.string().uuid().optional(),
2040
+ spaceId: z29.string().uuid().optional()
2041
+ });
2042
+ var BatchResolveResponseSchema = z29.object({
2043
+ results: z29.record(z29.string(), ResolveResultSchema)
2044
+ });
2045
+
2046
+ // ../types/dist/notification.schema.js
2047
+ import { z as z30 } from "zod";
2048
+ var NotificationTypeSchema = z30.enum(["mention"]);
2049
+ var NotificationSchema = z30.object({
2050
+ id: z30.string().uuid(),
2051
+ project_id: z30.string().uuid(),
2052
+ user_id: z30.string().uuid(),
2053
+ actor_id: z30.string().uuid(),
2054
+ type: NotificationTypeSchema,
2055
+ source_type: z30.string(),
2056
+ source_id: z30.string().uuid(),
2057
+ display_id: z30.string(),
2058
+ title: z30.string(),
2059
+ read: z30.boolean(),
2060
+ created_at: z30.string().datetime({ offset: true })
2061
+ });
2062
+ var NotificationWithActorSchema = NotificationSchema.extend({
2063
+ actor: z30.object({
2064
+ id: z30.string().uuid(),
2065
+ display_name: z30.string(),
2066
+ avatar_url: z30.string().nullable()
2067
+ }).nullable()
2068
+ });
2069
+ var NotificationsResponseSchema = z30.object({
2070
+ notifications: z30.array(NotificationWithActorSchema),
2071
+ unread_count: z30.number().int().nonnegative()
2072
+ });
2073
+
2074
+ // ../types/dist/field-value.schema.js
2075
+ import { z as z31 } from "zod";
2076
+ var FieldValueSchema = z31.object({
2077
+ id: z31.string().uuid(),
2078
+ ticket_id: z31.string().uuid(),
2079
+ field_id: z31.string().uuid(),
2080
+ text_value: z31.string().nullable(),
2081
+ number_value: z31.number().nullable(),
2082
+ date_value: z31.string().nullable(),
2083
+ json_value: z31.unknown().nullable(),
2084
+ ref_user_id: z31.string().uuid().nullable(),
2085
+ ref_ticket_id: z31.string().uuid().nullable(),
2086
+ ref_document_id: z31.string().uuid().nullable(),
2087
+ created_at: z31.string().datetime({ offset: true }),
2088
+ updated_at: z31.string().datetime({ offset: true })
2089
+ });
2090
+ var FieldValueWithDefinitionSchema = FieldValueSchema.extend({
2091
+ field_name: z31.string(),
2092
+ field_type: z31.string()
2093
+ });
2094
+ var SetFieldValueSchema = z31.object({
2095
+ value: z31.unknown()
2096
+ });
2097
+ var BatchSetFieldValuesSchema = z31.object({
2098
+ values: z31.record(z31.string(), z31.unknown())
2099
+ });
2100
+
2101
+ // ../types/dist/transition-requirement.schema.js
2102
+ import { z as z32 } from "zod";
2103
+ var TransitionFieldRequirementSchema = z32.object({
2104
+ id: z32.string().uuid(),
2105
+ board_id: z32.string().uuid(),
2106
+ to_column_id: z32.string().uuid().nullable(),
2107
+ field_id: z32.string().uuid(),
2108
+ to_tombstone_id: z32.string().uuid().nullable(),
2109
+ status: TransitionRuleStatusSchema,
2110
+ instruction: z32.string().nullable(),
2111
+ created_at: z32.string().datetime({ offset: true }),
2112
+ updated_at: z32.string().datetime({ offset: true })
2113
+ });
2114
+ var TransitionFieldRequirementWithTombstoneSchema = TransitionFieldRequirementSchema.extend({
2115
+ to_tombstone_name: z32.string().nullable().default(null),
2116
+ field_name: z32.string().default(""),
2117
+ field_type: z32.string().default("")
2118
+ });
2119
+ var BulkUpsertTransitionRequirementsSchema = z32.object({
2120
+ requirements: z32.array(z32.object({
2121
+ to_column_id: z32.string().uuid(),
2122
+ field_id: z32.string().uuid(),
2123
+ instruction: z32.string().nullable().optional()
2124
+ }))
2125
+ });
2126
+
2127
+ // ../types/dist/transition-blocked.schema.js
2128
+ import { z as z33 } from "zod";
2129
+ var ColumnInfoSchema = z33.object({
2130
+ id: z33.string().uuid(),
2131
+ name: z33.string()
2132
+ });
2133
+ var WorkflowViolationSchema = z33.object({
2134
+ type: z33.literal("workflow"),
2135
+ message: z33.string(),
2136
+ from_column: ColumnInfoSchema,
2137
+ to_column: ColumnInfoSchema,
2138
+ allowed_targets: z33.array(ColumnInfoSchema)
2139
+ });
2140
+ var MissingFieldsViolationSchema = z33.object({
2141
+ type: z33.literal("missing_fields"),
2142
+ message: z33.string(),
2143
+ fields: z33.array(z33.object({
2144
+ field_id: z33.string().uuid(),
2145
+ name: z33.string(),
2146
+ type: z33.string(),
2147
+ config: z33.record(z33.string(), z33.unknown()).default({})
2148
+ }))
2149
+ });
2150
+ var UnresolvedDependenciesViolationSchema = z33.object({
2151
+ type: z33.literal("unresolved_dependencies"),
2152
+ message: z33.string(),
2153
+ blocking_tickets: z33.array(z33.object({
2154
+ id: z33.string().uuid(),
2155
+ ticket_number: z33.number().int(),
2156
+ title: z33.string(),
2157
+ column: z33.string()
2158
+ }))
2159
+ });
2160
+ var TransitionViolationSchema = z33.discriminatedUnion("type", [
2161
+ WorkflowViolationSchema,
2162
+ MissingFieldsViolationSchema,
2163
+ UnresolvedDependenciesViolationSchema
2164
+ ]);
2165
+ var TransitionBlockedErrorSchema = z33.object({
2166
+ success: z33.literal(false),
2167
+ error: z33.object({
2168
+ code: z33.literal("TRANSITION_BLOCKED"),
2169
+ violations: z33.array(TransitionViolationSchema)
2170
+ })
2171
+ });
2172
+
2173
+ // ../types/dist/ticket-link.schema.js
2174
+ import { z as z34 } from "zod";
2175
+ var TicketLinkTypeSchema = z34.enum(["blocks", "relates_to", "duplicates"]);
2176
+ var ResolvedWhenSchema = z34.discriminatedUnion("type", [
2177
+ z34.object({
2178
+ type: z34.literal("column"),
2179
+ column_ids: z34.array(z34.string().uuid()).min(1)
2180
+ }),
2181
+ z34.object({
2182
+ type: z34.literal("archived")
2183
+ }),
2184
+ z34.object({
2185
+ type: z34.literal("column_or_archived"),
2186
+ column_ids: z34.array(z34.string().uuid())
2187
+ })
2188
+ ]);
2189
+ var TicketLinkSchema = z34.object({
2190
+ id: z34.string().uuid(),
2191
+ source_id: z34.string().uuid(),
2192
+ target_id: z34.string().uuid(),
2193
+ link_type: TicketLinkTypeSchema,
2194
+ project_id: z34.string().uuid(),
2195
+ created_by: z34.string().uuid(),
2196
+ created_at: z34.string().datetime({ offset: true }),
2197
+ updated_at: z34.string().datetime({ offset: true }),
2198
+ resolved_at: z34.string().datetime({ offset: true }).nullable().optional(),
2199
+ resolved_by: z34.string().uuid().nullable().optional()
2200
+ });
2201
+ var TicketLinkWithDetailsSchema = TicketLinkSchema.extend({
2202
+ source: z34.object({
2203
+ id: z34.string().uuid(),
2204
+ ticket_number: z34.number().int(),
2205
+ title: z34.string(),
2206
+ column_name: z34.string().nullable()
2207
+ }),
2208
+ target: z34.object({
2209
+ id: z34.string().uuid(),
2210
+ ticket_number: z34.number().int(),
2211
+ title: z34.string(),
2212
+ column_name: z34.string().nullable()
2213
+ })
2214
+ });
2215
+ var CreateTicketLinkSchema = z34.object({
2216
+ source_ticket_id: z34.string().uuid(),
2217
+ target_ticket_id: z34.string().uuid(),
2218
+ link_type: TicketLinkTypeSchema
2219
+ });
2220
+ var DependencyRequirementSchema = z34.object({
2221
+ id: z34.string().uuid(),
2222
+ board_id: z34.string().uuid(),
2223
+ to_column_id: z34.string().uuid().nullable().optional(),
2224
+ to_tombstone_id: z34.string().uuid().nullable().optional(),
2225
+ instruction: z34.string().nullable().optional(),
2226
+ status: z34.enum(["active", "broken"]),
2227
+ resolved_when: ResolvedWhenSchema.nullable().optional(),
2228
+ created_at: z34.string().datetime({ offset: true }),
2229
+ updated_at: z34.string().datetime({ offset: true })
2230
+ });
2231
+
2232
+ // ../types/dist/column-tombstone.schema.js
2233
+ import { z as z35 } from "zod";
2234
+ var ColumnTombstoneSchema = z35.object({
2235
+ id: z35.string().uuid(),
2236
+ board_id: z35.string().uuid(),
2237
+ name: z35.string(),
2238
+ color: z35.string(),
2239
+ deleted_at: z35.string().datetime({ offset: true })
2240
+ });
2241
+
2242
+ // ../types/dist/gif.schema.js
2243
+ import { z as z36 } from "zod";
2244
+ var GifSchema = z36.object({
2245
+ id: z36.string(),
2246
+ title: z36.string(),
2247
+ url: z36.string().url(),
2248
+ preview_url: z36.string().url(),
2249
+ width: z36.number().int(),
2250
+ height: z36.number().int()
2251
+ });
2252
+ var GifSearchQuerySchema = z36.object({
2253
+ q: z36.string().min(1).max(100)
2254
+ });
2255
+ var GifResponseSchema = z36.object({
2256
+ gifs: z36.array(GifSchema)
2257
+ });
2258
+
2259
+ // ../types/dist/preferences.schema.js
2260
+ import { z as z37 } from "zod";
2261
+ var ThemePaletteSchema = z37.enum(["kantban", "seventies-coffee"]);
2262
+ var ThemeModeSchema = z37.enum(["light", "dark", "system"]);
2263
+ var UserPreferencesSchema = z37.object({
2264
+ user_id: z37.string().uuid(),
2265
+ theme_palette: ThemePaletteSchema,
2266
+ theme_mode: ThemeModeSchema
2267
+ });
2268
+ var UpdateUserPreferencesSchema = z37.object({
2269
+ theme_palette: ThemePaletteSchema.optional(),
2270
+ theme_mode: ThemeModeSchema.optional()
2271
+ });
2272
+
2273
+ // ../types/dist/activity.schema.js
2274
+ import { z as z38 } from "zod";
2275
+ var ActivityActionSchema = z38.enum([
2276
+ "ticket_created",
2277
+ "ticket_moved",
2278
+ "ticket_updated",
2279
+ "comment_added",
2280
+ "field_changed",
2281
+ "ticket_archived",
2282
+ "github_reference_created",
2283
+ "github_reference_updated",
2284
+ "template_executed",
2285
+ "sprint_closed",
2286
+ "signal_created",
2287
+ "document_updated",
2288
+ "board_updated",
2289
+ "column_updated",
2290
+ "signal_deleted",
2291
+ "transition_rule_changed",
2292
+ "firing_constraint_created",
2293
+ "firing_constraint_updated",
2294
+ "firing_constraint_deleted",
2295
+ "pipeline_session_completed"
2296
+ ]);
2297
+ var ActivityResourceTypeSchema = z38.enum([
2298
+ "ticket",
2299
+ "comment",
2300
+ "field_value",
2301
+ "board",
2302
+ "document",
2303
+ "ticket_reference",
2304
+ "pipeline_template",
2305
+ "signal",
2306
+ "column",
2307
+ "pipeline_session"
2308
+ ]);
2309
+ var ActivityLogSchema = z38.object({
2310
+ id: z38.string().uuid(),
2311
+ project_id: z38.string().uuid(),
2312
+ actor_id: z38.string().uuid(),
2313
+ action: ActivityActionSchema,
2314
+ resource_type: ActivityResourceTypeSchema,
2315
+ resource_id: z38.string().uuid(),
2316
+ board_id: z38.string().uuid().nullable().default(null),
2317
+ ticket_id: z38.string().uuid().nullable().default(null),
2318
+ metadata: z38.record(z38.string(), z38.unknown()).default({}),
2319
+ created_at: z38.string().datetime({ offset: true })
2320
+ });
2321
+ var ActivityFeedQuerySchema = z38.object({
2322
+ since: z38.string().datetime({ offset: true }).optional(),
2323
+ types: z38.string().optional(),
2324
+ via: z38.string().optional(),
2325
+ boardId: z38.string().uuid().optional(),
2326
+ ticketId: z38.string().uuid().optional(),
2327
+ columnId: z38.string().uuid().optional(),
2328
+ sessionId: z38.string().uuid().optional(),
2329
+ limit: z38.coerce.number().int().min(1).max(200).optional().default(20),
2330
+ cursor: z38.string().optional()
2331
+ });
2332
+
2333
+ // ../types/dist/ticket-metrics.schema.js
2334
+ import { z as z39 } from "zod";
2335
+ var TicketMetricsSchema = z39.object({
2336
+ ticket_id: z39.string().uuid(),
2337
+ board_id: z39.string().uuid(),
2338
+ project_id: z39.string().uuid(),
2339
+ created_at: z39.string().datetime({ offset: true }),
2340
+ first_active_at: z39.string().datetime({ offset: true }).nullable(),
2341
+ done_at: z39.string().datetime({ offset: true }),
2342
+ lead_time_hours: z39.number(),
2343
+ cycle_time_hours: z39.number().nullable(),
2344
+ column_transitions: z39.number().int(),
2345
+ backward_moves: z39.number().int(),
2346
+ assignee_changes: z39.number().int(),
2347
+ labels: z39.record(z39.string(), z39.unknown()).default({})
2348
+ });
2349
+
2350
+ // ../types/dist/daily-snapshot.schema.js
2351
+ import { z as z40 } from "zod";
2352
+ var DailySnapshotSchema = z40.object({
2353
+ id: z40.string().uuid(),
2354
+ project_id: z40.string().uuid(),
2355
+ board_id: z40.string().uuid(),
2356
+ snapshot_date: z40.string(),
2357
+ column_id: z40.string().uuid(),
2358
+ column_name: z40.string(),
2359
+ ticket_count: z40.number().int()
2360
+ });
2361
+
2362
+ // ../types/dist/compound.schema.js
2363
+ import { z as z41 } from "zod";
2364
+ var PlanItemSchema = z41.object({
2365
+ title: z41.string().min(1).max(500),
2366
+ description: z41.string().max(1e4).optional(),
2367
+ columnName: z41.string().optional(),
2368
+ fieldValues: z41.record(z41.string(), z41.unknown()).optional(),
2369
+ subtasks: z41.array(z41.object({
2370
+ title: z41.string().min(1).max(500),
2371
+ description: z41.string().max(1e4).optional()
2372
+ })).optional()
2373
+ });
2374
+ var PlanToTicketsBodySchema = z41.object({
2375
+ plan: z41.array(PlanItemSchema).min(1).max(50),
2376
+ dryRun: z41.boolean().optional().default(true)
2377
+ });
2378
+ var SuggestNextTaskQuerySchema = z41.object({
2379
+ boardId: z41.string().uuid().optional(),
2380
+ userId: z41.string().uuid().optional(),
2381
+ count: z41.coerce.number().optional().default(5)
2382
+ });
2383
+ var TaskScoreSchema = z41.object({
2384
+ ticketId: z41.string().uuid(),
2385
+ ticketNumber: z41.number(),
2386
+ title: z41.string(),
2387
+ score: z41.number(),
2388
+ breakdown: z41.record(z41.string(), z41.number()),
2389
+ reasoning: z41.string(),
2390
+ columnName: z41.string(),
2391
+ boardName: z41.string(),
2392
+ assigneeName: z41.string().nullable(),
2393
+ timeInColumn: z41.number(),
2394
+ timeUnit: z41.enum(["minutes", "hours", "days"]).default("days")
2395
+ });
2396
+ var StartWorkingBodySchema = z41.object({
2397
+ moveToColumn: z41.string().optional()
2398
+ });
2399
+ var CompleteTaskBodySchema = z41.object({
2400
+ moveToColumn: z41.string().optional(),
2401
+ completionComment: z41.string().max(1e4).optional(),
2402
+ suggestNext: z41.boolean().optional().default(true),
2403
+ handoff: z41.record(z41.string(), z41.unknown()).optional()
2404
+ });
2405
+ var BottleneckResultSchema = z41.object({
2406
+ wip_violations: z41.array(z41.object({
2407
+ column: z41.string(),
2408
+ limit: z41.number(),
2409
+ actual: z41.number(),
2410
+ tickets: z41.array(z41.object({ id: z41.string(), title: z41.string(), ticket_number: z41.number() }))
2411
+ })),
2412
+ stuck_tickets: z41.array(z41.object({
2413
+ ticket: z41.object({ id: z41.string(), title: z41.string(), ticket_number: z41.number() }),
2414
+ column: z41.string(),
2415
+ time_in_column: z41.number(),
2416
+ time_unit: z41.enum(["minutes", "hours", "days"]).default("days"),
2417
+ last_activity_at: z41.string().nullable()
2418
+ })),
2419
+ blocked_chains: z41.array(z41.object({
2420
+ blocking_ticket: z41.object({ id: z41.string(), title: z41.string(), ticket_number: z41.number() }),
2421
+ blocked_tickets: z41.array(z41.object({ id: z41.string(), title: z41.string(), ticket_number: z41.number() })),
2422
+ reason: z41.string()
2423
+ })),
2424
+ unassigned_active: z41.array(z41.object({
2425
+ ticket: z41.object({ id: z41.string(), title: z41.string(), ticket_number: z41.number() }),
2426
+ column: z41.string()
2427
+ })),
2428
+ suggestions: z41.array(z41.string()),
2429
+ circuit_breaker_proximity: z41.array(z41.object({
2430
+ ticket: z41.object({ id: z41.string(), title: z41.string(), ticket_number: z41.number() }),
2431
+ column: z41.string(),
2432
+ backward_transitions: z41.number(),
2433
+ threshold: z41.number()
2434
+ })).optional()
2435
+ });
2436
+ var TicketContextSchema = z41.object({
2437
+ ticket: z41.record(z41.string(), z41.unknown()),
2438
+ comments: z41.array(z41.record(z41.string(), z41.unknown())),
2439
+ field_values: z41.array(z41.record(z41.string(), z41.unknown())),
2440
+ linked_tickets: z41.array(z41.record(z41.string(), z41.unknown())),
2441
+ linked_documents: z41.array(z41.record(z41.string(), z41.unknown())),
2442
+ references: z41.array(z41.record(z41.string(), z41.unknown())),
2443
+ signals: z41.array(z41.record(z41.string(), z41.unknown())).optional(),
2444
+ transitions: z41.array(z41.record(z41.string(), z41.unknown())).optional()
2445
+ });
2446
+ var ChunkedSearchBodySchema = z41.object({
2447
+ query: z41.string().min(1),
2448
+ maxChunks: z41.number().optional().default(5)
2449
+ });
2450
+
2451
+ // ../types/dist/dashboard.schema.js
2452
+ import { z as z42 } from "zod";
2453
+ var DashboardBoardSummarySchema = z42.object({
2454
+ id: z42.string().uuid(),
2455
+ name: z42.string(),
2456
+ columns: z42.array(z42.object({
2457
+ id: z42.string().uuid(),
2458
+ name: z42.string(),
2459
+ ticket_count: z42.number(),
2460
+ wip_limit: z42.number().nullable()
2461
+ })),
2462
+ total_tickets: z42.number()
2463
+ });
2464
+ var DashboardProjectSchema = z42.object({
2465
+ id: z42.string().uuid(),
2466
+ name: z42.string(),
2467
+ ticket_prefix: z42.string(),
2468
+ boards: z42.array(DashboardBoardSummarySchema),
2469
+ my_tickets: z42.array(z42.object({
2470
+ id: z42.string().uuid(),
2471
+ ticket_number: z42.number(),
2472
+ title: z42.string(),
2473
+ board_name: z42.string(),
2474
+ column_name: z42.string().nullable(),
2475
+ time_in_column: z42.number().nullable(),
2476
+ time_unit: z42.enum(["minutes", "hours", "days"]).default("days")
2477
+ }))
2478
+ });
2479
+ var UserDashboardSchema = z42.object({
2480
+ projects: z42.array(DashboardProjectSchema),
2481
+ urgent: z42.array(z42.object({
2482
+ type: z42.string(),
2483
+ message: z42.string(),
2484
+ ticket_id: z42.string().uuid().optional(),
2485
+ board_id: z42.string().uuid().optional()
2486
+ }))
2487
+ });
2488
+
2489
+ // ../types/dist/github.schema.js
2490
+ import { z as z43 } from "zod";
2491
+ var GithubConnectionSchema = z43.object({
2492
+ id: z43.string().uuid(),
2493
+ user_id: z43.string().uuid(),
2494
+ github_user_id: z43.string(),
2495
+ github_username: z43.string(),
2496
+ scopes: z43.array(z43.string()),
2497
+ created_at: z43.string().datetime({ offset: true })
2498
+ });
2499
+ var ProjectGithubRepoSchema = z43.object({
2500
+ id: z43.string().uuid(),
2501
+ project_id: z43.string().uuid(),
2502
+ github_repo_owner: z43.string(),
2503
+ github_repo_name: z43.string(),
2504
+ github_repo_id: z43.number().int(),
2505
+ connected_by: z43.string().uuid(),
2506
+ webhook_id: z43.number().int().nullable(),
2507
+ created_at: z43.string().datetime({ offset: true }),
2508
+ updated_at: z43.string().datetime({ offset: true })
2509
+ });
2510
+ var ConnectGithubRepoBodySchema = z43.object({
2511
+ repo_owner: z43.string().min(1),
2512
+ repo_name: z43.string().min(1)
2513
+ });
2514
+
2515
+ // ../types/dist/ticket-reference.schema.js
2516
+ import { z as z44 } from "zod";
2517
+ var TicketReferenceProviderSchema = z44.enum(["github"]);
2518
+ var TicketReferenceTypeSchema = z44.enum(["pull_request", "branch", "commit"]);
2519
+ var TicketReferenceStatusSchema = z44.enum(["open", "closed", "merged", "draft", "active", "deleted", "none"]);
2520
+ var TicketReferenceLinkedBySchema = z44.enum(["convention", "manual"]);
2521
+ var TicketReferenceSchema = z44.object({
2522
+ id: z44.string().uuid(),
2523
+ ticket_id: z44.string().uuid(),
2524
+ project_id: z44.string().uuid(),
2525
+ provider: TicketReferenceProviderSchema,
2526
+ type: TicketReferenceTypeSchema,
2527
+ external_id: z44.string(),
2528
+ external_url: z44.string().url(),
2529
+ title: z44.string(),
2530
+ status: TicketReferenceStatusSchema,
2531
+ metadata: z44.record(z44.string(), z44.unknown()).default({}),
2532
+ linked_by: TicketReferenceLinkedBySchema,
2533
+ synced_at: z44.string().datetime({ offset: true }).nullable(),
2534
+ created_at: z44.string().datetime({ offset: true })
2535
+ });
2536
+ var LinkGithubReferenceBodySchema = z44.object({
2537
+ type: TicketReferenceTypeSchema,
2538
+ url: z44.string().url()
2539
+ });
2540
+
2541
+ // ../types/dist/analytics.schema.js
2542
+ import { z as z45 } from "zod";
2543
+ var AnalyticsQuerySchema = z45.object({
2544
+ boardId: z45.string().uuid().optional(),
2545
+ since: z45.string().datetime({ offset: true }).optional(),
2546
+ until: z45.string().datetime({ offset: true }).optional(),
2547
+ assigneeId: z45.string().uuid().optional(),
2548
+ resolution: z45.enum(["auto", "minutes", "hours", "days"]).optional().default("auto")
2549
+ });
2550
+ var VelocityQuerySchema = AnalyticsQuerySchema.extend({
2551
+ weeks: z45.coerce.number().int().min(1).max(52).optional().default(8)
2552
+ });
2553
+ var ForecastQuerySchema = z45.object({
2554
+ boardId: z45.string().uuid().optional(),
2555
+ remainingTickets: z45.coerce.number().int().min(0).optional(),
2556
+ targetDate: z45.string().date().optional()
2557
+ });
2558
+ var EstimationQuerySchema = z45.object({
2559
+ ticketId: z45.string().uuid()
2560
+ });
2561
+ var RetrospectiveQuerySchema = AnalyticsQuerySchema.extend({
2562
+ periodDays: z45.coerce.number().int().min(1).max(365).optional().default(14)
2563
+ });
2564
+ var VelocityWeekSchema = z45.object({
2565
+ week_start: z45.string(),
2566
+ completed: z45.number().int(),
2567
+ avg_cycle_time_value: z45.number().nullable()
2568
+ });
2569
+ var VelocityResponseSchema = z45.object({
2570
+ weeks: z45.array(VelocityWeekSchema),
2571
+ trend: z45.enum(["up", "down", "stable"]),
2572
+ avg_throughput: z45.number(),
2573
+ time_unit: z45.enum(["minutes", "hours", "days"]).default("days")
2574
+ });
2575
+ var CycleTimeDataPointSchema = z45.object({
2576
+ ticket_id: z45.string().uuid(),
2577
+ ticket_number: z45.number().int().optional(),
2578
+ title: z45.string().optional(),
2579
+ done_at: z45.string(),
2580
+ cycle_time_value: z45.number()
2581
+ });
2582
+ var CycleTimeResponseSchema = z45.object({
2583
+ data_points: z45.array(CycleTimeDataPointSchema),
2584
+ percentiles: z45.object({
2585
+ p50: z45.number(),
2586
+ p85: z45.number(),
2587
+ p95: z45.number()
2588
+ }),
2589
+ avg_cycle_time_value: z45.number(),
2590
+ total_tickets: z45.number().int(),
2591
+ time_unit: z45.enum(["minutes", "hours", "days"]).default("days")
2592
+ });
2593
+ var LeadTimeBucketSchema = z45.object({
2594
+ range_label: z45.string(),
2595
+ min_hours: z45.number(),
2596
+ max_hours: z45.number(),
2597
+ count: z45.number().int()
2598
+ });
2599
+ var LeadTimeResponseSchema = z45.object({
2600
+ buckets: z45.array(LeadTimeBucketSchema),
2601
+ percentiles: z45.object({
2602
+ p50: z45.number(),
2603
+ p85: z45.number(),
2604
+ p95: z45.number()
2605
+ }),
2606
+ avg_lead_time_value: z45.number(),
2607
+ total_tickets: z45.number().int(),
2608
+ time_unit: z45.enum(["minutes", "hours", "days"]).default("days")
2609
+ });
2610
+ var CfdColumnDataSchema = z45.object({
2611
+ column_name: z45.string(),
2612
+ count: z45.number().int()
2613
+ });
2614
+ var CfdDateEntrySchema = z45.object({
2615
+ date: z45.string(),
2616
+ columns: z45.array(CfdColumnDataSchema)
2617
+ });
2618
+ var CfdResponseSchema = z45.object({
2619
+ entries: z45.array(CfdDateEntrySchema),
2620
+ column_names: z45.array(z45.string())
2621
+ });
2622
+ var ForecastProbabilitySchema = z45.object({
2623
+ confidence: z45.number(),
2624
+ date: z45.string(),
2625
+ weeks: z45.number()
2626
+ });
2627
+ var ForecastResponseSchema = z45.object({
2628
+ remaining_tickets: z45.number().int(),
2629
+ simulations: z45.number().int(),
2630
+ probabilities: z45.array(ForecastProbabilitySchema),
2631
+ target_date_probability: z45.number().nullable(),
2632
+ weekly_throughput_avg: z45.number(),
2633
+ weekly_throughput_stddev: z45.number(),
2634
+ data_weeks: z45.number().int()
2635
+ });
2636
+ var EstimationResponseSchema = z45.object({
2637
+ ticket_id: z45.string().uuid(),
2638
+ similar_count: z45.number().int(),
2639
+ cycle_time_estimate: z45.object({
2640
+ min: z45.number(),
2641
+ max: z45.number(),
2642
+ avg: z45.number(),
2643
+ median: z45.number(),
2644
+ p85: z45.number()
2645
+ }).nullable(),
2646
+ similar_tickets: z45.array(z45.object({
2647
+ ticket_id: z45.string().uuid(),
2648
+ title: z45.string(),
2649
+ cycle_time_value: z45.number(),
2650
+ keyword_overlap: z45.number().int()
2651
+ })),
2652
+ time_unit: z45.enum(["minutes", "hours", "days"]).default("days")
2653
+ });
2654
+ var RetrospectiveInsightsSchema = z45.object({
2655
+ period_days: z45.number().int(),
2656
+ throughput: z45.object({
2657
+ created: z45.number().int(),
2658
+ completed: z45.number().int(),
2659
+ net: z45.number().int()
2660
+ }),
2661
+ bottlenecks: z45.object({
2662
+ high_backward_moves: z45.array(z45.object({
2663
+ ticket_id: z45.string().uuid(),
2664
+ backward_moves: z45.number().int()
2665
+ })),
2666
+ avg_backward_moves: z45.number()
2667
+ }),
2668
+ rework: z45.object({
2669
+ total_backward_moves: z45.number().int(),
2670
+ tickets_with_rework: z45.number().int()
2671
+ }),
2672
+ workload: z45.array(z45.object({
2673
+ assignee_id: z45.string().uuid(),
2674
+ completed: z45.number().int(),
2675
+ avg_cycle_time_value: z45.number().nullable()
2676
+ })),
2677
+ wip: z45.object({
2678
+ current_in_progress: z45.number().int()
2679
+ }),
2680
+ time_unit: z45.enum(["minutes", "hours", "days"]).default("days")
2681
+ });
2682
+ var BoardAnalyticsSummarySchema = z45.object({
2683
+ velocity: VelocityResponseSchema,
2684
+ cycle_time: z45.object({
2685
+ avg_value: z45.number(),
2686
+ p85_value: z45.number(),
2687
+ total_completed: z45.number().int(),
2688
+ time_unit: z45.enum(["minutes", "hours", "days"]).default("days")
2689
+ }),
2690
+ wip: z45.object({
2691
+ current: z45.number().int(),
2692
+ limit: z45.number().int().nullable()
2693
+ })
2694
+ });
2695
+
2696
+ // ../types/dist/pipeline-template.schema.js
2697
+ import { z as z46 } from "zod";
2698
+ var PipelineTemplateStepSchema = z46.object({
2699
+ name: z46.string(),
2700
+ tool: z46.string(),
2701
+ description: z46.string(),
2702
+ params: z46.record(z46.string(), z46.unknown()),
2703
+ condition: z46.string().optional(),
2704
+ onError: z46.enum(["stop", "skip", "warn"])
2705
+ });
2706
+ var PipelineTemplateSchema = z46.object({
2707
+ id: z46.string().uuid(),
2708
+ project_id: z46.string().uuid().nullable(),
2709
+ name: z46.string(),
2710
+ display_name: z46.string(),
2711
+ description: z46.string(),
2712
+ steps: z46.array(PipelineTemplateStepSchema),
2713
+ parameters: z46.record(z46.string(), z46.unknown()).default({}),
2714
+ is_builtin: z46.boolean(),
2715
+ created_at: z46.string().datetime({ offset: true }),
2716
+ updated_at: z46.string().datetime({ offset: true })
2717
+ });
2718
+ var CreatePipelineTemplateBodySchema = z46.object({
2719
+ name: z46.string().min(1).max(100),
2720
+ display_name: z46.string().min(1).max(200),
2721
+ description: z46.string().max(2e3),
2722
+ steps: z46.array(PipelineTemplateStepSchema).min(1),
2723
+ parameters: z46.record(z46.string(), z46.unknown()).optional().default({})
2724
+ });
2725
+ var UpdatePipelineTemplateBodySchema = z46.object({
2726
+ name: z46.string().min(1).max(100).optional(),
2727
+ display_name: z46.string().min(1).max(200).optional(),
2728
+ description: z46.string().max(2e3).optional(),
2729
+ steps: z46.array(PipelineTemplateStepSchema).min(1).optional(),
2730
+ parameters: z46.record(z46.string(), z46.unknown()).optional()
2731
+ });
2732
+ var RunPipelineTemplateBodySchema = z46.object({
2733
+ parameters: z46.record(z46.string(), z46.unknown()).optional().default({}),
2734
+ dryRun: z46.boolean().optional().default(true)
2735
+ });
2736
+
2737
+ // ../types/dist/time-unit.js
2738
+ import { z as z47 } from "zod";
2739
+ var TimeUnitSchema = z47.enum(["minutes", "hours", "days"]);
2740
+
2741
+ // ../types/dist/pipeline-analytics.schema.js
2742
+ import { z as z48 } from "zod";
2743
+ var PeriodSchema = z48.object({
2744
+ since: z48.string(),
2745
+ until: z48.string()
2746
+ });
2747
+ var PipelineAnalyticsQuerySchema = z48.object({
2748
+ boardId: z48.string().uuid().optional(),
2749
+ since: z48.string().datetime({ offset: true }).optional(),
2750
+ until: z48.string().datetime({ offset: true }).optional()
2751
+ });
2752
+ var PipelineAnalyticsResolutionQuerySchema = PipelineAnalyticsQuerySchema.extend({
2753
+ resolution: z48.enum(["auto", "minutes", "hours", "days"]).optional()
2754
+ });
2755
+ var RunsQuerySchema = z48.object({
2756
+ boardId: z48.string().uuid().optional(),
2757
+ limit: z48.coerce.number().optional().default(10)
2758
+ });
2759
+ var SessionsQuerySchema = z48.object({
2760
+ boardId: z48.string().uuid().optional(),
2761
+ since: z48.string().datetime({ offset: true }).optional(),
2762
+ limit: z48.coerce.number().optional().default(20)
2763
+ });
2764
+ var AutonomyResponseSchema = z48.object({
2765
+ total_completed: z48.number(),
2766
+ fully_autonomous: z48.number(),
2767
+ human_assisted: z48.number(),
2768
+ human_only: z48.number(),
2769
+ autonomy_rate: z48.number(),
2770
+ period: PeriodSchema
2771
+ });
2772
+ var RunSchema = z48.object({
2773
+ started_at: z48.string(),
2774
+ ended_at: z48.string(),
2775
+ tickets_entered: z48.number(),
2776
+ tickets_completed: z48.number(),
2777
+ tickets_escalated: z48.number(),
2778
+ duration_minutes: z48.number()
2779
+ });
2780
+ var RunsResponseSchema = z48.object({
2781
+ runs: z48.array(RunSchema)
2782
+ });
2783
+ var SessionSchema = z48.object({
2784
+ session_id: z48.string(),
2785
+ started_at: z48.string(),
2786
+ last_activity_at: z48.string(),
2787
+ action_count: z48.number()
2788
+ });
2789
+ var SessionsResponseSchema = z48.object({
2790
+ sessions: z48.array(SessionSchema)
2791
+ });
2792
+ var ThroughputBucketSchema = z48.object({
2793
+ timestamp: z48.string(),
2794
+ autonomous: z48.number(),
2795
+ human_assisted: z48.number(),
2796
+ human_only: z48.number(),
2797
+ escalated: z48.number()
2798
+ });
2799
+ var ThroughputResponseSchema = z48.object({
2800
+ buckets: z48.array(ThroughputBucketSchema),
2801
+ time_unit: TimeUnitSchema,
2802
+ period: PeriodSchema
2803
+ });
2804
+
2805
+ // ../types/dist/ticket-transition.schema.js
2806
+ import { z as z49 } from "zod";
2807
+ var TransitionQuerySchema = z49.object({
2808
+ limit: z49.coerce.number().int().min(1).max(100).default(20)
2809
+ });
2810
+ var TicketTransitionSchema = z49.object({
2811
+ id: z49.string().uuid(),
2812
+ project_id: z49.string().uuid(),
2813
+ board_id: z49.string().uuid(),
2814
+ ticket_id: z49.string().uuid(),
2815
+ from_column: z49.string().uuid().nullable(),
2816
+ to_column: z49.string().uuid(),
2817
+ moved_by: z49.string().uuid().nullable(),
2818
+ handoff: z49.record(z49.string(), z49.unknown()).nullable().default(null),
2819
+ created_at: z49.string().datetime({ offset: true })
2820
+ });
2821
+ var TicketTransitionWithColumnsSchema = TicketTransitionSchema.extend({
2822
+ from_column_name: z49.string().nullable().optional(),
2823
+ to_column_name: z49.string().nullable().optional()
2824
+ });
2825
+
2826
+ // ../types/dist/pipeline-context.schema.js
2827
+ import { z as z50 } from "zod";
2828
+ var AdvisorConfigSchema = z50.object({
2829
+ enabled: z50.boolean(),
2830
+ max_invocations: z50.number().int().positive().optional(),
2831
+ model: z50.string().optional()
2832
+ });
2833
+ var ModelRoutingSchema = z50.object({
2834
+ initial: z50.string(),
2835
+ escalation: z50.array(z50.string()).min(1),
2836
+ escalate_after: z50.number().int().positive().optional()
2837
+ });
2838
+ var StuckDetectionConfigSchema = z50.object({
2839
+ enabled: z50.boolean(),
2840
+ first_check: z50.number().int().positive().optional(),
2841
+ interval: z50.number().int().positive().optional()
2842
+ });
2843
+ var AgentConfigSchema = z50.object({
2844
+ execution_mode: z50.enum(["kant_loop", "cron_poll", "manual"]).optional(),
2845
+ provider: z50.string().optional(),
2846
+ // Column-level provider override (e.g. 'claude', 'codex')
2847
+ model_preference: z50.string().optional(),
2848
+ max_iterations: z50.number().int().positive().optional(),
2849
+ max_budget_usd: z50.number().positive().nullable().optional(),
2850
+ concurrency: z50.number().int().positive().optional(),
2851
+ gutter_threshold: z50.number().int().positive().optional(),
2852
+ poll_interval_seconds: z50.number().int().positive().optional(),
2853
+ worktree: z50.object({
2854
+ enabled: z50.boolean(),
2855
+ path_pattern: z50.string().optional(),
2856
+ // legacy — still accepted, ignored by orchestrator
2857
+ on_move: z50.enum(["keep", "merge", "cleanup"]).optional(),
2858
+ on_done: z50.enum(["pr", "merge", "cleanup"]).optional(),
2859
+ integration_branch: z50.string().optional()
2860
+ }).optional(),
2861
+ invocation_tier: z50.enum(["auto", "light", "heavy"]).optional(),
2862
+ run_memory: z50.boolean().optional(),
2863
+ lookahead_column_id: z50.string().uuid().optional(),
2864
+ advisor: AdvisorConfigSchema.optional(),
2865
+ checkpoint: z50.boolean().optional(),
2866
+ model_routing: ModelRoutingSchema.optional(),
2867
+ builtin_tools: z50.string().optional(),
2868
+ // Value for --tools flag: space-separated list, '' to strip all
2869
+ allowed_tools: z50.array(z50.string()).optional(),
2870
+ disallowed_tools: z50.array(z50.string()).optional(),
2871
+ stuck_detection: StuckDetectionConfigSchema.optional(),
2872
+ extensions: z50.record(z50.string(), z50.unknown()).optional()
2873
+ }).strict();
2874
+ var TicketFingerprintSchema = z50.object({
2875
+ column_id: z50.string().uuid().nullable(),
2876
+ updated_at: z50.string().datetime({ offset: true }),
2877
+ comment_count: z50.number(),
2878
+ signal_count: z50.number(),
2879
+ field_value_count: z50.number()
2880
+ });
2881
+ var DebtItemSchema = z50.object({
2882
+ type: z50.enum(["dropped_criterion", "missing_test", "missing_functionality", "unmet_requirement", "waived_gate"]),
2883
+ description: z50.string(),
2884
+ severity: z50.enum(["high", "medium", "low"]),
2885
+ source_column: z50.string().optional()
2886
+ });
2887
+ var LoopCheckpointSchema = z50.object({
2888
+ run_id: z50.string().uuid(),
2889
+ column_id: z50.string().uuid(),
2890
+ iteration: z50.number().int().nonnegative(),
2891
+ gutter_count: z50.number().int().nonnegative(),
2892
+ advisor_invocations: z50.number().int().nonnegative(),
2893
+ model_tier: z50.string(),
2894
+ last_fingerprint: TicketFingerprintSchema.optional(),
2895
+ worktree_name: z50.string().optional(),
2896
+ updated_at: z50.string().datetime({ offset: true })
2897
+ });
2898
+ var PipelineContextBoardScopeSchema = z50.object({
2899
+ scope: z50.literal("board"),
2900
+ board: z50.object({
2901
+ id: z50.string().uuid(),
2902
+ name: z50.string()
2903
+ }),
2904
+ backlog_ticket_count: z50.number().int(),
2905
+ columns: z50.array(z50.object({
2906
+ id: z50.string().uuid(),
2907
+ name: z50.string(),
2908
+ type: z50.string(),
2909
+ position: z50.number().int(),
2910
+ wip_limit: z50.number().int().nullable(),
2911
+ goal: z50.string().nullable().optional(),
2912
+ ticket_count: z50.number().int(),
2913
+ has_prompt: z50.boolean(),
2914
+ constraint_count: z50.number().int().nonnegative().optional()
2915
+ })),
2916
+ circuit_breaker: z50.object({
2917
+ threshold: z50.number().int().nullable(),
2918
+ target_column_id: z50.string().uuid().nullable()
2919
+ }).nullable(),
2920
+ tool_prefix: z50.string(),
2921
+ board_constraint_count: z50.number().int().nonnegative().optional()
2922
+ });
2923
+ var PipelineContextColumnScopeSchema = z50.object({
2924
+ scope: z50.literal("column"),
2925
+ column: z50.object({
2926
+ id: z50.string().uuid(),
2927
+ name: z50.string(),
2928
+ goal: z50.string().nullable().optional()
2929
+ }),
2930
+ prompt_document: z50.object({
2931
+ id: z50.string().uuid(),
2932
+ title: z50.string(),
2933
+ content: z50.string()
2934
+ }).nullable().optional(),
2935
+ agent_config: z50.record(z50.string(), z50.unknown()).nullable().optional(),
2936
+ tickets: z50.array(z50.object({
2937
+ id: z50.string().uuid(),
2938
+ ticket_number: z50.number().int(),
2939
+ title: z50.string(),
2940
+ assignee_name: z50.string().nullable(),
2941
+ backward_transitions: z50.number().int().optional()
2942
+ })),
2943
+ transition_rules: z50.string().nullable(),
2944
+ signals: z50.array(z50.string()),
2945
+ field_definitions: z50.array(z50.object({
2946
+ id: z50.string().uuid(),
2947
+ name: z50.string(),
2948
+ type: z50.string()
2949
+ })),
2950
+ tool_prefix: z50.string(),
2951
+ firing_constraints: z50.array(z50.object({
2952
+ id: z50.string().uuid(),
2953
+ name: z50.string(),
2954
+ enabled: z50.boolean(),
2955
+ subject_type: FiringConstraintSubjectTypeSchema,
2956
+ subject_ref: z50.string(),
2957
+ operator: FiringConstraintOperatorSchema,
2958
+ value: z50.unknown(),
2959
+ scope: z50.string(),
2960
+ notify: z50.boolean(),
2961
+ column_id: z50.string().uuid().nullable()
2962
+ })).optional()
2963
+ });
2964
+ var PipelineContextTicketScopeSchema = z50.object({
2965
+ scope: z50.literal("ticket"),
2966
+ ticket: z50.object({
2967
+ id: z50.string().uuid(),
2968
+ ticket_number: z50.number().int(),
2969
+ title: z50.string(),
2970
+ description: z50.string().nullable(),
2971
+ backward_transitions: z50.number().int(),
2972
+ assignee: z50.object({
2973
+ id: z50.string().uuid(),
2974
+ name: z50.string()
2975
+ }).nullable(),
2976
+ column: z50.object({
2977
+ id: z50.string().uuid(),
2978
+ name: z50.string(),
2979
+ type: z50.string()
2980
+ }).nullable()
2981
+ }),
2982
+ field_values: z50.array(z50.object({
2983
+ field_name: z50.string(),
2984
+ value: z50.unknown()
2985
+ })),
2986
+ transitions: z50.array(z50.object({
2987
+ from: z50.string().nullable(),
2988
+ to: z50.string(),
2989
+ handoff: z50.record(z50.string(), z50.unknown()).nullable(),
2990
+ timestamp: z50.string()
2991
+ })),
2992
+ comments: z50.array(z50.object({
2993
+ author: z50.string(),
2994
+ body: z50.string(),
2995
+ created_at: z50.string()
2996
+ })),
2997
+ ticket_links: z50.array(z50.object({
2998
+ direction: z50.enum(["outward", "inward"]),
2999
+ link_type: z50.enum(["blocks", "relates_to", "duplicates"]),
3000
+ ticket_id: z50.string().uuid(),
3001
+ ticket_number: z50.number().int(),
3002
+ title: z50.string(),
3003
+ column_name: z50.string().nullable(),
3004
+ resolved: z50.boolean()
3005
+ })),
3006
+ parent: z50.object({
3007
+ id: z50.string().uuid(),
3008
+ ticket_number: z50.number().int(),
3009
+ title: z50.string()
3010
+ }).nullable(),
3011
+ children: z50.array(z50.object({
3012
+ id: z50.string().uuid(),
3013
+ ticket_number: z50.number().int(),
3014
+ title: z50.string(),
3015
+ column_name: z50.string().nullable()
3016
+ })),
3017
+ signals: z50.array(z50.string()),
3018
+ linked_documents: z50.array(z50.object({
3019
+ id: z50.string().uuid(),
3020
+ title: z50.string(),
3021
+ content: z50.string().optional(),
3022
+ truncated: z50.boolean().optional()
3023
+ })),
3024
+ transition_rules: z50.string().nullable(),
3025
+ dependency_requirements: z50.string(),
3026
+ tool_prefix: z50.string()
3027
+ });
3028
+ var PipelineContextResponseSchema = z50.discriminatedUnion("scope", [
3029
+ PipelineContextBoardScopeSchema,
3030
+ PipelineContextColumnScopeSchema,
3031
+ PipelineContextTicketScopeSchema
3032
+ ]);
3033
+
3034
+ // ../types/dist/gate.schema.js
3035
+ import { z as z51 } from "zod";
3036
+ var GateResultSchema = z51.object({
3037
+ name: z51.string(),
3038
+ passed: z51.boolean(),
3039
+ required: z51.boolean(),
3040
+ duration_ms: z51.number().int().nonnegative(),
3041
+ output: z51.string().max(1048576),
3042
+ stderr: z51.string(),
3043
+ exit_code: z51.number().int().min(0).max(255),
3044
+ timed_out: z51.boolean()
3045
+ });
3046
+ var GateDeltaSchema = z51.enum(["improved", "same", "regressed", "first_check"]);
3047
+ var GateSnapshotSchema = z51.object({
3048
+ timestamp: z51.string().datetime({ offset: true }),
3049
+ iteration: z51.number().int().nonnegative(),
3050
+ results: z51.array(GateResultSchema),
3051
+ all_required_passed: z51.boolean(),
3052
+ delta_from_previous: GateDeltaSchema
3053
+ });
3054
+ var GateDefinitionSchema = z51.object({
3055
+ name: z51.string().min(1),
3056
+ run: z51.string().min(1),
3057
+ required: z51.boolean().default(true),
3058
+ timeout: z51.string().regex(/^\d+(s|m)$/, 'Must be format like "60s" or "5m"').optional()
3059
+ });
3060
+ var ColumnGateOverrideSchema = z51.object({
3061
+ extend: z51.boolean().default(true),
3062
+ gates: z51.array(GateDefinitionSchema).default([])
3063
+ });
3064
+ var BudgetConfigSchema = z51.object({
3065
+ max_input_tokens: z51.number().int().positive(),
3066
+ max_output_tokens: z51.number().int().positive(),
3067
+ warn_pct: z51.number().int().min(1).max(100).default(75)
3068
+ });
3069
+ var PricingEntrySchema = z51.object({
3070
+ input_per_mtok: z51.number().nonnegative(),
3071
+ output_per_mtok: z51.number().nonnegative()
3072
+ });
3073
+ var GateSettingsSchema = z51.object({
3074
+ cwd: z51.string().optional(),
3075
+ env: z51.record(z51.string(), z51.string()).optional(),
3076
+ total_timeout: z51.string().optional(),
3077
+ budget: BudgetConfigSchema.optional(),
3078
+ pricing: z51.record(z51.string(), PricingEntrySchema).optional()
3079
+ });
3080
+ var GateConfigSchema = z51.object({
3081
+ default: z51.array(GateDefinitionSchema),
3082
+ columns: z51.record(z51.string(), ColumnGateOverrideSchema).optional(),
3083
+ settings: GateSettingsSchema.optional()
3084
+ });
3085
+ var VerdictFindingSchema = z51.object({
3086
+ severity: z51.enum(["blocker", "warning", "nit"]),
3087
+ file: z51.string().optional(),
3088
+ line: z51.number().int().positive().optional(),
3089
+ description: z51.string()
3090
+ });
3091
+ var VerdictSchema = z51.object({
3092
+ decision: z51.enum(["approve", "reject"]),
3093
+ summary: z51.string(),
3094
+ findings: z51.array(VerdictFindingSchema)
3095
+ });
3096
+
3097
+ // src/lib/gate-config.ts
3098
+ var DANGEROUS_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
3099
+ var VALID_BRANCH_RE = /^[a-zA-Z0-9][a-zA-Z0-9._\-/]*$/;
3100
+ function assertNoPrototypePollutionKeys(value, depth = 0) {
3101
+ if (depth > 20 || value === null || typeof value !== "object") return;
3102
+ for (const key of Object.keys(value)) {
3103
+ if (DANGEROUS_KEYS.has(key)) {
3104
+ throw new Error(`Unsafe key "${key}" detected in YAML input`);
3105
+ }
3106
+ assertNoPrototypePollutionKeys(value[key], depth + 1);
3107
+ }
3108
+ }
3109
+ function parseGateConfig(yamlContent) {
3110
+ const raw = load(yamlContent, { schema: JSON_SCHEMA });
3111
+ assertNoPrototypePollutionKeys(raw);
3112
+ return GateConfigSchema.parse(raw);
3113
+ }
3114
+ function resolveGatesForColumn(config, columnName) {
3115
+ const lowerName = columnName.toLowerCase();
3116
+ const overrideKey = config.columns ? Object.keys(config.columns).find((k) => k.toLowerCase() === lowerName) : void 0;
3117
+ const override = overrideKey ? config.columns[overrideKey] : void 0;
3118
+ if (!override) {
3119
+ return [...config.default];
3120
+ }
3121
+ if (!override.extend) {
3122
+ if (override.gates.length === 0) {
3123
+ console.error(` [warn] Column "${columnName}" has extend:false with no gates \u2014 all gate enforcement disabled for this column`);
3124
+ }
3125
+ return [...override.gates];
3126
+ }
3127
+ const overrideNames = new Set(override.gates.map((g) => g.name));
3128
+ const merged = config.default.filter((g) => !overrideNames.has(g.name));
3129
+ return [...merged, ...override.gates];
3130
+ }
3131
+ var DEFAULT_TIMEOUT_MS = 6e4;
3132
+ function parseTimeout(timeout) {
3133
+ if (!timeout) return DEFAULT_TIMEOUT_MS;
3134
+ const match = timeout.match(/^(\d+)(s|m)$/);
3135
+ if (!match) return DEFAULT_TIMEOUT_MS;
3136
+ const value = parseInt(match[1], 10);
3137
+ if (value <= 0) return DEFAULT_TIMEOUT_MS;
3138
+ return match[2] === "m" ? value * 6e4 : value * 1e3;
3139
+ }
3140
+
3141
+ export {
3142
+ LoopCheckpointSchema,
3143
+ VerdictSchema,
3144
+ VALID_BRANCH_RE,
3145
+ parseGateConfig,
3146
+ resolveGatesForColumn,
3147
+ parseTimeout
3148
+ };
3149
+ //# sourceMappingURL=chunk-MN4H5NSU.js.map