@vercel/board 0.0.0 → 0.16.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 (126) hide show
  1. package/README.md +180 -0
  2. package/dist/a2-C41hD8SF.mjs +3045 -0
  3. package/dist/a2-D24cvwpN.d.mts +3359 -0
  4. package/dist/access-CJU2-vaa.mjs +226 -0
  5. package/dist/access-CV96SYgr.d.mts +32 -0
  6. package/dist/access.d.mts +30 -0
  7. package/dist/access.mjs +4 -0
  8. package/dist/actors-DjMeZpnU.mjs +224 -0
  9. package/dist/attempts-Bxp9KgPf.mjs +919 -0
  10. package/dist/auth-COzc09sn.mjs +276 -0
  11. package/dist/auth-CU56Q2Xh.d.mts +204 -0
  12. package/dist/backend-a2/blob-vercel.d.mts +8 -0
  13. package/dist/backend-a2/blob-vercel.mjs +81 -0
  14. package/dist/backend-a2/contract.d.mts +18 -0
  15. package/dist/backend-a2/contract.mjs +5 -0
  16. package/dist/backend-a2/scheduler-local.d.mts +11 -0
  17. package/dist/backend-a2/scheduler-local.mjs +2 -0
  18. package/dist/backend-a2/scheduler-qstash.d.mts +2 -0
  19. package/dist/backend-a2/scheduler-qstash.mjs +2 -0
  20. package/dist/backend-a2/scheduler-vercel.d.mts +2 -0
  21. package/dist/backend-a2/scheduler-vercel.mjs +2 -0
  22. package/dist/backend-a2/store-memory.d.mts +11 -0
  23. package/dist/backend-a2/store-memory.mjs +19 -0
  24. package/dist/backend-a2/store-postgres.d.mts +38 -0
  25. package/dist/backend-a2/store-postgres.mjs +110 -0
  26. package/dist/backend-a2/store-redis-http.d.mts +17 -0
  27. package/dist/backend-a2/store-redis-http.mjs +32 -0
  28. package/dist/backend-a2/store-redis.d.mts +23 -0
  29. package/dist/backend-a2/store-redis.mjs +39 -0
  30. package/dist/backend-a2/store-sqlite.d.mts +12 -0
  31. package/dist/backend-a2/store-sqlite.mjs +31 -0
  32. package/dist/backend-a2.d.mts +4 -0
  33. package/dist/backend-a2.mjs +2 -0
  34. package/dist/backend-http-0roEmjl0.mjs +613 -0
  35. package/dist/backend-http-BVRno-ca.mjs +469 -0
  36. package/dist/backend-http-Bid7RIpC.d.mts +630 -0
  37. package/dist/backend-http.d.mts +10 -0
  38. package/dist/backend-http.mjs +2 -0
  39. package/dist/backend-http.node.d.mts +10 -0
  40. package/dist/backend-http.node.mjs +2 -0
  41. package/dist/blob-C0J3wbGv.d.mts +39 -0
  42. package/dist/bots-CGkO76qH.mjs +67 -0
  43. package/dist/chat-provider-XCnQlxq6.d.mts +140 -0
  44. package/dist/chat-provider-jFSeyNmB.mjs +389 -0
  45. package/dist/cli.d.mts +1 -0
  46. package/dist/cli.mjs +2252 -0
  47. package/dist/client-DGDPaN7U.mjs +380 -0
  48. package/dist/conformance-DRR23YNy.mjs +512 -0
  49. package/dist/conformance.d.mts +30 -0
  50. package/dist/conformance.mjs +2 -0
  51. package/dist/contract-CuJmlrhw.mjs +566 -0
  52. package/dist/emoji-CTLpvH-A.mjs +445 -0
  53. package/dist/engine-Bir5s8ts.mjs +1449 -0
  54. package/dist/errors-DX3hpwWt.mjs +64 -0
  55. package/dist/exports-DLiE7fLY.d.mts +4 -0
  56. package/dist/exports-Dvc1o52I.mjs +1285 -0
  57. package/dist/files-SniSmeEr.mjs +47 -0
  58. package/dist/index.d.mts +13 -0
  59. package/dist/index.default-Bkg77Pxn.mjs +12 -0
  60. package/dist/index.mjs +19 -0
  61. package/dist/index.node.d.mts +14 -0
  62. package/dist/index.node.mjs +5 -0
  63. package/dist/inspect/app.js +416 -0
  64. package/dist/inspect/engine.js +5 -0
  65. package/dist/local-Cr_dSjvs.mjs +44 -0
  66. package/dist/own-OwgPWdmh.mjs +15 -0
  67. package/dist/project-CFiArraX.mjs +124 -0
  68. package/dist/provider-BGjz-mDa.d.mts +2473 -0
  69. package/dist/provider-CuewcDNZ.mjs +205 -0
  70. package/dist/redis-tables-B35vv4CZ.mjs +842 -0
  71. package/dist/reducers-B_vUGQRp.d.mts +1172 -0
  72. package/dist/reducers-mUPFuFJV.mjs +293 -0
  73. package/dist/schemas-Be08nyfW.mjs +74 -0
  74. package/dist/schemas-CWxs3ECJ.d.mts +50 -0
  75. package/dist/serve-BsOOc-6_.mjs +170 -0
  76. package/dist/server-jwPY7_wi.mjs +17 -0
  77. package/dist/serving-BNbzc96L.mjs +2 -0
  78. package/dist/sql-DbiEnqM0.mjs +571 -0
  79. package/dist/sqlite-db-Cbj03vmp.mjs +70 -0
  80. package/dist/sync-github.d.mts +473 -0
  81. package/dist/sync-github.mjs +603 -0
  82. package/dist/sync-kapso.d.mts +175 -0
  83. package/dist/sync-kapso.mjs +86 -0
  84. package/dist/sync-slack.d.mts +364 -0
  85. package/dist/sync-slack.mjs +728 -0
  86. package/dist/sync.chat.d.mts +2 -0
  87. package/dist/sync.chat.mjs +2 -0
  88. package/dist/sync.d.mts +3 -0
  89. package/dist/sync.mjs +4 -0
  90. package/dist/targets-yM5JBUgr.mjs +94 -0
  91. package/dist/tokens-DKLn5P9B.mjs +256 -0
  92. package/dist/types-BHCjTZdB.d.mts +104 -0
  93. package/dist/users-Dls7_ANV.mjs +42 -0
  94. package/dist/watch-spec-W0c7ypHJ.mjs +787 -0
  95. package/dist/watchers-hash-CLjsa6od.mjs +225 -0
  96. package/docs/01-board/01-mounting.md +506 -0
  97. package/docs/01-board/02-database.md +258 -0
  98. package/docs/01-board/03-identity.md +264 -0
  99. package/docs/01-board/04-messages.md +192 -0
  100. package/docs/01-board/05-reading.md +177 -0
  101. package/docs/01-board/06-watchers.md +249 -0
  102. package/docs/01-board/07-schedules.md +133 -0
  103. package/docs/01-board/08-middleware.md +139 -0
  104. package/docs/01-board/09-access.md +501 -0
  105. package/docs/01-quickstart.md +196 -0
  106. package/docs/02-sync/01-overview.md +290 -0
  107. package/docs/02-sync/02-callbacks.md +265 -0
  108. package/docs/02-sync/03-slack.md +248 -0
  109. package/docs/02-sync/04-github.md +201 -0
  110. package/docs/02-sync/05-whatsapp.md +148 -0
  111. package/docs/02-sync/06-providers.md +228 -0
  112. package/docs/03-guides/01-coding-agents.md +226 -0
  113. package/docs/03-guides/02-inspector.md +104 -0
  114. package/docs/03-guides/03-ci.md +251 -0
  115. package/docs/03-guides/04-triage.md +233 -0
  116. package/docs/03-guides/05-agent-factory.md +142 -0
  117. package/docs/04-reference/01-cli.md +606 -0
  118. package/docs/04-reference/02-board.md +579 -0
  119. package/docs/04-reference/03-http.md +489 -0
  120. package/docs/04-reference/04-log.md +250 -0
  121. package/docs/04-reference/05-conformance.md +97 -0
  122. package/docs/index.md +186 -0
  123. package/package.json +168 -1
  124. package/sql/postgres/board.sql +145 -0
  125. package/sql/postgres/notifications.sql +24 -0
  126. package/sql/postgres/schema.sql +451 -0
