@vercel/board 0.25.0 → 0.26.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 (84) hide show
  1. package/dist/{a2-CQ3WcqMv.mjs → a2-Qzj0kCWU.mjs} +6 -6
  2. package/dist/access.d.mts +1 -2
  3. package/dist/access.mjs +3 -3
  4. package/dist/{actors-CDDhhFNY.mjs → actors-BLXVp4oZ.mjs} +2 -2
  5. package/dist/{auth-BwWH3Twu.mjs → auth-lTkOgvcE.mjs} +1 -1
  6. package/dist/{backend-DmXjVnil.d.mts → backend-ZKYTe3xa.d.mts} +5 -15
  7. package/dist/backend-a2/blob-vercel.d.mts +1 -1
  8. package/dist/backend-a2/contract.d.mts +1 -2
  9. package/dist/backend-a2/store-memory.d.mts +1 -1
  10. package/dist/backend-a2/store-postgres.d.mts +1 -1
  11. package/dist/backend-a2/store-redis-http.d.mts +1 -1
  12. package/dist/backend-a2/store-redis.d.mts +1 -1
  13. package/dist/backend-a2/store-sqlite.d.mts +1 -1
  14. package/dist/backend-a2.d.mts +5 -6
  15. package/dist/backend-a2.mjs +1 -1
  16. package/dist/{backend-http-BJ7AdK0c.mjs → backend-http-BB0Gld6Q.mjs} +8 -5
  17. package/dist/{backend-http-BsP0Xq9e.d.mts → backend-http-E7YU0qhn.d.mts} +3 -4
  18. package/dist/{backend-http-Cs-UKpYp.mjs → backend-http-F0W6e36G.mjs} +2 -2
  19. package/dist/backend-http.d.mts +1 -1
  20. package/dist/backend-http.mjs +1 -1
  21. package/dist/backend-http.node.d.mts +1 -1
  22. package/dist/backend-http.node.mjs +1 -1
  23. package/dist/{backend-vercel-CED673bx.d.mts → backend-vercel-CIRObA0t.d.mts} +3 -4
  24. package/dist/{backend-vercel-CG2SYa03.mjs → backend-vercel-CtB46vMQ.mjs} +3 -3
  25. package/dist/{backend-vercel-B0Q0K0O5.mjs → backend-vercel-DUWIcFi9.mjs} +24 -8
  26. package/dist/backend-vercel.d.mts +1 -1
  27. package/dist/backend-vercel.mjs +1 -1
  28. package/dist/backend-vercel.node.d.mts +6 -1
  29. package/dist/backend-vercel.node.mjs +2 -2
  30. package/dist/{blob-C0J3wbGv.d.mts → blob-B-9AvYis.d.mts} +2 -1
  31. package/dist/{chat-provider-6eYkL2ef.d.mts → chat-provider-DsNEBQiA.d.mts} +3 -2
  32. package/dist/cli-commands.d.mts +1 -1
  33. package/dist/cli-commands.mjs +1 -1
  34. package/dist/cli-embedded.d.mts +7 -3
  35. package/dist/cli-embedded.mjs +8 -4
  36. package/dist/cli.mjs +4 -4
  37. package/dist/{client-BY-BCggB.mjs → client-D0Px7KzF.mjs} +16 -4
  38. package/dist/{provider-C_sj4-GL.d.mts → client-xLxeDz0f.d.mts} +13 -689
  39. package/dist/{commands-D0wXq6CY.d.mts → commands-D6gvrOh3.d.mts} +4 -4
  40. package/dist/{commands-BtL4jFq8.mjs → commands-nEG47RM_.mjs} +7 -7
  41. package/dist/{conformance-BZ53bxrG.mjs → conformance-DlnfuzEB.mjs} +1 -1
  42. package/dist/conformance.d.mts +1 -1
  43. package/dist/conformance.mjs +1 -1
  44. package/dist/{engine-SeaJ_CIY.mjs → engine-ROa7-IQY.mjs} +2 -2
  45. package/dist/errors-CB4tnZGz.d.mts +16 -0
  46. package/dist/{errors-Bven0k29.mjs → errors-CusN4x2l.mjs} +14 -6
  47. package/dist/exports-D22M68rk.d.mts +5 -0
  48. package/dist/{exports-ByvYtxFT.mjs → exports-NFjBgIT2.mjs} +6 -6
  49. package/dist/{folds-CRYY14kc.d.mts → folds-jS9wlh9_.d.mts} +49 -2
  50. package/dist/{index-k2LfZxl-.d.mts → index-C05it0mC.d.mts} +2 -2
  51. package/dist/index.d.mts +5 -4
  52. package/dist/{index.default-DmfhBZZi.mjs → index.default-Boe7x-mK.mjs} +1 -1
  53. package/dist/index.mjs +6 -6
  54. package/dist/index.node.d.mts +5 -4
  55. package/dist/index.node.mjs +4 -4
  56. package/dist/inspect/app.js +108 -108
  57. package/dist/{main-BNkywL2P.mjs → main-BuahKR16.mjs} +84 -69
  58. package/dist/{middleware-B0J7QBq7.mjs → middleware-ChKM1zuu.mjs} +1 -1
  59. package/dist/{node-C51_xzCb.mjs → node-Ybi9E6bO.mjs} +104 -46
  60. package/dist/provider-Cdg1qadh.d.mts +688 -0
  61. package/dist/{serve-DYQ64Q5R.mjs → serve-BbHEQk_Y.mjs} +5 -5
  62. package/dist/{server-BgK1sgj7.mjs → server-Bphio_82.mjs} +4 -4
  63. package/dist/{serving-rXQcEgTO.mjs → serving-CvOWEym2.mjs} +1 -1
  64. package/dist/sync-github.d.mts +2 -2
  65. package/dist/sync-kapso.d.mts +2 -2
  66. package/dist/sync-linear.d.mts +2 -2
  67. package/dist/sync-slack.d.mts +3 -3
  68. package/dist/sync.chat.d.mts +1 -1
  69. package/dist/sync.d.mts +2 -2
  70. package/dist/{tokens-U-XRlEfq.mjs → tokens-BuCU-61R.mjs} +2 -2
  71. package/dist/{types-8yq2VnKI.d.mts → types-aCAf6lGU.d.mts} +1 -1
  72. package/dist/{watchers-hash-C4CJg7K1.mjs → watchers-hash-BfDPW95j.mjs} +5 -5
  73. package/docs/01-board/04-messages.md +1 -1
  74. package/docs/01-board/05-reading.md +2 -2
  75. package/docs/01-board/06-watchers.md +3 -3
  76. package/docs/02-sync/01-overview.md +2 -2
  77. package/docs/03-guides/03-ci.md +2 -2
  78. package/docs/03-guides/04-triage.md +5 -5
  79. package/docs/04-reference/01-cli.md +9 -4
  80. package/docs/04-reference/02-board.md +6 -2
  81. package/docs/index.md +2 -2
  82. package/package.json +1 -1
  83. package/dist/exports-CPrIkpz3.d.mts +0 -4
  84. package/dist/schemas-CWxs3ECJ.d.mts +0 -50
