@kammcs/buildit-mcp 0.2.0 → 0.8.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 (43) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +273 -32
  3. package/SECURITY.md +1 -1
  4. package/dist/api/client.js +5 -1
  5. package/dist/api/generated/operations.js +840 -11
  6. package/dist/api/generated/schemas.js +936 -3
  7. package/dist/api/generated/strict.js +1088 -3
  8. package/dist/capabilities.js +236 -0
  9. package/dist/channel/api.js +159 -0
  10. package/dist/channel/approvals.js +259 -0
  11. package/dist/channel/handoffs.js +190 -0
  12. package/dist/channel/item-events.js +164 -0
  13. package/dist/channel/lock.js +181 -0
  14. package/dist/channel/loop.js +1034 -0
  15. package/dist/channel/mask.js +365 -0
  16. package/dist/channel/threads.js +60 -0
  17. package/dist/channel/tool-ring.js +124 -0
  18. package/dist/channel/typing.js +150 -0
  19. package/dist/channel/waiters.js +229 -0
  20. package/dist/channel/workers.js +66 -0
  21. package/dist/cli/claude-config.js +100 -0
  22. package/dist/cli/commands.js +438 -0
  23. package/dist/config.js +356 -6
  24. package/dist/errors.js +49 -1
  25. package/dist/index.js +122 -6
  26. package/dist/log.js +3 -2
  27. package/dist/secrets/keychain.js +273 -0
  28. package/dist/server.js +61 -5
  29. package/dist/tools/approve.js +791 -0
  30. package/dist/tools/ask.js +898 -0
  31. package/dist/tools/chat.js +98 -1
  32. package/dist/tools/handoff.js +409 -0
  33. package/dist/tools/items-read.js +6 -3
  34. package/dist/tools/items-write.js +77 -16
  35. package/dist/tools/plans.js +221 -14
  36. package/dist/tools/reply.js +138 -0
  37. package/dist/tools/shared.js +24 -1
  38. package/dist/tools/threads.js +149 -0
  39. package/dist/tools/whoami.js +53 -3
  40. package/dist/toolsets/catalog.js +3 -1
  41. package/dist/toolsets/registry.js +2 -0
  42. package/dist/transports/stdio.js +288 -12
  43. package/package.json +5 -1
@@ -2,7 +2,7 @@
2
2
  * Tolerant schemas for the agent API's responses: unknown fields are kept, unknown enum values pass, and string formats aren't checked, because the API's v1 only grows.
3
3
  *
4
4
  * GENERATED by scripts/generate.ts from openapi/openapi.json (agent API
5
- * 1.2.0). Do not edit: change the contract, then run
5
+ * 1.9.0). Do not edit: change the contract, then run
6
6
  * `npm run generate`.
7
7
  */
8
8
  import { z } from 'zod';
@@ -10,14 +10,43 @@ import { z } from 'zod';
10
10
  function openEnum(_values) {
11
11
  return z.string();
12
12
  }
13
+ export const AckSessionEventsRequestSchema = z.looseObject({ cursor: z.number() });
14
+ export const AckSessionEventsResponseSchema = z.looseObject({
15
+ acked: z.number(),
16
+ cursor: z.number(),
17
+ });
18
+ export const AgentRefSchema = z.string();
13
19
  export const AllowedTransitionSchema = z.looseObject({
14
20
  to: z.string(),
15
21
  required_fields: z.array(z.string()),
16
22
  admins_only: z.boolean(),
17
23
  });
24
+ export const AnswerSessionResponseRequestSchema = z.looseObject({
25
+ status: openEnum(['accepted', 'rejected']),
26
+ note: z.string().optional(),
27
+ revision: z.number(),
28
+ });
29
+ export const ApprovalFieldSchema = z.looseObject({
30
+ key: z.string(),
31
+ value: z.string(),
32
+ cut: z.number().optional(),
33
+ });
34
+ export const ApprovalRuleEntrySchema = z.looseObject({
35
+ toolName: z.string(),
36
+ ruleContent: z.string().optional(),
37
+ });
38
+ export const CapabilitySchema = z.string();
39
+ export const CapabilityInSchema = z.string();
40
+ export const CardAnswerSchema = z.union([
41
+ z.looseObject({ action: z.string() }),
42
+ z.looseObject({ inputs: z.record(z.string(), z.union([z.string(), z.array(z.string())])) }),
43
+ ]);
18
44
  export const ChannelNameSchema = z.string();
19
45
  export const ChannelRefSchema = z.string();
20
46
  export const ChannelVisibilitySchema = openEnum(['public', 'private']);
47
+ export const CloseSessionApprovalRequestSchema = z.looseObject({
48
+ reason: openEnum(['answered_elsewhere', 'stale', 'interrupted', 'session_ended', 'expired']),
49
+ });
21
50
  export const ColorSchema = z.string();
22
51
  export const CommentBodySchema = z.string();
