@vercel/board 0.32.0 → 0.34.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 (167) hide show
  1. package/README.md +25 -20
  2. package/dist/{access-CY5xVMIK.mjs → access-CdBcYPQH.mjs} +170 -13
  3. package/dist/access.d.mts +4 -5
  4. package/dist/access.mjs +5 -5
  5. package/dist/{actors-Bm-ojWWT.mjs → actors-MrIEr9LI.mjs} +3 -3
  6. package/dist/auth-DjoJygbG.mjs +599 -0
  7. package/dist/{auth-K8dY1nBY.d.mts → auth-aaoKt5DK.d.mts} +133 -100
  8. package/dist/backend-local.d.mts +28 -0
  9. package/dist/backend-local.mjs +2 -0
  10. package/dist/{backend-DxE9wGKm.d.mts → backend-u1sVvybh.d.mts} +108 -55
  11. package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
  12. package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-De0iDnUB.d.mts} +2 -3
  13. package/dist/cli-commands.d.mts +1 -1
  14. package/dist/cli-commands.mjs +1 -1
  15. package/dist/cli-embedded.d.mts +2 -2
  16. package/dist/cli-embedded.mjs +1 -1
  17. package/dist/cli.mjs +6 -6
  18. package/dist/{commands-DsnQKTdB.mjs → commands-B8oZEByR.mjs} +37 -52
  19. package/dist/{commands-CpyPV_tk.d.mts → commands-BkVMdXP1.d.mts} +9 -6
  20. package/dist/{conformance-3RBKxwbp.mjs → conformance-gqYBkXFS.mjs} +79 -86
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-DurYIRt8.mjs → engine-rtOVWsiF.mjs} +6 -8
  24. package/dist/{errors-CJXhhzvT.mjs → errors-D8ifv16L.mjs} +75 -6
  25. package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
  26. package/dist/exports-Bx2dGpzr.mjs +3252 -0
  27. package/dist/exports-uwRl5qIj.d.mts +4 -0
  28. package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
  29. package/dist/index-D6mK0Ial.d.mts +11 -0
  30. package/dist/index.d.mts +10 -9
  31. package/dist/index.mjs +21 -8
  32. package/dist/index.node.d.mts +6 -7
  33. package/dist/index.node.mjs +3 -3
  34. package/dist/inspect/app.js +95 -95
  35. package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
  36. package/dist/local-CPz22MQ8.mjs +9225 -0
  37. package/dist/{main-CcYDo9Hb.mjs → main-DScDKwQN.mjs} +129 -54
  38. package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
  39. package/dist/middleware-BjYpk4yq.mjs +103 -0
  40. package/dist/{provider-gynDUoyW.d.mts → provider-hB8QNrwm.d.mts} +369 -3
  41. package/dist/{client-COfYrgfV.d.mts → routes-De4W6lEs.d.mts} +997 -367
  42. package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
  43. package/dist/{serve-Bplieh0C.mjs → serve-B1noQRkn.mjs} +33 -24
  44. package/dist/{node-BgeGcwX0.mjs → server-Ov6GBJ8j.mjs} +419 -6
  45. package/dist/{serving-Y7s7VDjB.mjs → serving-2s7lqSBS.mjs} +1 -1
  46. package/dist/{sql-E1K5g_ih.mjs → sql-BQzKUqQt.mjs} +349 -114
  47. package/dist/sqlite-DCtZFEVm.mjs +30 -0
  48. package/dist/{sqlite-db-CzcD_FW8.mjs → sqlite-db-qLTs52Ny.mjs} +2 -3
  49. package/dist/{store-codec-pAG2oPgQ-SqDXlPBR.mjs → store-N8PXxDAS-BdL4Sq-f.mjs} +6 -2
  50. package/dist/{store-memory-B0PkVSuQ.mjs → store-memory-CKQVEzXN.mjs} +2 -4
  51. package/dist/store-memory-OdGsc-t_.mjs +2 -0
  52. package/dist/{store-polling-BZt2Rf3D-Div-bJ_D.mjs → store-polling-BZt2Rf3D-oh3aU_An.mjs} +1 -1
  53. package/dist/store-sqlite-CTxAVCcz.mjs +2 -0
  54. package/dist/{store-sqlite-D85t3tE7.mjs → store-sqlite-D6fIszST.mjs} +3 -4
  55. package/dist/sync-chat-sdk.d.mts +2 -2
  56. package/dist/sync-chat-sdk.mjs +2 -2
  57. package/dist/sync-github.d.mts +2 -2
  58. package/dist/sync-github.mjs +2 -2
  59. package/dist/sync-linear.d.mts +3 -3
  60. package/dist/sync-linear.mjs +2 -2
  61. package/dist/sync-slack.d.mts +3 -3
  62. package/dist/sync-slack.mjs +4 -4
  63. package/dist/sync.d.mts +2 -2
  64. package/dist/sync.mjs +2 -2
  65. package/dist/{watchers-hash-CurCzwhe.mjs → targets-aMdbp84G.mjs} +134 -16
  66. package/dist/{tokens-C7kYyrAG.mjs → tokens-LHLrnV_P.mjs} +15 -43
  67. package/docs/01-board/01-mounting.md +245 -288
  68. package/docs/01-board/03-identity.md +42 -50
  69. package/docs/01-board/04-messages.md +15 -14
  70. package/docs/01-board/05-reading.md +3 -3
  71. package/docs/01-board/06-watchers.md +58 -105
  72. package/docs/01-board/07-schedules.md +21 -41
  73. package/docs/01-board/08-middleware.md +11 -17
  74. package/docs/01-board/09-access.md +187 -343
  75. package/docs/01-board/10-local.md +81 -0
  76. package/docs/01-quickstart.md +49 -126
  77. package/docs/02-sync/01-overview.md +25 -80
  78. package/docs/02-sync/02-functions.md +10 -16
  79. package/docs/02-sync/03-slack.md +13 -26
  80. package/docs/02-sync/04-github.md +8 -20
  81. package/docs/02-sync/07-linear.md +6 -10
  82. package/docs/03-guides/02-inspector.md +3 -3
  83. package/docs/03-guides/03-ci.md +88 -128
  84. package/docs/03-guides/04-triage.md +7 -15
  85. package/docs/03-guides/05-agent-factory.md +29 -36
  86. package/docs/04-reference/01-cli.md +113 -38
  87. package/docs/04-reference/02-board.md +79 -82
  88. package/docs/04-reference/03-http.md +138 -69
  89. package/docs/04-reference/05-conformance.md +32 -46
  90. package/docs/index.md +41 -65
  91. package/package.json +12 -83
  92. package/dist/a2-DiDc77Uf.mjs +0 -4238
  93. package/dist/access-DPcrKIH_.d.mts +0 -37
  94. package/dist/auth-8pRZnF1M.mjs +0 -393
  95. package/dist/backend-a2/blob-vercel.d.mts +0 -8
  96. package/dist/backend-a2/blob-vercel.mjs +0 -81
  97. package/dist/backend-a2/contract.d.mts +0 -828
  98. package/dist/backend-a2/contract.mjs +0 -5
  99. package/dist/backend-a2/scheduler-local.d.mts +0 -11
  100. package/dist/backend-a2/scheduler-local.mjs +0 -2
  101. package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
  102. package/dist/backend-a2/scheduler-qstash.mjs +0 -522
  103. package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
  104. package/dist/backend-a2/scheduler-vercel.mjs +0 -204
  105. package/dist/backend-a2/store-memory.d.mts +0 -11
  106. package/dist/backend-a2/store-postgres.d.mts +0 -38
  107. package/dist/backend-a2/store-postgres.mjs +0 -2977
  108. package/dist/backend-a2/store-redis-http.d.mts +0 -17
  109. package/dist/backend-a2/store-redis-http.mjs +0 -520
  110. package/dist/backend-a2/store-redis.d.mts +0 -31
  111. package/dist/backend-a2/store-redis.mjs +0 -88
  112. package/dist/backend-a2/store-sqlite.d.mts +0 -12
  113. package/dist/backend-a2/store-sqlite.mjs +0 -31
  114. package/dist/backend-a2.d.mts +0 -2633
  115. package/dist/backend-a2.mjs +0 -3
  116. package/dist/backend-http-CaN06CaD.d.mts +0 -672
  117. package/dist/backend-http-CoaCghuJ.mjs +0 -18
  118. package/dist/backend-http-l5A8UmL-.mjs +0 -585
  119. package/dist/backend-http.d.mts +0 -10
  120. package/dist/backend-http.mjs +0 -2
  121. package/dist/backend-http.node.d.mts +0 -10
  122. package/dist/backend-http.node.mjs +0 -2
  123. package/dist/backend-vercel-BE65okBC.mjs +0 -86
  124. package/dist/backend-vercel-CVxoTNF2.mjs +0 -1744
  125. package/dist/backend-vercel-jg-6PAgD.d.mts +0 -674
  126. package/dist/backend-vercel.d.mts +0 -9
  127. package/dist/backend-vercel.mjs +0 -11
  128. package/dist/backend-vercel.node.d.mts +0 -17
  129. package/dist/backend-vercel.node.mjs +0 -2
  130. package/dist/blob-Bx8QPWEd.d.mts +0 -40
  131. package/dist/blob-WbB2DJKn.mjs +0 -201
  132. package/dist/errors-2vGs49Db.d.mts +0 -16
  133. package/dist/exports-BnUZuRm9.mjs +0 -1389
  134. package/dist/exports-u5mApVvn.d.mts +0 -5
  135. package/dist/files-SniSmeEr.mjs +0 -47
  136. package/dist/folds-DLUzfibJ.d.mts +0 -558
  137. package/dist/folds-DsWfIftc.mjs +0 -208
  138. package/dist/index-UXpTPWNc.d.mts +0 -11
  139. package/dist/index.default-Dp8gexln.mjs +0 -12
  140. package/dist/local-C76Fy5ad.mjs +0 -44
  141. package/dist/middleware-BavYSDUa.mjs +0 -62
  142. package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
  143. package/dist/project-4Vl7_uy5.mjs +0 -124
  144. package/dist/redis-tables-BFRj_SEJ.mjs +0 -3895
  145. package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
  146. package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
  147. package/dist/reducers-DQVSP3kk.mjs +0 -538
  148. package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
  149. package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
  150. package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
  151. package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
  152. package/dist/server-wIpAEjpX.mjs +0 -17
  153. package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
  154. package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
  155. package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
  156. package/dist/store-memory-4IBl0Ztu.mjs +0 -2
  157. package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
  158. package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
  159. package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
  160. package/dist/targets-Cgjs29T0.mjs +0 -33
  161. package/dist/types-CmrFjpml.d.mts +0 -102
  162. package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
  163. package/docs/01-board/02-database.md +0 -258
  164. package/docs/04-reference/04-log.md +0 -247
  165. package/sql/postgres/board.sql +0 -145
  166. package/sql/postgres/notifications.sql +0 -24
  167. package/sql/postgres/schema.sql +0 -451
