@kammcs/buildit-mcp 0.1.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/README.md +299 -72
  3. package/SECURITY.md +5 -5
  4. package/dist/api/client.js +5 -1
  5. package/dist/api/generated/operations.js +717 -4
  6. package/dist/api/generated/schemas.js +718 -3
  7. package/dist/api/generated/strict.js +859 -3
  8. package/dist/channel/api.js +128 -0
  9. package/dist/channel/approvals.js +259 -0
  10. package/dist/channel/item-events.js +138 -0
  11. package/dist/channel/lock.js +181 -0
  12. package/dist/channel/loop.js +776 -0
  13. package/dist/channel/mask.js +365 -0
  14. package/dist/channel/threads.js +60 -0
  15. package/dist/channel/tool-ring.js +124 -0
  16. package/dist/channel/typing.js +150 -0
  17. package/dist/channel/waiters.js +229 -0
  18. package/dist/channel/workers.js +66 -0
  19. package/dist/cli/claude-config.js +100 -0
  20. package/dist/cli/commands.js +410 -0
  21. package/dist/config.js +329 -6
  22. package/dist/errors.js +38 -0
  23. package/dist/index.js +122 -6
  24. package/dist/log.js +3 -2
  25. package/dist/secrets/keychain.js +273 -0
  26. package/dist/server.js +53 -5
  27. package/dist/tools/approve.js +791 -0
  28. package/dist/tools/ask.js +898 -0
  29. package/dist/tools/chat.js +98 -1
  30. package/dist/tools/items-read.js +41 -5
  31. package/dist/tools/items-write.js +66 -15
  32. package/dist/tools/pages.js +81 -1
  33. package/dist/tools/plans.js +221 -14
  34. package/dist/tools/projects.js +38 -24
  35. package/dist/tools/reply.js +138 -0
  36. package/dist/tools/shared.js +34 -1
  37. package/dist/tools/threads.js +123 -0
  38. package/dist/tools/whoami.js +29 -4
  39. package/dist/toolsets/catalog.js +5 -2
  40. package/dist/toolsets/registry.js +2 -0
  41. package/dist/transports/stdio.js +260 -6
  42. package/package.json +5 -1
@@ -2,18 +2,45 @@
2
2
  * Exact schemas for the agent API: closed objects and enums, patterns and bounds. The test fake uses them to check requests and its own responses against the contract; the server parses responses with the tolerant schemas.ts.
3
3
  *
4
4
  * GENERATED by scripts/generate.ts from openapi/openapi.json (agent API
5
- * 1.1.0). Do not edit: change the contract, then run
5
+ * 1.8.0). Do not edit: change the contract, then run
6
6
  * `npm run generate`.
7
7
  */
8
8
  import { z } from 'zod';
9
+ export const AckSessionEventsRequestSchema = z.strictObject({ cursor: z.int().min(0) });
10
+ export const AckSessionEventsResponseSchema = z.strictObject({
11
+ acked: z.int().min(0),
12
+ cursor: z.int().min(0),
13
+ });
14
+ export const AgentRefSchema = z.string().min(1).max(40);
9
15
  export const AllowedTransitionSchema = z.strictObject({
10
16
  to: z.string(),
11
17
  required_fields: z.array(z.string()),
12
18
  admins_only: z.boolean(),
13
19
  });
20
+ export const AnswerSessionResponseRequestSchema = z.strictObject({
21
+ status: z.enum(['accepted', 'rejected']),
22
+ note: z.string().optional(),
23
+ revision: z.int().min(1),
24
+ });
25
+ export const ApprovalFieldSchema = z.strictObject({
26
+ key: z.string(),
27
+ value: z.string(),
28
+ cut: z.int().min(0).optional(),
29
+ });
30
+ export const ApprovalRuleEntrySchema = z.strictObject({
31
+ toolName: z.string().regex(new RegExp('^[A-Za-z0-9][A-Za-z0-9_.:-]{0,99}$', 'u')),
32
+ ruleContent: z.string().optional(),
33
+ });
34
+ export const CardAnswerSchema = z.union([
35
+ z.strictObject({ action: z.string().min(1).max(40) }),
36
+ z.strictObject({ inputs: z.record(z.string(), z.union([z.string(), z.array(z.string())])) }),
37
+ ]);
14
38
  export const ChannelNameSchema = z.string().min(1).max(100);
15
39
  export const ChannelRefSchema = z.string().min(1).max(100);
16
40
  export const ChannelVisibilitySchema = z.enum(['public', 'private']);
41
+ export const CloseSessionApprovalRequestSchema = z.strictObject({
42
+ reason: z.enum(['answered_elsewhere', 'stale', 'interrupted', 'session_ended', 'expired']),
43
+ });
17
44
  export const ColorSchema = z.string().regex(new RegExp('^#[0-9A-Fa-f]{6}$', 'u'));
18
45
  export const CommentBodySchema = z.string().min(1).max(20000);
