@vercel/board 0.36.0 → 0.37.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 (70) hide show
  1. package/dist/access.d.mts +2 -2
  2. package/dist/access.mjs +1 -1
  3. package/dist/{actors-DFOpTw89.mjs → actors-uoD62kiN.mjs} +1 -0
  4. package/dist/{auth-C21V0EK1.d.mts → auth-BHXgi696.d.mts} +1 -1
  5. package/dist/{backend-D21q8mdm.d.mts → backend-BIvl2z1z.d.mts} +3 -9
  6. package/dist/backend-local.d.mts +1 -1
  7. package/dist/backend-local.mjs +1 -1
  8. package/dist/{chat-provider-Bb-jeJLY.mjs → chat-provider-C0WUS3-G.mjs} +1 -1
  9. package/dist/{chat-provider-DmZCmBkb.d.mts → chat-provider-DFYEReZL.d.mts} +2 -2
  10. package/dist/cli-commands.mjs +1 -1
  11. package/dist/cli-embedded.d.mts +18 -2
  12. package/dist/cli-embedded.mjs +22 -4
  13. package/dist/cli.mjs +50 -676
  14. package/dist/{commands-BLtqSwha.mjs → commands-D2pFCMSh.mjs} +11 -0
  15. package/dist/{conformance-CKrwglzA.mjs → conformance-rCrc_mwi.mjs} +2 -3
  16. package/dist/conformance.d.mts +1 -1
  17. package/dist/conformance.mjs +1 -1
  18. package/dist/digest-CLGw7653.mjs +4 -0
  19. package/dist/{engine-B_prP0b8.mjs → engine-COa73McY.mjs} +16 -12
  20. package/dist/{events-AEKh9tJm.mjs → events-v8f7pF9f.mjs} +21 -7
  21. package/dist/exports-Bb0m03fT.d.mts +4 -0
  22. package/dist/{exports-Ck4Xu3OV.mjs → exports-DTezg4xR.mjs} +728 -171
  23. package/dist/{index-LREsSZb2.d.mts → index-B1TZrMMu.d.mts} +2 -2
  24. package/dist/index.d.mts +5 -5
  25. package/dist/index.mjs +3 -3
  26. package/dist/index.node.d.mts +5 -5
  27. package/dist/index.node.mjs +2 -2
  28. package/dist/inspect/app.js +35 -35
  29. package/dist/inspect/engine.js +5 -5
  30. package/dist/inspect-B8c0Wh5Z.mjs +2 -0
  31. package/dist/inspect-CoFk2Xj7.mjs +643 -0
  32. package/dist/{local-DJ_qI9q7.mjs → local-Cm7a7_Q0.mjs} +10 -65
  33. package/dist/{main-Jz4nbNJi.mjs → main-DoZ8IFPb.mjs} +9 -7
  34. package/dist/{middleware-BxgizazV.mjs → middleware-k_XKQ6f7.mjs} +9 -1
  35. package/dist/page-BAQpb-s-.mjs +2 -0
  36. package/dist/page-LysMGAl3.mjs +30 -0
  37. package/dist/{provider-DEOfc4Ls.d.mts → provider-7pOnK8Jw.d.mts} +5 -3
  38. package/dist/{routes-BpKdMvgX.d.mts → routes-BtsZzal-.d.mts} +0 -17
  39. package/dist/{serve-Puf3I-oI.mjs → serve-2U_JPJtS.mjs} +2 -2
  40. package/dist/{server-CS-1aeTl.mjs → server-Drul_uwj.mjs} +18 -10
  41. package/dist/sync-chat-sdk.d.mts +2 -2
  42. package/dist/sync-chat-sdk.mjs +2 -2
  43. package/dist/sync-github.d.mts +2 -2
  44. package/dist/sync-github.mjs +2 -2
  45. package/dist/sync-linear.d.mts +3 -3
  46. package/dist/sync-linear.mjs +2 -2
  47. package/dist/sync-slack.d.mts +3 -3
  48. package/dist/sync-slack.mjs +2 -2
  49. package/dist/sync.d.mts +2 -2
  50. package/dist/sync.mjs +1 -1
  51. package/dist/{targets-Dk_xgS9q.mjs → targets-B0D4tJDY.mjs} +63 -18
  52. package/docs/01-board/01-mounting.md +11 -8
  53. package/docs/01-board/03-identity.md +2 -1
  54. package/docs/01-board/06-watchers.md +71 -40
  55. package/docs/01-quickstart.md +1 -1
  56. package/docs/02-sync/01-overview.md +7 -7
  57. package/docs/02-sync/02-functions.md +5 -8
  58. package/docs/02-sync/03-slack.md +0 -8
  59. package/docs/02-sync/04-github.md +0 -8
  60. package/docs/02-sync/07-linear.md +0 -6
  61. package/docs/03-guides/01-coding-agents.md +1 -0
  62. package/docs/03-guides/02-inspector.md +3 -2
  63. package/docs/03-guides/04-triage.md +8 -13
  64. package/docs/04-reference/01-cli.md +28 -4
  65. package/docs/04-reference/03-http.md +1 -1
  66. package/docs/04-reference/05-conformance.md +1 -1
  67. package/docs/index.md +3 -10
  68. package/package.json +2 -1
  69. package/dist/attempts-HXcskN1w.mjs +0 -10
  70. package/dist/exports-BxljH73E.d.mts +0 -4
