@vercel/board 0.48.1 → 0.49.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 (82) hide show
  1. package/dist/{access-C06pIr0M.mjs → access-B8DnrnHa.mjs} +29 -17
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +5 -5
  4. package/dist/{actors-Dkyg-oo0.mjs → actors-DewJKyqy.mjs} +4 -3
  5. package/dist/{auth-B9-wXQ-x.mjs → auth-CEU06Nyp.mjs} +2 -2
  6. package/dist/{auth-li3lKwJG.d.mts → auth-Z9-Khvvw.d.mts} +1 -1
  7. package/dist/{backend-UBP6HimX.d.mts → backend-BzCXxVZ-.d.mts} +19 -5
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-kNWd6MQC.mjs → chat-provider-BS_fr61g.mjs} +2 -2
  11. package/dist/{chat-provider-iN0DFsSE.d.mts → chat-provider-DQ1GHm4o.d.mts} +2 -2
  12. package/dist/cli-commands.d.mts +1 -1
  13. package/dist/cli-commands.mjs +1 -1
  14. package/dist/cli-embedded.d.mts +2 -2
  15. package/dist/cli-embedded.mjs +3 -3
  16. package/dist/cli.mjs +6 -6
  17. package/dist/client-C2T4eaXd.d.mts +544 -0
  18. package/dist/{commands-CJsOA-hf.d.mts → commands-Cm4sODIu.d.mts} +12 -8
  19. package/dist/{commands-Dk6_cHLS.mjs → commands-nN8WpvCe.mjs} +75 -58
  20. package/dist/{conformance-CDP8y2Zm.mjs → conformance-0xONNKcB.mjs} +102 -20
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-BQ0hJw2w.mjs → engine-BH_nfJ3N.mjs} +6 -5
  24. package/dist/{errors-QhkdzI-o.mjs → errors-DwV7I0g4.mjs} +53 -174
  25. package/dist/{events-B-qyxNsJ.mjs → events-B76-4bNp.mjs} +2 -2
  26. package/dist/{exports-inhbjAWi.d.mts → exports-CKEK1fxf.d.mts} +4 -4
  27. package/dist/{exports-BzSG0_wL.mjs → exports-DLzyKwEp.mjs} +336 -82
  28. package/dist/{external-BuVTXT1R.mjs → external-BLI4W_-V.mjs} +1 -1
  29. package/dist/{index-B0Fnhvk7.d.mts → index-DxqSw8yd.d.mts} +2 -2
  30. package/dist/index.d.mts +6 -6
  31. package/dist/index.mjs +4 -4
  32. package/dist/index.node.d.mts +7 -7
  33. package/dist/index.node.mjs +4 -4
  34. package/dist/inspect/app.js +39 -39
  35. package/dist/inspect-B2ImmOvw.mjs +272 -0
  36. package/dist/inspect-DnRQUmP8.mjs +2 -0
  37. package/dist/inspect.d.mts +17 -0
  38. package/dist/inspect.mjs +196 -0
  39. package/dist/{local-BdKxz-Dn.mjs → local-DPpSEq2_.mjs} +132 -50
  40. package/dist/{main-BgiViRZ8.mjs → main-CqX7JqzE.mjs} +214 -46
  41. package/dist/{memory-CMm-Fk_A.mjs → memory-DzqkXIB-.mjs} +2 -2
  42. package/dist/{middleware-CT6vMNUc.mjs → middleware-ysFm2S4v.mjs} +2 -2
  43. package/dist/{page-D-OzDOAX.mjs → page-7KWSGxyC.mjs} +12 -2
  44. package/dist/page-CN77B014.mjs +2 -0
  45. package/dist/profile-header-Cj0Cb1cf.mjs +163 -0
  46. package/dist/{provider-DC3WHUXo.d.mts → provider-Dwb_9mnu.d.mts} +3 -529
  47. package/dist/{routes-CjA6Mp4D.d.mts → routes-B6SEA9yw.d.mts} +130 -4
  48. package/dist/{routes-ABXf3CKq.mjs → routes-qS92xz8U.mjs} +33 -7
  49. package/dist/{schemas-7VFdomFB.mjs → schemas-TeVe4Udh.mjs} +4 -2
  50. package/dist/{serve-C2Jbr7pR.mjs → serve-CYr4RwRM.mjs} +5 -5
  51. package/dist/{server-EOQC5Gtq.mjs → server-V7qyVUiJ.mjs} +11 -9
  52. package/dist/{serving-BNdiReQT.mjs → serving-BzNxlnDV.mjs} +1 -1
  53. package/dist/{inspect-n9brh-TT.mjs → shell-BLHZoP-x.mjs} +25 -274
  54. package/dist/{sql-IEbO5vXs.mjs → sql-DIKQd5Me.mjs} +2 -2
  55. package/dist/{sqlite-CVG8XKHm.mjs → sqlite-BF9kBDh1.mjs} +2 -2
  56. package/dist/{sqlite-db-BJjPQYx4.mjs → sqlite-db-CSYwiZ4E.mjs} +1 -1
  57. package/dist/sync-chat-sdk.d.mts +2 -2
  58. package/dist/sync-chat-sdk.mjs +2 -2
  59. package/dist/sync-github.d.mts +2 -2
  60. package/dist/sync-github.mjs +2 -2
  61. package/dist/sync-linear.d.mts +3 -3
  62. package/dist/sync-linear.mjs +2 -2
  63. package/dist/sync-slack.d.mts +3 -3
  64. package/dist/sync-slack.mjs +11 -7
  65. package/dist/sync.d.mts +2 -2
  66. package/dist/sync.mjs +2 -2
  67. package/dist/{task-batch-D4p9N8lN.mjs → task-batch-CujTLmTB.mjs} +10 -11
  68. package/dist/{tokens-BCp4EWTQ.mjs → tokens-BmCDAT4N.mjs} +2 -2
  69. package/dist/version-BCoWGLEW.mjs +5 -0
  70. package/docs/01-board/01-mounting.md +8 -0
  71. package/docs/01-board/04-messages.md +6 -2
  72. package/docs/01-board/05-reading.md +17 -2
  73. package/docs/01-board/09-access.md +40 -6
  74. package/docs/01-board/11-tasks.md +3 -3
  75. package/docs/03-guides/02-inspector.md +31 -0
  76. package/docs/04-reference/01-cli.md +81 -32
  77. package/docs/04-reference/02-board.md +14 -3
  78. package/docs/04-reference/03-http.md +5 -3
  79. package/docs/04-reference/05-conformance.md +7 -0
  80. package/package.json +5 -1
  81. package/dist/inspect-BB-XUPuz.mjs +0 -2
  82. package/dist/page-Dr9Aqlej.mjs +0 -2