@@ -1,15 +1,15 @@
1
1
  import { n as DIRECT_UPLOAD_BYTES_MAX, r as IMPORT_BYTES_MAX, t as ATTACHMENT_BYTES_MAX } from "./files-SniSmeEr.mjs";
2
2
  import { _ as RemoteWatcherId, b as actorKind, i as Attachment, x as platformAvatar } from "./schemas-Be08nyfW.mjs";
3
3
  import "./external-BV_cUncs.mjs";
4
- import { a as METHODS, d as VERSION, f as SYNC, n as compileWatcher, r as hasCriteria, t as canonicalWatchers } from "./watchers-hash-C4CJg7K1.mjs";
5
- import { r as duration, t as BoardError } from "./client-BY-BCggB.mjs";
4
+ import { a as METHODS, d as VERSION, f as SYNC, n as compileWatcher, r as hasCriteria, t as canonicalWatchers } from "./watchers-hash-BfDPW95j.mjs";
5
+ import { r as duration, t as BoardError } from "./client-D0Px7KzF.mjs";
6
6
  import { n as derivedId, r as isKeyIdOf } from "./ids-C6AYo1bu.mjs";
7
- import { a as forbidden, c as toErrorResponse, i as duplicateId, r as badRequest, s as notFound, t as HttpError } from "./errors-Bven0k29.mjs";
7
+ import { a as forbidden, c as toErrorResponse, i as duplicateId, r as badRequest, s as notFound, t as HttpError } from "./errors-CusN4x2l.mjs";
8
8
  import { t as own } from "./own-OwgPWdmh.mjs";
9
9
  import { n as replaceMentions } from "./mentions-CB6ShY4R.mjs";
10
- import { _ as FULL_ACCESS, i as authenticates, v as authorize } from "./auth-BwWH3Twu.mjs";
11
- import { a as resolveMentions, n as actorSeen } from "./actors-CDDhhFNY.mjs";
12
- import { n as MIDDLEWARE_ACTOR, t as DroppedError } from "./middleware-B0J7QBq7.mjs";
10
+ import { _ as FULL_ACCESS, i as authenticates, v as authorize } from "./auth-lTkOgvcE.mjs";
11
+ import { a as resolveMentions, n as actorSeen } from "./actors-BLXVp4oZ.mjs";
12
+ import { n as MIDDLEWARE_ACTOR, t as DroppedError } from "./middleware-ChKM1zuu.mjs";
13
13
  import { n as syncTarget, r as withEmailMentions } from "./targets-C-wdR5wP.mjs";
14
14
  import { t as A2Error } from "./session-clear-wHd5GCpZ-BnKSxReK.mjs";
15
15
  import { a as reducer } from "./reducer-CjmvZSAb-D_OSISmj.mjs";
package/dist/access.d.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { a as Grant, i as ChannelPattern, n as AccessSummary, o as Permission, r as Can, t as Access } from "./access-CV96SYgr.mjs";
2
2
  import { _ as oidc, a as CallerRequest, c as HostPrincipal, d as OidcTokensOptions, f as Principal, g as githubActions, h as compileRules, i as AuthenticateContext, l as IssuerConfig, m as RuleFunction, n as AccessRule, o as Claims, p as PrincipalKind, r as Authenticate, t as AccessFunction, u as Known, v as vercelProject } from "./auth-CU56Q2Xh.mjs";
3
- import { o as Author } from "./schemas-CWxs3ECJ.mjs";
4
- import { t as Actor } from "./folds-CRYY14kc.mjs";
3
+ import { C as Author, t as Actor } from "./folds-jS9wlh9_.mjs";
5
4
  //#region src/server/tokens.d.ts
6
5
  /**
7
6
  * The OIDC tokens made out to this board: a request's bearer token, from Vercel (people and
package/dist/access.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as compileRules, c as githubActions, h as vercelProject, p as oidc } from "./auth-BwWH3Twu.mjs";
2
- import { i as resolveActor } from "./actors-CDDhhFNY.mjs";
3
- import { t as oidcTokens } from "./tokens-U-XRlEfq.mjs";
1
+ import { a as compileRules, c as githubActions, h as vercelProject, p as oidc } from "./auth-lTkOgvcE.mjs";
2
+ import { i as resolveActor } from "./actors-BLXVp4oZ.mjs";
3
+ import { t as oidcTokens } from "./tokens-BuCU-61R.mjs";
4
4
  export { compileRules, githubActions, oidc, oidcTokens, resolveActor, vercelProject };
@@ -1,8 +1,8 @@
1
1
  import { C as toStorable } from "./schemas-Be08nyfW.mjs";
2
- import { r as badRequest } from "./errors-Bven0k29.mjs";
2
+ import { r as badRequest } from "./errors-CusN4x2l.mjs";
3
3
  import { t as own } from "./own-OwgPWdmh.mjs";
4
4
  import { t as extractMentions } from "./mentions-CB6ShY4R.mjs";
5
- import { y as parseScope } from "./auth-BwWH3Twu.mjs";
5
+ import { y as parseScope } from "./auth-lTkOgvcE.mjs";
6
6
  //#region src/server/actors.ts
7
7
  /** Agents whose avatars the board serves itself. */