@@ -1,17 +1,16 @@
1
1
  import { a as forbidden$1, c as toErrorResponse, f as duration, g as fileName, h as IMPORT_BYTES_MAX, i as duplicateId, l as unauthorized, m as DIRECT_UPLOAD_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as mediaType } from "./errors-rYDxZEuN.mjs";
2
2
  import { _ as actorKind, a as ChannelPath, c as LabelKey, f as MessageId, g as SeenActorKind, h as SCOPE_MAX, i as Author, m as RemoteWatcherId, n as Attachment, o as Emoji, p as MessageText, s as Handle, t as ActorId, u as Labels, v as platformAvatar, y as storable } from "./schemas-BG205xds.mjs";
3
3
  import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-BA2aCC_3.mjs";
4
- import { a as compileWatcher, c as METHODS, h as VERSION, i as canonicalWatchers, m as SYNC, n as syncTarget, o as hasCriteria, r as withEmailMentions } from "./targets-Dk_xgS9q.mjs";
5
- import { i as waitUntil, n as MIDDLEWARE_ACTOR, o as derivedId, s as isKeyIdOf, t as DroppedError } from "./middleware-BxgizazV.mjs";
4
+ import { a as runMatch, g as VERSION, h as SYNC, i as canonicalWatchers, l as METHODS, n as syncTarget, o as compileWatcher, r as withEmailMentions, s as hasCriteria } from "./targets-B0D4tJDY.mjs";
5
+ import { a as waitUntil, c as isKeyIdOf, n as MIDDLEWARE_ACTOR, s as derivedId, t as DroppedError } from "./middleware-k_XKQ6f7.mjs";
6
6
  import { a as checkGrantChange, d as scopeOf, i as authorize, s as compileAccess, t as FULL_ACCESS, u as parseScope } from "./access-BsP0hvcC.mjs";
7
7
  import { C as workflowPath, c as checkGrant, f as grantIssuers, h as joined, l as checkPrincipal, m as issuerName, n as DEFAULT_CAN, o as authenticates, r as GITHUB_ISSUER, s as checkCan, t as BOARD_TOKEN_PREFIX, v as removes, w as wroteAs, y as tokenHash } from "./auth-CrjXLgOb.mjs";
8
8
  import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
9
9
  import { n as replaceMentions } from "./mentions-CB6ShY4R.mjs";
10
- import { a as resolveMentions, n as actorSeen } from "./actors-DFOpTw89.mjs";
10
+ import { a as resolveMentions, n as actorSeen } from "./actors-uoD62kiN.mjs";
11
11
  import { C as sessionClearedError, a as SOCKET_TIMINGS, c as drainSettledHooks, d as nullProtoRecord, f as runtimeConsumerFactory, g as A2Error, h as stateTailReaders, i as RESERVED_PARTICIPANT_IDS, l as failedPreviousAttempt, m as serverInternals, n as POLL_TIMINGS, o as STATE_CACHE, p as runtimeConsumers, r as PRESENCE_TIMINGS, s as STREAM_TIMINGS, t as DRAIN_TIMINGS, u as markSchedulerSendFailure, v as NonRetriableError, x as isSessionCleared, y as asStoreUnavailable } from "./internal-CvsrprnU-CEPOUpAv.mjs";
12
12
  import { i as streamActivities, n as defaultSleep, t as createStreamActivity } from "./store-polling-BZt2Rf3D-oh3aU_An.mjs";
13
13
  import { a as foldActors, i as concernedMessageId, o as foldMessages, s as iso, t as TABLES_CONSUMER } from "./sql-aetuEBZC.mjs";
14
- import { t as afterRetry } from "./attempts-HXcskN1w.mjs";
15
14
  import { z } from "zod";
16
15
  import { createHash, randomBytes } from "node:crypto";
17
16
  import { mkdir, readFile, writeFile } from "node:fs/promises";
@@ -4114,11 +4113,8 @@ const StoredPrincipal = z.object({
4114
4113
  /** The board token it came with: what it stores stops when the token does. */
4115
4114
  token: z.string().min(1).max(64).optional()
4116
4115
  });
