@vercel/board 0.50.2 → 0.51.1

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 (69) hide show
  1. package/README.md +124 -118
  2. package/dist/{access-BbgmsAFF.mjs → access-DdojoPZm.mjs} +1 -1
  3. package/dist/access.d.mts +2 -2
  4. package/dist/access.mjs +4 -4
  5. package/dist/{actors-CX2D22hL.mjs → actors-CDkNgWUL.mjs} +3 -3
  6. package/dist/{auth-Z9-Khvvw.d.mts → auth-C4VxPLYz.d.mts} +1 -1
  7. package/dist/{auth-DJDTfgAL.mjs → auth-zPqFJocD.mjs} +10 -3
  8. package/dist/{backend-C2JUnbm5.d.mts → backend-Da_YEltI.d.mts} +10 -12
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/{chat-provider-z4nzV8A-.d.mts → chat-provider-BHyX6H8H.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 +9 -4
  15. package/dist/cli-embedded.mjs +3 -3
  16. package/dist/cli.mjs +6 -6
  17. package/dist/{client-C2T4eaXd.d.mts → client-C4-r10SA.d.mts} +25 -4
  18. package/dist/{commands-Cm4sODIu.d.mts → commands-B6pgzwTI.d.mts} +10 -0
  19. package/dist/{commands-nN8WpvCe.mjs → commands-B_gbi2sU.mjs} +37 -10
  20. package/dist/{conformance-jHhuKZe8.mjs → conformance-DW4-9Dwf.mjs} +176 -64
  21. package/dist/conformance.d.mts +4 -3
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-I887QHnP.mjs → engine-D8YAsQS_.mjs} +4 -4
  24. package/dist/{errors-DYF4hhIc.mjs → errors-DbCKqGXp.mjs} +35 -7
  25. package/dist/{exports-DRId1Cks.mjs → exports-BFeX9HNn.mjs} +517 -250
  26. package/dist/{exports-DkdCh3Zi.d.mts → exports-BUtR_AHa.d.mts} +4 -4
  27. package/dist/{index-DpuOtt0J.d.mts → index-BTuTaBaK.d.mts} +2 -2
  28. package/dist/index.d.mts +6 -6
  29. package/dist/index.mjs +4 -4
  30. package/dist/index.node.d.mts +7 -7
  31. package/dist/index.node.mjs +4 -4
  32. package/dist/inspect/app.js +41 -41
  33. package/dist/inspect/engine.js +4 -4
  34. package/dist/inspect-Bd_mBGFt.mjs +2 -0
  35. package/dist/{inspect-DSBG5VDl.mjs → inspect-fOA9UNPD.mjs} +3 -3
  36. package/dist/inspect.d.mts +1 -1
  37. package/dist/inspect.mjs +2 -2
  38. package/dist/{local-DjrvtIoE.mjs → local-DTzfnJAf.mjs} +109 -31
  39. package/dist/{main-VTkjxFcG.mjs → main-Dq6yQxNB.mjs} +112 -33
  40. package/dist/{middleware-DUKIITFZ.mjs → middleware-iVTNf5Su.mjs} +1 -1
  41. package/dist/{profile-header-Cj0Cb1cf.mjs → profile-header-O8wC8yk8.mjs} +12 -1
  42. package/dist/{provider-BgUS6ZpP.d.mts → provider-CGicSMdu.d.mts} +2 -2
  43. package/dist/{routes-BSBUdD2X.mjs → routes-C85Sbhtm.mjs} +43 -10
  44. package/dist/{routes-B6SEA9yw.d.mts → routes-ChGBn0K3.d.mts} +60 -23
  45. package/dist/{serve-C2xn_cQV.mjs → serve-Bdwok1A9.mjs} +7 -7
  46. package/dist/{server-BLQxoL0g.mjs → server-DbYDp2Lr.mjs} +19 -12
  47. package/dist/{serving-Bulte-NO.mjs → serving-aOQsBok0.mjs} +1 -1
  48. package/dist/{shell-Bny3-l_d.mjs → shell-CmZylG0M.mjs} +1 -1
  49. package/dist/sync-chat-sdk.d.mts +2 -2
  50. package/dist/sync-github.d.mts +2 -2
  51. package/dist/sync-linear.d.mts +3 -3
  52. package/dist/sync-slack.d.mts +3 -3
  53. package/dist/sync.d.mts +2 -2
  54. package/dist/{task-batch-CE6BKnRw.mjs → task-batch-Da6Q_7AK.mjs} +52 -8
  55. package/dist/{tokens-DnDHSPml.mjs → tokens-C-T0B1uF.mjs} +3 -2
  56. package/dist/{version-DWvOShz3.mjs → version-BltS6V9X.mjs} +1 -1
  57. package/docs/01-board/01-mounting.md +19 -6
  58. package/docs/01-board/03-identity.md +1 -1
  59. package/docs/01-board/04-messages.md +5 -0
  60. package/docs/01-board/05-reading.md +71 -16
  61. package/docs/01-board/10-local.md +1 -1
  62. package/docs/03-guides/02-inspector.md +13 -5
  63. package/docs/03-guides/07-build-a-ui.md +15 -11
  64. package/docs/04-reference/01-cli.md +45 -11
  65. package/docs/04-reference/02-board.md +48 -23
  66. package/docs/04-reference/03-http.md +33 -14
  67. package/docs/04-reference/05-conformance.md +11 -10
  68. package/package.json +1 -1
  69. package/dist/inspect-DLLoYeg7.mjs +0 -2
