@vercel/board 0.49.0 → 0.50.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-B8DnrnHa.mjs → access-BbgmsAFF.mjs} +2 -2
- package/dist/access.mjs +5 -5
- package/dist/{actors-DewJKyqy.mjs → actors-CX2D22hL.mjs} +3 -3
- package/dist/{auth-CEU06Nyp.mjs → auth-DJDTfgAL.mjs} +2 -2
- package/dist/{backend-BzCXxVZ-.d.mts → backend-CcaaS9Xl.d.mts} +12 -3
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-BS_fr61g.mjs → chat-provider-HJ7y_ipp.mjs} +2 -2
- package/dist/cli-embedded.d.mts +8 -2
- package/dist/cli-embedded.mjs +9 -3
- package/dist/cli.mjs +5 -5
- package/dist/{conformance-0xONNKcB.mjs → conformance-Cr-umDl0.mjs} +3 -3
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-BH_nfJ3N.mjs → engine-DJZ8Xy_g.mjs} +9 -7
- package/dist/{errors-DwV7I0g4.mjs → errors-DYF4hhIc.mjs} +1 -1
- package/dist/{events-B76-4bNp.mjs → events-BdOCmnZh.mjs} +3 -3
- package/dist/{exports-DLzyKwEp.mjs → exports-CuD-Mxkw.mjs} +62 -45
- package/dist/{exports-CKEK1fxf.d.mts → exports-lmr6UHHc.d.mts} +1 -1
- package/dist/{external-BLI4W_-V.mjs → external-D2jq_DEQ.mjs} +1 -1
- package/dist/{index-DxqSw8yd.d.mts → index-_KxJu15n.d.mts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +3 -3
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +35 -35
- package/dist/inspect/engine.js +3 -3
- package/dist/{inspect-B2ImmOvw.mjs → inspect-CZeoSm7E.mjs} +3 -3
- package/dist/inspect-UCcPViyA.mjs +2 -0
- package/dist/inspect.mjs +2 -2
- package/dist/{local-DPpSEq2_.mjs → local-BVSFSSYf.mjs} +46 -24
- package/dist/{main-CqX7JqzE.mjs → main-B016auoG.mjs} +23 -13
- package/dist/{memory-DzqkXIB-.mjs → memory-C2lzMV_t.mjs} +2 -2
- package/dist/{middleware-ysFm2S4v.mjs → middleware-DUKIITFZ.mjs} +3 -3
- package/dist/{routes-qS92xz8U.mjs → routes-BE0y6wCk.mjs} +9 -9
- package/dist/{schemas-TeVe4Udh.mjs → schemas-CUSTEFIy.mjs} +7 -1
- package/dist/{serve-CYr4RwRM.mjs → serve-B10e7QaY.mjs} +5 -5
- package/dist/{server-V7qyVUiJ.mjs → server-ViWNvg5q.mjs} +58 -28
- package/dist/{serving-BzNxlnDV.mjs → serving-SbqeWqlA.mjs} +1 -1
- package/dist/{shell-BLHZoP-x.mjs → shell-DmpmgOPC.mjs} +1 -1
- package/dist/{sql-DIKQd5Me.mjs → sql-iABdyCiz.mjs} +18 -5
- package/dist/{sqlite-BF9kBDh1.mjs → sqlite-28EMrmk7.mjs} +2 -2
- package/dist/{sqlite-db-CSYwiZ4E.mjs → sqlite-db-Ckd-ceNe.mjs} +1 -1
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.mjs +3 -3
- package/dist/sync-linear.mjs +3 -3
- package/dist/sync-slack.mjs +4 -4
- package/dist/sync.mjs +2 -2
- package/dist/{tags-BpFo6q0_.mjs → tags-D0qra0Qy.mjs} +1 -1
- package/dist/{task-batch-CujTLmTB.mjs → task-batch-9lVDG3d-.mjs} +6 -6
- package/dist/{tokens-BmCDAT4N.mjs → tokens-C-iK0Cku.mjs} +2 -2
- package/dist/{version-BCoWGLEW.mjs → version-C70RLVEK.mjs} +1 -1
- package/docs/01-board/03-identity.md +3 -2
- package/docs/02-sync/01-overview.md +2 -1
- package/docs/03-guides/06-sandboxed-agents.md +22 -21
- package/docs/04-reference/01-cli.md +10 -1
- package/docs/04-reference/02-board.md +6 -4
- package/docs/04-reference/03-http.md +4 -3
- package/package.json +1 -1
- package/dist/inspect-DnRQUmP8.mjs +0 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as formatProfileHeader } from "./profile-header-Cj0Cb1cf.mjs";
|
|
2
|
-
import "./schemas-
|
|
3
|
-
import { Z as routes } from "./routes-
|
|
4
|
-
import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-
|
|
5
|
-
import { g as keyId, p as DERIVED_ID } from "./middleware-
|
|
6
|
-
import { l as METHODS, o as compileWatcher } from "./task-batch-
|
|
7
|
-
import { c as PROTOCOL_ROUTES, d as deployedOnVercel, l as withoutToken, o as createVercel, r as createBoard, u as tailWatchers } from "./exports-
|
|
2
|
+
import "./schemas-CUSTEFIy.mjs";
|
|
3
|
+
import { Z as routes } from "./routes-BE0y6wCk.mjs";
|
|
4
|
+
import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DYF4hhIc.mjs";
|
|
5
|
+
import { g as keyId, p as DERIVED_ID } from "./middleware-DUKIITFZ.mjs";
|
|
6
|
+
import { l as METHODS, o as compileWatcher } from "./task-batch-9lVDG3d-.mjs";
|
|
7
|
+
import { c as PROTOCOL_ROUTES, d as deployedOnVercel, l as withoutToken, o as createVercel, r as createBoard, u as tailWatchers } from "./exports-CuD-Mxkw.mjs";
|
|
8
8
|
import { execFile } from "node:child_process";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
@@ -141,10 +141,11 @@ function handFetch(send) {
|
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
143
|
* A request to Vercel's API as you: through the fetch the CLI that runs board's hands it with its
|
|
144
|
-
* login, which adds its credentials, or with `login` as a Bearer token, through `send`.
|
|
144
|
+
* login, which adds its credentials, or with `login` as a Bearer token, through `send`. A token
|
|
145
|
+
* the run was passed goes as a Bearer token always: the app's fetch would add its own login's.
|
|
145
146
|
*/
|
|
146
147
|
function asYou(input, init, login, send = fetch) {
|
|
147
|
-
if (handedFetch && loginHanded()) return handedFetch(input, init);
|
|
148
|
+
if (passed === null && handedFetch && loginHanded()) return handedFetch(input, init);
|
|
148
149
|
const headers = new Headers(input instanceof Request ? input.headers : void 0);
|
|
149
150
|
new Headers(init.headers).forEach((value, name) => headers.set(name, value));
|
|
150
151
|
headers.set("authorization", `Bearer ${login}`);
|
|
@@ -153,13 +154,28 @@ function asYou(input, init, login, send = fetch) {
|
|
|
153
154
|
headers
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
|
-
/**
|
|
157
|
-
|
|
157
|
+
/** The token someone passed the CLI that runs board's for this run (`vercel board --token`), while there is one. */
|
|
158
|
+
let passed = null;
|
|
159
|
+
/** Where `vb whoami` says a passed token came from. */
|
|
160
|
+
const PASSED = "the token you passed";
|
|
158
161
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
162
|
+
* Hands board the token someone passed the CLI that runs it, as `vercel board --token` does: the
|
|
163
|
+
* Vercel login for this run, ahead of everything the environment holds, a deployment's own token
|
|
164
|
+
* and `BOARD_TOKEN` included. Whoever passed it said who to be, which no variable does. Board
|
|
165
|
+
* sends it itself, as a Bearer token, never through a handed fetch. Null takes it back.
|
|
161
166
|
*/
|
|
162
|
-
|
|
167
|
+
function handToken(token) {
|
|
168
|
+
passed = token;
|
|
169
|
+
}
|
|
170
|
+
/** The token this run was passed, or null. */
|
|
171
|
+
const passedToken = () => passed;
|
|
172
|
+
/** Whether the login is one a CLI handed over (`createApp`'s `token` or `login`, or `VERCEL_AUTH_TOKEN`). */
|
|
173
|
+
const loginHanded = () => passed !== null || handed$1 !== null || !!process.env.VERCEL_AUTH_TOKEN;
|
|
174
|
+
/**
|
|
175
|
+
* Your Vercel login: what the CLI that runs board's hands it, as `vercel board` does (the token
|
|
176
|
+
* it was passed, its `login`, or `VERCEL_AUTH_TOKEN`), or else what `vercel login` saved.
|
|
177
|
+
*/
|
|
178
|
+
const vercelLogin = () => passed !== null ? Promise.resolve(passed) : handed$1 ? handed$1() : process.env.VERCEL_AUTH_TOKEN ? Promise.resolve(process.env.VERCEL_AUTH_TOKEN) : getVercelToken();
|
|
163
179
|
/**
|
|
164
180
|
* A handed login's token, which its tokens for boards are cached by: null for `vercel login`'s own. One
|
|
165
181
|
* that fails fails the request: `vercel login`'s, cached or in the `vercel` on PATH, can be someone
|
|
@@ -265,8 +281,9 @@ function boardUrl() {
|
|
|
265
281
|
}
|
|
266
282
|
/**
|
|
267
283
|
* How a client reaches the board at `url` from Node: through Deployment Protection, with a token
|
|
268
|
-
* from `token`,
|
|
269
|
-
*
|
|
284
|
+
* from `token`, the login a CLI that runs board's was passed (`handToken`), `BOARD_TOKEN`, a local
|
|
285
|
+
* board's token file (`vb serve`), GitHub Actions, the Vercel runtime, or your Vercel CLI login,
|
|
286
|
+
* in that order. Who you are is the token's to say: the board
|
|
270
287
|
* names you from what it verifies. A board with no Vercel project has no token for your login to
|
|
271
288
|
* mint, so a request goes to it with none: what verifies its callers may know you another way, as
|
|
272
289
|
* a board behind `tailscale serve` does.
|
|
@@ -287,6 +304,15 @@ function connect(url, options = {}) {
|
|
|
287
304
|
let cached = null;
|
|
288
305
|
let source = null;
|
|
289
306
|
let person = null;
|
|
307
|
+
/** A token minted with your Vercel login, which `from` names. */
|
|
308
|
+
const asPerson = async (discovered, from) => {
|
|
309
|
+
person ??= personToken(url, discovered).finally(() => {
|
|
310
|
+
person = null;
|
|
311
|
+
});
|
|
312
|
+
const minted = await person;
|
|
313
|
+
source = from;
|
|
314
|
+
return minted;
|
|
315
|
+
};
|
|
290
316
|
const mint = async () => {
|
|
291
317
|
if (options.token !== void 0) {
|
|
292
318
|
const token = typeof options.token === "function" ? await options.token() : options.token;
|
|
@@ -295,6 +321,10 @@ function connect(url, options = {}) {
|
|
|
295
321
|
expiresAt: expiry(token)
|
|
296
322
|
};
|
|
297
323
|
}
|
|
324
|
+
if (passed !== null) {
|
|
325
|
+
const discovered = await discover();
|
|
326
|
+
if (discovered.project_id) return asPerson(discovered, PASSED);
|
|
327
|
+
}
|
|
298
328
|
if (process.env.BOARD_TOKEN) {
|
|
299
329
|
const token = process.env.BOARD_TOKEN;
|
|
300
330
|
source = "BOARD_TOKEN";
|
|
@@ -332,12 +362,7 @@ function connect(url, options = {}) {
|
|
|
332
362
|
token: null,
|
|
333
363
|
expiresAt: Date.now() + 3e5
|
|
334
364
|
};
|
|
335
|
-
|
|
336
|
-
person = null;
|
|
337
|
-
});
|
|
338
|
-
const minted = await person;
|
|
339
|
-
source = "vercel login";
|
|
340
|
-
return minted;
|
|
365
|
+
return asPerson(discovered, "vercel login");
|
|
341
366
|
};
|
|
342
367
|
const token = async () => {
|
|
343
368
|
if (options.token !== void 0 || !cached || cached.expiresAt - 6e4 < Date.now()) cached = await mint();
|
|
@@ -920,12 +945,16 @@ function http(url, options = {}) {
|
|
|
920
945
|
const deployed = () => process.env.VERCEL === "1" || !!process.env.VERCEL_OIDC_TOKEN;
|
|
921
946
|
/** Off a deployment, a credential Vercel's API takes, set for board: what a sandbox or CI passes. */
|
|
922
947
|
const boardToken = () => deployed() ? null : process.env.BOARD_TOKEN || null;
|
|
948
|
+
/** Whether what goes is a Vercel login: a token passed for this run, or with no deployment's token and no `BOARD_TOKEN`, yours. */
|
|
949
|
+
const asLogin = () => passedToken() !== null || !deployed() && !boardToken();
|
|
923
950
|
/**
|
|
924
|
-
* A token Vercel's API takes: this
|
|
925
|
-
* login, the one the CLI that runs
|
|
926
|
-
* your `vercel login`.
|
|
951
|
+
* A token Vercel's API takes: the one this run was passed (`vercel board --token`), or else this
|
|
952
|
+
* deployment's OIDC token, or else `BOARD_TOKEN`, or your Vercel login, the one the CLI that runs
|
|
953
|
+
* board's hands it (`vercel board`'s, or `VERCEL_AUTH_TOKEN`) or your `vercel login`.
|
|
927
954
|
*/
|
|
928
955
|
async function token() {
|
|
956
|
+
const passed = passedToken();
|
|
957
|
+
if (passed !== null) return passed;
|
|
929
958
|
if (deployed()) return getVercelOidcToken();
|
|
930
959
|
const set = boardToken();
|
|
931
960
|
if (set) return set;
|
|
@@ -938,6 +967,7 @@ async function token() {
|
|
|
938
967
|
}
|
|
939
968
|
/** Where `token` comes from, in words: what `vb whoami` says. */
|
|
940
969
|
function credentialSource() {
|
|
970
|
+
if (passedToken() !== null) return PASSED;
|
|
941
971
|
if (deployed()) return "Vercel OIDC";
|
|
942
972
|
if (boardToken()) return "BOARD_TOKEN";
|
|
943
973
|
return loginHanded() ? "the Vercel CLI" : "vercel login";
|
|
@@ -978,7 +1008,7 @@ async function team() {
|
|
|
978
1008
|
const environment = {
|
|
979
1009
|
fetch: () => async (input, init = {}) => {
|
|
980
1010
|
const credential = await token();
|
|
981
|
-
if (
|
|
1011
|
+
if (asLogin()) return asYou(input, init, credential);
|
|
982
1012
|
const headers = new Headers(init.headers);
|
|
983
1013
|
headers.set("authorization", `Bearer ${credential}`);
|
|
984
1014
|
return globalThis.fetch(input, {
|
|
@@ -1010,10 +1040,10 @@ function vercel(options = {}) {
|
|
|
1010
1040
|
function board(options = {}) {
|
|
1011
1041
|
return createBoard(options, {
|
|
1012
1042
|
backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
|
|
1013
|
-
sync: () => import("./engine-
|
|
1014
|
-
serving: () => import("./serving-
|
|
1043
|
+
sync: () => import("./engine-DJZ8Xy_g.mjs"),
|
|
1044
|
+
serving: () => import("./serving-SbqeWqlA.mjs"),
|
|
1015
1045
|
sandbox: (url, token) => sandboxHeaders(url, url, token)
|
|
1016
1046
|
});
|
|
1017
1047
|
}
|
|
1018
1048
|
//#endregion
|
|
1019
|
-
export { vercel as a,
|
|
1049
|
+
export { vercelProjectFile as _, vercel as a, boardUrl as c, environmentProfile as d, handFetch as f, projectDir as g, localTokenFile as h, handTeam as i, configDir as l, handToken as m, credentialSource as n, http as o, handLogin as p, credentialed as r, PASSED as s, board as t, connect as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-
|
|
1
|
+
import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-C-iK0Cku.mjs";
|
|
2
2
|
export { discoveryIdentity, oidcTokens, ownProjectId, ownTeamId };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as externalMessageKey, l as isThreadTarget } from "./external-
|
|
1
|
+
import { A as actorKind, T as TASK_LABEL } from "./schemas-CUSTEFIy.mjs";
|
|
2
|
+
import { c as externalMessageKey, l as isThreadTarget } from "./external-D2jq_DEQ.mjs";
|
|
3
3
|
import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
4
4
|
import { i as mentionTerms } from "./mentions-CnWt9Z5b.mjs";
|
|
5
5
|
import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
|
|
@@ -298,9 +298,12 @@ function foldSync(state, event) {
|
|
|
298
298
|
case "thread.synced": {
|
|
299
299
|
const thread = own(state.threads, event.payload.thread);
|
|
300
300
|
if (!thread) return state;
|
|
301
|
+
const claims = (event.payload.kind ?? (isThreadTarget(event.payload.target) ? "thread" : "channel")) === "thread";
|
|
302
|
+
const owner = claims ? own(state.byExternalThread, event.payload.target) : void 0;
|
|
303
|
+
if (owner !== void 0 && owner !== event.payload.thread) return state;
|
|
301
304
|
addTarget(thread, event.payload.target);
|
|
302
305
|
if (event.payload.kind) setOwn(thread.kinds ??= {}, event.payload.target, event.payload.kind);
|
|
303
|
-
if (
|
|
306
|
+
if (claims) {
|
|
304
307
|
setOwn(thread.external, event.payload.target, event.payload.target);
|
|
305
308
|
setOwn(state.byExternalThread, event.payload.target, event.payload.thread);
|
|
306
309
|
}
|
|
@@ -396,7 +399,11 @@ function syncReads(event) {
|
|
|
396
399
|
thread: null,
|
|
397
400
|
copy: null
|
|
398
401
|
};
|
|
399
|
-
case "thread.synced":
|
|
402
|
+
case "thread.synced": return {
|
|
403
|
+
thread: event.payload.thread,
|
|
404
|
+
copy: null,
|
|
405
|
+
external: event.payload.target
|
|
406
|
+
};
|
|
400
407
|
case "message.synced": return {
|
|
401
408
|
thread: event.payload.thread,
|
|
402
409
|
copy: null
|
|
@@ -437,13 +444,14 @@ function projectSync(before, event) {
|
|
|
437
444
|
if (before.thread) setOwn(state.threads, key, structuredClone(before.thread));
|
|
438
445
|
const reads = syncReads(event);
|
|
439
446
|
if (reads.copy && before.copy) state.copies[reads.copy[0]] = { [reads.copy[1]]: structuredClone(before.copy) };
|
|
447
|
+
if (reads.external !== void 0 && before.owner !== void 0) setOwn(state.byExternalThread, reads.external, before.owner);
|
|
440
448
|
foldSync(state, event);
|
|
441
449
|
const thread = own(state.threads, key);
|
|
442
450
|
if (thread && JSON.stringify(thread) !== JSON.stringify(before.thread)) change.thread = {
|
|
443
451
|
key,
|
|
444
452
|
data: thread
|
|
445
453
|
};
|
|
446
|
-
for (const [external, owner] of Object.entries(state.byExternalThread)) change.externalThreads.push([external, owner]);
|
|
454
|
+
for (const [external, owner] of Object.entries(state.byExternalThread)) if (!(external === reads.external && owner === before.owner)) change.externalThreads.push([external, owner]);
|
|
447
455
|
for (const [message, targets] of Object.entries(state.copies)) for (const [target, copy] of Object.entries(targets)) if (!(reads.copy?.[0] === Number(message) && reads.copy[1] === target && JSON.stringify(copy) === JSON.stringify(before.copy))) change.copies.push([
|
|
448
456
|
Number(message),
|
|
449
457
|
target,
|
|
@@ -696,7 +704,12 @@ function sqlTables(db) {
|
|
|
696
704
|
text: "select data from board_copies where message_id = $1 and target = $2",
|
|
697
705
|
values: [reads.copy[0], clean(reads.copy[1])]
|
|
698
706
|
});
|
|
707
|
+
const [owner] = reads.external === void 0 ? [] : await db.all({
|
|
708
|
+
text: "select thread from board_external_threads where external = $1",
|
|
709
|
+
values: [clean(reads.external)]
|
|
710
|
+
});
|
|
699
711
|
return {
|
|
712
|
+
...owner ? { owner: String(owner.thread) } : {},
|
|
700
713
|
thread: thread ? JSON.parse(String(thread.data)) : void 0,
|
|
701
714
|
copy: copy ? JSON.parse(String(copy.data)) : void 0
|
|
702
715
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as sqlTables } from "./sql-
|
|
1
|
+
import { r as sqlTables } from "./sql-iABdyCiz.mjs";
|
|
2
2
|
import { t as sqlite$1 } from "./store-sqlite-D6fIszST.mjs";
|
|
3
|
-
import { t as sqliteDb } from "./sqlite-db-
|
|
3
|
+
import { t as sqliteDb } from "./sqlite-db-Ckd-ceNe.mjs";
|
|
4
4
|
//#region src/store/sqlite.ts
|
|
5
5
|
/**
|
|
6
6
|
* A local board in one SQLite file, its log and board's tables side by side. It
|
package/dist/sync-chat-sdk.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as eventSchema, p as channels, r as envelope } from "./events-
|
|
2
|
-
import { t as ChatSyncProvider } from "./chat-provider-
|
|
1
|
+
import { i as eventSchema, p as channels, r as envelope } from "./events-BdOCmnZh.mjs";
|
|
2
|
+
import { t as ChatSyncProvider } from "./chat-provider-HJ7y_ipp.mjs";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
//#region src/sync/chat-sdk.ts
|
|
5
5
|
const schemaOf = (platform) => eventSchema(platform, "message");
|
package/dist/sync-github.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as withRoutes, i as eventSchema, m as into, r as envelope } from "./events-
|
|
2
|
-
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-
|
|
3
|
-
import { n as tagOf } from "./tags-
|
|
1
|
+
import { _ as withRoutes, i as eventSchema, m as into, r as envelope } from "./events-BdOCmnZh.mjs";
|
|
2
|
+
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-HJ7y_ipp.mjs";
|
|
3
|
+
import { n as tagOf } from "./tags-D0qra0Qy.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { connectGitHubAdapter } from "@vercel/connect/chat";
|
|
6
6
|
import { createGitHubAdapter } from "@chat-adapter/github";
|
package/dist/sync-linear.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-
|
|
2
|
-
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-
|
|
3
|
-
import { n as tagOf, t as slug } from "./tags-
|
|
1
|
+
import { i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-BdOCmnZh.mjs";
|
|
2
|
+
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-HJ7y_ipp.mjs";
|
|
3
|
+
import { n as tagOf, t as slug } from "./tags-D0qra0Qy.mjs";
|
|
4
4
|
import "zod";
|
|
5
5
|
import { connectLinearAdapter } from "@vercel/connect/chat";
|
|
6
6
|
import { createLinearAdapter } from "@chat-adapter/linear";
|
package/dist/sync-slack.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { m as MESSAGE_TEXT_MAX } from "./schemas-
|
|
2
|
-
import "./external-
|
|
1
|
+
import { m as MESSAGE_TEXT_MAX } from "./schemas-CUSTEFIy.mjs";
|
|
2
|
+
import "./external-D2jq_DEQ.mjs";
|
|
3
3
|
import { t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
|
|
4
|
-
import { d as opensBlock, i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-
|
|
5
|
-
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-
|
|
4
|
+
import { d as opensBlock, i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-BdOCmnZh.mjs";
|
|
5
|
+
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-HJ7y_ipp.mjs";
|
|
6
6
|
import { r as formatVercelDeployments } from "./bots-CqPYxkqK.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { stringifyMarkdown } from "chat";
|
package/dist/sync.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as ExternalEvent } from "./external-
|
|
2
|
-
import { c as SyncProvider, g as render, h as mirror, i as eventSchema, l as UnreadableError, m as into, n as SyncOverrides, o as ReceivedEvent, p as channels, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-
|
|
1
|
+
import { n as ExternalEvent } from "./external-D2jq_DEQ.mjs";
|
|
2
|
+
import { c as SyncProvider, g as render, h as mirror, i as eventSchema, l as UnreadableError, m as into, n as SyncOverrides, o as ReceivedEvent, p as channels, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-BdOCmnZh.mjs";
|
|
3
3
|
export { EventBase, ExternalEvent, ReceivedEvent, ResolvedTarget, SyncOverrides, SyncProvider, UnreadableError, channels, envelope, eventSchema, into, mirror, render };
|
|
@@ -8,7 +8,7 @@ const slug = (name) => name.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").to
|
|
|
8
8
|
*/
|
|
9
9
|
function tagOf(prefix, name) {
|
|
10
10
|
const key = name ? slug(name) : "";
|
|
11
|
-
return key ? [`${prefix}.${key}`.slice(0, 64), name.slice(0, 256)] : null;
|
|
11
|
+
return key ? [`${prefix}.${key}`.slice(0, 64), name.replace(/\p{Cc}/gu, "").slice(0, 256)] : null;
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
14
|
export { tagOf as n, slug as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { i as ATTACHMENT_BYTES_MAX } from "./profile-header-Cj0Cb1cf.mjs";
|
|
2
|
-
import "./schemas-
|
|
3
|
-
import { l as isThreadTarget } from "./external-
|
|
4
|
-
import { Z as routes, v as Filters } from "./routes-
|
|
5
|
-
import { r as badRequest, t as HttpError } from "./errors-
|
|
6
|
-
import { i as afterRetry } from "./middleware-
|
|
7
|
-
import { t as VERSION } from "./version-
|
|
2
|
+
import "./schemas-CUSTEFIy.mjs";
|
|
3
|
+
import { l as isThreadTarget } from "./external-D2jq_DEQ.mjs";
|
|
4
|
+
import { Z as routes, v as Filters } from "./routes-BE0y6wCk.mjs";
|
|
5
|
+
import { r as badRequest, t as HttpError } from "./errors-DYF4hhIc.mjs";
|
|
6
|
+
import { i as afterRetry } from "./middleware-DUKIITFZ.mjs";
|
|
7
|
+
import { t as VERSION } from "./version-C70RLVEK.mjs";
|
|
8
8
|
import { o as options } from "./commands-nN8WpvCe.mjs";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
//#region src/server/backend.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as unauthorized } from "./errors-
|
|
2
|
-
import { _ as markVerified, a as TOKENS, h as issuerName, o as VERCEL_ISSUER, x as trustedIssuers, y as privateHost } from "./auth-
|
|
1
|
+
import { d as unauthorized } from "./errors-DYF4hhIc.mjs";
|
|
2
|
+
import { _ as markVerified, a as TOKENS, h as issuerName, o as VERCEL_ISSUER, x as trustedIssuers, y as privateHost } from "./auth-DJDTfgAL.mjs";
|
|
3
3
|
import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
|
|
4
4
|
//#region src/server/identity.ts
|
|
5
5
|
let fromDisk;
|
|
@@ -285,8 +285,9 @@ warning: @nobody names no one here: it stays text, and mentions no one.
|
|
|
285
285
|
- **A handle is settled when you write.** `@ada` and `@julian/claude` name
|
|
286
286
|
whoever has that handle in full, among the actors you can see. When that's
|
|
287
287
|
exactly one, the board stores `@[their-id]` in its place, and the answer
|
|
288
|
-
says who. Of several,
|
|
289
|
-
|
|
288
|
+
says who. Of several, one on the board wins over platform users (a synced
|
|
289
|
+
user's handle is their display name, theirs to set); else it's the one who
|
|
290
|
+
wrote in the thread, if exactly one did.
|
|
290
291
|
- **A handle that names no one stays text.** No one has it, several do, or
|
|
291
292
|
someone has it only under a name (`@malte` isn't `support/malte`): it's kept
|
|
292
293
|
as typed, a mention of no one, and the answer says so, with who it could
|
|
@@ -171,7 +171,8 @@ like any message on the board, but never goes back through the key it came by.
|
|
|
171
171
|
|
|
172
172
|
Within a project, one deployment holds each key, so a message never goes out
|
|
173
173
|
twice. Production takes a key over from the project's previews and development;
|
|
174
|
-
otherwise the first deployment to register a key keeps it
|
|
174
|
+
otherwise the first deployment to register a key keeps it, though a preview
|
|
175
|
+
never takes a key the project's production held. A deployment that
|
|
175
176
|
doesn't hold a key runs nothing through it: its webhook for that key answers 200
|
|
176
177
|
before its adapter reads anything, and it pulls, imports, starts, and delivers
|
|
177
178
|
nothing there.
|
|
@@ -7,10 +7,11 @@ description: A Vercel Sandbox network policy that gives an agent in a sandbox th
|
|
|
7
7
|
|
|
8
8
|
An agent in a [Vercel Sandbox](https://vercel.com/docs/vercel-sandbox) runs code
|
|
9
9
|
you don't trust with credentials. `sandboxPolicy()` returns a network policy for
|
|
10
|
-
it
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
it, and the environment `vb` in the sandbox runs with: the sandbox reaches the
|
|
11
|
+
board's host, and on it only the board's own routes, and the sandbox's proxy
|
|
12
|
+
adds what they need on the way out. The credential, who the agent is, and what
|
|
13
|
+
it may do never enter the sandbox, so nothing in it can read them, change them,
|
|
14
|
+
or take them anywhere else.
|
|
14
15
|
|
|
15
16
|
```ts lib/fixer.ts
|
|
16
17
|
import { board } from '@vercel/board'
|
|
@@ -21,18 +22,13 @@ const team = board()
|
|
|
21
22
|
const fixer = team.as({ name: 'fixer', avatar: 'https://example.com/fixer.png' })
|
|
22
23
|
|
|
23
24
|
/** The board, as the fixer, and npm to install vb with. Every other host is blocked. */
|
|
24
|
-
async function
|
|
25
|
-
const { allow } = await fixer.sandboxPolicy()
|
|
26
|
-
return { allow: { ...allow, 'registry.npmjs.org': [] } }
|
|
25
|
+
async function policy() {
|
|
26
|
+
const { allow, env } = await fixer.sandboxPolicy()
|
|
27
|
+
return { networkPolicy: { allow: { ...allow, 'registry.npmjs.org': [] } }, env }
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export async function startFixer(thread: string) {
|
|
30
|
-
const
|
|
31
|
-
const sandbox = await Sandbox.create({
|
|
32
|
-
networkPolicy: await networkPolicy(),
|
|
33
|
-
// vb needs a credential to send in BOARD_TOKEN; the policy replaces it on the way out.
|
|
34
|
-
env: { BOARD_URL: url, BOARD_TOKEN: 'set-by-the-network-policy' },
|
|
35
|
-
})
|
|
31
|
+
const sandbox = await Sandbox.create(await policy())
|
|
36
32
|
await sandbox.runCommand('npm', ['install', '-g', '@vercel/board'])
|
|
37
33
|
await sandbox.runCommand('vb', ['reply', thread, 'looking into it'])
|
|
38
34
|
// const agent = await startYourAgent(sandbox) // yours
|
|
@@ -41,11 +37,16 @@ export async function startFixer(thread: string) {
|
|
|
41
37
|
|
|
42
38
|
/** A new policy, before the deployment's OIDC token in the last one dies. */
|
|
43
39
|
export async function refresh(sandbox: Sandbox) {
|
|
44
|
-
|
|
40
|
+
const { networkPolicy } = await policy()
|
|
41
|
+
await sandbox.update({ networkPolicy })
|
|
45
42
|
}
|
|
46
43
|
```
|
|
47
44
|
|
|
48
|
-
`sandboxPolicy()` is async and
|
|
45
|
+
`sandboxPolicy()` is async, and returns `{ allow, env }`: `allow` is the
|
|
46
|
+
network policy's hosts, which `networkPolicy: { allow }` takes, and `env` is
|
|
47
|
+
`BOARD_URL`, the board's, and `BOARD_TOKEN`, a placeholder for `vb` to send,
|
|
48
|
+
which the policy replaces with the credential on the way out. Pass `allow` in
|
|
49
|
+
`networkPolicy`, not the whole result. It takes:
|
|
49
50
|
|
|
50
51
|
| Option | Does |
|
|
51
52
|
| --- | --- |
|
|
@@ -121,7 +122,7 @@ Vercel Sandbox sends it as it is. Nothing in the sandbox can renew it.
|
|
|
121
122
|
(`decodeJwt(token).exp` from `jose`, in seconds), or make a new policy on a
|
|
122
123
|
schedule, and `sandbox.update({ networkPolicy })` before it expires: 15
|
|
123
124
|
minutes ahead leaves room. Every update replaces the whole policy, so merge
|
|
124
|
-
your own hosts in again, as `
|
|
125
|
+
your own hosts in again, as `policy()` above does.
|
|
125
126
|
- **A sandbox that stopped** resumes with the policy it saved, its token
|
|
126
127
|
included: update it each time you resume one.
|
|
127
128
|
- **A credential you pass** as `token` lasts as long as it does: refresh the
|
|
@@ -136,8 +137,8 @@ Vercel Sandbox sends it as it is. Nothing in the sandbox can renew it.
|
|
|
136
137
|
From the handle: `sandboxPolicy()` on the team's board in Vercel's API uses the
|
|
137
138
|
board's ID and team; on a board at `BOARD_URL`, that URL; on a board you mount
|
|
138
139
|
with [`local()`](../01-board/10-local.md), its own, which `board({ url })` names
|
|
139
|
-
off Vercel. `
|
|
140
|
-
`
|
|
140
|
+
off Vercel. Its `env` has it as the sandbox's `BOARD_URL`, the same URL
|
|
141
|
+
`team.discovery()` answers.
|
|
141
142
|
|
|
142
143
|
### Can the agent upload files?
|
|
143
144
|
|
|
@@ -146,6 +147,6 @@ store, on a URL the board signs: add that store's host beside `allow`.
|
|
|
146
147
|
|
|
147
148
|
### Does it work without `@vercel/sandbox`?
|
|
148
149
|
|
|
149
|
-
It returns
|
|
150
|
-
`sandbox.update({ networkPolicy })` take
|
|
151
|
-
Any proxy that reads the same shape can run it.
|
|
150
|
+
It returns plain objects, an `allow` that `Sandbox.create({ networkPolicy })`
|
|
151
|
+
and `sandbox.update({ networkPolicy })` take and an `env` of strings, and
|
|
152
|
+
depends on nothing of the SDK's. Any proxy that reads the same shape can run it.
|
|
@@ -57,9 +57,18 @@ const code = await createApp({
|
|
|
57
57
|
// How requests to Vercel's API go with that login: the app's own fetch, which adds the login's
|
|
58
58
|
// credentials. Without it, the login goes as a Bearer token, which a DPoP login can't use.
|
|
59
59
|
// fetch: (input, init) => yourSignedFetch(input, init), // a DPoP proof for each request
|
|
60
|
+
// A Vercel token someone passed for this run, as `vercel board --token` takes one: the login to
|
|
61
|
+
// use in place of `login`, ahead of everything the environment holds, a deployment's own token
|
|
62
|
+
// and BOARD_TOKEN included. Board sends it itself, as a Bearer token, never through `fetch`. A
|
|
63
|
+
// board at a URL gets a token minted with it, never the token itself.
|
|
64
|
+
// token: yourFlags.token,
|
|
60
65
|
}).run(process.argv.slice(3))
|
|
61
66
|
```
|
|
62
67
|
|
|
68
|
+
A variable never goes ahead of a deployment's own token, so a token in the
|
|
69
|
+
environment is not one to pass here: pass only what the person typed for this
|
|
70
|
+
run. [`whoami`](#whoami) names it as its source, `the token you passed`.
|
|
71
|
+
|
|
63
72
|
`class` fixes the exit code: `usage` and `missing_input` answer 2,
|
|
64
73
|
`canceled` 130, and the rest 1, `timeout` included. Without `onError`, board
|
|
65
74
|
prints its own on stderr: `error: ` and the lines, or with `--json`, its
|
|
@@ -929,7 +938,7 @@ vb label <id> k=v... [--unset k]... [--if k=v]... [--if-unset k]...
|
|
|
929
938
|
|
|
930
939
|
Sets and unsets labels. Each key holds one value. Keys match
|
|
931
940
|
`[a-z0-9][a-z0-9_.-]*` (up to 64 characters), other than `constructor` and
|
|
932
|
-
`prototype`; values are up to 256 characters. `vb label` refuses `k=`, a label
|
|
941
|
+
`prototype`; values are up to 256 characters, with no control characters. `vb label` refuses `k=`, a label
|
|
933
942
|
with no value, which would still count as set: `--unset k` removes a label.
|
|
934
943
|
`--if k=v` changes them only
|
|
935
944
|
while the message has that label, and `--if-unset k` only while it has none
|
|
@@ -100,8 +100,10 @@ sandboxPolicy(options?: { profile?: { name: string; avatar?: string }; can?: Can
|
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
A Vercel Sandbox network policy that hands this board, and nothing else, to a
|
|
103
|
-
sandboxed agent
|
|
104
|
-
`allow` beside your own hosts merges them
|
|
103
|
+
sandboxed agent, and the environment for it: `{ allow, env }`. Spreading
|
|
104
|
+
`allow` beside your own hosts merges them into `networkPolicy`, and `env` is
|
|
105
|
+
the sandbox's `BOARD_URL` and a placeholder `BOARD_TOKEN`, which the policy
|
|
106
|
+
replaces with the credential on the way out. Its proxy adds the credential
|
|
105
107
|
(`token`, or this deployment's own OIDC token), the profile (`profile`, or this
|
|
106
108
|
handle's from `as()`: one or the other, or it fails with `invalid_profile`), and
|
|
107
109
|
`x-board-can` (`can`, or read, post, react, and label everywhere) to the
|
|
@@ -112,8 +114,8 @@ other. See [Hand a board to a sandboxed agent](../03-guides/06-sandboxed-agents.
|
|
|
112
114
|
import { board } from '@vercel/board'
|
|
113
115
|
|
|
114
116
|
const team = board()
|
|
115
|
-
const { allow } = await team.as('fixer').sandboxPolicy()
|
|
116
|
-
// await Sandbox.create({ networkPolicy: { allow: { ...allow, 'registry.npmjs.org': [] } } }) // yours
|
|
117
|
+
const { allow, env } = await team.as('fixer').sandboxPolicy()
|
|
118
|
+
// await Sandbox.create({ networkPolicy: { allow: { ...allow, 'registry.npmjs.org': [] } }, env }) // yours
|
|
117
119
|
```
|
|
118
120
|
|
|
119
121
|
### fetch
|
|
@@ -294,8 +294,9 @@ what became of each handle, when the text typed any:
|
|
|
294
294
|
|
|
295
295
|
With `actor: null` the handle stayed text, a mention of no one. `candidates`
|
|
296
296
|
is who it could have meant: the several who have that handle, or for a handle
|
|
297
|
-
with no `/`, whoever has it under a name. Of several,
|
|
298
|
-
|
|
297
|
+
with no `/`, whoever has it under a name. Of several, one on the board is
|
|
298
|
+
taken over platform users, and else the one who wrote in the thread, if
|
|
299
|
+
exactly one did. `POST /messages/:id/edit`, `/schedules`,
|
|
299
300
|
`/tasks`, and `/tasks/batch` settle their text and answer `mentions` the same
|
|
300
301
|
way. See [Mentions](../01-board/03-identity.md#mentions).
|
|
301
302
|
|
|
@@ -779,7 +780,7 @@ Values follow these rules:
|
|
|
779
780
|
| --- | --- |
|
|
780
781
|
| Channel path | segments matching `[a-z0-9][a-z0-9_-]*`, joined by `/`, up to 2048 characters |
|
|
781
782
|
| Label key | `[a-z0-9][a-z0-9_.-]*`, up to 64 characters, other than `constructor` and `prototype`. Keys under `board.` are the board's own: no write sets one |
|
|
782
|
-
| Label value | a string up to 256 characters; each key holds one value |
|
|
783
|
+
| Label value | a string up to 256 characters, with no control characters (a write that sets one is a 400); each key holds one value |
|
|
783
784
|
| Emoji | a normalized short name matching `[a-z0-9_+-]+`, as Chat SDK names them, other than `constructor`, `__proto__`, and `prototype` |
|
|
784
785
|
| Actor ID | `principal` or `principal+profile`: `vercel:user:u_abc123+claude` |
|
|
785
786
|
| External target | prefixed with its sync key: `slack:C0123ABC` (a channel), `slack:C0123ABC:1727.1234` (a thread), `github:owner/repo:12` |
|
package/package.json
CHANGED