4117
- /** A watcher as a board on `http()` registers it: its tail, and when it runs. */
4118
- const WatcherSpec = z.object({
4119
- tail: z.string().max(1e3),
4120
- when: z.enum(["matches", "enters"])
4121
- });
4116
+ /** A watcher as a board on `http()` registers it: its tail. */
4117
+ const WatcherSpec = z.object({ tail: z.string().max(1e3) });
4122
4118
  /**
4123
4119
  * Watchers that boards on `http()` registered with this one, outside the board
4124
4120
  * log: one session, `registry`. Each principal has one registration, and its
@@ -6398,10 +6394,7 @@ function watchersHash(watch, sync = []) {
6398
6394
  function foldRegistry(state, event) {
6399
6395
  if (event.type === "watchers.registered") {
6400
6396
  const { owner, principal, url, watch, sync, hash } = event.payload;
6401
- const copied = Object.fromEntries(Object.entries(watch).map(([id, spec]) => [id, {
6402
- tail: spec.tail,
6403
- when: spec.when
6404
- }]));
6397
+ const copied = Object.fromEntries(Object.entries(watch).map(([id, spec]) => [id, { tail: spec.tail }]));
6405
6398
  state.byOwner[owner] = {
6406
6399
  owner,
6407
6400
  principal: structuredClone(principal),
@@ -7030,7 +7023,7 @@ const queueReducer = reducer({
7030
7023
  unreachable: null
7031
7024
  }
7032
7025
  }).fold(foldQueue);
7033
- const describe$1 = (error) => ((error instanceof Error ? error.message : String(error)) || "unknown error").slice(0, 500);
7026
+ const describe = (error) => ((error instanceof Error ? error.message : String(error)) || "unknown error").slice(0, 500);
7034
7027
  /**
7035
7028
  * Whether `access` may see `event` now, as it was matched: a message's channel, or every channel for
7036
7029
  * none. Sync's queue gets what its registrant may sync, since it speaks for platform users there.
@@ -7251,7 +7244,7 @@ function failure(found, error) {
7251
7244
  payload: {
7252
7245
  matched: found.id,
7253
7246
  thread: found.thread,
7254
- error: describe$1(error)
7247
+ error: describe(error)
7255
7248
  }
7256
7249
  };
7257
7250
  }
@@ -7288,48 +7281,8 @@ const SYNCED = /* @__PURE__ */ new Set([
7288
7281
  ]);
7289
7282
  /** Whether a match waits in a registrant's queue for it to pull, as opposed to a config watcher's, which runs here. */
7290
7283
  const queued = (payload) => payload.watcher !== void 0 || payload.sync === true || payload.inbox !== void 0;
7291
- /**
7292
- * A2 dead-letters an event after 10 failures, and a dead letter stops its
7293
- * lane, which is the thread's: the watcher would never run on that thread
7294
- * again. So `run` gets a few tries, then the failure is recorded and the
7295
- * thread moves on.
7296
- */
7297
- const RUN_ATTEMPTS = 5;
7298
- /**
7299
- * A run that's killed (a timeout, out of memory) never throws. A2 counts it
7300
- * toward the 10 failures when the next attempt takes over, and dead-letters
7301
- * the event at that takeover instead of running it: the 10th attempt is the
7302
- * last one a watcher sees. Throws give up at RUN_ATTEMPTS, so getting this far
7303
- * means runs keep dying, and the 10th records the failure without running.
7304
- */
7305
- const KILLED_ATTEMPTS = 10;
7306
7284
  /** Tries at a wake-up before it's left to the next match or sweep, well short of A2's dead letter. */
7307
7285
  const WAKE_TRIES = 3;
7308
- const describe = (error) => ((error instanceof Error ? error.message : String(error)) || "unknown error").slice(0, 500);
7309
- /**
7310
- * One match, on its thread's lane: `run`, retried by A2 while it fails, then
7311
- * given up on (recorded as `watch.failed`) so the thread's next event runs.
7312
- */
7313
- async function runMatch(input) {
7314
- const { watcher, match, attempt } = input;
7315
- const event = match.payload.event;
7316
- const giveUp = async (error) => {
7317
- console.error(`[board] watcher ${watcher.id} gave up on event #${event.cursor} after ${attempt} tries:`, error);
7318
- await input.record({
7319
- matched: match.id,
7320
- thread: match.payload.thread,
7321
- error
7322
- });
7323
- };
7324
- const early = !afterRetry(attempt);
7325
- if (early && attempt >= KILLED_ATTEMPTS) return giveUp(`its run was cut short ${attempt - 1} times (a timeout, or out of memory)`);
7326
- try {
7327
- await watcher.run(event);
7328
- } catch (error) {
7329
- if (!early || attempt < RUN_ATTEMPTS) throw error;
7330
- await giveUp(describe(error));
7331
- }
7332
- }
7333
7286
  /** A watcher writes as `board:watch:<id>`, and its own writes never wake it. */
7334
7287
  const actorOf = (id) => `board:watch:${id}`;
7335
7288
  /** `watch:@<principal>`: everything one registrant's watchers matched, queued for it to pull. */
@@ -7499,7 +7452,7 @@ function createWatchers(options) {
7499
7452
  messages,
7500
7453
  access
7501
7454
  });
7502
- if (watcher.enters ? !entered(match, before, after, messages) : !(watcher.criteria ? match(before) || match(after) : id !== null)) continue;
7455
+ if (!(watcher.criteria ? match(before) || match(after) : id !== null)) continue;
7503
7456
  const key = registration ? `@${registration.owner}/${watcher.id}` : watcher.id;
7504
7457
  const shown = registration ? eventView(event, after, actors, await reads.reader(access, after ? [after] : [])) : view$1 ??= eventView(event, after, actors, OWN_CODE);