@@ -1,10 +1,646 @@
1
- import { n as AccessSummary, r as Can } from "./access-DPcrKIH_.mjs";
2
- import { a as ExternalCopy, g as BoardEvent, o as Message, p as Link, r as Channel, t as Actor, u as ExternalEvent, x as Attachment } from "./folds-DLUzfibJ.mjs";
3
1
  import { z } from "zod";
2
+ //#region src/contract/external.d.ts
3
+ /** Where a message came from on a platform. `thread` is grouped (GitHub review threads fold into their PR). */
4
+ declare const Origin: z.ZodObject<{
5
+ channel: z.ZodOptional<z.ZodString>;
6
+ thread: z.ZodString;
7
+ subthread: z.ZodNullable<z.ZodString>;
8
+ message: z.ZodString;
9
+ context: z.ZodNullable<z.ZodString>;
10
+ }, z.core.$strip>;
11
+ /**
12
+ * A platform message linked from a message (a Slack permalink): the board message
13
+ * it was synced to, if any, and a snapshot of it, or why the board couldn't read it.
14
+ */
15
+ declare const Link: z.ZodObject<{
16
+ url: z.ZodString;
17
+ message: z.ZodNullable<z.ZodNumber>;
18
+ snapshot: z.ZodNullable<z.ZodObject<{
19
+ author: z.ZodString;
20
+ text: z.ZodString;
21
+ createdAt: z.ZodNullable<z.ZodString>;
22
+ files: z.ZodArray<z.ZodObject<{
23
+ name: z.ZodString;
24
+ url: z.ZodNullable<z.ZodString>;
25
+ }, z.core.$strip>>;
26
+ }, z.core.$strip>>;
27
+ unavailable: z.ZodNullable<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ type Link = z.infer<typeof Link>;
30
+ type Origin = z.infer<typeof Origin>;
31
+ declare const ExternalAuthor: z.ZodObject<{
32
+ id: z.ZodString;
33
+ handle: z.ZodString;
34
+ name: z.ZodString;
35
+ avatar: z.ZodNullable<z.ZodString>;
36
+ isBot: z.ZodBoolean;
37
+ }, z.core.$strip>;
38
+ /**
39
+ * A file on a platform message, as Chat SDK describes it: enough for the
40
+ * platform's adapter to fetch it later (`rehydrateAttachment`), never the bytes.
41
+ */
42
+ declare const ExternalFile: z.ZodObject<{
43
+ type: z.ZodEnum<{
44
+ audio: "audio";
45
+ file: "file";
46
+ image: "image";
47
+ video: "video";
48
+ }>;
49
+ name: z.ZodOptional<z.ZodString>;
50
+ mimeType: z.ZodOptional<z.ZodString>;
51
+ size: z.ZodOptional<z.ZodNumber>;
52
+ url: z.ZodOptional<z.ZodString>;
53
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
54
+ }, z.core.$strip>;
55
+ type ExternalFile = z.infer<typeof ExternalFile>;
56
+ /**
57
+ * A platform message a platform message links to, at intake: where it lives
58
+ * (`thread`, with the sync key prefix, and `message`), and what it said when the
59
+ * platform sent that along (Slack's unfurl).
60
+ */
61
+ declare const ExternalLink: z.ZodObject<{
62
+ url: z.ZodString;
63
+ thread: z.ZodString;
64
+ message: z.ZodString;
65
+ snapshot: z.ZodNullable<z.ZodObject<{
66
+ author: z.ZodString;
67
+ text: z.ZodString;
68
+ createdAt: z.ZodNullable<z.ZodString>;
69
+ files: z.ZodArray<z.ZodObject<{
70
+ name: z.ZodString;
71
+ url: z.ZodNullable<z.ZodString>;
72
+ }, z.core.$strip>>;
73
+ }, z.core.$strip>>;
74
+ }, z.core.$strip>;
75
+ type ExternalLink = z.infer<typeof ExternalLink>;
76
+ /** A platform event, normalized at intake. Thread IDs are external IDs with the sync key prefix. */
77
+ declare const ExternalEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
78
+ channel: z.ZodString;
79
+ thread: z.ZodString;
80
+ subthread: z.ZodNullable<z.ZodString>;
81
+ kind: z.ZodLiteral<"message">;
82
+ message: z.ZodString;
83
+ isRoot: z.ZodBoolean;
84
+ text: z.ZodString;
85
+ context: z.ZodNullable<z.ZodString>;
86
+ author: z.ZodObject<{
87
+ id: z.ZodString;
88
+ handle: z.ZodString;
89
+ name: z.ZodString;
90
+ avatar: z.ZodNullable<z.ZodString>;
91
+ isBot: z.ZodBoolean;
92
+ }, z.core.$strip>;
93
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
94
+ type: z.ZodEnum<{
95
+ audio: "audio";
96
+ file: "file";
97
+ image: "image";
98
+ video: "video";
99
+ }>;
100
+ name: z.ZodOptional<z.ZodString>;
101
+ mimeType: z.ZodOptional<z.ZodString>;
102
+ size: z.ZodOptional<z.ZodNumber>;
103
+ url: z.ZodOptional<z.ZodString>;
104
+ fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
105
+ }, z.core.$strip>>>;
106
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
107
+ url: z.ZodString;
108
+ thread: z.ZodString;
109
+ message: z.ZodString;
110
+ snapshot: z.ZodNullable<z.ZodObject<{
111
+ author: z.ZodString;
112
+ text: z.ZodString;
113
+ createdAt: z.ZodNullable<z.ZodString>;
114
+ files: z.ZodArray<z.ZodObject<{
115
+ name: z.ZodString;
116
+ url: z.ZodNullable<z.ZodString>;
117
+ }, z.core.$strip>>;
118
+ }, z.core.$strip>>;
119
+ }, z.core.$strip>>>;
120
+ }, z.core.$strip>, z.ZodObject<{
121
+ channel: z.ZodString;
122
+ thread: z.ZodString;
123
+ subthread: z.ZodNullable<z.ZodString>;
124
+ kind: z.ZodLiteral<"edited">;
125
+ message: z.ZodString;
126
+ text: z.ZodString;
127
+ author: z.ZodObject<{
128
+ id: z.ZodString;
129
+ handle: z.ZodString;
130
+ name: z.ZodString;
131
+ avatar: z.ZodNullable<z.ZodString>;
132
+ isBot: z.ZodBoolean;
133
+ }, z.core.$strip>;
134
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
135
+ url: z.ZodString;
136
+ thread: z.ZodString;
137
+ message: z.ZodString;
138
+ snapshot: z.ZodNullable<z.ZodObject<{
139
+ author: z.ZodString;
140
+ text: z.ZodString;
141
+ createdAt: z.ZodNullable<z.ZodString>;
142
+ files: z.ZodArray<z.ZodObject<{
143
+ name: z.ZodString;
144
+ url: z.ZodNullable<z.ZodString>;
145
+ }, z.core.$strip>>;
146
+ }, z.core.$strip>>;
147
+ }, z.core.$strip>>>;
148
+ linksOnly: z.ZodOptional<z.ZodBoolean>;
149
+ }, z.core.$strip>, z.ZodObject<{
150
+ channel: z.ZodString;
151
+ thread: z.ZodString;
152
+ subthread: z.ZodNullable<z.ZodString>;
153
+ kind: z.ZodLiteral<"deleted">;
154
+ message: z.ZodString;
155
+ }, z.core.$strip>, z.ZodObject<{
156
+ channel: z.ZodString;
157
+ thread: z.ZodString;
158
+ subthread: z.ZodNullable<z.ZodString>;
159
+ kind: z.ZodLiteral<"reaction">;
160
+ message: z.ZodString;
161
+ emoji: z.ZodString;
162
+ added: z.ZodBoolean;
163
+ author: z.ZodObject<{
164
+ id: z.ZodString;
165
+ handle: z.ZodString;
166
+ name: z.ZodString;
167
+ avatar: z.ZodNullable<z.ZodString>;
168
+ isBot: z.ZodBoolean;
169
+ }, z.core.$strip>;
170
+ }, z.core.$strip>, z.ZodObject<{
171
+ channel: z.ZodString;
172
+ thread: z.ZodString;
173
+ kind: z.ZodLiteral<"lifecycle">;
174
+ type: z.ZodString;
175
+ title: z.ZodString;
176
+ url: z.ZodNullable<z.ZodString>;
177
+ body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
178
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
179
+ unset: z.ZodArray<z.ZodString>;
180
+ owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
181
+ reply: z.ZodNullable<z.ZodString>;
182
+ createRoot: z.ZodBoolean;
183
+ retitled: z.ZodOptional<z.ZodBoolean>;
184
+ author: z.ZodObject<{
185
+ id: z.ZodString;
186
+ handle: z.ZodString;
187
+ name: z.ZodString;
188
+ avatar: z.ZodNullable<z.ZodString>;
189
+ isBot: z.ZodBoolean;
190
+ }, z.core.$strip>;
191
+ }, z.core.$strip>], "kind">;
192
+ type ExternalEvent = z.infer<typeof ExternalEvent>;
193
+ type ExternalAuthor = z.infer<typeof ExternalAuthor>;
194
+ //#endregion
195
+ //#region src/contract/events.d.ts
196
+ /** The board's one log. Every board fact is an event in session `board`. */
197
+ declare const boardEvents: {
198
+ 'message.posted': z.ZodObject<{
199
+ channel: z.ZodString;
200
+ text: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
201
+ re: z.ZodNullable<z.ZodNumber>;
202
+ replyTo: z.ZodNullable<z.ZodNumber>;
203
+ thread: z.ZodString;
204
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
205
+ noSync: z.ZodBoolean;
206
+ mentions: z.ZodArray<z.ZodString>;
207
+ by: z.ZodObject<{
208
+ actor: z.ZodString;
209
+ principal: z.ZodString;
210
+ profile: z.ZodNullable<z.ZodString>;
211
+ session: z.ZodNullable<z.ZodString>;
212
+ }, z.core.$strip>;
213
+ origin: z.ZodNullable<z.ZodObject<{
214
+ channel: z.ZodOptional<z.ZodString>;
215
+ thread: z.ZodString;
216
+ subthread: z.ZodNullable<z.ZodString>;
217
+ message: z.ZodString;
218
+ context: z.ZodNullable<z.ZodString>;
219
+ }, z.core.$strip>>;
220
+ from: z.ZodNullable<z.ZodString>;
221
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
222
+ id: z.ZodString;
223
+ name: z.ZodString;
224
+ type: z.ZodString;
225
+ size: z.ZodNumber;
226
+ }, z.core.$strip>>>;
227
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
228
+ url: z.ZodString;
229
+ message: z.ZodNullable<z.ZodNumber>;
230
+ snapshot: z.ZodNullable<z.ZodObject<{
231
+ author: z.ZodString;
232
+ text: z.ZodString;
233
+ createdAt: z.ZodNullable<z.ZodString>;
234
+ files: z.ZodArray<z.ZodObject<{
235
+ name: z.ZodString;
236
+ url: z.ZodNullable<z.ZodString>;
237
+ }, z.core.$strip>>;
238
+ }, z.core.$strip>>;
239
+ unavailable: z.ZodNullable<z.ZodString>;
240
+ }, z.core.$strip>>>;
241
+ schedule: z.ZodOptional<z.ZodObject<{
242
+ id: z.ZodNumber;
243
+ n: z.ZodNumber;
244
+ }, z.core.$strip>>;
245
+ blind: z.ZodOptional<z.ZodLiteral<true>>;
246
+ importedBy: z.ZodOptional<z.ZodString>;
247
+ }, z.core.$strip>;
248
+ /**
249
+ * A channel made before anything posted to it. A post makes one too, with no event of its own:
250
+ * this is only for one that's empty. It names no message, so it carries no `id`.
251
+ */
252
+ 'channel.created': z.ZodObject<{
253
+ channel: z.ZodString;
254
+ by: z.ZodObject<{
255
+ actor: z.ZodString;
256
+ principal: z.ZodString;
257
+ profile: z.ZodNullable<z.ZodString>;
258
+ session: z.ZodNullable<z.ZodString>;
259
+ }, z.core.$strip>;
260
+ }, z.core.$strip>;
261
+ /** A message's links changed: an edit linked something new, or the platform sent what a link says. */
262
+ 'message.linked': z.ZodObject<{
263
+ id: z.ZodNumber;
264
+ thread: z.ZodString;
265
+ links: z.ZodArray<z.ZodObject<{
266
+ url: z.ZodString;
267
+ message: z.ZodNullable<z.ZodNumber>;
268
+ snapshot: z.ZodNullable<z.ZodObject<{
269
+ author: z.ZodString;
270
+ text: z.ZodString;
271
+ createdAt: z.ZodNullable<z.ZodString>;
272
+ files: z.ZodArray<z.ZodObject<{
273
+ name: z.ZodString;
274
+ url: z.ZodNullable<z.ZodString>;
275
+ }, z.core.$strip>>;
276
+ }, z.core.$strip>>;
277
+ unavailable: z.ZodNullable<z.ZodString>;
278
+ }, z.core.$strip>>;
279
+ by: z.ZodObject<{
280
+ actor: z.ZodString;
281
+ principal: z.ZodString;
282
+ profile: z.ZodNullable<z.ZodString>;
283
+ session: z.ZodNullable<z.ZodString>;
284
+ }, z.core.$strip>;
285
+ from: z.ZodNullable<z.ZodString>;
286
+ }, z.core.$strip>;
287
+ 'message.edited': z.ZodObject<{
288
+ id: z.ZodNumber;
289
+ thread: z.ZodString;
290
+ text: z.ZodString;
291
+ mentions: z.ZodArray<z.ZodString>;
292
+ by: z.ZodObject<{
293
+ actor: z.ZodString;
294
+ principal: z.ZodString;
295
+ profile: z.ZodNullable<z.ZodString>;
296
+ session: z.ZodNullable<z.ZodString>;
297
+ }, z.core.$strip>;
298
+ from: z.ZodNullable<z.ZodString>;
299
+ }, z.core.$strip>;
300
+ 'message.deleted': z.ZodObject<{
301
+ id: z.ZodNumber;
302
+ thread: z.ZodString;
303
+ by: z.ZodObject<{
304
+ actor: z.ZodString;
305
+ principal: z.ZodString;
306
+ profile: z.ZodNullable<z.ZodString>;
307
+ session: z.ZodNullable<z.ZodString>;
308
+ }, z.core.$strip>;
309
+ from: z.ZodNullable<z.ZodString>;
310
+ }, z.core.$strip>;
311
+ 'reaction.added': z.ZodObject<{
312
+ id: z.ZodNumber;
313
+ thread: z.ZodString;
314
+ emoji: z.ZodString;
315
+ by: z.ZodObject<{
316
+ actor: z.ZodString;
317
+ principal: z.ZodString;
318
+ profile: z.ZodNullable<z.ZodString>;
319
+ session: z.ZodNullable<z.ZodString>;
320
+ }, z.core.$strip>;
321
+ from: z.ZodNullable<z.ZodString>;
322
+ }, z.core.$strip>;
323
+ 'reaction.removed': z.ZodObject<{
324
+ id: z.ZodNumber;
325
+ thread: z.ZodString;
326
+ emoji: z.ZodString;
327
+ by: z.ZodObject<{
328
+ actor: z.ZodString;
329
+ principal: z.ZodString;
330
+ profile: z.ZodNullable<z.ZodString>;
331
+ session: z.ZodNullable<z.ZodString>;
332
+ }, z.core.$strip>;
333
+ from: z.ZodNullable<z.ZodString>;
334
+ }, z.core.$strip>;
335
+ 'labels.changed': z.ZodObject<{
336
+ id: z.ZodNumber;
337
+ thread: z.ZodString;
338
+ set: z.ZodRecord<z.ZodString, z.ZodString>;
339
+ unset: z.ZodArray<z.ZodString>;
340
+ by: z.ZodObject<{
341
+ actor: z.ZodString;
342
+ principal: z.ZodString;
343
+ profile: z.ZodNullable<z.ZodString>;
344
+ session: z.ZodNullable<z.ZodString>;
345
+ }, z.core.$strip>;
346
+ }, z.core.$strip>;
347
+ /** A thread is synced with an external channel (start a thread there) or thread (join it). */
348
+ 'thread.synced': z.ZodObject<{
349
+ thread: z.ZodString;
350
+ target: z.ZodString;
351
+ cause: z.ZodEnum<{
352
+ config: "config";
353
+ request: "request";
354
+ }>;
355
+ kind: z.ZodOptional<z.ZodEnum<{
356
+ channel: "channel";
357
+ thread: "thread";
358
+ }>>;
359
+ by: z.ZodObject<{
360
+ actor: z.ZodString;
361
+ principal: z.ZodString;
362
+ profile: z.ZodNullable<z.ZodString>;
363
+ session: z.ZodNullable<z.ZodString>;
364
+ }, z.core.$strip>;
365
+ }, z.core.$strip>;
366
+ /** An outbound delivery receipt: board message `id` exists on the platform as `external`. */
367
+ 'message.synced': z.ZodObject<{
368
+ id: z.ZodNumber;
369
+ thread: z.ZodString;
370
+ target: z.ZodString;
371
+ external: z.ZodObject<{
372
+ thread: z.ZodString;
373
+ message: z.ZodString;
374
+ }, z.core.$strip>;
375
+ syncedBy: z.ZodOptional<z.ZodString>;
376
+ }, z.core.$strip>;
377
+ /**
378
+ * Board message `id`'s files reached `target` after its text: `files` are the
379
+ * platform's IDs for them, or null when the platform refused files and the
380
+ * text got a line for each instead.
381
+ */
382
+ 'message.files_synced': z.ZodObject<{
383
+ id: z.ZodNumber;
384
+ thread: z.ZodString;
385
+ target: z.ZodString;
386
+ files: z.ZodNullable<z.ZodArray<z.ZodString>>;
387
+ syncedBy: z.ZodOptional<z.ZodString>;
388
+ }, z.core.$strip>;
389
+ /** A delivery that gave up: board message `id` didn't reach `target`, and `error` says why. */
390
+ 'message.sync_failed': z.ZodObject<{
391
+ id: z.ZodNumber;
392
+ thread: z.ZodString;
393
+ target: z.ZodString;
394
+ error: z.ZodString;
395
+ }, z.core.$strip>;
396
+ 'actor.seen': z.ZodObject<{
397
+ actor: z.ZodString;
398
+ kind: z.ZodUnion<readonly [z.ZodEnum<{
399
+ agent: "agent";
400
+ deployment: "deployment";
401
+ external: "external";
402
+ person: "person";
403
+ workflow: "workflow";
404
+ }>, z.ZodLiteral<"profile">]>;
405
+ handle: z.ZodString;
406
+ name: z.ZodString;
407
+ avatar: z.ZodNullable<z.ZodString>;
408
+ host: z.ZodOptional<z.ZodLiteral<true>>;
409
+ }, z.core.$strip>;
410
+ };
411
+ type BoardEvents = typeof boardEvents;
412
+ /** One event of the board log, of type `K`, in the shape its log stores it. */
413
+ type BoardEvent<K extends keyof BoardEvents & string = keyof BoardEvents & string> = { [T in keyof BoardEvents & string]: {
414
+ id: string;
415
+ type: T;
416
+ payload: z.output<BoardEvents[T]>;
417
+ index: number;
418
+ sessionId: string;
419
+ createdAt: Date;
420
+ }; }[K];
421
+ //#endregion
422
+ //#region src/contract/schemas.d.ts
423
+ declare const Labels: z.ZodRecord<z.ZodString, z.ZodString>;
424
+ /** What an actor is: a `person`, an `agent` acting for a principal (`--as claude`), a deployment, a workflow, or a platform user (`external`). */
425
+ declare const ActorKind: z.ZodEnum<{
426
+ agent: "agent";
427
+ deployment: "deployment";
428
+ external: "external";
429
+ person: "person";
430
+ workflow: "workflow";
431
+ }>;
432
+ declare const Author: z.ZodObject<{
433
+ actor: z.ZodString;
434
+ principal: z.ZodString;
435
+ profile: z.ZodNullable<z.ZodString>;
436
+ session: z.ZodNullable<z.ZodString>;
437
+ }, z.core.$strip>;
438
+ /** A file on a message. The board records `type` and `size` from what it stored, never from the request. */
439
+ declare const Attachment: z.ZodObject<{
440
+ id: z.ZodString;
441
+ name: z.ZodString;
442
+ type: z.ZodString;
443
+ size: z.ZodNumber;
444
+ }, z.core.$strip>;
445
+ type Labels = z.infer<typeof Labels>;
446
+ type ActorKind = z.infer<typeof ActorKind>;
447
+ type Author = z.infer<typeof Author>;
448
+ type Attachment = z.infer<typeof Attachment>;
449
+ //#endregion
450
+ //#region src/contract/folds.d.ts
451
+ type Message = {
452
+ id: number;
453
+ channel: string;
454
+ text: string;
455
+ re: number | null;
456
+ replyTo: number | null;
457
+ /** The thread key: the root's event ID. */
458
+ thread: string;
459
+ labels: Labels;
460
+ reactions: Record<string, string[]>;
461
+ mentions: string[];
462
+ by: Author;
463
+ noSync: boolean;
464
+ /** Where it came from on a platform, if it did. */
465
+ origin: Origin | null;
466
+ /** The sync key it came from, or null when written on the board. */
467
+ from: string | null;
468
+ createdAt: string;
469
+ editedAt: string | null;
470
+ deleted: boolean;
471
+ /** Sync targets this message didn't reach, with why. A later delivery clears its entry. */
472
+ undelivered: Record<string, string>;
473
+ attachments: Attachment[];
474
+ /** Platform messages it links to (Slack permalinks), each with what it said. */
475
+ links: Link[];
476
+ /** Set when a schedule posted it: the schedule's ID and which send this was, from 0. */
477
+ schedule?: {
478
+ id: number;
479
+ n: number;
480
+ };
481
+ /**
482
+ * Set when its author couldn't read its channel, as `authorizeOwn` checks: where they can't read,
483
+ * it's theirs to edit and delete only then. Its event's payload says so too.
484
+ */
485
+ blind?: true;
486
+ /** The index of the last event that changed it. Folds from before it existed leave it out. */
487
+ version?: number;
488
+ /** The index of its post, or of its last edit or delete. Folds from before it existed leave it out. */
489
+ revision?: number;
490
+ };
491
+ type Channel = {
492
+ path: string;
493
+ lastIndex: number;
494
+ messages: number;
495
+ threads: number;
496
+ };
497
+ type Actor = {
498
+ id: string;
499
+ kind: ActorKind;
500
+ handle: string;
501
+ name: string;
502
+ avatar: string | null;
503
+ /** A host's principal, or one of its profiles: once it's seen as one, it stays one. Views leave it out. */
504
+ host?: true;
505
+ };
506
+ /** A copy of a board message on a platform. */
507
+ /** `files`: the platform's IDs for the message's files, or null when it refused them; unset until they're sent. */
508
+ /** `by`: the principal of the sync elsewhere that recorded it, whose copy it is to change; none for the board's own sync's. */
509
+ type ExternalCopy = {
510
+ thread: string;
511
+ message: string;
512
+ files?: string[] | null;
513
+ by?: string;
514
+ };
515
+ //#endregion
516
+ //#region src/server/access.d.ts
517
+ /**
518
+ * What a principal may do in a channel. `read` covers messages, threads,
519
+ * `/events`, and schedules; `post` starts threads and edits your own messages;
520
+ * `manage` is the board's own bookkeeping (inbox, sources).
521
+ */
522
+ declare const PERMISSIONS: readonly ['read', 'post', 'react', 'label', 'sync', 'manage'];
523
+ /**
524
+ * A `can`, a channel pattern, a permission, or a scope that doesn't parse, saying what to write
525
+ * instead: what a board answers 400 for. Its `code` is `invalid_can`.
526
+ */
527
+ declare class InvalidCan extends Error {
528
+ readonly code = "invalid_can";
529
+ constructor(message: string);
530
+ }
531
+ type Permission = (typeof PERMISSIONS)[number];
532
+ /** `*`, a channel (`feedback`), or a channel and its subtree (`feedback/`). */
533
+ type ChannelPattern = string;
534
+ type Grant = 'all' | readonly Permission[];
535
+ /** `'all'`, a list for every channel (`['post']` is `{ '*': ['post'] }`), or a map from pattern to grant. */
536
+ type Can = Grant | Readonly<Record<ChannelPattern, Grant>>;
537
+ /** Each pattern's whole answer, implications included. */
538
+ type AccessSummary = Readonly<Record<ChannelPattern, readonly Permission[]>>;
539
+ type Access = {
540
+ can(permission: Permission, channel: string): boolean;
541
+ /** The hot path for feeds: memoized per channel. */
542
+ readable(channel: string): boolean;
543
+ /** `read` in every channel, including ones that don't exist yet. */
544
+ readsAll: boolean;
545
+ /** `permission` in every channel, including ones that don't exist yet: `everywhere('manage')` is full access. */
546
+ everywhere(permission: Permission): boolean;
547
+ /** `permission` in some channel. */
548
+ anywhere(permission: Permission): boolean;
549
+ /**
550
+ * `permission` where `pattern` itself decides: at `*`, what `*` gives, whatever a more specific
551
+ * pattern says; at `security/`, what covers `security` as a subtree. `checkGrantChange` checks
552
+ * `manage` this way.
553
+ */
554
+ at(permission: Permission, pattern: ChannelPattern): boolean;
555
+ /** Only what both this and `scope` allow, channel by channel. It never widens. */
556
+ narrow(scope: Can | Access): Access;
557
+ /** Each pattern and its permissions, `*` first and the rest sorted; an empty `*` is left out. */
558
+ summary(): AccessSummary;
559
+ };
560
+ /** Access from config: `'all'`, a list for every channel, or a map from pattern to grant. Throws on a bad pattern or permission. */
561
+ declare function compileAccess(can: Can): Access;
562
+ declare const FULL_ACCESS: Access;
563
+ /** What any of `accesses` allows, channel by channel: grants that match one principal add up. */
564
+ declare function union(accesses: readonly Access[]): Access;
565
+ /** A grant's `can` as it was written: each pattern and `'all'` or its permissions, `[]` for none. */
566
+ type WrittenCan = Readonly<Record<ChannelPattern, 'all' | readonly Permission[]>>;
567
+ /**
568
+ * How close a grant's principal is to a caller: one named principal (a user, a project, a
569
+ * repository's workflows, an issuer's claims), a group of them (`all-users`, `all-projects`), or
570
+ * `everyone`. The closest decides where grants name the same pattern.
571
+ */
572
+ declare const LEVELS: readonly ['principal', 'group', 'everyone'];
573
+ type Level = (typeof LEVELS)[number];
574
+ /** A grant as `checkGrantChange` reads it: whom it names, by kind, and what it gives where. */
575
+ type GrantShape = {
576
+ readonly principals: readonly {
577
+ readonly kind: string;
578
+ }[];
579
+ readonly can: WrittenCan;
580
+ };
581
+ /** A change that makes or widens a grant, as `checkGrantChange` judges it. */
582
+ type GrantChange = {
583
+ /**
584
+ * What the caller may do, narrowed by its token, on the grants the change applies to: what
585
+ * `GET /me` says. For an owner a token narrows, what its token's `can` gives.
586
+ */
587
+ caller: Access;
588
+ /**
589
+ * What the caller may do by its own limits alone: `caller` without `everyone` grants, so its role,
590
+ * the grants that name it or a group it's in, and its token. For an owner a token narrows, `caller`.
591
+ */
592
+ own: Access;
593
+ /** An owner no token narrows, whom nothing here limits. */
594
+ owner?: boolean;
595
+ /** Every grant as it would be after the change, the changed one included. */
596
+ after: readonly GrantShape[];
597
+ /** The grant made or widened, as it would be after the change: judged by reach and admission. */
598
+ changed?: {
599
+ readonly can: WrittenCan;
600
+ };
601
+ /**
602
+ * A grant revoked, or the one principals are removed from, or an update's grant as it was:
603
+ * judged by reach alone. Lifting what it held back widens whoever it named, but lets no one new in.
604
+ */
605
+ revoked?: {
606
+ readonly can: WrittenCan;
607
+ };
608
+ };
609
+ /** Why `checkGrantChange` refuses a change, and where: `pattern` is the spot it failed at. */
610
+ type GrantChangeRefusal = {
611
+ reason: 'reach';
612
+ pattern: ChannelPattern;
613
+ permission: 'manage';
614
+ } | {
615
+ reason: 'admission';
616
+ pattern: ChannelPattern;
617
+ permission: Permission;
618
+ };
619
+ /**
620
+ * Whether a caller may change grants so: make or widen one (`changed`), or revoke one or remove
621
+ * from it (`revoked`). You can't grant what you don't have. Your token's and your own grants'
622
+ * limits count, an `everyone` lock doesn't, and anyone you let in gets what `everyone` gets. Null
623
+ * when it may; otherwise why not, and where.
624
+ *
625
+ * - **Reach:** `manage` at each of the changed grant's patterns, by `caller` and by `own`, and at
626
+ * every more specific spot under them by `own`. A lock binds whoever the grant names as much as
627
+ * the caller, now and once it's lifted, so it doesn't count against the caller there; the
628
+ * caller's own limits do. At the grant's own patterns it counts too: there the grant would meet
629
+ * the lock at the same pattern, and its principal is closer.
630
+ * - **Admission:** wherever `everyone` gives something, `caller` has it too, since any principal a
631
+ * grant lets in gets what `everyone` gives. A revoke or a removal lets no one in, so it's judged
632
+ * by reach alone, at the patterns of the grant as it was.
633
+ *
634
+ * It looks only at the spots where access can change: the grants' patterns, the `everyone`
635
+ * grants', and the caller's own, from `summary()`. It does no I/O, so a board and Vercel's API run
636
+ * the same rule.
637
+ */
638
+ declare function checkGrantChange(change: GrantChange): GrantChangeRefusal | null;
639
+ //#endregion
4
640
  //#region src/api/routes.d.ts