@@ -0,0 +1,2473 @@
1
+ import { n as AccessSummary } from "./access-CV96SYgr.mjs";
2
+ import { i as Attachment } from "./schemas-CWxs3ECJ.mjs";
3
+ import { _ as ExternalFile, a as ExternalCopy, g as ExternalEvent, h as ExternalAuthor, o as Message, p as BoardEvent, r as Channel, t as Actor, v as ExternalLink, y as Link } from "./reducers-B_vUGQRp.mjs";
4
+ import { z } from "zod";
5
+ //#region src/api/routes.d.ts
6
+ /**
7
+ * A message's, schedule's, or cursor's ID: a string clients pass back as they got it, and never
8
+ * parse, compare, or count with. Each backend picks its own; a board on `a2()` writes decimals.
9
+ */
10
+ declare const Ref: z.ZodString;
11
+ /** A sync target as the board that syncs it resolved it: a platform channel to start a thread in, or a thread to join. */
12
+ declare const ResolvedSyncTarget: z.ZodObject<{
13
+ target: z.ZodString;
14
+ kind: z.ZodEnum<{
15
+ channel: "channel";
16
+ thread: "thread";
17
+ }>;
18
+ }, z.core.$strip>;
19
+ /** Shared by `/messages` and `/events`. */
20
+ declare const Filters$1: z.ZodObject<{
21
+ channel: z.ZodOptional<z.ZodString>;
22
+ re: z.ZodOptional<z.ZodString>;
23
+ by: z.ZodOptional<z.ZodString>;
24
+ mentions: z.ZodOptional<z.ZodString>;
25
+ label: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<readonly [string, null] | readonly [string, string[]], string>>>>>;
26
+ from: z.ZodOptional<z.ZodString>;
27
+ text: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ declare const MessagesQuery: z.ZodObject<{
30
+ channel: z.ZodOptional<z.ZodString>;
31
+ re: z.ZodOptional<z.ZodString>;
32
+ by: z.ZodOptional<z.ZodString>;
33
+ mentions: z.ZodOptional<z.ZodString>;
34
+ label: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<readonly [string, null] | readonly [string, string[]], string>>>>>;
35
+ from: z.ZodOptional<z.ZodString>;
36
+ text: z.ZodOptional<z.ZodString>;
37
+ after: z.ZodOptional<z.ZodString>;
38
+ before: z.ZodOptional<z.ZodString>;
39
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
40
+ }, z.core.$strip>;
41
+ /** `limit` counts threads: each thread with a matching message, by its latest reply. */
42
+ declare const ThreadsQuery: z.ZodObject<{
43
+ channel: z.ZodOptional<z.ZodString>;
44
+ re: z.ZodOptional<z.ZodString>;
45
+ by: z.ZodOptional<z.ZodString>;
46
+ mentions: z.ZodOptional<z.ZodString>;
47
+ label: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<readonly [string, null] | readonly [string, string[]], string>>>>>;
48
+ from: z.ZodOptional<z.ZodString>;
49
+ text: z.ZodOptional<z.ZodString>;
50
+ after: z.ZodOptional<z.ZodString>;
51
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
52
+ }, z.core.$strip>;
53
+ declare const EventsQuery: z.ZodObject<{
54
+ channel: z.ZodOptional<z.ZodString>;
55
+ re: z.ZodOptional<z.ZodString>;
56
+ by: z.ZodOptional<z.ZodString>;
57
+ mentions: z.ZodOptional<z.ZodString>;
58
+ label: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<readonly [string, null] | readonly [string, string[]], string>>>>>;
59
+ from: z.ZodOptional<z.ZodString>;
60
+ text: z.ZodOptional<z.ZodString>;
61
+ after: z.ZodOptional<z.ZodString>;
62
+ wait: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
63
+ all: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
64
+ }, z.core.$strip>;
65
+ declare const PostBody: z.ZodObject<{
66
+ channel: z.ZodOptional<z.ZodString>;
67
+ re: z.ZodOptional<z.ZodString>;
68
+ text: z.ZodDefault<z.ZodString>;
69
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
70
+ noSync: z.ZodOptional<z.ZodBoolean>;
71
+ sync: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
72
+ target: z.ZodString;
73
+ kind: z.ZodEnum<{
74
+ channel: "channel";
75
+ thread: "thread";
76
+ }>;
77
+ }, z.core.$strip>]>>>;
78
+ id: z.ZodOptional<z.ZodString>;
79
+ attachments: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
+ }, z.core.$strip>;
81
+ /**
82
+ * A message to post later, as the caller: once (`in` or `at`), or repeating
83
+ * (`every`, starting `at` or `in` from now, or one `every` from now), until
84
+ * `until`, `for` after the first send, or `times` sends. A repeat with no stop
85
+ * runs until it's canceled.
86
+ */
87
+ declare const ScheduleBody: z.ZodObject<{
88
+ channel: z.ZodOptional<z.ZodString>;
89
+ re: z.ZodOptional<z.ZodString>;
90
+ text: z.ZodDefault<z.ZodString>;
91
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
92
+ noSync: z.ZodOptional<z.ZodBoolean>;
93
+ attachments: z.ZodOptional<z.ZodArray<z.ZodString>>;
94
+ in: z.ZodOptional<z.ZodString>;
95
+ at: z.ZodOptional<z.ZodString>;
96
+ every: z.ZodOptional<z.ZodString>;
97
+ until: z.ZodOptional<z.ZodString>;
98
+ for: z.ZodOptional<z.ZodString>;
99
+ times: z.ZodOptional<z.ZodNumber>;
100
+ }, z.core.$strip>;
101
+ declare const SchedulesQuery: z.ZodObject<{
102
+ re: z.ZodOptional<z.ZodString>;
103
+ channel: z.ZodOptional<z.ZodString>;
104
+ by: z.ZodOptional<z.ZodString>;
105
+ all: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
106
+ }, z.core.$strip>;
107
+ declare const SyncBody: z.ZodObject<{
108
+ target: z.ZodString;
109
+ }, z.core.$strip>;
110
+ declare const InboxQuery: z.ZodObject<{
111
+ channel: z.ZodOptional<z.ZodString>;
112
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
113
+ }, z.core.$strip>;
114
+ /** How many watchers one registration holds: the board matches every event against every tail. */
115
+ declare const REGISTERED_WATCHERS_MAX = 32;
116
+ /** What a board on `http()` registers with the board it uses: its watchers' tails, and where to wake it. */
117
+ declare const RegisterBody: z.ZodObject<{
118
+ url: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
119
+ watch: z.ZodRecord<z.ZodString, z.ZodObject<{
120
+ tail: z.ZodString;
121
+ when: z.ZodDefault<z.ZodEnum<{
122
+ enters: "enters";
123
+ matches: "matches";
124
+ }>>;
125
+ }, z.core.$strip>>;
126
+ sync: z.ZodOptional<z.ZodArray<z.ZodObject<{
127
+ key: z.ZodString;
128
+ platform: z.ZodString;
129
+ signIn: z.ZodDefault<z.ZodBoolean>;
130
+ }, z.core.$strip>>>;
131
+ }, z.core.$strip>;
132
+ /** A pull of the caller's matches: at most `limit`, waiting up to `wait` seconds for one. */
133
+ declare const MatchesQuery: z.ZodObject<{
134
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
135
+ wait: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
136
+ }, z.core.$strip>;
137
+ /** How a pulled match went: its lease, and an error to try again, or `skip` to drop it. */
138
+ declare const AckBody: z.ZodObject<{
139
+ lease: z.ZodString;
140
+ error: z.ZodOptional<z.ZodString>;
141
+ skip: z.ZodOptional<z.ZodBoolean>;
142
+ }, z.core.$strip>;
143
+ /**
144
+ * What to read from a platform without syncing it: a channel (`#name` or an ID),
145
+ * a thread (`C0123:1727000000.123456`), or a message permalink (its thread).
146
+ */
147
+ declare const SourceReadQuery: z.ZodObject<{
148
+ target: z.ZodString;
149
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
150
+ }, z.core.$strip>;
151
+ declare const IdentityUnlinkBody: z.ZodObject<{
152
+ actor: z.ZodString;
153
+ }, z.core.$strip>;
154
+ /**
155
+ * A platform's write, as its platform author, with where it came from: only a caller with `sync` in
156
+ * the channel it lands in may make one. Posts are idempotent by `id`, derived from the platform
157
+ * event; every other op finds the message it changes from its `origin`.
158
+ */
159
+ declare const SyncImportBody: z.ZodDiscriminatedUnion<[z.ZodObject<{
160
+ author: z.ZodObject<{
161
+ id: z.ZodString;
162
+ handle: z.ZodString;
163
+ name: z.ZodString;
164
+ isBot: z.ZodBoolean;
165
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
166
+ }, z.core.$strip>;
167
+ from: z.ZodNullable<z.ZodString>;
168
+ op: z.ZodLiteral<"post">;
169
+ origin: z.ZodDefault<z.ZodNullable<z.ZodObject<{
170
+ channel: z.ZodOptional<z.ZodString>;
171
+ thread: z.ZodString;
172
+ subthread: z.ZodNullable<z.ZodString>;
173
+ message: z.ZodString;
174
+ context: z.ZodNullable<z.ZodString>;
175
+ }, z.core.$strip>>>;
176
+ source: z.ZodOptional<z.ZodObject<{
177
+ key: z.ZodString;
178
+ channel: z.ZodString;
179
+ thread: z.ZodString;
180
+ }, z.core.$strip>>;
181
+ channel: z.ZodOptional<z.ZodString>;
182
+ re: z.ZodOptional<z.ZodString>;
183
+ text: z.ZodDefault<z.ZodString>;
184
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
185
+ noSync: z.ZodOptional<z.ZodBoolean>;
186
+ attachments: z.ZodOptional<z.ZodArray<z.ZodString>>;
187
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
188
+ url: z.ZodString;
189
+ snapshot: z.ZodNullable<z.ZodObject<{
190
+ author: z.ZodString;
191
+ text: z.ZodString;
192
+ createdAt: z.ZodNullable<z.ZodString>;
193
+ files: z.ZodArray<z.ZodObject<{
194
+ name: z.ZodString;
195
+ url: z.ZodNullable<z.ZodString>;
196
+ }, z.core.$strip>>;
197
+ }, z.core.$strip>>;
198
+ unavailable: z.ZodNullable<z.ZodString>;
199
+ message: z.ZodNullable<z.ZodString>;
200
+ }, z.core.$strip>>>;
201
+ id: z.ZodOptional<z.ZodString>;
202
+ }, z.core.$strip>, z.ZodObject<{
203
+ author: z.ZodObject<{
204
+ id: z.ZodString;
205
+ handle: z.ZodString;
206
+ name: z.ZodString;
207
+ isBot: z.ZodBoolean;
208
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
209
+ }, z.core.$strip>;
210
+ from: z.ZodNullable<z.ZodString>;
211
+ origin: z.ZodOptional<z.ZodObject<{
212
+ thread: z.ZodString;
213
+ message: z.ZodOptional<z.ZodString>;
214
+ }, z.core.$strip>>;
215
+ message: z.ZodOptional<z.ZodString>;
216
+ op: z.ZodLiteral<"edit">;
217
+ text: z.ZodString;
218
+ source: z.ZodOptional<z.ZodObject<{
219
+ key: z.ZodString;
220
+ channel: z.ZodString;
221
+ thread: z.ZodString;
222
+ }, z.core.$strip>>;
223
+ }, z.core.$strip>, z.ZodObject<{
224
+ author: z.ZodObject<{
225
+ id: z.ZodString;
226
+ handle: z.ZodString;
227
+ name: z.ZodString;
228
+ isBot: z.ZodBoolean;
229
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
230
+ }, z.core.$strip>;
231
+ from: z.ZodNullable<z.ZodString>;
232
+ origin: z.ZodOptional<z.ZodObject<{
233
+ thread: z.ZodString;
234
+ message: z.ZodOptional<z.ZodString>;
235
+ }, z.core.$strip>>;
236
+ message: z.ZodOptional<z.ZodString>;
237
+ op: z.ZodLiteral<"delete">;
238
+ }, z.core.$strip>, z.ZodObject<{
239
+ author: z.ZodObject<{
240
+ id: z.ZodString;
241
+ handle: z.ZodString;
242
+ name: z.ZodString;
243
+ isBot: z.ZodBoolean;
244
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
245
+ }, z.core.$strip>;
246
+ from: z.ZodNullable<z.ZodString>;
247
+ origin: z.ZodOptional<z.ZodObject<{
248
+ thread: z.ZodString;
249
+ message: z.ZodOptional<z.ZodString>;
250
+ }, z.core.$strip>>;
251
+ message: z.ZodOptional<z.ZodString>;
252
+ op: z.ZodLiteral<"react">;
253
+ emoji: z.ZodString;
254
+ remove: z.ZodOptional<z.ZodBoolean>;
255
+ }, z.core.$strip>, z.ZodObject<{
256
+ author: z.ZodObject<{
257
+ id: z.ZodString;
258
+ handle: z.ZodString;
259
+ name: z.ZodString;
260
+ isBot: z.ZodBoolean;
261
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
262
+ }, z.core.$strip>;
263
+ from: z.ZodNullable<z.ZodString>;
264
+ origin: z.ZodOptional<z.ZodObject<{
265
+ thread: z.ZodString;
266
+ message: z.ZodOptional<z.ZodString>;
267
+ }, z.core.$strip>>;
268
+ message: z.ZodOptional<z.ZodString>;
269
+ op: z.ZodLiteral<"labels">;
270
+ set: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
271
+ unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
272
+ }, z.core.$strip>, z.ZodObject<{
273
+ author: z.ZodObject<{
274
+ id: z.ZodString;
275
+ handle: z.ZodString;
276
+ name: z.ZodString;
277
+ isBot: z.ZodBoolean;
278
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
279
+ }, z.core.$strip>;
280
+ from: z.ZodNullable<z.ZodString>;
281
+ origin: z.ZodOptional<z.ZodObject<{
282
+ thread: z.ZodString;
283
+ message: z.ZodOptional<z.ZodString>;
284
+ }, z.core.$strip>>;
285
+ message: z.ZodOptional<z.ZodString>;
286
+ op: z.ZodLiteral<"links">;
287
+ links: z.ZodArray<z.ZodObject<{
288
+ url: z.ZodString;
289
+ snapshot: z.ZodNullable<z.ZodObject<{
290
+ author: z.ZodString;
291
+ text: z.ZodString;
292
+ createdAt: z.ZodNullable<z.ZodString>;
293
+ files: z.ZodArray<z.ZodObject<{
294
+ name: z.ZodString;
295
+ url: z.ZodNullable<z.ZodString>;
296
+ }, z.core.$strip>>;
297
+ }, z.core.$strip>>;
298
+ unavailable: z.ZodNullable<z.ZodString>;
299
+ message: z.ZodNullable<z.ZodString>;
300
+ }, z.core.$strip>>;
301
+ }, z.core.$strip>, z.ZodObject<{
302
+ op: z.ZodLiteral<"seen">;
303
+ author: z.ZodObject<{
304
+ id: z.ZodString;
305
+ handle: z.ZodString;
306
+ name: z.ZodString;
307
+ isBot: z.ZodBoolean;
308
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
309
+ }, z.core.$strip>;
310
+ }, z.core.$strip>], "op">;
311
+ /** What sync did on a platform, about a board message: it landed, its files did, it gave up, or its thread syncs with a target. */
312
+ declare const SyncReceiptBody: z.ZodDiscriminatedUnion<[z.ZodObject<{
313
+ kind: z.ZodLiteral<"message">;
314
+ message: z.ZodString;
315
+ target: z.ZodString;
316
+ external: z.ZodObject<{
317
+ thread: z.ZodString;
318
+ message: z.ZodString;
319
+ asUser: z.ZodOptional<z.ZodLiteral<true>>;
320
+ }, z.core.$strip>;
321
+ files: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
322
+ }, z.core.$strip>, z.ZodObject<{
323
+ kind: z.ZodLiteral<"files">;
324
+ message: z.ZodString;
325
+ target: z.ZodString;
326
+ files: z.ZodNullable<z.ZodArray<z.ZodString>>;
327
+ }, z.core.$strip>, z.ZodObject<{
328
+ kind: z.ZodLiteral<"failed">;
329
+ message: z.ZodString;
330
+ target: z.ZodString;
331
+ error: z.ZodString;
332
+ }, z.core.$strip>, z.ZodObject<{
333
+ kind: z.ZodLiteral<"thread">;
334
+ message: z.ZodString;
335
+ target: z.ZodString;
336
+ targetKind: z.ZodEnum<{
337
+ channel: "channel";
338
+ thread: "thread";
339
+ }>;
340
+ cause: z.ZodEnum<{
341
+ config: "config";
342
+ request: "request";
343
+ }>;
344
+ }, z.core.$strip>], "kind">;
345
+ /** What sync looks up by platform ID: a thread or message, who an account is, and a person's accounts. */
346
+ declare const SyncFindQuery: z.ZodObject<{
347
+ code: z.ZodOptional<z.ZodString>;
348
+ post: z.ZodOptional<z.ZodString>;
349
+ thread: z.ZodOptional<z.ZodString>;
350
+ message: z.ZodOptional<z.ZodString>;
351
+ account: z.ZodOptional<z.ZodString>;
352
+ person: z.ZodOptional<z.ZodString>;
353
+ }, z.core.$strip>;
354
+ declare const SyncCopiesQuery: z.ZodObject<{
355
+ message: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodString>>;
356
+ }, z.core.$strip>;
357
+ /** A person's own roots since `since`, in epoch milliseconds. */
358
+ declare const SyncRootsQuery: z.ZodObject<{
359
+ by: z.ZodString;
360
+ since: z.ZodCoercedNumber<unknown>;
361
+ }, z.core.$strip>;
362
+ /** Platform events for a sync key's inbox, each with the platform's own ID for it, which dedupes it. */
363
+ declare const InboxPushBody: z.ZodObject<{
364
+ events: z.ZodArray<z.ZodObject<{
365
+ id: z.ZodString;
366
+ event: z.ZodDiscriminatedUnion<[z.ZodObject<{
367
+ channel: z.ZodString;
368
+ thread: z.ZodString;
369
+ subthread: z.ZodNullable<z.ZodString>;
370
+ kind: z.ZodLiteral<"message">;
371
+ message: z.ZodString;
372
+ isRoot: z.ZodBoolean;
373
+ text: z.ZodString;
374
+ context: z.ZodNullable<z.ZodString>;
375
+ author: z.ZodObject<{
376
+ id: z.ZodString;
377
+ handle: z.ZodString;
378
+ name: z.ZodString;
379
+ avatar: z.ZodNullable<z.ZodString>;
380
+ isBot: z.ZodBoolean;
381
+ }, z.core.$strip>;
382
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
383
+ type: z.ZodEnum<{
384
+ audio: "audio";
385
+ file: "file";
386
+ image: "image";
387
+ video: "video";
388
+ }>;
389
+ name: z.ZodOptional<z.ZodString>;
390
+ mimeType: z.ZodOptional<z.ZodString>;
391
+ size: z.ZodOptional<z.ZodNumber>;
392
+ url: z.ZodOptional<z.ZodString>;
393
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
394
+ }, z.core.$strip>>>;
395
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
396
+ url: z.ZodString;
397
+ thread: z.ZodString;
398
+ message: z.ZodString;
399
+ snapshot: z.ZodNullable<z.ZodObject<{
400
+ author: z.ZodString;
401
+ text: z.ZodString;
402
+ createdAt: z.ZodNullable<z.ZodString>;
403
+ files: z.ZodArray<z.ZodObject<{
404
+ name: z.ZodString;
405
+ url: z.ZodNullable<z.ZodString>;
406
+ }, z.core.$strip>>;
407
+ }, z.core.$strip>>;
408
+ }, z.core.$strip>>>;
409
+ }, z.core.$strip>, z.ZodObject<{
410
+ channel: z.ZodString;
411
+ thread: z.ZodString;
412
+ subthread: z.ZodNullable<z.ZodString>;
413
+ kind: z.ZodLiteral<"edited">;
414
+ message: z.ZodString;
415
+ text: z.ZodString;
416
+ author: z.ZodObject<{
417
+ id: z.ZodString;
418
+ handle: z.ZodString;
419
+ name: z.ZodString;
420
+ avatar: z.ZodNullable<z.ZodString>;
421
+ isBot: z.ZodBoolean;
422
+ }, z.core.$strip>;
423
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
424
+ url: z.ZodString;
425
+ thread: z.ZodString;
426
+ message: z.ZodString;
427
+ snapshot: z.ZodNullable<z.ZodObject<{
428
+ author: z.ZodString;
429
+ text: z.ZodString;
430
+ createdAt: z.ZodNullable<z.ZodString>;
431
+ files: z.ZodArray<z.ZodObject<{
432
+ name: z.ZodString;
433
+ url: z.ZodNullable<z.ZodString>;
434
+ }, z.core.$strip>>;
435
+ }, z.core.$strip>>;
436
+ }, z.core.$strip>>>;
437
+ linksOnly: z.ZodOptional<z.ZodBoolean>;
438
+ }, z.core.$strip>, z.ZodObject<{
439
+ channel: z.ZodString;
440
+ thread: z.ZodString;
441
+ subthread: z.ZodNullable<z.ZodString>;
442
+ kind: z.ZodLiteral<"deleted">;
443
+ message: z.ZodString;
444
+ }, z.core.$strip>, z.ZodObject<{
445
+ channel: z.ZodString;
446
+ thread: z.ZodString;
447
+ subthread: z.ZodNullable<z.ZodString>;
448
+ kind: z.ZodLiteral<"reaction">;
449
+ message: z.ZodString;
450
+ emoji: z.ZodString;
451
+ added: z.ZodBoolean;
452
+ author: z.ZodObject<{
453
+ id: z.ZodString;
454
+ handle: z.ZodString;
455
+ name: z.ZodString;
456
+ avatar: z.ZodNullable<z.ZodString>;
457
+ isBot: z.ZodBoolean;
458
+ }, z.core.$strip>;
459
+ }, z.core.$strip>, z.ZodObject<{
460
+ channel: z.ZodString;
461
+ thread: z.ZodString;
462
+ kind: z.ZodLiteral<"lifecycle">;
463
+ type: z.ZodString;
464
+ title: z.ZodString;
465
+ url: z.ZodNullable<z.ZodString>;
466
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
467
+ unset: z.ZodArray<z.ZodString>;
468
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
469
+ reply: z.ZodNullable<z.ZodString>;
470
+ createRoot: z.ZodBoolean;
471
+ author: z.ZodObject<{
472
+ id: z.ZodString;
473
+ handle: z.ZodString;
474
+ name: z.ZodString;
475
+ avatar: z.ZodNullable<z.ZodString>;
476
+ isBot: z.ZodBoolean;
477
+ }, z.core.$strip>;
478
+ }, z.core.$strip>], "kind">;
479
+ raw: z.ZodUnknown;
480
+ }, z.core.$strip>>;
481
+ }, z.core.$strip>;
482
+ declare const InboxNextQuery: z.ZodObject<{
483
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
484
+ }, z.core.$strip>;
485
+ declare const InboxAckBody: z.ZodObject<{
486
+ lease: z.ZodString;
487
+ error: z.ZodOptional<z.ZodString>;
488
+ }, z.core.$strip>;
489
+ /** A one-time code for linking an account on sync entry `sync`: a person's own, for themselves. */
490
+ declare const SyncCodeBody: z.ZodObject<{
491
+ sync: z.ZodString;
492
+ }, z.core.$strip>;
493
+ /**
494
+ * A platform account, linked to whoever a code was issued to: one posted from the account, or
495
+ * carried through its sign-in. `message` is the platform message that posted it.
496
+ */
497
+ declare const SyncAccountBody: z.ZodObject<{
498
+ sync: z.ZodString;
499
+ account: z.ZodObject<{
500
+ id: z.ZodString;
501
+ handle: z.ZodString;
502
+ name: z.ZodString;
503
+ isBot: z.ZodBoolean;
504
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
505
+ }, z.core.$strip>;
506
+ code: z.ZodString;
507
+ message: z.ZodOptional<z.ZodString>;
508
+ method: z.ZodOptional<z.ZodEnum<{
509
+ code: "code";
510
+ consent: "consent";
511
+ }>>;
512
+ }, z.core.$strip>;
513
+ /** A sign-in that carries a code, on the board whose sync runs the entry. */
514
+ declare const SignInQuery: z.ZodObject<{
515
+ sync: z.ZodString;
516
+ code: z.ZodString;
517
+ }, z.core.$strip>;
518
+ declare const SyncUnlinkBody: z.ZodObject<{
519
+ account: z.ZodString;
520
+ }, z.core.$strip>;
521
+ /** A direct upload, before its bytes: what the file will be called, its type, and its exact size. */
522
+ declare const UploadStartBody: z.ZodObject<{
523
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
524
+ type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
525
+ size: z.ZodNumber;
526
+ }, z.core.$strip>;
527
+ /** Where to send a direct upload's bytes: `PUT` the file to `url` with `headers` (its `content-type` included), before `expiresAt`, then finish it. */
528
+ type UploadTicket = {
529
+ id: string;
530
+ url: string;
531
+ headers: Record<string, string>;
532
+ expiresAt: string;
533
+ };
534
+ declare const EditBody: z.ZodObject<{
535
+ text: z.ZodString;
536
+ }, z.core.$strip>;
537
+ declare const DeleteBody: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
538
+ /** `status`: what Slack shows in place of "Typing…" (WhatsApp and GitHub ignore it). */
539
+ declare const TypingBody: z.ZodOptional<z.ZodObject<{
540
+ status: z.ZodOptional<z.ZodString>;
541
+ }, z.core.$strip>>;
542
+ declare const ReactBody: z.ZodObject<{
543
+ emoji: z.ZodString;
544
+ remove: z.ZodOptional<z.ZodBoolean>;
545
+ }, z.core.$strip>;
546
+ declare const LabelBody: z.ZodObject<{
547
+ set: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
548
+ unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
549
+ }, z.core.$strip>;
550
+ type FiltersInput = z.input<typeof Filters$1>;
551
+ type SyncImportInput = z.input<typeof SyncImportBody>;
552
+ type SyncReceiptInput = z.input<typeof SyncReceiptBody>;
553
+ type SyncFindInput = z.input<typeof SyncFindQuery>;
554
+ type SyncAccountInput = z.input<typeof SyncAccountBody>;
555
+ type MessagesQueryInput = z.input<typeof MessagesQuery>;
556
+ type ThreadsQueryInput = z.input<typeof ThreadsQuery>;
557
+ type EventsQueryInput = z.input<typeof EventsQuery>;
558
+ type PostInput = z.input<typeof PostBody>;
559
+ type ScheduleInput = z.input<typeof ScheduleBody>;
560
+ type ScheduleBodyOutput = z.output<typeof ScheduleBody>;
561
+ type SchedulesQueryInput = z.input<typeof SchedulesQuery>;
562
+ type SchedulesQueryOutput = z.output<typeof SchedulesQuery>;
563
+ /** A scheduled message. It posts as `by`, its creator; each message it posts carries `schedule: { id, n }`. */
564
+ type ScheduleView = {
565
+ id: string;
566
+ channel: string;
567
+ /** The thread it replies in, or null when each send starts a new thread in `channel`. */
568
+ re: string | null;
569
+ text: string;
570
+ labels: Record<string, string>;
571
+ noSync: boolean;
572
+ attachments: {
573
+ id: string;
574
+ name: string;
575
+ type: string;
576
+ size: number;
577
+ }[];
578
+ first: string;
579
+ /** Milliseconds between sends, or null for once. */
580
+ every: number | null;
581
+ until: string | null;
582
+ times: number | null;
583
+ /** Sends posted so far. */
584
+ sent: number;
585
+ /** When the next send is due; null once it's done or canceled. */
586
+ next: string | null;
587
+ /** The last message it posted. */
588
+ last: string | null;
589
+ state: 'pending' | 'done' | 'canceled';
590
+ canceled: {
591
+ by: {
592
+ actor: string;
593
+ principal: string;
594
+ profile: string | null;
595
+ session: string | null;
596
+ };
597
+ reason: 'canceled' | 'thread_deleted' | 'dropped' | 'revoked';
598
+ } | null;
599
+ by: {
600
+ actor: string;
601
+ principal: string;
602
+ profile: string | null;
603
+ session: string | null;
604
+ };
605
+ author: ActorView;
606
+ createdAt: string;
607
+ };
608
+ /** The person a platform account is linked to (`actor.linked`). */
609
+ type PersonView = {
610
+ id: string;
611
+ handle: string;
612
+ name: string;
613
+ avatar: string | null;
614
+ };
615
+ /**
616
+ * `kind` says who wrote it: a `person` or a platform user (`external`), an agent (`profile`), or a deployment or workflow.
617
+ * `person` is who a linked platform account belongs to.
618
+ */
619
+ type ActorView = Pick<Actor, 'kind' | 'handle' | 'name' | 'avatar'> & {
620
+ person?: PersonView;
621
+ };
622
+ /** A message as clients see it: its IDs are refs, and `version` says which of two views of it is newer. */
623
+ type MessageView = Omit<Message, 'id' | 're' | 'replyTo' | 'links' | 'schedule' | 'version'> & {
624
+ id: string;
625
+ /** The thread's root, or null for a root. */
626
+ re: string | null;
627
+ /** The exact message replied to, when it isn't the root. */
628
+ replyTo: string | null;
629
+ /** Grows with each change to this message: of two views of it, the one with the higher version is newer. */
630
+ version: number;
631
+ links: LinkView[];
632
+ /** Set when a schedule posted it: the schedule's ID and which send this was, from 0. */
633
+ schedule?: {
634
+ id: string;
635
+ n: number;
636
+ };
637
+ author: ActorView | null;
638
+ };
639
+ /** A link in a message: a board message it names is a ref. */
640
+ type LinkView = Omit<Link, 'message'> & {
641
+ message: string | null;
642
+ };
643
+ /** An event's payload as clients see it: message IDs are refs. */
644
+ type PayloadView<P> = { [K in keyof P]: K extends 'id' | 're' | 'replyTo' ? P[K] extends number ? string : P[K] extends number | null ? string | null : P[K] : K extends 'links' ? LinkView[] : K extends 'schedule' ? P[K] extends undefined ? undefined : {
645
+ id: string;
646
+ n: number;
647
+ } | Exclude<P[K], object> : P[K]; };
648
+ /** A board event as subscribers get it. Checking `type` narrows `payload` to that event's. */
649
+ type BoardEventView = BoardEvent extends (infer E) ? E extends {
650
+ type: infer T;
651
+ payload: infer P;
652
+ } ? {
653
+ /** Where this event is in the board's order: pass it as `after` to read on from here. */
654
+ cursor: string;
655
+ type: T;
656
+ createdAt: string;
657
+ payload: PayloadView<P>;
658
+ /** The message the event concerns, as it is after the event. */
659
+ message?: MessageView;
660
+ /** Who did it, for events with an author: a reaction's reactor, a label's setter. */
661
+ actor?: ActorView & {
662
+ id: string;
663
+ };
664
+ } : never : never;
665
+ type Discovery = {
666
+ version: string;
667
+ url: string;
668
+ audience: string;
669
+ team_id: string | null;
670
+ project_id: string | null;
671
+ /** The board's sync entries: `key` names its webhook and inbox, `platform` is e.g. `slack`. */
672
+ sync: {
673
+ key: string;
674
+ platform: string;
675
+ }[];
676
+ };
677
+ /** Watchers a board on `http()` registered here: one registration per principal. */
678
+ type RegistrationView = {
679
+ /** The principal that registered. Its watchers write as it, with their IDs as profiles. */
680
+ owner: string;
681
+ /** Where it's woken: `<url>/wake`. `null` when it pulls on its own. */
682
+ url: string | null;
683
+ watch: Record<string, {
684
+ tail: string;
685
+ when: 'matches' | 'enters';
686
+ }>;
687
+ /** Its sync entries. With any, its sync gets every event it delivers to platforms, as matches of watcher `@sync`. */
688
+ sync: {
689
+ key: string;
690
+ platform: string;
691
+ signIn: boolean;
692
+ }[];
693
+ /** Every wake-up carries it, so the board can tell its registration is stale. */
694
+ hash: string;
695
+ };
696
+ /** One match, leased to the registrant that pulled it. */
697
+ type MatchView = {
698
+ /** The match's ID, which its watcher's writes derive their IDs from. */
699
+ id: string;
700
+ watcher: string;
701
+ thread: string;
702
+ /** Acks name it. A lease that ran out is someone else's next try. */
703
+ lease: string;
704
+ /** How many tries came before this one. */
705
+ attempt: number;
706
+ /** The event, as `vb tail --json` prints it, as the registrant may see it. */
707
+ event: BoardEventView;
708
+ };
709
+ type Me = {
710
+ actor: string;
711
+ principal: string;
712
+ kind: Actor['kind'];
713
+ handle: string;
714
+ name: string;
715
+ avatar: string | null;
716
+ profile: string | null;
717
+ session: string | null;
718
+ expiresAt: string | null;
719
+ /** What you may do in each channel pattern, implications included: `{ '*': [...every permission] }` is full access. */
720
+ can: AccessSummary;
721
+ };
722
+ /** A platform account linked to you, as `GET /identity` lists it. */
723
+ type LinkedAccount = {
724
+ actor: string;
725
+ handle: string | null;
726
+ name: string | null;
727
+ method: 'code' | 'consent';
728
+ at: string;
729
+ };
730
+ type IdentityView = {
731
+ principal: string;
732
+ links: LinkedAccount[];
733
+ /** The sync entries you haven't linked an account on. Boards older than it leave it out. */
734
+ unlinked?: string[];
735
+ cursor: string;
736
+ };
737
+ /**
738
+ * How to prove an account is yours: post `code` from it anywhere the board syncs before
739
+ * `expiresAt`, or, when the entry signs people in, open `signIn` and approve: it carries the code.
740
+ */
741
+ type SyncCodeView = {
742
+ code: string;
743
+ expiresAt: string;
744
+ signIn?: string;
745
+ };
746
+ /** A thread's sync: its root, where it lives, its targets, and the platform thread it is on each. */
747
+ type SyncThreadView = {
748
+ thread: string;
749
+ root: string;
750
+ channel: string;
751
+ targets: string[];
752
+ external: Record<string, string>;
753
+ };
754
+ /** What a platform ID is on the board. Each answers only when it was asked. */
755
+ type SyncFindView = {
756
+ /** The board thread a platform thread belongs to. */
757
+ thread: string | null;
758
+ /** The board message a platform message is a copy of, or came in as. */
759
+ message: string | null;
760
+ /** Who a platform account is linked to, and how. */
761
+ person: {
762
+ id: string;
763
+ method: 'code' | 'consent';
764
+ } | null;
765
+ /** The platform accounts linked to a person, and how. */
766
+ accounts: {
767
+ id: string;
768
+ method: 'code' | 'consent';
769
+ }[];
770
+ /** Who a live code was issued to. */
771
+ holder: string | null;
772
+ };
773
+ /** A message's copies, by target: where it went, or came from, on each platform. */
774
+ type SyncCopiesView = {
775
+ copies: Record<string, Record<string, ExternalCopy>>;
776
+ };
777
+ /** A platform event pulled from the caller's inbox, leased to it until it acks. */
778
+ type InboxItem = {
779
+ id: string;
780
+ key: string;
781
+ /** The platform thread: its events come one at a time, in order. */
782
+ thread: string;
783
+ lease: string;
784
+ /** How many tries came before this one. */
785
+ attempt: number;
786
+ event: z.infer<typeof ExternalEvent>;
787
+ raw: unknown;
788
+ };
789
+ type ChannelView = Channel;
790
+ type MessagesPage = {
791
+ messages: MessageView[];
792
+ cursor: string;
793
+ };
794
+ type ThreadView = {
795
+ message: MessageView;
796
+ replies: MessageView[];
797
+ cursor: string;
798
+ /** The pending schedules that reply in this thread. Boards older than schedules leave it out. */
799
+ schedules?: ScheduleView[];
800
+ };
801
+ /** A thread at a glance: its root, how many replies it has, and the latest one (null when none). Deleted replies don't count. */
802
+ type ThreadSummaryView = {
803
+ message: MessageView;
804
+ replies: number;
805
+ last: MessageView | null;
806
+ };
807
+ type ThreadsPage = {
808
+ threads: ThreadSummaryView[];
809
+ cursor: string;
810
+ };
811
+ type EventsPage = {
812
+ events: BoardEventView[];
813
+ cursor: string;
814
+ };
815
+ /** The platform threads that now show typing: those the thread is synced to, minus any that failed. */
816
+ type TypingResult = {
817
+ targets: string[];
818
+ };
819
+ /** A platform message read on demand: nothing about it is stored on the board. */
820
+ type SourceMessage = {
821
+ /** The platform's message ID (Slack's `ts`). */
822
+ id: string;
823
+ /** The thread it's in, as a target `vb sources <key> read` reads: `C0123:1727000000.123456`. */
824
+ thread: string;
825
+ author: string;
826
+ text: string;
827
+ createdAt: string | null;
828
+ /** Replies under it, when it starts a thread. */
829
+ replies: number;
830
+ files: {
831
+ name: string;
832
+ url: string | null;
833
+ }[];
834
+ };
835
+ /** A channel or thread read from a platform, oldest message first. */
836
+ type SourceRead = {
837
+ /** The channel's ID, and its name when the platform gave one. */
838
+ channel: string;
839
+ name: string | null;
840
+ /** Set when a thread was read. */
841
+ thread: string | null;
842
+ messages: SourceMessage[];
843
+ /** The platform has more than `limit`: older messages in a channel, later replies in a thread. */
844
+ more: boolean;
845
+ };
846
+ type ApiError = {
847
+ error: {
848
+ code: string;
849
+ message: string;
850
+ };
851
+ };
852
+ /** A raw platform event, as `GET /inbox/:key` returns it. */
853
+ type InboxEntry = {
854
+ id: string;
855
+ channel: string;
856
+ createdAt: string;
857
+ sync: string;
858
+ event: {
859
+ kind: string;
860
+ thread: string;
861
+ [field: string]: unknown;
862
+ };
863
+ raw: unknown;
864
+ };
865
+ /** The route table: method, path, and the schemas that validate input. */
866
+ declare const routes: {
867
+ /** Where the board is, its project, and the sync entries it links accounts on. No token. */
868
+ readonly discovery: {
869
+ readonly method: 'GET';
870
+ readonly path: '/';
871
+ };
872
+ readonly me: {
873
+ readonly method: 'GET';
874
+ readonly path: '/me';
875
+ };
876
+ readonly channels: {
877
+ readonly method: 'GET';
878
+ readonly path: '/channels';
879
+ };
880
+ readonly actors: {
881
+ readonly method: 'GET';
882
+ readonly path: '/actors';
883
+ };
884
+ readonly messages: {
885
+ readonly method: 'GET';
886
+ readonly path: '/messages';
887
+ readonly query: z.ZodObject<{
888
+ channel: z.ZodOptional<z.ZodString>;
889
+ re: z.ZodOptional<z.ZodString>;
890
+ by: z.ZodOptional<z.ZodString>;
891
+ mentions: z.ZodOptional<z.ZodString>;
892
+ label: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<readonly [string, null] | readonly [string, string[]], string>>>>>;
893
+ from: z.ZodOptional<z.ZodString>;
894
+ text: z.ZodOptional<z.ZodString>;
895
+ after: z.ZodOptional<z.ZodString>;
896
+ before: z.ZodOptional<z.ZodString>;
897
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
898
+ }, z.core.$strip>;
899
+ };
900
+ readonly message: {
901
+ readonly method: 'GET';
902
+ readonly path: '/messages/:id';
903
+ };
904
+ /** Threads with a matching message, one summary each, by latest activity. */
905
+ readonly threads: {
906
+ readonly method: 'GET';
907
+ readonly path: '/threads';
908
+ readonly query: z.ZodObject<{
909
+ channel: z.ZodOptional<z.ZodString>;
910
+ re: z.ZodOptional<z.ZodString>;
911
+ by: z.ZodOptional<z.ZodString>;
912
+ mentions: z.ZodOptional<z.ZodString>;
913
+ label: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<readonly [string, null] | readonly [string, string[]], string>>>>>;
914
+ from: z.ZodOptional<z.ZodString>;
915
+ text: z.ZodOptional<z.ZodString>;
916
+ after: z.ZodOptional<z.ZodString>;
917
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
918
+ }, z.core.$strip>;
919
+ };
920
+ readonly post: {
921
+ readonly method: 'POST';
922
+ readonly path: '/messages';
923
+ readonly body: z.ZodObject<{
924
+ channel: z.ZodOptional<z.ZodString>;
925
+ re: z.ZodOptional<z.ZodString>;
926
+ text: z.ZodDefault<z.ZodString>;
927
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
928
+ noSync: z.ZodOptional<z.ZodBoolean>;
929
+ sync: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
930
+ target: z.ZodString;
931
+ kind: z.ZodEnum<{
932
+ channel: "channel";
933
+ thread: "thread";
934
+ }>;
935
+ }, z.core.$strip>]>>>;
936
+ id: z.ZodOptional<z.ZodString>;
937
+ attachments: z.ZodOptional<z.ZodArray<z.ZodString>>;
938
+ }, z.core.$strip>;
939
+ };
940
+ readonly edit: {
941
+ readonly method: 'POST';
942
+ readonly path: '/messages/:id/edit';
943
+ readonly body: z.ZodObject<{
944
+ text: z.ZodString;
945
+ }, z.core.$strip>;
946
+ };
947
+ readonly delete: {
948
+ readonly method: 'POST';
949
+ readonly path: '/messages/:id/delete';
950
+ readonly body: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
951
+ };
952
+ readonly react: {
953
+ readonly method: 'POST';
954
+ readonly path: '/messages/:id/reactions';
955
+ readonly body: z.ZodObject<{
956
+ emoji: z.ZodString;
957
+ remove: z.ZodOptional<z.ZodBoolean>;
958
+ }, z.core.$strip>;
959
+ };
960
+ readonly label: {
961
+ readonly method: 'POST';
962
+ readonly path: '/messages/:id/labels';
963
+ readonly body: z.ZodObject<{
964
+ set: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
965
+ unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
966
+ }, z.core.$strip>;
967
+ };
968
+ /** Attaches the thread to a sync target, recording a `thread` receipt: needs `sync` where the thread is. */
969
+ readonly sync: {
970
+ readonly method: 'POST';
971
+ readonly path: '/messages/:id/sync';
972
+ readonly body: z.ZodObject<{
973
+ target: z.ZodString;
974
+ }, z.core.$strip>;
975
+ };
976
+ /** Ephemeral: shows typing in the thread's synced platform threads, and writes nothing to the log. Needs `post` where the thread is. */
977
+ readonly typing: {
978
+ readonly method: 'POST';
979
+ readonly path: '/messages/:id/typing';
980
+ readonly body: z.ZodOptional<z.ZodObject<{
981
+ status: z.ZodOptional<z.ZodString>;
982
+ }, z.core.$strip>>;
983
+ };
984
+ /** Posts a message later, as the caller: needs a scheduler. */
985
+ readonly schedule: {
986
+ readonly method: 'POST';
987
+ readonly path: '/schedules';
988
+ readonly body: z.ZodObject<{
989
+ channel: z.ZodOptional<z.ZodString>;
990
+ re: z.ZodOptional<z.ZodString>;
991
+ text: z.ZodDefault<z.ZodString>;
992
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
993
+ noSync: z.ZodOptional<z.ZodBoolean>;
994
+ attachments: z.ZodOptional<z.ZodArray<z.ZodString>>;
995
+ in: z.ZodOptional<z.ZodString>;
996
+ at: z.ZodOptional<z.ZodString>;
997
+ every: z.ZodOptional<z.ZodString>;
998
+ until: z.ZodOptional<z.ZodString>;
999
+ for: z.ZodOptional<z.ZodString>;
1000
+ times: z.ZodOptional<z.ZodNumber>;
1001
+ }, z.core.$strip>;
1002
+ };
1003
+ readonly schedules: {
1004
+ readonly method: 'GET';
1005
+ readonly path: '/schedules';
1006
+ readonly query: z.ZodObject<{
1007
+ re: z.ZodOptional<z.ZodString>;
1008
+ channel: z.ZodOptional<z.ZodString>;
1009
+ by: z.ZodOptional<z.ZodString>;
1010
+ all: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
1011
+ }, z.core.$strip>;
1012
+ };
1013
+ /** Its creator, or manage in its channel, may cancel a schedule. Canceling one that's done is a no-op. */
1014
+ readonly cancelSchedule: {
1015
+ readonly method: 'POST';
1016
+ readonly path: '/schedules/:id/cancel';
1017
+ };
1018
+ /** The caller's own post with the client ID it gave: what `POST /messages` answered, for telling a retry before posting. */
1019
+ readonly posted: {
1020
+ readonly method: 'GET';
1021
+ readonly path: '/posts/:id';
1022
+ };
1023
+ /** Raw platform events in a sync key's inbox, newest first: the caller's own, and the board's with `sync` everywhere. */
1024
+ readonly inbox: {
1025
+ readonly method: 'GET';
1026
+ readonly path: '/inbox/:key';
1027
+ readonly query: z.ZodObject<{
1028
+ channel: z.ZodOptional<z.ZodString>;
1029
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1030
+ }, z.core.$strip>;
1031
+ };
1032
+ /** Pushes platform events into the caller's inbox for a sync key, deduplicated by their platform IDs. */
1033
+ readonly inboxPush: {
1034
+ readonly method: 'POST';
1035
+ readonly path: '/inbox/:key';
1036
+ readonly body: z.ZodObject<{
1037
+ events: z.ZodArray<z.ZodObject<{
1038
+ id: z.ZodString;
1039
+ event: z.ZodDiscriminatedUnion<[z.ZodObject<{
1040
+ channel: z.ZodString;
1041
+ thread: z.ZodString;
1042
+ subthread: z.ZodNullable<z.ZodString>;
1043
+ kind: z.ZodLiteral<"message">;
1044
+ message: z.ZodString;
1045
+ isRoot: z.ZodBoolean;
1046
+ text: z.ZodString;
1047
+ context: z.ZodNullable<z.ZodString>;
1048
+ author: z.ZodObject<{
1049
+ id: z.ZodString;
1050
+ handle: z.ZodString;
1051
+ name: z.ZodString;
1052
+ avatar: z.ZodNullable<z.ZodString>;
1053
+ isBot: z.ZodBoolean;
1054
+ }, z.core.$strip>;
1055
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
1056
+ type: z.ZodEnum<{
1057
+ audio: "audio";
1058
+ file: "file";
1059
+ image: "image";
1060
+ video: "video";
1061
+ }>;
1062
+ name: z.ZodOptional<z.ZodString>;
1063
+ mimeType: z.ZodOptional<z.ZodString>;
1064
+ size: z.ZodOptional<z.ZodNumber>;
1065
+ url: z.ZodOptional<z.ZodString>;
1066
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1067
+ }, z.core.$strip>>>;
1068
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
1069
+ url: z.ZodString;
1070
+ thread: z.ZodString;
1071
+ message: z.ZodString;
1072
+ snapshot: z.ZodNullable<z.ZodObject<{
1073
+ author: z.ZodString;
1074
+ text: z.ZodString;
1075
+ createdAt: z.ZodNullable<z.ZodString>;
1076
+ files: z.ZodArray<z.ZodObject<{
1077
+ name: z.ZodString;
1078
+ url: z.ZodNullable<z.ZodString>;
1079
+ }, z.core.$strip>>;
1080
+ }, z.core.$strip>>;
1081
+ }, z.core.$strip>>>;
1082
+ }, z.core.$strip>, z.ZodObject<{
1083
+ channel: z.ZodString;
1084
+ thread: z.ZodString;
1085
+ subthread: z.ZodNullable<z.ZodString>;
1086
+ kind: z.ZodLiteral<"edited">;
1087
+ message: z.ZodString;
1088
+ text: z.ZodString;
1089
+ author: z.ZodObject<{
1090
+ id: z.ZodString;
1091
+ handle: z.ZodString;
1092
+ name: z.ZodString;
1093
+ avatar: z.ZodNullable<z.ZodString>;
1094
+ isBot: z.ZodBoolean;
1095
+ }, z.core.$strip>;
1096
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
1097
+ url: z.ZodString;
1098
+ thread: z.ZodString;
1099
+ message: z.ZodString;
1100
+ snapshot: z.ZodNullable<z.ZodObject<{
1101
+ author: z.ZodString;
1102
+ text: z.ZodString;
1103
+ createdAt: z.ZodNullable<z.ZodString>;
1104
+ files: z.ZodArray<z.ZodObject<{
1105
+ name: z.ZodString;
1106
+ url: z.ZodNullable<z.ZodString>;
1107
+ }, z.core.$strip>>;
1108
+ }, z.core.$strip>>;
1109
+ }, z.core.$strip>>>;
1110
+ linksOnly: z.ZodOptional<z.ZodBoolean>;
1111
+ }, z.core.$strip>, z.ZodObject<{
1112
+ channel: z.ZodString;
1113
+ thread: z.ZodString;
1114
+ subthread: z.ZodNullable<z.ZodString>;
1115
+ kind: z.ZodLiteral<"deleted">;
1116
+ message: z.ZodString;
1117
+ }, z.core.$strip>, z.ZodObject<{
1118
+ channel: z.ZodString;
1119
+ thread: z.ZodString;
1120
+ subthread: z.ZodNullable<z.ZodString>;
1121
+ kind: z.ZodLiteral<"reaction">;
1122
+ message: z.ZodString;
1123
+ emoji: z.ZodString;
1124
+ added: z.ZodBoolean;
1125
+ author: z.ZodObject<{
1126
+ id: z.ZodString;
1127
+ handle: z.ZodString;
1128
+ name: z.ZodString;
1129
+ avatar: z.ZodNullable<z.ZodString>;
1130
+ isBot: z.ZodBoolean;
1131
+ }, z.core.$strip>;
1132
+ }, z.core.$strip>, z.ZodObject<{
1133
+ channel: z.ZodString;
1134
+ thread: z.ZodString;
1135
+ kind: z.ZodLiteral<"lifecycle">;
1136
+ type: z.ZodString;
1137
+ title: z.ZodString;
1138
+ url: z.ZodNullable<z.ZodString>;
1139
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
1140
+ unset: z.ZodArray<z.ZodString>;
1141
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
1142
+ reply: z.ZodNullable<z.ZodString>;
1143
+ createRoot: z.ZodBoolean;
1144
+ author: z.ZodObject<{
1145
+ id: z.ZodString;
1146
+ handle: z.ZodString;
1147
+ name: z.ZodString;
1148
+ avatar: z.ZodNullable<z.ZodString>;
1149
+ isBot: z.ZodBoolean;
1150
+ }, z.core.$strip>;
1151
+ }, z.core.$strip>], "kind">;
1152
+ raw: z.ZodUnknown;
1153
+ }, z.core.$strip>>;
1154
+ }, z.core.$strip>;
1155
+ };
1156
+ /** The caller's next inbox events, leased to it, one platform thread at a time and in order. */
1157
+ readonly inboxNext: {
1158
+ readonly method: 'GET';
1159
+ readonly path: '/inbox/:key/next';
1160
+ readonly query: z.ZodObject<{
1161
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1162
+ }, z.core.$strip>;
1163
+ };
1164
+ /** How one went: done, or an error to try it again. */
1165
+ readonly inboxAck: {
1166
+ readonly method: 'POST';
1167
+ readonly path: '/inbox/:key/:id/ack';
1168
+ readonly body: z.ZodObject<{
1169
+ lease: z.ZodString;
1170
+ error: z.ZodOptional<z.ZodString>;
1171
+ }, z.core.$strip>;
1172
+ };
1173
+ /** A platform's write, as its platform author: `sync` where it lands. */
1174
+ readonly syncImport: {
1175
+ readonly method: 'POST';
1176
+ readonly path: '/sync/imports';
1177
+ readonly body: z.ZodDiscriminatedUnion<[z.ZodObject<{
1178
+ author: z.ZodObject<{
1179
+ id: z.ZodString;
1180
+ handle: z.ZodString;
1181
+ name: z.ZodString;
1182
+ isBot: z.ZodBoolean;
1183
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
1184
+ }, z.core.$strip>;
1185
+ from: z.ZodNullable<z.ZodString>;
1186
+ op: z.ZodLiteral<"post">;
1187
+ origin: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1188
+ channel: z.ZodOptional<z.ZodString>;
1189
+ thread: z.ZodString;
1190
+ subthread: z.ZodNullable<z.ZodString>;
1191
+ message: z.ZodString;
1192
+ context: z.ZodNullable<z.ZodString>;
1193
+ }, z.core.$strip>>>;
1194
+ source: z.ZodOptional<z.ZodObject<{
1195
+ key: z.ZodString;
1196
+ channel: z.ZodString;
1197
+ thread: z.ZodString;
1198
+ }, z.core.$strip>>;
1199
+ channel: z.ZodOptional<z.ZodString>;
1200
+ re: z.ZodOptional<z.ZodString>;
1201
+ text: z.ZodDefault<z.ZodString>;
1202
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1203
+ noSync: z.ZodOptional<z.ZodBoolean>;
1204
+ attachments: z.ZodOptional<z.ZodArray<z.ZodString>>;
1205
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
1206
+ url: z.ZodString;
1207
+ snapshot: z.ZodNullable<z.ZodObject<{
1208
+ author: z.ZodString;
1209
+ text: z.ZodString;
1210
+ createdAt: z.ZodNullable<z.ZodString>;
1211
+ files: z.ZodArray<z.ZodObject<{
1212
+ name: z.ZodString;
1213
+ url: z.ZodNullable<z.ZodString>;
1214
+ }, z.core.$strip>>;
1215
+ }, z.core.$strip>>;
1216
+ unavailable: z.ZodNullable<z.ZodString>;
1217
+ message: z.ZodNullable<z.ZodString>;
1218
+ }, z.core.$strip>>>;
1219
+ id: z.ZodOptional<z.ZodString>;
1220
+ }, z.core.$strip>, z.ZodObject<{
1221
+ author: z.ZodObject<{
1222
+ id: z.ZodString;
1223
+ handle: z.ZodString;
1224
+ name: z.ZodString;
1225
+ isBot: z.ZodBoolean;
1226
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
1227
+ }, z.core.$strip>;
1228
+ from: z.ZodNullable<z.ZodString>;
1229
+ origin: z.ZodOptional<z.ZodObject<{
1230
+ thread: z.ZodString;
1231
+ message: z.ZodOptional<z.ZodString>;
1232
+ }, z.core.$strip>>;
1233
+ message: z.ZodOptional<z.ZodString>;
1234
+ op: z.ZodLiteral<"edit">;
1235
+ text: z.ZodString;
1236
+ source: z.ZodOptional<z.ZodObject<{
1237
+ key: z.ZodString;
1238
+ channel: z.ZodString;
1239
+ thread: z.ZodString;
1240
+ }, z.core.$strip>>;
1241
+ }, z.core.$strip>, z.ZodObject<{
1242
+ author: z.ZodObject<{
1243
+ id: z.ZodString;
1244
+ handle: z.ZodString;
1245
+ name: z.ZodString;
1246
+ isBot: z.ZodBoolean;
1247
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
1248
+ }, z.core.$strip>;
1249
+ from: z.ZodNullable<z.ZodString>;
1250
+ origin: z.ZodOptional<z.ZodObject<{
1251
+ thread: z.ZodString;
1252
+ message: z.ZodOptional<z.ZodString>;
1253
+ }, z.core.$strip>>;
1254
+ message: z.ZodOptional<z.ZodString>;
1255
+ op: z.ZodLiteral<"delete">;
1256
+ }, z.core.$strip>, z.ZodObject<{
1257
+ author: z.ZodObject<{
1258
+ id: z.ZodString;
1259
+ handle: z.ZodString;
1260
+ name: z.ZodString;
1261
+ isBot: z.ZodBoolean;
1262
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
1263
+ }, z.core.$strip>;
1264
+ from: z.ZodNullable<z.ZodString>;
1265
+ origin: z.ZodOptional<z.ZodObject<{
1266
+ thread: z.ZodString;
1267
+ message: z.ZodOptional<z.ZodString>;
1268
+ }, z.core.$strip>>;
1269
+ message: z.ZodOptional<z.ZodString>;
1270
+ op: z.ZodLiteral<"react">;
1271
+ emoji: z.ZodString;
1272
+ remove: z.ZodOptional<z.ZodBoolean>;
1273
+ }, z.core.$strip>, z.ZodObject<{
1274
+ author: z.ZodObject<{
1275
+ id: z.ZodString;
1276
+ handle: z.ZodString;
1277
+ name: z.ZodString;
1278
+ isBot: z.ZodBoolean;
1279
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
1280
+ }, z.core.$strip>;
1281
+ from: z.ZodNullable<z.ZodString>;
1282
+ origin: z.ZodOptional<z.ZodObject<{
1283
+ thread: z.ZodString;
1284
+ message: z.ZodOptional<z.ZodString>;
1285
+ }, z.core.$strip>>;
1286
+ message: z.ZodOptional<z.ZodString>;
1287
+ op: z.ZodLiteral<"labels">;
1288
+ set: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1289
+ unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
1290
+ }, z.core.$strip>, z.ZodObject<{
1291
+ author: z.ZodObject<{
1292
+ id: z.ZodString;
1293
+ handle: z.ZodString;
1294
+ name: z.ZodString;
1295
+ isBot: z.ZodBoolean;
1296
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
1297
+ }, z.core.$strip>;
1298
+ from: z.ZodNullable<z.ZodString>;
1299
+ origin: z.ZodOptional<z.ZodObject<{
1300
+ thread: z.ZodString;
1301
+ message: z.ZodOptional<z.ZodString>;
1302
+ }, z.core.$strip>>;
1303
+ message: z.ZodOptional<z.ZodString>;
1304
+ op: z.ZodLiteral<"links">;
1305
+ links: z.ZodArray<z.ZodObject<{
1306
+ url: z.ZodString;
1307
+ snapshot: z.ZodNullable<z.ZodObject<{
1308
+ author: z.ZodString;
1309
+ text: z.ZodString;
1310
+ createdAt: z.ZodNullable<z.ZodString>;
1311
+ files: z.ZodArray<z.ZodObject<{
1312
+ name: z.ZodString;
1313
+ url: z.ZodNullable<z.ZodString>;
1314
+ }, z.core.$strip>>;
1315
+ }, z.core.$strip>>;
1316
+ unavailable: z.ZodNullable<z.ZodString>;
1317
+ message: z.ZodNullable<z.ZodString>;
1318
+ }, z.core.$strip>>;
1319
+ }, z.core.$strip>, z.ZodObject<{
1320
+ op: z.ZodLiteral<"seen">;
1321
+ author: z.ZodObject<{
1322
+ id: z.ZodString;
1323
+ handle: z.ZodString;
1324
+ name: z.ZodString;
1325
+ isBot: z.ZodBoolean;
1326
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
1327
+ }, z.core.$strip>;
1328
+ }, z.core.$strip>], "op">;
1329
+ };
1330
+ /** What sync did on a platform: a delivery, its files, a failure, or a thread's new target. */
1331
+ readonly syncReceipt: {
1332
+ readonly method: 'POST';
1333
+ readonly path: '/sync/receipts';
1334
+ readonly body: z.ZodDiscriminatedUnion<[z.ZodObject<{
1335
+ kind: z.ZodLiteral<"message">;
1336
+ message: z.ZodString;
1337
+ target: z.ZodString;
1338
+ external: z.ZodObject<{
1339
+ thread: z.ZodString;
1340
+ message: z.ZodString;
1341
+ asUser: z.ZodOptional<z.ZodLiteral<true>>;
1342
+ }, z.core.$strip>;
1343
+ files: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1344
+ }, z.core.$strip>, z.ZodObject<{
1345
+ kind: z.ZodLiteral<"files">;
1346
+ message: z.ZodString;
1347
+ target: z.ZodString;
1348
+ files: z.ZodNullable<z.ZodArray<z.ZodString>>;
1349
+ }, z.core.$strip>, z.ZodObject<{
1350
+ kind: z.ZodLiteral<"failed">;
1351
+ message: z.ZodString;
1352
+ target: z.ZodString;
1353
+ error: z.ZodString;
1354
+ }, z.core.$strip>, z.ZodObject<{
1355
+ kind: z.ZodLiteral<"thread">;
1356
+ message: z.ZodString;
1357
+ target: z.ZodString;
1358
+ targetKind: z.ZodEnum<{
1359
+ channel: "channel";
1360
+ thread: "thread";
1361
+ }>;
1362
+ cause: z.ZodEnum<{
1363
+ config: "config";
1364
+ request: "request";
1365
+ }>;
1366
+ }, z.core.$strip>], "kind">;
1367
+ };
1368
+ /** A board thread's sync, by its key. */
1369
+ readonly syncThread: {
1370
+ readonly method: 'GET';
1371
+ readonly path: '/sync/threads/:thread';
1372
+ };
1373
+ /** What platform IDs are on the board. */
1374
+ readonly syncFind: {
1375
+ readonly method: 'GET';
1376
+ readonly path: '/sync/find';
1377
+ readonly query: z.ZodObject<{
1378
+ code: z.ZodOptional<z.ZodString>;
1379
+ post: z.ZodOptional<z.ZodString>;
1380
+ thread: z.ZodOptional<z.ZodString>;
1381
+ message: z.ZodOptional<z.ZodString>;
1382
+ account: z.ZodOptional<z.ZodString>;
1383
+ person: z.ZodOptional<z.ZodString>;
1384
+ }, z.core.$strip>;
1385
+ };
1386
+ /** Messages' copies on platforms. */
1387
+ readonly syncCopies: {
1388
+ readonly method: 'GET';
1389
+ readonly path: '/sync/copies';
1390
+ readonly query: z.ZodObject<{
1391
+ message: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodString>>;
1392
+ }, z.core.$strip>;
1393
+ };
1394
+ /** A person's recent roots, for telling their own platform copies from new messages. */
1395
+ readonly syncRoots: {
1396
+ readonly method: 'GET';
1397
+ readonly path: '/sync/roots';
1398
+ readonly query: z.ZodObject<{
1399
+ by: z.ZodString;
1400
+ since: z.ZodCoercedNumber<unknown>;
1401
+ }, z.core.$strip>;
1402
+ };
1403
+ /** A one-time code for linking a platform account. */
1404
+ readonly syncCode: {
1405
+ readonly method: 'POST';
1406
+ readonly path: '/sync/codes';
1407
+ readonly body: z.ZodObject<{
1408
+ sync: z.ZodString;
1409
+ }, z.core.$strip>;
1410
+ };
1411
+ /** Links a platform account, by a code or for a person. */
1412
+ readonly syncAccount: {
1413
+ readonly method: 'POST';
1414
+ readonly path: '/sync/accounts';
1415
+ readonly body: z.ZodObject<{
1416
+ sync: z.ZodString;
1417
+ account: z.ZodObject<{
1418
+ id: z.ZodString;
1419
+ handle: z.ZodString;
1420
+ name: z.ZodString;
1421
+ isBot: z.ZodBoolean;
1422
+ avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
1423
+ }, z.core.$strip>;
1424
+ code: z.ZodString;
1425
+ message: z.ZodOptional<z.ZodString>;
1426
+ method: z.ZodOptional<z.ZodEnum<{
1427
+ code: "code";
1428
+ consent: "consent";
1429
+ }>>;
1430
+ }, z.core.$strip>;
1431
+ };
1432
+ /** Unlinks a platform account. */
1433
+ readonly syncUnlink: {
1434
+ readonly method: 'POST';
1435
+ readonly path: '/sync/accounts/unlink';
1436
+ readonly body: z.ZodObject<{
1437
+ account: z.ZodString;
1438
+ }, z.core.$strip>;
1439
+ };
1440
+ /** Reads a platform channel or thread on demand, where that sync runs, without syncing or storing it. Full access only. */
1441
+ readonly readSource: {
1442
+ readonly method: 'GET';
1443
+ readonly path: '/sources/:key/read';
1444
+ readonly query: z.ZodObject<{
1445
+ target: z.ZodString;
1446
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1447
+ }, z.core.$strip>;
1448
+ };
1449
+ readonly webhook: {
1450
+ readonly method: 'POST';
1451
+ readonly path: '/webhooks/:key';
1452
+ };
1453
+ readonly events: {
1454
+ readonly method: 'GET';
1455
+ readonly path: '/events';
1456
+ readonly query: z.ZodObject<{
1457
+ channel: z.ZodOptional<z.ZodString>;
1458
+ re: z.ZodOptional<z.ZodString>;
1459
+ by: z.ZodOptional<z.ZodString>;
1460
+ mentions: z.ZodOptional<z.ZodString>;
1461
+ label: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<readonly [string, null] | readonly [string, string[]], string>>>>>;
1462
+ from: z.ZodOptional<z.ZodString>;
1463
+ text: z.ZodOptional<z.ZodString>;
1464
+ after: z.ZodOptional<z.ZodString>;
1465
+ wait: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1466
+ all: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
1467
+ }, z.core.$strip>;
1468
+ };
1469
+ readonly avatar: {
1470
+ readonly method: 'GET';
1471
+ readonly path: '/avatars/:name';
1472
+ };
1473
+ /** The file is the body; `content-type` is its type and `x-board-filename` its name, URI-encoded. */
1474
+ readonly upload: {
1475
+ readonly method: 'POST';
1476
+ readonly path: '/attachments';
1477
+ };
1478
+ readonly attachment: {
1479
+ readonly method: 'GET';
1480
+ readonly path: '/attachments/:id';
1481
+ };
1482
+ /** A file too big for one request: the board answers where to `PUT` it in its blob store. Needs a store with `uploadUrl`. */
1483
+ readonly uploadStart: {
1484
+ readonly method: 'POST';
1485
+ readonly path: '/attachments/uploads';
1486
+ readonly body: z.ZodObject<{
1487
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1488
+ type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1489
+ size: z.ZodNumber;
1490
+ }, z.core.$strip>;
1491
+ };
1492
+ /** After the `PUT`: the board checks what landed in the store and records the attachment. */
1493
+ readonly uploadFinish: {
1494
+ readonly method: 'POST';
1495
+ readonly path: '/attachments/uploads/:id';
1496
+ };
1497
+ readonly openapi: {
1498
+ readonly method: 'GET';
1499
+ readonly path: '/openapi.json';
1500
+ };
1501
+ /** Your linked platform accounts. */
1502
+ readonly identity: {
1503
+ readonly method: 'GET';
1504
+ readonly path: '/identity';
1505
+ };
1506
+ /** Starts a sign-in that carries a code (no token), on the board that runs the entry's sync. */
1507
+ readonly signIn: {
1508
+ readonly method: 'GET';
1509
+ readonly path: '/identity/sign-in';
1510
+ readonly query: z.ZodObject<{
1511
+ sync: z.ZodString;
1512
+ code: z.ZodString;
1513
+ }, z.core.$strip>;
1514
+ };
1515
+ /** Where a sign-in comes back (no token): links the account it authorized to the code's person. */
1516
+ readonly signedIn: {
1517
+ readonly method: 'GET';
1518
+ readonly path: '/identity/signed-in';
1519
+ readonly query: z.ZodObject<{
1520
+ sync: z.ZodString;
1521
+ code: z.ZodString;
1522
+ }, z.core.$strip>;
1523
+ };
1524
+ readonly identityUnlink: {
1525
+ readonly method: 'POST';
1526
+ readonly path: '/identity/unlink';
1527
+ readonly body: z.ZodObject<{
1528
+ actor: z.ZodString;
1529
+ }, z.core.$strip>;
1530
+ };
1531
+ /** Watchers registered by boards on `http()`: every one to `manage` everywhere, the caller's own to anyone else. */
1532
+ readonly watchers: {
1533
+ readonly method: 'GET';
1534
+ readonly path: '/watchers';
1535
+ };
1536
+ /** Registers the caller's watchers, replacing its last registration. On a board on `http()`, registers its own, with no body or token. */
1537
+ readonly register: {
1538
+ readonly method: 'POST';
1539
+ readonly path: '/watchers';
1540
+ readonly body: z.ZodObject<{
1541
+ url: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
1542
+ watch: z.ZodRecord<z.ZodString, z.ZodObject<{
1543
+ tail: z.ZodString;
1544
+ when: z.ZodDefault<z.ZodEnum<{
1545
+ enters: "enters";
1546
+ matches: "matches";
1547
+ }>>;
1548
+ }, z.core.$strip>>;
1549
+ sync: z.ZodOptional<z.ZodArray<z.ZodObject<{
1550
+ key: z.ZodString;
1551
+ platform: z.ZodString;
1552
+ signIn: z.ZodDefault<z.ZodBoolean>;
1553
+ }, z.core.$strip>>>;
1554
+ }, z.core.$strip>;
1555
+ };
1556
+ /** The caller's matches it can run now, each leased to it until it acks. */
1557
+ readonly matches: {
1558
+ readonly method: 'GET';
1559
+ readonly path: '/watchers/matches';
1560
+ readonly query: z.ZodObject<{
1561
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1562
+ wait: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1563
+ }, z.core.$strip>;
1564
+ };
1565
+ readonly ack: {
1566
+ readonly method: 'POST';
1567
+ readonly path: '/watchers/matches/:id/ack';
1568
+ readonly body: z.ZodObject<{
1569
+ lease: z.ZodString;
1570
+ error: z.ZodOptional<z.ZodString>;
1571
+ skip: z.ZodOptional<z.ZodBoolean>;
1572
+ }, z.core.$strip>;
1573
+ };
1574
+ /** On a board on `http()`: something matched. No body, no token: the board pulls what. */
1575
+ readonly wake: {
1576
+ readonly method: 'POST';
1577
+ readonly path: '/wake';
1578
+ };
1579
+ };
1580
+ type RouteName = keyof typeof routes;
1581
+ //#endregion
1582
+ //#region src/client/client.d.ts
1583
+ declare class BoardError extends Error {
1584
+ readonly code: string;
1585
+ readonly status: number;
1586
+ constructor(code: string, message: string, status: number);
1587
+ }
1588
+ type Resolvable<T> = T | (() => T | Promise<T>);
1589
+ /** A profile name, `{ name, avatar }`, or null for no profile. */
1590
+ type ProfileOption = string | {
1591
+ name: string;
1592
+ avatar?: string;
1593
+ } | null;
1594
+ type ClientOptions = {
1595
+ /** The board's URL, e.g. `https://www.example.com/api/board`. */
1596
+ url: string;
1597
+ /** An OIDC token whose audience is the board's URL, or a function returning one. Without one, `fetch` brings the credentials. */
1598
+ token?: Resolvable<string>;
1599
+ profile?: Resolvable<ProfileOption>;
1600
+ /** Runtime session, recorded on writes and used to scope read cursors. */
1601
+ session?: Resolvable<string | null>;
1602
+ /** A person's handle; the board falls back to one derived from their user ID. */
1603
+ handle?: Resolvable<string | null>;
1604
+ /** Your display name and avatar, shown when you write as yourself (not as a profile). */
1605
+ person?: Resolvable<{
1606
+ name?: string | null;
1607
+ avatar?: string | null;
1608
+ } | null>;
1609
+ /** Extra headers on every request. */
1610
+ headers?: Resolvable<Record<string, string>>;
1611
+ fetch?: typeof fetch;
1612
+ /**
1613
+ * How a direct upload's bytes go to the blob store's signed URL: `fetch` by default, never the
1614
+ * board's own, which brings the board's credentials and would hand them to the store.
1615
+ */
1616
+ storeFetch?: typeof fetch;
1617
+ };
1618
+ type PostOptions = {
1619
+ text: string;
1620
+ labels?: Record<string, string>;
1621
+ /** Keep this message on the board: no configured sync targets. */
1622
+ noSync?: boolean;
1623
+ /** External targets the new thread starts with: `slack:#incidents` starts one, `github:owner/repo:12` joins one. */
1624
+ sync?: string[];
1625
+ /** Makes retries idempotent: the same id never posts twice. */
1626
+ id?: string;
1627
+ /** Files from `upload`, or their IDs. */
1628
+ attachments?: (Attachment | string)[];
1629
+ };
1630
+ type ReplyOptions = Omit<PostOptions, 'sync'>;
1631
+ /**
1632
+ * When a scheduled message goes out: once `in` a while or `at` a time, or
1633
+ * `every` so often (first at `at`, `in`, or one `every` from now), stopping
1634
+ * `until` a time, `for` a while after the first send, or after `times` sends.
1635
+ * A repeat with no stop runs until it's canceled.
1636
+ */
1637
+ type ScheduleTiming = {
1638
+ in?: string;
1639
+ at?: Date | string;
1640
+ every?: string;
1641
+ until?: Date | string;
1642
+ for?: string;
1643
+ times?: number;
1644
+ };
1645
+ type ScheduleOptions = Omit<PostOptions, 'sync' | 'id'> & ScheduleTiming;
1646
+ /** What `upload` takes: the bytes, and what to call them. */
1647
+ type UploadInput = {
1648
+ data: Blob | Uint8Array<ArrayBuffer>;
1649
+ name: string;
1650
+ /** A MIME type; a `Blob`'s own type, or one from the name's extension, otherwise. */
1651
+ type?: string;
1652
+ };
1653
+ type WaitOptions = {
1654
+ /** `'30s'`, `'10m'`, `'1h'`, or milliseconds. Default `'30m'`. */
1655
+ timeout?: string | number;
1656
+ signal?: AbortSignal;
1657
+ };
1658
+ declare function duration(value: string | number): number;
1659
+ type Filters = Omit<FiltersInput, 'label'> & {
1660
+ /** `{ status: 'open' }` or `['status=open']`. */
1661
+ label?: Record<string, string> | string[];
1662
+ };
1663
+ type BoardClient = ReturnType<typeof createBoardClient>;
1664
+ /** What a write returns, with the handles in it that matched nobody and stayed plain text. */
1665
+ type Written<T> = T & {
1666
+ unknownMentions?: string[];
1667
+ };
1668
+ declare function createBoardClient(options: ClientOptions): {
1669
+ url: string;
1670
+ /**
1671
+ * The board's HTTP API with this client's credentials, and the response as
1672
+ * the board sent it, errors included: for proxies like `vb inspect`.
1673
+ */
1674
+ request: (path: string, init?: {
1675
+ method?: string;
1676
+ body?: Uint8Array<ArrayBuffer>;
1677
+ headers?: Record<string, string>;
1678
+ signal?: AbortSignal;
1679
+ /** Act as this profile (`null` for yourself) instead of the client's. */
1680
+ as?: ProfileOption;
1681
+ }) => Promise<Response>;
1682
+ discovery: () => Promise<Discovery>;
1683
+ me: () => Promise<Me>;
1684
+ channels: () => Promise<Channel[]>;
1685
+ actors: () => Promise<(Actor & {
1686
+ person?: ActorView['person'];
1687
+ })[]>;
1688
+ /** Your linked platform accounts, and the sync entries you haven't linked (`unlinked`). */
1689
+ identity: () => Promise<IdentityView>;
1690
+ /** Unlinks one of your accounts, by actor ID or handle. History keeps its messages as they were. */
1691
+ unlinkAccount: (account: string) => Promise<{
1692
+ ok: true;
1693
+ actor: string;
1694
+ }>;
1695
+ messages: (query?: Filters & Omit<MessagesQueryInput, keyof FiltersInput>) => Promise<MessagesPage>;
1696
+ thread: (id: string) => Promise<ThreadView>;
1697
+ /** Your own post with the client ID you gave it, as posting it answered: 404 `post_not_found` when there's none. */
1698
+ posted: (id: string) => Promise<MessageView>;
1699
+ /** Threads with a matching message, one summary each (root, reply count, latest reply), by latest activity. `limit` counts threads. */
1700
+ threads: (query?: Filters & Omit<ThreadsQueryInput, keyof FiltersInput>) => Promise<ThreadsPage>;
1701
+ /** `unknownMentions` lists the handles that matched nobody: they posted as plain text. */
1702
+ post(channel: string, input: string | PostOptions): Promise<Written<MessageView>>;
1703
+ reply(id: string, input: string | ReplyOptions): Promise<Written<MessageView>>;
1704
+ /**
1705
+ * Posts later, as you: a new thread when `target` is a channel, a reply when it's
1706
+ * `{ re }`, any message's ID in the thread. Each message it posts carries
1707
+ * `schedule: { id, n }`. Needs a board with a scheduler.
1708
+ */
1709
+ schedule(target: string | {
1710
+ re: string;
1711
+ }, input: ScheduleOptions): Promise<Written<ScheduleView>>;
1712
+ /** Pending schedules (`all` for done and canceled too), oldest first. `re` is any message in a thread. */
1713
+ schedules: (query?: SchedulesQueryInput) => Promise<ScheduleView[]>;
1714
+ /** Stops a schedule: yours, or any with manage in its channel. `canceled` is false when it was already done or canceled. */
1715
+ cancelSchedule: (id: string) => Promise<{
1716
+ schedule: ScheduleView;
1717
+ canceled: boolean;
1718
+ }>;
1719
+ /**
1720
+ * Stores a file on the board, for a post or reply's `attachments`. Up to 4 MB goes in one
1721
+ * request; bigger, up to 100 MB, goes straight to the board's blob store on a URL the board
1722
+ * signs, where its store can (`no_direct_uploads` where it can't).
1723
+ */
1724
+ upload(input: UploadInput): Promise<Attachment>;
1725
+ /** An attachment's bytes, as the board serves them: `content-type` is the file's type. */
1726
+ download: (id: string, opts?: {
1727
+ signal?: AbortSignal;
1728
+ }) => Promise<Response>;
1729
+ edit: (id: string, text: string) => Promise<{
1730
+ ok: true;
1731
+ unknownMentions?: string[];
1732
+ }>;
1733
+ delete: (id: string) => Promise<{
1734
+ ok: true;
1735
+ }>;
1736
+ /** `emoji` is a short name, `:name:`, or the character itself. */
1737
+ react: (id: string, emoji: string, opts?: {
1738
+ remove?: boolean;
1739
+ }) => Promise<{
1740
+ ok: true;
1741
+ }>;
1742
+ label: (id: string, change: {
1743
+ set?: Record<string, string>;
1744
+ unset?: string[];
1745
+ }) => Promise<{
1746
+ ok: true;
1747
+ }>;
1748
+ /**
1749
+ * Shows typing in the platform threads the message's thread is synced to
1750
+ * (on WhatsApp, also marking the latest inbound message read). Ephemeral:
1751
+ * nothing goes in the log. Answers the external threads that took it.
1752
+ * `status` replaces "Typing…" on Slack ("running tests…").
1753
+ */
1754
+ typing: (id: string, status?: string) => Promise<string[]>;
1755
+ /** Attaches the message's thread to an external target, backfilling it. Attaching twice is a no-op. */
1756
+ sync: (id: string, target: string) => Promise<{
1757
+ target: string;
1758
+ attached: boolean;
1759
+ }>;
1760
+ /** Raw platform events for a sync entry, newest first. */
1761
+ inbox: (key: string, opts?: {
1762
+ channel?: string;
1763
+ limit?: number;
1764
+ }) => Promise<InboxEntry[]>;
1765
+ /** Registers the caller's watchers, replacing its last registration: what a board on `http()` does. */
1766
+ register: (input: {
1767
+ url?: string | null;
1768
+ watch: Record<string, {
1769
+ tail: string;
1770
+ when?: 'matches' | 'enters';
1771
+ }>;
1772
+ sync?: {
1773
+ key: string;
1774
+ platform: string;
1775
+ signIn?: boolean;
1776
+ }[];
1777
+ }) => Promise<RegistrationView>;
1778
+ /** Registered watchers: every one to `manage` everywhere, the caller's own to anyone else. */
1779
+ watchers: () => Promise<RegistrationView[]>;
1780
+ /** The caller's matches it can run now, each leased to it until it acks. `wait` holds the request up to that many seconds for one. */
1781
+ matches: (opts?: {
1782
+ limit?: number;
1783
+ wait?: number;
1784
+ signal?: AbortSignal;
1785
+ }) => Promise<MatchView[]>;
1786
+ /** How a pulled match went: done, an error to try again, or `skip` to drop it. */
1787
+ ack: (id: string, body: {
1788
+ lease: string;
1789
+ error?: string;
1790
+ skip?: boolean;
1791
+ }) => Promise<{
1792
+ ok: true;
1793
+ }>;
1794
+ /**
1795
+ * Reads a platform channel (`#name`, an ID), thread (`C0123:1727000000.123456`),
1796
+ * or message permalink on demand, without syncing or storing it. Full access only.
1797
+ */
1798
+ readSource: (key: string, target: string, opts?: {
1799
+ limit?: number;
1800
+ }) => Promise<SourceRead>;
1801
+ poll: (query?: Filters & {
1802
+ after?: string;
1803
+ wait?: number;
1804
+ all?: boolean;
1805
+ }, signal?: AbortSignal) => Promise<EventsPage>;
1806
+ /** A platform's write, as its platform author: idempotent per platform event for a post, found from its origin otherwise. */
1807
+ syncImport: (body: SyncImportInput) => Promise<{
1808
+ message: string | null;
1809
+ dropped?: string[];
1810
+ }>;
1811
+ /** What sync did on a platform: a delivery, its files, a failure, or a thread's new target. */
1812
+ syncReceipt: (body: SyncReceiptInput) => Promise<{
1813
+ ok: true;
1814
+ attached?: boolean;
1815
+ }>;
1816
+ /** A board thread's sync, by its key. */
1817
+ syncThread: (thread: string) => Promise<SyncThreadView>;
1818
+ /** What platform IDs are on the board: a thread, a message, who an account is, a person's accounts. */
1819
+ syncFind: (query: SyncFindInput, opts?: {
1820
+ signal?: AbortSignal;
1821
+ }) => Promise<SyncFindView>;
1822
+ /** Messages' copies on platforms, by message and target. */
1823
+ syncCopies: (messages: string[]) => Promise<Record<string, Record<string, ExternalCopy>>>;
1824
+ /** A person's roots since `since`. */
1825
+ syncRoots: (by: string, since: Date | number) => Promise<MessageView[]>;
1826
+ /** Pushes platform events into your inbox for sync key `key`; each platform ID lands once. */
1827
+ inboxPush: (key: string, events: {
1828
+ id: string;
1829
+ event: InboxItem['event'];
1830
+ raw: unknown;
1831
+ }[]) => Promise<{
1832
+ ok: true;
1833
+ }>;
1834
+ /** Your next inbox events for `key`, leased to you until you ack them, one platform thread at a time. */
1835
+ inboxNext: (key: string, opts?: {
1836
+ limit?: number;
1837
+ }) => Promise<InboxItem[]>;
1838
+ /** How an inbox event went: done, or an error to try it again. */
1839
+ inboxAck: (key: string, id: string, body: {
1840
+ lease: string;
1841
+ error?: string;
1842
+ }) => Promise<{
1843
+ ok: true;
1844
+ }>;
1845
+ /**
1846
+ * A one-time code for linking your account on sync entry `sync`, to post from that account where
1847
+ * the board syncs, and `signIn` when the entry signs people in: open it (only you) and approve.
1848
+ * Only people get one, each for themselves. `identity()` shows the link once it's made.
1849
+ */
1850
+ syncCode: (sync: string) => Promise<SyncCodeView>;
1851
+ /** Links a platform account to whoever a code was issued to: one posted from it, or carried through its sign-in. */
1852
+ syncAccount: (body: SyncAccountInput) => Promise<{
1853
+ person: string;
1854
+ link: LinkedAccount;
1855
+ }>;
1856
+ /** Unlinks a platform account: your own, or anyone's with `sync`. */
1857
+ syncUnlink: (account: string) => Promise<{
1858
+ ok: true;
1859
+ }>;
1860
+ /** Live events. Reconnects from the last seen index whenever the stream closes. */
1861
+ events(query?: Filters & Pick<EventsQueryInput, 'after' | 'all'>, opts?: {
1862
+ signal?: AbortSignal;
1863
+ }): AsyncGenerator<BoardEventView>;
1864
+ /** The next matching event after `after` (default: now), or null on timeout. */
1865
+ wait(query?: Filters & {
1866
+ after?: string;
1867
+ }, opts?: WaitOptions): Promise<BoardEventView | null>;
1868
+ };
1869
+ //#endregion
1870
+ //#region src/sync/events.d.ts
1871
+ declare const EventBase: z.ZodObject<{
1872
+ channel: z.ZodString;
1873
+ thread: z.ZodString;
1874
+ subthread: z.ZodNullable<z.ZodString>;
1875
+ id: z.ZodString;
1876
+ platform: z.ZodString;
1877
+ key: z.ZodString;
1878
+ raw: z.ZodUnknown;
1879
+ }, z.core.$strip>;
1880
+ type EventBase<P extends string = string> = Omit<z.infer<typeof EventBase>, 'platform'> & {
1881
+ platform: P;
1882
+ };
1883
+ type ProviderEvent = EventBase & ExternalEvent & {
1884
+ type: string;
1885
+ };
1886
+ declare function envelope(platform: string, key: string, event: ExternalEvent, raw: unknown, id: string): {
1887
+ channel: string;
1888
+ thread: string;
1889
+ subthread: string | null;
1890
+ kind: "message";
1891
+ message: string;
1892
+ isRoot: boolean;
1893
+ text: string;
1894
+ context: string | null;
1895
+ author: {
1896
+ id: string;
1897
+ handle: string;
1898
+ name: string;
1899
+ avatar: string | null;
1900
+ isBot: boolean;
1901
+ };
1902
+ files?: {
1903
+ type: "audio" | "file" | "image" | "video";
1904
+ name?: string | undefined;
1905
+ mimeType?: string | undefined;
1906
+ size?: number | undefined;
1907
+ url?: string | undefined;
1908
+ fetchMetadata?: Record<string, string> | undefined;
1909
+ }[] | undefined;
1910
+ links?: {
1911
+ url: string;
1912
+ thread: string;
1913
+ message: string;
1914
+ snapshot: {
1915
+ author: string;
1916
+ text: string;
1917
+ createdAt: string | null;
1918
+ files: {
1919
+ name: string;
1920
+ url: string | null;
1921
+ }[];
1922
+ } | null;
1923
+ }[] | undefined;
1924
+ id: string;
1925
+ platform: string;
1926
+ key: string;
1927
+ raw: unknown;
1928
+ type: string;
1929
+ } | {
1930
+ channel: string;
1931
+ thread: string;
1932
+ subthread: string | null;
1933
+ kind: "edited";
1934
+ message: string;
1935
+ text: string;
1936
+ author: {
1937
+ id: string;
1938
+ handle: string;
1939
+ name: string;
1940
+ avatar: string | null;
1941
+ isBot: boolean;
1942
+ };
1943
+ links?: {
1944
+ url: string;
1945
+ thread: string;
1946
+ message: string;
1947
+ snapshot: {
1948
+ author: string;
1949
+ text: string;
1950
+ createdAt: string | null;
1951
+ files: {
1952
+ name: string;
1953
+ url: string | null;
1954
+ }[];
1955
+ } | null;
1956
+ }[] | undefined;
1957
+ linksOnly?: boolean | undefined;
1958
+ id: string;
1959
+ platform: string;
1960
+ key: string;
1961
+ raw: unknown;
1962
+ type: string;
1963
+ } | {
1964
+ channel: string;
1965
+ thread: string;
1966
+ subthread: string | null;
1967
+ kind: "deleted";
1968
+ message: string;
1969
+ id: string;
1970
+ platform: string;
1971
+ key: string;
1972
+ raw: unknown;
1973
+ type: string;
1974
+ } | {
1975
+ channel: string;
1976
+ thread: string;
1977
+ subthread: string | null;
1978
+ kind: "reaction";
1979
+ message: string;
1980
+ emoji: string;
1981
+ added: boolean;
1982
+ author: {
1983
+ id: string;
1984
+ handle: string;
1985
+ name: string;
1986
+ avatar: string | null;
1987
+ isBot: boolean;
1988
+ };
1989
+ id: string;
1990
+ platform: string;
1991
+ key: string;
1992
+ raw: unknown;
1993
+ type: string;
1994
+ } | {
1995
+ channel: string;
1996
+ thread: string;
1997
+ subthread: string | null;
1998
+ kind: "lifecycle";
1999
+ title: string;
2000
+ url: string | null;
2001
+ labels: Record<string, string>;
2002
+ unset: string[];
2003
+ owns?: string[] | undefined;
2004
+ reply: string | null;
2005
+ createRoot: boolean;
2006
+ author: {
2007
+ id: string;
2008
+ handle: string;
2009
+ name: string;
2010
+ avatar: string | null;
2011
+ isBot: boolean;
2012
+ };
2013
+ id: string;
2014
+ platform: string;
2015
+ key: string;
2016
+ raw: unknown;
2017
+ type: string;
2018
+ };
2019
+ declare function eventSchema<P extends string, M extends string>(platform: P, messageType: M): z.ZodDiscriminatedUnion<[z.ZodObject<{
2020
+ channel: z.ZodString;
2021
+ thread: z.ZodString;
2022
+ subthread: z.ZodNullable<z.ZodString>;
2023
+ kind: z.ZodLiteral<"message">;
2024
+ message: z.ZodString;
2025
+ isRoot: z.ZodBoolean;
2026
+ text: z.ZodString;
2027
+ context: z.ZodNullable<z.ZodString>;
2028
+ author: z.ZodObject<{
2029
+ id: z.ZodString;
2030
+ handle: z.ZodString;
2031
+ name: z.ZodString;
2032
+ avatar: z.ZodNullable<z.ZodString>;
2033
+ isBot: z.ZodBoolean;
2034
+ }, z.core.$strip>;
2035
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
2036
+ type: z.ZodEnum<{
2037
+ audio: "audio";
2038
+ file: "file";
2039
+ image: "image";
2040
+ video: "video";
2041
+ }>;
2042
+ name: z.ZodOptional<z.ZodString>;
2043
+ mimeType: z.ZodOptional<z.ZodString>;
2044
+ size: z.ZodOptional<z.ZodNumber>;
2045
+ url: z.ZodOptional<z.ZodString>;
2046
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2047
+ }, z.core.$strip>>>;
2048
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
2049
+ url: z.ZodString;
2050
+ thread: z.ZodString;
2051
+ message: z.ZodString;
2052
+ snapshot: z.ZodNullable<z.ZodObject<{
2053
+ author: z.ZodString;
2054
+ text: z.ZodString;
2055
+ createdAt: z.ZodNullable<z.ZodString>;
2056
+ files: z.ZodArray<z.ZodObject<{
2057
+ name: z.ZodString;
2058
+ url: z.ZodNullable<z.ZodString>;
2059
+ }, z.core.$strip>>;
2060
+ }, z.core.$strip>>;
2061
+ }, z.core.$strip>>>;
2062
+ id: z.ZodString;
2063
+ key: z.ZodString;
2064
+ raw: z.ZodUnknown;
2065
+ platform: z.ZodLiteral<P>;
2066
+ type: z.ZodLiteral<M>;
2067
+ }, z.core.$strip>, z.ZodObject<{
2068
+ channel: z.ZodString;
2069
+ thread: z.ZodString;
2070
+ subthread: z.ZodNullable<z.ZodString>;
2071
+ kind: z.ZodLiteral<"edited">;
2072
+ message: z.ZodString;
2073
+ text: z.ZodString;
2074
+ author: z.ZodObject<{
2075
+ id: z.ZodString;
2076
+ handle: z.ZodString;
2077
+ name: z.ZodString;
2078
+ avatar: z.ZodNullable<z.ZodString>;
2079
+ isBot: z.ZodBoolean;
2080
+ }, z.core.$strip>;
2081
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
2082
+ url: z.ZodString;
2083
+ thread: z.ZodString;
2084
+ message: z.ZodString;
2085
+ snapshot: z.ZodNullable<z.ZodObject<{
2086
+ author: z.ZodString;
2087
+ text: z.ZodString;
2088
+ createdAt: z.ZodNullable<z.ZodString>;
2089
+ files: z.ZodArray<z.ZodObject<{
2090
+ name: z.ZodString;
2091
+ url: z.ZodNullable<z.ZodString>;
2092
+ }, z.core.$strip>>;
2093
+ }, z.core.$strip>>;
2094
+ }, z.core.$strip>>>;
2095
+ linksOnly: z.ZodOptional<z.ZodBoolean>;
2096
+ id: z.ZodString;
2097
+ key: z.ZodString;
2098
+ raw: z.ZodUnknown;
2099
+ platform: z.ZodLiteral<P>;
2100
+ type: z.ZodLiteral<"message.edited">;
2101
+ }, z.core.$strip>, z.ZodObject<{
2102
+ channel: z.ZodString;
2103
+ thread: z.ZodString;
2104
+ subthread: z.ZodNullable<z.ZodString>;
2105
+ kind: z.ZodLiteral<"deleted">;
2106
+ message: z.ZodString;
2107
+ id: z.ZodString;
2108
+ key: z.ZodString;
2109
+ raw: z.ZodUnknown;
2110
+ platform: z.ZodLiteral<P>;
2111
+ type: z.ZodLiteral<"message.deleted">;
2112
+ }, z.core.$strip>, z.ZodObject<{
2113
+ channel: z.ZodString;
2114
+ thread: z.ZodString;
2115
+ subthread: z.ZodNullable<z.ZodString>;
2116
+ kind: z.ZodLiteral<"reaction">;
2117
+ message: z.ZodString;
2118
+ emoji: z.ZodString;
2119
+ added: z.ZodBoolean;
2120
+ author: z.ZodObject<{
2121
+ id: z.ZodString;
2122
+ handle: z.ZodString;
2123
+ name: z.ZodString;
2124
+ avatar: z.ZodNullable<z.ZodString>;
2125
+ isBot: z.ZodBoolean;
2126
+ }, z.core.$strip>;
2127
+ id: z.ZodString;
2128
+ key: z.ZodString;
2129
+ raw: z.ZodUnknown;
2130
+ platform: z.ZodLiteral<P>;
2131
+ type: z.ZodEnum<{
2132
+ "reaction.added": "reaction.added";
2133
+ "reaction.removed": "reaction.removed";
2134
+ }>;
2135
+ }, z.core.$strip>, z.ZodObject<{
2136
+ channel: z.ZodString;
2137
+ thread: z.ZodString;
2138
+ subthread: z.ZodNullable<z.ZodString>;
2139
+ kind: z.ZodLiteral<"lifecycle">;
2140
+ type: z.ZodString;
2141
+ title: z.ZodString;
2142
+ url: z.ZodNullable<z.ZodString>;
2143
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
2144
+ unset: z.ZodArray<z.ZodString>;
2145
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
2146
+ reply: z.ZodNullable<z.ZodString>;
2147
+ createRoot: z.ZodBoolean;
2148
+ author: z.ZodObject<{
2149
+ id: z.ZodString;
2150
+ handle: z.ZodString;
2151
+ name: z.ZodString;
2152
+ avatar: z.ZodNullable<z.ZodString>;
2153
+ isBot: z.ZodBoolean;
2154
+ }, z.core.$strip>;
2155
+ id: z.ZodString;
2156
+ key: z.ZodString;
2157
+ raw: z.ZodUnknown;
2158
+ platform: z.ZodLiteral<P>;
2159
+ }, z.core.$strip>], "kind">;
2160
+ type SyncRoot = {
2161
+ text: string;
2162
+ labels: Record<string, string>;
2163
+ author: ExternalAuthor;
2164
+ raw: unknown;
2165
+ };
2166
+ type RootOverride = (root: Readonly<SyncRoot>) => {
2167
+ text?: string;
2168
+ labels?: Record<string, string>;
2169
+ };
2170
+ declare const SyncOverrides: z.ZodObject<{
2171
+ root: z.ZodOptional<z.ZodCustom<RootOverride, RootOverride>>;
2172
+ text: z.ZodOptional<z.ZodString>;
2173
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2174
+ unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
2175
+ noSync: z.ZodOptional<z.ZodBoolean>;
2176
+ }, z.core.$strict>;
2177
+ type SyncOverrides = z.infer<typeof SyncOverrides>;
2178
+ /** What an import made: its thread's root and the message, as IDs clients pass back as they got them. */
2179
+ type SyncResult = {
2180
+ root: string | null;
2181
+ message: string | null;
2182
+ };
2183
+ //#endregion
2184
+ //#region src/sync/users.d.ts
2185
+ /**
2186
+ * People's own platform tokens, so a board message they wrote reaches Slack or
2187
+ * GitHub as them, and signing in proves an account is theirs. The board never
2188
+ * stores a token: it asks for one at each delivery, and a person without one
2189
+ * (never signed in, revoked, expired) is delivered as the bot, as before.
2190
+ */
2191
+ type UserTokens = {
2192
+ /**
2193
+ * A sign-in URL that binds whoever completes it to `principal`. Show it only to them. With
2194
+ * `callback`, the platform sends them there once they've approved.
2195
+ */
2196
+ authorize(principal: string, options?: {
2197
+ callback?: string;
2198
+ }): Promise<string>;
2199
+ /** `principal`'s token on the platform, or null when they haven't signed in. */
2200
+ token(principal: string): Promise<string | null>;
2201
+ };
2202
+ /**
2203
+ * Gives an adapter people's tokens, for your own OAuth: `slack({ adapter:
2204
+ * withUserTokens(createSlackAdapter(...), { authorize, token }) })`. A Connect
2205
+ * connector name (`adapter: 'slack/acme'`) does this for you.
2206
+ */
2207
+ declare function withUserTokens<A extends object>(adapter: A, tokens: UserTokens): A;
2208
+ /** Vercel Connect's user tokens for `connector`: the subject is the board's principal, so Connect binds the account to it. */
2209
+ declare function connectUserTokens(connector: string): UserTokens;
2210
+ //#endregion
2211
+ //#region src/sync/provider.d.ts
2212
+ declare const ResolvedTarget: z.ZodObject<{
2213
+ target: z.ZodString;
2214
+ channel: z.ZodString;
2215
+ kind: z.ZodEnum<{
2216
+ channel: "channel";
2217
+ thread: "thread";
2218
+ }>;
2219
+ }, z.core.$strict>;
2220
+ type ResolvedTarget = z.infer<typeof ResolvedTarget>;
2221
+ type SyncClient<E extends ProviderEvent = ProviderEvent> = Omit<BoardClient, 'sync'> & {
2222
+ sync(id: string, target: string): ReturnType<BoardClient['sync']>;
2223
+ sync(channel: string, event: E, overrides?: SyncOverrides): Promise<SyncResult>;
2224
+ };
2225
+ type SyncHandler<E extends ProviderEvent> = (args: {
2226
+ event: E;
2227
+ board: SyncClient<E>;
2228
+ /**
2229
+ * The platform's own link to the event's message (Slack's `chat.getPermalink`), fetched on
2230
+ * the first call and kept for the rest of the callback. Null when the event has no single
2231
+ * message or the platform has no links. It only reads the URL: nothing is synced or joined.
2232
+ */
2233
+ permalink(): Promise<string | null>;
2234
+ }) => unknown;
2235
+ type SyncContext = {
2236
+ id: string;
2237
+ key: string;
2238
+ event: ExternalEvent;
2239
+ raw: unknown;
2240
+ board: BoardClient;
2241
+ client<E extends ProviderEvent>(event: E): SyncClient<E>;
2242
+ apply(channel: string, overrides?: SyncOverrides): Promise<SyncResult>;
2243
+ };
2244
+ type ProviderMapping = {
2245
+ channel?: string;
2246
+ run?: (context: SyncContext) => unknown;
2247
+ };
2248
+ type RenderInput = {
2249
+ /** The message as clients see it: its IDs are refs. */
2250
+ message: Readonly<MessageView>;
2251
+ author: Readonly<Actor> | null;
2252
+ /** How this platform mentions an actor, through linked accounts; null when it can't. */
2253
+ mentionOf: (actor: string) => string | null;
2254
+ label: string;
2255
+ target: string;
2256
+ };
2257
+ type EventMapping<E extends ProviderEvent> = string | SyncHandler<E> | {
2258
+ channel: string;
2259
+ run: SyncHandler<E>;
2260
+ };
2261
+ type FileDelivery = {
2262
+ message: string;
2263
+ files: string[];
2264
+ };
2265
+ /** What a linked message said, or why the platform wouldn't say. */
2266
+ type FetchedLink = Pick<Link, 'snapshot' | 'unavailable'>;
2267
+ /** A file to send: its bytes (a Node `Buffer` is one), its name, and its type. */
2268
+ type ProviderFile = {
2269
+ data: Uint8Array;
2270
+ filename: string;
2271
+ mimeType?: string;
2272
+ };
2273
+ /**
2274
+ * Who a post is from, for a platform that can show it as the sender (Slack's per-message
2275
+ * username and icon): `name` is the label the text opens with (`**name**: …`).
2276
+ */
2277
+ type ProviderSender = {
2278
+ name: string;
2279
+ avatar: string | null;
2280
+ };
2281
+ type ProviderPost = {
2282
+ markdown: string;
2283
+ files?: ProviderFile[];
2284
+ as?: ProviderSender;
2285
+ };
2286
+ type ProviderDelivery = {
2287
+ thread: string;
2288
+ message: string;
2289
+ files?: string[];
2290
+ };
2291
+ type ProviderOptions = {
2292
+ platform: string;
2293
+ canStartThreads?: boolean;
2294
+ singleReaction?: boolean;
2295
+ uploadsFiles?: boolean;
2296
+ render?: (input: RenderInput) => string;
2297
+ /** People's own tokens, to post as them and to link accounts by signing in. */
2298
+ users?: UserTokens | null;
2299
+ };
2300
+ declare const ReceivedEvent: z.ZodObject<{
2301
+ event: z.ZodDiscriminatedUnion<[z.ZodObject<{
2302
+ channel: z.ZodString;
2303
+ thread: z.ZodString;
2304
+ subthread: z.ZodNullable<z.ZodString>;
2305
+ kind: z.ZodLiteral<"message">;
2306
+ message: z.ZodString;
2307
+ isRoot: z.ZodBoolean;
2308
+ text: z.ZodString;
2309
+ context: z.ZodNullable<z.ZodString>;
2310
+ author: z.ZodObject<{
2311
+ id: z.ZodString;
2312
+ handle: z.ZodString;
2313
+ name: z.ZodString;
2314
+ avatar: z.ZodNullable<z.ZodString>;
2315
+ isBot: z.ZodBoolean;
2316
+ }, z.core.$strip>;
2317
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
2318
+ type: z.ZodEnum<{
2319
+ audio: "audio";
2320
+ file: "file";
2321
+ image: "image";
2322
+ video: "video";
2323
+ }>;
2324
+ name: z.ZodOptional<z.ZodString>;
2325
+ mimeType: z.ZodOptional<z.ZodString>;
2326
+ size: z.ZodOptional<z.ZodNumber>;
2327
+ url: z.ZodOptional<z.ZodString>;
2328
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2329
+ }, z.core.$strip>>>;
2330
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
2331
+ url: z.ZodString;
2332
+ thread: z.ZodString;
2333
+ message: z.ZodString;
2334
+ snapshot: z.ZodNullable<z.ZodObject<{
2335
+ author: z.ZodString;
2336
+ text: z.ZodString;
2337
+ createdAt: z.ZodNullable<z.ZodString>;
2338
+ files: z.ZodArray<z.ZodObject<{
2339
+ name: z.ZodString;
2340
+ url: z.ZodNullable<z.ZodString>;
2341
+ }, z.core.$strip>>;
2342
+ }, z.core.$strip>>;
2343
+ }, z.core.$strip>>>;
2344
+ }, z.core.$strip>, z.ZodObject<{
2345
+ channel: z.ZodString;
2346
+ thread: z.ZodString;
2347
+ subthread: z.ZodNullable<z.ZodString>;
2348
+ kind: z.ZodLiteral<"edited">;
2349
+ message: z.ZodString;
2350
+ text: z.ZodString;
2351
+ author: z.ZodObject<{
2352
+ id: z.ZodString;
2353
+ handle: z.ZodString;
2354
+ name: z.ZodString;
2355
+ avatar: z.ZodNullable<z.ZodString>;
2356
+ isBot: z.ZodBoolean;
2357
+ }, z.core.$strip>;
2358
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
2359
+ url: z.ZodString;
2360
+ thread: z.ZodString;
2361
+ message: z.ZodString;
2362
+ snapshot: z.ZodNullable<z.ZodObject<{
2363
+ author: z.ZodString;
2364
+ text: z.ZodString;
2365
+ createdAt: z.ZodNullable<z.ZodString>;
2366
+ files: z.ZodArray<z.ZodObject<{
2367
+ name: z.ZodString;
2368
+ url: z.ZodNullable<z.ZodString>;
2369
+ }, z.core.$strip>>;
2370
+ }, z.core.$strip>>;
2371
+ }, z.core.$strip>>>;
2372
+ linksOnly: z.ZodOptional<z.ZodBoolean>;
2373
+ }, z.core.$strip>, z.ZodObject<{
2374
+ channel: z.ZodString;
2375
+ thread: z.ZodString;
2376
+ subthread: z.ZodNullable<z.ZodString>;
2377
+ kind: z.ZodLiteral<"deleted">;
2378
+ message: z.ZodString;
2379
+ }, z.core.$strip>, z.ZodObject<{
2380
+ channel: z.ZodString;
2381
+ thread: z.ZodString;
2382
+ subthread: z.ZodNullable<z.ZodString>;
2383
+ kind: z.ZodLiteral<"reaction">;
2384
+ message: z.ZodString;
2385
+ emoji: z.ZodString;
2386
+ added: z.ZodBoolean;
2387
+ author: z.ZodObject<{
2388
+ id: z.ZodString;
2389
+ handle: z.ZodString;
2390
+ name: z.ZodString;
2391
+ avatar: z.ZodNullable<z.ZodString>;
2392
+ isBot: z.ZodBoolean;
2393
+ }, z.core.$strip>;
2394
+ }, z.core.$strip>, z.ZodObject<{
2395
+ channel: z.ZodString;
2396
+ thread: z.ZodString;
2397
+ kind: z.ZodLiteral<"lifecycle">;
2398
+ type: z.ZodString;
2399
+ title: z.ZodString;
2400
+ url: z.ZodNullable<z.ZodString>;
2401
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
2402
+ unset: z.ZodArray<z.ZodString>;
2403
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
2404
+ reply: z.ZodNullable<z.ZodString>;
2405
+ createRoot: z.ZodBoolean;
2406
+ author: z.ZodObject<{
2407
+ id: z.ZodString;
2408
+ handle: z.ZodString;
2409
+ name: z.ZodString;
2410
+ avatar: z.ZodNullable<z.ZodString>;
2411
+ isBot: z.ZodBoolean;
2412
+ }, z.core.$strip>;
2413
+ }, z.core.$strip>], "kind">;
2414
+ raw: z.ZodUnknown;
2415
+ dedupe: z.ZodString;
2416
+ }, z.core.$strip>;
2417
+ type ReceivedEvent = z.infer<typeof ReceivedEvent>;
2418
+ type Receive = (received: ReceivedEvent) => Promise<void>;
2419
+ declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
2420
+ readonly platform: string;
2421
+ readonly canStartThreads: boolean;
2422
+ readonly singleReaction: boolean;
2423
+ readonly uploadsFiles: boolean;
2424
+ readonly mappings: Record<string, ProviderMapping>;
2425
+ /** People's tokens, when the adapter has them: messages they write post as them. */
2426
+ readonly users: UserTokens | null;
2427
+ protected readonly options: ProviderOptions;
2428
+ constructor(options: ProviderOptions);
2429
+ abstract receive(key: string, request: Request, emit: Receive): Promise<Response>;
2430
+ abstract resolveChannel(key: string): Promise<string>;
2431
+ abstract resolveTarget(target: string): Promise<ResolvedTarget>;
2432
+ abstract post(target: string, kind: ResolvedTarget['kind'], body: ProviderPost): Promise<ProviderDelivery>;
2433
+ /** The platform account a person's token belongs to. */
2434
+ whoAmI(_token: string): Promise<ExternalAuthor>;
2435
+ /** `post`, as the person whose token this is. */
2436
+ postAs(_token: string, _target: string, _kind: ResolvedTarget['kind'], _body: ProviderPost): Promise<ProviderDelivery>;
2437
+ editAs(_token: string, _thread: string, _message: string, _body: ProviderPost): Promise<void>;
2438
+ deleteAs(_token: string, _thread: string, _message: string): Promise<void>;
2439
+ findByEmail(_email: string): Promise<ExternalAuthor | null>;
2440
+ mention(_actor: Actor): string | null;
2441
+ fetchRoot(_thread: string): Promise<SyncRoot | null>;
2442
+ fetchFile(_file: ExternalFile): Promise<Uint8Array | null>;
2443
+ /** The platform's own link to an event's message, or null when it has none. */
2444
+ permalink(_event: E): Promise<string | null>;
2445
+ /** A linked message the platform didn't describe, read from the platform. */
2446
+ fetchLink(_link: ExternalLink): Promise<FetchedLink>;
2447
+ /**
2448
+ * A channel or thread, read on demand for whoever asked: nothing is synced,
2449
+ * stored, or joined. Throws `UnreadableError` for what it won't read.
2450
+ */
2451
+ read(_target: string, _options: {
2452
+ limit: number;
2453
+ }): Promise<SourceRead>;
2454
+ edit(_thread: string, _message: string, _body: ProviderPost): Promise<void>;
2455
+ delete(_thread: string, _message: string): Promise<void>;
2456
+ react(_thread: string, _message: string, _emoji: string, _added: boolean): Promise<void>;
2457
+ startTyping(_thread: string, _latest: string | null, _status?: string): Promise<void>;
2458
+ /**
2459
+ * The channel whose inbox a thread's events land in (`slack:C0123ABC` for `slack:C0123ABC:1727.1234`),
2460
+ * worked out without calling the platform. Null when the provider can't tell: a key's inbox then
2461
+ * lists only the mapped channels'.
2462
+ */
2463
+ inboxChannel(_key: string, _thread: string): string | null;
2464
+ deleteFiles(_ids: string[]): Promise<void>;
2465
+ refusesFiles(_error: unknown): boolean;
2466
+ uploadFiles(_thread: string, _files: ProviderFile[]): Promise<FileDelivery>;
2467
+ abstract event(context: Pick<SyncContext, 'id' | 'key' | 'event' | 'raw'>): E;
2468
+ sync(context: SyncContext, channel: string, overrides?: SyncOverrides): Promise<SyncResult>;
2469
+ render(input: RenderInput): string;
2470
+ protected map(key: string, value: EventMapping<E>): void;
2471
+ }
2472
+ //#endregion
2473
+ export { InboxAckBody as $, ThreadSummaryView as $t, PostOptions as A, SchedulesQueryInput as At, ActorView as B, SyncCodeView as Bt, SyncResult as C, ResolvedSyncTarget as Ct, BoardClient as D, ScheduleInput as Dt, eventSchema as E, ScheduleBodyOutput as Et, UploadInput as F, SourceReadQuery as Ft, Discovery as G, SyncFindView as Gt, BoardEventView as H, SyncCopiesView as Ht, WaitOptions as I, SyncAccountBody as It, EventsQuery as J, SyncReceiptBody as Jt, EditBody as K, SyncImportBody as Kt, Written as L, SyncAccountInput as Lt, ReplyOptions as M, SignInQuery as Mt, ScheduleOptions as N, SourceMessage as Nt, BoardError as O, ScheduleView as Ot, ScheduleTiming as P, SourceRead as Pt, IdentityView as Q, SyncUnlinkBody as Qt, duration as R, SyncBody as Rt, SyncOverrides as S, RegistrationView as St, envelope as T, ScheduleBody as Tt, ChannelView as U, SyncFindInput as Ut, ApiError as V, SyncCopiesQuery as Vt, DeleteBody as W, SyncFindQuery as Wt, FiltersInput as X, SyncRootsQuery as Xt, EventsQueryInput as Y, SyncReceiptInput as Yt, IdentityUnlinkBody as Z, SyncThreadView as Zt, connectUserTokens as _, PostInput as _t, ProviderFile as a, TypingResult as an, LabelBody as at, ProviderEvent as b, Ref as bt, Receive as c, routes as cn, MatchView as ct, ResolvedTarget as d, MessageView as dt, ThreadView as en, InboxEntry as et, SyncClient as f, MessagesPage as ft, UserTokens as g, PostBody as gt, SyncProvider as h, PersonView as ht, ProviderDelivery as i, TypingBody as in, InboxQuery as it, ProfileOption as j, SchedulesQueryOutput as jt, Filters as k, SchedulesQuery as kt, ReceivedEvent as l, MatchesQuery as lt, SyncHandler as m, MessagesQueryInput as mt, FetchedLink as n, ThreadsQuery as nn, InboxNextQuery as nt, ProviderOptions as o, UploadStartBody as on, LinkView as ot, SyncContext as p, MessagesQuery as pt, EventsPage as q, SyncImportInput as qt, FileDelivery as r, ThreadsQueryInput as rn, InboxPushBody as rt, ProviderPost as s, UploadTicket as sn, LinkedAccount as st, EventMapping as t, ThreadsPage as tn, InboxItem as tt, RenderInput as u, Me as ut, withUserTokens as v, REGISTERED_WATCHERS_MAX as vt, SyncRoot as w, RouteName as wt, RootOverride as x, RegisterBody as xt, EventBase as y, ReactBody as yt, AckBody as z, SyncCodeBody as zt };