@vercel/board 0.46.0 → 0.47.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-Crbvd2Dm.mjs → access-C06pIr0M.mjs} +1 -1
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +4 -4
  4. package/dist/{actors-BBphaJ_G.mjs → actors-Dkyg-oo0.mjs} +2 -2
  5. package/dist/{auth-C-pFnJBA.mjs → auth-B9-wXQ-x.mjs} +29 -9
  6. package/dist/{auth-CkNXnQno.d.mts → auth-li3lKwJG.d.mts} +1 -1
  7. package/dist/{backend-D3p8gjba.d.mts → backend-i_esjwUS.d.mts} +21 -4
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-Bn33acHd.d.mts → chat-provider-BWBGZOZY.d.mts} +4 -2
  11. package/dist/{chat-provider-1zpY6Qo_.mjs → chat-provider-CD7jskh7.mjs} +7 -4
  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 +2 -2
  16. package/dist/cli.mjs +46 -15
  17. package/dist/{commands-CSZPQ38I.d.mts → commands-CJsOA-hf.d.mts} +6 -0
  18. package/dist/{commands-D0lyo8O8.mjs → commands-Dk6_cHLS.mjs} +6 -0
  19. package/dist/{conformance-Blzd4CXG.mjs → conformance-CDP8y2Zm.mjs} +94 -3
  20. package/dist/conformance.d.mts +1 -1
  21. package/dist/conformance.mjs +1 -1
  22. package/dist/{engine-C_SlBihU.mjs → engine-j2VeNuKG.mjs} +43 -50
  23. package/dist/{errors-DZ1tbwSM.mjs → errors-QhkdzI-o.mjs} +27 -8
  24. package/dist/{events-mGuhF4i5.mjs → events-MOcxGpOQ.mjs} +1 -1
  25. package/dist/{exports-DQauuHrc.mjs → exports-CEqS-IPP.mjs} +205 -56
  26. package/dist/{exports-DUX_Yzo7.d.mts → exports-CF9rKCXd.d.mts} +4 -4
  27. package/dist/{external-BVr1Sq0y.mjs → external-BuVTXT1R.mjs} +6 -2
  28. package/dist/{index-BHXg4Xdo.d.mts → index-ttfx1TZ6.d.mts} +2 -2
  29. package/dist/index.d.mts +6 -6
  30. package/dist/index.mjs +4 -4
  31. package/dist/index.node.d.mts +7 -7
  32. package/dist/index.node.mjs +4 -4
  33. package/dist/inspect/app.js +44 -44
  34. package/dist/inspect/engine.js +1 -1
  35. package/dist/inspect-8YAhl_h3.mjs +2 -0
  36. package/dist/{inspect-2OIjv2lW.mjs → inspect-vOSrW_g6.mjs} +82 -32
  37. package/dist/{local-11FMUJrU.mjs → local-0ajWOVhN.mjs} +92 -50
  38. package/dist/{main-BYmbTDgo.mjs → main-B8Zkd4Pm.mjs} +127 -46
  39. package/dist/{memory-CZBdVNn8.mjs → memory-CMm-Fk_A.mjs} +2 -2
  40. package/dist/{mentions-DfZGp3B-.mjs → mentions-CnWt9Z5b.mjs} +34 -1
  41. package/dist/{middleware-BKsTcMAv.mjs → middleware-CT6vMNUc.mjs} +1 -1
  42. package/dist/{provider-D3bfHRHA.d.mts → provider-Bc3xI90K.d.mts} +82 -5
  43. package/dist/{routes-B2HHHD_C.mjs → routes-ABXf3CKq.mjs} +17 -4
  44. package/dist/{routes-NEc6w3QC.d.mts → routes-CjA6Mp4D.d.mts} +70 -0
  45. package/dist/serve-BepKXDH3.mjs +285 -0
  46. package/dist/{server-Ch3tuK2k.mjs → server-4rQL3xuH.mjs} +38 -19
  47. package/dist/{serving-9riPNrHk.mjs → serving-BNdiReQT.mjs} +1 -1
  48. package/dist/{sql-Bml29DpM.mjs → sql-IEbO5vXs.mjs} +2 -2
  49. package/dist/{sqlite-4C5u7-ag.mjs → sqlite-CVG8XKHm.mjs} +2 -2
  50. package/dist/{sqlite-db-eVb9v3zc.mjs → sqlite-db-BJjPQYx4.mjs} +1 -1
  51. package/dist/sync-chat-sdk.d.mts +16 -2
  52. package/dist/sync-chat-sdk.mjs +2 -2
  53. package/dist/sync-github.d.mts +16 -2
  54. package/dist/sync-github.mjs +3 -3
  55. package/dist/sync-linear.d.mts +17 -3
  56. package/dist/sync-linear.mjs +2 -2
  57. package/dist/sync-slack.d.mts +17 -3
  58. package/dist/sync-slack.mjs +106 -14
  59. package/dist/sync.d.mts +2 -2
  60. package/dist/sync.mjs +2 -2
  61. package/dist/{task-batch-BJcLiYe1.mjs → task-batch-BZXm6kOE.mjs} +6 -6
  62. package/dist/{tokens-DPKF_cb5.mjs → tokens-BCp4EWTQ.mjs} +2 -2
  63. package/docs/01-board/01-mounting.md +7 -4
  64. package/docs/01-board/03-identity.md +43 -23
  65. package/docs/01-board/04-messages.md +3 -2
  66. package/docs/01-board/06-watchers.md +3 -3
  67. package/docs/01-board/07-schedules.md +2 -2
  68. package/docs/01-board/09-access.md +6 -4
  69. package/docs/01-board/10-local.md +4 -1
  70. package/docs/02-sync/01-overview.md +4 -5
  71. package/docs/02-sync/02-functions.md +2 -2
  72. package/docs/02-sync/03-slack.md +8 -5
  73. package/docs/02-sync/06-providers.md +8 -0
  74. package/docs/03-guides/02-inspector.md +17 -1
  75. package/docs/03-guides/06-sandboxed-agents.md +2 -2
  76. package/docs/03-guides/08-tailnet.md +123 -0
  77. package/docs/04-reference/01-cli.md +56 -15
  78. package/docs/04-reference/02-board.md +10 -5
  79. package/docs/04-reference/03-http.md +24 -3
  80. package/package.json +1 -1
  81. package/dist/inspect-F-b4GPXX.mjs +0 -2
  82. package/dist/serve-DS2T2iWI.mjs +0 -181
