@pithy-sh/support 0.5.1 → 0.6.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 (173) hide show
  1. package/README.md +8 -0
  2. package/dist/audit/actions.d.ts +9 -0
  3. package/dist/audit/actions.d.ts.map +1 -1
  4. package/dist/audit/actions.js +9 -0
  5. package/dist/capability.d.ts +2 -1
  6. package/dist/capability.d.ts.map +1 -1
  7. package/dist/capability.js +30 -6
  8. package/dist/config/config.d.ts +63 -2
  9. package/dist/config/config.d.ts.map +1 -1
  10. package/dist/config/config.js +63 -5
  11. package/dist/data/assignment.d.ts +43 -0
  12. package/dist/data/assignment.d.ts.map +1 -0
  13. package/dist/data/assignment.js +38 -0
  14. package/dist/data/embedding.d.ts +21 -0
  15. package/dist/data/embedding.d.ts.map +1 -0
  16. package/dist/data/embedding.js +23 -0
  17. package/dist/data/tables.d.ts +28 -0
  18. package/dist/data/tables.d.ts.map +1 -1
  19. package/dist/data/tables.js +10 -2
  20. package/dist/data/thread.d.ts +9 -4
  21. package/dist/data/thread.d.ts.map +1 -1
  22. package/dist/data/thread.js +9 -4
  23. package/dist/http/guards.d.ts +32 -14
  24. package/dist/http/guards.d.ts.map +1 -1
  25. package/dist/http/guards.js +44 -16
  26. package/dist/http/handlers.d.ts +35 -2
  27. package/dist/http/handlers.d.ts.map +1 -1
  28. package/dist/http/handlers.js +81 -8
  29. package/dist/http/resolve.d.ts +8 -0
  30. package/dist/http/resolve.d.ts.map +1 -1
  31. package/dist/http/resolve.js +20 -1
  32. package/dist/http/responses.d.ts +355 -0
  33. package/dist/http/responses.d.ts.map +1 -1
  34. package/dist/http/responses.js +64 -2
  35. package/dist/http/routes.d.ts +25 -11
  36. package/dist/http/routes.d.ts.map +1 -1
  37. package/dist/http/routes.js +34 -5
  38. package/dist/http/schemas.d.ts +67 -3
  39. package/dist/http/schemas.d.ts.map +1 -1
  40. package/dist/http/schemas.js +44 -5
  41. package/dist/http/scopes.d.ts +10 -5
  42. package/dist/http/scopes.d.ts.map +1 -1
  43. package/dist/http/scopes.js +42 -6
  44. package/dist/http/views.d.ts +9 -1
  45. package/dist/http/views.d.ts.map +1 -1
  46. package/dist/http/views.js +40 -1
  47. package/dist/inbound/ingest.d.ts +1 -1
  48. package/dist/inbound/ingest.d.ts.map +1 -1
  49. package/dist/inbound/ingest.js +3 -1
  50. package/dist/index.d.ts +5 -3
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +6 -4
  53. package/dist/migrations/0002_assignment.d.ts +20 -0
  54. package/dist/migrations/0002_assignment.d.ts.map +1 -0
  55. package/dist/migrations/0002_assignment.js +45 -0
  56. package/dist/migrations/0003_embeddings.d.ts +15 -0
  57. package/dist/migrations/0003_embeddings.d.ts.map +1 -0
  58. package/dist/migrations/0003_embeddings.js +23 -0
  59. package/dist/migrations/set.d.ts +13 -0
  60. package/dist/migrations/set.d.ts.map +1 -0
  61. package/dist/migrations/set.js +21 -0
  62. package/dist/presence/room.d.ts +35 -0
  63. package/dist/presence/room.d.ts.map +1 -0
  64. package/dist/presence/room.js +66 -0
  65. package/dist/provision/provisionSupport.d.ts +32 -0
  66. package/dist/provision/provisionSupport.d.ts.map +1 -1
  67. package/dist/provision/provisionSupport.js +10 -2
  68. package/dist/provision/resolveSupportConfig.d.ts.map +1 -1
  69. package/dist/provision/resolveSupportConfig.js +13 -2
  70. package/dist/purge/contribution.d.ts +49 -0
  71. package/dist/purge/contribution.d.ts.map +1 -0
  72. package/dist/purge/contribution.js +164 -0
  73. package/dist/secret/registry.d.ts +26 -2
  74. package/dist/secret/registry.d.ts.map +1 -1
  75. package/dist/secret/registry.js +15 -3
  76. package/dist/semantic/documents.d.ts +21 -0
  77. package/dist/semantic/documents.d.ts.map +1 -0
  78. package/dist/semantic/documents.js +128 -0
  79. package/dist/semantic/embed.d.ts +59 -0
  80. package/dist/semantic/embed.d.ts.map +1 -0
  81. package/dist/semantic/embed.js +59 -0
  82. package/dist/semantic/messageIndex.d.ts +46 -0
  83. package/dist/semantic/messageIndex.d.ts.map +1 -0
  84. package/dist/semantic/messageIndex.js +67 -0
  85. package/dist/semantic/query.d.ts +37 -0
  86. package/dist/semantic/query.d.ts.map +1 -0
  87. package/dist/semantic/query.js +46 -0
  88. package/dist/staff/staff.d.ts +22 -0
  89. package/dist/staff/staff.d.ts.map +1 -0
  90. package/dist/staff/staff.js +64 -0
  91. package/dist/store/assignment.d.ts +63 -0
  92. package/dist/store/assignment.d.ts.map +1 -0
  93. package/dist/store/assignment.js +86 -0
  94. package/dist/store/hybrid.d.ts +134 -0
  95. package/dist/store/hybrid.d.ts.map +1 -0
  96. package/dist/store/hybrid.js +185 -0
  97. package/dist/store/paging.d.ts +10 -0
  98. package/dist/store/paging.d.ts.map +1 -1
  99. package/dist/store/paging.js +11 -1
  100. package/dist/store/provisionIndex.d.ts +21 -0
  101. package/dist/store/provisionIndex.d.ts.map +1 -0
  102. package/dist/store/provisionIndex.js +36 -0
  103. package/dist/store/search.d.ts +18 -9
  104. package/dist/store/search.d.ts.map +1 -1
  105. package/dist/store/search.js +36 -34
  106. package/dist/store/searchIndex.d.ts +4 -4
  107. package/dist/store/searchIndex.js +4 -4
  108. package/dist/store/threads.d.ts +174 -8
  109. package/dist/store/threads.d.ts.map +1 -1
  110. package/dist/store/threads.js +33 -40
  111. package/dist/submission/submit.d.ts +1 -1
  112. package/dist/submission/submit.d.ts.map +1 -1
  113. package/dist/submission/submit.js +2 -1
  114. package/dist/test-utils/seed.d.ts +33 -0
  115. package/dist/test-utils/seed.d.ts.map +1 -0
  116. package/dist/test-utils/seed.js +102 -0
  117. package/dist/test-utils/semantic.d.ts +21 -0
  118. package/dist/test-utils/semantic.d.ts.map +1 -0
  119. package/dist/test-utils/semantic.js +107 -0
  120. package/dist/version.generated.d.ts +1 -1
  121. package/dist/version.generated.js +1 -1
  122. package/dist/workflows/specs.d.ts +23 -0
  123. package/dist/workflows/specs.d.ts.map +1 -1
  124. package/dist/workflows/specs.js +27 -7
  125. package/dist/workflows/worker.d.ts +15 -2
  126. package/dist/workflows/worker.d.ts.map +1 -1
  127. package/dist/workflows/worker.js +48 -4
  128. package/package.json +9 -7
  129. package/pithy.manifest.json +21 -3
  130. package/src/audit/actions.ts +9 -0
  131. package/src/capability.ts +43 -4
  132. package/src/config/config.ts +104 -5
  133. package/src/data/assignment.ts +55 -0
  134. package/src/data/embedding.ts +27 -0
  135. package/src/data/tables.ts +8 -0
  136. package/src/data/thread.ts +26 -4
  137. package/src/http/guards.ts +52 -15
  138. package/src/http/handlers.ts +125 -4
  139. package/src/http/resolve.ts +19 -0
  140. package/src/http/responses.ts +154 -0
  141. package/src/http/routes.ts +98 -12
  142. package/src/http/schemas.ts +117 -28
  143. package/src/http/scopes.ts +43 -6
  144. package/src/http/views.ts +44 -0
  145. package/src/inbound/ingest.ts +5 -2
  146. package/src/index.ts +5 -0
  147. package/src/migrations/0002_assignment.ts +65 -0
  148. package/src/migrations/0003_embeddings.ts +29 -0
  149. package/src/migrations/set.ts +21 -0
  150. package/src/presence/room.ts +94 -0
  151. package/src/provision/provisionSupport.ts +33 -1
  152. package/src/provision/resolveSupportConfig.ts +24 -13
  153. package/src/purge/contribution.ts +294 -0
  154. package/src/secret/registry.ts +17 -2
  155. package/src/semantic/documents.ts +178 -0
  156. package/src/semantic/embed.ts +99 -0
  157. package/src/semantic/messageIndex.ts +74 -0
  158. package/src/semantic/query.ts +66 -0
  159. package/src/staff/staff.ts +128 -0
  160. package/src/store/assignment.ts +179 -0
  161. package/src/store/hybrid.ts +314 -0
  162. package/src/store/paging.ts +14 -0
  163. package/src/store/provisionIndex.ts +46 -0
  164. package/src/store/search.ts +58 -37
  165. package/src/store/searchIndex.ts +4 -4
  166. package/src/store/threads.ts +91 -91
  167. package/src/submission/submit.ts +3 -2
  168. package/src/test-utils/seed.ts +141 -0
  169. package/src/test-utils/semantic.ts +110 -0
  170. package/src/version.generated.ts +1 -1
  171. package/src/workflows/specs.ts +34 -0
  172. package/src/workflows/worker.ts +84 -8
  173. package/src/workflows/wrangler.jsonc +8 -3
