@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.
Files changed (100) hide show
  1. package/README.md +6 -4
  2. package/dist/{access-CVkjSfxj.mjs → access-C5HaO42b.mjs} +2 -2
  3. package/dist/access.d.mts +6 -6
  4. package/dist/access.mjs +5 -5
  5. package/dist/actors-nrOf7Y7z.mjs +160 -0
  6. package/dist/{auth-BXLCkeB0.d.mts → auth-Bn8J_1F2.d.mts} +14 -29
  7. package/dist/{auth-B3bBYOqf.mjs → auth-DAlYi6TN.mjs} +9 -19
  8. package/dist/{backend-HcCCGPG4.d.mts → backend-CYsTLxtP.d.mts} +139 -43
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/blocks-CVoBC7ur.mjs +402 -0
  12. package/dist/blocks-DGvh2alZ.d.mts +33 -0
  13. package/dist/{chat-provider-1WKsLEnM.mjs → chat-provider-CPZg2MQb.mjs} +2 -2
  14. package/dist/{chat-provider-DyNy5xdC.d.mts → chat-provider-Cgkh9xJw.d.mts} +2 -2
  15. package/dist/cli-commands.d.mts +1 -1
  16. package/dist/cli-commands.mjs +1 -1
  17. package/dist/cli-embedded.d.mts +3 -3
  18. package/dist/cli-embedded.mjs +4 -4
  19. package/dist/cli.mjs +8 -13
  20. package/dist/{commands-B5d-lmNN.d.mts → commands-CrEVjASe.d.mts} +14 -26
  21. package/dist/{commands-BLS7erNu.mjs → commands-QRD0U9AQ.mjs} +114 -105
  22. package/dist/{conformance-D59Py2m2.mjs → conformance-ClxEEZ9C.mjs} +378 -101
  23. package/dist/conformance.d.mts +11 -9
  24. package/dist/conformance.mjs +1 -1
  25. package/dist/data-values-C-Cq80hz.mjs +176 -0
  26. package/dist/digest-Dna1CGa_.mjs +4 -0
  27. package/dist/{engine-eUgO5jTM.mjs → engine-8BcNeckB.mjs} +197 -84
  28. package/dist/{errors-rYDxZEuN.mjs → errors-DcQf5WeM.mjs} +123 -42
  29. package/dist/{events-C6HwB046.mjs → events-BT8y_81j.mjs} +2 -2
  30. package/dist/{exports-M5o4PTfO.mjs → exports-B6udRV_E.mjs} +961 -383
  31. package/dist/exports-C8zsIL1A.d.mts +4 -0
  32. package/dist/{external-CHDxWIVf.mjs → external-DymyhUzl.mjs} +1 -1
  33. package/dist/{index-rNqqgkyu.d.mts → index-fcpEFCTR.d.mts} +2 -2
  34. package/dist/index.d.mts +7 -6
  35. package/dist/index.mjs +8 -6
  36. package/dist/index.node.d.mts +7 -6
  37. package/dist/index.node.mjs +5 -4
  38. package/dist/inspect/app.js +110 -109
  39. package/dist/inspect/engine.js +5 -5
  40. package/dist/inspect-BsF3mYMY.mjs +2 -0
  41. package/dist/{inspect-BkXxR2uB.mjs → inspect-DPRoC_Gg.mjs} +6 -6
  42. package/dist/{local-DvkOWf4U.mjs → local-B9y4p6N7.mjs} +463 -512
  43. package/dist/{main-DtV_Po9i.mjs → main-S0A-c_kP.mjs} +549 -178
  44. package/dist/{memory-DkoqhxIH.mjs → memory-DhduVbUu.mjs} +2 -2
  45. package/dist/{mentions-CB6ShY4R.mjs → mentions-DfZGp3B-.mjs} +18 -4
  46. package/dist/{middleware-CPqAuRtp.mjs → middleware-DHdrxmoc.mjs} +71 -3
  47. package/dist/{targets-C1mT3M1N.mjs → origin-B3m2lnZC.mjs} +43 -64
  48. package/dist/{page-64IwoGRu.mjs → page-2jjHZmIW.mjs} +2 -2
  49. package/dist/page-CAUe4GmQ.mjs +2 -0
  50. package/dist/{provider-D5yVFisj.d.mts → provider-dY54GFNz.d.mts} +20 -34
  51. package/dist/{routes-BffuaoTX.d.mts → routes-By9lmvUD.d.mts} +91 -77
  52. package/dist/{schemas-AZkxk06N.mjs → schemas-DAzSsgWk.mjs} +8 -3
  53. package/dist/schemas.d.mts +37 -0
  54. package/dist/schemas.mjs +3 -0
  55. package/dist/{serve-CX1rqDF_.mjs → serve-B15I2Ibf.mjs} +5 -5
  56. package/dist/{server-DkYkyarg.mjs → server-DgpRZ4Nu.mjs} +74 -127
  57. package/dist/{serving-DJMcG0dT.mjs → serving-CALKWs9K.mjs} +1 -1
  58. package/dist/{sql-l3ysn4O5.mjs → sql-P9g-rLIF.mjs} +75 -12
  59. package/dist/{sqlite-CAwNHbQD.mjs → sqlite-B3rCcIof.mjs} +2 -2
  60. package/dist/{sqlite-db-cm5yhrD-.mjs → sqlite-db-D0Fyju-4.mjs} +1 -1
  61. package/dist/sync-chat-sdk.d.mts +2 -2
  62. package/dist/sync-chat-sdk.mjs +2 -2
  63. package/dist/sync-github.d.mts +2 -2
  64. package/dist/sync-github.mjs +2 -2
  65. package/dist/sync-linear.d.mts +3 -3
  66. package/dist/sync-linear.mjs +2 -2
  67. package/dist/sync-slack.d.mts +14 -8
  68. package/dist/sync-slack.mjs +46 -19
  69. package/dist/sync.d.mts +2 -2
  70. package/dist/sync.mjs +2 -2
  71. package/dist/{tokens-DA9ipsZ-.mjs → tokens-D7_ZIWpX.mjs} +4 -4
  72. package/docs/01-board/01-mounting.md +13 -16
  73. package/docs/01-board/03-identity.md +112 -74
  74. package/docs/01-board/04-messages.md +61 -2
  75. package/docs/01-board/05-reading.md +11 -5
  76. package/docs/01-board/06-watchers.md +17 -13
  77. package/docs/01-board/07-schedules.md +8 -6
  78. package/docs/01-board/08-middleware.md +1 -1
  79. package/docs/01-board/09-access.md +80 -132
  80. package/docs/02-sync/01-overview.md +75 -4
  81. package/docs/02-sync/02-functions.md +11 -6
  82. package/docs/02-sync/03-slack.md +43 -19
  83. package/docs/02-sync/06-providers.md +9 -4
  84. package/docs/03-guides/01-coding-agents.md +18 -22
  85. package/docs/03-guides/02-inspector.md +4 -5
  86. package/docs/03-guides/03-ci.md +7 -26
  87. package/docs/03-guides/04-triage.md +2 -2
  88. package/docs/03-guides/05-agent-factory.md +7 -9
  89. package/docs/03-guides/06-sandboxed-agents.md +149 -0
  90. package/docs/04-reference/01-cli.md +161 -104
  91. package/docs/04-reference/02-board.md +89 -37
  92. package/docs/04-reference/03-http.md +176 -71
  93. package/docs/04-reference/05-conformance.md +47 -21
  94. package/docs/index.md +5 -5
  95. package/package.json +5 -1
  96. package/dist/actors-kfMejhaw.mjs +0 -156
  97. package/dist/digest-krhjNAt4.mjs +0 -4
  98. package/dist/exports-vLQ2Y2Nd.d.mts +0 -4
  99. package/dist/inspect-lnv1sLXM.mjs +0 -2
  100. 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>` (`--handle` to pick another), and `vb` pointed at
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 as the app. Your Slack account is an actor of its own, and
109
- an email names it:
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@vercel.com # Slack pings of whoever has that email on Slack
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-rYDxZEuN.mjs";
2
- import { a as CAN_MAX, o as ChannelPath } from "./schemas-AZkxk06N.mjs";
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 Actor, Bt as FULL_ACCESS, Gt as InvalidCan, Ht as GrantChange, It as Access, Lt as AccessSummary, Qt as union, Rt as Can, Ut as GrantChangeRefusal, Vt as Grant, Wt as GrantShape, Xt as compileAccess, Yt as checkGrantChange, Zt as parseCan, nn as Author, qt as Permission, rn as CAN_MAX, zt as ChannelPattern } from "./routes-BffuaoTX.mjs";
2
- import { _ as GrantExplanation, a as DEFAULT_CAN, b as explainGrants, c as IssuerConfig, f as Principal, g as DecidingGrant, h as Caller, i as Claims, l as Known, n as AuthenticateContext, p as PrincipalKind, r as CallerRequest, s as HostPrincipal, t as Authenticate, u as OidcTokensOptions, v as GrantFacts, x as grantAccess, y as GrantSource } from "./auth-BXLCkeB0.mjs";
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
- * A person's name is what they claim, and so is their handle unless a host's verifier named them;
23
- * anyone else's are their principal's. `audience` is the board's URL, which serves the known
24
- * agents' avatars.
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, audience: string): ResolvedActor;
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-AZkxk06N.mjs";
2
- import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-CVkjSfxj.mjs";
3
- import { E as grantAccess, T as explainGrants, n as DEFAULT_CAN } from "./auth-B3bBYOqf.mjs";
4
- import { i as resolveActor } from "./actors-kfMejhaw.mjs";
5
- import { t as oidcTokens } from "./tokens-DA9ipsZ-.mjs";
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 { It as Access, Jt as WrittenCan, Kt as Level, Rt as Can, qt as Permission } from "./routes-BffuaoTX.mjs";
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-avatar`: an https URL for its picture. */
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
- /** The default handle; a person's is replaced by the handle their CLI sends, unless a host's verifier named them. */
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, and the board token it came with. */
183
- type Known = Pick<Principal, 'id' | 'kind' | 'handle' | 'facts' | 'scope' | 'token'>;
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 or a token left without `can` gives: what Vercel's API gives a project it lets use a
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
- /** Kept as it is: `x-board-handle` doesn't replace it. Return `request.claims.handle` to take the caller's. */
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 { GrantExplanation as _, DEFAULT_CAN as a, explainGrants as b, IssuerConfig as c, Pinned as d, Principal as f, DecidingGrant as g, Caller as h, Claims as i, Known as l, StoredGrant as m, AuthenticateContext as n, Granted as o, PrincipalKind as p, CallerRequest as r, HostPrincipal as s, Authenticate as t, OidcTokensOptions as u, GrantFacts as v, grantAccess as x, GrantSource as y };
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-rYDxZEuN.mjs";
2
- import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-CVkjSfxj.mjs";
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 a board token pins the profile it writes as, as that
112
- * profile. A token acts as its minter, so the principal alone would let one agent's token change
113
- * what its minter or another agent wrote. Another token that pins the same profile writes as the
114
- * same author, so a renewed one picks up where the last left off.
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 && ((caller.principal.pinned?.profile ?? null) === null || by.actor === caller.actor.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
- * A board token's SHA-256, hex: what the board keeps instead of the secret, both when it mints one
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 { workflowPath as C, grantAccess as E, verifiesTokens as S, explainGrants as T, privateHost as _, VERCEL_ISSUER as a, trustedIssuers as b, checkGrant as c, fromTokens as d, grantIssuers as f, markVerified as g, joined as h, TOKENS as i, checkPrincipal as l, issuerName as m, DEFAULT_CAN as n, authenticates as o, hostPrincipal as p, GITHUB_ISSUER as r, checkCan as s, BOARD_TOKEN_PREFIX as t, createAuthority as u, removes as v, wroteAs as w, verifiedIssuers as x, tokenHash as y };
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 };