23
52
  export const CompleteSprintRequestSchema = z.looseObject({
@@ -28,12 +57,14 @@ export const CustomValueInSchema = z
28
57
  .union([z.string(), z.number(), z.boolean(), z.array(z.string())])
29
58
  .nullable();
30
59
  export const DateSchema = z.string();
60
+ export const DeclineSessionHandoffRequestSchema = z.looseObject({ reason: z.string() });
31
61
  export const DevelopmentBranchSchema = z.looseObject({
32
62
  name: z.string(),
33
63
  state: openEnum(['active', 'deleted']),
34
64
  repo: z.string(),
35
65
  url: z.string(),
36
66
  });
67
+ export const DeviceCodeSchema = z.string();
37
68
  export const EmptyRequestSchema = z.looseObject({});
38
69
  export const EntityKindSchema = openEnum([
39
70
  'project',
@@ -55,6 +86,10 @@ export const EntityKindSchema = openEnum([
55
86
  'message',
56
87
  'plan',
57
88
  'route',
89
+ 'response',
90
+ 'agent',
91
+ 'approval',
92
+ 'handoff',
58
93
  ]);
59
94
  export const EstimateSchema = z.number();
60
95
  export const EstimateScaleSchema = openEnum(['none', 'points', 'tshirt']);
@@ -145,12 +180,17 @@ export const ProjectTemplateSchema = openEnum([
145
180
  'ops',
146
181
  'marketing',
147
182
  ]);
183
+ export const QuestionCardSchema = z.record(z.string(), z.unknown());
148
184
  export const RateLimitsSchema = z.looseObject({
149
185
  requests_per_minute: z.number(),
150
186
  user_requests_per_minute: z.number(),
151
187
  writes_per_minute: z.number(),
152
188
  writes_per_day: z.number(),
153
189
  org_requests_per_minute: z.number(),
190
+ polls_per_minute: z.number().optional(),
191
+ typing_per_minute: z.number().optional(),
192
+ approvals_per_minute: z.number().optional(),
193
+ handoffs_per_minute: z.number().optional(),
154
194
  });
155
195
  export const ReleaseRefSchema = z.string();
156
196
  export const ReleaseStatusSchema = openEnum(['unreleased', 'released', 'archived']);
@@ -168,6 +208,19 @@ export const SearchMatchSchema = z.looseObject({
168
208
  title_highlight: z.string(),
169
209
  snippet: z.string().nullable(),
170
210
  });
211
+ export const SessionCardSettingsSchema = z.looseObject({
212
+ visibility: openEnum(['shared', 'private', 'anonymous']),
213
+ results: openEnum(['live', 'on_close', 'hidden']),
214
+ mode: openEnum(['once', 'changeable']),
215
+ confirm: z.boolean(),
216
+ });
217
+ export const SessionRuleEntrySchema = z.looseObject({
218
+ toolName: z.string(),
219
+ ruleContent: z.string().optional(),
220
+ });
221
+ export const SessionStateSchema = openEnum(['online', 'offline']);
222
+ export const SessionTextSchema = z.string();
223
+ export const SessionTokenSchema = z.string();
171
224
  export const SprintRefSchema = z.string();
172
225
  export const SprintStateSchema = openEnum(['planned', 'active', 'completed']);
173
226
  export const StatusCategorySchema = openEnum(['not_started', 'started', 'done', 'canceled']);
@@ -178,6 +231,7 @@ export const TransitionMoveSchema = z.looseObject({
178
231
  required_fields: z.array(z.string()),
179
232
  admins_only: z.boolean(),
180
233
  });
234
+ export const UserCodeSchema = z.string();
181
235
  export const UserRefSchema = z.string();
182
236
  export const UuidSchema = z.string();
183
237
  export const WorkflowRefSchema = z.string();
@@ -186,6 +240,20 @@ export const AddCommentRequestSchema = z.looseObject({
186
240
  idempotency_key: UuidSchema.optional(),
187
241
  });
188
242
  export const AddLinkRequestSchema = z.looseObject({ kind: LinkKindSchema, target: ItemRefSchema });
243
+ export const AgentBriefSchema = z.looseObject({ id: UuidSchema, name: z.string() });
244
+ export const ApprovalRuleSchema = z.union([
245
+ z.looseObject({
246
+ type: z.literal('addRules'),
247
+ rules: z.array(ApprovalRuleEntrySchema),
248
+ behavior: z.literal('allow'),
249
+ destination: z.literal('session'),
250
+ }),
251
+ z.looseObject({
252
+ type: z.literal('setMode'),
253
+ mode: z.literal('acceptEdits'),
254
+ destination: z.literal('session'),
255
+ }),
256
+ ]);
189
257
  export const ArchiveStatusArgsSchema = z.looseObject({
190
258
  project: ProjectRefSchema,
191
259
  workflow: WorkflowRefSchema.optional(),
@@ -200,6 +268,28 @@ export const BoardColumnSchema = z.looseObject({
200
268
  statuses: z.array(z.string()),
201
269
  });
202
270
  export const ChannelBriefSchema = z.looseObject({ id: UuidSchema, name: z.string() });
271
+ export const CloseSessionCardResponseSchema = z.looseObject({ closed_at: TimestampSchema });
272
+ export const ConnectPollRequestSchema = z.looseObject({ device_code: DeviceCodeSchema });
273
+ export const ConnectStartRequestSchema = z.looseObject({
274
+ client: z.string(),
275
+ machine: z.string(),
276
+ label: z.string(),
277
+ projects: z.array(ProjectRefSchema),
278
+ capabilities: z.array(CapabilityInSchema).optional(),
279
+ });
280
+ export const ConnectStartResponseSchema = z.looseObject({
281
+ device_code: DeviceCodeSchema,
282
+ user_code: UserCodeSchema,
283
+ verification_uri: z.string(),
284
+ verification_uri_complete: z.string(),
285
+ interval: z.number(),
286
+ expires_in: z.number(),
287
+ });
288
+ export const ConnectedSessionSchema = z.looseObject({
289
+ id: UuidSchema,
290
+ label: z.string(),
291
+ projects: z.array(z.looseObject({ id: UuidSchema, key: ProjectKeySchema })),
292
+ });
203
293
  export const CreateChannelRequestSchema = z.looseObject({
204
294
  name: ChannelNameSchema,
205
295
  description: z.string().optional(),
@@ -236,6 +326,11 @@ export const CreateSprintRequestSchema = z.looseObject({
236
326
  starts_on: DateSchema.optional(),
237
327
  ends_on: DateSchema.optional(),
238
328
  });
329
+ export const CustomEmojiSchema = z.looseObject({
330
+ id: UuidSchema,
331
+ name: z.string(),
332
+ animated: z.boolean(),
333
+ });
239
334
  export const CustomValuesInSchema = z.record(z.string(), CustomValueInSchema);
240
335
  export const DeleteItemArgsSchema = z.looseObject({ item: ItemRefSchema });
241
336
  export const DescriptionEditSchema = z.union([
@@ -343,7 +438,15 @@ export const ErrorSchema = z.looseObject({
343
438
  message: z.string(),
344
439
  hint: z.string().optional(),
345
440
  details: z.looseObject({
346
- reason: openEnum(['admins_only', 'not_in_channel', 'not_reporter', 'guest', 'other']),
441
+ reason: openEnum([
442
+ 'admins_only',
443
+ 'not_in_channel',
444
+ 'not_reporter',
445
+ 'guest',
446
+ 'other',
447
+ 'agent_self_assign',
448
+ 'agent_assignee',
449
+ ]),
347
450
  }),
348
451
  }),
349
452
  z.looseObject({
@@ -362,7 +465,9 @@ export const ErrorSchema = z.looseObject({
362
465
  code: z.literal('method_not_allowed'),
363
466
  message: z.string(),
364
467
  hint: z.string().optional(),
365
- details: z.looseObject({ allowed: z.array(openEnum(['GET', 'POST', 'PATCH', 'DELETE'])) }),
468
+ details: z.looseObject({
469
+ allowed: z.array(openEnum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE'])),
470
+ }),
366
471
  }),
367
472
  z.looseObject({
368
473
  code: z.literal('conflict'),
@@ -490,6 +595,13 @@ export const ErrorSchema = z.looseObject({
490
595
  'token_writes_per_day',
491
596
  'org_requests_per_minute',
492
597
  'user_requests_per_minute',
598
+ 'session_polls_per_minute',
599
+ 'connect_starts_per_hour',
600
+ 'connect_pending_grants',
601
+ 'connect_pending_per_address',
602
+ 'session_typing_per_minute',
603
+ 'session_approvals_per_minute',
604
+ 'session_handoffs_per_minute',
493
605
  ]),
494
606
  }),
495
607
  }),
@@ -517,6 +629,182 @@ export const ErrorSchema = z.looseObject({
517
629
  hint: z.string().optional(),
518
630
  details: z.looseObject({ ref: z.string() }),
519
631
  }),
632
+ z.looseObject({
633
+ code: z.literal('session_token_required'),
634
+ message: z.string(),
635
+ hint: z.string().optional(),
636
+ details: z.looseObject({}),
637
+ }),
638
+ z.looseObject({
639
+ code: z.literal('agent_sessions_off'),
640
+ message: z.string(),
641
+ hint: z.string().optional(),
642
+ details: z.looseObject({}),
643
+ }),
644
+ z.looseObject({
645
+ code: z.literal('authorization_pending'),
646
+ message: z.string(),
647
+ hint: z.string().optional(),
648
+ details: z.looseObject({ interval: z.number() }),
649
+ }),
650
+ z.looseObject({
651
+ code: z.literal('slow_down'),
652
+ message: z.string(),
653
+ hint: z.string().optional(),
654
+ details: z.looseObject({ interval: z.number() }),
655
+ }),
656
+ z.looseObject({
657
+ code: z.literal('access_denied'),
658
+ message: z.string(),
659
+ hint: z.string().optional(),
660
+ details: z.looseObject({}),
661
+ }),
662
+ z.looseObject({
663
+ code: z.literal('expired_token'),
664
+ message: z.string(),
665
+ hint: z.string().optional(),
666
+ details: z.looseObject({}),
667
+ }),
668
+ z.looseObject({
669
+ code: z.literal('thread_other_session'),
670
+ message: z.string(),
671
+ hint: z.string().optional(),
672
+ details: z.looseObject({ thread_id: z.string() }),
673
+ }),
674
+ z.looseObject({
675
+ code: z.literal('card_invalid'),
676
+ message: z.string(),
677
+ hint: z.string().optional(),
678
+ details: z.looseObject({
679
+ errors: z.array(z.looseObject({ path: z.string(), message: z.string() })),
680
+ }),
681
+ }),
682
+ z.looseObject({
683
+ code: z.literal('card_closed'),
684
+ message: z.string(),
685
+ hint: z.string().optional(),
686
+ details: z.looseObject({ message_id: z.string() }),
687
+ }),
688
+ z.looseObject({
689
+ code: z.literal('response_changed'),
690
+ message: z.string(),
691
+ hint: z.string().optional(),
692
+ details: z.looseObject({ response_id: z.string(), revision: z.number() }),
693
+ }),
694
+ z.looseObject({
695
+ code: z.literal('not_own_message'),
696
+ message: z.string(),
697
+ hint: z.string().optional(),
698
+ details: z.looseObject({ message_id: z.string() }),
699
+ }),
700
+ z.looseObject({
701
+ code: z.literal('plan_awaits_owner'),
702
+ message: z.string(),
703
+ hint: z.string().optional(),
704
+ details: z.looseObject({ handle: z.string(), message_id: z.string() }),
705
+ }),
706
+ z.looseObject({
707
+ code: z.literal('plan_card_exists'),
708
+ message: z.string(),
709
+ hint: z.string().optional(),
710
+ details: z.looseObject({ handle: z.string(), message_id: z.string() }),
711
+ }),
712
+ z.looseObject({
713
+ code: z.literal('plan_card_required'),
714
+ message: z.string(),
715
+ hint: z.string().optional(),
716
+ details: z.looseObject({ handle: z.string() }),
717
+ }),
718
+ z.looseObject({
719
+ code: z.literal('thread_not_bound'),
720
+ message: z.string(),
721
+ hint: z.string().optional(),
722
+ details: z.looseObject({ thread_id: z.string() }),
723
+ }),
724
+ z.looseObject({
725
+ code: z.literal('thread_required'),
726
+ message: z.string(),
727
+ hint: z.string().optional(),
728
+ details: z.looseObject({ conversation_id: z.string() }),
729
+ }),
730
+ z.looseObject({
731
+ code: z.literal('outside_reach'),
732
+ message: z.string(),
733
+ hint: z.string().optional(),
734
+ details: z.looseObject({
735
+ thread_id: z.string().nullable(),
736
+ reason: openEnum([
737
+ 'session_ended',
738
+ 'session_projects',
739
+ 'projects_off',
740
+ 'not_in_channel',
741
+ 'archived',
742
+ 'item_deleted',
743
+ ]),
744
+ }),
745
+ }),
746
+ z.looseObject({
747
+ code: z.literal('plan_outside_thread'),
748
+ message: z.string(),
749
+ hint: z.string().optional(),
750
+ details: z.looseObject({ thread_id: z.string(), key: z.string() }),
751
+ }),
752
+ z.looseObject({
753
+ code: z.literal('approvals_off'),
754
+ message: z.string(),
755
+ hint: z.string().optional(),
756
+ details: z.looseObject({ by: openEnum(['agent', 'platform']) }),
757
+ }),
758
+ z.looseObject({
759
+ code: z.literal('too_many_open'),
760
+ message: z.string(),
761
+ hint: z.string().optional(),
762
+ details: z.looseObject({ open: z.number() }),
763
+ }),
764
+ z.looseObject({
765
+ code: z.literal('handoffs_off'),
766
+ message: z.string(),
767
+ hint: z.string().optional(),
768
+ details: z.looseObject({ by: openEnum(['platform']) }),
769
+ }),
770
+ z.looseObject({
771
+ code: z.literal('not_parent_session'),
772
+ message: z.string(),
773
+ hint: z.string().optional(),
774
+ details: z.looseObject({ item_id: z.string() }),
775
+ }),
776
+ z.looseObject({
777
+ code: z.literal('handoff_not_allowed'),
778
+ message: z.string(),
779
+ hint: z.string().optional(),
780
+ details: z.looseObject({
781
+ reason: openEnum([
782
+ 'needs_missing',
783
+ 'closed',
784
+ 'agent_assigned',
785
+ 'person_assigned',
786
+ 'other_session',
787
+ ]),
788
+ }),
789
+ }),
790
+ z.looseObject({
791
+ code: z.literal('handoff_exists'),
792
+ message: z.string(),
793
+ hint: z.string().optional(),
794
+ details: z.looseObject({ handoff_id: z.string() }),
795
+ }),
796
+ z.looseObject({
797
+ code: z.literal('no_target'),
798
+ message: z.string(),
799
+ hint: z.string().optional(),
800
+ details: z.looseObject({ needs: z.array(z.string()) }),
801
+ }),
802
+ z.looseObject({
803
+ code: z.literal('handoff_closed'),
804
+ message: z.string(),
805
+ hint: z.string().optional(),
806
+ details: z.looseObject({ handoff_id: z.string() }),
807
+ }),
520
808
  ]),
521
809
  });
522
810
  export const FeedbackSchema = z.looseObject({
@@ -580,6 +868,7 @@ export const ItemBriefSchema = z.looseObject({
580
868
  key: ItemKeySchema,
581
869
  title: z.string(),
582
870
  });
871
+ export const ItemIdKeySchema = z.looseObject({ id: UuidSchema, key: z.string() });
583
872
  export const LabelSchema = z.looseObject({
584
873
  id: UuidSchema,
585
874
  name: z.string(),
@@ -647,6 +936,19 @@ export const PlanEffectSchema = z.looseObject({
647
936
  after: z.unknown(),
648
937
  });
649
938
  export const PlanningItemsRequestSchema = z.looseObject({ items: z.array(ItemRefSchema) });
939
+ export const PostPlanCardRequestSchema = z.looseObject({
940
+ handle: PlanHandleSchema,
941
+ id: UuidSchema,
942
+ thread_id: UuidSchema.optional(),
943
+ });
944
+ export const PostSessionMessageRequestSchema = z.looseObject({
945
+ id: UuidSchema,
946
+ text: SessionTextSchema,
947
+ thread_id: UuidSchema.optional(),
948
+ reply_to_id: UuidSchema.optional(),
949
+ conversation_id: UuidSchema.optional(),
950
+ card: QuestionCardSchema.optional(),
951
+ });
650
952
  export const ProjectBriefSchema = z.looseObject({
651
953
  id: UuidSchema,
652
954
  key: ProjectKeySchema,
@@ -668,6 +970,10 @@ export const ProjectTypeSchema = z.looseObject({
668
970
  color: ColorSchema.nullable(),
669
971
  workflow: z.looseObject({ id: UuidSchema, name: z.string() }),
670
972
  });
973
+ export const ProposeSessionHandoffRequestSchema = z.looseObject({
974
+ id: UuidSchema,
975
+ item: ItemRefSchema,
976
+ });
671
977
  export const RankPositionSchema = z.looseObject({
672
978
  before: ItemRefSchema.optional(),
673
979
  after: ItemRefSchema.optional(),
@@ -706,6 +1012,146 @@ export const ReleaseVersionRequestSchema = z.looseObject({
706
1012
  move_open_to: ReleaseRefSchema.optional(),
707
1013
  });
708
1014
  export const RemoveLinkResponseSchema = z.looseObject({ id: UuidSchema, removed: z.boolean() });
1015
+ export const SessionApprovalSchema = z.looseObject({
1016
+ id: UuidSchema,
1017
+ status: openEnum([
1018
+ 'open',
1019
+ 'approved',
1020
+ 'approved_session',
1021
+ 'denied',
1022
+ 'expired',
1023
+ 'answered_elsewhere',
1024
+ 'stale',
1025
+ 'closed',
1026
+ ]),
1027
+ reason: openEnum([
1028
+ 'time',
1029
+ 'client',
1030
+ 'session_ended',
1031
+ 'unassigned',
1032
+ 'interrupted',
1033
+ 'deleted',
1034
+ 'removed',
1035
+ 'switched_off',
1036
+ ]).optional(),
1037
+ tool_name: z.string(),
1038
+ thread_id: UuidSchema.nullable(),
1039
+ created_at: TimestampSchema,
1040
+ closes_at: TimestampSchema,
1041
+ decided_at: TimestampSchema.optional(),
1042
+ });
1043
+ export const SessionBriefSchema = z.looseObject({ id: UuidSchema, label: z.string() });
1044
+ export const SessionCapabilitiesResponseSchema = z.looseObject({
1045
+ capabilities: z.array(CapabilitySchema),
1046
+ capabilities_detected: z.array(CapabilitySchema),
1047
+ });
1048
+ export const SessionCardMessageSchema = z.looseObject({
1049
+ id: UuidSchema,
1050
+ thread_id: UuidSchema.nullable(),
1051
+ });
1052
+ export const SessionCardResponseSchema = z.looseObject({
1053
+ id: UuidSchema,
1054
+ message_id: UuidSchema,
1055
+ revision: z.number(),
1056
+ status: openEnum(['recorded', 'accepted', 'rejected']),
1057
+ answer: CardAnswerSchema,
1058
+ note: z.string().nullable(),
1059
+ created_at: TimestampSchema,
1060
+ updated_at: TimestampSchema,
1061
+ });
1062
+ export const SessionChildItemSchema = z.looseObject({
1063
+ id: UuidSchema,
1064
+ key: z.string(),
1065
+ title: z.string(),
1066
+ status: z
1067
+ .looseObject({ key: z.string().nullable(), name: z.string().nullable(), category: z.string() })
1068
+ .nullable(),
1069
+ });
1070
+ export const SessionChildResultSchema = z.looseObject({
1071
+ untrusted: z.literal(true),
1072
+ message: z.looseObject({
1073
+ id: UuidSchema,
1074
+ author: z.looseObject({
1075
+ kind: openEnum(['user', 'app', 'agent']),
1076
+ id: UuidSchema.nullable(),
1077
+ name: z.string(),
1078
+ }),
1079
+ from_owner: z.boolean(),
1080
+ via_agent: z.string().nullable(),
1081
+ text: z.string(),
1082
+ created_at: TimestampSchema,
1083
+ }),
1084
+ });
1085
+ export const SessionContextMessageSchema = z.looseObject({
1086
+ id: UuidSchema,
1087
+ author: z.looseObject({
1088
+ kind: openEnum(['user', 'app', 'agent']),
1089
+ id: UuidSchema.nullable(),
1090
+ name: z.string(),
1091
+ }),
1092
+ from_owner: z.boolean(),
1093
+ via_agent: z.string().nullable().optional(),
1094
+ text: z.string(),
1095
+ created_at: TimestampSchema,
1096
+ });
1097
+ export const SessionEventMessageSchema = z.looseObject({
1098
+ id: UuidSchema,
1099
+ thread_id: UuidSchema.nullable(),
1100
+ reply_to_id: UuidSchema.nullable(),
1101
+ text: z.string(),
1102
+ mentions: z.array(UuidSchema),
1103
+ has_card: z.boolean(),
1104
+ created_at: TimestampSchema,
1105
+ edited_at: TimestampSchema.nullable(),
1106
+ via_agent: z.string().nullable().optional(),
1107
+ forwarded: z.boolean(),
1108
+ forwarded_from: z
1109
+ .looseObject({
1110
+ message_id: UuidSchema,
1111
+ user: z.looseObject({ id: UuidSchema, name: z.string() }).nullable(),
1112
+ app: z.looseObject({ id: UuidSchema, name: z.string() }).nullable(),
1113
+ })
1114
+ .nullable(),
1115
+ });
1116
+ export const SessionEventProjectSchema = z.looseObject({ id: UuidSchema, key: z.string() });
1117
+ export const SessionEventUserSchema = z.looseObject({
1118
+ id: UuidSchema,
1119
+ name: z.string(),
1120
+ is_guest: z.boolean(),
1121
+ locale: z.string().nullable(),
1122
+ });
1123
+ export const SessionHeartbeatRequestSchema = z.looseObject({ state: SessionStateSchema });
1124
+ export const SessionHeartbeatResponseSchema = z.looseObject({
1125
+ state: SessionStateSchema,
1126
+ last_seen_at: TimestampSchema,
1127
+ });
1128
+ export const SessionItemStatusSchema = z.looseObject({
1129
+ id: UuidSchema,
1130
+ key: z.string().nullable(),
1131
+ name: z.string().nullable(),
1132
+ category: z.string(),
1133
+ });
1134
+ export const SessionOwnerSchema = z.looseObject({ id: UuidSchema, name: z.string() });
1135
+ export const SessionRuleSchema = z.union([
1136
+ z.looseObject({
1137
+ type: z.literal('addRules'),
1138
+ rules: z.array(SessionRuleEntrySchema),
1139
+ behavior: z.literal('allow'),
1140
+ destination: z.literal('session'),
1141
+ }),
1142
+ z.looseObject({
1143
+ type: z.literal('setMode'),
1144
+ mode: z.literal('acceptEdits'),
1145
+ destination: z.literal('session'),
1146
+ }),
1147
+ ]);
1148
+ export const SessionTypingRequestSchema = z.looseObject({
1149
+ thread_id: UuidSchema.nullable().optional(),
1150
+ typing: z.boolean().optional(),
1151
+ });
1152
+ export const SetSessionCapabilitiesRequestSchema = z.looseObject({
1153
+ detected: z.array(CapabilityInSchema),
1154
+ });
709
1155
  export const SprintSchema = z.looseObject({
710
1156
  id: UuidSchema,
711
1157
  number: z.number(),
@@ -769,6 +1215,10 @@ export const UpdateReleaseRequestSchema = z.looseObject({
769
1215
  target_date: DateSchema.nullable().optional(),
770
1216
  released_on: DateSchema.optional(),
771
1217
  });
1218
+ export const UpdateSessionMessageRequestSchema = z.looseObject({
1219
+ text: SessionTextSchema.optional(),
1220
+ card: QuestionCardSchema.nullable().optional(),
1221
+ });
772
1222
  export const UserSchema = z.looseObject({
773
1223
  id: UuidSchema,
774
1224
  display_name: z.string(),
@@ -850,6 +1300,9 @@ export const WorkflowStatusSchema = z.looseObject({
850
1300
  board_column: z.string().nullable(),
851
1301
  allowed: z.array(AllowedTransitionSchema),
852
1302
  });
1303
+ export const AnswerSessionResponseResponseSchema = z.looseObject({
1304
+ response: SessionCardResponseSchema,
1305
+ });
853
1306
  export const BulkPatchSchema = z.looseObject({
854
1307
  status: NameRefSchema.optional(),
855
1308
  assignee: UserRefSchema.nullable().optional(),
@@ -876,6 +1329,9 @@ export const ChannelSchema = z.looseObject({
876
1329
  project: ProjectBriefSchema.nullable(),
877
1330
  last_message_at: TimestampSchema.nullable(),
878
1331
  });
1332
+ export const CloseSessionApprovalResponseSchema = z.looseObject({
1333
+ approval: SessionApprovalSchema,
1334
+ });
879
1335
  export const CommentSchema = z.looseObject({
880
1336
  id: UuidSchema,
881
1337
  author: UserSchema.nullable(),
@@ -894,6 +1350,14 @@ export const CompleteSprintResponseSchema = z.looseObject({
894
1350
  carried_count: z.number(),
895
1351
  carried_to: SprintBriefSchema.nullable(),
896
1352
  });
1353
+ export const ConnectPollResponseSchema = z.looseObject({
1354
+ token: SessionTokenSchema,
1355
+ expires_at: TimestampSchema,
1356
+ session: ConnectedSessionSchema,
1357
+ agent: AgentBriefSchema,
1358
+ owner: SessionOwnerSchema,
1359
+ org: z.looseObject({ id: UuidSchema, name: z.string() }),
1360
+ });
897
1361
  export const CreateItemRequestSchema = z.looseObject({
898
1362
  project: ProjectRefSchema.optional(),
899
1363
  type: NameRefSchema.optional(),
@@ -902,8 +1366,10 @@ export const CreateItemRequestSchema = z.looseObject({
902
1366
  parent: ItemRefSchema.optional(),
903
1367
  status: NameRefSchema.optional(),
904
1368
  assignee: UserRefSchema.optional(),
1369
+ assignee_agent: AgentRefSchema.optional(),
905
1370
  priority: PrioritySchema.optional(),
906
1371
  labels: z.array(LabelRefSchema).optional(),
1372
+ needs: z.array(CapabilityInSchema).optional(),
907
1373
  estimate: EstimateSchema.optional(),
908
1374
  start_date: DateSchema.optional(),
909
1375
  due_date: DateSchema.optional(),
@@ -937,6 +1403,18 @@ export const FieldDefSchema = z.looseObject({
937
1403
  required_on_create: z.boolean(),
938
1404
  position: z.number(),
939
1405
  });
1406
+ export const GetSessionApprovalResponseSchema = z.looseObject({ approval: SessionApprovalSchema });
1407
+ export const HandoffOptionSchema = z.looseObject({
1408
+ kind: openEnum(['session', 'agent']),
1409
+ agent: AgentBriefSchema,
1410
+ session: SessionBriefSchema.nullable(),
1411
+ online: z.boolean(),
1412
+ });
1413
+ export const HandoffTargetSchema = z.looseObject({
1414
+ kind: openEnum(['session', 'agent']),
1415
+ agent: AgentBriefSchema,
1416
+ session: SessionBriefSchema.nullable(),
1417
+ });
940
1418
  export const HistoryEventSchema = z.looseObject({
941
1419
  id: z.number(),
942
1420
  at: TimestampSchema,
@@ -959,10 +1437,12 @@ export const ItemSummarySchema = z.looseObject({
959
1437
  title: z.string(),
960
1438
  priority: PrioritySchema,
961
1439
  assignee: UserSchema.nullable(),
1440
+ assignee_agent: AgentBriefSchema.nullable(),
962
1441
  reporter: UserSchema.nullable(),
963
1442
  parent: ItemBriefSchema.nullable(),
964
1443
  initiative: InitiativeBriefSchema.nullable(),
965
1444
  labels: z.array(LabelSchema),
1445
+ needs: z.array(CapabilitySchema).optional(),
966
1446
  estimate: z.number().nullable(),
967
1447
  start_date: DateSchema.nullable(),
968
1448
  due_date: DateSchema.nullable(),
@@ -983,6 +1463,7 @@ export const LinkedItemSchema = z.looseObject({
983
1463
  title: z.string(),
984
1464
  status: StatusBriefSchema,
985
1465
  });
1466
+ export const ListEmojiResponseSchema = z.looseObject({ items: z.array(CustomEmojiSchema) });
986
1467
  export const ListMembersResponseSchema = z.looseObject({
987
1468
  items: z.array(OrgMemberSchema),
988
1469
  next_cursor: z.string().nullable(),
@@ -1005,6 +1486,7 @@ export const MeResponseSchema = z.looseObject({
1005
1486
  token: z.looseObject({
1006
1487
  id: UuidSchema,
1007
1488
  name: z.string(),
1489
+ kind: openEnum(['pat', 'session']).optional(),
1008
1490
  scopes: z.array(ScopeSchema),
1009
1491
  expires_at: TimestampSchema,
1010
1492
  created_at: TimestampSchema,
@@ -1047,6 +1529,9 @@ export const MessageSchema = z.looseObject({
1047
1529
  edited_at: TimestampSchema.nullable(),
1048
1530
  deleted: z.boolean(),
1049
1531
  via_agent: z.string().nullable(),
1532
+ pinned: z.boolean(),
1533
+ pinned_at: TimestampSchema.nullable(),
1534
+ pinned_by: MessageAuthorSchema.nullable(),
1050
1535
  });
1051
1536
  export const PageSchema = z.looseObject({
1052
1537
  id: UuidSchema,
@@ -1088,6 +1573,18 @@ export const PlanPreviewSchema = z.looseObject({
1088
1573
  item_count: z.number(),
1089
1574
  warnings: z.array(z.string()),
1090
1575
  });
1576
+ export const PostSessionApprovalRequestSchema = z.looseObject({
1577
+ id: UuidSchema,
1578
+ thread_id: UuidSchema.nullable().optional(),
1579
+ tool_name: z.string(),
1580
+ tool_use_id: z.string().optional(),
1581
+ agent: z.looseObject({ ref: z.string(), type: z.string().optional() }).optional(),
1582
+ description: z.string().optional(),
1583
+ fields: z.array(ApprovalFieldSchema),
1584
+ more_fields: z.number().optional(),
1585
+ suggestion: SessionRuleSchema.optional(),
1586
+ wait_s: z.number(),
1587
+ });
1091
1588
  export const ProjectSummarySchema = z.looseObject({
1092
1589
  id: UuidSchema,
1093
1590
  key: ProjectKeySchema,
@@ -1106,6 +1603,143 @@ export const ReleaseItemsResponseSchema = z.looseObject({
1106
1603
  changed: z.array(ItemBriefSchema),
1107
1604
  });
1108
1605
  export const ReleaseResponseSchema = z.looseObject({ release: ReleaseSchema });
1606
+ export const SessionApprovalOutcomeSchema = z.looseObject({
1607
+ id: UuidSchema,
1608
+ outcome: openEnum([
1609
+ 'approved',
1610
+ 'approved_session',
1611
+ 'denied',
1612
+ 'expired',
1613
+ 'answered_elsewhere',
1614
+ 'stale',
1615
+ 'closed',
1616
+ ]),
1617
+ reason: openEnum([
1618
+ 'time',
1619
+ 'client',
1620
+ 'session_ended',
1621
+ 'unassigned',
1622
+ 'interrupted',
1623
+ 'deleted',
1624
+ 'removed',
1625
+ 'switched_off',
1626
+ ]).optional(),
1627
+ decided_by: UuidSchema.optional(),
1628
+ decided_at: TimestampSchema.optional(),
1629
+ rule: ApprovalRuleSchema.optional(),
1630
+ });
1631
+ export const SessionAssignedHandoffSchema = z.looseObject({
1632
+ id: UuidSchema,
1633
+ parent: ItemIdKeySchema,
1634
+ from: z.looseObject({ agent: AgentBriefSchema, session: SessionBriefSchema.nullable() }),
1635
+ needs: z.array(CapabilitySchema),
1636
+ queued: z.boolean(),
1637
+ });
1638
+ export const SessionCardResponseDataSchema = z.looseObject({
1639
+ channel: z.looseObject({ id: UuidSchema, name: z.string().nullable() }),
1640
+ message: SessionCardMessageSchema,
1641
+ card: SessionCardSettingsSchema,
1642
+ response: z.looseObject({
1643
+ id: UuidSchema,
1644
+ revision: z.number(),
1645
+ answer: CardAnswerSchema,
1646
+ created_at: TimestampSchema,
1647
+ updated_at: TimestampSchema,
1648
+ }),
1649
+ user: SessionEventUserSchema,
1650
+ pseudonym: z.string().nullable(),
1651
+ private: z.unknown(),
1652
+ });
1653
+ export const SessionEventItemSchema = z.looseObject({
1654
+ id: UuidSchema,
1655
+ key: z.string(),
1656
+ title: z.string(),
1657
+ type: z.looseObject({
1658
+ id: UuidSchema.nullable(),
1659
+ key: z.string().nullable(),
1660
+ name: z.string().nullable(),
1661
+ }),
1662
+ status: SessionItemStatusSchema.nullable(),
1663
+ created_at: TimestampSchema,
1664
+ description_excerpt: z.string().optional(),
1665
+ description_truncated: z.boolean().optional(),
1666
+ });
1667
+ export const SessionItemAssignmentSchema = z.looseObject({
1668
+ agent: AgentBriefSchema,
1669
+ owner: SessionOwnerSchema,
1670
+ by: SessionEventUserSchema.nullable(),
1671
+ at: TimestampSchema,
1672
+ });
1673
+ export const SessionItemContextSchema = z.looseObject({
1674
+ untrusted: z.literal(true),
1675
+ messages: z.array(SessionContextMessageSchema),
1676
+ });
1677
+ export const SessionMessageSchema = z.looseObject({
1678
+ id: UuidSchema,
1679
+ conversation_id: UuidSchema,
1680
+ thread_id: UuidSchema.nullable(),
1681
+ reply_to_id: UuidSchema.nullable(),
1682
+ text: z.string(),
1683
+ created_at: TimestampSchema,
1684
+ session: SessionBriefSchema,
1685
+ });
1686
+ export const SessionResponseSchema = z.looseObject({
1687
+ session: z.looseObject({
1688
+ id: UuidSchema,
1689
+ label: z.string(),
1690
+ machine: z.string(),
1691
+ client: z.string(),
1692
+ scopes: z.array(ScopeSchema),
1693
+ project_ids: z.array(UuidSchema),
1694
+ channel_ids: z.array(UuidSchema),
1695
+ approved_at: TimestampSchema,
1696
+ last_seen_at: TimestampSchema.nullable(),
1697
+ expires_at: TimestampSchema,
1698
+ capabilities: z.array(CapabilitySchema).optional(),
1699
+ capabilities_detected: z.array(CapabilitySchema).optional(),
1700
+ }),
1701
+ agent: AgentBriefSchema,
1702
+ owner: SessionOwnerSchema,
1703
+ org: z.looseObject({ id: UuidSchema, name: z.string() }),
1704
+ dm: z.looseObject({ conversation_id: UuidSchema }),
1705
+ poll_interval_s: z.number(),
1706
+ });
1707
+ export const SessionThreadSchema = z.looseObject({
1708
+ thread_id: UuidSchema,
1709
+ conversation_id: UuidSchema,
1710
+ kind: openEnum(['dm', 'item']),
1711
+ item: z
1712
+ .looseObject({
1713
+ id: UuidSchema,
1714
+ key: z.string(),
1715
+ title: z.string(),
1716
+ status: SessionItemStatusSchema.nullable(),
1717
+ })
1718
+ .nullable(),
1719
+ bound_reason: openEnum(['posted', 'routed', 'handed', 'assigned', 'mentioned', 'handoff']),
1720
+ bound_at: TimestampSchema,
1721
+ last_owner_message_at: TimestampSchema.nullable(),
1722
+ open_cards: z.number(),
1723
+ handoff: z
1724
+ .looseObject({
1725
+ id: UuidSchema,
1726
+ role: openEnum(['target', 'asked']),
1727
+ status: openEnum([
1728
+ 'proposed',
1729
+ 'cancelled',
1730
+ 'expired',
1731
+ 'stale',
1732
+ 'withdrawn',
1733
+ 'closed',
1734
+ 'handed',
1735
+ 'declined',
1736
+ 'ended',
1737
+ 'finished',
1738
+ ]),
1739
+ })
1740
+ .nullable()
1741
+ .optional(),
1742
+ });
1109
1743
  export const SprintItemsResponseSchema = z.looseObject({
1110
1744
  sprint: SprintSchema,
1111
1745
  changed: z.array(ItemBriefSchema),
@@ -1132,10 +1766,12 @@ export const UpdateItemRequestSchema = z.looseObject({
1132
1766
  status: NameRefSchema.optional(),
1133
1767
  parent: ItemRefSchema.nullable().optional(),
1134
1768
  assignee: UserRefSchema.nullable().optional(),
1769
+ assignee_agent: AgentRefSchema.nullable().optional(),
1135
1770
  priority: PrioritySchema.optional(),
1136
1771
  labels: z.array(LabelRefSchema).optional(),
1137
1772
  add_labels: z.array(LabelRefSchema).optional(),
1138
1773
  remove_labels: z.array(LabelRefSchema).optional(),
1774
+ needs: z.array(CapabilityInSchema).optional(),
1139
1775
  estimate: EstimateSchema.nullable().optional(),
1140
1776
  start_date: DateSchema.nullable().optional(),
1141
1777
  due_date: DateSchema.nullable().optional(),
@@ -1268,8 +1904,16 @@ export const ListProjectsResponseSchema = z.looseObject({
1268
1904
  items: z.array(ProjectSummarySchema),
1269
1905
  next_cursor: z.string().nullable(),
1270
1906
  });
1907
+ export const ListSessionThreadsResponseSchema = z.looseObject({
1908
+ threads: z.array(SessionThreadSchema),
1909
+ });
1271
1910
  export const ListWorkTypesResponseSchema = z.looseObject({ items: z.array(WorkTypeSchema) });
1272
1911
  export const PageResponseSchema = z.looseObject({ page: PageSchema });
1912
+ export const PinnedMessageSchema = z.looseObject({
1913
+ pinned_at: TimestampSchema,
1914
+ pinned_by: MessageAuthorSchema.nullable(),
1915
+ message: MessageSchema,
1916
+ });
1273
1917
  export const PlanResultSchema = z.union([
1274
1918
  z.looseObject({ action: z.literal('delete_item'), deleted: z.array(ItemBriefSchema) }),
1275
1919
  z.looseObject({
@@ -1284,11 +1928,174 @@ export const PlanResultSchema = z.union([
1284
1928
  z.looseObject({ action: z.literal('field_change'), field_id: UuidSchema }),
1285
1929
  z.looseObject({ action: z.literal('label_change'), label_id: UuidSchema }),
1286
1930
  ]);
1931
+ export const PostPlanCardResponseSchema = z.looseObject({
1932
+ created: z.boolean(),
1933
+ message: SessionMessageSchema,
1934
+ plan: z.looseObject({ handle: PlanHandleSchema, expires_at: TimestampSchema }),
1935
+ });
1936
+ export const PostSessionApprovalResponseSchema = z.looseObject({
1937
+ created: z.boolean(),
1938
+ message: SessionMessageSchema,
1939
+ approval: SessionApprovalSchema,
1940
+ });
1941
+ export const PostSessionMessageResponseSchema = z.looseObject({
1942
+ created: z.boolean(),
1943
+ message: SessionMessageSchema,
1944
+ });
1287
1945
  export const RankItemResponseSchema = z.looseObject({ item: ItemSummarySchema });
1288
1946
  export const SearchPagesResponseSchema = z.looseObject({
1289
1947
  items: z.array(PageSearchResultSchema),
1290
1948
  next_cursor: z.string().nullable(),
1291
1949
  });
1950
+ export const SessionCardResponseEventSchema = z.looseObject({
1951
+ v: z.literal(1),
1952
+ id: UuidSchema,
1953
+ type: z.literal('card.response'),
1954
+ created_at: TimestampSchema,
1955
+ org: z.looseObject({ id: UuidSchema }),
1956
+ app: z.looseObject({ id: UuidSchema, installation_id: UuidSchema }),
1957
+ attempt: z.number(),
1958
+ session: SessionBriefSchema,
1959
+ data: SessionCardResponseDataSchema,
1960
+ });
1961
+ export const SessionChildDoneDataSchema = z.looseObject({
1962
+ channel: z.looseObject({ id: UuidSchema, name: z.string().nullable() }),
1963
+ project: SessionEventProjectSchema,
1964
+ item: SessionEventItemSchema,
1965
+ child: SessionChildItemSchema,
1966
+ handoff: z.looseObject({
1967
+ id: UuidSchema,
1968
+ needs: z.array(CapabilitySchema),
1969
+ target: z.looseObject({ agent: AgentBriefSchema, session: SessionBriefSchema.nullable() }),
1970
+ }),
1971
+ outcome: openEnum(['in_review', 'done', 'declined', 'ended']),
1972
+ reason: openEnum([
1973
+ 'canceled',
1974
+ 'unassigned',
1975
+ 'reassigned',
1976
+ 'moved',
1977
+ 'deleted',
1978
+ 'owner_left',
1979
+ 'agent_deleted',
1980
+ 'expired',
1981
+ ]).nullable(),
1982
+ result: SessionChildResultSchema.nullable(),
1983
+ });
1984
+ export const SessionEventDataSchema = z.looseObject({
1985
+ channel: z.looseObject({ id: UuidSchema, name: z.string().nullable() }).optional(),
1986
+ message: SessionEventMessageSchema.optional(),
1987
+ user: SessionEventUserSchema.nullable().optional(),
1988
+ project: SessionEventProjectSchema.optional(),
1989
+ item: SessionEventItemSchema.optional(),
1990
+ assignment: SessionItemAssignmentSchema.nullable().optional(),
1991
+ context: SessionItemContextSchema.optional(),
1992
+ });
1993
+ export const SessionHandoffSchema = z.looseObject({
1994
+ id: UuidSchema,
1995
+ item: ItemIdKeySchema,
1996
+ parent: ItemIdKeySchema,
1997
+ needs: z.array(CapabilitySchema),
1998
+ status: openEnum([
1999
+ 'proposed',
2000
+ 'cancelled',
2001
+ 'expired',
2002
+ 'stale',
2003
+ 'withdrawn',
2004
+ 'closed',
2005
+ 'handed',
2006
+ 'declined',
2007
+ 'ended',
2008
+ 'finished',
2009
+ ]),
2010
+ card_message_id: UuidSchema.nullable(),
2011
+ closes_at: TimestampSchema,
2012
+ targets: z.array(HandoffOptionSchema),
2013
+ target: HandoffTargetSchema.optional(),
2014
+ queued: z.boolean().optional(),
2015
+ outcome: openEnum(['applied', 'cancelled', 'expired', 'stale', 'withdrawn', 'closed']).optional(),
2016
+ reason: openEnum([
2017
+ 'deleted',
2018
+ 'moved',
2019
+ 'closed',
2020
+ 'agent_assigned',
2021
+ 'person_assigned',
2022
+ 'other_session',
2023
+ 'parent_changed',
2024
+ 'no_target',
2025
+ 'session_ended',
2026
+ 'unassigned',
2027
+ 'removed',
2028
+ 'interrupted',
2029
+ 'switched_off',
2030
+ 'canceled',
2031
+ 'reassigned',
2032
+ 'owner_left',
2033
+ 'agent_deleted',
2034
+ 'expired',
2035
+ ]).optional(),
2036
+ });
2037
+ export const SessionHandoffOutcomeSchema = z.looseObject({
2038
+ id: UuidSchema,
2039
+ item: ItemIdKeySchema,
2040
+ outcome: openEnum(['applied', 'cancelled', 'expired', 'stale', 'withdrawn', 'closed']),
2041
+ reason: openEnum([
2042
+ 'deleted',
2043
+ 'moved',
2044
+ 'closed',
2045
+ 'agent_assigned',
2046
+ 'person_assigned',
2047
+ 'other_session',
2048
+ 'parent_changed',
2049
+ 'no_target',
2050
+ 'session_ended',
2051
+ 'unassigned',
2052
+ 'removed',
2053
+ 'interrupted',
2054
+ 'switched_off',
2055
+ 'canceled',
2056
+ 'reassigned',
2057
+ 'owner_left',
2058
+ 'agent_deleted',
2059
+ 'expired',
2060
+ ]).optional(),
2061
+ target: HandoffTargetSchema.optional(),
2062
+ queued: z.boolean().optional(),
2063
+ });
2064
+ export const SessionItemAssignedDataSchema = z.looseObject({
2065
+ channel: z.looseObject({ id: UuidSchema, name: z.string().nullable() }),
2066
+ project: SessionEventProjectSchema,
2067
+ item: SessionEventItemSchema,
2068
+ assignment: SessionItemAssignmentSchema,
2069
+ context: SessionItemContextSchema,
2070
+ user: SessionEventUserSchema.nullable(),
2071
+ handoff: SessionAssignedHandoffSchema.optional(),
2072
+ });
2073
+ export const SessionItemUnassignedDataSchema = z.looseObject({
2074
+ channel: z.looseObject({ id: UuidSchema, name: z.string().nullable() }),
2075
+ project: SessionEventProjectSchema,
2076
+ item: SessionEventItemSchema,
2077
+ assignment: SessionItemAssignmentSchema.nullable(),
2078
+ reason: openEnum([
2079
+ 'unassigned',
2080
+ 'reassigned',
2081
+ 'moved',
2082
+ 'deleted',
2083
+ 'owner_left',
2084
+ 'agent_deleted',
2085
+ 'declined',
2086
+ 'handoff_expired',
2087
+ ]),
2088
+ user: SessionEventUserSchema.nullable(),
2089
+ });
2090
+ export const SessionMentionDataSchema = z.looseObject({
2091
+ channel: z.looseObject({ id: UuidSchema, name: z.string().nullable() }),
2092
+ project: SessionEventProjectSchema,
2093
+ item: SessionEventItemSchema,
2094
+ assignment: SessionItemAssignmentSchema.nullable(),
2095
+ context: SessionItemContextSchema,
2096
+ message: SessionEventMessageSchema,
2097
+ user: SessionEventUserSchema,
2098
+ });
1292
2099
  export const ThreadResponseSchema = z.looseObject({
1293
2100
  root: MessageSchema,
1294
2101
  replies: z.array(MessageSchema),
@@ -1304,6 +2111,7 @@ export const TransitionItemResponseSchema = z.looseObject({
1304
2111
  item: ItemSummarySchema,
1305
2112
  comment: CommentSchema.nullable(),
1306
2113
  });
2114
+ export const UpdateSessionMessageResponseSchema = z.looseObject({ message: SessionMessageSchema });
1307
2115
  export const WorkflowChangeArgsSchema = z.looseObject({
1308
2116
  project: ProjectRefSchema,
1309
2117
  workflow_def: WorkflowDefinitionSchema,
@@ -1335,10 +2143,12 @@ export const ItemDetailSchema = z.looseObject({
1335
2143
  title: z.string(),
1336
2144
  priority: PrioritySchema,
1337
2145
  assignee: UserSchema.nullable(),
2146
+ assignee_agent: AgentBriefSchema.nullable(),
1338
2147
  reporter: UserSchema.nullable(),
1339
2148
  parent: ItemBriefSchema.nullable(),
1340
2149
  initiative: InitiativeBriefSchema.nullable(),
1341
2150
  labels: z.array(LabelSchema),
2151
+ needs: z.array(CapabilitySchema).optional(),
1342
2152
  estimate: z.number().nullable(),
1343
2153
  start_date: DateSchema.nullable(),
1344
2154
  due_date: DateSchema.nullable(),
@@ -1369,10 +2179,12 @@ export const ItemSearchResultSchema = z.looseObject({
1369
2179
  title: z.string(),
1370
2180
  priority: PrioritySchema,
1371
2181
  assignee: UserSchema.nullable(),
2182
+ assignee_agent: AgentBriefSchema.nullable(),
1372
2183
  reporter: UserSchema.nullable(),
1373
2184
  parent: ItemBriefSchema.nullable(),
1374
2185
  initiative: InitiativeBriefSchema.nullable(),
1375
2186
  labels: z.array(LabelSchema),
2187
+ needs: z.array(CapabilitySchema).optional(),
1376
2188
  estimate: z.number().nullable(),
1377
2189
  start_date: DateSchema.nullable(),
1378
2190
  due_date: DateSchema.nullable(),
@@ -1392,6 +2204,78 @@ export const ItemSearchResultSchema = z.looseObject({
1392
2204
  description: z.string().optional(),
1393
2205
  custom: z.array(CustomFieldValueSchema).optional(),
1394
2206
  });
2207
+ export const ListPinsResponseSchema = z.looseObject({
2208
+ items: z.array(PinnedMessageSchema),
2209
+ next_cursor: z.string().nullable(),
2210
+ });
2211
+ export const ProposeSessionHandoffResponseSchema = z.looseObject({
2212
+ handoff: SessionHandoffSchema,
2213
+ created: z.boolean(),
2214
+ });
2215
+ export const SessionChildDoneEventSchema = z.looseObject({
2216
+ v: z.literal(1),
2217
+ id: UuidSchema,
2218
+ type: z.literal('work_item.child_done'),
2219
+ created_at: TimestampSchema,
2220
+ org: z.looseObject({ id: UuidSchema }),
2221
+ app: z.looseObject({ id: UuidSchema, installation_id: UuidSchema }),
2222
+ attempt: z.number(),
2223
+ session: SessionBriefSchema,
2224
+ data: SessionChildDoneDataSchema,
2225
+ });
2226
+ export const SessionHandoffResponseSchema = z.looseObject({ handoff: SessionHandoffSchema });
2227
+ export const SessionItemAssignedEventSchema = z.looseObject({
2228
+ v: z.literal(1),
2229
+ id: UuidSchema,
2230
+ type: z.literal('work_item.assigned'),
2231
+ created_at: TimestampSchema,
2232
+ org: z.looseObject({ id: UuidSchema }),
2233
+ app: z.looseObject({ id: UuidSchema, installation_id: UuidSchema }),
2234
+ attempt: z.number(),
2235
+ session: SessionBriefSchema,
2236
+ data: SessionItemAssignedDataSchema,
2237
+ });
2238
+ export const SessionItemUnassignedEventSchema = z.looseObject({
2239
+ v: z.literal(1),
2240
+ id: UuidSchema,
2241
+ type: z.literal('work_item.unassigned'),
2242
+ created_at: TimestampSchema,
2243
+ org: z.looseObject({ id: UuidSchema }),
2244
+ app: z.looseObject({ id: UuidSchema, installation_id: UuidSchema }),
2245
+ attempt: z.number(),
2246
+ session: SessionBriefSchema,
2247
+ data: SessionItemUnassignedDataSchema,
2248
+ });
2249
+ export const SessionMentionEventSchema = z.looseObject({
2250
+ v: z.literal(1),
2251
+ id: UuidSchema,
2252
+ type: z.literal('app.mentioned'),
2253
+ created_at: TimestampSchema,
2254
+ org: z.looseObject({ id: UuidSchema }),
2255
+ app: z.looseObject({ id: UuidSchema, installation_id: UuidSchema }),
2256
+ attempt: z.number(),
2257
+ session: SessionBriefSchema,
2258
+ data: SessionMentionDataSchema,
2259
+ });
2260
+ export const SessionMessageEventSchema = z.looseObject({
2261
+ v: z.literal(1),
2262
+ id: UuidSchema,
2263
+ type: z.literal('message.posted'),
2264
+ created_at: TimestampSchema,
2265
+ org: z.looseObject({ id: UuidSchema }),
2266
+ app: z.looseObject({ id: UuidSchema, installation_id: UuidSchema }),
2267
+ attempt: z.number(),
2268
+ session: SessionBriefSchema,
2269
+ data: SessionEventDataSchema,
2270
+ });
2271
+ export const SessionPlanOutcomeSchema = z.looseObject({
2272
+ handle: PlanHandleSchema,
2273
+ action: PlanActionSchema,
2274
+ outcome: openEnum(['applied', 'cancelled', 'stale', 'failed', 'expired', 'unknown']),
2275
+ result: PlanResultSchema.optional(),
2276
+ error: z.looseObject({ code: z.string(), message: z.string().optional() }).optional(),
2277
+ changed: z.array(z.looseObject({ kind: z.string(), ref: z.string() })).optional(),
2278
+ });
1395
2279
  export const CreateItemResponseSchema = z.looseObject({
1396
2280
  item: ItemDetailSchema,
1397
2281
  created: z.boolean(),
@@ -1411,3 +2295,52 @@ export const SearchItemsResponseSchema = z.looseObject({
1411
2295
  items: z.array(ItemSearchResultSchema),
1412
2296
  next_cursor: z.string().nullable(),
1413
2297
  });
2298
+ export const SessionCardClosedDataSchema = z.looseObject({
2299
+ channel: z.looseObject({ id: UuidSchema, name: z.string().nullable() }),
2300
+ message: SessionCardMessageSchema,
2301
+ card: SessionCardSettingsSchema,
2302
+ closed_by: openEnum([
2303
+ 'time',
2304
+ 'app',
2305
+ 'owner',
2306
+ 'session_ended',
2307
+ 'deleted',
2308
+ 'removed',
2309
+ 'unassigned',
2310
+ 'switched_off',
2311
+ ]),
2312
+ closed_at: TimestampSchema,
2313
+ respondents: z.number(),
2314
+ counts: z.record(z.string(), z.unknown()).nullable(),
2315
+ private: z.unknown(),
2316
+ plan: SessionPlanOutcomeSchema.optional(),
2317
+ approval: SessionApprovalOutcomeSchema.optional(),
2318
+ handoff: SessionHandoffOutcomeSchema.optional(),
2319
+ });
2320
+ export const SessionCardClosedEventSchema = z.looseObject({
2321
+ v: z.literal(1),
2322
+ id: UuidSchema,
2323
+ type: z.literal('card.closed'),
2324
+ created_at: TimestampSchema,
2325
+ org: z.looseObject({ id: UuidSchema }),
2326
+ app: z.looseObject({ id: UuidSchema, installation_id: UuidSchema }),
2327
+ attempt: z.number(),
2328
+ session: SessionBriefSchema,
2329
+ data: SessionCardClosedDataSchema,
2330
+ });
2331
+ export const SessionEventSchema = z.union([
2332
+ SessionMessageEventSchema,
2333
+ SessionCardResponseEventSchema,
2334
+ SessionCardClosedEventSchema,
2335
+ SessionMentionEventSchema,
2336
+ SessionItemAssignedEventSchema,
2337
+ SessionItemUnassignedEventSchema,
2338
+ SessionChildDoneEventSchema,
2339
+ ]);
2340
+ export const SessionEventsResponseSchema = z.looseObject({
2341
+ events: z.array(SessionEventSchema),
2342
+ cursor: z.number(),
2343
+ more: z.boolean(),
2344
+ });
2345
+ /** The answer of an operation that returns no body (204). */
2346
+ export const NoContentSchema = z.undefined();