@@ -37,6 +37,10 @@ export declare const SupportThreadView: z.ZodObject<{
37
37
  archived: z.ZodBoolean;
38
38
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
39
39
  archivedBy: z.ZodNullable<z.ZodString>;
40
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
43
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
44
  messageCount: z.ZodNumber;
41
45
  firstMessageAt: z.ZodISODateTime;
42
46
  lastMessageAt: z.ZodISODateTime;
@@ -84,6 +88,10 @@ export declare const SupportListedThreadView: z.ZodObject<{
84
88
  archived: z.ZodBoolean;
85
89
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
86
90
  archivedBy: z.ZodNullable<z.ZodString>;
91
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
92
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
93
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
94
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
95
  messageCount: z.ZodNumber;
88
96
  firstMessageAt: z.ZodISODateTime;
89
97
  lastMessageAt: z.ZodISODateTime;
@@ -249,6 +257,10 @@ export declare const SupportThreadsResponse: z.ZodObject<{
249
257
  archived: z.ZodBoolean;
250
258
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
251
259
  archivedBy: z.ZodNullable<z.ZodString>;
260
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
261
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
262
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
263
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
252
264
  messageCount: z.ZodNumber;
253
265
  firstMessageAt: z.ZodISODateTime;
254
266
  lastMessageAt: z.ZodISODateTime;
@@ -260,6 +272,156 @@ export declare const SupportThreadsResponse: z.ZodObject<{
260
272
  nextCursor: z.ZodNullable<z.ZodString>;
261
273
  }, z.core.$strip>;
262
274
  export type SupportThreadsResponse = z.output<typeof SupportThreadsResponse>;
275
+ /** One search result. */
276
+ export declare const SupportSearchResultView: z.ZodObject<{
277
+ thread: z.ZodObject<{
278
+ id: z.ZodString;
279
+ channel: z.ZodEnum<{
280
+ app: "app";
281
+ email: "email";
282
+ }>;
283
+ inboxAddress: z.ZodNullable<z.ZodString>;
284
+ subject: z.ZodString;
285
+ fromAddress: z.ZodString;
286
+ fromName: z.ZodNullable<z.ZodString>;
287
+ senderAuthenticated: z.ZodBoolean;
288
+ userId: z.ZodNullable<z.ZodString>;
289
+ accountLinkSource: z.ZodNullable<z.ZodEnum<{
290
+ email_address: "email_address";
291
+ session: "session";
292
+ }>>;
293
+ declaredCategory: z.ZodNullable<z.ZodString>;
294
+ category: z.ZodString;
295
+ priority: z.ZodEnum<{
296
+ low: "low";
297
+ normal: "normal";
298
+ urgent: "urgent";
299
+ }>;
300
+ sentiment: z.ZodEnum<{
301
+ angry: "angry";
302
+ frustrated: "frustrated";
303
+ neutral: "neutral";
304
+ positive: "positive";
305
+ }>;
306
+ confidence: z.ZodNullable<z.ZodNumber>;
307
+ model: z.ZodNullable<z.ZodString>;
308
+ classifiedAt: z.ZodNullable<z.ZodISODateTime>;
309
+ archived: z.ZodBoolean;
310
+ archivedAt: z.ZodNullable<z.ZodISODateTime>;
311
+ archivedBy: z.ZodNullable<z.ZodString>;
312
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
313
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
314
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
315
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
316
+ messageCount: z.ZodNumber;
317
+ firstMessageAt: z.ZodISODateTime;
318
+ lastMessageAt: z.ZodISODateTime;
319
+ createdAt: z.ZodISODateTime;
320
+ updatedAt: z.ZodISODateTime;
321
+ read: z.ZodBoolean;
322
+ snoozedUntil: z.ZodNullable<z.ZodISODateTime>;
323
+ }, z.core.$strip>;
324
+ messageId: z.ZodString;
325
+ bm25: z.ZodOptional<z.ZodNumber>;
326
+ similarity: z.ZodOptional<z.ZodNumber>;
327
+ }, z.core.$strip>;
328
+ export type SupportSearchResultView = z.output<typeof SupportSearchResultView>;
329
+ /** `GET {base}/threads/search`. */
330
+ export declare const SupportSearchResponse: z.ZodObject<{
331
+ mode: z.ZodEnum<{
332
+ hybrid: "hybrid";
333
+ keyword: "keyword";
334
+ semantic: "semantic";
335
+ }>;
336
+ backends: z.ZodObject<{
337
+ ran: z.ZodArray<z.ZodEnum<{
338
+ fts: "fts";
339
+ like: "like";
340
+ semantic: "semantic";
341
+ }>>;
342
+ skipped: z.ZodArray<z.ZodObject<{
343
+ backend: z.ZodEnum<{
344
+ fts: "fts";
345
+ like: "like";
346
+ semantic: "semantic";
347
+ }>;
348
+ reason: z.ZodEnum<{
349
+ failed: "failed";
350
+ unprovisioned: "unprovisioned";
351
+ }>;
352
+ }, z.core.$strip>>;
353
+ }, z.core.$strip>;
354
+ count: z.ZodNumber;
355
+ results: z.ZodArray<z.ZodObject<{
356
+ thread: z.ZodObject<{
357
+ id: z.ZodString;
358
+ channel: z.ZodEnum<{
359
+ app: "app";
360
+ email: "email";
361
+ }>;
362
+ inboxAddress: z.ZodNullable<z.ZodString>;
363
+ subject: z.ZodString;
364
+ fromAddress: z.ZodString;
365
+ fromName: z.ZodNullable<z.ZodString>;
366
+ senderAuthenticated: z.ZodBoolean;
367
+ userId: z.ZodNullable<z.ZodString>;
368
+ accountLinkSource: z.ZodNullable<z.ZodEnum<{
369
+ email_address: "email_address";
370
+ session: "session";
371
+ }>>;
372
+ declaredCategory: z.ZodNullable<z.ZodString>;
373
+ category: z.ZodString;
374
+ priority: z.ZodEnum<{
375
+ low: "low";
376
+ normal: "normal";
377
+ urgent: "urgent";
378
+ }>;
379
+ sentiment: z.ZodEnum<{
380
+ angry: "angry";
381
+ frustrated: "frustrated";
382
+ neutral: "neutral";
383
+ positive: "positive";
384
+ }>;
385
+ confidence: z.ZodNullable<z.ZodNumber>;
386
+ model: z.ZodNullable<z.ZodString>;
387
+ classifiedAt: z.ZodNullable<z.ZodISODateTime>;
388
+ archived: z.ZodBoolean;
389
+ archivedAt: z.ZodNullable<z.ZodISODateTime>;
390
+ archivedBy: z.ZodNullable<z.ZodString>;
391
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
392
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
393
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
394
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
395
+ messageCount: z.ZodNumber;
396
+ firstMessageAt: z.ZodISODateTime;
397
+ lastMessageAt: z.ZodISODateTime;
398
+ createdAt: z.ZodISODateTime;
399
+ updatedAt: z.ZodISODateTime;
400
+ read: z.ZodBoolean;
401
+ snoozedUntil: z.ZodNullable<z.ZodISODateTime>;
402
+ }, z.core.$strip>;
403
+ messageId: z.ZodString;
404
+ bm25: z.ZodOptional<z.ZodNumber>;
405
+ similarity: z.ZodOptional<z.ZodNumber>;
406
+ }, z.core.$strip>>;
407
+ }, z.core.$strip>;
408
+ export type SupportSearchResponse = z.output<typeof SupportSearchResponse>;
409
+ /** One change of a thread's assignee, as its history shows it. */
410
+ export declare const SupportAssignmentView: z.ZodObject<{
411
+ id: z.ZodString;
412
+ assigneeRef: z.ZodNullable<z.ZodString>;
413
+ assigneeName: z.ZodNullable<z.ZodString>;
414
+ previousRef: z.ZodNullable<z.ZodString>;
415
+ previousName: z.ZodNullable<z.ZodString>;
416
+ actorType: z.ZodEnum<{
417
+ "control-plane": "control-plane";
418
+ user: "user";
419
+ }>;
420
+ assignedBy: z.ZodString;
421
+ note: z.ZodNullable<z.ZodString>;
422
+ createdAt: z.ZodISODateTime;
423
+ }, z.core.$strip>;
424
+ export type SupportAssignmentView = z.output<typeof SupportAssignmentView>;
263
425
  /** `GET {base}/threads/:id`. */
264
426
  export declare const SupportThreadResponse: z.ZodObject<{
265
427
  thread: z.ZodObject<{
@@ -297,6 +459,10 @@ export declare const SupportThreadResponse: z.ZodObject<{
297
459
  archived: z.ZodBoolean;
298
460
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
299
461
  archivedBy: z.ZodNullable<z.ZodString>;
462
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
463
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
464
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
465
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
300
466
  messageCount: z.ZodNumber;
301
467
  firstMessageAt: z.ZodISODateTime;
302
468
  lastMessageAt: z.ZodISODateTime;
@@ -367,6 +533,20 @@ export declare const SupportThreadResponse: z.ZodObject<{
367
533
  category: z.ZodOptional<z.ZodString>;
368
534
  body: z.ZodString;
369
535
  }, z.core.$strip>>;
536
+ assignments: z.ZodOptional<z.ZodArray<z.ZodObject<{
537
+ id: z.ZodString;
538
+ assigneeRef: z.ZodNullable<z.ZodString>;
539
+ assigneeName: z.ZodNullable<z.ZodString>;
540
+ previousRef: z.ZodNullable<z.ZodString>;
541
+ previousName: z.ZodNullable<z.ZodString>;
542
+ actorType: z.ZodEnum<{
543
+ "control-plane": "control-plane";
544
+ user: "user";
545
+ }>;
546
+ assignedBy: z.ZodString;
547
+ note: z.ZodNullable<z.ZodString>;
548
+ createdAt: z.ZodISODateTime;
549
+ }, z.core.$strip>>>;
370
550
  }, z.core.$strip>;
371
551
  export type SupportThreadResponse = z.output<typeof SupportThreadResponse>;
372
552
  /**
@@ -410,6 +590,10 @@ export declare const SupportArchiveResponse: z.ZodObject<{
410
590
  archived: z.ZodBoolean;
411
591
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
412
592
  archivedBy: z.ZodNullable<z.ZodString>;
593
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
594
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
595
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
596
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
413
597
  messageCount: z.ZodNumber;
414
598
  firstMessageAt: z.ZodISODateTime;
415
599
  lastMessageAt: z.ZodISODateTime;
@@ -434,6 +618,61 @@ export declare const SupportReplySentResponse: z.ZodDiscriminatedUnion<[z.ZodObj
434
618
  messageId: z.ZodString;
435
619
  }, z.core.$strip>], "channel">;
436
620
  export type SupportReplySentResponse = z.output<typeof SupportReplySentResponse>;
621
+ /**
622
+ * `POST {base}/threads/:id/assign` and `POST {base}/staff/threads/:id/assign`.
623
+ *
624
+ * The thread as the assignment left it, and whether anything changed: assigning the current assignee again
625
+ * is a success that wrote nothing, and a pane that re-renders from it should know not to say *reassigned*.
626
+ */
627
+ export declare const SupportAssignResponse: z.ZodObject<{
628
+ thread: z.ZodObject<{
629
+ id: z.ZodString;
630
+ channel: z.ZodEnum<{
631
+ app: "app";
632
+ email: "email";
633
+ }>;
634
+ inboxAddress: z.ZodNullable<z.ZodString>;
635
+ subject: z.ZodString;
636
+ fromAddress: z.ZodString;
637
+ fromName: z.ZodNullable<z.ZodString>;
638
+ senderAuthenticated: z.ZodBoolean;
639
+ userId: z.ZodNullable<z.ZodString>;
640
+ accountLinkSource: z.ZodNullable<z.ZodEnum<{
641
+ email_address: "email_address";
642
+ session: "session";
643
+ }>>;
644
+ declaredCategory: z.ZodNullable<z.ZodString>;
645
+ category: z.ZodString;
646
+ priority: z.ZodEnum<{
647
+ low: "low";
648
+ normal: "normal";
649
+ urgent: "urgent";
650
+ }>;
651
+ sentiment: z.ZodEnum<{
652
+ angry: "angry";
653
+ frustrated: "frustrated";
654
+ neutral: "neutral";
655
+ positive: "positive";
656
+ }>;
657
+ confidence: z.ZodNullable<z.ZodNumber>;
658
+ model: z.ZodNullable<z.ZodString>;
659
+ classifiedAt: z.ZodNullable<z.ZodISODateTime>;
660
+ archived: z.ZodBoolean;
661
+ archivedAt: z.ZodNullable<z.ZodISODateTime>;
662
+ archivedBy: z.ZodNullable<z.ZodString>;
663
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
664
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
665
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
666
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
667
+ messageCount: z.ZodNumber;
668
+ firstMessageAt: z.ZodISODateTime;
669
+ lastMessageAt: z.ZodISODateTime;
670
+ createdAt: z.ZodISODateTime;
671
+ updatedAt: z.ZodISODateTime;
672
+ }, z.core.$strip>;
673
+ changed: z.ZodBoolean;
674
+ }, z.core.$strip>;
675
+ export type SupportAssignResponse = z.output<typeof SupportAssignResponse>;
437
676
  /** `POST {base}/threads/:id/reclassify`. */
438
677
  export declare const SupportReclassifiedResponse: z.ZodObject<{
439
678
  messageId: z.ZodString;
@@ -500,6 +739,10 @@ export declare const SupportThreadViewAsRead: z.ZodObject<{
500
739
  archived: z.ZodBoolean;
501
740
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
502
741
  archivedBy: z.ZodNullable<z.ZodString>;
742
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
743
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
744
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
745
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
503
746
  messageCount: z.ZodNumber;
504
747
  firstMessageAt: z.ZodISODateTime;
505
748
  lastMessageAt: z.ZodISODateTime;
@@ -528,6 +771,10 @@ export declare const SupportListedThreadViewAsRead: z.ZodObject<{
528
771
  archived: z.ZodBoolean;
529
772
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
530
773
  archivedBy: z.ZodNullable<z.ZodString>;
774
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
775
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
776
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
777
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
531
778
  messageCount: z.ZodNumber;
532
779
  firstMessageAt: z.ZodISODateTime;
533
780
  lastMessageAt: z.ZodISODateTime;
@@ -581,6 +828,10 @@ export declare const SupportThreadsResponseAsRead: z.ZodObject<{
581
828
  archived: z.ZodBoolean;
582
829
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
583
830
  archivedBy: z.ZodNullable<z.ZodString>;
831
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
832
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
833
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
834
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
584
835
  messageCount: z.ZodNumber;
585
836
  firstMessageAt: z.ZodISODateTime;
586
837
  lastMessageAt: z.ZodISODateTime;
@@ -592,6 +843,56 @@ export declare const SupportThreadsResponseAsRead: z.ZodObject<{
592
843
  nextCursor: z.ZodNullable<z.ZodString>;
593
844
  }, z.core.$strip>;
594
845
  export type SupportThreadsResponseAsRead = z.output<typeof SupportThreadsResponseAsRead>;
846
+ /** `GET {base}/threads/search`, as a client that does not control the Worker must read it. */
847
+ export declare const SupportSearchResponseAsRead: z.ZodObject<{
848
+ mode: z.ZodString;
849
+ backends: z.ZodObject<{
850
+ ran: z.ZodArray<z.ZodString>;
851
+ skipped: z.ZodArray<z.ZodObject<{
852
+ backend: z.ZodString;
853
+ reason: z.ZodString;
854
+ }, z.core.$strip>>;
855
+ }, z.core.$strip>;
856
+ count: z.ZodNumber;
857
+ results: z.ZodArray<z.ZodObject<{
858
+ thread: z.ZodObject<{
859
+ id: z.ZodString;
860
+ channel: z.ZodString;
861
+ inboxAddress: z.ZodNullable<z.ZodString>;
862
+ subject: z.ZodString;
863
+ fromAddress: z.ZodString;
864
+ fromName: z.ZodNullable<z.ZodString>;
865
+ senderAuthenticated: z.ZodBoolean;
866
+ userId: z.ZodNullable<z.ZodString>;
867
+ accountLinkSource: z.ZodNullable<z.ZodString>;
868
+ declaredCategory: z.ZodNullable<z.ZodString>;
869
+ category: z.ZodString;
870
+ priority: z.ZodString;
871
+ sentiment: z.ZodString;
872
+ confidence: z.ZodNullable<z.ZodNumber>;
873
+ model: z.ZodNullable<z.ZodString>;
874
+ classifiedAt: z.ZodNullable<z.ZodISODateTime>;
875
+ archived: z.ZodBoolean;
876
+ archivedAt: z.ZodNullable<z.ZodISODateTime>;
877
+ archivedBy: z.ZodNullable<z.ZodString>;
878
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
879
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
880
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
881
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
882
+ messageCount: z.ZodNumber;
883
+ firstMessageAt: z.ZodISODateTime;
884
+ lastMessageAt: z.ZodISODateTime;
885
+ createdAt: z.ZodISODateTime;
886
+ updatedAt: z.ZodISODateTime;
887
+ read: z.ZodBoolean;
888
+ snoozedUntil: z.ZodNullable<z.ZodISODateTime>;
889
+ }, z.core.$strip>;
890
+ messageId: z.ZodString;
891
+ bm25: z.ZodOptional<z.ZodNumber>;
892
+ similarity: z.ZodOptional<z.ZodNumber>;
893
+ }, z.core.$strip>>;
894
+ }, z.core.$strip>;
895
+ export type SupportSearchResponseAsRead = z.output<typeof SupportSearchResponseAsRead>;
595
896
  /** `GET {base}/threads/:id`, as a client that does not control the Worker must read it. */
596
897
  export declare const SupportThreadResponseAsRead: z.ZodObject<{
597
898
  thread: z.ZodObject<{
@@ -614,6 +915,10 @@ export declare const SupportThreadResponseAsRead: z.ZodObject<{
614
915
  archived: z.ZodBoolean;
615
916
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
616
917
  archivedBy: z.ZodNullable<z.ZodString>;
918
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
919
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
920
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
921
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
617
922
  messageCount: z.ZodNumber;
618
923
  firstMessageAt: z.ZodISODateTime;
619
924
  lastMessageAt: z.ZodISODateTime;
@@ -678,6 +983,17 @@ export declare const SupportThreadResponseAsRead: z.ZodObject<{
678
983
  category: z.ZodOptional<z.ZodString>;
679
984
  body: z.ZodString;
680
985
  }, z.core.$strip>>;
986
+ assignments: z.ZodOptional<z.ZodArray<z.ZodObject<{
987
+ id: z.ZodString;
988
+ assigneeRef: z.ZodNullable<z.ZodString>;
989
+ assigneeName: z.ZodNullable<z.ZodString>;
990
+ previousRef: z.ZodNullable<z.ZodString>;
991
+ previousName: z.ZodNullable<z.ZodString>;
992
+ actorType: z.ZodString;
993
+ assignedBy: z.ZodString;
994
+ note: z.ZodNullable<z.ZodString>;
995
+ createdAt: z.ZodISODateTime;
996
+ }, z.core.$strip>>>;
681
997
  }, z.core.$strip>;
682
998
  export type SupportThreadResponseAsRead = z.output<typeof SupportThreadResponseAsRead>;
683
999
  /** `POST {base}/threads/:id/archive`, as a client that does not control the Worker must read it. */
@@ -701,6 +1017,10 @@ export declare const SupportArchiveResponseAsRead: z.ZodObject<{
701
1017
  archived: z.ZodBoolean;
702
1018
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
703
1019
  archivedBy: z.ZodNullable<z.ZodString>;
1020
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1021
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1022
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
1023
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
704
1024
  messageCount: z.ZodNumber;
705
1025
  firstMessageAt: z.ZodISODateTime;
706
1026
  lastMessageAt: z.ZodISODateTime;
@@ -708,6 +1028,41 @@ export declare const SupportArchiveResponseAsRead: z.ZodObject<{
708
1028
  updatedAt: z.ZodISODateTime;
709
1029
  }, z.core.$strip>;
710
1030
  export type SupportArchiveResponseAsRead = z.output<typeof SupportArchiveResponseAsRead>;
1031
+ /** `POST {base}/threads/:id/assign`, as a client that does not control the Worker must read it. */
1032
+ export declare const SupportAssignResponseAsRead: z.ZodObject<{
1033
+ thread: z.ZodObject<{
1034
+ id: z.ZodString;
1035
+ channel: z.ZodString;
1036
+ inboxAddress: z.ZodNullable<z.ZodString>;
1037
+ subject: z.ZodString;
1038
+ fromAddress: z.ZodString;
1039
+ fromName: z.ZodNullable<z.ZodString>;
1040
+ senderAuthenticated: z.ZodBoolean;
1041
+ userId: z.ZodNullable<z.ZodString>;
1042
+ accountLinkSource: z.ZodNullable<z.ZodString>;
1043
+ declaredCategory: z.ZodNullable<z.ZodString>;
1044
+ category: z.ZodString;
1045
+ priority: z.ZodString;
1046
+ sentiment: z.ZodString;
1047
+ confidence: z.ZodNullable<z.ZodNumber>;
1048
+ model: z.ZodNullable<z.ZodString>;
1049
+ classifiedAt: z.ZodNullable<z.ZodISODateTime>;
1050
+ archived: z.ZodBoolean;
1051
+ archivedAt: z.ZodNullable<z.ZodISODateTime>;
1052
+ archivedBy: z.ZodNullable<z.ZodString>;
1053
+ assigneeRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1054
+ assigneeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1055
+ assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
1056
+ assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1057
+ messageCount: z.ZodNumber;
1058
+ firstMessageAt: z.ZodISODateTime;
1059
+ lastMessageAt: z.ZodISODateTime;
1060
+ createdAt: z.ZodISODateTime;
1061
+ updatedAt: z.ZodISODateTime;
1062
+ }, z.core.$strip>;
1063
+ changed: z.ZodBoolean;
1064
+ }, z.core.$strip>;
1065
+ export type SupportAssignResponseAsRead = z.output<typeof SupportAssignResponseAsRead>;
711
1066
  /**
712
1067
  * ## The submitter's own view, and what it deliberately omits
713
1068
  *
@@ -1 +1 @@
1
- {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/http/responses.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkDxB,mEAAmE;AACnE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8D0C,CAAC;AACzE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGkE,CAAC;AACvG,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE/E,qCAAqC;AACrC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;iBAqCoD,CAAC;AACpF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAErE,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB;;;;;;;;iBAeuE,CAAC;AAC1G,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE3E,kFAAkF;AAClF,eAAO,MAAM,kBAAkB;;;;;;;;;iBAWiF,CAAC;AACjH,MAAM,MAAM,k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AAO,sBAAsB,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
3
  import { SupportAccountLinkSource, SupportChannel, SupportMessageDirection, SupportPriority, SupportSentiment } from "../data/enums.js";
4
+ import { SupportAssignmentActorType } from "../data/assignment.js";
4
5
  import { SupportSubmissionContext } from "../data/message.js";
5
6
  import { SUPPORT_BILLING_SCOPE } from "../data/billingScope.js";
6
7
  import { z } from "zod";
@@ -61,6 +62,10 @@ const SupportThreadView = z.object({
61
62
  archived: z.boolean().describe("Done. One shared boolean, not per viewer."),
62
63
  archivedAt: z.iso.datetime().nullable().describe("When it was last archived, ISO-8601; null while open."),
63
64
  archivedBy: z.string().nullable().describe("The control-plane subject that archived it, for convenience only — the answer to 'who marked this done' comes from the audit trail."),
65
+ assigneeRef: z.string().nullable().optional().describe("Who has this conversation, as the opaque reference it was assigned to, or null when nobody has it. Absent from a Worker that predates assignment. The listing's `assignee` filter matches it."),
66
+ assigneeName: z.string().nullable().optional().describe("How the assignee is shown, as the assigner named them; null when nobody has it. A label, never an identity — `assigneeRef` is that. Untrusted text; render it escaped."),
67
+ assignedAt: z.iso.datetime().nullable().optional().describe("When the current assignment was made, ISO-8601; null when nobody has it."),
68
+ assignedBy: z.string().nullable().optional().describe("Who made the current assignment — a control-plane subject, or a user of the app's id; null when nobody has it. Every earlier change is in the thread's `assignments`."),
64
69
  messageCount: z.number().int().describe("How many messages the thread holds, inbound and outbound together."),
65
70
  firstMessageAt: z.iso.datetime().describe("When the thread opened, ISO-8601."),
66
71
  lastMessageAt: z.iso.datetime().describe("When the thread last moved, ISO-8601. The inbox sorts on this."),
@@ -167,13 +172,56 @@ const SupportThreadsResponse = z.object({
167
172
  threads: z.array(SupportListedThreadView).describe("The page, newest first."),
168
173
  nextCursor: NextCursor
169
174
  }).describe("A page of the inbox, as one viewer sees it.");
175
+ /** A search backend, by name. */
176
+ const SupportSearchBackend = z.enum([
177
+ "fts",
178
+ "like",
179
+ "semantic"
180
+ ]).describe("A search backend: `fts` (the FTS5 index), `like` (the keyword scan), or `semantic` (the message index).");
181
+ /** One search result. */
182
+ const SupportSearchResultView = z.object({
183
+ thread: SupportListedThreadView.describe("The thread, carrying the calling viewer's own read and snooze state."),
184
+ messageId: z.string().describe("The message in the thread that matched best — the one the scores below belong to. Open the thread at it."),
185
+ bm25: z.number().optional().describe("That message's FTS5 `bm25`, raw: lower is better, and comparable only within one search. Absent when FTS5 did not run or did not match it — including on the `LIKE` scan, which has no score."),
186
+ similarity: z.number().optional().describe("That message's similarity to the query in the semantic index, raw: higher is closer. Absent when semantic search did not run or did not match it. Never normalized against `bm25` — the two are reported as they are.")
187
+ }).describe("One thread a search found, named by its best-matching message, with that message's raw scores.");
188
+ /** `GET {base}/threads/search`. */
189
+ const SupportSearchResponse = z.object({
190
+ mode: z.enum([
191
+ "keyword",
192
+ "semantic",
193
+ "hybrid"
194
+ ]).describe("The mode that ran: the one asked for, or `hybrid` when none was."),
195
+ backends: z.object({
196
+ ran: z.array(SupportSearchBackend).describe("The backends that answered."),
197
+ skipped: z.array(z.object({
198
+ backend: SupportSearchBackend,
199
+ reason: z.enum(["unprovisioned", "failed"]).describe("`unprovisioned` — on in config, and its index or binding is not there until `pithy support provision` runs. `failed` — it was there and did not answer.")
200
+ }).describe("A backend that was on and did not answer.")).describe("The backends that were on and did not answer. Empty when every one did. A skip degrades the search, never fails it.")
201
+ }).describe("Which backends ran, and which were skipped."),
202
+ count: z.number().int().min(0).describe("How many results came back. Under the limit when the filters left fewer — that is the true count, not a page."),
203
+ results: z.array(SupportSearchResultView).describe("The threads, best first: fused by rank, newest first on a tie.")
204
+ }).describe("A ranked search over the inbox. No cursor: a ranked list has a top, not pages.");
205
+ /** One change of a thread's assignee, as its history shows it. */
206
+ const SupportAssignmentView = z.object({
207
+ id: z.string().describe("The history row's id."),
208
+ assigneeRef: z.string().nullable().describe("Who had the thread after this change, or null when it was unassigned."),
209
+ assigneeName: z.string().nullable().describe("How that assignee was shown at the time, or null."),
210
+ previousRef: z.string().nullable().describe("Who had it before, or null when nobody did."),
211
+ previousName: z.string().nullable().describe("How the previous assignee was shown, or null."),
212
+ actorType: SupportAssignmentActorType.describe("How whoever made the change was verified: `control-plane` for a management client, `user` for a signed-in user of the app."),
213
+ assignedBy: z.string().describe("Who made the change — a control-plane subject, or a user of the app's id."),
214
+ note: z.string().nullable().describe("Why, in the assigner's words, or null. Untrusted text; render it escaped."),
215
+ createdAt: z.iso.datetime().describe("When the change was made, ISO-8601.")
216
+ }).describe("One append-only change of a conversation's assignee.");
170
217
  /** `GET {base}/threads/:id`. */
171
218
  const SupportThreadResponse = z.object({
172
219
  thread: SupportThreadView.describe("The conversation."),
173
220
  messages: z.array(SupportMessageView).describe("Its messages, oldest first — a conversation reads downward."),
174
221
  attachments: z.array(SupportAttachmentView).describe("Its attachments, across every message."),
175
222
  sender: SenderContextView.describe("What the app already knows about the sender."),
176
- replies: z.array(SupportReplyView).describe("The canned replies, ordered for this thread's category.")
223
+ replies: z.array(SupportReplyView).describe("The canned replies, ordered for this thread's category."),
224
+ assignments: z.array(SupportAssignmentView).optional().describe("Every change of the assignee, oldest first. Empty when nobody was ever assigned; absent from a Worker that predates assignment.")
177
225
  }).describe("A whole conversation, with the customer context and the replies worth offering on it.");
178
226
  /**
179
227
  * `POST {base}/threads/:id/archive`.
@@ -198,6 +246,16 @@ const SupportReplySentResponse = z.discriminatedUnion("channel", [z.object({
198
246
  channel: z.literal("app").describe("The reply was stored, and no mail was sent. The submitter reads it next time they open the conversation — which means nobody has told them yet, and telling them is the application's call."),
199
247
  messageId: z.string().describe("The outbound message row this reply created.")
200
248
  }).describe("A reply that is waiting in the app. There is no mail job, because there was no send.")]).describe("The reply that was filed, and which of the two ways it reaches the customer.");
249
+ /**
250
+ * `POST {base}/threads/:id/assign` and `POST {base}/staff/threads/:id/assign`.
251
+ *
252
+ * The thread as the assignment left it, and whether anything changed: assigning the current assignee again
253
+ * is a success that wrote nothing, and a pane that re-renders from it should know not to say *reassigned*.
254
+ */
255
+ const SupportAssignResponse = z.object({
256
+ thread: SupportThreadView.describe("The conversation, as the assignment left it."),
257
+ changed: z.boolean().describe("Whether the assignee changed. False when the thread already had that assignee, or had none and was unassigned — nothing was recorded and nothing was audited.")
258
+ }).describe("The conversation after an assignment, and whether it changed anything.");
201
259
  /** `POST {base}/threads/:id/reclassify`. */
202
260
  const SupportReclassifiedResponse = z.object({ messageId: z.string().describe("The latest inbound message the classifier was started against.") }).describe("Which message a reclassification was started for.");
203
261
  /**
@@ -245,10 +303,14 @@ const SupportListedThreadViewAsRead = asRead(SupportListedThreadView);
245
303
  const SupportMessageViewAsRead = asRead(SupportMessageView);
246
304
  /** `GET {base}/threads`, as a client that does not control the Worker must read it. */
247
305
  const SupportThreadsResponseAsRead = asRead(SupportThreadsResponse);
306
+ /** `GET {base}/threads/search`, as a client that does not control the Worker must read it. */
307
+ const SupportSearchResponseAsRead = asRead(SupportSearchResponse);
248
308
  /** `GET {base}/threads/:id`, as a client that does not control the Worker must read it. */
249
309
  const SupportThreadResponseAsRead = asRead(SupportThreadResponse);
250
310
  /** `POST {base}/threads/:id/archive`, as a client that does not control the Worker must read it. */
251
311
  const SupportArchiveResponseAsRead = asRead(SupportArchiveResponse);
312
+ /** `POST {base}/threads/:id/assign`, as a client that does not control the Worker must read it. */
313
+ const SupportAssignResponseAsRead = asRead(SupportAssignResponse);
252
314
  /**
253
315
  * ## The submitter's own view, and what it deliberately omits
254
316
  *
@@ -302,4 +364,4 @@ const SupportMyThreadResponse = z.object({
302
364
  /** `GET {base}/replies`. */
303
365
  const SupportRepliesResponse = z.object({ replies: z.array(SupportReplyView).describe("The catalog, ordered for the requested category.") }).describe("The canned reply catalog.");
304
366
  //#endregion
305
- export { SenderBillingScope, SenderContextView, SenderEntitlementView, SenderPurchaseView, SupportArchiveResponse, SupportArchiveResponseAsRead, SupportAttachmentView, SupportFlagsResponse, SupportListedThreadView, SupportListedThreadViewAsRead, SupportMessageView, SupportMessageViewAsRead, SupportMyMessageView, SupportMyThreadResponse, SupportMyThreadView, SupportMyThreadsResponse, SupportReclassifiedResponse, SupportRepliesResponse, SupportReplySentResponse, SupportReplyView, SupportSubmissionResponse, SupportThreadResponse, SupportThreadResponseAsRead, SupportThreadView, SupportThreadViewAsRead, SupportThreadsResponse, SupportThreadsResponseAsRead };
367
+ export { SenderBillingScope, SenderContextView, SenderEntitlementView, SenderPurchaseView, SupportArchiveResponse, SupportArchiveResponseAsRead, SupportAssignResponse, SupportAssignResponseAsRead, SupportAssignmentView, SupportAttachmentView, SupportFlagsResponse, SupportListedThreadView, SupportListedThreadViewAsRead, SupportMessageView, SupportMessageViewAsRead, SupportMyMessageView, SupportMyThreadResponse, SupportMyThreadView, SupportMyThreadsResponse, SupportReclassifiedResponse, SupportRepliesResponse, SupportReplySentResponse, SupportReplyView, SupportSearchResponse, SupportSearchResponseAsRead, SupportSearchResultView, SupportSubmissionResponse, SupportThreadResponse, SupportThreadResponseAsRead, SupportThreadView, SupportThreadViewAsRead, SupportThreadsResponse, SupportThreadsResponseAsRead };