@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.
- package/dist/{access-Crbvd2Dm.mjs → access-C06pIr0M.mjs} +1 -1
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +4 -4
- package/dist/{actors-BBphaJ_G.mjs → actors-Dkyg-oo0.mjs} +2 -2
- package/dist/{auth-C-pFnJBA.mjs → auth-B9-wXQ-x.mjs} +29 -9
- package/dist/{auth-CkNXnQno.d.mts → auth-li3lKwJG.d.mts} +1 -1
- package/dist/{backend-D3p8gjba.d.mts → backend-i_esjwUS.d.mts} +21 -4
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-Bn33acHd.d.mts → chat-provider-BWBGZOZY.d.mts} +4 -2
- package/dist/{chat-provider-1zpY6Qo_.mjs → chat-provider-CD7jskh7.mjs} +7 -4
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +2 -2
- package/dist/cli.mjs +46 -15
- package/dist/{commands-CSZPQ38I.d.mts → commands-CJsOA-hf.d.mts} +6 -0
- package/dist/{commands-D0lyo8O8.mjs → commands-Dk6_cHLS.mjs} +6 -0
- package/dist/{conformance-Blzd4CXG.mjs → conformance-CDP8y2Zm.mjs} +94 -3
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-C_SlBihU.mjs → engine-j2VeNuKG.mjs} +43 -50
- package/dist/{errors-DZ1tbwSM.mjs → errors-QhkdzI-o.mjs} +27 -8
- package/dist/{events-mGuhF4i5.mjs → events-MOcxGpOQ.mjs} +1 -1
- package/dist/{exports-DQauuHrc.mjs → exports-CEqS-IPP.mjs} +205 -56
- package/dist/{exports-DUX_Yzo7.d.mts → exports-CF9rKCXd.d.mts} +4 -4
- package/dist/{external-BVr1Sq0y.mjs → external-BuVTXT1R.mjs} +6 -2
- package/dist/{index-BHXg4Xdo.d.mts → index-ttfx1TZ6.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +7 -7
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +44 -44
- package/dist/inspect/engine.js +1 -1
- package/dist/inspect-8YAhl_h3.mjs +2 -0
- package/dist/{inspect-2OIjv2lW.mjs → inspect-vOSrW_g6.mjs} +82 -32
- package/dist/{local-11FMUJrU.mjs → local-0ajWOVhN.mjs} +92 -50
- package/dist/{main-BYmbTDgo.mjs → main-B8Zkd4Pm.mjs} +127 -46
- package/dist/{memory-CZBdVNn8.mjs → memory-CMm-Fk_A.mjs} +2 -2
- package/dist/{mentions-DfZGp3B-.mjs → mentions-CnWt9Z5b.mjs} +34 -1
- package/dist/{middleware-BKsTcMAv.mjs → middleware-CT6vMNUc.mjs} +1 -1
- package/dist/{provider-D3bfHRHA.d.mts → provider-Bc3xI90K.d.mts} +82 -5
- package/dist/{routes-B2HHHD_C.mjs → routes-ABXf3CKq.mjs} +17 -4
- package/dist/{routes-NEc6w3QC.d.mts → routes-CjA6Mp4D.d.mts} +70 -0
- package/dist/serve-BepKXDH3.mjs +285 -0
- package/dist/{server-Ch3tuK2k.mjs → server-4rQL3xuH.mjs} +38 -19
- package/dist/{serving-9riPNrHk.mjs → serving-BNdiReQT.mjs} +1 -1
- package/dist/{sql-Bml29DpM.mjs → sql-IEbO5vXs.mjs} +2 -2
- package/dist/{sqlite-4C5u7-ag.mjs → sqlite-CVG8XKHm.mjs} +2 -2
- package/dist/{sqlite-db-eVb9v3zc.mjs → sqlite-db-BJjPQYx4.mjs} +1 -1
- package/dist/sync-chat-sdk.d.mts +16 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +16 -2
- package/dist/sync-github.mjs +3 -3
- package/dist/sync-linear.d.mts +17 -3
- package/dist/sync-linear.mjs +2 -2
- package/dist/sync-slack.d.mts +17 -3
- package/dist/sync-slack.mjs +106 -14
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{task-batch-BJcLiYe1.mjs → task-batch-BZXm6kOE.mjs} +6 -6
- package/dist/{tokens-DPKF_cb5.mjs → tokens-BCp4EWTQ.mjs} +2 -2
- package/docs/01-board/01-mounting.md +7 -4
- package/docs/01-board/03-identity.md +43 -23
- package/docs/01-board/04-messages.md +3 -2
- package/docs/01-board/06-watchers.md +3 -3
- package/docs/01-board/07-schedules.md +2 -2
- package/docs/01-board/09-access.md +6 -4
- package/docs/01-board/10-local.md +4 -1
- package/docs/02-sync/01-overview.md +4 -5
- package/docs/02-sync/02-functions.md +2 -2
- package/docs/02-sync/03-slack.md +8 -5
- package/docs/02-sync/06-providers.md +8 -0
- package/docs/03-guides/02-inspector.md +17 -1
- package/docs/03-guides/06-sandboxed-agents.md +2 -2
- package/docs/03-guides/08-tailnet.md +123 -0
- package/docs/04-reference/01-cli.md +56 -15
- package/docs/04-reference/02-board.md +10 -5
- package/docs/04-reference/03-http.md +24 -3
- package/package.json +1 -1
- package/dist/inspect-F-b4GPXX.mjs +0 -2
- 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-
|
|
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-
|
|
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-
|
|
6
|
-
import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-
|
|
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-
|
|
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
|
-
/**
|
|
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
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
|
921
|
-
*
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
*
|
|
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,
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
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
|
|
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`)
|
|
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,
|
|
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
|
-
|
|
550
|
+
const { message, mentions } = await call("POST", "/messages", { body: {
|
|
545
551
|
channel,
|
|
546
552
|
...messageBody(input)
|
|
547
|
-
} })
|
|
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
|
-
|
|
561
|
+
const { message, mentions } = await call("POST", "/messages", { body: {
|
|
551
562
|
re: id,
|
|
552
563
|
...messageBody(input)
|
|
553
|
-
} })
|
|
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
|
-
|
|
576
|
+
const { schedule, mentions } = await call("POST", "/schedules", { body: {
|
|
562
577
|
...typeof target === "string" ? { channel: target } : { re: target.re },
|
|
563
578
|
...scheduleBody(input)
|
|
564
|
-
} })
|
|
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-
|
|
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");
|