@@ -1,10 +1,10 @@
1
- import { C as fileSize, T as typeOf, c as notFound, r as badRequest, t as HttpError, x as IMPORT_BYTES_MAX, y as ATTACHMENT_BYTES_MAX } from "./errors-DZ1tbwSM.mjs";
1
+ import { C as fileSize, T as typeOf, c as notFound, r as badRequest, t as HttpError, x as IMPORT_BYTES_MAX, y as ATTACHMENT_BYTES_MAX } from "./errors-QhkdzI-o.mjs";
2
2
  import { N as toStorable, m as MESSAGE_TEXT_MAX, s as ChannelPath } from "./schemas-7VFdomFB.mjs";
3
- import { l as isThreadTarget, s as channelOf } from "./external-BVr1Sq0y.mjs";
3
+ import { l as isThreadTarget, s as channelOf } from "./external-BuVTXT1R.mjs";
4
4
  import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
5
- 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-BKsTcMAv.mjs";
6
- import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-DfZGp3B-.mjs";
7
- 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-mGuhF4i5.mjs";
5
+ 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-CT6vMNUc.mjs";
6
+ import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
7
+ 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-MOcxGpOQ.mjs";
8
8
  import { i as vercelDeployments, n as displayText } from "./bots-CLKKMgYf.mjs";
9
9
  //#region src/sync/engine.ts
