@vercel/board 0.39.0 → 0.41.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/README.md +6 -4
- package/dist/{access-CVkjSfxj.mjs → access-C5HaO42b.mjs} +2 -2
- package/dist/access.d.mts +6 -6
- package/dist/access.mjs +5 -5
- package/dist/actors-nrOf7Y7z.mjs +160 -0
- package/dist/{auth-BXLCkeB0.d.mts → auth-Bn8J_1F2.d.mts} +14 -29
- package/dist/{auth-B3bBYOqf.mjs → auth-DAlYi6TN.mjs} +9 -19
- package/dist/{backend-HcCCGPG4.d.mts → backend-CYsTLxtP.d.mts} +139 -43
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/blocks-CVoBC7ur.mjs +402 -0
- package/dist/blocks-DGvh2alZ.d.mts +33 -0
- package/dist/{chat-provider-1WKsLEnM.mjs → chat-provider-CPZg2MQb.mjs} +2 -2
- package/dist/{chat-provider-DyNy5xdC.d.mts → chat-provider-Cgkh9xJw.d.mts} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +3 -3
- package/dist/cli-embedded.mjs +4 -4
- package/dist/cli.mjs +8 -13
- package/dist/{commands-B5d-lmNN.d.mts → commands-CrEVjASe.d.mts} +14 -26
- package/dist/{commands-BLS7erNu.mjs → commands-QRD0U9AQ.mjs} +114 -105
- package/dist/{conformance-D59Py2m2.mjs → conformance-ClxEEZ9C.mjs} +378 -101
- package/dist/conformance.d.mts +11 -9
- package/dist/conformance.mjs +1 -1
- package/dist/data-values-C-Cq80hz.mjs +176 -0
- package/dist/digest-Dna1CGa_.mjs +4 -0
- package/dist/{engine-eUgO5jTM.mjs → engine-8BcNeckB.mjs} +197 -84
- package/dist/{errors-rYDxZEuN.mjs → errors-DcQf5WeM.mjs} +123 -42
- package/dist/{events-C6HwB046.mjs → events-BT8y_81j.mjs} +2 -2
- package/dist/{exports-M5o4PTfO.mjs → exports-B6udRV_E.mjs} +961 -383
- package/dist/exports-C8zsIL1A.d.mts +4 -0
- package/dist/{external-CHDxWIVf.mjs → external-DymyhUzl.mjs} +1 -1
- package/dist/{index-rNqqgkyu.d.mts → index-fcpEFCTR.d.mts} +2 -2
- package/dist/index.d.mts +7 -6
- package/dist/index.mjs +8 -6
- package/dist/index.node.d.mts +7 -6
- package/dist/index.node.mjs +5 -4
- package/dist/inspect/app.js +110 -109
- package/dist/inspect/engine.js +5 -5
- package/dist/inspect-BsF3mYMY.mjs +2 -0
- package/dist/{inspect-BkXxR2uB.mjs → inspect-DPRoC_Gg.mjs} +6 -6
- package/dist/{local-DvkOWf4U.mjs → local-B9y4p6N7.mjs} +463 -512
- package/dist/{main-DtV_Po9i.mjs → main-S0A-c_kP.mjs} +549 -178
- package/dist/{memory-DkoqhxIH.mjs → memory-DhduVbUu.mjs} +2 -2
- package/dist/{mentions-CB6ShY4R.mjs → mentions-DfZGp3B-.mjs} +18 -4
- package/dist/{middleware-CPqAuRtp.mjs → middleware-DHdrxmoc.mjs} +71 -3
- package/dist/{targets-C1mT3M1N.mjs → origin-B3m2lnZC.mjs} +43 -64
- package/dist/{page-64IwoGRu.mjs → page-2jjHZmIW.mjs} +2 -2
- package/dist/page-CAUe4GmQ.mjs +2 -0
- package/dist/{provider-D5yVFisj.d.mts → provider-dY54GFNz.d.mts} +20 -34
- package/dist/{routes-BffuaoTX.d.mts → routes-By9lmvUD.d.mts} +91 -77
- package/dist/{schemas-AZkxk06N.mjs → schemas-DAzSsgWk.mjs} +8 -3
- package/dist/schemas.d.mts +37 -0
- package/dist/schemas.mjs +3 -0
- package/dist/{serve-CX1rqDF_.mjs → serve-B15I2Ibf.mjs} +5 -5
- package/dist/{server-DkYkyarg.mjs → server-DgpRZ4Nu.mjs} +74 -127
- package/dist/{serving-DJMcG0dT.mjs → serving-CALKWs9K.mjs} +1 -1
- package/dist/{sql-l3ysn4O5.mjs → sql-P9g-rLIF.mjs} +75 -12
- package/dist/{sqlite-CAwNHbQD.mjs → sqlite-B3rCcIof.mjs} +2 -2
- package/dist/{sqlite-db-cm5yhrD-.mjs → sqlite-db-D0Fyju-4.mjs} +1 -1
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +2 -2
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-linear.mjs +2 -2
- package/dist/sync-slack.d.mts +14 -8
- package/dist/sync-slack.mjs +46 -19
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{tokens-DA9ipsZ-.mjs → tokens-D7_ZIWpX.mjs} +4 -4
- package/docs/01-board/01-mounting.md +13 -16
- package/docs/01-board/03-identity.md +112 -74
- package/docs/01-board/04-messages.md +61 -2
- package/docs/01-board/05-reading.md +11 -5
- package/docs/01-board/06-watchers.md +17 -13
- package/docs/01-board/07-schedules.md +8 -6
- package/docs/01-board/08-middleware.md +1 -1
- package/docs/01-board/09-access.md +80 -132
- package/docs/02-sync/01-overview.md +75 -4
- package/docs/02-sync/02-functions.md +11 -6
- package/docs/02-sync/03-slack.md +43 -19
- package/docs/02-sync/06-providers.md +9 -4
- package/docs/03-guides/01-coding-agents.md +18 -22
- package/docs/03-guides/02-inspector.md +4 -5
- package/docs/03-guides/03-ci.md +7 -26
- package/docs/03-guides/04-triage.md +2 -2
- package/docs/03-guides/05-agent-factory.md +7 -9
- package/docs/03-guides/06-sandboxed-agents.md +149 -0
- package/docs/04-reference/01-cli.md +161 -104
- package/docs/04-reference/02-board.md +89 -37
- package/docs/04-reference/03-http.md +176 -71
- package/docs/04-reference/05-conformance.md +47 -21
- package/docs/index.md +5 -5
- package/package.json +5 -1
- package/dist/actors-kfMejhaw.mjs +0 -156
- package/dist/digest-krhjNAt4.mjs +0 -4
- package/dist/exports-vLQ2Y2Nd.d.mts +0 -4
- package/dist/inspect-lnv1sLXM.mjs +0 -2
- package/dist/page-BUj8_UZv.mjs +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as sqlTables } from "./sql-
|
|
1
|
+
import { r as sqlTables } from "./sql-P9g-rLIF.mjs";
|
|
2
2
|
import { t as memory$1 } from "./store-memory-CKQVEzXN.mjs";
|
|
3
|
-
import { t as sqliteDb } from "./sqlite-db-
|
|
3
|
+
import { t as sqliteDb } from "./sqlite-db-D0Fyju-4.mjs";
|
|
4
4
|
//#region src/store/memory.ts
|
|
5
5
|
/**
|
|
6
6
|
* A board that lives in memory, for tests: its log in A2's memory store, its
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import { r as findBlocks } from "./blocks-CVoBC7ur.mjs";
|
|
1
2
|
//#region src/contract/mentions.ts
|
|
2
3
|
const FENCED_CODE = /```[\s\S]*?```/g;
|
|
3
4
|
const INLINE_CODE = /`[^`\n]*`/g;
|
|
4
5
|
const NAME = "[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?";
|
|
5
|
-
const MENTION = new RegExp(`(?<![\\w@.-])@(${NAME}(?:/${NAME})?)(
|
|
6
|
+
const MENTION = new RegExp(`(?<![\\w@.-])@(${NAME}(?:/${NAME})?)(?!:\\S|[a-z0-9_/-]|\\.(?=[a-z0-9]))`, "gi");
|
|
6
7
|
const EXACT = /(?<![\w@.-])@\[([^\]\s]+)\]/g;
|
|
7
|
-
/**
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Blanks out code so mentions inside it never count. A block's fence is code whatever it's fenced
|
|
10
|
+
* with and whatever its JSON holds, so nothing that reads or rewrites mentions touches its data.
|
|
11
|
+
*/
|
|
12
|
+
function proseOnly(text) {
|
|
13
|
+
let prose = text.replace(FENCED_CODE, (match) => " ".repeat(match.length)).replace(INLINE_CODE, (match) => " ".repeat(match.length));
|
|
14
|
+
if (text.includes("json#")) for (const { start, end } of findBlocks(text)) prose = `${prose.slice(0, start)}${" ".repeat(end - start)}${prose.slice(end)}`;
|
|
15
|
+
return prose;
|
|
16
|
+
}
|
|
9
17
|
/** Mentions in prose order, deduplicated. Handles are lowercased. */
|
|
10
18
|
function extractMentions(text) {
|
|
11
19
|
const prose = proseOnly(text);
|
|
@@ -35,6 +43,12 @@ function extractMentions(text) {
|
|
|
35
43
|
const seen = /* @__PURE__ */ new Set();
|
|
36
44
|
return found.sort((a, b) => a.index - b.index).filter(({ key }) => !seen.has(key) && seen.add(key)).map(({ token }) => token);
|
|
37
45
|
}
|
|
46
|
+
/** An email, as `@[ada@vercel.com]` names one: no actor ID has an `@` without a `:`. */
|
|
47
|
+
const isEmail = (value) => /^[^\s@:]+@[^\s@:]+$/.test(value);
|
|
48
|
+
/** A mention as filters match it: an actor ID (it has a colon) as written, anything else (a handle, an email) lowercased. */
|
|
49
|
+
const mentionTerm = (name) => name.includes(":") ? name : name.toLowerCase();
|
|
50
|
+
/** What `text` mentions, as filters match it: each `@handle` and `@[…]`, as `mentionTerm` has it. */
|
|
51
|
+
const mentionTerms = (text) => [...new Set(extractMentions(text).map((token) => mentionTerm(token.kind === "handle" ? token.handle : token.actor)))];
|
|
38
52
|
/**
|
|
39
53
|
* Rewrites each mention in prose with `replace`, which also gets the mention as
|
|
40
54
|
* written; one it returns null for stays as written.
|
|
@@ -69,4 +83,4 @@ function replaceMentions(text, replace) {
|
|
|
69
83
|
return out + text.slice(at);
|
|
70
84
|
}
|
|
71
85
|
//#endregion
|
|
72
|
-
export { replaceMentions as n, extractMentions as t };
|
|
86
|
+
export { replaceMentions as a, mentionTerms as i, isEmail as n, mentionTerm as r, extractMentions as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as HttpError } from "./errors-
|
|
2
|
-
import { d as Labels, f as MESSAGE_TEXT_MAX } from "./schemas-
|
|
1
|
+
import { t as HttpError } from "./errors-DcQf5WeM.mjs";
|
|
2
|
+
import { d as Labels, f as MESSAGE_TEXT_MAX } from "./schemas-DAzSsgWk.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/client/ids.ts
|
|
5
5
|
const hex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
@@ -31,6 +31,74 @@ const keyId = async (principal, derived) => `key:${principal}:${(await sha256(`b
|
|
|
31
31
|
*/
|
|
32
32
|
const isKeyIdOf = (id, principal) => id.startsWith(`key:${principal}:`) && /^[0-9a-f]{32}$/.test(id.slice(`key:${principal}:`.length));
|
|
33
33
|
//#endregion
|
|
34
|
+
//#region src/contract/profiles.ts
|
|
35
|
+
/**
|
|
36
|
+
* What an actor's profile is, when it's a platform user a principal's sync speaks for: `slack:user:U0456`
|
|
37
|
+
* is user `user:U0456` under sync key `slack`. Null for an agent's profile (`claude`), whose name never
|
|
38
|
+
* has a colon, and for none.
|
|
39
|
+
*/
|
|
40
|
+
function platformProfile(profile) {
|
|
41
|
+
const colon = profile?.indexOf(":") ?? -1;
|
|
42
|
+
return profile && colon > 0 ? {
|
|
43
|
+
key: profile.slice(0, colon),
|
|
44
|
+
user: profile.slice(colon + 1)
|
|
45
|
+
} : null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A platform user's handle as board's mention syntax takes it (`NAME` in `mentions.ts`), so anyone
|
|
49
|
+
* can type it: diacritics taken off (`ü` is `u`), lowercased, each run of anything but `a-z`, `0-9`,
|
|
50
|
+
* `.`, `_`, and `-` as one `-`, and `-`, `.`, and `_` trimmed from the ends. "Jürgen Ubl" is
|
|
51
|
+
* `jurgen-ubl`. One with nothing left is their ID on the platform, without the sync key, the same
|
|
52
|
+
* way: `T_EU:U0MALTE` is `t_eu-u0malte`. Vercel's API names them by the same rule.
|
|
53
|
+
*/
|
|
54
|
+
function typableHandle(handle, userId) {
|
|
55
|
+
return typable(handle) || typable(userId);
|
|
56
|
+
}
|
|
57
|
+
/** `typableHandle`'s rule on one value, in a single pass: a trim by regex backtracks on long runs. */
|
|
58
|
+
const typable = (value) => trimmed(value.normalize("NFKD").replace(/\p{M}+/gu, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-"));
|
|
59
|
+
/** `-`, `.`, and `_` off both ends. */
|
|
60
|
+
function trimmed(value) {
|
|
61
|
+
let start = 0;
|
|
62
|
+
let end = value.length;
|
|
63
|
+
while (start < end && "-._".includes(value[start])) start++;
|
|
64
|
+
while (end > start && "-._".includes(value[end - 1])) end--;
|
|
65
|
+
return value.slice(start, end);
|
|
66
|
+
}
|
|
67
|
+
/** The most characters a handle the board stores has (`Handle` in `schemas.ts`). */
|
|
68
|
+
const HANDLE_MAX = 128;
|
|
69
|
+
/**
|
|
70
|
+
* `<principal>/<part>`, at most `HANDLE_MAX` characters: a part too long is cut on whole characters,
|
|
71
|
+
* and its ends trimmed again.
|
|
72
|
+
*/
|
|
73
|
+
function underPrincipal(principal, part) {
|
|
74
|
+
const room = HANDLE_MAX - Array.from(principal).length - 1;
|
|
75
|
+
const chars = Array.from(part);
|
|
76
|
+
return `${principal}/${chars.length <= room ? part : trimmed(chars.slice(0, Math.max(room, 1)).join(""))}`;
|
|
77
|
+
}
|
|
78
|
+
/** A platform user's ID there, without the sync key they came through: `T_EU:U0MALTE` of `slack-eu:T_EU:U0MALTE`. */
|
|
79
|
+
const userIdOf = (id) => id.slice(id.indexOf(":") + 1);
|
|
80
|
+
/**
|
|
81
|
+
* A platform user's handle as a principal's sync imported them: the principal's name (a project's,
|
|
82
|
+
* in every environment), then theirs, typable: `support/malte-ubl`, at most 128 characters. `userId`
|
|
83
|
+
* is theirs on the platform, without the sync key.
|
|
84
|
+
*/
|
|
85
|
+
const importedHandle = (principal, handle, userId) => underPrincipal(principal, typableHandle(handle, userId));
|
|
86
|
+
/** An actor ID's principal and profile: `vercel:user:u_1+claude` is `vercel:user:u_1` with `claude`. */
|
|
87
|
+
function actorParts(actor) {
|
|
88
|
+
const plus = actor.indexOf("+");
|
|
89
|
+
return plus === -1 ? {
|
|
90
|
+
principal: actor,
|
|
91
|
+
profile: null
|
|
92
|
+
} : {
|
|
93
|
+
principal: actor.slice(0, plus),
|
|
94
|
+
profile: actor.slice(plus + 1)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** `via www (preview)`, `via julian`: an environment shows unless it's production. */
|
|
98
|
+
const viaText = (via) => `via ${via.name}${via.environment !== null && via.environment !== "production" ? ` (${via.environment})` : ""}`;
|
|
99
|
+
/** An actor as people see it: `claude via julian`, `Malte via www (preview)`, or just a name for an actor with no profile. */
|
|
100
|
+
const shownName = (actor) => actor.via ? `${actor.name} ${viaText(actor.via)}` : actor.name;
|
|
101
|
+
//#endregion
|
|
34
102
|
//#region src/server/wait-until.ts
|
|
35
103
|
/**
|
|
36
104
|
* Keeps `task` running after the response, where the platform offers it: Vercel's request context, as A2
|
|
@@ -108,4 +176,4 @@ async function runMiddleware(middleware, input, commit) {
|
|
|
108
176
|
return committed.value;
|
|
109
177
|
}
|
|
110
178
|
//#endregion
|
|
111
|
-
export { waitUntil as a,
|
|
179
|
+
export { sha256 as _, waitUntil as a, platformProfile as c, userIdOf as d, viaText as f, keyId as g, isKeyIdOf as h, afterRetry as i, shownName as l, derivedId as m, MIDDLEWARE_ACTOR as n, actorParts as o, DERIVED_ID as p, runMiddleware as r, importedHandle as s, DroppedError as t, underPrincipal as u };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as Labels, f as MESSAGE_TEXT_MAX, l as LabelKey, m as MessageText, o as ChannelPath, r as AttachmentId, s as Emoji, u as LabelValue,
|
|
3
|
-
import { a as Link, i as ExternalTarget, l as isThreadTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { g as DIRECT_UPLOAD_BYTES_MAX, h as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-DcQf5WeM.mjs";
|
|
2
|
+
import { b as storable, d as Labels, f as MESSAGE_TEXT_MAX, l as LabelKey, m as MessageText, o as ChannelPath, r as AttachmentId, s as Emoji, u as LabelValue, y as platformAvatar } from "./schemas-DAzSsgWk.mjs";
|
|
3
|
+
import { a as Link, i as ExternalTarget, l as isThreadTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-DymyhUzl.mjs";
|
|
4
|
+
import { a as SCHEMA_DESCRIPTION_MAX, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX } from "./blocks-CVoBC7ur.mjs";
|
|
5
|
+
import { i as afterRetry } from "./middleware-DHdrxmoc.mjs";
|
|
6
|
+
import { o as options } from "./commands-QRD0U9AQ.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
//#region src/api/routes.ts
|
|
9
9
|
/**
|
|
@@ -43,8 +43,11 @@ const Filters = z.object({
|
|
|
43
43
|
by: z.string().optional(),
|
|
44
44
|
mentions: z.string().optional(),
|
|
45
45
|
label: repeated.pipe(z.array(LabelFilter)).optional(),
|
|
46
|
-
/**
|
|
47
|
-
from:
|
|
46
|
+
/**
|
|
47
|
+
* Where messages came from: a sync key such as `slack`, or `board` for the board itself. On Vercel's board, another
|
|
48
|
+
* project's key is `<project>/<key>`, by its name (up to 100 characters) or its ID.
|
|
49
|
+
*/
|
|
50
|
+
from: z.string().min(1).max(165).optional(),
|
|
48
51
|
/** Case-insensitive words the text contains. */
|
|
49
52
|
text: z.string().min(1).max(200).optional()
|
|
50
53
|
});
|
|
@@ -130,8 +133,6 @@ const SchedulesQuery = z.object({
|
|
|
130
133
|
all: flag.optional()
|
|
131
134
|
});
|
|
132
135
|
const CanGrant = z.union([z.literal("all"), z.array(z.string().min(1).max(16)).max(8)]);
|
|
133
|
-
/** What a grant or token lets do: `'all'`, a list for every channel, or a map from channel pattern to one. board() checks the patterns. */
|
|
134
|
-
const Can = z.union([CanGrant, z.record(z.string().min(1).max(300), CanGrant)]);
|
|
135
136
|
const ClaimValue = z.string().min(1).max(1e3);
|
|
136
137
|
const Environments = z.array(z.string().min(1).max(100)).min(1).max(16);
|
|
137
138
|
/**
|
|
@@ -214,15 +215,16 @@ const UpdateGrantBody = z.strictObject({
|
|
|
214
215
|
remove: z.array(PrincipalInput).min(1).max(32).optional(),
|
|
215
216
|
can: GrantCan.optional()
|
|
216
217
|
}).refine((body) => body.add !== void 0 || body.remove !== void 0 || body.can !== void 0, "name principals to add or remove, or a can");
|
|
217
|
-
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
218
|
+
/**
|
|
219
|
+
* A schema version to register, for good: `name` and `version` are its ID (`sandbox@1`), and
|
|
220
|
+
* `schema` is a JSON Schema for an object, in structural keywords only, which the board checks.
|
|
221
|
+
* Strict, so a board that doesn't know a field refuses it: what it kept could never be changed.
|
|
222
|
+
*/
|
|
223
|
+
const SchemaBody = z.strictObject({
|
|
224
|
+
name: z.string().regex(SCHEMA_NAME, "a schema name is up to 80 lowercase letters, numbers, and ._-, starting with a letter"),
|
|
225
|
+
version: z.number().int().min(1).max(SCHEMA_VERSION_MAX),
|
|
226
|
+
description: z.string().min(1).max(SCHEMA_DESCRIPTION_MAX).refine(storable, "a description has a NUL character or a lone surrogate").optional(),
|
|
227
|
+
schema: z.record(z.string(), z.unknown())
|
|
226
228
|
});
|
|
227
229
|
const SyncBody = z.object({ target: z.string().min(3).max(300) });
|
|
228
230
|
const InboxQuery = z.object({
|
|
@@ -300,16 +302,11 @@ const ImportOrigin = z.object({
|
|
|
300
302
|
/** A link as an import carries it: a board message it names is a ref. */
|
|
301
303
|
const ImportLink = Link.extend({ message: Ref.nullable() });
|
|
302
304
|
/**
|
|
303
|
-
* A platform user, as sync names them to the board. Their avatar shows wherever they do, so one
|
|
304
|
-
* that isn't an https URL is dropped, never refused: the write lands without it.
|
|
305
|
-
*/
|
|
306
|
-
const PlatformUser = ExternalAuthor.extend({ avatar: z.string().nullable().transform(platformAvatar) });
|
|
307
|
-
/**
|
|
308
305
|
* Who wrote it on the platform, and the sync key it came through: null for a write a sync callback
|
|
309
306
|
* makes as that user, which syncs out to every platform like one written on the board.
|
|
310
307
|
*/
|
|
311
308
|
const Imported = {
|
|
312
|
-
author:
|
|
309
|
+
author: ExternalAuthor.extend({ avatar: z.string().nullable().transform(platformAvatar) }),
|
|
313
310
|
from: SyncKey.nullable()
|
|
314
311
|
};
|
|
315
312
|
/**
|
|
@@ -384,10 +381,6 @@ const SyncImportBody = z.discriminatedUnion("op", [
|
|
|
384
381
|
...Imported,
|
|
385
382
|
...Changed,
|
|
386
383
|
links: z.array(ImportLink).max(10)
|
|
387
|
-
}),
|
|
388
|
-
z.object({
|
|
389
|
-
op: z.literal("seen"),
|
|
390
|
-
author: PlatformUser
|
|
391
384
|
})
|
|
392
385
|
]);
|
|
393
386
|
const PlatformFiles = z.array(z.string().min(1).max(300)).max(10).nullable();
|
|
@@ -611,19 +604,21 @@ const routes = {
|
|
|
611
604
|
method: "POST",
|
|
612
605
|
path: "/grants/:id/revoke"
|
|
613
606
|
},
|
|
614
|
-
/**
|
|
615
|
-
|
|
607
|
+
/** Every schema: the built-ins, then the board's own. Anyone the board lets in reads them. */
|
|
608
|
+
schemas: {
|
|
616
609
|
method: "GET",
|
|
617
|
-
path: "/
|
|
610
|
+
path: "/schemas"
|
|
618
611
|
},
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
612
|
+
/** One schema version, by `name@version`. */
|
|
613
|
+
schema: {
|
|
614
|
+
method: "GET",
|
|
615
|
+
path: "/schemas/:id"
|
|
623
616
|
},
|
|
624
|
-
|
|
617
|
+
/** Registers a version, which never changes after: needs manage at `*`. The same definition again is a no-op. */
|
|
618
|
+
createSchema: {
|
|
625
619
|
method: "POST",
|
|
626
|
-
path: "/
|
|
620
|
+
path: "/schemas",
|
|
621
|
+
body: SchemaBody
|
|
627
622
|
},
|
|
628
623
|
/** The caller's own post with the client ID it gave: what `POST /messages` answered, for telling a retry before posting. */
|
|
629
624
|
posted: {
|
|
@@ -762,7 +757,7 @@ const routes = {
|
|
|
762
757
|
};
|
|
763
758
|
//#endregion
|
|
764
759
|
//#region src/version.ts
|
|
765
|
-
const VERSION = "0.
|
|
760
|
+
const VERSION = "0.41.0";
|
|
766
761
|
//#endregion
|
|
767
762
|
//#region src/server/backend.ts
|
|
768
763
|
/** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
|
|
@@ -800,9 +795,9 @@ const METHODS = [
|
|
|
800
795
|
"updateGrant",
|
|
801
796
|
"explain",
|
|
802
797
|
"revokeGrant",
|
|
803
|
-
"
|
|
804
|
-
"
|
|
805
|
-
"
|
|
798
|
+
"schemas",
|
|
799
|
+
"schema",
|
|
800
|
+
"createSchema",
|
|
806
801
|
"upload",
|
|
807
802
|
"attachment",
|
|
808
803
|
"uploadStart",
|
|
@@ -1172,28 +1167,12 @@ const syncTarget = (target) => typeof target === "string" ? {
|
|
|
1172
1167
|
target,
|
|
1173
1168
|
kind: isThreadTarget(target) ? "thread" : "channel"
|
|
1174
1169
|
} : target;
|
|
1175
|
-
|
|
1176
|
-
|
|
1170
|
+
//#endregion
|
|
1171
|
+
//#region src/server/origin.ts
|
|
1177
1172
|
/**
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1173
|
+
* Sync in board() itself, on a board whose log is in this deployment (`local()`): it checked each
|
|
1174
|
+
* platform event itself, so what it imports is by the platform user, not a profile of anyone.
|
|
1180
1175
|
*/
|
|
1181
|
-
|
|
1182
|
-
const emails = extractMentions(text).flatMap((token) => token.kind === "actor" && token.actor.includes("@") ? [token.actor] : []);
|
|
1183
|
-
if (emails.length === 0) return {
|
|
1184
|
-
text,
|
|
1185
|
-
found: []
|
|
1186
|
-
};
|
|
1187
|
-
const byEmail = /* @__PURE__ */ new Map();
|
|
1188
|
-
for (const email of emails) byEmail.set(email, await find?.(email).catch(() => null) ?? null);
|
|
1189
|
-
return {
|
|
1190
|
-
text: replaceMentions(text, (token) => {
|
|
1191
|
-
if (token.kind !== "actor" || !byEmail.has(token.actor)) return null;
|
|
1192
|
-
const actor = byEmail.get(token.actor);
|
|
1193
|
-
return actor ? `@[${actor.id}]` : token.actor;
|
|
1194
|
-
}),
|
|
1195
|
-
found: [...byEmail.values()].filter((actor) => actor !== null)
|
|
1196
|
-
};
|
|
1197
|
-
}
|
|
1176
|
+
const SYNC_ACTOR = "board:sync";
|
|
1198
1177
|
//#endregion
|
|
1199
|
-
export {
|
|
1178
|
+
export { MessagesQuery as A, SyncBody as B, InboxAckBody as C, LabelBody as D, InboxQuery as E, ScheduleBody as F, ThreadsQuery as G, SyncFindQuery as H, SchedulesQuery as I, UploadStartBody as J, TypingBody as K, SchemaBody as L, ReactBody as M, Ref as N, LinkedQuery as O, RegisterBody as P, SourceJoinBody as R, GrantBody as S, InboxPushBody as T, SyncImportBody as U, SyncCopiesQuery as V, SyncReceiptBody as W, routes as Y, CreateChannelBody as _, compileWatcher as a, EventsQuery as b, METHODS as c, queryObject as d, readCapped as f, AckBody as g, VERSION as h, runMatch as i, PostBody as j, MatchesQuery as k, createRouter as l, SYNC as m, syncTarget as n, hasCriteria as o, readJson as p, UpdateGrantBody as q, canonicalWatchers as r, withMentions as s, SYNC_ACTOR as t, openapi as u, DeleteBody as v, InboxNextQuery as w, ExplainQuery as x, EditBody as y, SourceReadQuery as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./digest-
|
|
1
|
+
import "./digest-Dna1CGa_.mjs";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
//#region src/inspect/page.ts
|
|
@@ -22,7 +22,7 @@ function files() {
|
|
|
22
22
|
async function page() {
|
|
23
23
|
for (const file of files()) {
|
|
24
24
|
const script = await readFile(file, "utf8").catch(() => null);
|
|
25
|
-
if (script !== null && createHash("sha256").update(script).digest("hex") === "
|
|
25
|
+
if (script !== null && createHash("sha256").update(script).digest("hex") === "bffecbb88c0932a155d138369038fe92de8d4f8b6e40c651f6471358ac237c0a") return script;
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as InboxEntry, Ct as SyncThreadView, Dt as ThreadsPage, Et as ThreadView, F as MessageView, I as MessagesPage, J as RegisterInput, M as MatchView, Nt as UpdateGrantInput, P as Me, R as MessagesQueryInput, St as SyncReceiptInput, Y as RegistrationView, _ as FiltersInput, a as BoardEventView, b as GrantInput, bt as SyncImportInput, cn as ExternalFile, ct as SourceJoin, dt as SourceRead, en as Actor, f as EventsPage, g as Explanation, gt as SyncFindInput, kt as ThreadsQueryInput, ln as ExternalLink, n as ActorView, nn as Attachment, on as ExternalAuthor, ot as SchemaInput, rt as SchedulesQueryInput, s as ChannelView, sn as ExternalEvent, st as SchemaView, tn as ExternalCopy, tt as ScheduleView, u as Discovery, un as Link, vt as SyncFindView, w as InboxItem, wt as SyncedView, x as GrantView } from "./routes-By9lmvUD.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/client/client.d.ts
|
|
4
4
|
/**
|
|
@@ -34,15 +34,6 @@ type ClientOptions = {
|
|
|
34
34
|
/** An OIDC token whose audience is the board's URL, or a function returning one. Without one, `fetch` brings the credentials. */
|
|
35
35
|
token?: Resolvable<string>;
|
|
36
36
|
profile?: Resolvable<ProfileOption>;
|
|
37
|
-
/** Runtime session, recorded on writes and used to scope read cursors. */
|
|
38
|
-
session?: Resolvable<string | null>;
|
|
39
|
-
/** A person's handle; the board falls back to one derived from their user ID. */
|
|
40
|
-
handle?: Resolvable<string | null>;
|
|
41
|
-
/** Your display name and avatar, shown when you write as yourself (not as a profile). */
|
|
42
|
-
person?: Resolvable<{
|
|
43
|
-
name?: string | null;
|
|
44
|
-
avatar?: string | null;
|
|
45
|
-
} | null>;
|
|
46
37
|
/** Extra headers on every request. */
|
|
47
38
|
headers?: Resolvable<Record<string, string>>;
|
|
48
39
|
fetch?: typeof fetch;
|
|
@@ -119,10 +110,6 @@ type ExplainPrincipal = {
|
|
|
119
110
|
/** An app on the team, by its slug or client ID. */
|
|
120
111
|
app?: string;
|
|
121
112
|
};
|
|
122
|
-
/** What a write returns, with the handles in it that matched nobody and stayed plain text. */
|
|
123
|
-
type Written<T> = T & {
|
|
124
|
-
unknownMentions?: string[];
|
|
125
|
-
};
|
|
126
113
|
declare function createBoardClient(options: ClientOptions): {
|
|
127
114
|
url: string;
|
|
128
115
|
/**
|
|
@@ -166,16 +153,15 @@ declare function createBoardClient(options: ClientOptions): {
|
|
|
166
153
|
created: boolean;
|
|
167
154
|
grants?: GrantView[];
|
|
168
155
|
}>;
|
|
169
|
-
actors: () => Promise<Actor[]>;
|
|
156
|
+
actors: () => Promise<(Actor & Pick<ActorView, "verified">)[]>;
|
|
170
157
|
messages: (query?: Filters & Omit<MessagesQueryInput, keyof FiltersInput>) => Promise<MessagesPage>;
|
|
171
158
|
thread: (id: string) => Promise<ThreadView>;
|
|
172
159
|
/** Your own post with the client ID you gave it, as posting it answered: 404 `post_not_found` when there's none. */
|
|
173
160
|
posted: (id: string) => Promise<MessageView>;
|
|
174
161
|
/** Threads with a matching message, one summary each (root, reply count, latest reply), by latest activity. `limit` counts threads. */
|
|
175
162
|
threads: (query?: Filters & Omit<ThreadsQueryInput, keyof FiltersInput>) => Promise<ThreadsPage>;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
reply(id: string, input: string | ReplyOptions): Promise<Written<MessageView>>;
|
|
163
|
+
post(channel: string, input: string | PostOptions): Promise<MessageView>;
|
|
164
|
+
reply(id: string, input: string | ReplyOptions): Promise<MessageView>;
|
|
179
165
|
/**
|
|
180
166
|
* Posts later, as you: a new thread when `target` is a channel, a reply when it's
|
|
181
167
|
* `{ re }`, any message's ID in the thread. Each message it posts carries
|
|
@@ -183,7 +169,7 @@ declare function createBoardClient(options: ClientOptions): {
|
|
|
183
169
|
*/
|
|
184
170
|
schedule(target: string | {
|
|
185
171
|
re: string;
|
|
186
|
-
}, input: ScheduleOptions): Promise<
|
|
172
|
+
}, input: ScheduleOptions): Promise<ScheduleView>;
|
|
187
173
|
/** Pending schedules (`all` for done and canceled too), oldest first. `re` is any message in a thread. */
|
|
188
174
|
schedules: (query?: Omit<SchedulesQueryInput, 'all'> & {
|
|
189
175
|
all?: boolean;
|
|
@@ -218,20 +204,18 @@ declare function createBoardClient(options: ClientOptions): {
|
|
|
218
204
|
revokeGrant: (id: string) => Promise<{
|
|
219
205
|
revoked: boolean;
|
|
220
206
|
}>;
|
|
207
|
+
/** Every schema: the built-ins, then the board's own, by name and version. */
|
|
208
|
+
schemas: () => Promise<SchemaView[]>;
|
|
209
|
+
/** One schema version, by its ID: `sandbox@1`. */
|
|
210
|
+
schema: (id: string) => Promise<SchemaView>;
|
|
221
211
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
212
|
+
* Registers a schema version, for good: `schema` is a JSON Schema for an object, in structural
|
|
213
|
+
* keywords only. Needs manage at `*`. `created` is false for one that's there with the same
|
|
214
|
+
* definition; another definition is refused, since a version never changes.
|
|
225
215
|
*/
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}>;
|
|
230
|
-
/** Your live tokens, or everyone's with manage in every channel. Never their secrets. */
|
|
231
|
-
tokens: () => Promise<TokenView[]>;
|
|
232
|
-
/** It and every token minted with it stop. `revoked` is false when it was already revoked. */
|
|
233
|
-
revokeToken: (id: string) => Promise<{
|
|
234
|
-
revoked: boolean;
|
|
216
|
+
createSchema: (input: SchemaInput) => Promise<{
|
|
217
|
+
schema: SchemaView;
|
|
218
|
+
created: boolean;
|
|
235
219
|
}>;
|
|
236
220
|
/**
|
|
237
221
|
* Stores a file on the board, for a post or reply's `attachments`. Up to 4 MB goes in one
|
|
@@ -251,7 +235,6 @@ declare function createBoardClient(options: ClientOptions): {
|
|
|
251
235
|
revision?: number;
|
|
252
236
|
}) => Promise<{
|
|
253
237
|
ok: true;
|
|
254
|
-
unknownMentions?: string[];
|
|
255
238
|
}>;
|
|
256
239
|
delete: (id: string, opts?: {
|
|
257
240
|
revision?: number;
|
|
@@ -834,11 +817,14 @@ type ProviderFile = {
|
|
|
834
817
|
};
|
|
835
818
|
/**
|
|
836
819
|
* Who a post is from, for a platform that can show it as the sender (Slack's per-message
|
|
837
|
-
* username and icon): `name` is the label the text opens with (`**name**: …`)
|
|
820
|
+
* username and icon): `name` is the label the text opens with (`**name**: …`), and `attribution`
|
|
821
|
+
* the end of it that says whose word it is (` via support (preview) (slack)`), empty for a
|
|
822
|
+
* person as themselves, which a platform that cuts names short keeps whole.
|
|
838
823
|
*/
|
|
839
824
|
type ProviderSender = {
|
|
840
825
|
name: string;
|
|
841
826
|
avatar: string | null;
|
|
827
|
+
attribution?: string;
|
|
842
828
|
};
|
|
843
829
|
type ProviderPost = {
|
|
844
830
|
markdown: string;
|
|
@@ -1048,4 +1034,4 @@ declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
|
|
|
1048
1034
|
render(input: RenderInput): string;
|
|
1049
1035
|
}
|
|
1050
1036
|
//#endregion
|
|
1051
|
-
export {
|
|
1037
|
+
export { SyncRoot as A, ScheduleOptions as B, mirror as C, RootOverride as D, ProviderEvent as E, ErrorOrigin as F, UploadInput as H, Filters as I, PostOptions as L, eventSchema as M, BoardClient as N, SyncOverrides as O, BoardError as P, ProfileOption as R, into as S, EventBase as T, WaitOptions as U, ScheduleTiming as V, duration as W, SyncFn as _, ProviderOptions as a, SyncUnit as b, Receive as c, Renderer as d, ResolvedTarget as f, Sync as g, UnreadableError as h, ProviderFile as i, envelope as j, SyncResult as k, ReceivedEvent as l, SyncProvider as m, FileDelivery as n, ProviderPost as o, SyncContext as p, ProviderDelivery as r, ProviderSender as s, FetchedLink as t, RenderInput as u, SyncIn as v, render as w, channels as x, SyncOut as y, ReplyOptions as z };
|