@vercel/board 0.36.0 → 0.37.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 (70) hide show
  1. package/dist/access.d.mts +2 -2
  2. package/dist/access.mjs +1 -1
  3. package/dist/{actors-DFOpTw89.mjs → actors-uoD62kiN.mjs} +1 -0
  4. package/dist/{auth-C21V0EK1.d.mts → auth-BHXgi696.d.mts} +1 -1
  5. package/dist/{backend-D21q8mdm.d.mts → backend-BIvl2z1z.d.mts} +3 -9
  6. package/dist/backend-local.d.mts +1 -1
  7. package/dist/backend-local.mjs +1 -1
  8. package/dist/{chat-provider-Bb-jeJLY.mjs → chat-provider-C0WUS3-G.mjs} +1 -1
  9. package/dist/{chat-provider-DmZCmBkb.d.mts → chat-provider-DFYEReZL.d.mts} +2 -2
  10. package/dist/cli-commands.mjs +1 -1
  11. package/dist/cli-embedded.d.mts +18 -2
  12. package/dist/cli-embedded.mjs +22 -4
  13. package/dist/cli.mjs +50 -676
  14. package/dist/{commands-BLtqSwha.mjs → commands-D2pFCMSh.mjs} +11 -0
  15. package/dist/{conformance-CKrwglzA.mjs → conformance-rCrc_mwi.mjs} +2 -3
  16. package/dist/conformance.d.mts +1 -1
  17. package/dist/conformance.mjs +1 -1
  18. package/dist/digest-CLGw7653.mjs +4 -0
  19. package/dist/{engine-B_prP0b8.mjs → engine-COa73McY.mjs} +16 -12
  20. package/dist/{events-AEKh9tJm.mjs → events-v8f7pF9f.mjs} +21 -7
  21. package/dist/exports-Bb0m03fT.d.mts +4 -0
  22. package/dist/{exports-Ck4Xu3OV.mjs → exports-DTezg4xR.mjs} +728 -171
  23. package/dist/{index-LREsSZb2.d.mts → index-B1TZrMMu.d.mts} +2 -2
  24. package/dist/index.d.mts +5 -5
  25. package/dist/index.mjs +3 -3
  26. package/dist/index.node.d.mts +5 -5
  27. package/dist/index.node.mjs +2 -2
  28. package/dist/inspect/app.js +35 -35
  29. package/dist/inspect/engine.js +5 -5
  30. package/dist/inspect-B8c0Wh5Z.mjs +2 -0
  31. package/dist/inspect-CoFk2Xj7.mjs +643 -0
  32. package/dist/{local-DJ_qI9q7.mjs → local-Cm7a7_Q0.mjs} +10 -65
  33. package/dist/{main-Jz4nbNJi.mjs → main-DoZ8IFPb.mjs} +9 -7
  34. package/dist/{middleware-BxgizazV.mjs → middleware-k_XKQ6f7.mjs} +9 -1
  35. package/dist/page-BAQpb-s-.mjs +2 -0
  36. package/dist/page-LysMGAl3.mjs +30 -0
  37. package/dist/{provider-DEOfc4Ls.d.mts → provider-7pOnK8Jw.d.mts} +5 -3
  38. package/dist/{routes-BpKdMvgX.d.mts → routes-BtsZzal-.d.mts} +0 -17
  39. package/dist/{serve-Puf3I-oI.mjs → serve-2U_JPJtS.mjs} +2 -2
  40. package/dist/{server-CS-1aeTl.mjs → server-Drul_uwj.mjs} +18 -10
  41. package/dist/sync-chat-sdk.d.mts +2 -2
  42. package/dist/sync-chat-sdk.mjs +2 -2
  43. package/dist/sync-github.d.mts +2 -2
  44. package/dist/sync-github.mjs +2 -2
  45. package/dist/sync-linear.d.mts +3 -3
  46. package/dist/sync-linear.mjs +2 -2
  47. package/dist/sync-slack.d.mts +3 -3
  48. package/dist/sync-slack.mjs +2 -2
  49. package/dist/sync.d.mts +2 -2
  50. package/dist/sync.mjs +1 -1
  51. package/dist/{targets-Dk_xgS9q.mjs → targets-B0D4tJDY.mjs} +63 -18
  52. package/docs/01-board/01-mounting.md +11 -8
  53. package/docs/01-board/03-identity.md +2 -1
  54. package/docs/01-board/06-watchers.md +71 -40
  55. package/docs/01-quickstart.md +1 -1
  56. package/docs/02-sync/01-overview.md +7 -7
  57. package/docs/02-sync/02-functions.md +5 -8
  58. package/docs/02-sync/03-slack.md +0 -8
  59. package/docs/02-sync/04-github.md +0 -8
  60. package/docs/02-sync/07-linear.md +0 -6
  61. package/docs/03-guides/01-coding-agents.md +1 -0
  62. package/docs/03-guides/02-inspector.md +3 -2
  63. package/docs/03-guides/04-triage.md +8 -13
  64. package/docs/04-reference/01-cli.md +28 -4
  65. package/docs/04-reference/03-http.md +1 -1
  66. package/docs/04-reference/05-conformance.md +1 -1
  67. package/docs/index.md +3 -10
  68. package/package.json +2 -1
  69. package/dist/attempts-HXcskN1w.mjs +0 -10
  70. package/dist/exports-BxljH73E.d.mts +0 -4