5
641
  /**
6
642
  * A message's, schedule's, or cursor's ID: a string clients pass back as they got it, and never
7
- * parse, compare, or count with. Each backend picks its own; a board on `a2()` writes decimals,
643
+ * parse, compare, or count with. Each backend picks its own; a board on `local()` writes decimals,
8
644
  * and `s12` for a schedule.
9
645
  */
10
646
  declare const Ref: z.ZodString;
@@ -17,7 +653,7 @@ declare const ResolvedSyncTarget: z.ZodObject<{
17
653
  }>;
18
654
  }, z.core.$strip>;
19
655
  /** Shared by `/messages` and `/events`. */
20
- declare const Filters$1: z.ZodObject<{
656
+ declare const Filters: z.ZodObject<{
21
657
  channel: z.ZodOptional<z.ZodString>;
22
658
  re: z.ZodOptional<z.ZodString>;
23
659
  by: z.ZodOptional<z.ZodString>;
@@ -27,7 +663,7 @@ declare const Filters$1: z.ZodObject<{
27
663
  text: z.ZodOptional<z.ZodString>;
28
664
  }, z.core.$strip>;
29
665
  /** The filters a query asks for, as the board parsed them. */
30
- type ParsedFilters = z.output<typeof Filters$1>;
666
+ type ParsedFilters = z.output<typeof Filters>;
31
667
  declare const MessagesQuery: z.ZodObject<{
32
668
  channel: z.ZodOptional<z.ZodString>;
33
669
  re: z.ZodOptional<z.ZodString>;
@@ -117,12 +753,166 @@ declare const SchedulesQuery: z.ZodObject<{
117
753
  true: "true";
118
754
  }>, z.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
119
755
  }, z.core.$strip>;
120
- /** Who a grant lets in: an issuer (`vercel`, `github`, or an https URL) and the claims its tokens carry, exactly. */
121
- declare const GrantBody: z.ZodObject<{
756
+ /**
757
+ * Who a grant names, as people write it: a user by email (or, where the board can't look one up,
758
+ * by ID), a project by name or ID, a repository by `owner/name`. The board resolves names and keeps
759
+ * IDs; a board that verifies tokens itself takes IDs only. A `user` names `email` or `userId`.
760
+ * Nothing else: a key it doesn't know (a misspelled `workflows`, say) is a 400, never dropped,
761
+ * since dropping it would name more than was meant.
762
+ */
763
+ declare const PrincipalInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
764
+ kind: z.ZodLiteral<"user">;
765
+ email: z.ZodOptional<z.ZodString>;
766
+ userId: z.ZodOptional<z.ZodString>;
767
+ }, z.core.$strict>, z.ZodObject<{
768
+ kind: z.ZodLiteral<"project">;
769
+ project: z.ZodString;
770
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
771
+ }, z.core.$strict>, z.ZodObject<{
772
+ kind: z.ZodLiteral<"github">;
773
+ repository: z.ZodString;
774
+ workflow: z.ZodOptional<z.ZodString>;
775
+ branch: z.ZodOptional<z.ZodString>;
776
+ event: z.ZodOptional<z.ZodString>;
777
+ }, z.core.$strict>, z.ZodObject<{
778
+ kind: z.ZodLiteral<"oidc">;
122
779
  issuer: z.ZodString;
123
780
  claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
124
- can: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>]>>;
781
+ }, z.core.$strict>, z.ZodObject<{
782
+ kind: z.ZodLiteral<"all-users">;
783
+ }, z.core.$strict>, z.ZodObject<{
784
+ kind: z.ZodLiteral<"all-projects">;
785
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
786
+ }, z.core.$strict>, z.ZodObject<{
787
+ kind: z.ZodLiteral<"app">;
788
+ app: z.ZodString;
789
+ }, z.core.$strict>, z.ZodObject<{
790
+ kind: z.ZodLiteral<"all-apps">;
791
+ }, z.core.$strict>, z.ZodObject<{
792
+ kind: z.ZodLiteral<"everyone">;
793
+ }, z.core.$strict>], "kind">;
794
+ /** What a grant lets its principals do: a map from channel pattern to `'all'` or a list, `[]` for none. Kept as written. */
795
+ declare const GrantCan: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>;
796
+ /** A grant: who it names, and one `can` for all of them. The same principals again are another grant. */
797
+ declare const GrantBody: z.ZodObject<{
798
+ principals: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
799
+ kind: z.ZodLiteral<"user">;
800
+ email: z.ZodOptional<z.ZodString>;
801
+ userId: z.ZodOptional<z.ZodString>;
802
+ }, z.core.$strict>, z.ZodObject<{
803
+ kind: z.ZodLiteral<"project">;
804
+ project: z.ZodString;
805
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
806
+ }, z.core.$strict>, z.ZodObject<{
807
+ kind: z.ZodLiteral<"github">;
808
+ repository: z.ZodString;
809
+ workflow: z.ZodOptional<z.ZodString>;
810
+ branch: z.ZodOptional<z.ZodString>;
811
+ event: z.ZodOptional<z.ZodString>;
812
+ }, z.core.$strict>, z.ZodObject<{
813
+ kind: z.ZodLiteral<"oidc">;
814
+ issuer: z.ZodString;
815
+ claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
816
+ }, z.core.$strict>, z.ZodObject<{
817
+ kind: z.ZodLiteral<"all-users">;
818
+ }, z.core.$strict>, z.ZodObject<{
819
+ kind: z.ZodLiteral<"all-projects">;
820
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
821
+ }, z.core.$strict>, z.ZodObject<{
822
+ kind: z.ZodLiteral<"app">;
823
+ app: z.ZodString;
824
+ }, z.core.$strict>, z.ZodObject<{
825
+ kind: z.ZodLiteral<"all-apps">;
826
+ }, z.core.$strict>, z.ZodObject<{
827
+ kind: z.ZodLiteral<"everyone">;
828
+ }, z.core.$strict>], "kind">>;
829
+ can: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>;
830
+ }, z.core.$strict>;
831
+ /**
832
+ * Which grant decides a channel, and what it gives, for the caller or a principal it names: a
833
+ * `user` (by email, or by ID where the board can't look one up), a `project` in one `environment`
834
+ * (production by default), a `github` repository's run (with its `workflow`, `branch`, and
835
+ * `event`), or an `oidc` issuer's token with each `claim` as `name=value`.
836
+ */
837
+ declare const ExplainQuery: z.ZodObject<{
838
+ channel: z.ZodString;
839
+ user: z.ZodOptional<z.ZodString>;
840
+ project: z.ZodOptional<z.ZodString>;
841
+ environment: z.ZodOptional<z.ZodString>;
842
+ github: z.ZodOptional<z.ZodString>;
843
+ workflow: z.ZodOptional<z.ZodString>;
844
+ branch: z.ZodOptional<z.ZodString>;
845
+ event: z.ZodOptional<z.ZodString>;
846
+ oidc: z.ZodOptional<z.ZodString>;
847
+ claim: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
848
+ app: z.ZodOptional<z.ZodString>;
125
849
  }, z.core.$strip>;