@@ -1,9 +1,4 @@
1
- import { g as InvalidProfileHeader, v as parseProfileHeader, y as ATTACHMENT_BYTES_MAX } from "./errors-QhkdzI-o.mjs";
2
- import "./schemas-7VFdomFB.mjs";
3
- import { t as Failed, u as who } from "./main-BgiViRZ8.mjs";
4
- import { t as page } from "./page-D-OzDOAX.mjs";
5
- import { randomBytes, timingSafeEqual } from "node:crypto";
6
- import { createServer } from "node:http";
1
+ import { t as VERSION } from "./version-BCoWGLEW.mjs";
7
2
  //#region src/inspect/style.ts
8
3
  /**
9
4
  * Just Chat's look: mono, quiet, one accent, hairlines only under headers.
@@ -65,6 +60,10 @@ a:focus-visible, button:focus-visible, [role='separator']:focus-visible { outlin
65
60
 
66
61
  .boot { display: grid; place-items: center; height: 100dvh; color: var(--faint); }
67
62
  .boot.error, .error { color: var(--red); }
63
+ .name-gate { display: grid; gap: 10px; width: min(320px, 90vw); color: var(--bright); }
64
+ .name-gate p { margin: 0; color: var(--faint); }
65
+ .name-gate input { width: 100%; height: 36px; padding: 0 10px; border: 0; outline: 1px solid var(--muted); background: var(--shade); font-size: 16px; }
66
+ .name-gate .send { justify-self: end; }
68
67
  .empty, .error { padding: 20px; margin: 0; color: var(--faint); }
69
68
  .faint { color: var(--faint); }
70
69
  .grow { flex: 1; min-width: 0; }
@@ -632,31 +631,28 @@ button.file:hover { background: var(--shade-hover); color: var(--bright); }
632
631
  input, textarea, select { font-size: 16px !important; }
633
632
  }
634
633
  `;
635
- /** What a proxy adds to a request it forwards: Tailscale's sets `X-Forwarded-Host`, most others `X-Forwarded-For`. */
636
- const FORWARDED = [
637
- "forwarded",
638
- "x-forwarded-for",
639
- "x-forwarded-host",
640
- "x-forwarded-proto",
641
- "x-real-ip"
642
- ];
643
- /** The prebuilt UI where board is installed, read only when an inspector starts without one. */
644
- const bundle = async () => (await import("./page-Dr9Aqlej.mjs")).page();
634
+ //#endregion
635
+ //#region src/inspect/shell.ts
645
636
  const attribute = (value) => value.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
646
- /** The page, with what only this run's page is told: its token for the proxy, and the profile inspect started as. */
647
- const shell = (token, profile) => `<!doctype html>
637
+ /**
638
+ * The page, with what only it is told: its credential for the proxy, the profile it starts as, and
639
+ * the path it's served under (`''` at a server's root), which its bundle, its proxy, and its links
640
+ * are under too.
641
+ */
642
+ const shell = ({ token, profile, base, named = false }) => `<!doctype html>
648
643
  <html lang="en">
649
644
  <head>
650
645
  <meta charset="utf-8">
651
646
  <meta name="viewport" content="width=device-width, initial-scale=1">
652
- <meta name="inspect-token" content="${token}">
647
+ <meta name="inspect-token" content="${attribute(token)}">
653
648
  <meta name="inspect-profile" content="${attribute(JSON.stringify(profile))}">
654
- <title>board</title>
649
+ <meta name="inspect-base" content="${attribute(base)}">
650
+ ${named ? "<meta name=\"inspect-named\" content=\"1\">\n" : ""}<title>board</title>
655
651
  <style>${CSS}</style>
