@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
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ export BOARD_URL=http://127.0.0.1:4100/api/board # in the terminals your agent
|
|
|
47
47
|
|
|
48
48
|
It keeps its log (SQLite) and attachments in the project's `.board/`, across
|
|
49
49
|
restarts, runs its timers in its own process, and has no sync. You're
|
|
50
|
-
`local:user:<your OS user
|
|
50
|
+
`local:user:<your OS user>`, and `vb` pointed at
|
|
51
51
|
it, agents included, finds its token on its own: the token lives in a file
|
|
52
52
|
only you can read, for as long as the board runs.
|
|
53
53
|
|
|
@@ -105,11 +105,13 @@ sync: {
|
|
|
105
105
|
}
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
Board messages post
|
|
109
|
-
|
|
108
|
+
Board messages post to Slack under their author's name (`Julián Benegas`,
|
|
109
|
+
`claude via julian`) when the app has `chat:write.customize` and the board
|
|
110
|
+
verified who they are: always on Vercel's board. Your Slack account
|
|
111
|
+
is an actor of its own, and a Slack ping comes in as your Slack handle:
|
|
110
112
|
|
|
111
113
|
```bash
|
|
112
|
-
vb tail --mentions julian
|
|
114
|
+
vb tail --mentions @julian # pings of whoever goes by julian, on Slack or the board
|
|
113
115
|
```
|
|
114
116
|
|
|
115
117
|
## Customize sync
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as forbidden } from "./errors-
|
|
2
|
-
import { a as CAN_MAX, o as ChannelPath } from "./schemas-
|
|
1
|
+
import { a as forbidden } from "./errors-DcQf5WeM.mjs";
|
|
2
|
+
import { a as CAN_MAX, o as ChannelPath } from "./schemas-DAzSsgWk.mjs";
|
|
3
3
|
//#region src/server/access.ts
|
|
4
4
|
/**
|
|
5
5
|
* What a principal may do in a channel. `read` covers messages, threads,
|
package/dist/access.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $t as
|
|
2
|
-
import { _ as
|
|
1
|
+
import { $t as union, Bt as ChannelPattern, Gt as GrantShape, Ht as Grant, Jt as Permission, Kt as InvalidCan, Lt as Access, Qt as parseCan, Rt as AccessSummary, Ut as GrantChange, Vt as FULL_ACCESS, Wt as GrantChangeRefusal, Xt as checkGrantChange, Zt as compileAccess, en as Actor, in as CAN_MAX, rn as Author, zt as Can } from "./routes-By9lmvUD.mjs";
|
|
2
|
+
import { _ as GrantFacts, a as DEFAULT_CAN, b as grantAccess, c as IssuerConfig, d as Principal, f as PrincipalKind, g as GrantExplanation, h as DecidingGrant, i as Claims, l as Known, m as Caller, n as AuthenticateContext, r as CallerRequest, s as HostPrincipal, t as Authenticate, u as OidcTokensOptions, v as GrantSource, y as explainGrants } from "./auth-Bn8J_1F2.mjs";
|
|
3
3
|
//#region src/server/tokens.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The OIDC tokens made out to this board: a request's bearer token, from Vercel (people and
|
|
@@ -19,10 +19,10 @@ type ResolvedActor = {
|
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* The actor a caller writes as: its principal, plus the profile it claims (`vercel:user:u_123+claude`).
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Its handle and name are what verified its principal said: a host's verifier's handle, a Vercel
|
|
23
|
+
* login's user ID, a deployment's project (named with its environment outside production,
|
|
24
|
+
* `support (preview)`). A profile's name and avatar are the ones it sends, under that handle.
|
|
25
25
|
*/
|
|
26
|
-
export declare function resolveActor(principal: Principal, claims: Claims
|
|
26
|
+
export declare function resolveActor(principal: Principal, claims: Claims): ResolvedActor;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { type Access, type AccessSummary, type Authenticate, type AuthenticateContext, CAN_MAX, type Caller, type CallerRequest, type Can, type ChannelPattern, type Claims, DEFAULT_CAN, type DecidingGrant, FULL_ACCESS, type Grant, type GrantChange, type GrantChangeRefusal, type GrantExplanation, type GrantFacts, type GrantShape, type GrantSource, type HostPrincipal, InvalidCan, type IssuerConfig, type Known, type OidcTokensOptions, type Permission, type Principal, type PrincipalKind, checkGrantChange, compileAccess, explainGrants, grantAccess, parseCan, union };
|
package/dist/access.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as CAN_MAX } from "./schemas-
|
|
2
|
-
import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as oidcTokens } from "./tokens-
|
|
1
|
+
import { a as CAN_MAX } from "./schemas-DAzSsgWk.mjs";
|
|
2
|
+
import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-C5HaO42b.mjs";
|
|
3
|
+
import { C as explainGrants, t as DEFAULT_CAN, w as grantAccess } from "./auth-DAlYi6TN.mjs";
|
|
4
|
+
import { a as resolveActor } from "./actors-nrOf7Y7z.mjs";
|
|
5
|
+
import { t as oidcTokens } from "./tokens-D7_ZIWpX.mjs";
|
|
6
6
|
export { CAN_MAX, DEFAULT_CAN, FULL_ACCESS, InvalidCan, checkGrantChange, compileAccess, explainGrants, grantAccess, oidcTokens, parseCan, resolveActor, union };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { m as parseProfileHeader, r as badRequest } from "./errors-DcQf5WeM.mjs";
|
|
2
|
+
import { x as toStorable } from "./schemas-DAzSsgWk.mjs";
|
|
3
|
+
import { u as parseCan } from "./access-C5HaO42b.mjs";
|
|
4
|
+
import { t as own } from "./own-OwgPWdmh.mjs";
|
|
5
|
+
//#region src/server/actors.ts
|
|
6
|
+
/** Agents whose marks the board serves at `/avatars/<name>`, for a caller to pass as an avatar. */
|
|
7
|
+
const KNOWN_AGENTS = [
|
|
8
|
+
"fx",
|
|
9
|
+
"claude",
|
|
10
|
+
"codex",
|
|
11
|
+
"grok",
|
|
12
|
+
"pi"
|
|
13
|
+
];
|
|
14
|
+
const PROFILE = /^[A-Za-z][A-Za-z0-9-]{0,31}$/;
|
|
15
|
+
/**
|
|
16
|
+
* What a request's headers say about its caller, checked for shape: a 400 for one that's
|
|
17
|
+
* malformed. None of it is verified; board() works out the actor from it once it knows who the
|
|
18
|
+
* credential is.
|
|
19
|
+
*/
|
|
20
|
+
function claimsOf(headers) {
|
|
21
|
+
const { profile, avatar } = profileOf(headers.get("x-board-profile"));
|
|
22
|
+
if (headers.get("x-board-scope") !== null) throw badRequest("x-board-scope is x-board-can now: send the same value as x-board-can", "invalid_scope");
|
|
23
|
+
const scope = headers.get("x-board-can");
|
|
24
|
+
if (scope !== null) try {
|
|
25
|
+
parseCan(scope);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
throw badRequest(error.message, "invalid_scope");
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
profile,
|
|
31
|
+
avatar,
|
|
32
|
+
scope
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** `x-board-profile`'s profile and avatar, checked: a 400 for a header that isn't one. */
|
|
36
|
+
function profileOf(header) {
|
|
37
|
+
if (header === null || header.trim() === "") return {
|
|
38
|
+
profile: null,
|
|
39
|
+
avatar: null
|
|
40
|
+
};
|
|
41
|
+
let parsed;
|
|
42
|
+
try {
|
|
43
|
+
parsed = parseProfileHeader(header);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
throw badRequest(error.message, "invalid_profile");
|
|
46
|
+
}
|
|
47
|
+
if (!PROFILE.test(parsed.name)) throw badRequest("profile names start with a letter and use up to 32 letters, numbers, and hyphens", "invalid_profile");
|
|
48
|
+
if (parsed.avatar !== null && !isAvatarUrl(parsed.avatar)) throw badRequest("avatars must be https URLs (http only on localhost)", "invalid_profile");
|
|
49
|
+
return {
|
|
50
|
+
profile: parsed.name,
|
|
51
|
+
avatar: parsed.avatar
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The actor a caller writes as: its principal, plus the profile it claims (`vercel:user:u_123+claude`).
|
|
56
|
+
* Its handle and name are what verified its principal said: a host's verifier's handle, a Vercel
|
|
57
|
+
* login's user ID, a deployment's project (named with its environment outside production,
|
|
58
|
+
* `support (preview)`). A profile's name and avatar are the ones it sends, under that handle.
|
|
59
|
+
*/
|
|
60
|
+
function resolveActor(principal, claims) {
|
|
61
|
+
const profile = claims.profile?.toLowerCase() ?? null;
|
|
62
|
+
const id = profile === null ? principal.id : `${principal.id}+${profile}`;
|
|
63
|
+
const via = viaOf(principal);
|
|
64
|
+
const actor = {
|
|
65
|
+
id,
|
|
66
|
+
kind: profile === null ? principal.kind : "agent",
|
|
67
|
+
handle: profile === null ? principal.handle : `${principal.handle}/${profile}`,
|
|
68
|
+
name: claims.profile ?? (via.environment !== null && via.environment !== "production" ? `${via.name} (${via.environment})` : principal.handle),
|
|
69
|
+
avatar: claims.avatar,
|
|
70
|
+
...profile === null ? {} : { via }
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
author: {
|
|
74
|
+
actor: id,
|
|
75
|
+
principal: principal.id,
|
|
76
|
+
profile
|
|
77
|
+
},
|
|
78
|
+
actor
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The actor `author` writes as, shown as its principal names it now: a stored one (a schedule's
|
|
83
|
+
* creator) whose handle, name, or picture a client sent, before they were checked, shows as its
|
|
84
|
+
* principal does instead. A profile keeps its spelling and its avatar, which are its own to choose; a
|
|
85
|
+
* platform user, whom its sync names, stays as it is.
|
|
86
|
+
*/
|
|
87
|
+
function ownedActor(principal, author, actor) {
|
|
88
|
+
if (principal.kind === "external" || principal.id.startsWith("board:")) return actor;
|
|
89
|
+
const profile = author.profile === null ? null : actor.name.toLowerCase() === author.profile ? actor.name : author.profile;
|
|
90
|
+
const { actor: named } = resolveActor(principal, {
|
|
91
|
+
profile,
|
|
92
|
+
avatar: profile === null ? null : actor.avatar,
|
|
93
|
+
scope: null
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
...actor,
|
|
97
|
+
handle: named.handle,
|
|
98
|
+
name: named.name,
|
|
99
|
+
avatar: named.avatar,
|
|
100
|
+
...named.via ? { via: named.via } : {}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Who a profile of `principal` acts through, as the board shows it: a deployment by its project's name
|
|
105
|
+
* and its environment, anyone else by their handle. A deployment's handle is its project's name in
|
|
106
|
+
* every environment; one a board stored with its environment after it (`www@preview`) still shows as `www`.
|
|
107
|
+
*/
|
|
108
|
+
function viaOf(principal) {
|
|
109
|
+
const environment = /^vercel:project:[^:]+:([^:]+)$/.exec(principal.id)?.[1] ?? null;
|
|
110
|
+
const suffix = `@${environment}`;
|
|
111
|
+
return {
|
|
112
|
+
name: environment !== null && principal.handle.endsWith(suffix) && principal.handle.length > suffix.length ? principal.handle.slice(0, -suffix.length) : principal.handle,
|
|
113
|
+
environment
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function isAvatarUrl(value) {
|
|
117
|
+
try {
|
|
118
|
+
const url = new URL(value);
|
|
119
|
+
return url.protocol === "https:" || url.protocol === "http:" && ["localhost", "127.0.0.1"].includes(url.hostname);
|
|
120
|
+
} catch {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* An `actor.seen` event, or null when the board already knows these details. `host`: the actor is
|
|
126
|
+
* a host's principal or one of its profiles, which the board records once. `seen.verified`: this
|
|
127
|
+
* write's credential named it as shown, which each write says anew.
|
|
128
|
+
*/
|
|
129
|
+
function actorSeen(seen, known, host = false) {
|
|
130
|
+
const existing = own(known.byId, seen.id);
|
|
131
|
+
const avatar = seen.kind === "external" && seen.avatar === null ? { avatar: existing?.avatar ?? null } : {};
|
|
132
|
+
const via = seen.via === void 0 && existing?.via ? { via: existing.via } : {};
|
|
133
|
+
const platform = seen.platform === void 0 && existing?.platform ? { platform: existing.platform } : {};
|
|
134
|
+
const actor = {
|
|
135
|
+
...seen,
|
|
136
|
+
...avatar,
|
|
137
|
+
...via,
|
|
138
|
+
...platform
|
|
139
|
+
};
|
|
140
|
+
if (existing && existing.kind === actor.kind && existing.handle === actor.handle && existing.name === actor.name && existing.avatar === actor.avatar && existing.via?.name === actor.via?.name && existing.via?.environment === actor.via?.environment && existing.platform === actor.platform && existing.verified === actor.verified && (!host || existing.host)) return null;
|
|
141
|
+
return {
|
|
142
|
+
type: "actor.seen",
|
|
143
|
+
payload: {
|
|
144
|
+
actor: actor.id,
|
|
145
|
+
kind: actor.kind,
|
|
146
|
+
handle: toStorable(actor.handle),
|
|
147
|
+
name: toStorable(actor.name),
|
|
148
|
+
avatar: actor.avatar,
|
|
149
|
+
...actor.via ? { via: {
|
|
150
|
+
name: toStorable(actor.via.name),
|
|
151
|
+
environment: actor.via.environment
|
|
152
|
+
} } : {},
|
|
153
|
+
...actor.platform ? { platform: actor.platform } : {},
|
|
154
|
+
...host ? { host: true } : {},
|
|
155
|
+
...actor.verified ? { verified: true } : {}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
export { resolveActor as a, ownedActor as i, actorSeen as n, viaOf as o, claimsOf as r, KNOWN_AGENTS as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Jt as Permission, Lt as Access, Yt as WrittenCan, qt as Level, zt as Can } from "./routes-By9lmvUD.mjs";
|
|
2
2
|
import { JWTVerifyGetKey } from "jose";
|
|
3
3
|
//#region src/server/grants.d.ts
|
|
4
4
|
/** Who asks, as a verified token says, in the terms grants name them by. */
|
|
@@ -92,13 +92,8 @@ declare function explainGrants<G extends DecidingGrant>(facts: GrantFacts<G>, ch
|
|
|
92
92
|
type Claims = {
|
|
93
93
|
/** `x-board-profile`: the agent or tool it writes as, `claude`, say. */
|
|
94
94
|
profile: string | null;
|
|
95
|
-
/** `x-board-
|
|
95
|
+
/** The `avatar` parameter of `x-board-profile`: an https URL for its picture. */
|
|
96
96
|
avatar: string | null;
|
|
97
|
-
/** `x-board-session`: the agent session it writes from. */
|
|
98
|
-
session: string | null;
|
|
99
|
-
/** `x-board-handle` and `x-board-name`: a person's handle and display name. */
|
|
100
|
-
handle: string | null;
|
|
101
|
-
name: string | null;
|
|
102
97
|
/** `x-board-can`: what it narrows itself to, `dev/=read,post`. It only narrows. */
|
|
103
98
|
scope: string | null;
|
|
104
99
|
};
|
|
@@ -122,29 +117,13 @@ type Principal = {
|
|
|
122
117
|
/** `vercel:user:<id>`, `vercel:project:<id>:<env>`, `github:repo:<id>`, `oidc:<issuer>:<sub>`. */
|
|
123
118
|
id: string;
|
|
124
119
|
kind: PrincipalKind;
|
|
125
|
-
/**
|
|
120
|
+
/** Its handle, as what verified it says: a host's verifier's, a Vercel login's user ID, a deployment's project. */
|
|
126
121
|
handle: string;
|
|
127
122
|
expiresAt: Date | null;
|
|
128
123
|
/** The verified token's claims, so its access can be worked out again later, as a schedule's sends do. Absent for people and the board's own code. */
|
|
129
124
|
facts?: TokenFacts;
|
|
130
125
|
/** The `x-board-can` a proxy sent, which narrows whatever it may do. */
|
|
131
126
|
scope?: string;
|
|
132
|
-
/**
|
|
133
|
-
* The board token it came with (its ID), kept with what it stores: a schedule or a registration
|
|
134
|
-
* made with one stops when the token does.
|
|
135
|
-
*/
|
|
136
|
-
token?: string;
|
|
137
|
-
/** What a board token pins for every request with it: the profile, avatar, and session it writes as, and a person's handle and name. */
|
|
138
|
-
pinned?: Pinned;
|
|
139
|
-
};
|
|
140
|
-
/** What a board token says about who writes, beside its principal: labels, but the board's, so a request can't change them. */
|
|
141
|
-
type Pinned = {
|
|
142
|
-
profile: string | null;
|
|
143
|
-
avatar: string | null;
|
|
144
|
-
session: string | null;
|
|
145
|
-
/** A person's handle and display name as they were when they minted it: whoever holds the token sends none. */
|
|
146
|
-
handle: string | null;
|
|
147
|
-
name: string | null;
|
|
148
127
|
};
|
|
149
128
|
/** A principal and what it may do in each channel, as board()'s `access` worked it out. */
|
|
150
129
|
type Granted = Principal & {
|
|
@@ -179,8 +158,11 @@ type OidcTokensOptions = {
|
|
|
179
158
|
jwks: JWTVerifyGetKey;
|
|
180
159
|
};
|
|
181
160
|
};
|
|
182
|
-
/** A principal as the board keeps it to work its access out again: who it is, its token's facts, its scope
|
|
183
|
-
type Known = Pick<Principal, 'id' | 'kind' | 'handle' | 'facts' | 'scope'
|
|
161
|
+
/** A principal as the board keeps it to work its access out again: who it is, its token's facts, and its scope. */
|
|
162
|
+
type Known = Pick<Principal, 'id' | 'kind' | 'handle' | 'facts' | 'scope'> & {
|
|
163
|
+
/** The board token a schedule was made with, from when boards issued them: it stopped with them. */
|
|
164
|
+
token?: string;
|
|
165
|
+
};
|
|
184
166
|
/**
|
|
185
167
|
* Who a grant names, as the board keeps it: IDs, with the names it knows beside them. A board
|
|
186
168
|
* that verifies tokens itself knows none, so it keeps what was written: a user's ID, a project's
|
|
@@ -228,7 +210,7 @@ type StoredGrant = {
|
|
|
228
210
|
can: WrittenCan;
|
|
229
211
|
};
|
|
230
212
|
/**
|
|
231
|
-
* What a grant
|
|
213
|
+
* What a grant left without `can` gives: what Vercel's API gives a project it lets use a
|
|
232
214
|
* board. Frozen all the way down: board reads it for every such grant, and @vercel/board/access
|
|
233
215
|
* exports it, so code that imports it can't widen them.
|
|
234
216
|
*/
|
|
@@ -261,9 +243,12 @@ type HostPrincipal = {
|
|
|
261
243
|
/** `vercel:user:<id>`, `vercel:project:<id>:<env>`, …: records keep their shape. */
|
|
262
244
|
id: string;
|
|
263
245
|
kind: PrincipalKind;
|
|
264
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* Who it is to people, its handle and its name: the board takes it as checked, so a person posts to Slack under
|
|
248
|
+
* it as a plain sender. A verifier that knows only an ID gives that.
|
|
249
|
+
*/
|
|
265
250
|
handle: string;
|
|
266
251
|
expiresAt?: Date | null;
|
|
267
252
|
};
|
|
268
253
|
//#endregion
|
|
269
|
-
export {
|
|
254
|
+
export { GrantFacts as _, DEFAULT_CAN as a, grantAccess as b, IssuerConfig as c, Principal as d, PrincipalKind as f, GrantExplanation as g, DecidingGrant as h, Claims as i, Known as l, Caller as m, AuthenticateContext as n, Granted as o, StoredGrant as p, CallerRequest as r, HostPrincipal as s, Authenticate as t, OidcTokensOptions as u, GrantSource as v, explainGrants as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as forbidden, l as unauthorized, r as badRequest, t as HttpError } from "./errors-
|
|
2
|
-
import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-
|
|
1
|
+
import { a as forbidden, l as unauthorized, r as badRequest, t as HttpError } from "./errors-DcQf5WeM.mjs";
|
|
2
|
+
import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-C5HaO42b.mjs";
|
|
3
3
|
//#region src/server/grants.ts
|
|
4
4
|
/**
|
|
5
5
|
* How close `principal` is to the caller, or null when it doesn't name it: `principal` for its own
|
|
@@ -108,12 +108,12 @@ function explainGrants(facts, channel) {
|
|
|
108
108
|
//#region src/server/auth.ts
|
|
109
109
|
/**
|
|
110
110
|
* Whether a caller wrote what `by` says, as far as changing it goes (editing, deleting, canceling a
|
|
111
|
-
* schedule): its principal did, and when
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
111
|
+
* schedule): its principal did, and when it writes as a profile, as that profile. A principal's
|
|
112
|
+
* profiles share its credential (a sandbox's agent writes as one through its deployment's), so the
|
|
113
|
+
* principal alone would let one profile change what another wrote. The principal itself, as no
|
|
114
|
+
* profile, changes what any of them wrote.
|
|
115
115
|
*/
|
|
116
|
-
const wroteAs = (caller, by) => by.principal === caller.principal.id && (
|
|
116
|
+
const wroteAs = (caller, by) => by.principal === caller.principal.id && (caller.actor.id === caller.principal.id || by.actor === caller.actor.id);
|
|
117
117
|
/**
|
|
118
118
|
* Principal IDs a board authenticates: its people, deployments, workflows, and its own code. No
|
|
119
119
|
* platform actor sync writes as may have one, or an import could pass for someone signed in.
|
|
@@ -143,18 +143,8 @@ function trustedIssuers(issuers) {
|
|
|
143
143
|
}
|
|
144
144
|
return new Set(issuers);
|
|
145
145
|
}
|
|
146
|
-
/** What a board token starts with, so board() knows its own before it tries any other verifier. */
|
|
147
|
-
const BOARD_TOKEN_PREFIX = "board_";
|
|
148
146
|
/**
|
|
149
|
-
*
|
|
150
|
-
* and when a request carries one. A token is 32 random bytes, so no salt or key is needed.
|
|
151
|
-
*/
|
|
152
|
-
async function tokenHash(secret) {
|
|
153
|
-
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(secret)));
|
|
154
|
-
return Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* What a grant or a token left without `can` gives: what Vercel's API gives a project it lets use a
|
|
147
|
+
* What a grant left without `can` gives: what Vercel's API gives a project it lets use a
|
|
158
148
|
* board. Frozen all the way down: board reads it for every such grant, and @vercel/board/access
|
|
159
149
|
* exports it, so code that imports it can't widen them.
|
|
160
150
|
*/
|
|
@@ -596,4 +586,4 @@ function hostPrincipal(value) {
|
|
|
596
586
|
};
|
|
597
587
|
}
|
|
598
588
|
//#endregion
|
|
599
|
-
export {
|
|
589
|
+
export { explainGrants as C, wroteAs as S, removes as _, authenticates as a, verifiesTokens as b, checkPrincipal as c, grantIssuers as d, hostPrincipal as f, privateHost as g, markVerified as h, VERCEL_ISSUER as i, createAuthority as l, joined as m, GITHUB_ISSUER as n, checkCan as o, issuerName as p, TOKENS as r, checkGrant as s, DEFAULT_CAN as t, fromTokens as u, trustedIssuers as v, grantAccess as w, workflowPath as x, verifiedIssuers as y };
|