850
+ /** A grant's change: principals to add and to remove, and a `can` to replace its own. */
851
+ declare const UpdateGrantBody: z.ZodObject<{
852
+ add: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
853
+ kind: z.ZodLiteral<"user">;
854
+ email: z.ZodOptional<z.ZodString>;
855
+ userId: z.ZodOptional<z.ZodString>;
856
+ }, z.core.$strict>, z.ZodObject<{
857
+ kind: z.ZodLiteral<"project">;
858
+ project: z.ZodString;
859
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
860
+ }, z.core.$strict>, z.ZodObject<{
861
+ kind: z.ZodLiteral<"github">;
862
+ repository: z.ZodString;
863
+ workflow: z.ZodOptional<z.ZodString>;
864
+ branch: z.ZodOptional<z.ZodString>;
865
+ event: z.ZodOptional<z.ZodString>;
866
+ }, z.core.$strict>, z.ZodObject<{
867
+ kind: z.ZodLiteral<"oidc">;
868
+ issuer: z.ZodString;
869
+ claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
870
+ }, z.core.$strict>, z.ZodObject<{
871
+ kind: z.ZodLiteral<"all-users">;
872
+ }, z.core.$strict>, z.ZodObject<{
873
+ kind: z.ZodLiteral<"all-projects">;
874
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
875
+ }, z.core.$strict>, z.ZodObject<{
876
+ kind: z.ZodLiteral<"app">;
877
+ app: z.ZodString;
878
+ }, z.core.$strict>, z.ZodObject<{
879
+ kind: z.ZodLiteral<"all-apps">;
880
+ }, z.core.$strict>, z.ZodObject<{
881
+ kind: z.ZodLiteral<"everyone">;
882
+ }, z.core.$strict>], "kind">>>;
883
+ remove: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
884
+ kind: z.ZodLiteral<"user">;
885
+ email: z.ZodOptional<z.ZodString>;
886
+ userId: z.ZodOptional<z.ZodString>;
887
+ }, z.core.$strict>, z.ZodObject<{
888
+ kind: z.ZodLiteral<"project">;
889
+ project: z.ZodString;
890
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
891
+ }, z.core.$strict>, z.ZodObject<{
892
+ kind: z.ZodLiteral<"github">;
893
+ repository: z.ZodString;
894
+ workflow: z.ZodOptional<z.ZodString>;
895
+ branch: z.ZodOptional<z.ZodString>;
896
+ event: z.ZodOptional<z.ZodString>;
897
+ }, z.core.$strict>, z.ZodObject<{
898
+ kind: z.ZodLiteral<"oidc">;
899
+ issuer: z.ZodString;
900
+ claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
901
+ }, z.core.$strict>, z.ZodObject<{
902
+ kind: z.ZodLiteral<"all-users">;
903
+ }, z.core.$strict>, z.ZodObject<{
904
+ kind: z.ZodLiteral<"all-projects">;
905
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
906
+ }, z.core.$strict>, z.ZodObject<{
907
+ kind: z.ZodLiteral<"app">;
908
+ app: z.ZodString;
909
+ }, z.core.$strict>, z.ZodObject<{
910
+ kind: z.ZodLiteral<"all-apps">;
911
+ }, z.core.$strict>, z.ZodObject<{
912
+ kind: z.ZodLiteral<"everyone">;
913
+ }, z.core.$strict>], "kind">>>;
914
+ can: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>>;
915
+ }, z.core.$strict>;
126
916
  /** A token acting as the caller: what it may do, and the profile and session every request with it writes as. */