@@ -0,0 +1,643 @@
1
+ import { p as ATTACHMENT_BYTES_MAX } from "./errors-rYDxZEuN.mjs";
2
+ import "./schemas-BG205xds.mjs";
3
+ import { t as Failed, u as who } from "./main-DoZ8IFPb.mjs";
4
+ import { t as page } from "./page-LysMGAl3.mjs";
5
+ import { randomBytes, timingSafeEqual } from "node:crypto";
6
+ import { createServer } from "node:http";
7
+ //#region src/inspect/style.ts
8
+ /**
9
+ * Just Chat's look: mono, quiet, one accent, hairlines only under headers.
10
+ * The default cursor everywhere but text; buttons never get a pointer; nothing
11
+ * scrolls smoothly; hovers are instant.
12
+ */
13
+ const CSS = `
14
+ :root {
15
+ --bg: #fafafa;
16
+ --bright: #040404;
17
+ --dim: #303030;
18
+ --muted: #646464;
19
+ --faint: #909090;
20
+ --hairline: #d9d9d9;
21
+ --shade: #f0f0f0;
22
+ --shade-hover: #e3e3e3;
23
+ /* The accent is the ink itself: black, and white in the dark. */
24
+ --accent: #040404;
25
+ --accent-transparent: rgba(4, 4, 4, 0.14);
26
+ --label: #fafafa;
27
+ --red: #c70000;
28
+ --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
29
+ color-scheme: light dark;
30
+ }
31
+ @media (prefers-color-scheme: dark) {
32
+ :root {
33
+ --bg: #040404;
34
+ --bright: #fafafa;
35
+ --dim: #dedede;
36
+ --muted: #909090;
37
+ --faint: #646464;
38
+ --hairline: #252525;
39
+ --shade: #161616;
40
+ --shade-hover: #1b1b1b;
41
+ --accent: #fafafa;
42
+ --accent-transparent: rgba(250, 250, 250, 0.22);
43
+ --label: #040404;
44
+ --red: #ff7b72;
45
+ }
46
+ }
47
+ * { box-sizing: border-box; }
48
+ html { scroll-behavior: auto; -webkit-tap-highlight-color: var(--accent-transparent); }
49
+ body {
50
+ margin: 0;
51
+ overflow: hidden;
52
+ background: var(--bg);
53
+ color: var(--dim);
54
+ font-family: var(--mono);
55
+ font-size: 13px;
56
+ letter-spacing: -0.02em;
57
+ line-height: 1.5;
58
+ cursor: default;
59
+ }
60
+ a { color: inherit; text-decoration: none; cursor: pointer; }
61
+ button { cursor: default; font: inherit; color: inherit; background: none; border: 0; padding: 0; letter-spacing: inherit; }
62
+ input, textarea { font: inherit; color: var(--bright); letter-spacing: inherit; cursor: text; }
63
+ ::selection { background: var(--accent-transparent); }
64
+ a:focus-visible, button:focus-visible, [role='separator']:focus-visible { outline: 2px dashed var(--accent); outline-offset: 2px; }
65
+
66
+ .boot { display: grid; place-items: center; height: 100dvh; color: var(--faint); }
67
+ .boot.error, .error { color: var(--red); }
68
+ .empty, .error { padding: 20px; margin: 0; color: var(--faint); }
69
+ .faint { color: var(--faint); }
70
+ .grow { flex: 1; min-width: 0; }
71
+ .hint { color: var(--faint); font-size: 11px; }
72
+
73
+ .shell { display: flex; height: 100dvh; overflow: hidden; }
74
+
75
+ /* --- sidebar: same background as the page; its edge is the resize line --- */
76
+ .sidebar { position: relative; flex-shrink: 0; display: flex; }
77
+ .sidebar-scroll { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 0 8px 12px; }
78
+ .brand {
79
+ height: 46px;
80
+ flex-shrink: 0;
81
+ display: flex;
82
+ align-items: center;
83
+ justify-content: space-between;
84
+ margin: 0 -8px 8px;
85
+ padding: 0 8px 0 16px;
86
+ border-bottom: 1px solid var(--hairline);
87
+ color: var(--bright);
88
+ font-weight: 600;
89
+ }
90
+ .sidebar h2 { margin: 16px 8px 4px; font-size: 11px; font-weight: 500; color: var(--faint); }
91
+ .sidebar .item {
92
+ display: flex;
93
+ align-items: center;
94
+ gap: 6px;
95
+ padding: 5px 8px;
96
+ color: var(--muted);
97
+ font-size: 13px;
98
+ cursor: default;
99
+ }
100
+ .sidebar .item:hover, .sidebar .item[aria-current='page'] { background: var(--shade); color: var(--bright); }
101
+ .sidebar .item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
102
+ .sidebar .item.unread { color: var(--bright); font-weight: 600; }
103
+ .sidebar .count { color: var(--faint); font-size: 11px; font-weight: 400; }
104
+ .sidebar .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
105
+ .whoami-wrap { margin-top: auto; padding-top: 16px; }
106
+ .whoami { width: 100%; display: flex; align-items: center; gap: 6px; padding: 6px 8px; color: var(--muted); font-size: 11px; text-align: left; }
107
+ .whoami:hover, .whoami[data-popup-open] { background: var(--shade); color: var(--bright); }
108
+ .whoami .grow { display: grid; }
109
+ .whoami .as, .whoami .url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
110
+ .whoami.naming { margin-top: auto; flex-direction: column; align-items: stretch; }
111
+ .whoami.naming .send { align-self: flex-end; }
112
+ .whoami.naming input { width: 100%; height: 28px; padding: 0 8px; border: 0; outline: 1px solid var(--muted); background: var(--shade); font-size: 12px; }
113
+ .choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
114
+ .choice svg { color: var(--accent); }
115
+
116
+ /* --- resize handles: a hairline that lights up --- */
117
+ .resize { position: absolute; top: 0; bottom: 0; width: 7px; z-index: 5; cursor: col-resize; display: flex; justify-content: center; outline: none; }
118
+ .resize.right { right: -3px; }
119
+ .resize.left { left: -3px; }
120
+ .resize i { width: 1px; height: 100%; background: var(--hairline); transition: background-color 0.12s; }
121
+ .resize:hover i { background: var(--muted); }
122
+ .resize.dragging i, .resize:focus-visible i { background: var(--accent); }
123
+
124
+ /* --- main and the thread pane --- */
125
+ .main, .pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
126
+ .main { flex: 1; }
127
+ .pane { position: relative; flex-shrink: 0; }
128
+ @media (max-width: 900px) {
129
+ .sidebar { display: none; }
130
+ .pane { position: fixed; inset: 0; width: auto !important; background: var(--bg); z-index: 30; }
131
+ .resize { display: none; }
132
+ }
133
+
134
+ .header {
135
+ height: 46px;
136
+ flex-shrink: 0;
137
+ display: flex;
138
+ align-items: center;
139
+ gap: 10px;
140
+ padding: 0 12px 0 20px;
141
+ border-bottom: 1px solid var(--hairline);
142
+ white-space: nowrap;
143
+ }
144
+ .header .title { color: var(--bright); font-weight: 600; }
145
+ .header .meta { color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
146
+ .header .spacer { flex: 1; }
147
+ .header > .tool:first-child { margin-left: -8px; }
148
+
149
+ .live { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 11px; }
150
+ .live i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
151
+ .live.live i { background: var(--accent); }
152
+
153
+ /* --- the feed: no row borders; a short conversation sits on the composer --- */
154
+ .feed-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
155
+ .feed { flex: 1; overflow-y: auto; padding: 8px 0 12px; display: flex; flex-direction: column; overflow-anchor: none; }
156
+ .feed > div { margin-top: auto; }
157
+ .jump {
158
+ position: absolute;
159
+ bottom: 12px;
160
+ left: 50%;
161
+ transform: translateX(-50%);
162
+ padding: 3px 10px;
163
+ border: 1px solid var(--accent);
164
+ background: var(--bg);
165
+ color: var(--accent);
166
+ font-size: 11px;
167
+ }
168
+ .divider { display: flex; align-items: center; gap: 8px; margin: 14px 20px 4px; color: var(--faint); font-size: 11px; }
169
+ .divider::after { content: ''; flex: 1; height: 1px; background: var(--hairline); }
170
+
171
+ .message { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 8px; padding: 6px 20px 4px 8px; }
172
+ .message.continued { padding-top: 1px; padding-bottom: 1px; }
173
+ .message.active { background: var(--shade); }
174
+ .message.pending { opacity: 0.5; }
175
+ .message.failed { opacity: 1; }
176
+ .gutter { display: flex; justify-content: center; align-items: flex-start; }
177
+ .gutter-time { visibility: hidden; color: var(--faint); font-size: 10px; line-height: 21px; }
178
+ .message.active .gutter-time, .gutter-time.shown { visibility: visible; }
179
+ .avatar {
180
+ flex-shrink: 0;
181
+ display: inline-grid;
182
+ place-items: center;
183
+ border-radius: 4px;
184
+ background: var(--shade-hover);
185
+ color: var(--muted);
186
+ font-weight: 600;
187
+ overflow: hidden;
188
+ }
189
+ .avatar img { width: 100%; height: 100%; object-fit: cover; }
190
+ .body { min-width: 0; }
191
+ .meta-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
192
+ .author { color: var(--bright); font-weight: 600; }
193
+ .where { color: var(--faint); font-size: 12px; }
194
+ .where a { color: var(--accent); cursor: default; }
195
+ .where a:hover { text-decoration: underline; }
196
+ .time, .id { color: var(--faint); font-size: 11px; }
197
+ /* Message text is markdown. Blocks stay compact; a short message reads as one line. */
198
+ .text { overflow-wrap: anywhere; color: var(--dim); font-size: 14px; cursor: text; }
199
+ .text > :first-child { margin-top: 0; }
200
+ .text > :last-child { margin-bottom: 0; }
201
+ .text > p:last-child, .text > p:has(+ .edited) { display: inline; }
202
+ .text p { margin: 0 0 6px; }
203
+ .text a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; overflow-wrap: anywhere; }
204
+ .text a:hover { text-decoration-color: currentColor; }
205
+ .text strong { color: var(--bright); font-weight: 600; }
206
+ .text h1, .text h2, .text h3, .text h4 { margin: 8px 0 4px; color: var(--bright); font-size: 14px; font-weight: 600; }
207
+ .text ul, .text ol { margin: 2px 0 6px; padding-left: 20px; }
208
+ .text li + li { margin-top: 1px; }
209
+ .text blockquote { margin: 4px 0; padding-left: 10px; border-left: 2px solid var(--hairline); color: var(--muted); }
210
+ .text code { padding: 1px 4px; border-radius: 3px; background: var(--shade); color: var(--bright); font-size: 0.92em; }
211
+ .message.active .text code { background: var(--shade-hover); }
212
+ .text pre { margin: 4px 0 6px; padding: 10px; overflow-x: auto; border: 1px solid var(--hairline); border-radius: 4px; background: var(--shade); line-height: 1.5; }
213
+ .text pre code, .message.active .text pre code { padding: 0; border-radius: 0; background: none; font-size: 13px; }
214
+ .text table { margin: 4px 0 6px; border-collapse: collapse; font-size: 12px; display: block; overflow-x: auto; max-width: 100%; }
215
+ .text th, .text td { padding: 3px 10px; border: 1px solid var(--hairline); text-align: left; white-space: nowrap; }
216
+ .text th { color: var(--bright); font-weight: 600; background: var(--shade); }
217
+ .text img { max-width: 100%; max-height: 260px; vertical-align: middle; }
218
+ .text hr { border: 0; height: 1px; margin: 8px 0; background: var(--hairline); }
219
+ .text input[type='checkbox'] { margin: 0 6px 0 0; vertical-align: middle; }
220
+ .text ul.contains-task-list { list-style: none; padding-left: 2px; }
221
+ .avatar-wrap { position: relative; display: inline-flex; }
222
+ .source {
223
+ position: absolute;
224
+ right: -5px;
225
+ bottom: -5px;
226
+ width: 16px;
227
+ height: 16px;
228
+ padding: 2px;
229
+ border-radius: 4px;
230
+ background: var(--bg);
231
+ color: var(--bright);
232
+ }
233
+ .source svg { display: block; width: 100%; height: 100%; }
234
+ .source.text { display: grid; place-items: center; font-size: 9px; font-weight: 600; }
235
+ .mention { color: var(--accent); font-weight: 600; }
236
+ .removed { color: var(--faint); font-style: italic; }
237
+ .edited { color: var(--faint); font-size: 11px; }
238
+ .undelivered { margin-top: 4px; font-size: 11px; color: var(--red); }
239
+ .undelivered button { text-decoration: underline; }
240
+
241
+ .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
242
+ .badge, .label, .chip {
243
+ display: inline-flex;
244
+ align-items: center;
245
+ gap: 4px;
246
+ padding: 1px 7px;
247
+ border: 1px solid var(--hairline);
248
+ background: var(--shade);
249
+ color: var(--muted);
250
+ font-size: 11px;
251
+ line-height: 16px;
252
+ }
253
+ .badge.slack, .badge.github { border-color: var(--accent-transparent); background: none; color: var(--accent); }
254
+ .label:hover, .chip:hover { color: var(--bright); background: var(--shade-hover); }
255
+ .label button { color: var(--faint); display: inline-flex; }
256
+ .label button:hover { color: var(--bright); }
257
+ /* Your own reaction: a little brighter, not louder. */
258
+ .chip.mine { border-color: var(--muted); background: var(--shade-hover); color: var(--bright); }
259
+ /* Attachments: media in a fixed frame, so loading never moves the page; files as chips. */
260
+ .links { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
261
+ .link-embed { padding: 2px 0 2px 10px; border-left: 2px solid var(--hairline); }
262
+ .link-meta { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--muted); }
263
+ .link-meta .author { font-size: 13px; }
264
+ .link-meta a, .link-file a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; overflow-wrap: anywhere; }
265
+ .link-meta a:hover, .link-file a:hover { text-decoration-color: currentColor; }
266
+ .link-file { display: flex; gap: 4px; align-items: center; margin-top: 2px; font-size: 12px; color: var(--muted); }
267
+ .attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
268
+ .attachment-media { display: block; width: 320px; max-width: 100%; height: 200px; border: 1px solid var(--hairline); background: var(--shade); overflow: hidden; }
269
+ .attachment-media img, .attachment-media video { display: block; width: 100%; height: 100%; object-fit: contain; }
270
+ .file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--hairline); background: var(--shade); color: var(--dim); font-size: 12px; }
271
+ button.file:hover { background: var(--shade-hover); color: var(--bright); }
272
+ .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
273
+ .file button { color: var(--faint); display: inline-flex; }
274
+ .file button:hover { color: var(--bright); }
275
+ .composer-files { margin: 0 12px 4px; }
276
+ .replies { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 0 -4px; padding: 2px 6px 2px 4px; color: var(--dim); font-size: 12px; font-weight: 600; }
277
+ .replies:hover { background: var(--shade-hover); color: var(--bright); }
278
+ .replies .time { font-weight: 400; }
279
+ .replies .faces { display: inline-flex; }
280
+ .replies .faces .avatar + .avatar { margin-left: -4px; }
281
+
282
+ .editor { display: grid; gap: 2px; margin: 2px 0; }
283
+ .editor textarea {
284
+ width: 100%;
285
+ padding: 8px 10px;
286
+ border: 1px solid var(--hairline);
287
+ background: var(--bg);
288
+ resize: none;
289
+ outline: none;
290
+ font-size: 14px;
291
+ }
292
+ .editor textarea:focus { border-color: var(--muted); }
293
+
294
+ /* --- hover actions: one hairline box at the row's corner --- */
295
+ .actions { position: absolute; top: -12px; right: 20px; z-index: 5; display: flex; border: 1px solid var(--hairline); background: var(--bg); }
296
+ .tool {
297
+ display: inline-flex;
298
+ align-items: center;
299
+ justify-content: center;
300
+ gap: 4px;
301
+ min-width: 28px;
302
+ height: 26px;
303
+ padding: 0 6px;
304
+ color: var(--muted);
305
+ font-size: 13px;
306
+ }
307
+ .tool:hover, .tool[data-popup-open] { background: var(--shade); color: var(--bright); }
308
+ .tool.on { color: var(--accent); }
309
+ .tool .count, .tool .tool-label { font-size: 11px; }
310
+
311
+ /* --- menus and popovers: square, a dim edge, an offset dot shadow --- */
312
+ .positioner { z-index: 50; outline: none; }
313
+ .frame { position: relative; isolation: isolate; }
314
+ .dots {
315
+ position: absolute;
316
+ left: 6px;
317
+ top: 6px;
318
+ width: 100%;
319
+ height: 100%;
320
+ z-index: -1;
321
+ background-image: radial-gradient(var(--faint) 0.8px, transparent 0.8px);
322
+ background-size: 4px 4px;
323
+ pointer-events: none;
324
+ }
325
+ .menu { min-width: 172px; padding: 6px; border: 1px solid var(--dim); background: var(--bg); outline: none; }
326
+ .menu.list { max-height: 260px; overflow-y: auto; }
327
+ .item {
328
+ display: flex;
329
+ align-items: center;
330
+ gap: 8px;
331
+ padding: 6px 8px;
332
+ color: var(--muted);
333
+ outline: none;
334
+ cursor: default;
335
+ white-space: nowrap;
336
+ }
337
+ .item[data-highlighted] { background: var(--shade); color: var(--bright); }
338
+ .item.danger, .item.danger[data-highlighted] { color: var(--red); }
339
+ /* A hint (a message's ID) gives way first: a long one ends in an ellipsis, not a wide menu. */
340
+ .item .hint { margin-left: 12px; min-width: 0; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }
341
+ .separator { height: 1px; margin: 4px 0; background: var(--hairline); }
342
+ .empty-item { padding: 6px 8px; color: var(--faint); }
343
+ .emoji-row { display: grid; grid-template-columns: repeat(6, 1fr); }
344
+ .item.emoji { justify-content: center; padding: 6px 0; font-size: 15px; }
345
+ .emoji-grid { display: grid; grid-template-columns: repeat(12, 30px); padding: 6px; }
346
+ .emoji-grid .emoji { height: 30px; font-size: 16px; }
347
+ .emoji-grid .emoji:hover { background: var(--shade); }
348
+ .popover { width: min(380px, calc(100vw - 32px)); padding: 12px; }
349
+ .popover-title { margin: 0 0 8px; color: var(--bright); font-size: 12px; font-weight: 600; }
350
+
351
+ .labels-editor { display: grid; gap: 10px; }
352
+ .labels-editor > .hint { margin: 0; }
353
+ .label-rows { display: grid; }
354
+ .label-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: center; gap: 8px; padding: 2px 0 2px 8px; }
355
+ .label-row:hover { background: var(--shade); }
356
+ .label-key { color: var(--bright); overflow: hidden; text-overflow: ellipsis; }
357
+ .label-value { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
358
+ .label-add { display: flex; align-items: center; gap: 6px; }
359
+ .suggest { display: flex; align-items: center; min-width: 0; padding: 0 8px; background: var(--shade); }
360
+ .suggest input { width: 100%; min-width: 0; height: 28px; border: 0; outline: none; background: none; }
361
+ .suggest:focus-within { outline: 1px solid var(--muted); }
362
+ .suggest .prefix { color: var(--faint); }
363
+ .label-add > .suggest { width: 38%; }
364
+
365
+ /* --- filters --- */
366
+ .filter-bar { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 20px 0; }
367
+ .clear { color: var(--faint); font-size: 11px; }
368
+ .clear:hover { color: var(--bright); }
369
+ .filter-form { display: grid; gap: 12px; }
370
+ .filter-form > .clear { justify-self: start; }
371
+ .filter-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: start; gap: 10px; }
372
+ .filter-name { color: var(--faint); font-size: 11px; line-height: 28px; }
373
+ .filter-row .grow { display: grid; gap: 6px; }
374
+ .segments { display: flex; flex-wrap: wrap; gap: 2px; }
375
+ .segment { height: 28px; padding: 0 10px; background: var(--shade); color: var(--muted); }
376
+ .segment:hover { color: var(--bright); }
377
+ .segment.on { background: var(--bright); color: var(--bg); }
378
+
379
+ /* --- the composer: an outline, not a border --- */
380
+ .composer { flex-shrink: 0; padding: 0 20px 20px; }
381
+ .composer-box {
382
+ display: flex;
383
+ flex-direction: column;
384
+ background: var(--bg);
385
+ outline: 2px dotted var(--hairline);
386
+ outline-offset: -1px;
387
+ cursor: text;
388
+ }
389
+ .composer-box:focus-within { background: var(--shade); outline-style: dashed; }
390
+ .composer-box textarea {
391
+ width: 100%;
392
+ min-height: 58px;
393
+ max-height: 160px;
394
+ padding: 10px 12px 2px;
395
+ border: 0;
396
+ outline: none;
397
+ background: none;
398
+ color: var(--dim);
399
+ font-size: 14px;
400
+ line-height: 1.5;
401
+ resize: none;
402
+ overflow-y: auto;
403
+ }
404
+ .composer-box textarea::placeholder { color: var(--faint); }
405
+ .composer-channel { margin: 8px 8px 0; align-self: flex-start; width: min(320px, calc(100% - 16px)); }
406
+ .composer-labels { margin: 8px 12px 0; }
407
+ .composer-footer { display: flex; align-items: center; gap: 2px; min-height: 40px; padding: 2px 8px 8px; }
408
+ .composer-footer .hint { margin-left: auto; margin-right: 8px; }
409
+ .pane .composer-footer .hint { display: none; }
410
+ .pane .composer-footer .send { margin-left: auto; }
411
+ .send { height: 32px; padding: 0 12px; background: var(--accent); color: var(--label); font-weight: 500; }
412
+ .send.small { height: 28px; padding: 0 10px; }
413
+ .send:disabled { opacity: 0.5; }
414
+
415
+ .inbox-row { display: grid; grid-template-columns: 70px 90px 1fr; gap: 12px; padding: 6px 20px; }
416
+ .inbox-row:hover { background: var(--shade); }
417
+ .inbox-row pre { margin: 4px 0 0; color: var(--faint); font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
418
+
419
+ .toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
420
+ .toast { max-width: 420px; padding: 8px 12px; border: 1px solid var(--dim); background: var(--bg); color: var(--bright); }
421
+ `;
422
+ /** The prebuilt UI where board is installed, read only when an inspector starts without one. */
423
+ const bundle = async () => (await import("./page-BAQpb-s-.mjs")).page();
424
+ const shell = (token) => `<!doctype html>
425
+ <html lang="en">
426
+ <head>
427
+ <meta charset="utf-8">
428
+ <meta name="viewport" content="width=device-width, initial-scale=1">
429
+ <meta name="inspect-token" content="${token}">
430
+ <title>board</title>
431
+ <style>${CSS}</style>
432
+ </head>
433
+ <body>
434
+ <div id="root"></div>
435
+ <script type="module" src="/app.js"><\/script>
436
+ </body>
437
+ </html>`;
438
+ const CSP = [
439
+ "default-src 'none'",
440
+ "img-src https: http://localhost:* http://127.0.0.1:* data: blob:",
441
+ "media-src blob:",
442
+ "style-src 'unsafe-inline'",
443
+ "script-src 'self'",
444
+ "connect-src 'self'",
445
+ "form-action 'none'",
446
+ "base-uri 'none'",
447
+ "frame-ancestors 'none'"
448
+ ].join("; ");
449
+ /**
450
+ * Serves the UI, and a proxy for the board's API that adds your credentials, on
451
+ * 127.0.0.1. Because the proxy acts as you, it answers only its own page: every
452
+ * request must name this server's host (no DNS rebinding) and carry the per-run
453
+ * token that only the page has, and writes must also come from its origin. Your
454
+ * board token never leaves this process.
455
+ */
456
+ async function startInspector(options) {
457
+ const { client } = options;
458
+ const me = await client.me();
459
+ const board = (await client.discovery().catch(() => null))?.url ?? client.url;
460
+ const app = options.page ?? await bundle();
461
+ const token = randomBytes(24).toString("base64url");
462
+ let origins = /* @__PURE__ */ new Set();
463
+ const streams = /* @__PURE__ */ new Set();
464
+ async function proxy(request, response, url) {
465
+ const reading = request.method === "GET" || request.method === "HEAD";
466
+ if (!sameSecret(String(request.headers["x-inspect-token"] ?? ""), token) || !reading && !origins.has(String(request.headers.origin))) return json(response, 403, { error: {
467
+ code: "forbidden",
468
+ message: "the board is reachable only from the inspector's own page"
469
+ } });
470
+ const path = url.pathname.slice(6) || "/";
471
+ let decoded;
472
+ try {
473
+ decoded = decodeURIComponent(path);
474
+ } catch {
475
+ decoded = "..";
476
+ }
477
+ if (/(^|\/)\.\.?(\/|$)|\\/.test(decoded)) return json(response, 400, { error: {
478
+ code: "bad_path",
479
+ message: "no relative paths"
480
+ } });
481
+ const controller = new AbortController();
482
+ streams.add(controller);
483
+ response.on("close", () => controller.abort());
484
+ try {
485
+ const body = reading ? void 0 : await read(request, path === "/attachments" ? ATTACHMENT_BYTES_MAX : void 0);
486
+ const chosen = request.headers["x-inspect-profile"];
487
+ const avatar = request.headers["x-inspect-avatar"];
488
+ const as = typeof chosen === "string" ? chosen === "" ? null : typeof avatar === "string" && avatar ? {
489
+ name: chosen,
490
+ avatar
491
+ } : chosen : void 0;
492
+ const upstream = await client.request(`${path}${url.search}`, {
493
+ ...as !== void 0 ? { as } : {},
494
+ method: request.method ?? "GET",
495
+ headers: {
496
+ ...request.headers["content-type"] ? { "content-type": String(request.headers["content-type"]) } : {},
497
+ ...request.headers.accept ? { accept: String(request.headers.accept) } : {},
498
+ ...request.headers["x-board-filename"] ? { "x-board-filename": String(request.headers["x-board-filename"]) } : {}
499
+ },
500
+ ...body ? { body } : {},
501
+ signal: controller.signal
502
+ });
503
+ response.writeHead(upstream.status, {
504
+ "content-type": upstream.headers.get("content-type") ?? "application/json",
505
+ "cache-control": "no-store",
506
+ "x-content-type-options": "nosniff"
507
+ });
508
+ if (upstream.body) for await (const chunk of upstream.body) response.write(chunk);
509
+ response.end();
510
+ } catch (error) {
511
+ if (controller.signal.aborted || response.headersSent) return void response.end();
512
+ json(response, 502, { error: {
513
+ code: "unreachable",
514
+ message: `the board didn't answer: ${error.message}`
515
+ } });
516
+ } finally {
517
+ streams.delete(controller);
518
+ }
519
+ }
520
+ const server = createServer((request, response) => {
521
+ const url = new URL(request.url ?? "/", "http://inspector");
522
+ if (!origins.has(`http://${request.headers.host}`)) return send(response, 421, "text/plain; charset=utf-8", "wrong host");
523
+ if (url.pathname === "/board" || url.pathname.startsWith("/board/")) return void proxy(request, response, url).catch(() => response.headersSent ? response.end() : send(response, 500, "text/plain; charset=utf-8", "error"));
524
+ if (request.method !== "GET") return send(response, 405, "text/plain; charset=utf-8", "method not allowed");
525
+ if (url.pathname === "/app.js") return app ? send(response, 200, "text/javascript; charset=utf-8", app) : send(response, 503, "text/plain; charset=utf-8", "the inspector's UI isn't built: run `pnpm --filter @vercel/board build`");
526
+ send(response, 200, "text/html; charset=utf-8", shell(token), { "content-security-policy": CSP });
527
+ });
528
+ const port = await listen(server, options.port ?? 4747, options.port === void 0);
529
+ origins = /* @__PURE__ */ new Set([`http://127.0.0.1:${port}`, `http://localhost:${port}`]);
530
+ return {
531
+ url: `http://127.0.0.1:${port}`,
532
+ board,
533
+ me,
534
+ close: () => new Promise((resolve) => {
535
+ for (const stream of streams) stream.abort();
536
+ server.close(() => resolve());
537
+ server.closeAllConnections();
538
+ })
539
+ };
540
+ }
541
+ function sameSecret(given, expected) {
542
+ const a = Buffer.from(given);
543
+ const b = Buffer.from(expected);
544
+ return a.length === b.length && timingSafeEqual(a, b);
545
+ }
546
+ function read(request, limit = 1048576) {
547
+ return new Promise((resolve, reject) => {
548
+ let size = 0;
549
+ const chunks = [];
550
+ request.on("data", (chunk) => {
551
+ size += chunk.length;
552
+ if (size > limit) {
553
+ reject(/* @__PURE__ */ new Error("request too large"));
554
+ request.destroy();
555
+ } else chunks.push(chunk);
556
+ });
557
+ request.on("end", () => resolve(new Uint8Array(Buffer.concat(chunks))));
558
+ request.on("error", reject);
559
+ });
560
+ }
561
+ function send(response, status, type, body, headers = {}) {
562
+ response.writeHead(status, {
563
+ "content-type": type,
564
+ "cache-control": "no-store",
565
+ "x-content-type-options": "nosniff",
566
+ "referrer-policy": "no-referrer",
567
+ ...headers
568
+ });
569
+ response.end(body);
570
+ }
571
+ const json = (response, status, body) => send(response, status, "application/json", JSON.stringify(body));
572
+ /** Listens on the port, or any free one when the default port is taken. */
573
+ async function listen(server, port, fallback) {
574
+ try {
575
+ return await listenOn(server, port);
576
+ } catch (error) {
577
+ if (fallback && error.code === "EADDRINUSE") return listenOn(server, 0);
578
+ throw error;
579
+ }
580
+ }
581
+ function listenOn(server, port) {
582
+ return new Promise((resolve, reject) => {
583
+ const onError = (error) => {
584
+ server.off("listening", onListening);
585
+ reject(error);
586
+ };
587
+ const onListening = () => {
588
+ server.off("error", onError);
589
+ resolve(server.address().port);
590
+ };
591
+ server.once("error", onError);
592
+ server.once("listening", onListening);
593
+ server.listen(port, "127.0.0.1");
594
+ });
595
+ }
596
+ //#endregion
597
+ //#region src/cli/inspect.ts
598
+ /** Until Ctrl-C or a SIGTERM, whichever comes first: then neither is listened for. */
599
+ const stopped = () => new Promise((resolve) => {
600
+ const done = () => {
601
+ process.off("SIGINT", done);
602
+ process.off("SIGTERM", done);
603
+ resolve();
604
+ };
605
+ process.once("SIGINT", done);
606
+ process.once("SIGTERM", done);
607
+ });
608
+ /** The page to serve, before anything starts: a run that can't have one says so, and serves nothing. */
609
+ async function pageOf(provided) {
610
+ if (provided) try {
611
+ return await provided();
612
+ } catch (error) {
613
+ throw new Failed({
614
+ class: "unknown",
615
+ reason: "inspector_page_unavailable",
616
+ message: `Couldn't get the inspector's page: ${error.message}`
617
+ });
618
+ }
619
+ const found = await page();
620
+ if (found === null) throw new Failed({
621
+ class: "unknown",
622
+ reason: "no_inspector_page",
623
+ message: "The inspector's page isn't beside board's CLI.",
624
+ next: [{ instruction: "An app that bundles board's CLI passes it to createApp as inspectorPage" }, { instruction: "From source, build board first: pnpm --filter @vercel/board build" }]
625
+ });
626
+ return found;
627
+ }
628
+ async function inspect({ flags, out, portFlag, client, openBrowser, inspectorPage }) {
629
+ const port = portFlag();
630
+ const page = await pageOf(inspectorPage);
631
+ const inspector = await startInspector({
632
+ client: client(),
633
+ page,
634
+ ...port !== void 0 ? { port } : {}
635
+ });
636
+ out(`inspecting ${inspector.board} as ${who(inspector.me)} at ${inspector.url} (Ctrl-C to stop)`);
637
+ if (!flags["no-open"]) openBrowser(inspector.url);
638
+ await stopped();
639
+ await inspector.close();
640
+ return 0;
641
+ }
642
+ //#endregion
643
+ export { stopped as n, startInspector as r, inspect as t };