7505
7458
  add(registration ? registrantSession(registration.owner) : watchSession(watcher.id), {
@@ -7554,11 +7507,6 @@ function createWatchers(options) {
7554
7507
  if (!reads) throw new Error("watchers used before the board bound them");
7555
7508
  return loadBefore(reads, event, signal);
7556
7509
  }
7557
- /** Didn't match before and does now; a new reply only counts if its thread wasn't already in view. */
7558
- function entered(match, before, after, messages) {
7559
- if (match(before) || !match(after)) return false;
7560
- return !match(before === void 0 && after.re !== null ? messages.byId[after.re] : void 0);
7561
- }
7562
7510
  return {
7563
7511
  server,
7564
7512
  boardConsumer: consumer({
@@ -7820,10 +7768,7 @@ function build(options, binding) {
7820
7768
  let ownHandle = null;
7821
7769
  const post = options.transport?.post ?? publicPost;
7822
7770
  const watchers = createWatchers({
7823
- watch: Object.fromEntries(Object.entries(binding.subscriptions).flatMap(([id, subscription]) => subscription.kind === "tail" ? [[id, {
7824
- tail: subscription.tail,
7825
- when: subscription.when
7826
- }]] : [])),
7771
+ watch: Object.fromEntries(Object.entries(binding.subscriptions).flatMap(([id, subscription]) => subscription.kind === "tail" ? [[id, { tail: subscription.tail }]] : [])),
7827
7772
  run: (id, event, trigger, attempt) => binding.run(id, event, {
7828
7773
  trigger,
7829
7774
  attempt
@@ -1,12 +1,12 @@
1
1
  import { _ as fileSize, m as DIRECT_UPLOAD_BYTES_MAX, u as BoardError } from "./errors-rYDxZEuN.mjs";
2
2
  import { d as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-BG205xds.mjs";
3
- import { h as VERSION, s as withMentions } from "./targets-Dk_xgS9q.mjs";
3
+ import { c as withMentions, g as VERSION } from "./targets-B0D4tJDY.mjs";
4
4
  import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
5
5
  import { r as PERMISSIONS, u as parseScope } from "./access-BsP0hvcC.mjs";
6
- import { i as isApiMessageId, n as isBoardName } from "./exports-Ck4Xu3OV.mjs";
7
- import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-BLtqSwha.mjs";
8
- import { a as http, c as handFetch, f as vercelProjectFile, i as vercel, l as handLogin, n as credentialSource, o as boardUrl, r as handTeam, s as connect, t as board } from "./server-CS-1aeTl.mjs";
9
- import { t as conformance } from "./conformance-CKrwglzA.mjs";
6
+ import { i as isApiMessageId, n as isBoardName } from "./exports-DTezg4xR.mjs";
7
+ import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-D2pFCMSh.mjs";
8
+ import { a as http, c as handFetch, f as vercelProjectFile, i as vercel, l as handLogin, n as credentialSource, o as boardUrl, r as handTeam, s as connect, t as board } from "./server-Drul_uwj.mjs";
9
+ import { t as conformance } from "./conformance-rCrc_mwi.mjs";
10
10
  import { t as displayText } from "./bots-CGkO76qH.mjs";
11
11
  import { spawn } from "node:child_process";
12
12
  import { readFile, stat, writeFile } from "node:fs/promises";
@@ -1492,7 +1492,7 @@ function failureOf(error) {
1492
1492
  }]);
1493
1493
  case "board_name_taken": return own("conflict", "board_name_taken");
1494
1494
  case "board_not_granted": return own("permission", "board_not_granted");
1495
- case "board_token_unsupported": return own("permission", "board_token_unsupported");
1495
+ case "watchers_need_project": return own("permission", "watchers_need_project");
1496
1496
  case "board_token_scope": return own("permission", "board_token_scope");
1497
1497
  case "invalid_board_name": return own("usage", "invalid_arguments", [helpRecovery()]);
1498
1498
  case "too_many_redirects": return own("network", "network_error");
@@ -2404,6 +2404,7 @@ async function run(command, args) {
2404
2404
  else out(formatEvent(event));
2405
2405
  return 0;
2406
2406
  }
2407
+ case "inspect": return (await import("./inspect-B8c0Wh5Z.mjs")).inspect(context());
2407
2408
  default: {
2408
2409
  const own = app.commands[command];
2409
2410
  if (own) return own.run(args, context());
@@ -2447,7 +2448,8 @@ const context = () => ({
2447
2448
  portFlag,
2448
2449
  connection,
2449
2450
  client,
2450
- openBrowser
2451
+ openBrowser,
2452
+ ...app.inspectorPage ? { inspectorPage: app.inspectorPage } : {}
2451
2453
  });
2452
2454
  /**
2453
2455
  * Runs board's CLI on `argv` (what follows the command name) as `app`, and answers its exit
@@ -41,6 +41,14 @@ function waitUntil(task) {
41
41
  Reflect.get(globalThis, Symbol.for("@vercel/request-context"))?.get?.()?.waitUntil?.(task);
42
42
  } catch {}
43
43
  }
44
+ /**
45
+ * Whether a run comes after a retry from a dead letter. A2 keeps counting
46
+ * `ctx.attempt` across one, and no earlier run sees an attempt past A2_TRIES:
47
+ * the event is dead by then. board gives up early, and records why, only in an
48
+ * event's first tries; a retried one gets A2's fresh tries, and dead-letters
49
+ * again if they all fail.
50
+ */
51
+ const afterRetry = (attempt) => attempt > 10;
44
52
  //#endregion
45
53
  //#region src/server/middleware.ts
46
54
  /** A write the middleware didn't let through: the API answers 422 with what it responded. */
@@ -100,4 +108,4 @@ async function runMiddleware(middleware, input, commit) {
100
108
  return committed.value;
101
109
  }
102
110
  //#endregion
103
- export { DERIVED_ID as a, keyId as c, waitUntil as i, sha256 as l, MIDDLEWARE_ACTOR as n, derivedId as o, runMiddleware as r, isKeyIdOf as s, DroppedError as t };
111
+ export { waitUntil as a, isKeyIdOf as c, afterRetry as i, keyId as l, MIDDLEWARE_ACTOR as n, DERIVED_ID as o, runMiddleware as r, derivedId as s, DroppedError as t, sha256 as u };
@@ -0,0 +1,2 @@
1
+ import { t as page } from "./page-LysMGAl3.mjs";
2
+ export { page };
@@ -0,0 +1,30 @@
1
+ import "./digest-CLGw7653.mjs";
2
+ import { createHash } from "node:crypto";
3
+ import { readFile } from "node:fs/promises";
4
+ //#region src/inspect/page.ts
5
+ /**
6
+ * Next to the CLI in `dist`, or in `dist` when running from source. Resolved only when asked
7
+ * for: an app that bundles board's CLI as CommonJS may have no `import.meta.url`, and then has
8
+ * none of board's files either.
9
+ */
10
+ function files() {
11
+ try {
12
+ return [new URL("./inspect/app.js", import.meta.url), new URL("../../dist/inspect/app.js", import.meta.url)];
13
+ } catch {
14
+ return [];
15
+ }
16
+ }
17
+ /**
18
+ * The page's script where board is installed, or null when there's none beside it. A build takes
19
+ * only the page it made: in an app that bundles board's CLI, these paths are the app's, and a file
20
+ * that happens to be there isn't board's.
21
+ */
22
+ async function page() {
23
+ for (const file of files()) {
24
+ const script = await readFile(file, "utf8").catch(() => null);
25
+ if (script !== null && createHash("sha256").update(script).digest("hex") === "4f1478124855783385e763c2cc87539b5299c8c9c0325f1ec65db6b7284f3382") return script;
26
+ }
27
+ return null;
28
+ }
29
+ //#endregion
30
+ export { page as t };
@@ -1,4 +1,4 @@
1
- import { $t as ExternalCopy, C as InboxItem, Ct as ThreadsPage, Dt as TokenInput, F as MessagesPage, J as RegistrationView, L as MessagesQueryInput, Mt as UpdateGrantInput, N as Me, Ot as TokenView, P as MessageView, Qt as Actor, S as InboxEntry, St as ThreadView, Tt as ThreadsQueryInput, an as ExternalFile, b as GrantView, bt as SyncedView, d as EventsPage, en as Attachment, et as ScheduleView, ft as SyncFindInput, g as FiltersInput, gt as SyncImportInput, h as Explanation, i as BoardEventView, in as ExternalEvent, it as SourceJoin, j as MatchView, l as Discovery, mt as SyncFindView, nt as SchedulesQueryInput, o as ChannelView, on as ExternalLink, q as RegisterInput, rn as ExternalAuthor, sn as Link, st as SourceRead, vt as SyncReceiptInput, y as GrantInput, yt as SyncThreadView } from "./routes-BpKdMvgX.mjs";
1
+ import { $t as ExternalCopy, C as InboxItem, Ct as ThreadsPage, Dt as TokenInput, F as MessagesPage, J as RegistrationView, L as MessagesQueryInput, Mt as UpdateGrantInput, N as Me, Ot as TokenView, P as MessageView, Qt as Actor, S as InboxEntry, St as ThreadView, Tt as ThreadsQueryInput, an as ExternalFile, b as GrantView, bt as SyncedView, d as EventsPage, en as Attachment, et as ScheduleView, ft as SyncFindInput, g as FiltersInput, gt as SyncImportInput, h as Explanation, i as BoardEventView, in as ExternalEvent, it as SourceJoin, j as MatchView, l as Discovery, mt as SyncFindView, nt as SchedulesQueryInput, o as ChannelView, on as ExternalLink, q as RegisterInput, rn as ExternalAuthor, sn as Link, st as SourceRead, vt as SyncReceiptInput, y as GrantInput, yt as SyncThreadView } from "./routes-BtsZzal-.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/client/client.d.ts
4
4
  /**
@@ -780,8 +780,10 @@ declare function render<E extends ProviderEvent = ProviderEvent>(renderer: Rende
780
780
  * to every channel's function, with `channel` set to that one. A thread the board syncs outside
781
781
  * these channels (someone ran `vb sync` on it) stays synced both ways. A key the platform says
782
782
  * doesn't exist is skipped. While one can't be checked, an event outside the resolved channels
783
- * throws, so it's retried, rather than going past that key's function to the default. A new root
784
- * starts only in the channels that resolved.
783
+ * that it may be (any, for a name; its own, for an ID) throws, so it's retried, rather than
784
+ * going past that key's function to the default. The webhook keeps one an ID may be; one only a
785
+ * name may be, it refuses, so the platform sends it again and nothing off the map is stored. A
786
+ * new root starts only in the channels that resolved.
785
787
  */
786
788
  declare function channels<E extends ProviderEvent = ProviderEvent>(map: Record<string, SyncUnit<E>>): SyncFn<E>;
787
789
  //#endregion
@@ -938,10 +938,6 @@ declare const REGISTERED_WATCHERS_MAX = 32;
938
938
  declare const RegisterBody: z.ZodUnion<readonly [z.ZodObject<{
939
939
  watch: z.ZodRecord<z.ZodString, z.ZodObject<{
940
940
  tail: z.ZodString;
941
- when: z.ZodDefault<z.ZodEnum<{
942
- enters: "enters";
943
- matches: "matches";
944
- }>>;
945
941
  }, z.core.$strip>>;
946
942
  sync: z.ZodOptional<z.ZodArray<z.ZodObject<{
947
943
  key: z.ZodString;
@@ -953,10 +949,6 @@ declare const RegisterBody: z.ZodUnion<readonly [z.ZodObject<{
953
949
  }, z.core.$strip>, z.ZodObject<{
954
950
  watch: z.ZodRecord<z.ZodString, z.ZodObject<{
955
951
  tail: z.ZodString;
956
- when: z.ZodDefault<z.ZodEnum<{
957
- enters: "enters";
958
- matches: "matches";
959
- }>>;
960
952
  }, z.core.$strip>>;
961
953
  sync: z.ZodOptional<z.ZodArray<z.ZodObject<{
962
954
  key: z.ZodString;
@@ -1614,7 +1606,6 @@ type RegistrationView = {
1614
1606
  owner: string;
1615
1607
  watch: Record<string, {
1616
1608
  tail: string;
1617
- when: 'matches' | 'enters';
1618
1609
  }>;
1619
1610
  /** Its sync entries. With any, its sync gets every event it delivers to platforms, as matches of watcher `@sync`. */
1620
1611
  sync: {
@@ -2608,10 +2599,6 @@ declare const routes: {
2608
2599
  readonly body: z.ZodUnion<readonly [z.ZodObject<{
2609
2600
  watch: z.ZodRecord<z.ZodString, z.ZodObject<{
2610
2601
  tail: z.ZodString;
2611
- when: z.ZodDefault<z.ZodEnum<{
2612
- enters: "enters";
2613
- matches: "matches";
2614
- }>>;
2615
2602
  }, z.core.$strip>>;
2616
2603
  sync: z.ZodOptional<z.ZodArray<z.ZodObject<{
2617
2604
  key: z.ZodString;
@@ -2623,10 +2610,6 @@ declare const routes: {
2623
2610
  }, z.core.$strip>, z.ZodObject<{
2624
2611
  watch: z.ZodRecord<z.ZodString, z.ZodObject<{
2625
2612
  tail: z.ZodString;
2626
- when: z.ZodDefault<z.ZodEnum<{
2627
- enters: "enters";
2628
- matches: "matches";
2629
- }>>;
2630
2613
  }, z.core.$strip>>;
2631
2614
  sync: z.ZodOptional<z.ZodArray<z.ZodObject<{
2632
2615
  key: z.ZodString;
@@ -1,7 +1,7 @@
1
1
  import { u as BoardError } from "./errors-rYDxZEuN.mjs";
2
- import { t as board, u as localTokenFile } from "./server-CS-1aeTl.mjs";
2
+ import { t as board, u as localTokenFile } from "./server-Drul_uwj.mjs";
3
3
  import { t as oidcTokens } from "./tokens-Dn4cPZIr.mjs";
4
- import { t as local } from "./local-DJ_qI9q7.mjs";
4
+ import { t as local } from "./local-Cm7a7_Q0.mjs";
5
5
  import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
6
6
  import { userInfo } from "node:os";
7
7
  import { dirname, join, resolve } from "node:path";
@@ -1,8 +1,8 @@
1
1
  import { d as createBoardClient, o as json, t as HttpError, u as BoardError } from "./errors-rYDxZEuN.mjs";
2
2
  import "./schemas-BG205xds.mjs";
3
- import { P as RegisterBody, Y as routes, a as compileWatcher, c as METHODS, i as canonicalWatchers } from "./targets-Dk_xgS9q.mjs";
4
- import { a as DERIVED_ID, c as keyId, l as sha256 } from "./middleware-BxgizazV.mjs";
5
- import { a as registrant, o as wakePath, r as createVercel, t as createBoard } from "./exports-Ck4Xu3OV.mjs";
3
+ import { F as RegisterBody, X as routes, i as canonicalWatchers, l as METHODS, o as compileWatcher } from "./targets-B0D4tJDY.mjs";
4
+ import { l as keyId, o as DERIVED_ID, u as sha256 } from "./middleware-k_XKQ6f7.mjs";
5
+ import { a as registrant, o as wakePath, r as createVercel, t as createBoard } from "./exports-DTezg4xR.mjs";
6
6
  import { execFile } from "node:child_process";
7
7
  import { createHash } from "node:crypto";
8
8
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
@@ -82,9 +82,13 @@ function localToken(url) {
82
82
  return null;
83
83
  }
84
84
  }
85
- /** Claude Code, Codex, and Grok sessions select their own profile, like Just Chat's CLI. */
85
+ /** fx, Claude Code, Codex, and Grok sessions select their own profile, like Just Chat's CLI. */
86
86
  function detectAgent(env = process.env) {
87
87
  const found = [];
88
+ if (env.AI_AGENT?.trim().toLowerCase() === "fx") found.push({
89
+ profile: "fx",
90
+ session: env.FX_SESSION_ID || null
91
+ });
88
92
  if (env.CLAUDECODE === "1" || env.CLAUDE_CODE_SESSION_ID) found.push({
89
93
  profile: "claude",
90
94
  session: env.CLAUDE_CODE_SESSION_ID || null
@@ -340,6 +344,9 @@ function connect(url, options = {}) {
340
344
  const found = await response.json();
341
345
  if (found.audience !== url) throw new BoardError("wrong_audience", `The board at ${url} says its URL is ${shown(found.audience, URL_SHAPE) ?? "another one"}.`, 0, { hint: shown(found.audience, URL_SHAPE) ? `Use ${found.audience}.` : "Use the URL its discovery names." });
342
346
  return found;
347
+ }).catch((error) => {
348
+ discovery = void 0;
349
+ throw error;
343
350
  });
344
351
  let cached = null;
345
352
  let source = null;
@@ -521,6 +528,9 @@ function guarded(url, doFetch, suppliedToken) {
521
528
  looked ??= projectBypass(url, host, doFetch).then(async (found) => {
522
529
  await writeBypass(host, found.secret).catch(() => {});
523
530
  return found;
531
+ }, (error) => {
532
+ looked = void 0;
533
+ throw error;
524
534
  });
525
535
  const { secret: found, created } = await looked;
526
536
  secret = Promise.resolve(found);
@@ -961,10 +971,7 @@ function createHttp(url, options, environment) {
961
971
  }
962
972
  if (!PROFILE.test(id)) throw new Error(`watch ${id}: ${PROFILE_RULE}`);
963
973
  compileWatcher(id, spec);
964
- specs[id] = {
965
- tail: spec.tail,
966
- when: spec.when
967
- };
974
+ specs[id] = { tail: spec.tail };
968
975
  }
969
976
  hash = null;
970
977
  binding = next;
@@ -1067,7 +1074,8 @@ const environment = {
1067
1074
  });
1068
1075
  },
1069
1076
  team,
1070
- profile: environmentProfile
1077
+ profile: environmentProfile,
1078
+ boardToken: () => boardToken() !== null
1071
1079
  };
1072
1080
  /**
1073
1081
  * Your team's board, in Vercel's API: this board keeps nothing, and reads and writes that one as
@@ -1087,7 +1095,7 @@ function vercel(options = {}) {
1087
1095
  function board(options = {}) {
1088
1096
  return createBoard(options, {
1089
1097
  backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
1090
- sync: () => import("./engine-B_prP0b8.mjs"),
1098
+ sync: () => import("./engine-COa73McY.mjs"),
1091
1099
  serving: () => import("./serving-6_bhBNAW.mjs")
1092
1100
  });
1093
1101
  }
@@ -1,5 +1,5 @@
1
- import { b as channels, g as SyncFn, p as SyncProvider } from "./provider-DEOfc4Ls.mjs";
2
- import { r as ChatTransport, t as ChatInput } from "./chat-provider-DmZCmBkb.mjs";
1
+ import { b as channels, g as SyncFn, p as SyncProvider } from "./provider-7pOnK8Jw.mjs";
2
+ import { r as ChatTransport, t as ChatInput } from "./chat-provider-DFYEReZL.mjs";
3
3
  import { z } from "zod";
4
4
  import { ReactionEvent } from "chat";
5
5
  //#region src/sync/chat-sdk.d.ts
@@ -1,5 +1,5 @@
1
- import { f as channels, i as eventSchema, r as envelope } from "./events-AEKh9tJm.mjs";
2
- import { t as ChatSyncProvider } from "./chat-provider-Bb-jeJLY.mjs";
1
+ import { f as channels, i as eventSchema, r as envelope } from "./events-v8f7pF9f.mjs";
2
+ import { t as ChatSyncProvider } from "./chat-provider-C0WUS3-G.mjs";
3
3
  import { createHash } from "node:crypto";
4
4
  //#region src/sync/chat-sdk.ts
5
5
  const schemaOf = (platform) => eventSchema(platform, "message");
@@ -1,5 +1,5 @@
1
- import { f as SyncContext, g as SyncFn, y as SyncUnit } from "./provider-DEOfc4Ls.mjs";
2
- import { n as ChatSyncProvider } from "./chat-provider-DmZCmBkb.mjs";
1
+ import { f as SyncContext, g as SyncFn, y as SyncUnit } from "./provider-7pOnK8Jw.mjs";
2
+ import { n as ChatSyncProvider } from "./chat-provider-DFYEReZL.mjs";
3
3
  import { z } from "zod";
4
4
  import { Adapter } from "chat";
5
5
  //#region src/sync/github.d.ts
@@ -1,5 +1,5 @@
1
- import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-AEKh9tJm.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-Bb-jeJLY.mjs";
1
+ import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-v8f7pF9f.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-C0WUS3-G.mjs";
3
3
  import { n as tagOf } from "./tags-BpFo6q0_.mjs";
4
4
  import { z } from "zod";
5
5
  import { connectGitHubAdapter } from "@vercel/connect/chat";
@@ -1,6 +1,6 @@
1
- import { st as SourceRead } from "./routes-BpKdMvgX.mjs";
2
- import { c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery, y as SyncUnit } from "./provider-DEOfc4Ls.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DmZCmBkb.mjs";
1
+ import { st as SourceRead } from "./routes-BtsZzal-.mjs";
2
+ import { c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery, y as SyncUnit } from "./provider-7pOnK8Jw.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DFYEReZL.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/linear.d.ts
@@ -1,5 +1,5 @@
1
- import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-AEKh9tJm.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-Bb-jeJLY.mjs";
1
+ import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-v8f7pF9f.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-C0WUS3-G.mjs";
3
3
  import { n as tagOf, t as slug } from "./tags-BpFo6q0_.mjs";
4
4
  import "zod";
5
5
  import { connectLinearAdapter } from "@vercel/connect/chat";
@@ -1,6 +1,6 @@
1
- import { on as ExternalLink } from "./routes-BpKdMvgX.mjs";
2
- import { b as channels, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery } from "./provider-DEOfc4Ls.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DmZCmBkb.mjs";
1
+ import { on as ExternalLink } from "./routes-BtsZzal-.mjs";
2
+ import { b as channels, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery } from "./provider-7pOnK8Jw.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DFYEReZL.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/slack.d.ts
@@ -1,7 +1,7 @@
1
1
  import { d as MESSAGE_TEXT_MAX } from "./schemas-BG205xds.mjs";
2
2
  import "./external-BA2aCC_3.mjs";
3
- import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-AEKh9tJm.mjs";
4
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-Bb-jeJLY.mjs";
3
+ import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-v8f7pF9f.mjs";
4
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-C0WUS3-G.mjs";
5
5
  import { z } from "zod";
6
6
  import { stringifyMarkdown } from "chat";
7
7
  import { createSlackAdapter } from "@chat-adapter/slack";
package/dist/sync.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { an as ExternalFile, in as ExternalEvent, rn as ExternalAuthor } from "./routes-BpKdMvgX.mjs";
2
- import { A as envelope, C as render, D as SyncOverrides, E as RootOverride, O as SyncResult, S as mirror, T as ProviderEvent, _ as SyncIn, a as ProviderOptions, b as channels, c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, h as Sync, i as ProviderFile, j as eventSchema, k as SyncRoot, l as RenderInput, m as UnreadableError, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, u as Renderer, v as SyncOut, w as EventBase, x as into, y as SyncUnit } from "./provider-DEOfc4Ls.mjs";
1
+ import { an as ExternalFile, in as ExternalEvent, rn as ExternalAuthor } from "./routes-BtsZzal-.mjs";
2
+ import { A as envelope, C as render, D as SyncOverrides, E as RootOverride, O as SyncResult, S as mirror, T as ProviderEvent, _ as SyncIn, a as ProviderOptions, b as channels, c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, h as Sync, i as ProviderFile, j as eventSchema, k as SyncRoot, l as RenderInput, m as UnreadableError, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, u as Renderer, v as SyncOut, w as EventBase, x as into, y as SyncUnit } from "./provider-7pOnK8Jw.mjs";
3
3
  export { EventBase, type ExternalAuthor, ExternalEvent, type ExternalFile, type FileDelivery, type ProviderDelivery, type ProviderEvent, type ProviderFile, type ProviderOptions, type ProviderPost, type Receive, ReceivedEvent, type RenderInput, type Renderer, ResolvedTarget, type RootOverride, type Sync, type SyncContext, type SyncFn, type SyncIn, type SyncOut, SyncOverrides, SyncProvider, type SyncResult, type SyncRoot, type SyncUnit, UnreadableError, channels, envelope, eventSchema, into, mirror, render };
package/dist/sync.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { n as ExternalEvent } from "./external-BA2aCC_3.mjs";
2
- import { c as SyncProvider, f as channels, h as render, i as eventSchema, l as UnreadableError, m as mirror, n as SyncOverrides, o as ReceivedEvent, p as into, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-AEKh9tJm.mjs";
2
+ import { c as SyncProvider, f as channels, h as render, i as eventSchema, l as UnreadableError, m as mirror, n as SyncOverrides, o as ReceivedEvent, p as into, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-v8f7pF9f.mjs";
3
3
  export { EventBase, ExternalEvent, ReceivedEvent, ResolvedTarget, SyncOverrides, SyncProvider, UnreadableError, channels, envelope, eventSchema, into, mirror, render };