127
917
  declare const TokenBody: z.ZodObject<{
128
918
  name: z.ZodString;
@@ -581,7 +1371,7 @@ declare const LabelBody: z.ZodObject<{
581
1371
  unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
582
1372
  if: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
583
1373
  }, z.core.$strip>;
584
- type FiltersInput = z.input<typeof Filters$1>;
1374
+ type FiltersInput = z.input<typeof Filters>;
585
1375
  type SyncImportInput = z.input<typeof SyncImportBody>;
586
1376
  type SyncReceiptInput = z.input<typeof SyncReceiptBody>;
587
1377
  type SyncFindInput = z.input<typeof SyncFindQuery>;
@@ -592,9 +1382,20 @@ type PostInput = z.input<typeof PostBody>;
592
1382
  type ScheduleInput = z.input<typeof ScheduleBody>;
593
1383
  type ScheduleBodyOutput = z.output<typeof ScheduleBody>;
594
1384
  type SchedulesQueryInput = z.input<typeof SchedulesQuery>;
595
- /** What `grant` takes: `can` as `access` writes it. */
596
- type GrantInput = Omit<z.input<typeof GrantBody>, 'can'> & {
597
- can?: Can;
1385
+ /** A principal as `createGrant` and `updateGrant` take it. */
1386
+ type PrincipalInput = z.input<typeof PrincipalInput>;
1387
+ /** A grant's `can`: each channel pattern and what it gives, `'all'` or a list, `[]` for none. */
1388
+ type GrantCan = WrittenCan;
1389
+ /** What `createGrant` takes. */
1390
+ type GrantInput = {
1391
+ principals: readonly PrincipalInput[];
1392
+ can: GrantCan;
1393
+ };
1394
+ /** What `updateGrant` takes: principals to add, principals to remove (by who they are, environments aside), and a `can` that replaces the grant's. */
1395
+ type UpdateGrantInput = {
1396
+ add?: readonly PrincipalInput[];
1397
+ remove?: readonly PrincipalInput[];
1398
+ can?: GrantCan;
598
1399
  };
599
1400
  /** What `token` takes: `can` as `access` writes it. */
600
1401
  type TokenInput = Omit<z.input<typeof TokenBody>, 'can'> & {
@@ -646,15 +1447,70 @@ type ScheduleView = {
646
1447
  author: ActorView;
647
1448
  createdAt: string;
648
1449
  };
649
- /** A grant: who it lets in, what it lets them do, and who set it when. */
650
- type GrantView = {
651
- id: string;
1450
+ /**
1451
+ * Which grants decide a channel for a principal: the `pattern` that won there (an exact channel,
1452
+ * then the longest subtree, then `*`), the patterns it won `over` (the others its grants name that
1453
+ * cover the channel, most specific first), the `level` that won at it, the `grants` at that level,
1454
+ * which add up, and what they give, `can`, after `capped`, the team role that caps a person's. `pattern` and `level` are null where no grant decides: the
1455
+ * board's own code, its own deployments where it runs, or a principal nothing lets in, whose `can`
1456
+ * is empty.
1457
+ */
1458
+ type Explanation = {
1459
+ channel: string;
1460
+ pattern: string | null;
1461
+ over: string[];
1462
+ level: 'principal' | 'group' | 'everyone' | null;
1463
+ grants: GrantView[];
1464
+ capped: string | null;
1465
+ can: Permission[];
1466
+ };
1467
+ /** A principal as a grant keeps it: IDs, with the names the board knows beside them. */
1468
+ type PrincipalView = {
1469
+ kind: 'user';
1470
+ userId: string;
1471
+ email: string | null;
1472
+ } | {
1473
+ kind: 'project';
1474
+ projectId: string;
1475
+ name: string | null;
1476
+ environments: string[];
1477
+ teamId: string | null;
1478
+ } | {
1479
+ kind: 'github';
1480
+ repositoryId: string | null;
1481
+ repository: string;
1482
+ workflow?: string;
1483
+ branch?: string;
1484
+ event?: string;
1485
+ } | {
1486
+ kind: 'oidc';
652
1487
  issuer: string;
653
1488
  claims: Record<string, string | string[]>;
654
- can: AccessSummary;
655
- /** The actor that last set it. */
656
- by: string;
657
- at: string;
1489
+ } | {
1490
+ kind: 'all-users';
1491
+ } | {
1492
+ kind: 'all-projects';
1493
+ environments: string[];
1494
+ } | {
1495
+ kind: 'app';
1496
+ clientId: string;
1497
+ name: string | null;
1498
+ } | {
1499
+ kind: 'all-apps';
1500
+ } | {
1501
+ kind: 'everyone';
1502
+ };
1503
+ /** A grant: who it names, what it lets them do, and who changed it last, when. */
1504
+ type GrantView = {
1505
+ id: string;
1506
+ principals: PrincipalView[];
1507
+ /** As it was written: each pattern and `'all'` or its permissions, `[]` for none. */
1508
+ can: Record<string, 'all' | Permission[]>;
1509
+ /** Whether a person's team role caps what it gives them: a viewer only reads and reacts. False where the board has no roles. */
1510
+ capped: boolean;
1511
+ /** The actor that changed it last, and when: null for one the board started with. */
1512
+ by: string | null;
1513
+ at: string | null;
658
1514
  };
659
1515
  /** A token, as its minter and `manage` see it: never its secret. */
660
1516
  type TokenView = {
@@ -827,7 +1683,7 @@ type InboxItem = {
827
1683
  };
828
1684
  /**
829
1685
  * A channel, and what its board counts in it: its threads, its messages, and its last message's
830
- * position. `a2()` keeps all three; Vercel's API keeps none, so a board on it leaves them out.
1686
+ * position. `local()` keeps all three; Vercel's API keeps none, so a board on it leaves them out.
831
1687
  */
832
1688
  type ChannelView = {
833
1689
  path: string;
@@ -1120,7 +1976,7 @@ declare const routes: {
1120
1976
  readonly method: 'POST';
1121
1977
  readonly path: '/schedules/:id/cancel';
1122
1978
  };
1123
- /** Grants need manage in every channel. Setting one with the same issuer and claims changes its `can`. */
1979
+ /** Listing grants needs manage at `*`; changing one, manage at each pattern its `can` names. Team owners always may. */
1124
1980
  readonly grants: {
1125
1981
  readonly method: 'GET';
1126
1982
  readonly path: '/grants';
@@ -1129,9 +1985,125 @@ declare const routes: {
1129
1985
  readonly method: 'POST';
1130
1986
  readonly path: '/grants';
1131
1987
  readonly body: z.ZodObject<{
1132
- issuer: z.ZodString;
1133
- claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
1134
- can: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>]>>;
1988
+ principals: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1989
+ kind: z.ZodLiteral<"user">;
1990
+ email: z.ZodOptional<z.ZodString>;
1991
+ userId: z.ZodOptional<z.ZodString>;
1992
+ }, z.core.$strict>, z.ZodObject<{
1993
+ kind: z.ZodLiteral<"project">;
1994
+ project: z.ZodString;
1995
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
1996
+ }, z.core.$strict>, z.ZodObject<{
1997
+ kind: z.ZodLiteral<"github">;
1998
+ repository: z.ZodString;
1999
+ workflow: z.ZodOptional<z.ZodString>;
2000
+ branch: z.ZodOptional<z.ZodString>;
2001
+ event: z.ZodOptional<z.ZodString>;
2002
+ }, z.core.$strict>, z.ZodObject<{
2003
+ kind: z.ZodLiteral<"oidc">;
2004
+ issuer: z.ZodString;
2005
+ claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
2006
+ }, z.core.$strict>, z.ZodObject<{
2007
+ kind: z.ZodLiteral<"all-users">;
2008
+ }, z.core.$strict>, z.ZodObject<{
2009
+ kind: z.ZodLiteral<"all-projects">;
2010
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
2011
+ }, z.core.$strict>, z.ZodObject<{
2012
+ kind: z.ZodLiteral<"app">;
2013
+ app: z.ZodString;
2014
+ }, z.core.$strict>, z.ZodObject<{
2015
+ kind: z.ZodLiteral<"all-apps">;
2016
+ }, z.core.$strict>, z.ZodObject<{
2017
+ kind: z.ZodLiteral<"everyone">;
2018
+ }, z.core.$strict>], "kind">>;
2019
+ can: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>;
2020
+ }, z.core.$strict>;
2021
+ };
2022
+ readonly updateGrant: {
2023
+ readonly method: 'PATCH';
2024
+ readonly path: '/grants/:id';
2025
+ readonly body: z.ZodObject<{
2026
+ add: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2027
+ kind: z.ZodLiteral<"user">;
2028
+ email: z.ZodOptional<z.ZodString>;
2029
+ userId: z.ZodOptional<z.ZodString>;
2030
+ }, z.core.$strict>, z.ZodObject<{
2031
+ kind: z.ZodLiteral<"project">;
2032
+ project: z.ZodString;
2033
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
2034
+ }, z.core.$strict>, z.ZodObject<{
2035
+ kind: z.ZodLiteral<"github">;
2036
+ repository: z.ZodString;
2037
+ workflow: z.ZodOptional<z.ZodString>;
2038
+ branch: z.ZodOptional<z.ZodString>;
2039
+ event: z.ZodOptional<z.ZodString>;
2040
+ }, z.core.$strict>, z.ZodObject<{
2041
+ kind: z.ZodLiteral<"oidc">;
2042
+ issuer: z.ZodString;
2043
+ claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
2044
+ }, z.core.$strict>, z.ZodObject<{
2045
+ kind: z.ZodLiteral<"all-users">;
2046
+ }, z.core.$strict>, z.ZodObject<{
2047
+ kind: z.ZodLiteral<"all-projects">;
2048
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
2049
+ }, z.core.$strict>, z.ZodObject<{
2050
+ kind: z.ZodLiteral<"app">;
2051
+ app: z.ZodString;
2052
+ }, z.core.$strict>, z.ZodObject<{
2053
+ kind: z.ZodLiteral<"all-apps">;
2054
+ }, z.core.$strict>, z.ZodObject<{
2055
+ kind: z.ZodLiteral<"everyone">;
2056
+ }, z.core.$strict>], "kind">>>;
2057
+ remove: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2058
+ kind: z.ZodLiteral<"user">;
2059
+ email: z.ZodOptional<z.ZodString>;
2060
+ userId: z.ZodOptional<z.ZodString>;
2061
+ }, z.core.$strict>, z.ZodObject<{
2062
+ kind: z.ZodLiteral<"project">;
2063
+ project: z.ZodString;
2064
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
2065
+ }, z.core.$strict>, z.ZodObject<{
2066
+ kind: z.ZodLiteral<"github">;
2067
+ repository: z.ZodString;
2068
+ workflow: z.ZodOptional<z.ZodString>;
2069
+ branch: z.ZodOptional<z.ZodString>;
2070
+ event: z.ZodOptional<z.ZodString>;
2071
+ }, z.core.$strict>, z.ZodObject<{
2072
+ kind: z.ZodLiteral<"oidc">;
2073
+ issuer: z.ZodString;
2074
+ claims: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
2075
+ }, z.core.$strict>, z.ZodObject<{
2076
+ kind: z.ZodLiteral<"all-users">;
2077
+ }, z.core.$strict>, z.ZodObject<{
2078
+ kind: z.ZodLiteral<"all-projects">;
2079
+ environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
2080
+ }, z.core.$strict>, z.ZodObject<{
2081
+ kind: z.ZodLiteral<"app">;
2082
+ app: z.ZodString;
2083
+ }, z.core.$strict>, z.ZodObject<{
2084
+ kind: z.ZodLiteral<"all-apps">;
2085
+ }, z.core.$strict>, z.ZodObject<{
2086
+ kind: z.ZodLiteral<"everyone">;
2087
+ }, z.core.$strict>], "kind">>>;
2088
+ can: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodString>]>>>;
2089
+ }, z.core.$strict>;
2090
+ };
2091
+ /** Which grant decides a channel, for the caller or, with `manage` at `*`, a principal it names. */
2092
+ readonly explain: {
2093
+ readonly method: 'GET';
2094
+ readonly path: '/grants/explain';
2095
+ readonly query: z.ZodObject<{
2096
+ channel: z.ZodString;
2097
+ user: z.ZodOptional<z.ZodString>;
2098
+ project: z.ZodOptional<z.ZodString>;
2099
+ environment: z.ZodOptional<z.ZodString>;
2100
+ github: z.ZodOptional<z.ZodString>;
2101
+ workflow: z.ZodOptional<z.ZodString>;
2102
+ branch: z.ZodOptional<z.ZodString>;
2103
+ event: z.ZodOptional<z.ZodString>;
2104
+ oidc: z.ZodOptional<z.ZodString>;
2105
+ claim: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
2106
+ app: z.ZodOptional<z.ZodString>;
1135
2107
  }, z.core.$strip>;
1136
2108
  };