656
652
  </head>
657
653
  <body>
658
654
  <div id="root"></div>
659
- <script type="module" src="/app.js"><\/script>
655
+ <script type="module" src="${attribute(base)}/app.js?v=${attribute(VERSION)}"><\/script>
660
656
  </body>
661
657
  </html>`;
662
658
  const CSP = [
@@ -670,260 +666,15 @@ const CSP = [
670
666
  "base-uri 'none'",
671
667
  "frame-ancestors 'none'"
672
668
  ].join("; ");
673
- /**
674
- * The UI, and a proxy for the board's API that adds your credentials, for a server
675
- * on 127.0.0.1 to answer with. Because the proxy acts as you, it answers only its
676
- * own page: every request must name the server's host (no DNS rebinding) and carry
677
- * the per-run token that only the page has, and writes must also come from its
678
- * origin. Your credential for the board never leaves this process. `hosts` adds
679
- * names a proxy in front of it serves the page on: whoever reaches the page there
680
- * acts as you, unless `visitor` says who a request is: a client that acts as them,
681
- * or null for one it can't name, which the proxy then refuses. A request a proxy
682
- * forwarded must name one of them: the server's own name is this machine's alone,
683
- * and a caller behind a proxy can send it too.
684
- */
685
- async function createInspector(options) {
686
- const { client } = options;
687
- const me = await client.me();
688
- const started = me.profile === null ? null : me.avatar ? {
689
- name: me.profile,
690
- avatar: me.avatar
691
- } : me.profile;
692
- const board = (await client.discovery().catch(() => null))?.url ?? client.url;
693
- const app = options.page ?? await bundle();
694
- const token = randomBytes(24).toString("base64url");
695
- const allowed = new Set((options.hosts ?? []).map((host) => host.toLowerCase()));
696
- let hosts = /* @__PURE__ */ new Set();
697
- let proxied = /* @__PURE__ */ new Set();
698
- let origins = /* @__PURE__ */ new Set();
699
- const streams = /* @__PURE__ */ new Set();
700
- async function proxy(request, response, url) {
701
- const reading = request.method === "GET" || request.method === "HEAD";
702
- if (!sameSecret(String(request.headers["x-inspect-token"] ?? ""), token) || !reading && !origins.has(String(request.headers.origin))) return json(response, 403, { error: {
703
- code: "forbidden",
704
- message: "the board is reachable only from the inspector's own page"
705
- } });
706
- const path = url.pathname.slice(6) || "/";
707
- let decoded;
708
- try {
709
- decoded = decodeURIComponent(path);
710
- } catch {
711
- decoded = "..";
712
- }
713
- if (/(^|\/)\.\.?(\/|$)|\\/.test(decoded)) return json(response, 400, { error: {
714
- code: "bad_path",
715
- message: "no relative paths"
716
- } });
717
- const visiting = options.visitor?.(request);
718
- if (visiting === null) return json(response, 401, { error: {
719
- code: "unauthorized",
720
- message: "the proxy in front of this page names no one for this request, so there's no one to act as"
721
- } });
722
- const acting = visiting ?? client;
723
- const controller = new AbortController();
724
- streams.add(controller);
725
- response.on("close", () => controller.abort());
726
- try {
727
- const body = reading ? void 0 : await read(request, path === "/attachments" ? ATTACHMENT_BYTES_MAX : void 0);
728
- let as = null;
729
- const named = request.headers["x-board-profile"];
730
- if (typeof named === "string" && named.trim() !== "") try {
731
- const { name, avatar } = parseProfileHeader(named);
732
- as = avatar === null ? name : {
733
- name,
734
- avatar
735
- };
736
- } catch (error) {
737
- if (!(error instanceof InvalidProfileHeader)) throw error;
738
- return json(response, 400, { error: {
739
- code: "invalid_profile",
740
- message: error.message
741
- } });
742
- }
743
- const upstream = await acting.request(`${path}${url.search}`, {
744
- as,
745
- method: request.method ?? "GET",
746
- headers: {
747
- ...request.headers["content-type"] ? { "content-type": String(request.headers["content-type"]) } : {},
748
- ...request.headers.accept ? { accept: String(request.headers.accept) } : {},
749
- ...request.headers["x-board-filename"] ? { "x-board-filename": String(request.headers["x-board-filename"]) } : {}
750
- },
751
- ...body ? { body } : {},
752
- signal: controller.signal
753
- });
754
- response.writeHead(upstream.status, {
755
- "content-type": upstream.headers.get("content-type") ?? "application/json",
756
- "cache-control": "no-store",
757
- "x-content-type-options": "nosniff"
758
- });
759
- if (upstream.body) for await (const chunk of upstream.body) response.write(chunk);
760
- response.end();
761
- } catch (error) {
762
- if (controller.signal.aborted || response.headersSent) return void response.end();
763
- json(response, 502, { error: {
764
- code: "unreachable",
765
- message: `the board didn't answer: ${error.message}`
766
- } });
767
- } finally {
768
- streams.delete(controller);
769
- }
770
- }
771
- function handle(request, response) {
772
- let url;
773
- try {
774
- url = new URL(request.url ?? "/", "http://inspector");
775
- } catch {
776
- return send(response, 400, "text/plain; charset=utf-8", "bad request");
777
- }
778
- const named = String(request.headers.host).toLowerCase();
779
- if (!(FORWARDED.some((header) => request.headers[header] !== void 0) ? proxied : hosts).has(named)) return send(response, 421, "text/plain; charset=utf-8", "wrong host");
780
- 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"));
781
- if (request.method !== "GET") return send(response, 405, "text/plain; charset=utf-8", "method not allowed");
782
- 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`");
783
- send(response, 200, "text/html; charset=utf-8", shell(token, started), { "content-security-policy": CSP });
784
- }
785
- return {
786
- board,
787
- me,
788
- at(port) {
789
- const own = [`127.0.0.1:${port}`, `localhost:${port}`];
790
- hosts = /* @__PURE__ */ new Set([...own, ...allowed]);
791
- proxied = new Set([...allowed].filter((host) => !own.includes(host)));
792
- origins = /* @__PURE__ */ new Set([
793
- `http://127.0.0.1:${port}`,
794
- `http://localhost:${port}`,
795
- ...[...allowed].flatMap((host) => [`http://${host}`, `https://${host}`])
796
- ]);
797
- return {
798
- handle,
799
- close() {
800
- for (const stream of streams) stream.abort();
801
- }
802
- };
803
- }
804
- };
805
- }
806
- /** The inspector on a server of its own, on 127.0.0.1: `port`, or 4747, or any free one when that's taken. */
807
- async function startInspector(options) {
808
- const inspector = await createInspector(options);
809
- let page = null;
810
- const server = createServer((request, response) => page ? page.handle(request, response) : void response.writeHead(503).end());
811
- const port = await listen(server, options.port ?? 4747, options.port === void 0);
812
- const serving = page = inspector.at(port);
813
- return {
814
- url: `http://127.0.0.1:${port}`,
815
- board: inspector.board,
816
- me: inspector.me,
817
- close: () => new Promise((resolve) => {
818
- serving.close();
819
- server.close(() => resolve());
820
- server.closeAllConnections();
821
- })
822
- };
823
- }
824
- function sameSecret(given, expected) {
825
- const a = Buffer.from(given);
826
- const b = Buffer.from(expected);
827
- return a.length === b.length && timingSafeEqual(a, b);
828
- }
829
- function read(request, limit = 1048576) {
830
- return new Promise((resolve, reject) => {
831
- let size = 0;
832
- const chunks = [];
833
- request.on("data", (chunk) => {
834
- size += chunk.length;
835
- if (size > limit) {
836
- reject(/* @__PURE__ */ new Error("request too large"));
837
- request.destroy();
838
- } else chunks.push(chunk);
839
- });
840
- request.on("end", () => resolve(new Uint8Array(Buffer.concat(chunks))));
841
- request.on("error", reject);
842
- });
843
- }
844
- function send(response, status, type, body, headers = {}) {
845
- response.writeHead(status, {
846
- "content-type": type,
847
- "cache-control": "no-store",
848
- "x-content-type-options": "nosniff",
849
- "referrer-policy": "no-referrer",
850
- ...headers
851
- });
852
- response.end(body);
853
- }
854
- const json = (response, status, body) => send(response, status, "application/json", JSON.stringify(body));
855
- /** Listens on the port, or any free one when the default port is taken. */
856
- async function listen(server, port, fallback) {
669
+ /** Whether a proxied path, as sent, climbs out of the board's API: `..`, `.`, or a backslash, encoded or not. */
670
+ function relative(path) {
671
+ let decoded;
857
672
  try {
858
- return await listenOn(server, port);
859
- } catch (error) {
860
- if (fallback && error.code === "EADDRINUSE") return listenOn(server, 0);
861
- throw error;
673
+ decoded = decodeURIComponent(path);
674
+ } catch {
675
+ return true;
862
676
  }
863
- }
864
- function listenOn(server, port) {
865
- return new Promise((resolve, reject) => {
866
- const onError = (error) => {
867
- server.off("listening", onListening);
868
- reject(error);
869
- };
870
- const onListening = () => {
871
- server.off("error", onError);
872
- resolve(server.address().port);
873
- };
874
- server.once("error", onError);
875
- server.once("listening", onListening);
876
- server.listen(port, "127.0.0.1");
877
- });
878
- }
879
- //#endregion
880
- //#region src/cli/inspect.ts
881
- /** Until Ctrl-C or a SIGTERM, whichever comes first: then neither is listened for. */
882
- const stopped = () => new Promise((resolve) => {
883
- const done = () => {
884
- process.off("SIGINT", done);
885
- process.off("SIGTERM", done);
886
- resolve();
887
- };
888
- process.once("SIGINT", done);
889
- process.once("SIGTERM", done);
890
- });
891
- /** The page to serve, before anything starts: an install without one says so, and serves nothing. */
892
- async function pageOf() {
893
- const found = await page();
894
- if (found === null) throw new Failed({
895
- class: "unknown",
896
- reason: "no_inspector_page",
897
- message: "The inspector's page isn't installed with this CLI.",
898
- next: [{ instruction: "Reinstall or update the CLI" }]
899
- });
900
- return found;
901
- }
902
- /** The hosts `--allow-host`, or `--tailscale`, names: each a host, with its port when that isn't its scheme's default. */
903
- function allowedHosts({ flags, usage }, flag = "allow-host") {
904
- const hosts = flags[flag] ?? [];
905
- const bad = hosts.find((host) => !/^[a-z0-9.-]+(:\d+)?$/i.test(host));
906
- if (bad !== void 0) throw usage(`--${flag} takes a host, with a port if it isn't the default, like box.tailnet.ts.net: not ${bad}.`);
907
- return [...new Set(hosts.flatMap((host) => [host, host.replace(/:(443|80)$/, "")]))];
908
- }
909
- async function inspect({ flags, out, usage, portFlag, client, openBrowser }) {
910
- const port = portFlag();
911
- const hosts = allowedHosts({
912
- flags,
913
- usage
914
- });
915
- const page = await pageOf();
916
- const inspector = await startInspector({
917
- client: client(),
918
- page,
919
- hosts,
920
- ...port !== void 0 ? { port } : {}
921
- });
922
- out(`inspecting ${inspector.board} as ${who(inspector.me)} at ${inspector.url} (Ctrl-C to stop)`);
923
- if (!flags["no-open"]) openBrowser(inspector.url);
924
- await stopped();
925
- await inspector.close();
926
- return 0;
677
+ return /(^|\/)\.\.?(\/|$)|\\/.test(decoded);
927
678
  }
928
679
  //#endregion
929
- export { createInspector as i, inspect as n, stopped as r, allowedHosts as t };
680
+ export { relative as n, shell as r, CSP as t };
@@ -1,5 +1,5 @@
1
- import { k as actorKind, w as TASK_LABEL } from "./schemas-7VFdomFB.mjs";
2
- import { c as externalMessageKey, l as isThreadTarget } from "./external-BuVTXT1R.mjs";
1
+ import { k as actorKind, w as TASK_LABEL } from "./schemas-TeVe4Udh.mjs";
2
+ import { c as externalMessageKey, l as isThreadTarget } from "./external-BLI4W_-V.mjs";
3
3
  import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
4
4
  import { i as mentionTerms } from "./mentions-CnWt9Z5b.mjs";
5
5
  import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
@@ -1,6 +1,6 @@
1
- import { r as sqlTables } from "./sql-IEbO5vXs.mjs";
1
+ import { r as sqlTables } from "./sql-DIKQd5Me.mjs";
2
2
  import { t as sqlite$1 } from "./store-sqlite-D6fIszST.mjs";
3
- import { t as sqliteDb } from "./sqlite-db-BJjPQYx4.mjs";
3
+ import { t as sqliteDb } from "./sqlite-db-CSYwiZ4E.mjs";
4
4
  //#region src/store/sqlite.ts
5
5
  /**
6
6
  * A local board in one SQLite file, its log and board's tables side by side. It
@@ -1,4 +1,4 @@
1
- import { n as ddl } from "./sql-IEbO5vXs.mjs";
1
+ import { n as ddl } from "./sql-DIKQd5Me.mjs";
2
2
  import { mkdirSync } from "node:fs";
3
3
  import { dirname, resolve } from "node:path";
4
4
  //#region src/store/sqlite-db.ts
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-DC3WHUXo.mjs";
2
- import { r as ChatTransport, t as ChatInput } from "./chat-provider-iN0DFsSE.mjs";
1
+ import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-Dwb_9mnu.mjs";
2
+ import { r as ChatTransport, t as ChatInput } from "./chat-provider-DQ1GHm4o.mjs";
3
3
  import { z } from "zod";
4
4
  import { ReactionEvent } from "chat";
5
5
  //#region src/sync/chat-sdk.d.ts
@@ -1,5 +1,5 @@
1
- import { i as eventSchema, p as channels, r as envelope } from "./events-B-qyxNsJ.mjs";
2
- import { t as ChatSyncProvider } from "./chat-provider-kNWd6MQC.mjs";
1
+ import { i as eventSchema, p as channels, r as envelope } from "./events-B76-4bNp.mjs";
2
+ import { t as ChatSyncProvider } from "./chat-provider-BS_fr61g.mjs";
3
3
  import { createHash } from "node:crypto";
4
4
  //#region src/sync/chat-sdk.ts
5
5
  const schemaOf = (platform) => eventSchema(platform, "message");
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-DC3WHUXo.mjs";
2
- import { n as ChatSyncProvider } from "./chat-provider-iN0DFsSE.mjs";
1
+ import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-Dwb_9mnu.mjs";
2
+ import { n as ChatSyncProvider } from "./chat-provider-DQ1GHm4o.mjs";
3
3
  import { z } from "zod";
4
4
  import { Adapter } from "chat";
5
5
  //#region src/sync/github.d.ts
@@ -1,5 +1,5 @@
1
- import { _ as withRoutes, i as eventSchema, m as into, r as envelope } from "./events-B-qyxNsJ.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-kNWd6MQC.mjs";
1
+ import { _ as withRoutes, i as eventSchema, m as into, r as envelope } from "./events-B76-4bNp.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-BS_fr61g.mjs";
3
3
  import { n as tagOf } from "./tags-BpFo6q0_.mjs";
4
4
  import { z } from "zod";
5
5
  import { connectGitHubAdapter } from "@vercel/connect/chat";
@@ -1,6 +1,6 @@
1
- import { Ot as SourceRead } from "./routes-CjA6Mp4D.mjs";
2
- import { _ as SyncFn, b as SyncUnit, f as ResolvedTarget, l as ReceivedEvent, o as ProviderPost, p as SyncContext, r as ProviderDelivery } from "./provider-DC3WHUXo.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-iN0DFsSE.mjs";
1
+ import { Mt as SourceRead } from "./routes-B6SEA9yw.mjs";
2
+ import { _ as SyncFn, b as SyncUnit, f as ResolvedTarget, l as ReceivedEvent, o as ProviderPost, p as SyncContext, r as ProviderDelivery } from "./provider-Dwb_9mnu.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DQ1GHm4o.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/linear.d.ts
@@ -1,5 +1,5 @@
1
- import { i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-B-qyxNsJ.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-kNWd6MQC.mjs";
1
+ import { i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-B76-4bNp.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-BS_fr61g.mjs";
3
3
  import { n as tagOf, t as slug } from "./tags-BpFo6q0_.mjs";
4
4
  import "zod";
5
5
  import { connectLinearAdapter } from "@vercel/connect/chat";
@@ -1,6 +1,6 @@
1
- import { Nn as ExternalLink } from "./routes-CjA6Mp4D.mjs";
2
- import { _ as SyncFn, f as ResolvedTarget, o as ProviderPost, p as SyncContext, r as ProviderDelivery, s as ProviderSender, x as channels } from "./provider-DC3WHUXo.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-iN0DFsSE.mjs";
1
+ import { zn as ExternalLink } from "./routes-B6SEA9yw.mjs";
2
+ import { _ as SyncFn, f as ResolvedTarget, o as ProviderPost, p as SyncContext, r as ProviderDelivery, s as ProviderSender, x as channels } from "./provider-Dwb_9mnu.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DQ1GHm4o.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/slack-deployments.d.ts
@@ -1,8 +1,8 @@
1
- import { m as MESSAGE_TEXT_MAX } from "./schemas-7VFdomFB.mjs";
2
- import "./external-BuVTXT1R.mjs";
1
+ import { m as MESSAGE_TEXT_MAX } from "./schemas-TeVe4Udh.mjs";
2
+ import "./external-BLI4W_-V.mjs";
3
3
  import { t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
4
- import { d as opensBlock, i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-B-qyxNsJ.mjs";
5
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-kNWd6MQC.mjs";
4
+ import { d as opensBlock, i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-B76-4bNp.mjs";
5
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-BS_fr61g.mjs";
6
6
  import { r as formatVercelDeployments } from "./bots-CqPYxkqK.mjs";
7
7
  import { z } from "zod";
8
8
  import { stringifyMarkdown } from "chat";
@@ -123,11 +123,15 @@ const MENTIONED = /@\uF8F0([A-Z0-9_]+)\uF8F1/g;
123
123
  const mentionedAs = (user) => `\uF8F0${user}\uF8F1`;
124
124
  /** A user's mention in Slack's own mrkdwn, with the name Slack may give it: `<@U0456>`, `<@U0456|ada>`. */
125
125
  const SLACK_MENTION = /<@([A-Z0-9_]+)(?:\|[^<>]*)?>/g;
126
- /** A Slack user's ID, as `<@U0456>` names one. */
127
- const SLACK_USER_ID = /^[A-Z0-9_]+$/;
126
+ /**
127
+ * A Slack user's ID, as `<@U0456>` names one: `U…`, or `W…` on Enterprise Grid. A bot's own ID
128
+ * (`B…`, the author of an app's messages) isn't one, and Slack shows `<@B0456>` as it's written.
129
+ */
130
+ const SLACK_USER_ID = /^[UW][A-Z0-9_]+$/;
128
131
  /**
129
132
  * A Slack user as Slack mentions them, from their ID alone. Only a user's ID: anything else between
130
- * `<@` and `>` could close the mention and open Slack's own markup (`<!channel>`).
133
+ * `<@` and `>` could close the mention and open Slack's own markup (`<!channel>`), and a bot's ID
134
+ * shows as markup, so the mention stays text.
131
135
  */
132
136
  function slackMention(id) {
133
137
  const user = id.startsWith("slack:user:") ? id.slice(11) : null;
package/dist/sync.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { An as ExternalAuthor, Mn as ExternalFile, jn as ExternalEvent } from "./routes-CjA6Mp4D.mjs";
2
- import { A as SyncRoot, C as mirror, D as RootOverride, E as ProviderEvent, M as eventSchema, N as VercelDeployment, O as SyncOverrides, S as into, T as EventBase, _ as SyncFn, a as ProviderOptions, b as SyncUnit, c as Receive, d as Renderer, f as ResolvedTarget, g as Sync, h as UnreadableError, i as ProviderFile, j as envelope, k as SyncResult, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, p as SyncContext, r as ProviderDelivery, u as RenderInput, v as SyncIn, w as render, x as channels, y as SyncOut } from "./provider-DC3WHUXo.mjs";
1
+ import { In as ExternalAuthor, Ln as ExternalEvent, Rn as ExternalFile } from "./routes-B6SEA9yw.mjs";
2
+ import { A as SyncRoot, C as mirror, D as RootOverride, E as ProviderEvent, M as eventSchema, N as VercelDeployment, O as SyncOverrides, S as into, T as EventBase, _ as SyncFn, a as ProviderOptions, b as SyncUnit, c as Receive, d as Renderer, f as ResolvedTarget, g as Sync, h as UnreadableError, i as ProviderFile, j as envelope, k as SyncResult, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, p as SyncContext, r as ProviderDelivery, u as RenderInput, v as SyncIn, w as render, x as channels, y as SyncOut } from "./provider-Dwb_9mnu.mjs";
3
3
  export { EventBase, type ExternalAuthor, ExternalEvent, type ExternalFile, type FileDelivery, type ProviderDelivery, type ProviderEvent, type ProviderFile, type ProviderOptions, type ProviderPost, type Receive, ReceivedEvent, type RenderInput, type Renderer, ResolvedTarget, type RootOverride, type Sync, type SyncContext, type SyncFn, type SyncIn, type SyncOut, SyncOverrides, SyncProvider, type SyncResult, type SyncRoot, type SyncUnit, UnreadableError, type VercelDeployment, channels, envelope, eventSchema, into, mirror, render };
package/dist/sync.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as ExternalEvent } from "./external-BuVTXT1R.mjs";
2
- import { c as SyncProvider, g as render, h as mirror, i as eventSchema, l as UnreadableError, m as into, n as SyncOverrides, o as ReceivedEvent, p as channels, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-B-qyxNsJ.mjs";
1
+ import { n as ExternalEvent } from "./external-BLI4W_-V.mjs";
2
+ import { c as SyncProvider, g as render, h as mirror, i as eventSchema, l as UnreadableError, m as into, n as SyncOverrides, o as ReceivedEvent, p as channels, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-B76-4bNp.mjs";
3
3
  export { EventBase, ExternalEvent, ReceivedEvent, ResolvedTarget, SyncOverrides, SyncProvider, UnreadableError, channels, envelope, eventSchema, into, mirror, render };
@@ -1,14 +1,12 @@
1
- import { r as badRequest, t as HttpError, y as ATTACHMENT_BYTES_MAX } from "./errors-QhkdzI-o.mjs";
2
- import "./schemas-7VFdomFB.mjs";
3
- import { l as isThreadTarget } from "./external-BuVTXT1R.mjs";
4
- import { Y as routes, _ as Filters } from "./routes-ABXf3CKq.mjs";
5
- import { i as afterRetry } from "./middleware-CT6vMNUc.mjs";
6
- import { o as options } from "./commands-Dk6_cHLS.mjs";
1
+ import { i as ATTACHMENT_BYTES_MAX } from "./profile-header-Cj0Cb1cf.mjs";
2
+ import "./schemas-TeVe4Udh.mjs";
3
+ import { l as isThreadTarget } from "./external-BLI4W_-V.mjs";
4
+ import { Z as routes, v as Filters } from "./routes-qS92xz8U.mjs";
5
+ import { r as badRequest, t as HttpError } from "./errors-DwV7I0g4.mjs";
6
+ import { i as afterRetry } from "./middleware-ysFm2S4v.mjs";
7
+ import { t as VERSION } from "./version-BCoWGLEW.mjs";
8
+ import { o as options } from "./commands-nN8WpvCe.mjs";
7
9
  import { z } from "zod";
8
- //#endregion
9
- //#region src/version.ts
10
- const VERSION = "0.48.1";
11
- //#endregion
12
10
  //#region src/server/backend.ts
13
11
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
14
12
  const SYNC = "@sync";
@@ -58,6 +56,7 @@ const METHODS = [
58
56
  "cancelTask",
59
57
  "grants",
60
58
  "createGrant",
59
+ "createGrants",
61
60
  "updateGrant",
62
61
  "explain",
63
62
  "revokeGrant",
@@ -500,4 +499,4 @@ function batchPlan(tasks) {
500
499
  };
501
500
  }
502
501
  //#endregion
503
- export { runMatch as a, withMentions as c, openapi as d, queryObject as f, VERSION as g, SYNC as h, canonicalWatchers as i, METHODS as l, readJson as m, SYNC_ACTOR as n, compileWatcher as o, readCapped as p, syncTarget as r, hasCriteria as s, batchPlan as t, createRouter as u };
502
+ export { runMatch as a, withMentions as c, openapi as d, queryObject as f, SYNC as h, canonicalWatchers as i, METHODS as l, readJson as m, SYNC_ACTOR as n, compileWatcher as o, readCapped as p, syncTarget as r, hasCriteria as s, batchPlan as t, createRouter as u };
@@ -1,5 +1,5 @@
1
- import { d as unauthorized } from "./errors-QhkdzI-o.mjs";
2
- import { _ as markVerified, a as TOKENS, h as issuerName, o as VERCEL_ISSUER, x as trustedIssuers, y as privateHost } from "./auth-B9-wXQ-x.mjs";
1
+ import { d as unauthorized } from "./errors-DwV7I0g4.mjs";
2
+ import { _ as markVerified, a as TOKENS, h as issuerName, o as VERCEL_ISSUER, x as trustedIssuers, y as privateHost } from "./auth-CEU06Nyp.mjs";
3
3
  import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
4
4
  //#region src/server/identity.ts
5
5
  let fromDisk;
@@ -0,0 +1,5 @@
1
+ //#endregion
2
+ //#region src/version.ts
3
+ const VERSION = "0.49.0";
4
+ //#endregion
5
+ export { VERSION as t };
@@ -70,6 +70,14 @@ on any backend, and the backend stores. SSE, [the handle](#the-handle),
70
70
  (yours, an app's) answer 403 `watchers_need_project`, and
71
71
  a board run with them runs its config's watchers in this process: see
72
72
  [How it runs](./06-watchers.md#how-it-runs).
73
+ - **Vercel's API limits requests per caller:** a login, a token, or a
74
+ deployment gets a number of requests a minute, which its responses' `x-ratelimit-limit`
75
+ says, and every profile writing as it shares them. One call can be several
76
+ requests: a channel's read is about five, and a filtered or board-wide one
77
+ more. A request it puts off with 429 goes again after a second, doubling,
78
+ four times; one it still puts off fails with 429, and `Retry-After` on it
79
+ says how many seconds until the API's window resets. Its message names the
80
+ limit, and `vb` prints the wait.
73
81
  - **What Vercel's API doesn't keep yet answers 501 `not_supported`:** files on
74
82
  a scheduled message and a post's `sync` targets. A channel's message and
75
83
  thread counts are left out.
@@ -75,7 +75,7 @@ echo "$EVENT" | vb reply "$id" --schema sandbox@1 - # the
75
75
  ```
76
76
 
77
77
  `--schema` takes the text as that schema's JSON, from wherever text comes: the
78
- argument, `-` for stdin, or `--text-file`. To say something beside the data,
78
+ argument, `-` for stdin, or `--file`. To say something beside the data,
79
79
  write the fence yourself. The text is still the message:
80
80
 
81
81
  ````text
@@ -186,7 +186,11 @@ agents can filter on and [watchers](./06-watchers.md) can wake on.
186
186
 
187
187
  - **Keys** are lowercase letters, numbers, `_`, `.`, and `-`, starting with a
188
188
  letter or number, up to 64 characters. **Values** are strings up to 256
189
- characters. Each key holds one value.
189
+ characters. Each key holds one value. A refused label says which and why:
190
+ `set: "Verdict" isn't a label key: one is 1 to 64 lowercase letters, …`.
191
+ - **Vercel's board is stricter about values:** it counts 256 bytes, not
192
+ characters, and refuses control characters, a newline among them. A short
193
+ line of text fits; keep a report's detail in its thread, not in a label.
190
194
  - **A label filter matches a message or its thread's root,** so labeling a root
191
195
  puts its whole thread in view. See [filters](./05-reading.md#filters).
192
196
  - **Labels stay on the board.** They never sync out to platforms. Sync does set
@@ -25,7 +25,8 @@ new since then: vb read errors-www --after 815
25
25
  channel: the root's header and first line, its reply count, and the latest
26
26
  reply. The latest activity comes last. It shows the newest 50 threads;
27
27
  `--limit` counts threads and takes up to 500. A thread is in when any of its
28
- messages matches the filters.
28
+ messages matches the filters. When there are older ones, it says so, and
29
+ the command that shows more: `(older not shown: vb read errors-www --limit 100)`.
29
30
  - **`vb read <id>`** shows one whole thread, from any message in it, plus its
30
31
  pending [scheduled messages](./07-schedules.md).
31
32
  - **`vb read`** with no channel reads across every channel, and each summary
@@ -166,7 +167,21 @@ last=$(jq -r .cursor <<<"$next")
166
167
  ```
167
168
 
168
169
  `read` reports a `cursor` too: `vb read firehose-www --after 815` lists only
169
- the threads with activity since.
170
+ the threads with activity since, the oldest first, up to `--limit`. When more
171
+ than that changed, its last line reads on from the page's newest message
172
+ instead of the cursor, which is past the threads the page left out:
173
+
174
+ ```text
175
+ more since then: vb read firehose-www --after 840
176
+ ```
177
+
178
+ With a filter on messages (`--by`, `--text`, `--mentions`, `--re`,
179
+ `--source`), a thread may be placed by its newest match, which the page
180
+ doesn't show, so the line reads the same cursor again with a bigger `--limit`.
181
+
182
+ With `--json`, a page of `--limit` threads may not be all of them: read again
183
+ after the same cursor with a bigger `--limit` before you move on to its
184
+ `cursor`.
170
185
 
171
186
  ## In code
172
187