@@ -93,6 +93,16 @@ const options = {
93
93
  value: "N",
94
94
  description: "how many"
95
95
  },
96
+ last: {
97
+ type: "string",
98
+ value: "N",
99
+ description: "start with the feed's newest N events (1 to 100)"
100
+ },
101
+ before: {
102
+ type: "string",
103
+ value: "older",
104
+ description: "a channel's threads before a page: the older its read printed"
105
+ },
96
106
  "idempotency-key": {
97
107
  type: "string",
98
108
  value: "key",
@@ -721,23 +731,37 @@ const commands = [
721
731
  {
722
732
  group: "the board",
723
733
  name: "channels",
724
- description: "channels, grouped by path prefix: a first post makes one, and so does create",
725
- arguments: [],
726
- options: [],
734
+ description: "channels, a page at a time, grouped by path prefix: a first post makes one, and so does create",
735
+ arguments: [{
736
+ name: "prefix",
737
+ required: false,
738
+ description: "only the channels whose path starts with it: dev/"
739
+ }],
740
+ options: [option("limit"), option("after")],
727
741
  runsWithoutSubcommand: true,
728
742
  examples: [{
729
743
  name: "list the channels",
730
744
  value: "channels"
745
+ }, {
746
+ name: "the ones under dev",
747
+ value: "channels dev/"
731
748
  }],
732
749
  subcommands: [{
733
750
  name: "list",
734
751
  default: true,
735
- description: "channels, grouped by path prefix",
736
- arguments: [],
737
- options: [],
752
+ description: "channels, a page at a time, grouped by path prefix",
753
+ arguments: [{
754
+ name: "prefix",
755
+ required: false,
756
+ description: "only the channels whose path starts with it: dev/"
757
+ }],
758
+ options: [option("limit"), option("after")],
738
759
  examples: [{
739
760
  name: "list the channels",
740
761
  value: "channels list"
762
+ }, {
763
+ name: "the next page, from the cursor a page ends with",
764
+ value: "channels list dev/ --after c.8f2a.2"
741
765
  }]
742
766
  }, {
743
767
  name: "create",
@@ -837,7 +861,7 @@ const commands = [
837
861
  required: false,
838
862
  description: "a channel (every channel without one), a message's ID, or a Slack or GitHub link the board synced"
839
863
  }],
840
- options: [option("limit", "threads to list (default: 50, at most 500)")],
864
+ options: [option("limit", "threads to list (default: 50, at most 500)"), option("before")],
841
865
  filters: true,
842
866
  examples: [
843
867
  {
@@ -857,8 +881,8 @@ const commands = [
857
881
  value: "read dev --after 1042"
858
882
  },
859
883
  {
860
- name: "search every channel for a phrase",
861
- value: "read --text \"times out\""
884
+ name: "the page before one, by the older it printed",
885
+ value: "read dev --before 1031.1024"
862
886
  }
863
887
  ]
864
888
  },
@@ -1498,11 +1522,14 @@ const commands = [
1498
1522
  required: false,
1499
1523
  description: "a channel, or a path prefix (dev/)"
1500
1524
  }],
1501
- options: [option("all", "delivery receipts too")],
1525
+ options: [option("all", "delivery receipts too"), option("last")],
1502
1526
  filters: true,
1503
1527
  examples: [{
1504
1528
  name: "follow the bugs",
1505
1529
  value: "tail dev --label kind=bug"
1530
+ }, {
1531
+ name: "start with a channel's newest 20 events, then follow",
1532
+ value: "tail dev --last 20"
1506
1533
  }]
1507
1534
  },
1508
1535
  {
@@ -1,7 +1,24 @@
1
- import "./routes-BSBUdD2X.mjs";
2
- import { f as BoardError } from "./errors-DYF4hhIc.mjs";
1
+ import "./routes-C85Sbhtm.mjs";
2
+ import { f as BoardError } from "./errors-DbCKqGXp.mjs";
3
3
  import { c as canonical, t as block } from "./blocks-CVoBC7ur.mjs";
4
- import { a as canText, c as compileAccess } from "./access-BbgmsAFF.mjs";
4
+ import { a as canText, c as compileAccess } from "./access-DdojoPZm.mjs";
5
+ //#region src/client/channels.ts
6
+ /** Every channel of a board, or every one whose path starts with `prefix`, a page at a time: for what needs them all. */
7
+ async function everyChannel(board, prefix) {
8
+ const channels = [];
9
+ let after;
10
+ do {
11
+ const page = await board.channels({
12
+ limit: 500,
13
+ ...prefix !== void 0 ? { prefix } : {},
14
+ ...after !== void 0 ? { after } : {}
15
+ });
16
+ channels.push(...page.channels);
17
+ after = page.next ?? void 0;
18
+ } while (after !== void 0);
19
+ return channels;
20
+ }
21
+ //#endregion
5
22
  //#region src/conformance/index.ts
6
23
  var Mismatch = class extends Error {};
7
24
  const show = (value) => JSON.stringify(value) ?? String(value);
@@ -82,9 +99,12 @@ function isRef(value, what) {
82
99
  * The groups a board may keep none of, saying so with a 501: a board without a scheduler answers
83
100
  * `no_scheduler`, and without a blob store `no_files`; one that keeps no tasks answers `no_tasks`,
84
101
  * a backend of one's own that keeps no grants `no_grants`, and one that keeps no schemas
85
- * `no_schemas`. A board that's meant to keep something and doesn't yet answers otherwise, and fails.
102
+ * `no_schemas`. `search` is finding threads by what their messages say, and reading every channel
103
+ * under a pattern at once: a board with no index for either, as Vercel's has none, answers
104
+ * `not_supported`. A board that's meant to keep something and doesn't yet answers otherwise, and fails.
86
105
  */
87
106
  const OPTIONAL = /* @__PURE__ */ new Set([
107
+ "search",
88
108
  "schedules",
89
109
  "tasks",
90
110
  "grants",
@@ -550,36 +570,86 @@ const CHECKS = [
550
570
  },
551
571
  {
552
572
  group: "core",
553
- name: "matches a label on the message or its thread's root",
573
+ name: "reads one channel's messages after a cursor of its own, oldest first, and on from where it stopped",
554
574
  run: async (ctx) => {
555
- const { reply } = needRoot(ctx);
556
- const { messages } = await ctx.board.messages({
557
- channel: ctx.channel,
558
- label: ctx.labels
575
+ const { root, reply } = needRoot(ctx);
576
+ const channel = ctx.board.channel(ctx.channel);
577
+ const page = await channel.messages({
578
+ after: ctx.start,
579
+ limit: 500
559
580
  });
560
- check(messages.some((m) => m.id === reply.id), "a reply should match its root's label");
581
+ isRef(page.cursor, "a read's cursor");
582
+ const ids = page.messages.map((m) => m.id);
583
+ check(ids.indexOf(root.id) !== -1 && ids.indexOf(root.id) < ids.indexOf(reply.id), `the root should come before its reply, got ${show(ids)}`);
584
+ check(page.messages.every((m) => m.channel === ctx.channel), `a channel's messages should all be in it, got ${show([...new Set(page.messages.map((m) => m.channel))])}`);
585
+ const one = await channel.messages({
586
+ after: ctx.start,
587
+ limit: 1
588
+ });
589
+ same(one.messages.length, 1, "how many messages a read with a limit of 1 lists");
590
+ const rest = await channel.messages({
591
+ after: one.cursor,
592
+ limit: 500
593
+ });
594
+ const twice = rest.messages.filter((m) => one.messages.some((first) => first.id === m.id));
595
+ check(twice.length === 0, `reading on from a page's cursor should repeat none of it, got ${show(twice.map((m) => m.id))} again`);
596
+ const all = [...one.messages, ...rest.messages].map((m) => m.id);
597
+ check(all.includes(root.id) && all.includes(reply.id), `reading on from a page's cursor should reach what came after it, got ${show(all)}`);
598
+ }
599
+ },
600
+ {
601
+ group: "core",
602
+ name: "lists channels a page at a time, and the ones under a prefix",
603
+ run: async (ctx) => {
604
+ const paths = (channels) => channels.map((channel) => channel.path);
605
+ const under = paths(await everyChannel(ctx.board, ctx.channel));
606
+ check(under.includes(ctx.channel) && under.every((path) => path.startsWith(ctx.channel)), `the channels under ${ctx.channel} should be it and the ones that start with it, got ${show(under)}`);
607
+ const seen = [];
608
+ let after;
609
+ do {
610
+ const page = await ctx.board.channels({
611
+ prefix: ctx.channel,
612
+ limit: 1,
613
+ ...after !== void 0 ? { after } : {}
614
+ });
615
+ check(page.channels.length <= 1, `a list with a limit of 1 should answer 1 channel at most, got ${show(paths(page.channels))}`);
616
+ seen.push(...paths(page.channels));
617
+ after = page.next ?? void 0;
618
+ } while (after !== void 0 && seen.length <= under.length);
619
+ same(show([...seen].sort()), show([...under].sort()), "the channels under a prefix, read a page of 1 at a time");
561
620
  }
562
621
  },
563
622
  {
564
623
  group: "core",
565
- name: "reads a channel after a cursor or a message ID, oldest first",
624
+ name: "reads a thread's replies after one of its messages, and as many of its newest as it's asked for",
566
625
  run: async (ctx) => {
567
626
  const { root, reply } = needRoot(ctx);
568
- const page = await ctx.board.messages({
569
- channel: ctx.channel,
570
- label: ctx.labels,
571
- after: ctx.start
572
- });
573
- isRef(page.cursor, "a read's cursor");
574
- const ids = page.messages.map((m) => m.id);
575
- check(ids.indexOf(root.id) !== -1 && ids.indexOf(root.id) < ids.indexOf(reply.id), `the root should come before its reply, got ${show(ids)}`);
576
- const later = await ctx.board.messages({
577
- channel: ctx.channel,
578
- label: ctx.labels,
579
- after: root.id
627
+ const ids = (read) => [read.message.id, ...read.replies.map((m) => m.id)];
628
+ const whole = ids(await ctx.board.thread(root.id));
629
+ const after = ids(await ctx.board.thread(root.id, { after: reply.id }));
630
+ same(show(after), show([root.id, ...whole.slice(whole.indexOf(reply.id) + 1)]), "a thread read after one of its replies: its root, and the replies after that one");
631
+ const first = ids(await ctx.board.thread(reply.id, {
632
+ after: root.id,
633
+ limit: 1
634
+ }));
635
+ same(show(first), show(whole.slice(0, 2)), "a thread read for the first reply after its root");
636
+ const newest = ids(await ctx.board.thread(root.id, { limit: 1 }));
637
+ same(show(newest), show([root.id, whole.at(-1)]), "a thread read for its newest reply");
638
+ }
639
+ },
640
+ {
641
+ group: "core",
642
+ name: "reads one channel's newest messages, as many as it's asked for",
643
+ run: async (ctx) => {
644
+ needRoot(ctx);
645
+ const latest = await post(ctx, "conformance: the newest message of the channel, for now");
646
+ const page = await ctx.board.channel(ctx.channel).messages({ limit: 2 });
647
+ check(page.messages.length <= 2, `a read with a limit of 2 should list 2 at most, got ${page.messages.length}`);
648
+ const after = await ctx.board.channel(ctx.channel).messages({
649
+ after: page.cursor,
650
+ limit: 500
580
651
  });
581
- check(!later.messages.some((m) => m.id === root.id), "reading after a message should leave it out");
582
- check(later.messages.some((m) => m.id === reply.id), "reading after a message should include what came after it");
652
+ check([...page.messages, ...after.messages].some((m) => m.id === latest.id), `the newest messages, and what came after them, should include ${latest.id}`);
583
653
  }
584
654
  },
585
655
  {
@@ -665,31 +735,36 @@ const CHECKS = [
665
735
  }
666
736
  },
667
737
  {
668
- group: "core",
669
- name: "matches text anywhere in a message's own, in any case, as it reads now",
738
+ group: "search",
739
+ name: "finds threads by text anywhere in a message of theirs, in any case, as it reads now",
670
740
  run: async (ctx) => {
671
741
  const literal = await post(ctx, "conformance: Deploy FAILED at 100% on a_b");
672
742
  const lookalike = await post(ctx, "conformance: deploy failed at 1000 on axb");
673
- const under = await reply(ctx, lookalike.id, "conformance: a reply that says Crème Brûlée");
674
- const found = async (text) => (await ctx.board.messages({
743
+ await reply(ctx, lookalike.id, "conformance: a reply that says Crème Brûlée");
744
+ const found = async (text) => (await ctx.board.threads({
675
745
  channel: ctx.channel,
676
746
  label: ctx.labels,
677
- after: ctx.start,
678
747
  text
679
- })).messages.map((m) => m.id);
680
- alike(await found("DEPLOY failed"), [literal.id, lookalike.id], "the messages \"DEPLOY failed\" finds");
681
- alike(await found("100%"), [literal.id], "the messages \"100%\" finds, % being a character");
682
- alike(await found("a_b"), [literal.id], "the messages \"a_b\" finds, _ being a character");
683
- alike(await found("BRÛLÉE"), [under.id], "the messages \"BRÛLÉE\" finds");
748
+ })).threads.map((t) => t.message.id);
749
+ alike(await found("DEPLOY failed"), [literal.id, lookalike.id], "the threads \"DEPLOY failed\" finds");
750
+ alike(await found("100%"), [literal.id], "the threads \"100%\" finds, % being a character");
751
+ alike(await found("a_b"), [literal.id], "the threads \"a_b\" finds, _ being a character");
752
+ alike(await found("crème BRÛLÉE"), [lookalike.id], "the threads \"crème BRÛLÉE\" finds");
753
+ await ctx.board.edit(lookalike.id, "conformance: deploy fixed");
754
+ alike(await found("1000"), [], "the threads \"1000\" finds, once the message that said it is edited");
755
+ alike(await found("deploy fixed"), [lookalike.id], "the threads \"deploy fixed\" finds, once a message is edited to say it");
756
+ }
757
+ },
758
+ {
759
+ group: "search",
760
+ name: "lists the threads of every channel under a pattern at once",
761
+ run: async (ctx) => {
762
+ const { root } = needRoot(ctx);
684
763
  const { threads } = await ctx.board.threads({
685
- channel: ctx.channel,
686
- label: ctx.labels,
687
- text: "crème brûlée"
764
+ channel: `${ctx.channel}/`,
765
+ label: ctx.labels
688
766
  });
689
- alike(threads.map((t) => t.message.id), [lookalike.id], "the threads \"crème brûlée\" finds");
690
- await ctx.board.edit(lookalike.id, "conformance: deploy fixed");
691
- alike(await found("1000"), [], "the messages \"1000\" finds, once the one that said it is edited");
692
- alike(await found("deploy fixed"), [lookalike.id], "the messages \"deploy fixed\" finds, once one is edited to say it");
767
+ check(threads.some((t) => t.message.id === root.id), `the threads under ${ctx.channel}/ should include ${root.id}, in ${ctx.channel} itself`);
693
768
  }
694
769
  },
695
770
  {
@@ -711,6 +786,34 @@ const CHECKS = [
711
786
  })).events.some((event) => event.message?.id === root.id), "reading on from the cursor should not repeat what it read");
712
787
  }
713
788
  },
789
+ {
790
+ group: "core",
791
+ name: "reads a channel's newest events, oldest first, and goes on from their cursor",
792
+ run: async (ctx) => {
793
+ const { root, reply } = needRoot(ctx);
794
+ const page = await ctx.board.poll({
795
+ channel: ctx.channel,
796
+ last: 100
797
+ }).catch((error) => {
798
+ if (error instanceof BoardError && error.status === 501 && error.code === "not_supported") return `not kept here: ${error.message}`;
799
+ throw error;
800
+ });
801
+ if (typeof page === "string") return page;
802
+ isRef(page.cursor, "the newest events' cursor");
803
+ const posted = page.events.filter((event) => event.type === "message.posted").map((event) => event.message?.id);
804
+ check(posted.includes(root.id) && posted.includes(reply.id), `the channel's newest events should include ${root.id} and ${reply.id} being posted`);
805
+ check(posted.indexOf(root.id) < posted.indexOf(reply.id), `${root.id} was posted before ${reply.id}, so it should come first`);
806
+ const one = await ctx.board.poll({
807
+ channel: ctx.channel,
808
+ last: 1
809
+ });
810
+ check(one.events.length <= 1, `\`last=1\` on one channel should answer one event at most, not ${one.events.length}`);
811
+ check(!(await ctx.board.poll({
812
+ channel: ctx.channel,
813
+ after: page.cursor
814
+ })).events.some((event) => page.events.some((read) => read.cursor === event.cursor)), "reading on from the cursor should not repeat what it read");
815
+ }
816
+ },
714
817
  {
715
818
  group: "core",
716
819
  name: "holds a long-poll open until the next event",
@@ -757,32 +860,25 @@ const CHECKS = [
757
860
  noSync: true
758
861
  });
759
862
  ctx.posted.push(root.id);
760
- const kept = await reply(ctx, root.id, "conformance: a reply under it");
761
- const found = async () => ({
762
- threads: (await ctx.board.threads({
763
- channel: ctx.channel,
764
- label
765
- })).threads.map((t) => t.message.id),
766
- messages: (await ctx.board.messages({
767
- channel: ctx.channel,
768
- label
769
- })).messages.map((m) => m.id)
770
- });
863
+ await reply(ctx, root.id, "conformance: a reply under it");
864
+ const found = async () => (await ctx.board.threads({
865
+ channel: ctx.channel,
866
+ label
867
+ })).threads.map((t) => t.message.id);
771
868
  const before = await found();
772
- check(before.threads.includes(root.id) && before.messages.includes(kept.id), `its labels should find the root and its reply before the delete, got ${show(before)}`);
869
+ check(before.includes(root.id), `its labels should find the root's thread before the delete, got ${show(before)}`);
773
870
  await ctx.board.delete(root.id);
774
871
  const { labels } = (await ctx.board.thread(root.id)).message;
775
872
  check(Object.keys(labels).length === 0, `a deleted message should keep no labels, got ${show(labels)}`);
776
873
  const after = await found();
777
- check(!after.threads.includes(root.id), `a label read should leave out a deleted root's thread, got ${show(after.threads)}`);
778
- check(!after.messages.includes(root.id) && !after.messages.includes(kept.id), `a deleted root's labels should find neither it nor its replies, got ${show(after.messages)}`);
874
+ check(!after.includes(root.id), `a label read should leave out a deleted root's thread, got ${show(after)}`);
779
875
  }
780
876
  },
781
877
  {
782
878
  group: "core",
783
879
  name: "lists the channel and you in it",
784
880
  run: async (ctx) => {
785
- const found = (await ctx.board.channels()).find((c) => c.path === ctx.channel);
881
+ const found = (await everyChannel(ctx.board)).find((c) => c.path === ctx.channel);
786
882
  check(found, `the channels should include ${ctx.channel}`);
787
883
  for (const field of [
788
884
  "lastIndex",
@@ -990,14 +1086,14 @@ const CHECKS = [
990
1086
  const thread = await ctx.board.thread(root.id);
991
1087
  same(thread.message.task?.state, "ready", "the task, read as its thread");
992
1088
  check(thread.replies.some((m) => m.id === answer.id), "a reply should land in the task's thread");
993
- const { messages } = await ctx.board.messages({
1089
+ const { threads } = await ctx.board.threads({
994
1090
  channel: ctx.channel,
995
1091
  label: {
996
1092
  ...ctx.labels,
997
1093
  "board.task": "ready"
998
1094
  }
999
1095
  });
1000
- check(messages.some((m) => m.id === root.id), "board.task=ready should find the task");
1096
+ check(threads.some((t) => t.message.id === root.id), "board.task=ready should find the task");
1001
1097
  const listed = (await ctx.board.tasks.list({
1002
1098
  channel: ctx.channel,
1003
1099
  label: ctx.labels
@@ -2363,6 +2459,25 @@ const CHECKS = [
2363
2459
  same(new TextDecoder().decode(await response.arrayBuffer()), new TextDecoder().decode(bytes), "the file's bytes");
2364
2460
  }
2365
2461
  },
2462
+ {
2463
+ group: "attachments",
2464
+ name: "refuses a name that would download as a dotfile",
2465
+ run: async (ctx) => {
2466
+ const bytes = new TextEncoder().encode(`conformance ${ctx.labels.conformance}\n`);
2467
+ try {
2468
+ await ctx.board.upload({
2469
+ data: bytes,
2470
+ name: ".conformance",
2471
+ type: "text/plain"
2472
+ });
2473
+ } catch (error) {
2474
+ if (error instanceof BoardError && error.status === 501) throw error;
2475
+ if (error instanceof BoardError && error.status === 400 && error.code === "invalid_attachment") return;
2476
+ throw new Mismatch(`a dotfile name: expected 400 invalid_attachment, got ${error instanceof BoardError ? `${error.status} ${error.code}` : String(error)}`);
2477
+ }
2478
+ throw new Mismatch("a dotfile name: expected 400 invalid_attachment, and it succeeded");
2479
+ }
2480
+ },
2366
2481
  {
2367
2482
  group: "attachments",
2368
2483
  name: "starts a task with a file, which its root carries",
@@ -2972,10 +3087,7 @@ async function conformance(board, options = {}) {
2972
3087
  board,
2973
3088
  channel,
2974
3089
  labels: { conformance: label },
2975
- start: (await board.messages({
2976
- channel,
2977
- limit: 1
2978
- })).cursor,
3090
+ start: (await board.channel(channel).messages({ limit: 1 })).cursor,
2979
3091
  me,
2980
3092
  posted: [],
2981
3093
  ...options.withCan ? { withCan: options.withCan } : options.withHeaders ? { withCan: (can) => options.withHeaders({ "x-board-can": can }) } : {},
@@ -3037,4 +3149,4 @@ async function conformance(board, options = {}) {
3037
3149
  };
3038
3150
  }
3039
3151
  //#endregion
3040
- export { conformance as t };
3152
+ export { everyChannel as n, conformance as t };
@@ -1,15 +1,16 @@
1
- import { f as Board } from "./backend-C2JUnbm5.mjs";
1
+ import { f as Board } from "./backend-Da_YEltI.mjs";
2
2
  //#region src/conformance/index.d.ts
3
3
  /**
4
4
  * Checks that a board speaks the protocol, through a handle on it (`conformance(board())`), as
5
5
  * `vb` and agents use it: every board answers all of it. A board may keep no schedules, tasks, or
6
- * files, and says so with a 501, which the kit reports as not kept here. It writes to one channel
6
+ * files, or no index to find threads by what their messages say or who wrote them, and says so with a
7
+ * 501, which the kit reports as not kept here. It writes to one channel
7
8
  * (`conformance` by default), and for the tasks checks that need two, to `tasks` under it, keeps
8
9
  * every post on the board, and deletes what it posted. The one
9
10
  * schema it registers, `conformance@1`, stays: a schema version is never removed.
10
11
  */
11
12
  /** What a check is about, for the report's headings. */
12
- export type CheckGroup = 'core' | 'paging' | 'schedules' | 'tasks' | 'grants' | 'schemas' | 'attachments' | 'watchers' | 'sync';
13
+ export type CheckGroup = 'core' | 'paging' | 'search' | 'schedules' | 'tasks' | 'grants' | 'schemas' | 'attachments' | 'watchers' | 'sync';
13
14
  export type CheckResult = {
14
15
  group: CheckGroup;
15
16
  name: string;
@@ -1,2 +1,2 @@
1
- import { t as conformance } from "./conformance-jHhuKZe8.mjs";
1
+ import { t as conformance } from "./conformance-DW4-9Dwf.mjs";
2
2
  export { conformance };
@@ -1,9 +1,9 @@
1
- import { c as fileSize, i as ATTACHMENT_BYTES_MAX, o as IMPORT_BYTES_MAX, u as typeOf } from "./profile-header-Cj0Cb1cf.mjs";
1
+ import { f as typeOf, i as ATTACHMENT_BYTES_MAX, l as fileSize, o as IMPORT_BYTES_MAX, u as importedFileName } from "./profile-header-O8wC8yk8.mjs";
2
2
  import { P as toStorable, m as MESSAGE_TEXT_MAX, s as ChannelPath } from "./schemas-CUSTEFIy.mjs";
3
3
  import { l as isThreadTarget, s as channelOf } from "./external-DkWafjn-.mjs";
4
4
  import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
5
- import { c as notFound, r as badRequest, t as HttpError } from "./errors-DYF4hhIc.mjs";
6
- import { a as waitUntil, c as platformProfile, f as viaText, i as afterRetry, l as shownName, m as derivedId, o as actorParts, t as DroppedError } from "./middleware-DUKIITFZ.mjs";
5
+ import { c as notFound, r as badRequest, t as HttpError } from "./errors-DbCKqGXp.mjs";
6
+ import { a as waitUntil, c as platformProfile, f as viaText, i as afterRetry, l as shownName, m as derivedId, o as actorParts, t as DroppedError } from "./middleware-iVTNf5Su.mjs";
7
7
  import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
8
8
  import { a as immutable, d as opensBlock, f as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-mWKc1uvZ.mjs";
9
9
  import { i as vercelDeployments, n as displayText, t as byVercelBot } from "./bots-CqPYxkqK.mjs";
@@ -496,7 +496,7 @@ function createSyncEngine(entries) {
496
496
  notes.push(fileNote(file, "it was empty"));
497
497
  continue;
498
498
  }
499
- const name = file.name ?? `${file.type}`;
499
+ const name = importedFileName(file.name ?? `${file.type}`);
500
500
  try {
501
501
  attachments.push((await call("upload", {
502
502
  data,
@@ -1,4 +1,4 @@
1
- import { a as DIRECT_UPLOAD_BYTES_MAX, i as ATTACHMENT_BYTES_MAX, n as formatProfileHeader, u as typeOf } from "./profile-header-Cj0Cb1cf.mjs";
1
+ import { a as DIRECT_UPLOAD_BYTES_MAX, f as typeOf, i as ATTACHMENT_BYTES_MAX, n as formatProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import { m as MESSAGE_TEXT_MAX } from "./schemas-CUSTEFIy.mjs";
3
3
  import { r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
4
4
  import { ZodError } from "zod";
@@ -321,7 +321,17 @@ function createBoardClient(options) {
321
321
  }),
322
322
  discovery: () => call("GET", "/", { auth: false }),
323
323
  me: () => call("GET", "/me"),
324
- channels: async () => (await call("GET", "/channels")).channels,
324
+ /**
325
+ * A page of the board's channels: `prefix` keeps the ones whose path starts with it (`dev/`), `limit` is how many
326
+ * (100 unless it says, 500 at most), and `after` takes a page's `next`, which is null on the last.
327
+ */
328
+ channels: async (query = {}) => {
329
+ const page = await call("GET", `/channels${queryString(query)}`);
330
+ return {
331
+ ...page,
332
+ next: page.next ?? null
333
+ };
334
+ },
325
335
  /**
326
336
  * Makes a channel before anything posts to it, as a first post would. Needs `read` and `post`
327
337
  * there. `created` is false when it was there already; it's left as it is.
@@ -354,7 +364,11 @@ function createBoardClient(options) {
354
364
  };
355
365
  const before = await reaching();
356
366
  if (before.length > 0) throw granted(before);
357
- const there = (await call("GET", "/channels")).channels.find((channel) => channel.path === path || channel.path.startsWith(pattern));
367
+ const first = async (prefix) => (await call("GET", `/channels${queryString({
368
+ prefix,
369
+ limit: 1
370
+ })}`)).channels.find((channel) => channel.path === path || channel.path.startsWith(pattern));
371
+ const there = await first(path) ?? await first(pattern);
358
372
  if (there) throw new BoardError("channel_exists", there.path === path ? `${path} is a channel already, so it stays as it is.` : `${there.path} is a channel already, and a private ${path} would close it too, so nothing was made.`, 409, { hint: `Close it with a grant: everyone at ${pattern} with 'none'.` });
359
373
  const own = await call("POST", "/grants", { body: {
360
374
  principals: [creator],
@@ -391,8 +405,20 @@ function createBoardClient(options) {
391
405
  };
392
406
  },
393
407
  actors: async () => (await call("GET", "/actors")).actors,
394
- messages: (query = {}) => call("GET", `/messages${queryString(query)}`),
395
- thread: (id) => call("GET", `/messages/${path(id)}`),
408
+ /**
409
+ * One channel, by its whole name: a board lists messages a channel at a time, never across channels. Its
410
+ * `messages()` are the channel's across its threads, oldest first: the newest `limit` (50 without one), or with
411
+ * `after`, a cursor a read of this channel answered, the ones posted since.
412
+ */
413
+ channel: (name) => ({ messages: (query = {}) => call("GET", `/messages${queryString({
414
+ channel: name,
415
+ ...query
416
+ })}`) }),
417
+ /**
418
+ * A thread: its root and its replies. `after`, one of its messages, answers the replies after it, and `limit` that
419
+ * many of them: with `after` the first after it, to read on from, and without, the newest.
420
+ */
421
+ thread: (id, range = {}) => call("GET", `/messages/${path(id)}${queryString(range)}`),
396
422
  /** Your own post with the client ID you gave it, as posting it answered: 404 `post_not_found` when there's none. */
397
423
  posted: async (id) => (await call("GET", `/posts/${path(id)}`)).message,
398
424
  /** Threads with a matching message, one summary each (root, reply count, latest reply), by latest activity. `limit` counts threads; `before` takes a page's `older`. */
@@ -655,6 +681,7 @@ function createBoardClient(options) {
655
681
  inboxAck: (key, id, body) => call("POST", `/inbox/${path(key)}/${path(id)}/ack`, { body }),
656
682
  /** Live events. Reconnects from the last seen index whenever the stream closes, and tells `onState` whether it's live or retrying. */
657
683
  async *events(query = {}, opts = {}) {
684
+ const { last, ...rest } = query;
658
685
  let after = query.after;
659
686
  let failures = 0;
660
687
  const state = eventsState(opts.onState);
@@ -662,7 +689,8 @@ function createBoardClient(options) {
662
689
  let response;
663
690
  try {
664
691
  response = await raw("GET", `/events${queryString({
665
- ...filtersQuery(query),
692
+ ...filtersQuery(rest),
693
+ ...after === void 0 && last !== void 0 ? { last } : {},
666
694
  after
667
695
  })}`, {
668
696
  headers: { accept: "text/event-stream" },
@@ -670,7 +698,7 @@ function createBoardClient(options) {
670
698
  });
671
699
  } catch (error) {
672
700
  if (opts.signal?.aborted) return;
673
- if (error instanceof BoardError && error.status >= 400 && error.status < 500) throw error;
701
+ if (error instanceof BoardError && (error.status === 501 || error.status >= 400 && error.status < 500)) throw error;
674
702
  state.failed();
675
703
  await new Promise((r) => setTimeout(r, Math.min(3e4, 500 * 2 ** failures++)));
676
704
  continue;