1137
2109
  readonly revokeGrant: {
@@ -1680,346 +2652,4 @@ declare const routes: {
1680
2652
  };
1681
2653
  type RouteName = keyof typeof routes;
1682
2654
  //#endregion
1683
- //#region src/client/client.d.ts
1684
- /**
1685
- * Where an error came from: `handle`, raised by the handle on this machine (no Vercel login,
1686
- * Deployment Protection), or `board`, a board's answer, whose words are its own whatever code it
1687
- * names.
1688
- */
1689
- type ErrorOrigin = 'handle' | 'board';
1690
- /**
1691
- * What went wrong: `message` says what and why, `code` is what to branch on, `hint`, when there's
1692
- * one, what fixes it, and `origin` who said so. Trust a `board` one's message and hint as you would
1693
- * the board.
1694
- */
1695
- declare class BoardError extends Error {
1696
- readonly code: string;
1697
- readonly status: number;
1698
- readonly hint: string | undefined;
1699
- readonly origin: ErrorOrigin;
1700
- constructor(code: string, message: string, status: number, options?: {
1701
- hint?: string;
1702
- origin?: ErrorOrigin;
1703
- });
1704
- }
1705
- type Resolvable<T> = T | (() => T | Promise<T>);
1706
- /** A profile name, `{ name, avatar }`, or null for no profile. */
1707
- type ProfileOption = string | {
1708
- name: string;
1709
- avatar?: string;
1710
- } | null;
1711
- type ClientOptions = {
1712
- /** The board's URL, e.g. `https://www.example.com/api/board`. */
1713
- url: string;
1714
- /** An OIDC token whose audience is the board's URL, or a function returning one. Without one, `fetch` brings the credentials. */
1715
- token?: Resolvable<string>;
1716
- profile?: Resolvable<ProfileOption>;
1717
- /** Runtime session, recorded on writes and used to scope read cursors. */
1718
- session?: Resolvable<string | null>;
1719
- /** A person's handle; the board falls back to one derived from their user ID. */
1720
- handle?: Resolvable<string | null>;
1721
- /** Your display name and avatar, shown when you write as yourself (not as a profile). */
1722
- person?: Resolvable<{
1723
- name?: string | null;
1724
- avatar?: string | null;
1725
- } | null>;
1726
- /** Extra headers on every request. */
1727
- headers?: Resolvable<Record<string, string>>;
1728
- fetch?: typeof fetch;
1729
- /**
1730
- * How a direct upload's bytes go to the blob store's signed URL: `fetch` by default, never the
1731
- * board's own, which brings the board's credentials and would hand them to the store.
1732
- */
1733
- storeFetch?: typeof fetch;
1734
- };
1735
- type PostOptions = {
1736
- text: string;
1737
- labels?: Record<string, string>;
1738
- /** Keep this message on the board: no configured sync targets. */
1739
- noSync?: boolean;
1740
- /** External targets the new thread starts with: `slack:#incidents` starts one, `github:owner/repo:12` joins one. */
1741
- sync?: string[];
1742
- /** Makes retries idempotent: the same id never posts twice. */
1743
- id?: string;
1744
- /** Files from `upload`, or their IDs. */
1745
- attachments?: (Attachment | string)[];
1746
- };
1747
- type ReplyOptions = Omit<PostOptions, 'sync'> & {
1748
- /**
1749
- * Posts only while this is the thread's newest message: the ID of the last one you read. If
1750
- * another has come after it, nothing is posted, and it throws a 409 `newer_message`.
1751
- */
1752
- after?: string;
1753
- };
1754
- /**
1755
- * When a scheduled message goes out: once `in` a while or `at` a time, or
1756
- * `every` so often (first at `at`, `in`, or one `every` from now), stopping
1757
- * `until` a time, `for` a while after the first send, or after `times` sends.
1758
- * A repeat with no stop runs until it's canceled.
1759
- */
1760
- type ScheduleTiming = {
1761
- in?: string;
1762
- at?: Date | string;
1763
- every?: string;
1764
- until?: Date | string;
1765
- for?: string;
1766
- times?: number;
1767
- };
1768
- type ScheduleOptions = Omit<PostOptions, 'sync' | 'id'> & ScheduleTiming;
1769
- /** What `upload` takes: the bytes, and what to call them. */
1770
- type UploadInput = {
1771
- data: Blob | Uint8Array<ArrayBuffer>;
1772
- name: string;
1773
- /** A MIME type; a `Blob`'s own type, or one from the name's extension, otherwise. */
1774
- type?: string;
1775
- };
1776
- type WaitOptions = {
1777
- /** `'30s'`, `'10m'`, `'1h'`, or milliseconds. Default `'30m'`. */
1778
- timeout?: string | number;
1779
- signal?: AbortSignal;
1780
- };
1781
- declare function duration(value: string | number): number;
1782
- type Filters = Omit<FiltersInput, 'label'> & {
1783
- /** `{ status: 'open' }` or `['status=open']`. */
1784
- label?: Record<string, string> | string[];
1785
- };
1786
- type BoardClient = ReturnType<typeof createBoardClient>;
1787
- /** What a write returns, with the handles in it that matched nobody and stayed plain text. */
1788
- type Written<T> = T & {
1789
- unknownMentions?: string[];
1790
- };
1791
- declare function createBoardClient(options: ClientOptions): {
1792
- url: string;
1793
- /**
1794
- * The board's HTTP API with this client's credentials, and the response as
1795
- * the board sent it, errors included: for proxies like `vb inspect`.
1796
- */
1797
- request: (path: string, init?: {
1798
- method?: string;
1799
- body?: Uint8Array<ArrayBuffer>;
1800
- headers?: Record<string, string>;
1801
- signal?: AbortSignal;
1802
- /** Act as this profile (`null` for yourself) instead of the client's. */
1803
- as?: ProfileOption;
1804
- }) => Promise<Response>;
1805
- discovery: () => Promise<Discovery>;
1806
- me: () => Promise<Me>;
1807
- channels: () => Promise<ChannelView[]>;
1808
- /**
1809
- * Makes a channel before anything posts to it, as a first post would. Needs `read` and `post`
1810
- * there. `created` is false when it was there already; it's left as it is.
1811
- */
1812
- createChannel: (path: string) => Promise<{
1813
- channel: ChannelView;
1814
- created: boolean;
1815
- }>;
1816
- actors: () => Promise<Actor[]>;
1817
- messages: (query?: Filters & Omit<MessagesQueryInput, keyof FiltersInput>) => Promise<MessagesPage>;
1818
- thread: (id: string) => Promise<ThreadView>;
1819
- /** Your own post with the client ID you gave it, as posting it answered: 404 `post_not_found` when there's none. */
1820
- posted: (id: string) => Promise<MessageView>;
1821
- /** Threads with a matching message, one summary each (root, reply count, latest reply), by latest activity. `limit` counts threads. */
1822
- threads: (query?: Filters & Omit<ThreadsQueryInput, keyof FiltersInput>) => Promise<ThreadsPage>;
1823
- /** `unknownMentions` lists the handles that matched nobody: they posted as plain text. */
1824
- post(channel: string, input: string | PostOptions): Promise<Written<MessageView>>;
1825
- reply(id: string, input: string | ReplyOptions): Promise<Written<MessageView>>;
1826
- /**
1827
- * Posts later, as you: a new thread when `target` is a channel, a reply when it's
1828
- * `{ re }`, any message's ID in the thread. Each message it posts carries
1829
- * `schedule: { id, n }`. Needs a board with a scheduler.
1830
- */
1831
- schedule(target: string | {
1832
- re: string;
1833
- }, input: ScheduleOptions): Promise<Written<ScheduleView>>;
1834
- /** Pending schedules (`all` for done and canceled too), oldest first. `re` is any message in a thread. */
1835
- schedules: (query?: Omit<SchedulesQueryInput, 'all'> & {
1836
- all?: boolean;
1837
- }) => Promise<ScheduleView[]>;
1838
- /** Stops a schedule: yours, or any with manage in its channel. `canceled` is false when it was already done or canceled. */
1839
- cancelSchedule: (id: string) => Promise<{
1840
- schedule: ScheduleView;
1841
- canceled: boolean;
1842
- }>;
1843
- /**
1844
- * Lets in callers with an OIDC token from `issuer` that carries every one of `claims`, to do
1845
- * what `can` says (read, post, react, and label everywhere when left out). Setting the same
1846
- * issuer and claims again changes its `can`: `created` says which. Needs manage in every channel.
1847
- */
1848
- createGrant: (input: GrantInput) => Promise<{
1849
- grant: GrantView;
1850
- created: boolean;
1851
- }>;
1852
- /** The board's grants. Needs manage in every channel. */
1853
- grants: () => Promise<GrantView[]>;
1854
- /** `revoked` is false when it was already gone. Its principals' next requests are refused. */
1855
- revokeGrant: (id: string) => Promise<{
1856
- revoked: boolean;
1857
- }>;
1858
- /**
1859
- * A token that acts as you, narrowed to `can`, writing as `profile` and `session` when they're
1860
- * given: for a widget, a sandbox, a script. `secret` shows only here. It lives 30 days, or
1861
- * `expires`, at most 90.
1862
- */
1863
- createToken: (input: TokenInput) => Promise<{
1864
- token: TokenView;
1865
- secret: string;
1866
- }>;
1867
- /** Your live tokens, or everyone's with manage in every channel. Never their secrets. */
1868
- tokens: () => Promise<TokenView[]>;
1869
- /** It and every token minted with it stop. `revoked` is false when it was already revoked. */
1870
- revokeToken: (id: string) => Promise<{
1871
- revoked: boolean;
1872
- }>;
1873
- /**
1874
- * Stores a file on the board, for a post or reply's `attachments`. Up to 4 MB goes in one
1875
- * request; bigger, up to 100 MB, goes straight to the board's blob store on a URL the board
1876
- * signs, where its store can (`no_direct_uploads` where it can't).
1877
- */
1878
- upload(input: UploadInput): Promise<Attachment>;
1879
- /** An attachment's bytes, as the board serves them: `content-type` is the file's type. */
1880
- download: (id: string, opts?: {
1881
- signal?: AbortSignal;
1882
- }) => Promise<Response>;
1883
- /**
1884
- * `revision` is the message's as you read it: if it's been edited or deleted since, nothing
1885
- * changes, and it throws a 409 `revision_conflict`.
1886
- */
1887
- edit: (id: string, text: string, opts?: {
1888
- revision?: number;
1889
- }) => Promise<{
1890
- ok: true;
1891
- unknownMentions?: string[];
1892
- }>;
1893
- delete: (id: string, opts?: {
1894
- revision?: number;
1895
- }) => Promise<{
1896
- ok: true;
1897
- }>;
1898
- /** `emoji` is a short name, `:name:`, or the character itself. */
1899
- react: (id: string, emoji: string, opts?: {
1900
- remove?: boolean;
1901
- }) => Promise<{
1902
- ok: true;
1903
- }>;
1904
- /**
1905
- * `if` is what the labels must be now, a value or null for one that mustn't be set: if one
1906
- * isn't, nothing changes, and it throws a 409 `label_conflict`.
1907
- */
1908
- label: (id: string, change: {
1909
- set?: Record<string, string>;
1910
- unset?: string[];
1911
- if?: Record<string, string | null>;
1912
- }) => Promise<{
1913
- ok: true;
1914
- }>;
1915
- /**
1916
- * Shows typing in the platform threads the message's thread is synced to.
1917
- * Ephemeral: nothing goes in the log. Answers the external threads that took it.
1918
- * `status` replaces "Typing…" on Slack ("running tests…").
1919
- */
1920
- typing: (id: string, status?: string) => Promise<string[]>;
1921
- /**
1922
- * With a target, attaches the message's thread to it, backfilling it: attaching twice is a no-op.
1923
- * Without one, where the thread is synced, and this message's copy on each target, with its link.
1924
- */
1925
- sync: {
1926
- (id: string): Promise<SyncedView>;
1927
- (id: string, target: string): Promise<{
1928
- target: string;
1929
- attached: boolean;
1930
- }>;
1931
- };
1932
- /**
1933
- * The thread of the board message a platform link names (a Slack permalink, a GitHub comment's
1934
- * URL), from what the board synced: the platform is never asked. 404 for one it didn't sync.
1935
- */
1936
- linked: (url: string) => Promise<ThreadView>;
1937
- /** Raw platform events for a sync entry, newest first. */
1938
- inbox: (key: string, opts?: {
1939
- channel?: string;
1940
- limit?: number;
1941
- }) => Promise<InboxEntry[]>;
1942
- /** Registers the caller's watchers, replacing its last registration: what a board on `http()` does. */
1943
- register: (input: RegisterInput) => Promise<RegistrationView>;
1944
- /** Registered watchers: every one to `manage` everywhere, the caller's own to anyone else. */
1945
- watchers: () => Promise<RegistrationView[]>;
1946
- /** 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. */
1947
- matches: (opts?: {
1948
- limit?: number;
1949
- wait?: number;
1950
- signal?: AbortSignal;
1951
- }) => Promise<MatchView[]>;
1952
- /** How a pulled match went: done, an error to try again, or `skip` to drop it. */
1953
- ack: (id: string, body: {
1954
- lease: string;
1955
- error?: string;
1956
- skip?: boolean;
1957
- }) => Promise<{
1958
- ok: true;
1959
- }>;
1960
- /**
1961
- * Reads a platform channel (`#name`, an ID), thread (`C0123:1727000000.123456`),
1962
- * or message permalink on demand, without syncing or storing it. Full access only.
1963
- */
1964
- readSource: (key: string, target: string, opts?: {
1965
- limit?: number;
1966
- after?: string;
1967
- }) => Promise<SourceRead>;
1968
- /** Adds the app to a public channel so `readSource` can read it, where the sync opted in with `join`. Full access only. */
1969
- joinSource: (key: string, target: string) => Promise<SourceJoin>;
1970
- poll: (query?: Filters & {
1971
- after?: string;
1972
- wait?: number;
1973
- all?: boolean;
1974
- }, signal?: AbortSignal) => Promise<EventsPage>;
1975
- /** A platform's write, as its platform author: idempotent per platform event for a post, found from its origin otherwise. */
1976
- syncImport: (body: SyncImportInput) => Promise<{
1977
- message: string | null;
1978
- dropped?: string[];
1979
- }>;
1980
- /** What sync did on a platform: a delivery, its files, a failure, or a thread's new target. */
1981
- syncReceipt: (body: SyncReceiptInput) => Promise<{
1982
- ok: true;
1983
- attached?: boolean;
1984
- }>;
1985
- /** A board thread's sync, by its key. */
1986
- syncThread: (thread: string) => Promise<SyncThreadView>;
1987
- /** What platform IDs are on the board: a thread, or a message. */
1988
- syncFind: (query: SyncFindInput, opts?: {
1989
- signal?: AbortSignal;
1990
- }) => Promise<SyncFindView>;
1991
- /** Messages' copies on platforms, by message and target. */
1992
- syncCopies: (messages: string[]) => Promise<Record<string, Record<string, ExternalCopy>>>;
1993
- /** Pushes platform events into your inbox for sync key `key`; each platform ID lands once. */
1994
- inboxPush: (key: string, events: {
1995
- id: string;
1996
- event: InboxItem['event'];
1997
- raw: unknown;
1998
- }[]) => Promise<{
1999
- ok: true;
2000
- }>;
2001
- /** Your next inbox events for `key`, leased to you until you ack them, one platform thread at a time. */
2002
- inboxNext: (key: string, opts?: {
2003
- limit?: number;
2004
- }) => Promise<InboxItem[]>;
2005
- /** How an inbox event went: done, or an error to try it again. */
2006
- inboxAck: (key: string, id: string, body: {
2007
- lease: string;
2008
- error?: string;
2009
- }) => Promise<{
2010
- ok: true;
2011
- }>;
2012
- /** Live events. Reconnects from the last seen index whenever the stream closes. */
2013
- events(query?: Filters & {
2014
- after?: string;
2015
- all?: boolean;
2016
- }, opts?: {
2017
- signal?: AbortSignal;
2018
- }): AsyncGenerator<BoardEventView>;
2019
- /** The next matching event after `after` (default: now), or null on timeout. */
2020
- wait(query?: Filters & {
2021
- after?: string;
2022
- }, opts?: WaitOptions): Promise<BoardEventView | null>;
2023
- };
2024
- //#endregion
2025
- export { RegisterBody as $, InboxAckBody as A, ThreadsPage as At, MatchView as B, routes as Bt, EventsPage as C, SyncImportInput as Ct, GrantBody as D, SyncedView as Dt, FiltersInput as E, SyncThreadView as Et, InboxQuery as F, TokenView as Ft, MessagesQuery as G, Me as H, LABEL_CONDITIONS_MAX as I, TypingBody as It, PostBody as J, MessagesQueryInput as K, LabelBody as L, TypingResult as Lt, InboxItem as M, ThreadsQueryInput as Mt, InboxNextQuery as N, TokenBody as Nt, GrantInput as O, ThreadSummaryView as Ot, InboxPushBody as P, TokenInput as Pt, Ref as Q, LinkView as R, UploadStartBody as Rt, EditBody as S, SyncImportBody as St, EventsQueryInput as T, SyncReceiptInput as Tt, MessageView as U, MatchesQuery as V, MessagesPage as W, REGISTERED_WATCHERS_MAX as X, PostInput as Y, ReactBody as Z, BoardEventView as _, SyncCopiesQuery as _t, PostOptions as a, ScheduleBodyOutput as at, DeleteBody as b, SyncFindQuery as bt, ScheduleOptions as c, SchedulesQuery as ct, WaitOptions as d, SourceJoin as dt, RegisterInput as et, Written as f, SourceJoinBody as ft, ApiError as g, SyncBody as gt, ActorView as h, SourceReadQuery as ht, Filters as i, ScheduleBody as it, InboxEntry as j, ThreadsQuery as jt, GrantView as k, ThreadView as kt, ScheduleTiming as l, SchedulesQueryInput as lt, AckBody as m, SourceRead as mt, BoardError as n, ResolvedSyncTarget as nt, ProfileOption as o, ScheduleInput as ot, duration as p, SourceMessage as pt, ParsedFilters as q, ErrorOrigin as r, RouteName as rt, ReplyOptions as s, ScheduleView as st, BoardClient as t, RegistrationView as tt, UploadInput as u, SchedulesQueryOutput as ut, ChannelView as v, SyncCopiesView as vt, EventsQuery as w, SyncReceiptBody as wt, Discovery as x, SyncFindView as xt, CreateChannelBody as y, SyncFindInput as yt, LinkedQuery as z, UploadTicket as zt };
2655
+ export { ScheduleView as $, Attachment as $t, MatchView as A, UpdateGrantBody as At, PrincipalInput as B, Grant as Bt, InboxNextQuery as C, ThreadsQuery as Ct, LabelBody as D, TokenView as Dt, LABEL_CONDITIONS_MAX as E, TokenInput as Et, MessagesQuery as F, Access as Ft, RegisterBody as G, Level as Gt, REGISTERED_WATCHERS_MAX as H, GrantChangeRefusal as Ht, MessagesQueryInput as I, AccessSummary as It, ResolvedSyncTarget as J, checkGrantChange as Jt, RegisterInput as K, Permission as Kt, ParsedFilters as L, Can as Lt, Me as M, UploadStartBody as Mt, MessageView as N, UploadTicket as Nt, LinkView as O, TypingBody as Ot, MessagesPage as P, routes as Pt, ScheduleInput as Q, ExternalCopy as Qt, PostBody as R, ChannelPattern as Rt, InboxItem as S, ThreadsPage as St, InboxQuery as T, TokenBody as Tt, ReactBody as U, GrantShape as Ut, PrincipalView as V, GrantChange as Vt, Ref as W, InvalidCan as Wt, ScheduleBody as X, union as Xt, RouteName as Y, compileAccess as Yt, ScheduleBodyOutput as Z, Actor as Zt, GrantCan as _, SyncReceiptInput as _t, ChannelView as a, ExternalLink as an, SourceMessage as at, InboxAckBody as b, ThreadSummaryView as bt, Discovery as c, SyncBody as ct, EventsQuery as d, SyncFindInput as dt, Author as en, SchedulesQuery as et, EventsQueryInput as f, SyncFindQuery as ft, GrantBody as g, SyncReceiptBody as gt, FiltersInput as h, SyncImportInput as ht, BoardEventView as i, ExternalFile as in, SourceJoinBody as it, MatchesQuery as j, UpdateGrantInput as jt, LinkedQuery as k, TypingResult as kt, EditBody as l, SyncCopiesQuery as lt, Explanation as m, SyncImportBody as mt, ActorView as n, ExternalAuthor as nn, SchedulesQueryOutput as nt, CreateChannelBody as o, Link as on, SourceRead as ot, ExplainQuery as p, SyncFindView as pt, RegistrationView as q, WrittenCan as qt, ApiError as r, ExternalEvent as rn, SourceJoin as rt, DeleteBody as s, SourceReadQuery as st, AckBody as t, Labels as tn, SchedulesQueryInput as tt, EventsPage as u, SyncCopiesView as ut, GrantInput as v, SyncThreadView as vt, InboxPushBody as w, ThreadsQueryInput as wt, InboxEntry as x, ThreadView as xt, GrantView as y, SyncedView as yt, PostInput as z, FULL_ACCESS as zt };