8
8
  const KNOWN_AGENTS = [
@@ -1,5 +1,5 @@
1
1
  import { c as ChannelPath, v as SCOPE_MAX } from "./schemas-Be08nyfW.mjs";
2
- import { a as forbidden, l as unauthorized } from "./errors-Bven0k29.mjs";
2
+ import { a as forbidden, l as unauthorized } from "./errors-CusN4x2l.mjs";
3
3
  //#region src/server/access.ts
4
4
  /**
5
5
  * What a principal may do in a channel. `read` covers messages, threads,
@@ -1,8 +1,9 @@
1
1
  import { t as Access } from "./access-CV96SYgr.mjs";
2
2
  import { m as RuleFunction, n as AccessRule, r as Authenticate, s as Granted, t as AccessFunction, u as Known } from "./auth-CU56Q2Xh.mjs";
3
- import { i as Attachment, o as Author, p as Labels } from "./schemas-CWxs3ECJ.mjs";
4
- import { t as Actor, u as ExternalEvent } from "./folds-CRYY14kc.mjs";
5
- import { $ as Discovery, $t as SyncCodeView, Bt as SchedulesQuery, Et as PostBody, F as BoardClient, Gt as SourceJoinBody, It as ScheduleBody, Jt as SourceReadQuery, Nt as RegistrationView, Qt as SyncCodeBody, St as MessagesQuery, Tt as PersonView, Wt as SourceJoin, X as BoardEventView, Yt as SyncAccountBody, Z as ChannelView, _t as MatchView, an as SyncImportBody, bn as UploadStartBody, bt as MessageView, ct as InboxEntry, dn as SyncUnlinkBody, dt as InboxPushBody, en as SyncCopiesQuery, et as EditBody, fn as SyncedView, ft as InboxQuery, gn as ThreadsQuery, gt as LinkedQuery, hn as ThreadsPage, ht as LinkedAccount, in as SyncFindView, jt as RegisterBody, kt as ReactBody, ln as SyncRootsQuery, lt as InboxItem, mn as ThreadView, nt as EventsQuery, ot as IdentityView, p as SyncProvider, pt as LabelBody, q as AckBody, qt as SourceRead, rn as SyncFindQuery, sn as SyncReceiptBody, st as InboxAckBody, tn as SyncCopiesView, tt as EventsPage, un as SyncThreadView, ut as InboxNextQuery, vn as TypingBody, vt as MatchesQuery, xn as UploadTicket, xt as MessagesPage, yt as Me, z as ProfileOption, zt as ScheduleView } from "./provider-C_sj4-GL.mjs";
3
+ import { A as Labels, C as Author, t as Actor, u as ExternalEvent, x as Attachment } from "./folds-jS9wlh9_.mjs";
4
+ import { A as InboxItem, At as SyncRootsQuery, B as Me, C as EventsQuery, D as IdentityView, Et as SyncImportBody, Ft as ThreadView, H as MessagesPage, Ht as UploadTicket, I as LinkedAccount, It as ThreadsPage, K as PersonView, L as LinkedQuery, Lt as ThreadsQuery, M as InboxPushBody, Mt as SyncUnlinkBody, N as InboxQuery, Nt as SyncedView, O as InboxAckBody, Ot as SyncReceiptBody, P as LabelBody, Q as RegisterBody, R as MatchView, S as EventsPage, St as SyncCopiesView, Tt as SyncFindView, U as MessagesQuery, V as MessageView, Vt as UploadStartBody, X as ReactBody, _ as BoardEventView, b as Discovery, bt as SyncCodeView, dt as SourceJoin, et as RegistrationView, ft as SourceJoinBody, gt as SyncAccountBody, ht as SourceReadQuery, j as InboxNextQuery, jt as SyncThreadView, k as InboxEntry, m as AckBody, mt as SourceRead, o as ProfileOption, ot as ScheduleView, q as PostBody, rt as ScheduleBody, st as SchedulesQuery, t as BoardClient, v as ChannelView, wt as SyncFindQuery, x as EditBody, xt as SyncCopiesQuery, yt as SyncCodeBody, z as MatchesQuery, zt as TypingBody } from "./client-xLxeDz0f.mjs";
5
+ import { t as HttpError } from "./errors-CB4tnZGz.mjs";
6
+ import { p as SyncProvider } from "./provider-Cdg1qadh.mjs";
6
7
  import { z } from "zod";
7
8
  //#region src/api/protocol.d.ts
8
9
  type Input<S extends z.ZodType> = NonNullable<z.output<S>>;
@@ -294,17 +295,6 @@ type Protocol = {
294
295
  };
295
296
  type Method = keyof Protocol;
296
297
  //#endregion
297
- //#region src/server/errors.d.ts
298
- declare class HttpError extends Error {
299
- readonly status: number;
300
- readonly code: string;
301
- /** What fixes it, when the handle that raised it knows (`BoardError`'s `hint`). */
302
- readonly hint: string | undefined;
303
- constructor(status: number, code: string, message: string, options?: {
304
- hint?: string;
305
- });
306
- }
307
- //#endregion
308
298
  //#region src/server/middleware.d.ts
309
299
  /** Where a write came from, as the middleware sees it. */
310
300
  type WriteSource =
@@ -688,4 +678,4 @@ interface Backend extends ProtocolMethods {
688
678
  bind(board: BoardBinding): void;
689
679
  }
690
680
  //#endregion
691
- export { Protocol as C, Method as S, MiddlewareContext as _, Identity as a, WriteSource as b, SelfCaller as c, Board as d, BoardOptions as f, Middleware as g, DroppedError as h, Caller as i, Subscription as l, WatcherContext as m, BackendRoute as n, InboxDelivery as o, Watcher as p, BoardBinding as r, ProtocolMethods as s, Backend as t, VerifiedCaller as u, Write as v, HttpError as x, WritePatch as y };
681
+ export { Protocol as S, MiddlewareContext as _, Identity as a, WriteSource as b, SelfCaller as c, Board as d, BoardOptions as f, Middleware as g, DroppedError as h, Caller as i, Subscription as l, WatcherContext as m, BackendRoute as n, InboxDelivery as o, Watcher as p, BoardBinding as r, ProtocolMethods as s, Backend as t, VerifiedCaller as u, Write as v, Method as x, WritePatch as y };
@@ -1,4 +1,4 @@
1
- import { t as BlobStore } from "../blob-C0J3wbGv.mjs";
1
+ import { t as BlobStore } from "../blob-B-9AvYis.mjs";
2
2
  //#region src/blob/vercel.d.ts