19
46
  export const CompleteSprintRequestSchema = z.strictObject({
@@ -37,6 +64,7 @@ export const DevelopmentBranchSchema = z.strictObject({
37
64
  repo: z.string(),
38
65
  url: z.string(),
39
66
  });
67
+ export const DeviceCodeSchema = z.string().regex(new RegExp('^[0-9A-Za-z]{43}$', 'u'));
40
68
  export const EmptyRequestSchema = z.strictObject({});
41
69
  export const EntityKindSchema = z.enum([
42
70
  'project',
@@ -58,6 +86,9 @@ export const EntityKindSchema = z.enum([
58
86
  'message',
59
87
  'plan',
60
88
  'route',
89
+ 'response',
90
+ 'agent',
91
+ 'approval',
61
92
  ]);
62
93
  export const EstimateSchema = z.number().min(0).max(9999.99);
63
94
  export const EstimateScaleSchema = z.enum(['none', 'points', 'tshirt']);
@@ -100,6 +131,14 @@ export const ItemRefSchema = z
100
131
  .regex(new RegExp('^(#?[A-Za-z][A-Za-z0-9]{1,5}-[1-9][0-9]{0,8}|[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12})$', 'u'));
101
132
  export const ItemTitleSchema = z.string().min(1).max(255);
102
133
  export const LabelRefSchema = z.string().min(1).max(40);
134
+ export const LinkCountsSchema = z.strictObject({
135
+ blocks: z.int().min(0),
136
+ blocked_by: z.int().min(0),
137
+ relates: z.int().min(0),
138
+ duplicates: z.int().min(0),
139
+ duplicated_by: z.int().min(0),
140
+ blocked_by_open: z.int().min(0),
141
+ });
103
142
  export const LinkKindSchema = z.enum([
104
143
  'blocks',
105
144
  'blocked_by',
@@ -121,6 +160,11 @@ export const NameRefSchema = z.string().min(1).max(60);
121
160
  export const NewProjectKeySchema = z.string().regex(new RegExp('^[A-Za-z][A-Za-z0-9]{1,5}$', 'u'));
122
161
  export const OrgRoleSchema = z.enum(['owner', 'admin', 'member', 'guest']);
123
162
  export const PageBodySchema = z.string().max(1048576);
163
+ export const PageSearchMatchSchema = z.strictObject({
164
+ score: z.number(),
165
+ title_highlight: z.string(),
166
+ snippet: z.string().nullable(),
167
+ });
124
168
  export const PageTitleSchema = z.string().min(1).max(200);
125
169
  export const PlanActionSchema = z.enum([
126
170
  'delete_item',
@@ -143,12 +187,16 @@ export const ProjectTemplateSchema = z.enum([
143
187
  'ops',
144
188
  'marketing',
145
189
  ]);
190
+ export const QuestionCardSchema = z.record(z.string(), z.unknown());
146
191
  export const RateLimitsSchema = z.strictObject({
147
192
  requests_per_minute: z.int(),
148
193
  user_requests_per_minute: z.int(),
149
194
  writes_per_minute: z.int(),
150
195
  writes_per_day: z.int(),
151
196
  org_requests_per_minute: z.int(),
197
+ polls_per_minute: z.int().optional(),
198
+ typing_per_minute: z.int().optional(),
199
+ approvals_per_minute: z.int().optional(),
152
200
  });
153
201
  export const ReleaseRefSchema = z.string().min(1).max(80);
154
202
  export const ReleaseStatusSchema = z.enum(['unreleased', 'released', 'archived']);
@@ -166,6 +214,21 @@ export const SearchMatchSchema = z.strictObject({
166
214
  title_highlight: z.string(),
167
215
  snippet: z.string().nullable(),
168
216
  });
217
+ export const SessionCardSettingsSchema = z.strictObject({
218
+ visibility: z.enum(['shared', 'private', 'anonymous']),
219
+ results: z.enum(['live', 'on_close', 'hidden']),
220
+ mode: z.enum(['once', 'changeable']),
221
+ confirm: z.boolean(),
222
+ });
223
+ export const SessionRuleEntrySchema = z.strictObject({
224
+ toolName: z.string().regex(new RegExp('^[A-Za-z0-9][A-Za-z0-9_.:-]{0,99}$', 'u')),
225
+ ruleContent: z.string().optional(),
226
+ });
227
+ export const SessionStateSchema = z.enum(['online', 'offline']);
228
+ export const SessionTextSchema = z.string();
229
+ export const SessionTokenSchema = z
230
+ .string()
231
+ .regex(new RegExp('^buildit_ags_[0-9A-Za-z]{49}$', 'u'));
169
232
  export const SprintRefSchema = z.string().min(1).max(80);
170
233
  export const SprintStateSchema = z.enum(['planned', 'active', 'completed']);
171
234
  export const StatusCategorySchema = z.enum(['not_started', 'started', 'done', 'canceled']);
@@ -180,6 +243,9 @@ export const TransitionMoveSchema = z.strictObject({
180
243
  required_fields: z.array(z.string()),
181
244
  admins_only: z.boolean(),
182
245
  });
246
+ export const UserCodeSchema = z
247
+ .string()
248
+ .regex(new RegExp('^[BCDFGHJKLMNPQRSTVWXZ]{4}-[BCDFGHJKLMNPQRSTVWXZ]{4}$', 'u'));
183
249
  export const UserRefSchema = z.string().min(1).max(320);
184
250
  export const UuidSchema = z
185
251
  .string()
@@ -190,6 +256,20 @@ export const AddCommentRequestSchema = z.strictObject({
190
256
  idempotency_key: UuidSchema.optional(),
191
257
  });
192
258
  export const AddLinkRequestSchema = z.strictObject({ kind: LinkKindSchema, target: ItemRefSchema });
259
+ export const AgentBriefSchema = z.strictObject({ id: UuidSchema, name: z.string() });
260
+ export const ApprovalRuleSchema = z.union([
261
+ z.strictObject({
262
+ type: z.literal('addRules'),
263
+ rules: z.array(ApprovalRuleEntrySchema).min(1).max(5),
264
+ behavior: z.literal('allow'),
265
+ destination: z.literal('session'),
266
+ }),
267
+ z.strictObject({
268
+ type: z.literal('setMode'),
269
+ mode: z.literal('acceptEdits'),
270
+ destination: z.literal('session'),
271
+ }),
272
+ ]);
193
273
  export const ArchiveStatusArgsSchema = z.strictObject({
194
274
  project: ProjectRefSchema,
195
275
  workflow: WorkflowRefSchema.optional(),
@@ -204,6 +284,27 @@ export const BoardColumnSchema = z.strictObject({
204
284
  statuses: z.array(z.string()),
205
285
  });
206
286
  export const ChannelBriefSchema = z.strictObject({ id: UuidSchema, name: z.string() });
287
+ export const CloseSessionCardResponseSchema = z.strictObject({ closed_at: TimestampSchema });
288
+ export const ConnectPollRequestSchema = z.strictObject({ device_code: DeviceCodeSchema });
289
+ export const ConnectStartRequestSchema = z.strictObject({
290
+ client: z.string().min(1).max(100),
291
+ machine: z.string().min(1).max(64),
292
+ label: z.string().min(1).max(40),
293
+ projects: z.array(ProjectRefSchema).min(1).max(10),
294
+ });
295
+ export const ConnectStartResponseSchema = z.strictObject({
296
+ device_code: DeviceCodeSchema,
297
+ user_code: UserCodeSchema,
298
+ verification_uri: z.string(),
299
+ verification_uri_complete: z.string(),
300
+ interval: z.int().min(1),
301
+ expires_in: z.int().min(1),
302
+ });
303
+ export const ConnectedSessionSchema = z.strictObject({
304
+ id: UuidSchema,
305
+ label: z.string(),
306
+ projects: z.array(z.strictObject({ id: UuidSchema, key: ProjectKeySchema })),
307
+ });
207
308
  export const CreateChannelRequestSchema = z.strictObject({
208
309
  name: ChannelNameSchema,
209
310
  description: z.string().max(1000).optional(),
@@ -240,6 +341,11 @@ export const CreateSprintRequestSchema = z.strictObject({
240
341
  starts_on: DateSchema.optional(),
241
342
  ends_on: DateSchema.optional(),
242
343
  });
344
+ export const CustomEmojiSchema = z.strictObject({
345
+ id: UuidSchema,
346
+ name: z.string(),
347
+ animated: z.boolean(),
348
+ });
243
349
  export const CustomValuesInSchema = z.record(z.string().min(1).max(60), CustomValueInSchema);
244
350
  export const DeleteItemArgsSchema = z.strictObject({ item: ItemRefSchema });
245
351
  export const DescriptionEditSchema = z.union([
@@ -355,7 +461,15 @@ export const ErrorSchema = z.strictObject({
355
461
  message: z.string().min(1),
356
462
  hint: z.string().optional(),
357
463
  details: z.strictObject({
358
- reason: z.enum(['admins_only', 'not_in_channel', 'not_reporter', 'guest', 'other']),
464
+ reason: z.enum([
465
+ 'admins_only',
466
+ 'not_in_channel',
467
+ 'not_reporter',
468
+ 'guest',
469
+ 'other',
470
+ 'agent_self_assign',
471
+ 'agent_assignee',
472
+ ]),
359
473
  }),
360
474
  }),
361
475
  z.strictObject({
@@ -507,6 +621,12 @@ export const ErrorSchema = z.strictObject({
507
621
  'token_writes_per_day',
508
622
  'org_requests_per_minute',
509
623
  'user_requests_per_minute',
624
+ 'session_polls_per_minute',
625
+ 'connect_starts_per_hour',
626
+ 'connect_pending_grants',
627
+ 'connect_pending_per_address',
628
+ 'session_typing_per_minute',
629
+ 'session_approvals_per_minute',
510
630
  ]),
511
631
  }),
512
632
  }),
@@ -534,6 +654,180 @@ export const ErrorSchema = z.strictObject({
534
654
  hint: z.string().optional(),
535
655
  details: z.strictObject({ ref: z.string().max(400) }),
536
656
  }),
657
+ z.strictObject({
658
+ code: z.literal('session_token_required'),
659
+ message: z.string().min(1),
660
+ hint: z.string().optional(),
661
+ details: z.strictObject({}),
662
+ }),
663
+ z.strictObject({
664
+ code: z.literal('agent_sessions_off'),
665
+ message: z.string().min(1),
666
+ hint: z.string().optional(),
667
+ details: z.strictObject({}),
668
+ }),
669
+ z.strictObject({
670
+ code: z.literal('authorization_pending'),
671
+ message: z.string().min(1),
672
+ hint: z.string().optional(),
673
+ details: z.strictObject({ interval: z.int().min(1) }),
674
+ }),
675
+ z.strictObject({
676
+ code: z.literal('slow_down'),
677
+ message: z.string().min(1),
678
+ hint: z.string().optional(),
679
+ details: z.strictObject({ interval: z.int().min(1) }),
680
+ }),
681
+ z.strictObject({
682
+ code: z.literal('access_denied'),
683
+ message: z.string().min(1),
684
+ hint: z.string().optional(),
685
+ details: z.strictObject({}),
686
+ }),
687
+ z.strictObject({
688
+ code: z.literal('expired_token'),
689
+ message: z.string().min(1),
690
+ hint: z.string().optional(),
691
+ details: z.strictObject({}),
692
+ }),
693
+ z.strictObject({
694
+ code: z.literal('thread_other_session'),
695
+ message: z.string().min(1),
696
+ hint: z.string().optional(),
697
+ details: z.strictObject({
698
+ thread_id: z
699
+ .string()
700
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u')),
701
+ }),
702
+ }),
703
+ z.strictObject({
704
+ code: z.literal('card_invalid'),
705
+ message: z.string().min(1),
706
+ hint: z.string().optional(),
707
+ details: z.strictObject({
708
+ errors: z.array(z.strictObject({ path: z.string(), message: z.string() })).min(1),
709
+ }),
710
+ }),
711
+ z.strictObject({
712
+ code: z.literal('card_closed'),
713
+ message: z.string().min(1),
714
+ hint: z.string().optional(),
715
+ details: z.strictObject({
716
+ message_id: z
717
+ .string()
718
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u')),
719
+ }),
720
+ }),
721
+ z.strictObject({
722
+ code: z.literal('response_changed'),
723
+ message: z.string().min(1),
724
+ hint: z.string().optional(),
725
+ details: z.strictObject({
726
+ response_id: z
727
+ .string()
728
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u')),
729
+ revision: z.int().min(1),
730
+ }),
731
+ }),
732
+ z.strictObject({
733
+ code: z.literal('not_own_message'),
734
+ message: z.string().min(1),
735
+ hint: z.string().optional(),
736
+ details: z.strictObject({
737
+ message_id: z
738
+ .string()
739
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u')),
740
+ }),
741
+ }),
742
+ z.strictObject({
743
+ code: z.literal('plan_awaits_owner'),
744
+ message: z.string().min(1),
745
+ hint: z.string().optional(),
746
+ details: z.strictObject({
747
+ handle: z.string(),
748
+ message_id: z
749
+ .string()
750
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u')),
751
+ }),
752
+ }),
753
+ z.strictObject({
754
+ code: z.literal('plan_card_exists'),
755
+ message: z.string().min(1),
756
+ hint: z.string().optional(),
757
+ details: z.strictObject({
758
+ handle: z.string(),
759
+ message_id: z
760
+ .string()
761
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u')),
762
+ }),
763
+ }),
764
+ z.strictObject({
765
+ code: z.literal('plan_card_required'),
766
+ message: z.string().min(1),
767
+ hint: z.string().optional(),
768
+ details: z.strictObject({ handle: z.string() }),
769
+ }),
770
+ z.strictObject({
771
+ code: z.literal('thread_not_bound'),
772
+ message: z.string().min(1),
773
+ hint: z.string().optional(),
774
+ details: z.strictObject({
775
+ thread_id: z
776
+ .string()
777
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u')),
778
+ }),
779
+ }),
780
+ z.strictObject({
781
+ code: z.literal('thread_required'),
782
+ message: z.string().min(1),
783
+ hint: z.string().optional(),
784
+ details: z.strictObject({
785
+ conversation_id: z
786
+ .string()
787
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u')),
788
+ }),
789
+ }),
790
+ z.strictObject({
791
+ code: z.literal('outside_reach'),
792
+ message: z.string().min(1),
793
+ hint: z.string().optional(),
794
+ details: z.strictObject({
795
+ thread_id: z
796
+ .string()
797
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u'))
798
+ .nullable(),
799
+ reason: z.enum([
800
+ 'session_ended',
801
+ 'session_projects',
802
+ 'projects_off',
803
+ 'not_in_channel',
804
+ 'archived',
805
+ ]),
806
+ }),
807
+ }),
808
+ z.strictObject({
809
+ code: z.literal('plan_outside_thread'),
810
+ message: z.string().min(1),
811
+ hint: z.string().optional(),
812
+ details: z.strictObject({
813
+ thread_id: z
814
+ .string()
815
+ .regex(new RegExp('^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$', 'u')),
816
+ key: z.string(),
817
+ }),
818
+ }),
819
+ z.strictObject({
820
+ code: z.literal('approvals_off'),
821
+ message: z.string().min(1),
822
+ hint: z.string().optional(),
823
+ details: z.strictObject({ by: z.enum(['agent', 'platform']) }),
824
+ }),
825
+ z.strictObject({
826
+ code: z.literal('too_many_open'),
827
+ message: z.string().min(1),
828
+ hint: z.string().optional(),
829
+ details: z.strictObject({ open: z.int().min(0) }),
830
+ }),
537
831
  ]),
538
832
  });
539
833
  export const FeedbackSchema = z.strictObject({
@@ -642,6 +936,12 @@ export const MoveItemArgsSchema = z.strictObject({
642
936
  type: NameRefSchema.optional(),
643
937
  status: NameRefSchema.optional(),
644
938
  });
939
+ export const OrgMemberSchema = z.strictObject({
940
+ id: UuidSchema,
941
+ display_name: z.string(),
942
+ email: z.string().nullable(),
943
+ role: OrgRoleSchema,
944
+ });
645
945
  export const PlanEffectSchema = z.strictObject({
646
946
  op: z.enum(['create', 'update', 'archive', 'restore', 'delete', 'move', 'transition', 'relabel']),
647
947
  kind: z.enum(['item', 'workflow', 'status', 'transition', 'type', 'field', 'option', 'label']),
@@ -653,6 +953,19 @@ export const PlanEffectSchema = z.strictObject({
653
953
  export const PlanningItemsRequestSchema = z.strictObject({
654
954
  items: z.array(ItemRefSchema).min(1).max(50),
655
955
  });
956
+ export const PostPlanCardRequestSchema = z.strictObject({
957
+ handle: PlanHandleSchema,
958
+ id: UuidSchema,
959
+ thread_id: UuidSchema.optional(),
960
+ });
961
+ export const PostSessionMessageRequestSchema = z.strictObject({
962
+ id: UuidSchema,
963
+ text: SessionTextSchema,
964
+ thread_id: UuidSchema.optional(),
965
+ reply_to_id: UuidSchema.optional(),
966
+ conversation_id: UuidSchema.optional(),
967
+ card: QuestionCardSchema.optional(),
968
+ });
656
969
  export const ProjectBriefSchema = z.strictObject({
657
970
  id: UuidSchema,
658
971
  key: ProjectKeySchema,
@@ -712,6 +1025,118 @@ export const ReleaseVersionRequestSchema = z.strictObject({
712
1025
  move_open_to: ReleaseRefSchema.optional(),
713
1026
  });
714
1027
  export const RemoveLinkResponseSchema = z.strictObject({ id: UuidSchema, removed: z.boolean() });
1028
+ export const SessionApprovalSchema = z.strictObject({
1029
+ id: UuidSchema,
1030
+ status: z.enum([
1031
+ 'open',
1032
+ 'approved',
1033
+ 'approved_session',
1034
+ 'denied',
1035
+ 'expired',
1036
+ 'answered_elsewhere',
1037
+ 'stale',
1038
+ 'closed',
1039
+ ]),
1040
+ reason: z
1041
+ .enum([
1042
+ 'time',
1043
+ 'client',
1044
+ 'session_ended',
1045
+ 'unassigned',
1046
+ 'interrupted',
1047
+ 'deleted',
1048
+ 'removed',
1049
+ 'switched_off',
1050
+ ])
1051
+ .optional(),
1052
+ tool_name: z.string(),
1053
+ thread_id: UuidSchema.nullable(),
1054
+ created_at: TimestampSchema,
1055
+ closes_at: TimestampSchema,
1056
+ decided_at: TimestampSchema.optional(),
1057
+ });
1058
+ export const SessionBriefSchema = z.strictObject({ id: UuidSchema, label: z.string() });
1059
+ export const SessionCardMessageSchema = z.strictObject({
1060
+ id: UuidSchema,
1061
+ thread_id: UuidSchema.nullable(),
1062
+ });
1063
+ export const SessionCardResponseSchema = z.strictObject({
1064
+ id: UuidSchema,
1065
+ message_id: UuidSchema,
1066
+ revision: z.int().min(1),
1067
+ status: z.enum(['recorded', 'accepted', 'rejected']),
1068
+ answer: CardAnswerSchema,
1069
+ note: z.string().nullable(),
1070
+ created_at: TimestampSchema,
1071
+ updated_at: TimestampSchema,
1072
+ });
1073
+ export const SessionContextMessageSchema = z.strictObject({
1074
+ id: UuidSchema,
1075
+ author: z.strictObject({
1076
+ kind: z.enum(['user', 'app', 'agent']),
1077
+ id: UuidSchema.nullable(),
1078
+ name: z.string(),
1079
+ }),
1080
+ from_owner: z.boolean(),
1081
+ via_agent: z.string().nullable().optional(),
1082
+ text: z.string(),
1083
+ created_at: TimestampSchema,
1084
+ });
1085
+ export const SessionEventMessageSchema = z.strictObject({
1086
+ id: UuidSchema,
1087
+ thread_id: UuidSchema.nullable(),
1088
+ reply_to_id: UuidSchema.nullable(),
1089
+ text: z.string(),
1090
+ mentions: z.array(UuidSchema),
1091
+ has_card: z.boolean(),
1092
+ created_at: TimestampSchema,
1093
+ edited_at: TimestampSchema.nullable(),
1094
+ via_agent: z.string().nullable().optional(),
1095
+ forwarded: z.boolean(),
1096
+ forwarded_from: z
1097
+ .strictObject({
1098
+ message_id: UuidSchema,
1099
+ user: z.strictObject({ id: UuidSchema, name: z.string() }).nullable(),
1100
+ app: z.strictObject({ id: UuidSchema, name: z.string() }).nullable(),
1101
+ })
1102
+ .nullable(),
1103
+ });
1104
+ export const SessionEventProjectSchema = z.strictObject({ id: UuidSchema, key: z.string() });
1105
+ export const SessionEventUserSchema = z.strictObject({
1106
+ id: UuidSchema,
1107
+ name: z.string(),
1108
+ is_guest: z.boolean(),
1109
+ locale: z.string().nullable(),
1110
+ });
1111
+ export const SessionHeartbeatRequestSchema = z.strictObject({ state: SessionStateSchema });
1112
+ export const SessionHeartbeatResponseSchema = z.strictObject({
1113
+ state: SessionStateSchema,
1114
+ last_seen_at: TimestampSchema,
1115
+ });
1116
+ export const SessionItemStatusSchema = z.strictObject({
1117
+ id: UuidSchema,
1118
+ key: z.string().nullable(),
1119
+ name: z.string().nullable(),
1120
+ category: z.string(),
1121
+ });
1122
+ export const SessionOwnerSchema = z.strictObject({ id: UuidSchema, name: z.string() });
1123
+ export const SessionRuleSchema = z.union([
1124
+ z.strictObject({
1125
+ type: z.literal('addRules'),
1126
+ rules: z.array(SessionRuleEntrySchema).min(1).max(5),
1127
+ behavior: z.literal('allow'),
1128
+ destination: z.literal('session'),
1129
+ }),
1130
+ z.strictObject({
1131
+ type: z.literal('setMode'),
1132
+ mode: z.literal('acceptEdits'),
1133
+ destination: z.literal('session'),
1134
+ }),
1135
+ ]);
1136
+ export const SessionTypingRequestSchema = z.strictObject({
1137
+ thread_id: UuidSchema.nullable().optional(),
1138
+ typing: z.boolean().optional(),
1139
+ });
715
1140
  export const SprintSchema = z.strictObject({
716
1141
  id: UuidSchema,
717
1142
  number: z.int(),
@@ -775,6 +1200,10 @@ export const UpdateReleaseRequestSchema = z.strictObject({
775
1200
  target_date: DateSchema.nullable().optional(),
776
1201
  released_on: DateSchema.optional(),
777
1202
  });
1203
+ export const UpdateSessionMessageRequestSchema = z.strictObject({
1204
+ text: SessionTextSchema.optional(),
1205
+ card: QuestionCardSchema.nullable().optional(),
1206
+ });
778
1207
  export const UserSchema = z.strictObject({
779
1208
  id: UuidSchema,
780
1209
  display_name: z.string(),
@@ -862,6 +1291,9 @@ export const WorkflowStatusSchema = z.strictObject({
862
1291
  board_column: z.string().nullable(),
863
1292
  allowed: z.array(AllowedTransitionSchema),
864
1293
  });
1294
+ export const AnswerSessionResponseResponseSchema = z.strictObject({
1295
+ response: SessionCardResponseSchema,
1296
+ });
865
1297
  export const BulkPatchSchema = z.strictObject({
866
1298
  status: NameRefSchema.optional(),
867
1299
  assignee: UserRefSchema.nullable().optional(),
@@ -888,6 +1320,9 @@ export const ChannelSchema = z.strictObject({
888
1320
  project: ProjectBriefSchema.nullable(),
889
1321
  last_message_at: TimestampSchema.nullable(),
890
1322
  });
1323
+ export const CloseSessionApprovalResponseSchema = z.strictObject({
1324
+ approval: SessionApprovalSchema,
1325
+ });
891
1326
  export const CommentSchema = z.strictObject({
892
1327
  id: UuidSchema,
893
1328
  author: UserSchema.nullable(),
@@ -906,6 +1341,14 @@ export const CompleteSprintResponseSchema = z.strictObject({
906
1341
  carried_count: z.int(),
907
1342
  carried_to: SprintBriefSchema.nullable(),
908
1343
  });
1344
+ export const ConnectPollResponseSchema = z.strictObject({
1345
+ token: SessionTokenSchema,
1346
+ expires_at: TimestampSchema,
1347
+ session: ConnectedSessionSchema,
1348
+ agent: AgentBriefSchema,
1349
+ owner: SessionOwnerSchema,
1350
+ org: z.strictObject({ id: UuidSchema, name: z.string() }),
1351
+ });
909
1352
  export const CreateItemRequestSchema = z.strictObject({
910
1353
  project: ProjectRefSchema.optional(),
911
1354
  type: NameRefSchema.optional(),
@@ -914,6 +1357,7 @@ export const CreateItemRequestSchema = z.strictObject({
914
1357
  parent: ItemRefSchema.optional(),
915
1358
  status: NameRefSchema.optional(),
916
1359
  assignee: UserRefSchema.optional(),
1360
+ assignee_agent: AgentRefSchema.optional(),
917
1361
  priority: PrioritySchema.optional(),
918
1362
  labels: z.array(LabelRefSchema).max(100).optional(),
919
1363
  estimate: EstimateSchema.optional(),
@@ -953,6 +1397,7 @@ export const FieldDefSchema = z.strictObject({
953
1397
  required_on_create: z.boolean(),
954
1398
  position: z.int(),
955
1399
  });
1400
+ export const GetSessionApprovalResponseSchema = z.strictObject({ approval: SessionApprovalSchema });
956
1401
  export const HistoryEventSchema = z.strictObject({
957
1402
  id: z.int(),
958
1403
  at: TimestampSchema,
@@ -975,6 +1420,7 @@ export const ItemSummarySchema = z.strictObject({
975
1420
  title: z.string(),
976
1421
  priority: PrioritySchema,
977
1422
  assignee: UserSchema.nullable(),
1423
+ assignee_agent: AgentBriefSchema.nullable(),
978
1424
  reporter: UserSchema.nullable(),
979
1425
  parent: ItemBriefSchema.nullable(),
980
1426
  initiative: InitiativeBriefSchema.nullable(),
@@ -999,6 +1445,11 @@ export const LinkedItemSchema = z.strictObject({
999
1445
  title: z.string(),
1000
1446
  status: StatusBriefSchema,
1001
1447
  });
1448
+ export const ListEmojiResponseSchema = z.strictObject({ items: z.array(CustomEmojiSchema) });
1449
+ export const ListMembersResponseSchema = z.strictObject({
1450
+ items: z.array(OrgMemberSchema),
1451
+ next_cursor: z.string().nullable(),
1452
+ });
1002
1453
  export const ListProjectMembersResponseSchema = z.strictObject({
1003
1454
  items: z.array(ProjectMemberSchema),
1004
1455
  next_cursor: z.string().nullable(),
@@ -1013,10 +1464,11 @@ export const ListSprintsResponseSchema = z.strictObject({
1013
1464
  });
1014
1465
  export const MeResponseSchema = z.strictObject({
1015
1466
  user: UserSchema,
1016
- org: z.strictObject({ id: UuidSchema, name: z.string() }),
1467
+ org: z.strictObject({ id: UuidSchema, name: z.string(), test: z.boolean().optional() }),
1017
1468
  token: z.strictObject({
1018
1469
  id: UuidSchema,
1019
1470
  name: z.string(),
1471
+ kind: z.enum(['pat', 'session']).optional(),
1020
1472
  scopes: z.array(ScopeSchema),
1021
1473
  expires_at: TimestampSchema,
1022
1474
  created_at: TimestampSchema,
@@ -1059,6 +1511,9 @@ export const MessageSchema = z.strictObject({
1059
1511
  edited_at: TimestampSchema.nullable(),
1060
1512
  deleted: z.boolean(),
1061
1513
  via_agent: z.string().nullable(),
1514
+ pinned: z.boolean(),
1515
+ pinned_at: TimestampSchema.nullable(),
1516
+ pinned_by: MessageAuthorSchema.nullable(),
1062
1517
  });
1063
1518
  export const PageSchema = z.strictObject({
1064
1519
  id: UuidSchema,
@@ -1075,6 +1530,14 @@ export const PageSchema = z.strictObject({
1075
1530
  created_at: TimestampSchema,
1076
1531
  created_by: UserSchema.nullable(),
1077
1532
  });
1533
+ export const PageSearchResultSchema = z.strictObject({
1534
+ id: UuidSchema,
1535
+ title: z.string(),
1536
+ parent_id: UuidSchema.nullable(),
1537
+ channel: ChannelBriefSchema,
1538
+ updated_at: TimestampSchema,
1539
+ match: PageSearchMatchSchema,
1540
+ });
1078
1541
  export const PageSummarySchema = z.strictObject({
1079
1542
  id: UuidSchema,
1080
1543
  title: z.string(),
@@ -1092,6 +1555,23 @@ export const PlanPreviewSchema = z.strictObject({
1092
1555
  item_count: z.int(),
1093
1556
  warnings: z.array(z.string()),
1094
1557
  });
1558
+ export const PostSessionApprovalRequestSchema = z.strictObject({
1559
+ id: UuidSchema,
1560
+ thread_id: UuidSchema.nullable().optional(),
1561
+ tool_name: z.string().regex(new RegExp('^[A-Za-z0-9][A-Za-z0-9_.:-]{0,99}$', 'u')),
1562
+ tool_use_id: z.string().regex(new RegExp('^[A-Za-z0-9_-]{1,100}$', 'u')).optional(),
1563
+ agent: z
1564
+ .strictObject({
1565
+ ref: z.string().regex(new RegExp('^[A-Za-z0-9_.:-]{1,200}$', 'u')),
1566
+ type: z.string().regex(new RegExp('^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$', 'u')).optional(),
1567
+ })
1568
+ .optional(),
1569
+ description: z.string().optional(),
1570
+ fields: z.array(ApprovalFieldSchema).max(20),
1571
+ more_fields: z.int().min(0).optional(),
1572
+ suggestion: SessionRuleSchema.optional(),
1573
+ wait_s: z.int().min(60).max(3540),
1574
+ });
1095
1575
  export const ProjectSummarySchema = z.strictObject({
1096
1576
  id: UuidSchema,
1097
1577
  key: ProjectKeySchema,
@@ -1110,6 +1590,117 @@ export const ReleaseItemsResponseSchema = z.strictObject({
1110
1590
  changed: z.array(ItemBriefSchema),
1111
1591
  });
1112
1592
  export const ReleaseResponseSchema = z.strictObject({ release: ReleaseSchema });
1593
+ export const SessionApprovalOutcomeSchema = z.strictObject({
1594
+ id: UuidSchema,
1595
+ outcome: z.enum([
1596
+ 'approved',
1597
+ 'approved_session',
1598
+ 'denied',
1599
+ 'expired',
1600
+ 'answered_elsewhere',
1601
+ 'stale',
1602
+ 'closed',
1603
+ ]),
1604
+ reason: z
1605
+ .enum([
1606
+ 'time',
1607
+ 'client',
1608
+ 'session_ended',
1609
+ 'unassigned',
1610
+ 'interrupted',
1611
+ 'deleted',
1612
+ 'removed',
1613
+ 'switched_off',
1614
+ ])
1615
+ .optional(),
1616
+ decided_by: UuidSchema.optional(),
1617
+ decided_at: TimestampSchema.optional(),
1618
+ rule: ApprovalRuleSchema.optional(),
1619
+ });
1620
+ export const SessionCardResponseDataSchema = z.strictObject({
1621
+ channel: z.strictObject({ id: UuidSchema, name: z.string().nullable() }),
1622
+ message: SessionCardMessageSchema,
1623
+ card: SessionCardSettingsSchema,
1624
+ response: z.strictObject({
1625
+ id: UuidSchema,
1626
+ revision: z.int().min(1),
1627
+ answer: CardAnswerSchema,
1628
+ created_at: TimestampSchema,
1629
+ updated_at: TimestampSchema,
1630
+ }),
1631
+ user: SessionEventUserSchema,
1632
+ pseudonym: z.string().nullable(),
1633
+ private: z.unknown(),
1634
+ });
1635
+ export const SessionEventItemSchema = z.strictObject({
1636
+ id: UuidSchema,
1637
+ key: z.string(),
1638
+ title: z.string(),
1639
+ type: z.strictObject({
1640
+ id: UuidSchema.nullable(),
1641
+ key: z.string().nullable(),
1642
+ name: z.string().nullable(),
1643
+ }),
1644
+ status: SessionItemStatusSchema.nullable(),
1645
+ created_at: TimestampSchema,
1646
+ description_excerpt: z.string().optional(),
1647
+ description_truncated: z.boolean().optional(),
1648
+ });
1649
+ export const SessionItemAssignmentSchema = z.strictObject({
1650
+ agent: AgentBriefSchema,
1651
+ owner: SessionOwnerSchema,
1652
+ by: SessionEventUserSchema.nullable(),
1653
+ at: TimestampSchema,
1654
+ });
1655
+ export const SessionItemContextSchema = z.strictObject({
1656
+ untrusted: z.literal(true),
1657
+ messages: z.array(SessionContextMessageSchema).max(10),
1658
+ });
1659
+ export const SessionMessageSchema = z.strictObject({
1660
+ id: UuidSchema,
1661
+ conversation_id: UuidSchema,
1662
+ thread_id: UuidSchema.nullable(),
1663
+ reply_to_id: UuidSchema.nullable(),
1664
+ text: z.string(),
1665
+ created_at: TimestampSchema,
1666
+ session: SessionBriefSchema,
1667
+ });
1668
+ export const SessionResponseSchema = z.strictObject({
1669
+ session: z.strictObject({
1670
+ id: UuidSchema,
1671
+ label: z.string(),
1672
+ machine: z.string(),
1673
+ client: z.string(),
1674
+ scopes: z.array(ScopeSchema),
1675
+ project_ids: z.array(UuidSchema),
1676
+ channel_ids: z.array(UuidSchema),
1677
+ approved_at: TimestampSchema,
1678
+ last_seen_at: TimestampSchema.nullable(),
1679
+ expires_at: TimestampSchema,
1680
+ }),
1681
+ agent: AgentBriefSchema,
1682
+ owner: SessionOwnerSchema,
1683
+ org: z.strictObject({ id: UuidSchema, name: z.string() }),
1684
+ dm: z.strictObject({ conversation_id: UuidSchema }),
1685
+ poll_interval_s: z.int().min(1),
1686
+ });
1687
+ export const SessionThreadSchema = z.strictObject({
1688
+ thread_id: UuidSchema,
1689
+ conversation_id: UuidSchema,
1690
+ kind: z.enum(['dm', 'item']),
1691
+ item: z
1692
+ .strictObject({
1693
+ id: UuidSchema,
1694
+ key: z.string(),
1695
+ title: z.string(),
1696
+ status: SessionItemStatusSchema.nullable(),
1697
+ })
1698
+ .nullable(),
1699
+ bound_reason: z.enum(['posted', 'routed', 'handed', 'assigned', 'mentioned']),
1700
+ bound_at: TimestampSchema,
1701
+ last_owner_message_at: TimestampSchema.nullable(),
1702
+ open_cards: z.int().min(0),
1703
+ });
1113
1704
  export const SprintItemsResponseSchema = z.strictObject({
1114
1705
  sprint: SprintSchema,
1115
1706
  changed: z.array(ItemBriefSchema),
@@ -1136,6 +1727,7 @@ export const UpdateItemRequestSchema = z.strictObject({
1136
1727
  status: NameRefSchema.optional(),
1137
1728
  parent: ItemRefSchema.nullable().optional(),
1138
1729
  assignee: UserRefSchema.nullable().optional(),
1730
+ assignee_agent: AgentRefSchema.nullable().optional(),
1139
1731
  priority: PrioritySchema.optional(),
1140
1732
  labels: z.array(LabelRefSchema).max(100).optional(),
1141
1733
  add_labels: z.array(LabelRefSchema).max(100).optional(),
@@ -1272,8 +1864,16 @@ export const ListProjectsResponseSchema = z.strictObject({
1272
1864
  items: z.array(ProjectSummarySchema),
1273
1865
  next_cursor: z.string().nullable(),
1274
1866
  });
1867
+ export const ListSessionThreadsResponseSchema = z.strictObject({
1868
+ threads: z.array(SessionThreadSchema).max(50),
1869
+ });
1275
1870
  export const ListWorkTypesResponseSchema = z.strictObject({ items: z.array(WorkTypeSchema) });
1276
1871
  export const PageResponseSchema = z.strictObject({ page: PageSchema });
1872
+ export const PinnedMessageSchema = z.strictObject({
1873
+ pinned_at: TimestampSchema,
1874
+ pinned_by: MessageAuthorSchema.nullable(),
1875
+ message: MessageSchema,
1876
+ });
1277
1877
  export const PlanResultSchema = z.union([
1278
1878
  z.strictObject({ action: z.literal('delete_item'), deleted: z.array(ItemBriefSchema) }),
1279
1879
  z.strictObject({
@@ -1288,7 +1888,70 @@ export const PlanResultSchema = z.union([
1288
1888
  z.strictObject({ action: z.literal('field_change'), field_id: UuidSchema }),
1289
1889
  z.strictObject({ action: z.literal('label_change'), label_id: UuidSchema }),
1290
1890
  ]);
1891
+ export const PostPlanCardResponseSchema = z.strictObject({
1892
+ created: z.boolean(),
1893
+ message: SessionMessageSchema,
1894
+ plan: z.strictObject({ handle: PlanHandleSchema, expires_at: TimestampSchema }),
1895
+ });
1896
+ export const PostSessionApprovalResponseSchema = z.strictObject({
1897
+ created: z.boolean(),
1898
+ message: SessionMessageSchema,
1899
+ approval: SessionApprovalSchema,
1900
+ });
1901
+ export const PostSessionMessageResponseSchema = z.strictObject({
1902
+ created: z.boolean(),
1903
+ message: SessionMessageSchema,
1904
+ });
1291
1905
  export const RankItemResponseSchema = z.strictObject({ item: ItemSummarySchema });
1906
+ export const SearchPagesResponseSchema = z.strictObject({
1907
+ items: z.array(PageSearchResultSchema),
1908
+ next_cursor: z.string().nullable(),
1909
+ });
1910
+ export const SessionCardResponseEventSchema = z.strictObject({
1911
+ v: z.literal(1),
1912
+ id: UuidSchema,
1913
+ type: z.literal('card.response'),
1914
+ created_at: TimestampSchema,
1915
+ org: z.strictObject({ id: UuidSchema }),
1916
+ app: z.strictObject({ id: UuidSchema, installation_id: UuidSchema }),
1917
+ attempt: z.int().min(1),
1918
+ session: SessionBriefSchema,
1919
+ data: SessionCardResponseDataSchema,
1920
+ });
1921
+ export const SessionEventDataSchema = z.strictObject({
1922
+ channel: z.strictObject({ id: UuidSchema, name: z.string().nullable() }).optional(),
1923
+ message: SessionEventMessageSchema.optional(),
1924
+ user: SessionEventUserSchema.nullable().optional(),
1925
+ project: SessionEventProjectSchema.optional(),
1926
+ item: SessionEventItemSchema.optional(),
1927
+ assignment: SessionItemAssignmentSchema.nullable().optional(),
1928
+ context: SessionItemContextSchema.optional(),
1929
+ });
1930
+ export const SessionItemAssignedDataSchema = z.strictObject({
1931
+ channel: z.strictObject({ id: UuidSchema, name: z.string().nullable() }),
1932
+ project: SessionEventProjectSchema,
1933
+ item: SessionEventItemSchema,
1934
+ assignment: SessionItemAssignmentSchema,
1935
+ context: SessionItemContextSchema,
1936
+ user: SessionEventUserSchema.nullable(),
1937
+ });
1938
+ export const SessionItemUnassignedDataSchema = z.strictObject({
1939
+ channel: z.strictObject({ id: UuidSchema, name: z.string().nullable() }),
1940
+ project: SessionEventProjectSchema,
1941
+ item: SessionEventItemSchema,
1942
+ assignment: SessionItemAssignmentSchema.nullable(),
1943
+ reason: z.enum(['unassigned', 'reassigned', 'moved', 'deleted', 'owner_left', 'agent_deleted']),
1944
+ user: SessionEventUserSchema.nullable(),
1945
+ });
1946
+ export const SessionMentionDataSchema = z.strictObject({
1947
+ channel: z.strictObject({ id: UuidSchema, name: z.string().nullable() }),
1948
+ project: SessionEventProjectSchema,
1949
+ item: SessionEventItemSchema,
1950
+ assignment: SessionItemAssignmentSchema.nullable(),
1951
+ context: SessionItemContextSchema,
1952
+ message: SessionEventMessageSchema,
1953
+ user: SessionEventUserSchema,
1954
+ });
1292
1955
  export const ThreadResponseSchema = z.strictObject({
1293
1956
  root: MessageSchema,
1294
1957
  replies: z.array(MessageSchema),
@@ -1304,6 +1967,7 @@ export const TransitionItemResponseSchema = z.strictObject({
1304
1967
  item: ItemSummarySchema,
1305
1968
  comment: CommentSchema.nullable(),
1306
1969
  });
1970
+ export const UpdateSessionMessageResponseSchema = z.strictObject({ message: SessionMessageSchema });
1307
1971
  export const WorkflowChangeArgsSchema = z.strictObject({
1308
1972
  project: ProjectRefSchema,
1309
1973
  workflow_def: WorkflowDefinitionSchema,
@@ -1335,6 +1999,7 @@ export const ItemDetailSchema = z.strictObject({
1335
1999
  title: z.string(),
1336
2000
  priority: PrioritySchema,
1337
2001
  assignee: UserSchema.nullable(),
2002
+ assignee_agent: AgentBriefSchema.nullable(),
1338
2003
  reporter: UserSchema.nullable(),
1339
2004
  parent: ItemBriefSchema.nullable(),
1340
2005
  initiative: InitiativeBriefSchema.nullable(),
@@ -1369,6 +2034,7 @@ export const ItemSearchResultSchema = z.strictObject({
1369
2034
  title: z.string(),
1370
2035
  priority: PrioritySchema,
1371
2036
  assignee: UserSchema.nullable(),
2037
+ assignee_agent: AgentBriefSchema.nullable(),
1372
2038
  reporter: UserSchema.nullable(),
1373
2039
  parent: ItemBriefSchema.nullable(),
1374
2040
  initiative: InitiativeBriefSchema.nullable(),
@@ -1387,9 +2053,67 @@ export const ItemSearchResultSchema = z.strictObject({
1387
2053
  completed_at: TimestampSchema.nullable(),
1388
2054
  canceled_at: TimestampSchema.nullable(),
1389
2055
  match: SearchMatchSchema.optional(),
2056
+ link_counts: LinkCountsSchema.optional(),
2057
+ activity_at: TimestampSchema.optional(),
1390
2058
  description: z.string().optional(),
1391
2059
  custom: z.array(CustomFieldValueSchema).optional(),
1392
2060
  });
2061
+ export const ListPinsResponseSchema = z.strictObject({
2062
+ items: z.array(PinnedMessageSchema),
2063
+ next_cursor: z.string().nullable(),
2064
+ });
2065
+ export const SessionItemAssignedEventSchema = z.strictObject({
2066
+ v: z.literal(1),
2067
+ id: UuidSchema,
2068
+ type: z.literal('work_item.assigned'),
2069
+ created_at: TimestampSchema,
2070
+ org: z.strictObject({ id: UuidSchema }),
2071
+ app: z.strictObject({ id: UuidSchema, installation_id: UuidSchema }),
2072
+ attempt: z.int().min(1),
2073
+ session: SessionBriefSchema,
2074
+ data: SessionItemAssignedDataSchema,
2075
+ });
2076
+ export const SessionItemUnassignedEventSchema = z.strictObject({
2077
+ v: z.literal(1),
2078
+ id: UuidSchema,
2079
+ type: z.literal('work_item.unassigned'),
2080
+ created_at: TimestampSchema,
2081
+ org: z.strictObject({ id: UuidSchema }),
2082
+ app: z.strictObject({ id: UuidSchema, installation_id: UuidSchema }),
2083
+ attempt: z.int().min(1),
2084
+ session: SessionBriefSchema,
2085
+ data: SessionItemUnassignedDataSchema,
2086
+ });
2087
+ export const SessionMentionEventSchema = z.strictObject({
2088
+ v: z.literal(1),
2089
+ id: UuidSchema,
2090
+ type: z.literal('app.mentioned'),
2091
+ created_at: TimestampSchema,
2092
+ org: z.strictObject({ id: UuidSchema }),
2093
+ app: z.strictObject({ id: UuidSchema, installation_id: UuidSchema }),
2094
+ attempt: z.int().min(1),
2095
+ session: SessionBriefSchema,
2096
+ data: SessionMentionDataSchema,
2097
+ });
2098
+ export const SessionMessageEventSchema = z.strictObject({
2099
+ v: z.literal(1),
2100
+ id: UuidSchema,
2101
+ type: z.literal('message.posted'),
2102
+ created_at: TimestampSchema,
2103
+ org: z.strictObject({ id: UuidSchema }),
2104
+ app: z.strictObject({ id: UuidSchema, installation_id: UuidSchema }),
2105
+ attempt: z.int().min(1),
2106
+ session: SessionBriefSchema,
2107
+ data: SessionEventDataSchema,
2108
+ });
2109
+ export const SessionPlanOutcomeSchema = z.strictObject({
2110
+ handle: PlanHandleSchema,
2111
+ action: PlanActionSchema,
2112
+ outcome: z.enum(['applied', 'cancelled', 'stale', 'failed', 'expired', 'unknown']),
2113
+ result: PlanResultSchema.optional(),
2114
+ error: z.strictObject({ code: z.string(), message: z.string().optional() }).optional(),
2115
+ changed: z.array(z.strictObject({ kind: z.string(), ref: z.string() })).optional(),
2116
+ });
1393
2117
  export const CreateItemResponseSchema = z.strictObject({
1394
2118
  item: ItemDetailSchema,
1395
2119
  created: z.boolean(),
@@ -1409,15 +2133,68 @@ export const SearchItemsResponseSchema = z.strictObject({
1409
2133
  items: z.array(ItemSearchResultSchema),
1410
2134
  next_cursor: z.string().nullable(),
1411
2135
  });
2136
+ export const SessionCardClosedDataSchema = z.strictObject({
2137
+ channel: z.strictObject({ id: UuidSchema, name: z.string().nullable() }),
2138
+ message: SessionCardMessageSchema,
2139
+ card: SessionCardSettingsSchema,
2140
+ closed_by: z.enum([
2141
+ 'time',
2142
+ 'app',
2143
+ 'owner',
2144
+ 'session_ended',
2145
+ 'deleted',
2146
+ 'removed',
2147
+ 'unassigned',
2148
+ 'switched_off',
2149
+ ]),
2150
+ closed_at: TimestampSchema,
2151
+ respondents: z.int().min(0),
2152
+ counts: z.record(z.string(), z.unknown()).nullable(),
2153
+ private: z.unknown(),
2154
+ plan: SessionPlanOutcomeSchema.optional(),
2155
+ approval: SessionApprovalOutcomeSchema.optional(),
2156
+ });
2157
+ export const SessionCardClosedEventSchema = z.strictObject({
2158
+ v: z.literal(1),
2159
+ id: UuidSchema,
2160
+ type: z.literal('card.closed'),
2161
+ created_at: TimestampSchema,
2162
+ org: z.strictObject({ id: UuidSchema }),
2163
+ app: z.strictObject({ id: UuidSchema, installation_id: UuidSchema }),
2164
+ attempt: z.int().min(1),
2165
+ session: SessionBriefSchema,
2166
+ data: SessionCardClosedDataSchema,
2167
+ });
2168
+ export const SessionEventSchema = z.union([
2169
+ SessionMessageEventSchema,
2170
+ SessionCardResponseEventSchema,
2171
+ SessionCardClosedEventSchema,
2172
+ SessionMentionEventSchema,
2173
+ SessionItemAssignedEventSchema,
2174
+ SessionItemUnassignedEventSchema,
2175
+ ]);
2176
+ export const SessionEventsResponseSchema = z.strictObject({
2177
+ events: z.array(SessionEventSchema),
2178
+ cursor: z.int().min(0),
2179
+ more: z.boolean(),
2180
+ });
2181
+ /** The answer of an operation that returns no body (204). */
2182
+ export const NoContentSchema = z.undefined();
1412
2183
  /** Each operation's query parameters, as read from a URL (repeated parameters as arrays). */
1413
2184
  export const QUERY_SCHEMAS = {
2185
+ ack_session_events: z.strictObject({}),
1414
2186
  add_comment: z.strictObject({}),
1415
2187
  add_link: z.strictObject({}),
1416
2188
  add_release_items: z.strictObject({}),
1417
2189
  add_sprint_items: z.strictObject({}),
2190
+ answer_session_response: z.strictObject({}),
1418
2191
  apply_plan: z.strictObject({}),
1419
2192
  archive_release: z.strictObject({}),
2193
+ close_session_approval: z.strictObject({}),
2194
+ close_session_card: z.strictObject({}),
1420
2195
  complete_sprint: z.strictObject({}),
2196
+ connect_poll: z.strictObject({}),
2197
+ connect_start: z.strictObject({}),
1421
2198
  create_channel: z.strictObject({}),
1422
2199
  create_item: z.strictObject({}),
1423
2200
  create_page: z.strictObject({}),
@@ -1440,6 +2217,8 @@ export const QUERY_SCHEMAS = {
1440
2217
  get_me: z.strictObject({}),
1441
2218
  get_meta: z.strictObject({}),
1442
2219
  get_page: z.strictObject({}),
2220
+ get_session: z.strictObject({}),
2221
+ get_session_approval: z.strictObject({}),
1443
2222
  get_thread: z.strictObject({
1444
2223
  cursor: CursorSchema.optional(),
1445
2224
  limit: z.coerce.number().int().min(1).max(100).optional(),
@@ -1460,10 +2239,20 @@ export const QUERY_SCHEMAS = {
1460
2239
  cursor: CursorSchema.optional(),
1461
2240
  limit: z.coerce.number().int().min(1).max(100).optional(),
1462
2241
  }),
2242
+ list_emoji: z.strictObject({}),
2243
+ list_members: z.strictObject({
2244
+ q: z.string().min(1).max(100).optional(),
2245
+ cursor: CursorSchema.optional(),
2246
+ limit: z.coerce.number().int().min(1).max(100).optional(),
2247
+ }),
1463
2248
  list_pages: z.strictObject({
1464
2249
  cursor: CursorSchema.optional(),
1465
2250
  limit: z.coerce.number().int().min(1).max(100).optional(),
1466
2251
  }),
2252
+ list_pins: z.strictObject({
2253
+ cursor: CursorSchema.optional(),
2254
+ limit: z.coerce.number().int().min(1).max(100).optional(),
2255
+ }),
1467
2256
  list_project_members: z.strictObject({
1468
2257
  q: z.string().min(1).max(100).optional(),
1469
2258
  cursor: CursorSchema.optional(),
@@ -1479,12 +2268,20 @@ export const QUERY_SCHEMAS = {
1479
2268
  cursor: CursorSchema.optional(),
1480
2269
  limit: z.coerce.number().int().min(1).max(100).optional(),
1481
2270
  }),
2271
+ list_session_events: z.strictObject({
2272
+ cursor: z.coerce.number().int().min(0).optional(),
2273
+ limit: z.coerce.number().int().min(1).max(100).optional(),
2274
+ }),
2275
+ list_session_threads: z.strictObject({}),
1482
2276
  list_sprints: z.strictObject({
1483
2277
  state: z.array(SprintStateSchema).max(3).optional(),
1484
2278
  cursor: CursorSchema.optional(),
1485
2279
  limit: z.coerce.number().int().min(1).max(100).optional(),
1486
2280
  }),
1487
2281
  list_work_types: z.strictObject({ include_archived: z.enum(['true', 'false']).optional() }),
2282
+ post_plan_card: z.strictObject({}),
2283
+ post_session_approval: z.strictObject({}),
2284
+ post_session_message: z.strictObject({}),
1488
2285
  rank_item: z.strictObject({}),
1489
2286
  release_version: z.strictObject({}),
1490
2287
  remove_link: z.strictObject({}),
@@ -1492,6 +2289,7 @@ export const QUERY_SCHEMAS = {
1492
2289
  remove_sprint_items: z.strictObject({}),
1493
2290
  reopen_release: z.strictObject({}),
1494
2291
  restore_release: z.strictObject({}),
2292
+ revoke_session: z.strictObject({}),
1495
2293
  search_items: z.strictObject({
1496
2294
  q: z.string().min(1).max(200).optional(),
1497
2295
  project: z.array(ProjectRefSchema).max(20).optional(),
@@ -1507,7 +2305,14 @@ export const QUERY_SCHEMAS = {
1507
2305
  sprint: SprintRefSchema.optional(),
1508
2306
  release: z.string().min(1).max(80).optional(),
1509
2307
  parent: ItemRefSchema.optional(),
2308
+ has_link: z
2309
+ .array(z
2310
+ .string()
2311
+ .regex(new RegExp('^(blocks|blocked_by|relates|duplicates|duplicated_by)(?::(open|not_started|started|done|canceled))?$', 'u')))
2312
+ .max(10)
2313
+ .optional(),
1510
2314
  updated_since: TimestampSchema.optional(),
2315
+ activity_since: TimestampSchema.optional(),
1511
2316
  sort: z
1512
2317
  .array(z
1513
2318
  .string()
@@ -1518,21 +2323,36 @@ export const QUERY_SCHEMAS = {
1518
2323
  cursor: CursorSchema.optional(),
1519
2324
  limit: z.coerce.number().int().min(1).max(100).optional(),
1520
2325
  }),
2326
+ search_pages: z.strictObject({
2327
+ q: z.string().min(1).max(200),
2328
+ channel: z.array(ChannelRefSchema).max(20).optional(),
2329
+ cursor: CursorSchema.optional(),
2330
+ limit: z.coerce.number().int().min(1).max(100).optional(),
2331
+ }),
2332
+ session_heartbeat: z.strictObject({}),
2333
+ session_typing: z.strictObject({}),
1521
2334
  start_sprint: z.strictObject({}),
1522
2335
  transition_item: z.strictObject({}),
1523
2336
  update_item: z.strictObject({}),
1524
2337
  update_page: z.strictObject({}),
1525
2338
  update_release: z.strictObject({}),
2339
+ update_session_message: z.strictObject({}),
1526
2340
  };
1527
2341
  /** Each operation's request body schema, or null when it takes none. */
1528
2342
  export const REQUEST_SCHEMAS = {
2343
+ ack_session_events: AckSessionEventsRequestSchema,
1529
2344
  add_comment: AddCommentRequestSchema,
1530
2345
  add_link: AddLinkRequestSchema,
1531
2346
  add_release_items: PlanningItemsRequestSchema,
1532
2347
  add_sprint_items: PlanningItemsRequestSchema,
2348
+ answer_session_response: AnswerSessionResponseRequestSchema,
1533
2349
  apply_plan: EmptyRequestSchema,
1534
2350
  archive_release: null,
2351
+ close_session_approval: CloseSessionApprovalRequestSchema,
2352
+ close_session_card: EmptyRequestSchema,
1535
2353
  complete_sprint: CompleteSprintRequestSchema,
2354
+ connect_poll: ConnectPollRequestSchema,
2355
+ connect_start: ConnectStartRequestSchema,
1536
2356
  create_channel: CreateChannelRequestSchema,
1537
2357
  create_item: CreateItemRequestSchema,
1538
2358
  create_page: CreatePageRequestSchema,
@@ -1547,17 +2367,27 @@ export const REQUEST_SCHEMAS = {
1547
2367
  get_me: null,
1548
2368
  get_meta: null,
1549
2369
  get_page: null,
2370
+ get_session: null,
2371
+ get_session_approval: null,
1550
2372
  get_thread: null,
1551
2373
  get_workflow: null,
1552
2374
  list_channel_messages: null,
1553
2375
  list_channels: null,
1554
2376
  list_comments: null,
2377
+ list_emoji: null,
2378
+ list_members: null,
1555
2379
  list_pages: null,
2380
+ list_pins: null,
1556
2381
  list_project_members: null,
1557
2382
  list_projects: null,
1558
2383
  list_releases: null,
2384
+ list_session_events: null,
2385
+ list_session_threads: null,
1559
2386
  list_sprints: null,
1560
2387
  list_work_types: null,
2388
+ post_plan_card: PostPlanCardRequestSchema,
2389
+ post_session_approval: PostSessionApprovalRequestSchema,
2390
+ post_session_message: PostSessionMessageRequestSchema,
1561
2391
  rank_item: RankItemRequestSchema,
1562
2392
  release_version: ReleaseVersionRequestSchema,
1563
2393
  remove_link: null,
@@ -1565,22 +2395,33 @@ export const REQUEST_SCHEMAS = {
1565
2395
  remove_sprint_items: PlanningItemsRequestSchema,
1566
2396
  reopen_release: null,
1567
2397
  restore_release: null,
2398
+ revoke_session: null,
1568
2399
  search_items: null,
2400
+ search_pages: null,
2401
+ session_heartbeat: SessionHeartbeatRequestSchema,
2402
+ session_typing: SessionTypingRequestSchema,
1569
2403
  start_sprint: StartSprintRequestSchema,
1570
2404
  transition_item: TransitionItemRequestSchema,
1571
2405
  update_item: UpdateItemRequestSchema,
1572
2406
  update_page: UpdatePageRequestSchema,
1573
2407
  update_release: UpdateReleaseRequestSchema,
2408
+ update_session_message: UpdateSessionMessageRequestSchema,
1574
2409
  };
1575
2410
  /** Each operation's success response schema. */
1576
2411
  export const RESPONSE_SCHEMAS = {
2412
+ ack_session_events: AckSessionEventsResponseSchema,
1577
2413
  add_comment: AddCommentResponseSchema,
1578
2414
  add_link: AddLinkResponseSchema,
1579
2415
  add_release_items: ReleaseItemsResponseSchema,
1580
2416
  add_sprint_items: SprintItemsResponseSchema,
2417
+ answer_session_response: AnswerSessionResponseResponseSchema,
1581
2418
  apply_plan: ApplyPlanResponseSchema,
1582
2419
  archive_release: ReleaseResponseSchema,
2420
+ close_session_approval: CloseSessionApprovalResponseSchema,
2421
+ close_session_card: CloseSessionCardResponseSchema,
1583
2422
  complete_sprint: CompleteSprintResponseSchema,
2423
+ connect_poll: ConnectPollResponseSchema,
2424
+ connect_start: ConnectStartResponseSchema,
1584
2425
  create_channel: CreateChannelResponseSchema,
1585
2426
  create_item: CreateItemResponseSchema,
1586
2427
  create_page: CreatePageResponseSchema,
@@ -1595,17 +2436,27 @@ export const RESPONSE_SCHEMAS = {
1595
2436
  get_me: MeResponseSchema,
1596
2437
  get_meta: MetaResponseSchema,
1597
2438
  get_page: PageResponseSchema,
2439
+ get_session: SessionResponseSchema,
2440
+ get_session_approval: GetSessionApprovalResponseSchema,
1598
2441
  get_thread: ThreadResponseSchema,
1599
2442
  get_workflow: GetWorkflowResponseSchema,
1600
2443
  list_channel_messages: ListChannelMessagesResponseSchema,
1601
2444
  list_channels: ListChannelsResponseSchema,
1602
2445
  list_comments: ListCommentsResponseSchema,
2446
+ list_emoji: ListEmojiResponseSchema,
2447
+ list_members: ListMembersResponseSchema,
1603
2448
  list_pages: ListPagesResponseSchema,
2449
+ list_pins: ListPinsResponseSchema,
1604
2450
  list_project_members: ListProjectMembersResponseSchema,
1605
2451
  list_projects: ListProjectsResponseSchema,
1606
2452
  list_releases: ListReleasesResponseSchema,
2453
+ list_session_events: SessionEventsResponseSchema,
2454
+ list_session_threads: ListSessionThreadsResponseSchema,
1607
2455
  list_sprints: ListSprintsResponseSchema,
1608
2456
  list_work_types: ListWorkTypesResponseSchema,
2457
+ post_plan_card: PostPlanCardResponseSchema,
2458
+ post_session_approval: PostSessionApprovalResponseSchema,
2459
+ post_session_message: PostSessionMessageResponseSchema,
1609
2460
  rank_item: RankItemResponseSchema,
1610
2461
  release_version: ReleaseResponseSchema,
1611
2462
  remove_link: RemoveLinkResponseSchema,
@@ -1613,10 +2464,15 @@ export const RESPONSE_SCHEMAS = {
1613
2464
  remove_sprint_items: SprintItemsResponseSchema,
1614
2465
  reopen_release: ReleaseResponseSchema,
1615
2466
  restore_release: ReleaseResponseSchema,
2467
+ revoke_session: NoContentSchema,
1616
2468
  search_items: SearchItemsResponseSchema,
2469
+ search_pages: SearchPagesResponseSchema,
2470
+ session_heartbeat: SessionHeartbeatResponseSchema,
2471
+ session_typing: NoContentSchema,
1617
2472
  start_sprint: StartSprintResponseSchema,
1618
2473
  transition_item: TransitionItemResponseSchema,
1619
2474
  update_item: ItemWriteResponseSchema,
1620
2475
  update_page: PageResponseSchema,
1621
2476
  update_release: ReleaseResponseSchema,
2477
+ update_session_message: UpdateSessionMessageResponseSchema,
1622
2478
  };