10
10
  /** `files`: a message with files may have no text. */
@@ -87,15 +87,30 @@ function keyedId(key, platform, id) {
87
87
  if (id.startsWith(`${key}:`)) return id;
88
88
  return `${key}:${id.startsWith(`${platform}:`) ? id.slice(platform.length + 1) : id}`;
89
89
  }
90
- /** A platform event with its author named under `key`. */
90
+ /**
91
+ * A platform event with its author named under `key`, and every user its text mentions there too:
92
+ * the ones `mentioned` describes, and any it has no room for, since a mention by the platform's
93
+ * name would be of another sync's user.
94
+ */
91
95
  function keyedEvent(key, platform, event) {
92
- return "author" in event ? {
96
+ if (!("author" in event)) return event;
97
+ const author = {
98
+ ...event.author,
99
+ id: keyedId(key, platform, event.author.id)
100
+ };
101
+ if (event.kind !== "message" && event.kind !== "edited" || key === platform) return {
93
102
  ...event,
94
- author: {
95
- ...event.author,
96
- id: keyedId(key, platform, event.author.id)
97
- }
98
- } : event;
103
+ author
104
+ };
105
+ return {
106
+ ...event,
107
+ author,
108
+ ...event.mentioned ? { mentioned: event.mentioned.map((user) => ({
109
+ ...user,
110
+ id: keyedId(key, platform, user.id)
111
+ })) } : {},
112
+ text: replaceMentions(event.text, (token) => token.kind === "actor" && token.actor.startsWith(`${platform}:`) ? `@[${keyedId(key, platform, token.actor)}]` : null)
113
+ };
99
114
  }
100
115
  /**
101
116
  * Two-way sync between a board and its platforms, run by board(): webhooks come in through its
@@ -698,6 +713,7 @@ function createSyncEngine(entries) {
698
713
  }, synced?.channel ?? channel);
699
714
  const base = {
700
715
  ...links.length ? { links } : {},
716
+ ...event.mentioned?.length ? { mentioned: event.mentioned } : {},
701
717
  author: event.author,
702
718
  text: clampText(withNotes(overrides.text ?? event.text, notes), attachments.length > 0),
703
719
  ...attachments.length ? { attachments } : {},
@@ -794,13 +810,15 @@ function createSyncEngine(entries) {
794
810
  else if (event.kind === "edited") {
795
811
  const stored = await messageOf(id);
796
812
  const text = clampText(withNotes(overrides.text ?? event.text, stored ? notesIn(stored.text) : []), (stored?.attachments.length ?? 0) > 0);
813
+ const mentioned = event.mentioned?.length ? { mentioned: event.mentioned } : {};
797
814
  if (stored && !event.linksOnly && stored.text !== text) await screened(await call("syncImport", {
798
815
  op: "edit",
799
816
  author,
800
817
  from: key,
801
818
  origin,
802
819
  text,
803
- source: from
820
+ source: from,
821
+ ...mentioned
804
822
  }));
805
823
  const links = stored ? await resolveLinks(platform, event.links ?? [], origin, stored.channel, stored.links) : [];
806
824
  if (stored && !sameLinks(links, stored.links)) await call("syncImport", {
@@ -917,43 +935,19 @@ function createSyncEngine(entries) {
917
935
  }
918
936
  }
919
937
  /**
920
- * A message's text for a platform, through entry `key`, its mentions resolved as it posts and only
921
- * against that entry's own users. An `@handle` reads natively when one of them has it, or of
922
- * several, the one who wrote in the thread: `@support/malte` names one of support's users, and
923
- * `@malte` is short for whichever of this sync's users that is, under its principal's name. An `@[actor-id]` reads natively when it's one of them (`@[slack:user:U0456]` also naming this sync's own profile of them),
924
- * and as the actor's name otherwise; an `@[email]`, as whoever the platform finds with it, or as
925
- * the email. The rest go as written.
938
+ * A message's text for a platform, through entry `key`. A mention is `@[actor-id]`, settled when
939
+ * the message was written: it reads natively when the actor is one of this entry's own users
940
+ * (`@[slack:user:U0456]` also naming this sync's own profile of them), and as the actor's name
941
+ * otherwise. An `@[email]` is whoever the platform finds with it, or the email. Everything else
942
+ * is text and goes as written, an `@handle` included: no sync reads one as a mention.
926
943
  */