3
3
  export declare function vercelBlob(options?: {
4
4
  token?: string;
@@ -1,5 +1,4 @@
1
- import { a as AttachmentId, c as ChannelPath, d as LabelKey, f as LabelValue, g as MessageText, h as MessageId, i as Attachment, l as Emoji, m as MESSAGE_TEXT_MAX, n as ActorId, o as Author, p as Labels, r as ActorKind, s as CHANNEL_PATH_MAX, t as ATTACHMENTS_PER_MESSAGE_MAX, u as Handle } from "../schemas-CWxs3ECJ.mjs";
2
- import { _ as BoardEvents, g as BoardEvent, h as BOARD_SESSION, i as ChannelsState, l as ExternalAuthor, m as Origin, n as ActorsState, o as Message, r as Channel, s as MessagesState, t as Actor } from "../folds-CRYY14kc.mjs";
1
+ import { A as Labels, C as Author, D as Handle, E as Emoji, M as MessageId, N as MessageText, O as LabelKey, S as AttachmentId, T as ChannelPath, _ as BoardEvents, b as ActorKind, g as BoardEvent, h as BOARD_SESSION, i as ChannelsState, j as MESSAGE_TEXT_MAX, k as LabelValue, l as ExternalAuthor, m as Origin, n as ActorsState, o as Message, r as Channel, s as MessagesState, t as Actor, v as ATTACHMENTS_PER_MESSAGE_MAX, w as CHANNEL_PATH_MAX, x as Attachment, y as ActorId } from "../folds-jS9wlh9_.mjs";
3
2
  import { l as Reducer, n as Contract } from "../reducer-CYPHsSmd-BQIfozGi.mjs";
4
3
  import { z } from "zod";
5
4
  //#region src/contract/files.d.ts
@@ -1,5 +1,5 @@
1
1
  import { n as Clock } from "../store-D0MhBvg6-4Z2L0Kqd.mjs";
2
- import { t as BoardStore } from "../types-8yq2VnKI.mjs";
2
+ import { t as BoardStore } from "../types-aCAf6lGU.mjs";
3
3
  //#region src/store/memory.d.ts
4
4
  /**
5
5
  * A board that lives in memory, for tests: its log in A2's memory store, its
@@ -1,4 +1,4 @@
1
- import { t as BoardStore } from "../types-8yq2VnKI.mjs";
1
+ import { t as BoardStore } from "../types-aCAf6lGU.mjs";
2
2
  //#region src/store/postgres-db.d.ts
3
3
  /** What the tables need of a `pg` Pool, or of anything shaped like one. */
4
4
  type PgQueryable = {
@@ -1,4 +1,4 @@
1
- import { t as BoardStore } from "../types-8yq2VnKI.mjs";
1
+ import { t as BoardStore } from "../types-aCAf6lGU.mjs";
2
2
  //#region src/store/redis-http.d.ts
3
3
  export type RedisHttpOptions = {
4
4
  /** The REST endpoint, e.g. `process.env.UPSTASH_REDIS_REST_URL`. */
@@ -1,4 +1,4 @@
1
- import { t as BoardStore } from "../types-8yq2VnKI.mjs";
1
+ import { t as BoardStore } from "../types-aCAf6lGU.mjs";
2
2
  //#region ../../node_modules/.pnpm/experimental-a2@0.22.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__52060f00b21aecfab049c27fa3abd2f9/node_modules/experimental-a2/dist/store-redis.d.ts
3
3
  //#region src/store-redis-notify.d.ts
4
4
  type RedisConnection = {
@@ -1,4 +1,4 @@
1
- import { t as BoardStore } from "../types-8yq2VnKI.mjs";
1
+ import { t as BoardStore } from "../types-aCAf6lGU.mjs";
2
2
  //#region src/store/sqlite.d.ts
3
3
  /**
4
4
  * A board in one SQLite file, A2's log and board's tables side by side: `a2()`'s
@@ -1,11 +1,10 @@
1
- import { i as Attachment } from "./schemas-CWxs3ECJ.mjs";
2
- import { t as Actor } from "./folds-CRYY14kc.mjs";
1
+ import { t as Actor, x as Attachment } from "./folds-jS9wlh9_.mjs";
3
2
  import { l as Reducer, r as ContractEvent } from "./reducer-CYPHsSmd-BQIfozGi.mjs";
4
3
  import { a as SessionAppend, c as SessionConsumeOptions, d as SessionSchedule, f as StateOptions, l as SessionConsumeResult, n as A2Server, o as SessionClearOptions, p as SessionCleared, r as Consumer, s as SessionClearResult, t as A2Scheduler, u as SessionDeadLetters } from "./server-qgez0Xny-D5mLfqFQ.mjs";
5
- import { $ as Discovery, $t as SyncCodeView, Nt as RegistrationView, Tt as PersonView, Wt as SourceJoin, Z as ChannelView, _t as MatchView, bt as MessageView, ct as InboxEntry, fn as SyncedView, hn as ThreadsPage, ht as LinkedAccount, in as SyncFindView, lt as InboxItem, mn as ThreadView, ot as IdentityView, qt as SourceRead, tn as SyncCopiesView, tt as EventsPage, un as SyncThreadView, xn as UploadTicket, xt as MessagesPage, yt as Me, zt as ScheduleView } from "./provider-C_sj4-GL.mjs";
6
- import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-DmXjVnil.mjs";
7
- import { n as fsBlob, r as memoryBlob, t as BlobStore } from "./blob-C0J3wbGv.mjs";
8
- import { t as BoardStore } from "./types-8yq2VnKI.mjs";
4
+ import { A as InboxItem, B as Me, D as IdentityView, Ft as ThreadView, H as MessagesPage, Ht as UploadTicket, I as LinkedAccount, It as ThreadsPage, K as PersonView, Nt as SyncedView, R as MatchView, S as EventsPage, St as SyncCopiesView, Tt as SyncFindView, V as MessageView, b as Discovery, bt as SyncCodeView, dt as SourceJoin, et as RegistrationView, jt as SyncThreadView, k as InboxEntry, mt as SourceRead, ot as ScheduleView, v as ChannelView } from "./client-xLxeDz0f.mjs";
5
+ import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-ZKYTe3xa.mjs";
6
+ import { n as fsBlob, r as memoryBlob, t as BlobStore } from "./blob-B-9AvYis.mjs";
7
+ import { t as BoardStore } from "./types-aCAf6lGU.mjs";
9
8
  import { z } from "zod";
10
9
  //#region src/server/transport.d.ts
11
10
  /**
@@ -1,2 +1,2 @@
1
- import { n as fsBlob, r as memoryBlob, t as a2 } from "./a2-CQ3WcqMv.mjs";
1
+ import { n as fsBlob, r as memoryBlob, t as a2 } from "./a2-Qzj0kCWU.mjs";
2
2
  export { a2, fsBlob, memoryBlob };
@@ -1,9 +1,9 @@
1
1
  import "./files-SniSmeEr.mjs";
2
2
  import "./schemas-Be08nyfW.mjs";
3
- import { K as routes, O as RegisterBody, a as METHODS, n as compileWatcher, t as canonicalWatchers } from "./watchers-hash-C4CJg7K1.mjs";
4
- import { n as createBoardClient, t as BoardError } from "./client-BY-BCggB.mjs";
3
+ import { K as routes, O as RegisterBody, a as METHODS, n as compileWatcher, t as canonicalWatchers } from "./watchers-hash-BfDPW95j.mjs";
4
+ import { n as createBoardClient, t as BoardError } from "./client-D0Px7KzF.mjs";
5
5
  import { a as sha256, i as keyId, n as derivedId, t as DERIVED_ID } from "./ids-C6AYo1bu.mjs";
6
- import { a as forbidden, o as json, t as HttpError } from "./errors-Bven0k29.mjs";
6
+ import { a as forbidden, o as json, t as HttpError } from "./errors-CusN4x2l.mjs";
7
7
  //#region src/server/registrant.ts
8
8
  /** Registering again this soon after the same registration only repeats it. */
9
9
  const REGISTER_EVERY_MS = 1e4;
@@ -239,7 +239,10 @@ function scopeOf(identity) {
239
239
  const describe = (error) => ((error instanceof Error ? error.message : String(error)) || "unknown error").slice(0, 500);
240
240
  /** The SDK's error, as the board answers it: the remote's own status and code, or 502 when it never answered. */
241
241
  const rethrow = (error) => {
242
- if (error instanceof BoardError) throw new HttpError(error.status >= 400 ? error.status : 502, error.code, error.message, error.hint !== void 0 ? { hint: error.hint } : {});
242
+ if (error instanceof BoardError) throw new HttpError(error.status >= 400 ? error.status : 502, error.code, error.message, {
243
+ ...error.hint !== void 0 ? { hint: error.hint } : {},
244
+ origin: error.origin
245
+ });
243
246
  if (error instanceof HttpError || error instanceof Error && error.name === "AbortError") throw error;
244
247
  throw new HttpError(502, "unreachable", `the board didn't answer: ${describe(error)}`);
245
248
  };
@@ -339,7 +342,7 @@ function createHttp(url, options, environment) {
339
342
  let discovered = null;
340
343
  /** The board it uses' discovery, for a handle here: who it is, and the sync entries it lists. */
341
344
  const discovery = () => (discovered ??= doFetch(remote).then(async (response) => {
342
- if (!response.ok) throw new HttpError(response.status >= 400 ? response.status : 502, "no_board", `There's no board at ${remote}: it answered ${response.status}.`);
345
+ if (!response.ok) throw new HttpError(response.status >= 400 ? response.status : 502, "no_board", `There's no board at ${remote}: it answered ${response.status}.`, { origin: "handle" });
343
346
  return await response.json();
344
347
  }, rethrow)).catch((error) => {
345
348
  discovered = null;
@@ -1,7 +1,6 @@
1
- import { i as Attachment } from "./schemas-CWxs3ECJ.mjs";
2
- import { t as Actor } from "./folds-CRYY14kc.mjs";
3
- import { $ as Discovery, $t as SyncCodeView, Nt as RegistrationView, Tt as PersonView, Wt as SourceJoin, Z as ChannelView, _t as MatchView, bt as MessageView, ct as InboxEntry, fn as SyncedView, hn as ThreadsPage, ht as LinkedAccount, in as SyncFindView, lt as InboxItem, mn as ThreadView, ot as IdentityView, qt as SourceRead, tn as SyncCopiesView, tt as EventsPage, un as SyncThreadView, xn as UploadTicket, xt as MessagesPage, yt as Me, z as ProfileOption, zt as ScheduleView } from "./provider-C_sj4-GL.mjs";
4
- import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-DmXjVnil.mjs";
1
+ import { t as Actor, x as Attachment } from "./folds-jS9wlh9_.mjs";
2
+ import { A as InboxItem, B as Me, D as IdentityView, Ft as ThreadView, H as MessagesPage, Ht as UploadTicket, I as LinkedAccount, It as ThreadsPage, K as PersonView, Nt as SyncedView, R as MatchView, S as EventsPage, St as SyncCopiesView, Tt as SyncFindView, V as MessageView, b as Discovery, bt as SyncCodeView, dt as SourceJoin, et as RegistrationView, jt as SyncThreadView, k as InboxEntry, mt as SourceRead, o as ProfileOption, ot as ScheduleView, v as ChannelView } from "./client-xLxeDz0f.mjs";
3
+ import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-ZKYTe3xa.mjs";
5
4
  //#region src/server/backend-http.d.ts
6
5
  type HttpOptions = {
7
6
  /**
@@ -1,5 +1,5 @@
1
- import { r as createHttp } from "./backend-http-BJ7AdK0c.mjs";
2
- import { n as connect, r as environmentProfile, t as boardUrl } from "./node-C51_xzCb.mjs";
1
+ import { r as createHttp } from "./backend-http-BB0Gld6Q.mjs";
2
+ import { n as connect, r as environmentProfile, t as boardUrl } from "./node-Ybi9E6bO.mjs";
3
3
  //#region src/backend-http/index.ts
4
4
  const environment = {
5
5
  url: boardUrl,
@@ -1,4 +1,4 @@
1
- import { n as HttpOptions, t as HttpBackend } from "./backend-http-BsP0Xq9e.mjs";
1
+ import { n as HttpOptions, t as HttpBackend } from "./backend-http-E7YU0qhn.mjs";
2
2
  //#region src/backend-http/index.default.d.ts
3
3
  /**
4
4
  * The board at `url`, which keeps the log. Outside Node there's no environment to find it or a
@@ -1,2 +1,2 @@
1
- import { t as http } from "./index.default-DmfhBZZi.mjs";
1
+ import { t as http } from "./index.default-Boe7x-mK.mjs";
2
2
  export { http };
@@ -1,4 +1,4 @@
1
- import { n as HttpOptions, t as HttpBackend } from "./backend-http-BsP0Xq9e.mjs";
1
+ import { n as HttpOptions, t as HttpBackend } from "./backend-http-E7YU0qhn.mjs";
2
2
  //#region src/backend-http/index.d.ts
3
3
  /**
4
4
  * The board at `url`, which keeps the log: this board uses it as this deployment. Without a
@@ -1,2 +1,2 @@
1
- import { t as http } from "./backend-http-Cs-UKpYp.mjs";
1
+ import { t as http } from "./backend-http-F0W6e36G.mjs";
2
2
  export { http };
@@ -1,7 +1,6 @@
1
- import { i as Attachment } from "./schemas-CWxs3ECJ.mjs";
2
- import { t as Actor } from "./folds-CRYY14kc.mjs";
3
- import { $ as Discovery, $t as SyncCodeView, Nt as RegistrationView, Tt as PersonView, Wt as SourceJoin, Z as ChannelView, _t as MatchView, bt as MessageView, ct as InboxEntry, fn as SyncedView, hn as ThreadsPage, ht as LinkedAccount, in as SyncFindView, lt as InboxItem, mn as ThreadView, ot as IdentityView, qt as SourceRead, tn as SyncCopiesView, tt as EventsPage, un as SyncThreadView, xn as UploadTicket, xt as MessagesPage, yt as Me, z as ProfileOption, zt as ScheduleView } from "./provider-C_sj4-GL.mjs";
4
- import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-DmXjVnil.mjs";
1
+ import { t as Actor, x as Attachment } from "./folds-jS9wlh9_.mjs";
2
+ import { A as InboxItem, B as Me, D as IdentityView, Ft as ThreadView, H as MessagesPage, Ht as UploadTicket, I as LinkedAccount, It as ThreadsPage, K as PersonView, Nt as SyncedView, R as MatchView, S as EventsPage, St as SyncCopiesView, Tt as SyncFindView, V as MessageView, b as Discovery, bt as SyncCodeView, dt as SourceJoin, et as RegistrationView, jt as SyncThreadView, k as InboxEntry, mt as SourceRead, o as ProfileOption, ot as ScheduleView, v as ChannelView } from "./client-xLxeDz0f.mjs";
3
+ import { i as Caller, n as BackendRoute, r as BoardBinding } from "./backend-ZKYTe3xa.mjs";
5
4
  //#region src/server/backend-vercel.d.ts
6
5
  type VercelOptions = {
7
6
  /** The team whose board it is: its ID (`team_…`) or its slug. In Node, by default your deployment's, or `VERCEL_ORG_ID`. */
@@ -1,8 +1,8 @@
1
1
  import { _ as RemoteWatcherId } from "./schemas-Be08nyfW.mjs";
2
- import { O as RegisterBody, a as METHODS, d as VERSION, n as compileWatcher, t as canonicalWatchers } from "./watchers-hash-C4CJg7K1.mjs";
2
+ import { O as RegisterBody, a as METHODS, d as VERSION, n as compileWatcher, t as canonicalWatchers } from "./watchers-hash-BfDPW95j.mjs";
3
3
  import { a as sha256, n as derivedId } from "./ids-C6AYo1bu.mjs";
4
- import { a as forbidden, o as json, s as notFound, t as HttpError } from "./errors-Bven0k29.mjs";
5
- import { a as wakePath, i as registrant, n as callerProfile, t as PROJECTS_OWN } from "./backend-http-BJ7AdK0c.mjs";
4
+ import { a as forbidden, o as json, s as notFound, t as HttpError } from "./errors-CusN4x2l.mjs";
5
+ import { a as wakePath, i as registrant, n as callerProfile, t as PROJECTS_OWN } from "./backend-http-BB0Gld6Q.mjs";
6
6
  //#region src/server/backend-vercel.ts
7
7
  const PROFILE = /^[A-Za-z][A-Za-z0-9-]{0,31}$/;
8
8
  const SESSION = /^[A-Za-z0-9_.:-]{1,128}$/;
@@ -1,6 +1,6 @@
1
- import { t as HttpError } from "./errors-Bven0k29.mjs";
2
- import { o as vercelLogin, r as environmentProfile, s as vercelProjectFile } from "./node-C51_xzCb.mjs";
3
- import { t as createVercel } from "./backend-vercel-CG2SYa03.mjs";
1
+ import { t as HttpError } from "./errors-CusN4x2l.mjs";
2
+ import { c as vercelLogin, l as vercelProjectFile, o as loginHanded, r as environmentProfile } from "./node-Ybi9E6bO.mjs";
3
+ import { t as createVercel } from "./backend-vercel-CtB46vMQ.mjs";
4
4
  import { readFile } from "node:fs/promises";
5
5
  import { decodeJwt } from "jose";
6
6
  import { getVercelOidcToken } from "@vercel/oidc";
@@ -9,23 +9,39 @@ import { getVercelOidcToken } from "@vercel/oidc";
9
9
  const deployed = () => process.env.VERCEL === "1" || !!process.env.VERCEL_OIDC_TOKEN;
10
10
  /**
11
11
  * A token Vercel's API takes: `VERCEL_TOKEN`, this deployment's OIDC token, or your Vercel login,
12
- * the one the Vercel CLI hands a CLI it runs (`VERCEL_AUTH_TOKEN`) or your `vercel login`.
12
+ * the one the CLI that runs board's hands it (`vercel board`'s) or your `vercel login`.
13
13
  */
14
14
  async function token() {
15
15
  if (process.env.VERCEL_TOKEN) return process.env.VERCEL_TOKEN;
16
16
  if (deployed()) return getVercelOidcToken();
17
17
  return vercelLogin().catch(() => {
18
- throw new HttpError(401, "not_logged_in", "not signed in to Vercel: run `vercel login`");
18
+ throw new HttpError(401, "not_logged_in", "You're not logged in to Vercel.", {
19
+ hint: "Run vercel login.",
20
+ origin: "handle"
21
+ });
19
22
  });
20
23
  }
21
24
  /** Where `token` comes from, in words: what `vb whoami` says. */
22
25
  function credentialSource() {
23
26
  if (process.env.VERCEL_TOKEN) return "VERCEL_TOKEN";
24
27
  if (deployed()) return "Vercel OIDC";
25
- return process.env.VERCEL_AUTH_TOKEN ? "the Vercel CLI" : "vercel login";
28
+ return loginHanded() ? "the Vercel CLI" : "vercel login";
29
+ }
30
+ /** The team a CLI that runs board's resolves itself (`vercel board`'s), while one does. */
31
+ let handed = null;
32
+ /**
33
+ * Hands board the team to use when nothing names one (`--scope` still wins), resolved as the app
34
+ * resolves its own and asked for only when a request needs it. Null takes it back.
35
+ */
36
+ function handTeam(resolve) {
37
+ handed = resolve;
26
38
  }
27
- /** The team: `VERCEL_ORG_ID`, the one the deployment's OIDC token names, or the linked project's (the nearest `.vercel/project.json`). */
39
+ /**
40
+ * The team: the one a CLI that runs board's hands it, `VERCEL_ORG_ID`, the one the deployment's OIDC
41
+ * token names, or the linked project's (the nearest `.vercel/project.json`).
42
+ */
28
43
  async function team() {
44
+ if (handed) return handed();
29
45
  if (process.env.VERCEL_ORG_ID) return process.env.VERCEL_ORG_ID;
30
46
  if (!process.env.VERCEL_TOKEN && deployed()) try {
31
47
  const owner = decodeJwt(await getVercelOidcToken()).owner_id;
@@ -60,4 +76,4 @@ function vercel(options = {}) {
60
76
  return createVercel(options, environment);
61
77
  }
62
78
  //#endregion
63
- export { vercel as n, credentialSource as t };
79
+ export { handTeam as n, vercel as r, credentialSource as t };
@@ -1,4 +1,4 @@
1
- import { n as VercelOptions, t as VercelBackend } from "./backend-vercel-CED673bx.mjs";
1
+ import { n as VercelOptions, t as VercelBackend } from "./backend-vercel-CIRObA0t.mjs";
2
2
  //#region src/backend-vercel/index.default.d.ts
3
3
  /**
4
4
  * Your team's board, in Vercel's API. Outside Node there's no environment to find credentials or
@@ -1,4 +1,4 @@
1
- import { t as createVercel } from "./backend-vercel-CG2SYa03.mjs";
1
+ import { t as createVercel } from "./backend-vercel-CtB46vMQ.mjs";
2
2
  //#region src/backend-vercel/index.default.ts
3
3
  /**
4
4
  * Your team's board, in Vercel's API. Outside Node there's no environment to find credentials or
@@ -1,7 +1,12 @@
1
- import { n as VercelOptions, t as VercelBackend } from "./backend-vercel-CED673bx.mjs";
1
+ import { n as VercelOptions, t as VercelBackend } from "./backend-vercel-CIRObA0t.mjs";
2
2
  //#region src/backend-vercel/index.d.ts
3
3
  /** Where `token` comes from, in words: what `vb whoami` says. */
4
4
  export declare function credentialSource(): string;
5
+ /**
6
+ * Hands board the team to use when nothing names one (`--scope` still wins), resolved as the app
7
+ * resolves its own and asked for only when a request needs it. Null takes it back.
8
+ */
9
+ export declare function handTeam(resolve: (() => Promise<string | null>) | null): void;
5
10
  /**
6
11
  * Your team's board, in Vercel's API: this board keeps nothing, and reads and writes that one as
7
12
  * this deployment's project, or as you. Without `board`, the team's board; without `fetch`, it
@@ -1,2 +1,2 @@
1
- import { n as vercel, t as credentialSource } from "./backend-vercel-B0Q0K0O5.mjs";
2
- export { credentialSource, vercel };
1
+ import { n as handTeam, r as vercel, t as credentialSource } from "./backend-vercel-DUWIcFi9.mjs";
2
+ export { credentialSource, handTeam, vercel };
@@ -1,4 +1,5 @@
1
- import "./schemas-CWxs3ECJ.mjs";
1
+ import "./folds-jS9wlh9_.mjs";
2
+ import "./errors-CB4tnZGz.mjs";
2
3
  //#region src/server/blob.d.ts
3
4
  /**
4
5
  * Where attachments' bytes live. The board writes each file once, under a key
@@ -1,5 +1,6 @@
1
- import { d as ExternalFile, f as ExternalLink, l as ExternalAuthor, t as Actor } from "./folds-CRYY14kc.mjs";
2
- import { M as SyncRoot, O as ProviderEvent, Wt as SourceJoin, a as ProviderOptions, c as ReceivedEvent, d as ResolvedTarget, i as ProviderFile, n as FileDelivery, o as ProviderPost, p as SyncProvider, qt as SourceRead, r as ProviderDelivery, s as Receive, t as FetchedLink, y as SyncFn } from "./provider-C_sj4-GL.mjs";
1
+ import { d as ExternalFile, f as ExternalLink, l as ExternalAuthor, t as Actor } from "./folds-jS9wlh9_.mjs";
2
+ import { dt as SourceJoin, mt as SourceRead } from "./client-xLxeDz0f.mjs";
3
+ import { M as SyncRoot, O as ProviderEvent, a as ProviderOptions, c as ReceivedEvent, d as ResolvedTarget, i as ProviderFile, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, t as FetchedLink, y as SyncFn } from "./provider-Cdg1qadh.mjs";
3
4
  import { Adapter, Author, FileUpload, Message, ReactionEvent } from "chat";
4
5
  //#region src/sync/types.d.ts
5
6
  declare function externalAuthor(platform: string, author: Author): ExternalAuthor;
@@ -1,2 +1,2 @@
1
- import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-D0wXq6CY.mjs";
1
+ import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-D6gvrOh3.mjs";
2
2
  export { CliArgument, CliCommand, CliExample, CliOption, OptionName, commands, filters, globalOptions, groups, option, options, usage };
@@ -1,2 +1,2 @@
1
- import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-BtL4jFq8.mjs";
1
+ import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-nEG47RM_.mjs";
2
2
  export { commands, filters, globalOptions, groups, option, options, usage };
@@ -1,5 +1,5 @@
1
- import { d as Board } from "./backend-DmXjVnil.mjs";
2
- import "./index-k2LfZxl-.mjs";
1
+ import { d as Board } from "./backend-ZKYTe3xa.mjs";
2
+ import "./index-C05it0mC.mjs";
3
3
  //#region src/cli/failure.d.ts
4
4
  /**
5
5
  * What kind of failure it is, which fixes the exit code: 2 for `usage` and `missing_input`, 124
@@ -60,7 +60,9 @@ export declare function commandWord(argv: string[]): string | undefined;
60
60
  *
61
61
  * A failure goes to `onError`, with whether the run asked for `--json`, to show as the app shows
62
62
  * its own, and a warning to `onWarning` (with `--json`, it's in the result). Without them, the CLI
63
- * prints its own on stderr.
63
+ * prints its own on stderr. `login` is the app's Vercel login and `team` the team it resolves
64
+ * (`--scope` still wins): board asks for each only when a request needs it, so help, a typo, or
65
+ * misuse never refreshes a login or looks a team up.
64
66
  */
65
67
  export declare function createApp(options: {
66
68
  appName: string;
@@ -68,6 +70,8 @@ export declare function createApp(options: {
68
70
  json: boolean;
69
71
  }) => void;
70
72
  onWarning?: (warning: Warning) => void;
73
+ login?: () => Promise<string>;
74
+ team?: () => Promise<string | null>;
71
75
  }): {
72
76
  run(args: string[]): Promise<number>;
73
77
  };
@@ -1,4 +1,4 @@
1
- import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-BNkywL2P.mjs";
1
+ import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-BuahKR16.mjs";
2
2
  //#region src/cli/embedded.ts
3
3
  /**
4
4
  * Board's CLI as `appName` names it in help, usage, and errors (`vercel board`). With no board
@@ -9,16 +9,20 @@ import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure,
9
9
  *
10
10
  * A failure goes to `onError`, with whether the run asked for `--json`, to show as the app shows
11
11
  * its own, and a warning to `onWarning` (with `--json`, it's in the result). Without them, the CLI
12
- * prints its own on stderr.
12
+ * prints its own on stderr. `login` is the app's Vercel login and `team` the team it resolves
13
+ * (`--scope` still wins): board asks for each only when a request needs it, so help, a typo, or
14
+ * misuse never refreshes a login or looks a team up.
13
15
  */
14
16
  function createApp(options) {
15
- const { appName, onError, onWarning } = options;
17
+ const { appName, onError, onWarning, login, team } = options;
16
18
  return { run: (args) => main(args, {
17
19
  name: appName,
18
20
  commands: {},
19
21
  teamBoard: true,
20
22
  ...onError ? { onError } : {},
21
- ...onWarning ? { onWarning } : {}
23
+ ...onWarning ? { onWarning } : {},
24
+ ...login ? { login } : {},
25
+ ...team ? { team } : {}
22
26
  }) };
23
27
  }
24
28
  const lacking = (what, option) => async () => {
package/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as ATTACHMENT_BYTES_MAX } from "./files-SniSmeEr.mjs";
3
3
  import "./schemas-Be08nyfW.mjs";
4
- import { a as option } from "./commands-BtL4jFq8.mjs";
5
- import { a as projectDir } from "./node-C51_xzCb.mjs";
6
- import { r as main, u as who } from "./main-BNkywL2P.mjs";
4
+ import { a as option } from "./commands-nEG47RM_.mjs";
5
+ import { s as projectDir } from "./node-Ybi9E6bO.mjs";
6
+ import { r as main, u as who } from "./main-BuahKR16.mjs";
7
7
  import { randomBytes, timingSafeEqual } from "node:crypto";
8
8
  import { appendFile, readFile } from "node:fs/promises";
9
9
  import { join } from "node:path";
@@ -661,7 +661,7 @@ const local = {
661
661
  if (args.length > 0) throw usage("serve takes no arguments: pass its port with --port, and its directory with --dir.");
662
662
  const port = portFlag();
663
663
  const root = projectDir();
664
- const { localHandle, serveLocal } = await import("./serve-DYQ64Q5R.mjs");
664
+ const { localHandle, serveLocal } = await import("./serve-BbHEQk_Y.mjs");
665
665
  const handle = flags.handle ?? process.env.BOARD_HANDLE;
666
666
  const local = await serveLocal({
667
667
  dir: flags.dir ?? join(root, ".board"),
@@ -40,21 +40,30 @@ async function* parseSse(body, signal) {
40
40
  //#endregion
41
41
  //#region src/client/client.ts
42
42
  /**
43
- * What went wrong: `message` says what and why, `code` is what to branch on, and `hint`, when the
44
- * handle knows one, says what fixes it (`Set VERCEL_AUTOMATION_BYPASS_SECRET…`).
43
+ * What went wrong: `message` says what and why, `code` is what to branch on, `hint`, when there's
44
+ * one, what fixes it, and `origin` who said so. Trust a `board` one's message and hint as you would
45
+ * the board.
45
46
  */
46
47
  var BoardError = class extends Error {
47
48
  code;
48
49
  status;
49
50
  hint;
51
+ origin;
50
52
  constructor(code, message, status, options = {}) {
51
53
  super(message);
52
54
  this.name = "BoardError";
53
55
  this.code = code;
54
56
  this.status = status;
55
57
  this.hint = options.hint;
58
+ this.origin = options.origin ?? "handle";
56
59
  }
57
60
  };
61
+ /**
62
+ * The responses, made in this process, that carry an error the handle raised: a handle's request
63
+ * to a board in this process keeps its errors the handle's on the way back. Nothing a board sends
64
+ * can be one.
65
+ */
66
+ const handleErrors = /* @__PURE__ */ new WeakSet();
58
67
  const resolve = async (value) => typeof value === "function" ? await value() : value;
59
68
  const scheduleBody = (input) => {
60
69
  const { at, until, ...rest } = messageBody(input);
@@ -388,9 +397,12 @@ function createBoardClient(options) {
388
397
  async function toError(response) {
389
398
  try {
390
399
  const body = await response.json();
391
- if (body.error?.message) return new BoardError(body.error.code ?? "error", body.error.message, response.status, typeof body.error.hint === "string" ? { hint: body.error.hint } : {});
400
+ if (body.error?.message) return new BoardError(body.error.code ?? "error", body.error.message, response.status, {
401
+ ...typeof body.error.hint === "string" ? { hint: body.error.hint } : {},
402
+ origin: handleErrors.has(response) ? "handle" : "board"
403
+ });
392
404
  } catch {}
393
405
  return new BoardError("http_error", `The board answered ${`${response.status} ${response.statusText}`.trim()}.`, response.status);
394
406
  }
395
407
  //#endregion
396
- export { createBoardClient as n, duration as r, BoardError as t };
408
+ export { handleErrors as i, createBoardClient as n, duration as r, BoardError as t };