927
- async function textFor(key, message, actors, text) {
928
- const tokens = extractMentions(text);
929
- if (tokens.length === 0) return text;
944
+ async function textFor(key, actors, text) {
945
+ const exact = extractMentions(text).flatMap((token) => token.kind === "actor" ? [token.actor] : []);
946
+ if (exact.length === 0) return text;
930
947
  const found = /* @__PURE__ */ new Map();
931
- for (const token of tokens) if (token.kind === "actor" && !actors.byId[token.actor] && isEmail(token.actor)) found.set(token.actor, await emailMention(key, token.actor));
932
- const users = /* @__PURE__ */ new Map();
933
- for (const token of tokens) {
934
- if (token.kind !== "handle") continue;
935
- const theirs = Object.values(actors.byId).filter((actor) => {
936
- const handle = actor.handle.toLowerCase();
937
- return handle === token.handle || !token.handle.includes("/") && handle.slice(handle.indexOf("/") + 1) === token.handle;
938
- });
939
- users.set(token.handle, theirs.flatMap((actor) => {
940
- const mention = nativeMention(key, actor.id, actors);
941
- return mention === null ? [] : [{
942
- id: actor.id,
943
- mention
944
- }];
945
- }));
946
- }
947
- const writers = [...users.values()].some((theirs) => new Set(theirs.map((user) => user.mention)).size > 1) ? new Set((await threadOf(message.re ?? message.id)).map((written) => written.by.actor)) : null;
948
- const one = (theirs) => {
949
- const mentions = new Set(theirs.map((user) => user.mention));
950
- return mentions.size === 1 ? [...mentions][0] : null;
951
- };
948
+ for (const named of exact) if (!actors.byId[named] && isEmail(named)) found.set(named, await emailMention(key, named));
952
949
  return replaceMentions(text, (token) => {
953
- if (token.kind === "handle") {
954
- const theirs = users.get(token.handle) ?? [];
955
- return one(theirs) ?? (writers ? one(theirs.filter((user) => writers.has(user.id))) : null);
956
- }
950
+ if (token.kind === "handle") return null;
957
951
  if (found.has(token.actor)) return found.get(token.actor) ?? token.actor;
958
952
  const actor = actorNamed(token.actor, actors);
959
953
  return actor ? nativeMention(key, actor.id, actors) ?? actor.name : null;
@@ -961,8 +955,7 @@ function createSyncEngine(entries) {
961
955
  }
962
956
  /**
963
957
  * The actor an `@[actor-id]` names: that actor, or, when the board has none by that ID, this
964
- * sync's own profile of it (`@[slack:user:U0456]` for `<principal>+slack:user:U0456`), as plain
965
- * `@malte` is short for this sync's `<principal>/malte`.
958
+ * sync's own profile of it (`@[slack:user:U0456]` for `<principal>+slack:user:U0456`).
966
959
  */
967
960
  function actorNamed(id, actors) {
968
961
  return actors.byId[id] ?? (actors.principal ? actors.byId[`${actors.principal}+${id}`] : void 0) ?? null;
@@ -1010,7 +1003,7 @@ function createSyncEngine(entries) {
1010
1003
  }));
1011
1004
  if (typeof body !== "string") throw badRequest("a provider renderer must return markdown");
1012
1005
  const labeled = `**${name}**: `;
1013
- const markdown = await textFor(key, message, actors, body.startsWith(labeled) && opensBlock(body.slice(labeled.length)) ? `**${name}**:\n\n${body.slice(labeled.length)}` : body);
1006
+ const markdown = await textFor(key, actors, body.startsWith(labeled) && opensBlock(body.slice(labeled.length)) ? `**${name}**:\n\n${body.slice(labeled.length)}` : body);
1014
1007
  const deployments = message.by.actor === "github:user:35613825" ? vercelDeployments(message.text) : null;
1015
1008
  return {
1016
1009
  markdown,
@@ -401,13 +401,14 @@ function createBoardClient(options) {
401
401
  ...input,
402
402
  attachments: input.attachments.map((file) => typeof file === "string" ? file : file.id)
403
403
  } : input;
404
- const { task, claim } = await call("POST", "/tasks", { body: {
404
+ const { task, claim, mentions } = await call("POST", "/tasks", { body: {
405
405
  ...where,
406
406
  ...made
407
407
  } });
408
408
  return {
409
409
  task,
410
- ...claim ? { claim: claimed(task, claim) } : {}
410
+ ...claim ? { claim: claimed(task, claim) } : {},
411
+ ...mentions ? { mentions } : {}
411
412
  };
412
413
  }
413
414
  /**
@@ -540,17 +541,31 @@ function createBoardClient(options) {
540
541
  posted: async (id) => (await call("GET", `/posts/${path(id)}`)).message,
541
542
  /** 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`. */
542
543
  threads: (query = {}) => call("GET", `/threads${queryString(query)}`),
544
+ /**
545
+ * Starts a thread. An `@handle` in the text that names exactly one actor you can see is stored as
546
+ * `@[actor-id]`, a mention of them; one that names none or several stays as typed, a mention of
547
+ * no one. `mentions` on what comes back says what became of each, when the text typed any.
548
+ */
543
549
  async post(channel, input) {
544
- return (await call("POST", "/messages", { body: {
550
+ const { message, mentions } = await call("POST", "/messages", { body: {
545
551
  channel,
546
552
  ...messageBody(input)
547
- } })).message;
553
+ } });
554
+ return mentions ? {
555
+ ...message,
556
+ mentions
557
+ } : message;
548
558
  },
559
+ /** Replies in a thread. Its `@handle`s are settled as `post`'s are: of several who share one, it's the one who wrote in the thread. */
549
560
  async reply(id, input) {
550
- return (await call("POST", "/messages", { body: {
561
+ const { message, mentions } = await call("POST", "/messages", { body: {
551
562
  re: id,
552
563
  ...messageBody(input)
553
- } })).message;
564
+ } });
565
+ return mentions ? {
566
+ ...message,
567
+ mentions
568
+ } : message;
554
569
  },
555
570
  /**
556
571
  * Posts later, as you: a new thread when `target` is a channel, a reply when it's
@@ -558,10 +573,14 @@ function createBoardClient(options) {
558
573
  * `schedule: { id, n }`. Needs a board with a scheduler.
559
574
  */
560
575
  async schedule(target, input) {
561
- return (await call("POST", "/schedules", { body: {
576
+ const { schedule, mentions } = await call("POST", "/schedules", { body: {
562
577
  ...typeof target === "string" ? { channel: target } : { re: target.re },
563
578
  ...scheduleBody(input)
564
- } })).schedule;
579
+ } });
580
+ return mentions ? {
581
+ ...schedule,
582
+ mentions
583
+ } : schedule;
565
584
  },
566
585
  /** Pending schedules (`all` for done and canceled too), oldest first. `re` is any message in a thread. */
567
586
  schedules: async (query = {}) => (await call("GET", `/schedules${queryString(query)}`)).schedules,
@@ -1,5 +1,5 @@
1
1
  import { d as LabelKey, p as Labels } from "./schemas-7VFdomFB.mjs";
2
- import { n as ExternalEvent, r as ExternalLocation } from "./external-BVr1Sq0y.mjs";
2
+ import { n as ExternalEvent, r as ExternalLocation } from "./external-BuVTXT1R.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/sync/fn.ts
5
5
  const ROUTES = Symbol.for("board.syncRoutes");