@vercel/board 0.51.1 → 0.53.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 (57) hide show
  1. package/dist/{access-DdojoPZm.mjs → access-Pcar1gwx.mjs} +1 -1
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +4 -4
  4. package/dist/{actors-CDkNgWUL.mjs → actors-XKUrjOfO.mjs} +2 -2
  5. package/dist/{auth-C4VxPLYz.d.mts → auth-BoYunD5t.d.mts} +1 -1
  6. package/dist/{auth-zPqFJocD.mjs → auth-C2CxMl2p.mjs} +2 -2
  7. package/dist/{backend-Da_YEltI.d.mts → backend-DJobr4nr.d.mts} +4 -4
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-BHyX6H8H.d.mts → chat-provider-BSHlV2lw.d.mts} +2 -2
  11. package/dist/cli-embedded.d.mts +32 -3
  12. package/dist/cli-embedded.mjs +4 -2
  13. package/dist/cli.mjs +5 -5
  14. package/dist/{client-C4-r10SA.d.mts → client-oYThy3CR.d.mts} +9 -3
  15. package/dist/{conformance-DW4-9Dwf.mjs → conformance-Cz1Elmgj.mjs} +56 -3
  16. package/dist/conformance.d.mts +1 -1
  17. package/dist/conformance.mjs +1 -1
  18. package/dist/{engine-D8YAsQS_.mjs → engine-506f7GEM.mjs} +2 -2
  19. package/dist/{errors-DbCKqGXp.mjs → errors-Cv0TGBt5.mjs} +7 -1
  20. package/dist/{exports-BFeX9HNn.mjs → exports-CBukc8T3.mjs} +16 -15
  21. package/dist/{exports-BUtR_AHa.d.mts → exports-CF_nUsT5.d.mts} +4 -4
  22. package/dist/{index-BTuTaBaK.d.mts → index-CM2u0wGd.d.mts} +2 -2
  23. package/dist/index.d.mts +5 -5
  24. package/dist/index.mjs +4 -4
  25. package/dist/index.node.d.mts +6 -6
  26. package/dist/index.node.mjs +4 -4
  27. package/dist/inspect/app.js +34 -34
  28. package/dist/{inspect-fOA9UNPD.mjs → inspect-PQsEgXRQ.mjs} +2 -2
  29. package/dist/inspect-SEaGzhvh.mjs +2 -0
  30. package/dist/inspect.d.mts +1 -1
  31. package/dist/inspect.mjs +1 -1
  32. package/dist/{local-DTzfnJAf.mjs → local-CwcmqEoa.mjs} +37 -21
  33. package/dist/{main-Dq6yQxNB.mjs → main-gNAS2WbP.mjs} +79 -20
  34. package/dist/{middleware-iVTNf5Su.mjs → middleware-DXiwepsR.mjs} +1 -1
  35. package/dist/{provider-CGicSMdu.d.mts → provider-WjdBsRLR.d.mts} +2 -2
  36. package/dist/{routes-ChGBn0K3.d.mts → routes-BpvyXQwv.d.mts} +20 -2
  37. package/dist/{routes-C85Sbhtm.mjs → routes-GF5ukHYX.mjs} +24 -4
  38. package/dist/{serve-Bdwok1A9.mjs → serve-Ci5KT11x.mjs} +6 -6
  39. package/dist/{server-DbYDp2Lr.mjs → server-XsbC50nY.mjs} +7 -7
  40. package/dist/{serving-aOQsBok0.mjs → serving-C6Ao7i-7.mjs} +1 -1
  41. package/dist/{shell-CmZylG0M.mjs → shell-BiCBL1w_.mjs} +6 -1
  42. package/dist/sync-chat-sdk.d.mts +2 -2
  43. package/dist/sync-github.d.mts +42 -2
  44. package/dist/sync-github.mjs +88 -6
  45. package/dist/sync-linear.d.mts +3 -3
  46. package/dist/sync-slack.d.mts +3 -3
  47. package/dist/sync.d.mts +2 -2
  48. package/dist/{task-batch-Da6Q_7AK.mjs → task-batch-nqYGszDJ.mjs} +4 -4
  49. package/dist/{tokens-C-T0B1uF.mjs → tokens-tulRtEWx.mjs} +2 -2
  50. package/dist/{version-BltS6V9X.mjs → version-CBjh_ogp.mjs} +1 -1
  51. package/docs/01-board/06-watchers.md +2 -1
  52. package/docs/01-board/11-tasks.md +23 -2
  53. package/docs/02-sync/04-github.md +7 -4
  54. package/docs/04-reference/01-cli.md +54 -0
  55. package/docs/04-reference/02-board.md +11 -6
  56. package/package.json +1 -1
  57. package/dist/inspect-Bd_mBGFt.mjs +0 -2
@@ -1,7 +1,7 @@
1
1
  import { i as ATTACHMENT_BYTES_MAX, r as parseProfileHeader, t as InvalidProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
- import { t as Failed, u as who } from "./main-Dq6yQxNB.mjs";
4
- import { n as relative, r as shell, t as CSP } from "./shell-CmZylG0M.mjs";
3
+ import { t as Failed, u as who } from "./main-gNAS2WbP.mjs";
4
+ import { n as relative, r as shell, t as CSP } from "./shell-BiCBL1w_.mjs";
5
5
  import { t as page } from "./page-7KWSGxyC.mjs";
6
6
  import { randomBytes, timingSafeEqual } from "node:crypto";
7
7
  import { createServer } from "node:http";
@@ -0,0 +1,2 @@
1
+ import { n as inspect } from "./inspect-PQsEgXRQ.mjs";
2
+ export { inspect };
@@ -1,4 +1,4 @@
1
- import { t as BoardClient } from "./client-C4-r10SA.mjs";
1
+ import { t as BoardClient } from "./client-oYThy3CR.mjs";
2
2
  //#region src/inspect/handler.d.ts
3
3
  /** Answers the inspector's requests under `basePath`: `GET`, `POST`, `PATCH`, `PUT`, and `DELETE` alike. */
4
4
  export type InspectorHandler = (request: Request) => Promise<Response>;
package/dist/inspect.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as ATTACHMENT_BYTES_MAX, r as parseProfileHeader, t as InvalidProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
- import { n as relative, r as shell, t as CSP } from "./shell-CmZylG0M.mjs";
3
+ import { n as relative, r as shell, t as CSP } from "./shell-BiCBL1w_.mjs";
4
4
  import { t as page } from "./page-7KWSGxyC.mjs";
5
5
  //#region src/inspect/handler.ts
6
6
  /**
@@ -1,17 +1,17 @@
1
1
  import { a as DIRECT_UPLOAD_BYTES_MAX, d as mediaType, i as ATTACHMENT_BYTES_MAX, o as IMPORT_BYTES_MAX } from "./profile-header-O8wC8yk8.mjs";
2
2
  import { A as actorKind, D as TaskHoldKind, E as TASK_NOTE_MAX, M as platformAvatar, N as storable, O as TaskNote, T as TASK_LABEL, a as CAN_MAX, b as RemoteWatcherId, c as EDITED_HOLD, d as LabelKey, g as MessageText, h as MessageId, i as Author, j as authorView, l as Emoji, n as Attachment, o as CHANNEL_PATTERN_MAX, p as Labels, s as ChannelPath, t as ActorId, u as Handle, v as OPEN_TASK_STATES, x as SeenActorKind } from "./schemas-CUSTEFIy.mjs";
3
3
  import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-DkWafjn-.mjs";
4
- import "./routes-C85Sbhtm.mjs";
5
- import { a as duplicateId, c as notFound, f as BoardError, i as batchTooLarge, l as textTooLong, m as duration, o as forbidden$1, r as badRequest, t as HttpError, u as toErrorResponse } from "./errors-DbCKqGXp.mjs";
6
- import { a as waitUntil, c as platformProfile, d as userIdOf, h as isKeyIdOf, l as shownName, m as derivedId, n as MIDDLEWARE_ACTOR, o as actorParts, s as importedHandle, t as DroppedError } from "./middleware-iVTNf5Su.mjs";
4
+ import "./routes-GF5ukHYX.mjs";
5
+ import { a as duplicateId, c as notFound, f as BoardError, i as batchTooLarge, l as textTooLong, m as duration, o as forbidden$1, r as badRequest, t as HttpError, u as toErrorResponse } from "./errors-Cv0TGBt5.mjs";
6
+ import { a as waitUntil, c as platformProfile, d as userIdOf, h as isKeyIdOf, l as shownName, m as derivedId, n as MIDDLEWARE_ACTOR, o as actorParts, s as importedHandle, t as DroppedError } from "./middleware-DXiwepsR.mjs";
7
7
  import { a as SCHEMA_DESCRIPTION_MAX, c as canonical, d as parseSchemaId, f as schemaId, i as BUILT_IN_SCHEMAS, l as checkDefinition, n as blocksIn, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX, u as isBuiltInName } from "./blocks-CVoBC7ur.mjs";
8
8
  import { a as replaceMentions, i as mentionTerms, n as isEmail, r as mentionTerm, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
9
- import { t as VERSION } from "./version-BltS6V9X.mjs";
10
- import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-DdojoPZm.mjs";
11
- import { _ as SYNC, a as runMatch, g as uploadName, h as carried, i as canonicalWatchers, l as METHODS, n as SYNC_ACTOR, o as compileWatcher, r as syncTarget, s as hasCriteria, t as batchPlan } from "./task-batch-Da6Q_7AK.mjs";
9
+ import { t as VERSION } from "./version-CBjh_ogp.mjs";
10
+ import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-Pcar1gwx.mjs";
11
+ import { _ as SYNC, a as runMatch, g as uploadName, h as carried, i as canonicalWatchers, l as METHODS, n as SYNC_ACTOR, o as compileWatcher, r as syncTarget, s as hasCriteria, t as batchPlan } from "./task-batch-nqYGszDJ.mjs";
12
12
  import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
13
- import { E as wroteAs, T as workflowPath, b as removes, c as checkCan, g as joined, h as issuerName, l as checkGrant, n as GITHUB_ISSUER, p as grantIssuers, s as authenticates, u as checkPrincipal } from "./auth-zPqFJocD.mjs";
14
- import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-CDkNgWUL.mjs";
13
+ import { E as wroteAs, T as workflowPath, b as removes, c as checkCan, g as joined, h as issuerName, l as checkGrant, n as GITHUB_ISSUER, p as grantIssuers, s as authenticates, u as checkPrincipal } from "./auth-C2CxMl2p.mjs";
14
+ import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-XKUrjOfO.mjs";
15
15
  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";
16
16
  import { i as streamActivities, n as defaultSleep, t as createStreamActivity } from "./store-polling-BZt2Rf3D-oh3aU_An.mjs";
17
17
  import { a as foldActors, i as concernedMessageId, o as foldMessages, s as iso, t as TABLES_CONSUMER } from "./sql-D0MqINA6.mjs";
@@ -7898,7 +7898,7 @@ function createTasks(options) {
7898
7898
  const owners = /* @__PURE__ */ new Set([principal.id]);
7899
7899
  for (const value of input.from ?? []) owners.add(ownerFrom(value));
7900
7900
  const seen = seenFor(identity, (await ctx.session.state(actorsReducer)).state);
7901
- const token = newToken();
7901
+ const token = input.token ?? newToken();
7902
7902
  const read = { taken: null };
7903
7903
  const rows = await appendFrom(ctx, async () => {
7904
7904
  read.taken = null;
@@ -7954,7 +7954,7 @@ function createTasks(options) {
7954
7954
  const { principal, actor, author } = identity;
7955
7955
  const assigned = ownActor(principal.id, input.for);
7956
7956
  if (input.claim) authorize(principal.access, "label", input.channel);
7957
- const token = newToken();
7957
+ const token = input.token ?? newToken();
7958
7958
  const along = async () => {
7959
7959
  const position = await writes().reads.tables.position();
7960
7960
  const needs = await needsAt(principal.access, input.needs, position, null);
@@ -8055,7 +8055,7 @@ function createTasks(options) {
8055
8055
  const { principal, actor, author } = identity;
8056
8056
  await authorizeMessage(writes(), principal.access, "label", id);
8057
8057
  const assigned = ownActor(principal.id, input.for);
8058
- const token = newToken();
8058
+ const token = input.token ?? newToken();
8059
8059
  const made = { claim: null };
8060
8060
  const root = await change(identity, id, async (found, position) => {
8061
8061
  made.claim = null;
@@ -8147,13 +8147,15 @@ function createTasks(options) {
8147
8147
  for (const thread of page.threads) {
8148
8148
  last = thread.root.id;
8149
8149
  if (thread.root.task && matches(thread.root)) found.push(thread);
8150
- if (found.length === limit) break scan;
8150
+ if (!query.latest && found.length === limit) break scan;
8151
8151
  }
8152
8152
  }
8153
- const cursor = found.length === limit ? last : Math.max(last, Math.min(position, through));
8154
- const reader = await ctx.reads.reader(principal.access, found.flatMap((t) => t.last ? [t.root, t.last] : [t.root]));
8153
+ const cursor = !query.latest && found.length === limit ? last : Math.max(last, Math.min(position, through));
8154
+ const activeAt = (t) => (t.last ?? t.root).createdAt;
8155
+ const kept = query.latest ? found.sort((a, b) => activeAt(a).localeCompare(activeAt(b))).slice(-limit) : found;
8156
+ const reader = await ctx.reads.reader(principal.access, kept.flatMap((t) => t.last ? [t.root, t.last] : [t.root]));
8155
8157
  return {
8156
- tasks: found.map((t) => ({
8158
+ tasks: kept.map((t) => ({
8157
8159
  message: view$1(t.root, actors, reader),
8158
8160
  replies: t.replies,
8159
8161
  last: t.last && view$1(t.last, actors, reader)
@@ -8161,14 +8163,26 @@ function createTasks(options) {
8161
8163
  cursor: ref(cursor)
8162
8164
  };
8163
8165
  },
8164
- /** Claims a task: `label` in its channel, whoever owns it. Of claims that race, one lands. */
8165
- async claim(identity, id, lease) {
8166
+ /**
8167
+ * Claims a task: `label` in its channel, whoever owns it. Of claims that race, one lands. With
8168
+ * the token of the claim that holds it now, it answers that claim as it is.
8169
+ */
8170
+ async claim(identity, id, lease, sent) {
8166
8171
  const { principal, actor } = identity;
8167
8172
  const { channel } = await taskOf(principal.access, id);
8168
8173
  authorize(principal.access, "label", channel);
8169
- const token = newToken();
8174
+ const token = sent ?? newToken();
8170
8175
  const made = {};
8171
8176
  const root = await changeTask(identity, id, (found) => {
8177
+ const { task } = found;
8178
+ if (sent !== void 0 && task.state === "claimed" && !lapsed(task, Date.now()) && hashes(sent, task.claim.token)) {
8179
+ made.claim = {
8180
+ epoch: task.epoch,
8181
+ token,
8182
+ until: task.claim.until
8183
+ };
8184
+ return [];
8185
+ }
8172
8186
  claimable(found, identity);
8173
8187
  const claimed = claiming(found, found.task, identity, lease, token);
8174
8188
  made.claim = claimed.claim;
@@ -9530,7 +9544,8 @@ function build(options, binding) {
9530
9544
  needs: body.needs,
9531
9545
  for: body.for,
9532
9546
  claim: body.claim,
9533
- lease: body.lease
9547
+ lease: body.lease,
9548
+ token: body.token
9534
9549
  };
9535
9550
  if (body.re !== void 0) return tasks.adopt(identity, messageAt(body.re), about);
9536
9551
  const proofs = await authorizePost(writes, principal.access, {
@@ -9610,9 +9625,9 @@ function build(options, binding) {
9610
9625
  taskLimits.from(body.from);
9611
9626
  return tasks.claimReady(await identityOf(caller), body, signal);
9612
9627
  },
9613
- async claimTask(caller, { id, lease }) {
9628
+ async claimTask(caller, { id, lease, token }) {
9614
9629
  taskLimits.lease(lease);
9615
- return tasks.claim(await identityOf(caller), messageAt(id), lease);
9630
+ return tasks.claim(await identityOf(caller), messageAt(id), lease, token);
9616
9631
  },
9617
9632
  async renewTask(caller, { id, epoch, token, lease }) {
9618
9633
  taskLimits.lease(lease);
@@ -9725,6 +9740,7 @@ function build(options, binding) {
9725
9740
  if ((body.sync?.length ?? 0) > 0 && !principal.access.anywhere("sync")) throw forbidden$1("this token can't register a sync: it needs sync somewhere");
9726
9741
  const taken = body.sync?.find((entry) => binding.sync.some((own) => own.key === entry.key));
9727
9742
  if (taken) throw new HttpError(409, "sync_key_taken", `this board's own sync has sync entry ${taken.key}: give yours another key`);
9743
+ if (Object.keys(body.watch).length > 64) throw badRequest(`a registration holds at most 64 watchers`, "too_many_watchers");
9728
9744
  for (const [id, spec] of Object.entries(body.watch)) {
9729
9745
  const name = RemoteWatcherId.safeParse(id);
9730
9746
  if (!name.success) throw badRequest(`watch ${id}: ${name.error.issues[0].message}`, "bad_watcher");
@@ -1,18 +1,18 @@
1
1
  import { a as DIRECT_UPLOAD_BYTES_MAX, l as fileSize } from "./profile-header-O8wC8yk8.mjs";
2
2
  import { m as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-CUSTEFIy.mjs";
3
- import "./routes-C85Sbhtm.mjs";
3
+ import "./routes-GF5ukHYX.mjs";
4
4
  import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
5
- import { f as BoardError } from "./errors-DbCKqGXp.mjs";
6
- import { l as shownName } from "./middleware-iVTNf5Su.mjs";
5
+ import { f as BoardError } from "./errors-Cv0TGBt5.mjs";
6
+ import { l as shownName } from "./middleware-DXiwepsR.mjs";
7
7
  import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
8
8
  import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
9
- import { t as VERSION } from "./version-BltS6V9X.mjs";
10
- import { r as PERMISSIONS } from "./access-DdojoPZm.mjs";
11
- import { c as withMentions } from "./task-batch-Da6Q_7AK.mjs";
12
- import { a as isBoardName, c as isApiMessageId, n as createTasksInChunks, t as TasksInChunksError } from "./exports-BFeX9HNn.mjs";
9
+ import { t as VERSION } from "./version-CBjh_ogp.mjs";
10
+ import { r as PERMISSIONS } from "./access-Pcar1gwx.mjs";
11
+ import { c as withMentions } from "./task-batch-nqYGszDJ.mjs";
12
+ import { a as isBoardName, c as isApiMessageId, n as createTasksInChunks, t as TasksInChunksError } from "./exports-CBukc8T3.mjs";
13
13
  import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-B_gbi2sU.mjs";
14
- import { _ as vercelProjectFile, a as vercel, c as boardUrl, d as environmentProfile, f as handFetch, i as handTeam, l as configDir, m as handToken, n as credentialSource, o as http, p as handLogin, r as credentialed, t as board, u as connect } from "./server-DbYDp2Lr.mjs";
15
- import { n as everyChannel, t as conformance } from "./conformance-DW4-9Dwf.mjs";
14
+ import { _ as vercelProjectFile, a as vercel, c as boardUrl, d as environmentProfile, f as handFetch, i as handTeam, l as configDir, m as handToken, n as credentialSource, o as http, p as handLogin, r as credentialed, t as board, u as connect } from "./server-XsbC50nY.mjs";
15
+ import { n as everyChannel, t as conformance } from "./conformance-Cz1Elmgj.mjs";
16
16
  import { n as displayText, t as byVercelBot } from "./bots-CqPYxkqK.mjs";
17
17
  import { spawn } from "node:child_process";
18
18
  import { createHash, randomUUID } from "node:crypto";
@@ -839,6 +839,26 @@ function memoryClaims(board, profile) {
839
839
  drop: async (task) => void claims.delete(at(task))
840
840
  };
841
841
  }
842
+ /**
843
+ * Claims by a token the caller chose, kept nowhere: a task's claim is this token's while the task
844
+ * is claimed, at the epoch the board shows, and the board says whether the token holds it. So any
845
+ * call with the token renews and settles the claim, on any handle, process, or instance.
846
+ */
847
+ function tokenClaims(board, token) {
848
+ return {
849
+ async get(task) {
850
+ const held = (await board.thread(task, { limit: 1 })).message.task;
851
+ if (held?.state !== "claimed" || !held.claim) return null;
852
+ return {
853
+ epoch: held.epoch,
854
+ token,
855
+ until: held.claim.until
856
+ };
857
+ },
858
+ put: async () => {},
859
+ drop: async () => {}
860
+ };
861
+ }
842
862
  //#endregion
843
863
  //#region src/cli/run.ts
844
864
  /** A claim is never renewed more often than this, however short its lease. */
@@ -2202,7 +2222,21 @@ function failureOf(error) {
2202
2222
  ...theirs("limit", "payload_too_large", `Can't ${doing()}. A message's text is at most ${MESSAGE_TEXT_MAX.toLocaleString("en-US")} characters.`, [{ instruction: current.command === "edit" ? "Keep the edit short, and reply with the long part in a file with --attach" : current.command === "tasks" ? "Keep it short, and reply to the task with the long part in a file with --attach" : "Put the long part in a file and --attach it, with a short summary as the text" }]),
2203
2223
  details: []
2204
2224
  };
2205
- if (code === "too_many_boards") return theirs("limit", code, `Can't ${doing()}. The team has all the boards it can.`, flags.name !== void 0 ? [{
2225
+ if (code === "too_many_boards") return theirs("limit", code, `Can't ${doing()}. The team has all the boards it can.`, current.command === "conformance" ? [{
2226
+ instruction: "Check a board by its URL, such as one from vb serve",
2227
+ argv: [
2228
+ ...rerunWithout(["--name", "--scope"]).filter((arg) => arg !== "--ensure"),
2229
+ "--url",
2230
+ "<URL>"
2231
+ ]
2232
+ }, {
2233
+ instruction: "Or the team's own board, which it posts to and changes the grants of",
2234
+ argv: [
2235
+ ...rerunWithout(["--name"]).filter((arg) => arg !== "--ensure"),
2236
+ "--name",
2237
+ "General"
2238
+ ]
2239
+ }] : flags.name !== void 0 ? [{
2206
2240
  instruction: "Use the team's board instead",
2207
2241
  argv: rerunWithout(["--name"]).filter((arg) => arg !== "--ensure")
2208
2242
  }] : process.env.BOARD_NAME ? [{
@@ -2568,6 +2602,7 @@ async function run(command, args) {
2568
2602
  }]
2569
2603
  });
2570
2604
  const withHeaders = io.board ? {} : { withHeaders: (headers) => connection(void 0, { headers }).board };
2605
+ await client().me();
2571
2606
  const report = await conformance(client(), {
2572
2607
  ...flags.channel ? { channel: flags.channel } : {},
2573
2608
  ...withHeaders
@@ -3361,13 +3396,27 @@ const planHelp = () => ({
3361
3396
  "--help"
3362
3397
  ]
3363
3398
  });
3364
- /** One of a plan task's `needs`: a task that's there, by its ID as text or as a number, or `{ "key": … }` for one of the plan's own. */
3399
+ /** One of a plan task's `needs`: a task that's there, by its ID as text, as a number, or as `{ "id": … }`, or `{ "key": … }` for one of the plan's own. */
3365
3400
  function isNeed(need) {
3366
3401
  if (typeof need === "string") return need.replace(/^#/, "").length > 0;
3367
3402
  if (typeof need === "number") return Number.isSafeInteger(need) && need >= 0;
3368
3403
  if (typeof need !== "object" || need === null) return false;
3369
3404
  const keys = Object.keys(need);
3370
- return keys.length === 1 && keys[0] === "key" && typeof need.key === "string";
3405
+ if (keys.length !== 1) return false;
3406
+ const value = need[keys[0]];
3407
+ if (keys[0] === "id") return typeof value === "string" && isNeed(value);
3408
+ return keys[0] === "key" && typeof value === "string";
3409
+ }
3410
+ /** A need as the board takes it: an ID as it is, or `{ "key": … }`, which a bare string is when it's a key of the plan's own. */
3411
+ function boardNeed(need, keys) {
3412
+ if (typeof need === "string" && keys.has(need)) return { key: need };
3413
+ return idNeed(need);
3414
+ }
3415
+ function idNeed(need) {
3416
+ if (typeof need === "string") return need.replace(/^#/, "");
3417
+ if (typeof need === "number") return String(need);
3418
+ if (typeof need === "object" && need !== null && "id" in need) return idNeed(need.id);
3419
+ return need;
3371
3420
  }
3372
3421
  /**
3373
3422
  * Refuses a plan that says something a task doesn't take, before anything is sent. The board
@@ -3393,7 +3442,7 @@ function checkPlan(plan, where) {
3393
3442
  const odd = task.needs.find((need) => !isNeed(need));
3394
3443
  if (odd !== void 0) {
3395
3444
  const said = JSON.stringify(odd);
3396
- throw usage(`Task ${at + 1} of ${where} needs ${said.length > 60 ? `${said.slice(0, 59)}…` : said}, which isn't a task's ID or {"key": "…"}.`, { next: [planHelp()] });
3445
+ throw usage(`Task ${at + 1} of ${where} needs ${said.length > 60 ? `${said.slice(0, 59)}…` : said}. A need is a key of the plan's own, like "fix" or {"key": "fix"}, or a task's ID as vb prints it or as {"id": "…"}.`, { next: [planHelp()] });
3397
3446
  }
3398
3447
  }
3399
3448
  }
@@ -3421,9 +3470,10 @@ async function planFrom(path, board) {
3421
3470
  const plan = parsed;
3422
3471
  checkPlan(plan, where);
3423
3472
  const principal = plan.some((task) => typeof task.for === "string" && !task.for.includes(":")) ? (await board.me()).principal : "";
3473
+ const keys = new Set(plan.flatMap((task) => typeof task.key === "string" ? [task.key] : []));
3424
3474
  return plan.map((task) => ({
3425
3475
  ...task,
3426
- ...Array.isArray(task.needs) ? { needs: task.needs.map((need) => typeof need === "string" ? need.replace(/^#/, "") : typeof need === "number" ? String(need) : need) } : {},
3476
+ ...Array.isArray(task.needs) ? { needs: task.needs.map((need) => boardNeed(need, keys)) } : {},
3427
3477
  ...typeof task.for === "string" && !task.for.includes(":") ? { for: profileActor(principal, task.for) } : {}
3428
3478
  }));
3429
3479
  }
@@ -3444,14 +3494,18 @@ const asTyped = () => flags.as ? ["--as", flags.as] : [];
3444
3494
  /**
3445
3495
  * This run's board, and the claims it holds there as whoever it writes as. A claim's token is the
3446
3496
  * CLI's to keep: in a file under its config directory, by the board's URL, the task, and the
3447
- * profile this run writes as; or for `vb()`, whose board is a handle, in memory for as long as the
3448
- * handle lasts.
3497
+ * profile this run writes as; or for `vb()`, whose board is a handle, in the store its caller
3498
+ * passes, or else in memory for as long as the handle lasts.
3449
3499
  */
3450
3500
  function tasksOn() {
3451
3501
  const profile = writesAs();
3502
+ if (io.board && io.claimToken !== void 0) return {
3503
+ board: client(),
3504
+ claims: tokenClaims(client(), io.claimToken)
3505
+ };
3452
3506
  if (io.board) return {
3453
3507
  board: client(),
3454
- claims: memoryClaims(io.claimsOf ?? io.board, profile)
3508
+ claims: io.claims?.(profile) ?? memoryClaims(io.claimsOf ?? io.board, profile)
3455
3509
  };
3456
3510
  const { board, url } = connection();
3457
3511
  return {
@@ -3527,7 +3581,10 @@ async function claimFor(board, claims, target) {
3527
3581
  "from",
3528
3582
  "wait"
3529
3583
  ]) if (flags[given] !== void 0) throw usage(`--${given} goes with --ready, which claims the next ready task in a channel.`);
3530
- const claim = await board.tasks.claim(taskId(target), lease !== void 0 ? { lease } : {});
3584
+ const claim = await board.tasks.claim(taskId(target), {
3585
+ ...lease !== void 0 ? { lease } : {},
3586
+ ...io.claimToken !== void 0 ? { token: io.claimToken } : {}
3587
+ });
3531
3588
  await claims.put(claim.task.id, {
3532
3589
  epoch: claim.epoch,
3533
3590
  token: claim.token,
@@ -3550,7 +3607,8 @@ async function claimFor(board, claims, target) {
3550
3607
  ...flags.label?.length ? { label: labelPairs(flags.label) } : {},
3551
3608
  ...flags.from?.length ? { from: flags.from } : {},
3552
3609
  ...wait !== void 0 ? { wait } : {},
3553
- ...lease !== void 0 ? { lease } : {}
3610
+ ...lease !== void 0 ? { lease } : {},
3611
+ ...io.claimToken !== void 0 ? { token: io.claimToken } : {}
3554
3612
  }, { signal: controller.signal });
3555
3613
  } catch (error) {
3556
3614
  if (controller.signal.aborted) return stop.interrupted() ? 130 : 0;
@@ -3649,7 +3707,8 @@ async function tasks(args) {
3649
3707
  ...flags.needs?.length ? { needs: flags.needs.map((id) => taskId(id)) } : {},
3650
3708
  ...flags.for ? { for: profileActor((await board.me()).principal, flags.for) } : {},
3651
3709
  ...claimFlag() ? { claim: true } : {},
3652
- ...lease !== void 0 ? { lease } : {}
3710
+ ...lease !== void 0 ? { lease } : {},
3711
+ ...claimFlag() && io.claimToken !== void 0 ? { token: io.claimToken } : {}
3653
3712
  };
3654
3713
  let made;
3655
3714
  if (isMessageRef(target)) {
@@ -1,5 +1,5 @@
1
1
  import { _ as NewLabels, m as MESSAGE_TEXT_MAX } from "./schemas-CUSTEFIy.mjs";
2
- import { t as HttpError } from "./errors-DbCKqGXp.mjs";
2
+ import { t as HttpError } from "./errors-Cv0TGBt5.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/client/ids.ts
5
5
  const hex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -1,5 +1,5 @@
1
- import { Ft as SourceJoin, Gn as ExternalEvent, Jn as Link, Kn as ExternalFile, Rn as Actor, Rt as SourceRead, Wn as ExternalAuthor, qn as ExternalLink, s as BoardEventView, st as MessageView } from "./routes-ChGBn0K3.mjs";
2
- import { t as BoardClient } from "./client-C4-r10SA.mjs";
1
+ import { Ft as SourceJoin, Gn as ExternalEvent, Jn as Link, Kn as ExternalFile, Rn as Actor, Rt as SourceRead, Wn as ExternalAuthor, qn as ExternalLink, s as BoardEventView, st as MessageView } from "./routes-BpvyXQwv.mjs";
2
+ import { t as BoardClient } from "./client-oYThy3CR.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/contract/bots.d.ts
5
5
  /**
@@ -1043,6 +1043,7 @@ declare const LEASE_DEFAULT_S = 900;
1043
1043
  * `lease` seconds.
1044
1044
  */
1045
1045
  declare const CreateTaskBody: z.ZodObject<{
1046
+ token: z.ZodOptional<z.ZodString>;
1046
1047
  channel: z.ZodOptional<z.ZodString>;
1047
1048
  re: z.ZodOptional<z.ZodString>;
1048
1049
  text: z.ZodOptional<z.ZodString>;
@@ -1107,8 +1108,15 @@ declare const TasksQuery: z.ZodObject<{
1107
1108
  needs: z.ZodOptional<z.ZodString>;
1108
1109
  after: z.ZodOptional<z.ZodString>;
1109
1110
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1111
+ latest: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
1112
+ 0: "0";
1113
+ 1: "1";
1114
+ false: "false";
1115
+ true: "true";
1116
+ }>, z.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
1110
1117
  }, z.core.$strip>;
1111
1118
  declare const ClaimTaskBody: z.ZodOptional<z.ZodObject<{
1119
+ token: z.ZodOptional<z.ZodString>;
1112
1120
  lease: z.ZodOptional<z.ZodNumber>;
1113
1121
  }, z.core.$strip>>;
1114
1122
  /**
@@ -1117,6 +1125,7 @@ declare const ClaimTaskBody: z.ZodOptional<z.ZodObject<{
1117
1125
  * holds the request up to that many seconds for one.
1118
1126
  */
1119
1127
  declare const ClaimReadyTaskBody: z.ZodObject<{
1128
+ token: z.ZodOptional<z.ZodString>;
1120
1129
  channel: z.ZodString;
1121
1130
  label: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1122
1131
  from: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1388,8 +1397,8 @@ declare const InboxQuery: z.ZodObject<{
1388
1397
  channel: z.ZodOptional<z.ZodString>;
1389
1398
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1390
1399
  }, z.core.$strip>;
1391
- /** How many watchers one registration holds: the board matches every event against every tail. */
1392
- declare const REGISTERED_WATCHERS_MAX = 32;
1400
+ /** How many watchers one registration holds on the local engine, which matches every event against every tail. Vercel's API sets its own. */
1401
+ declare const REGISTERED_WATCHERS_MAX = 64;
1393
1402
  /**
1394
1403
  * What a board on `http()` registers with the board it uses: its watchers, and where to wake it,
1395
1404
  * at a URL or at a path on its own project, never both.
@@ -2562,6 +2571,12 @@ declare const routes: {
2562
2571
  needs: z.ZodOptional<z.ZodString>;
2563
2572
  after: z.ZodOptional<z.ZodString>;
2564
2573
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
2574
+ latest: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
2575
+ 0: "0";
2576
+ 1: "1";
2577
+ false: "false";
2578
+ true: "true";
2579
+ }>, z.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
2565
2580
  }, z.core.$strip>;
2566
2581
  };
2567
2582
  /** Starts a thread as a task (`post` there, and `label` for its labels), or makes the thread `re` roots one (`label` there). */
@@ -2569,6 +2584,7 @@ declare const routes: {
2569
2584
  readonly method: 'POST';
2570
2585
  readonly path: '/tasks';
2571
2586
  readonly body: z.ZodObject<{
2587
+ token: z.ZodOptional<z.ZodString>;
2572
2588
  channel: z.ZodOptional<z.ZodString>;
2573
2589
  re: z.ZodOptional<z.ZodString>;
2574
2590
  text: z.ZodOptional<z.ZodString>;
@@ -2616,6 +2632,7 @@ declare const routes: {
2616
2632
  readonly method: 'POST';
2617
2633
  readonly path: '/tasks/claim';
2618
2634
  readonly body: z.ZodObject<{
2635
+ token: z.ZodOptional<z.ZodString>;
2619
2636
  channel: z.ZodString;
2620
2637
  label: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2621
2638
  from: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -2628,6 +2645,7 @@ declare const routes: {
2628
2645
  readonly method: 'POST';
2629
2646
  readonly path: '/tasks/:id/claim';
2630
2647
  readonly body: z.ZodOptional<z.ZodObject<{
2648
+ token: z.ZodOptional<z.ZodString>;
2631
2649
  lease: z.ZodOptional<z.ZodNumber>;
2632
2650
  }, z.core.$strip>>;
2633
2651
  };
@@ -180,6 +180,13 @@ const Claimed = {
180
180
  token: z.string().min(1).max(128)
181
181
  };
182
182
  /**
183
+ * A claim's token can be the caller's own: a secret it can derive again anywhere, as an HMAC-SHA256
184
+ * of its run's ID in base64url, so no store has to remember it. It's 32 bytes in base64url, as
185
+ * Vercel's API takes one. Claiming a task its live claim holds with that claim's token answers the
186
+ * claim as it is.
187
+ */
188
+ const ClaimToken = { token: z.string().regex(/^[A-Za-z0-9_-]{43}$/, "a claim token is 32 bytes in base64url: 43 characters").optional() };
189
+ /**
183
190
  * A new thread that's a task (`channel` and `text`, with `labels`, `noSync`, `attachments`, and an
184
191
  * `id` as a post takes them), or the thread `re` roots made one. `needs` are the tasks it waits for,
185
192
  * `for` the one actor of its owner's that claims it, and `claim` claims it in the same write, for
@@ -199,6 +206,7 @@ const CreateTaskBody = z.object({
199
206
  for: ActorId.nullable().optional(),
200
207
  claim: z.boolean().optional(),
201
208
  lease: Lease.optional(),
209
+ ...ClaimToken,
202
210
  id: z.string().min(1).max(200).refine(storable, "id has a NUL character or a lone surrogate").optional()
203
211
  }).refine((body) => body.channel === void 0 !== (body.re === void 0), { message: "a task needs `channel` and `text` for a new thread, or `re` for a thread that's there" }).refine((body) => body.channel === void 0 || (body.text ?? "").trim().length > 0 || (body.attachments?.length ?? 0) > 0, {
204
212
  message: "message text is empty",
@@ -209,6 +217,9 @@ const CreateTaskBody = z.object({
209
217
  }).refine((body) => body.re === void 0 || body.text === void 0 && body.labels === void 0 && body.noSync === void 0 && body.attachments === void 0 && body.id === void 0, { message: "`text`, `labels`, `noSync`, `attachments`, and `id` are a new thread's: `re` makes a task of a thread as it is" }).refine((body) => body.lease === void 0 || body.claim === true, {
210
218
  message: "`lease` goes with `claim`",
211
219
  path: ["lease"]
220
+ }).refine((body) => body.token === void 0 || body.claim === true, {
221
+ message: "`token` goes with `claim`",
222
+ path: ["token"]
212
223
  });
213
224
  /** A digest of what a batch asks for: what tells the same request under an `id` from another. */
214
225
  const BatchRequest = z.string().min(1).max(64);
@@ -270,9 +281,17 @@ const TasksQuery = z.object({
270
281
  needs: Ref.optional(),
271
282
  /** A `cursor` an earlier page reported. */
272
283
  after: Ref.optional(),
273
- limit: z.coerce.number().int().min(1).max(500).optional()
284
+ limit: z.coerce.number().int().min(1).max(500).optional(),
285
+ /** The `limit` last active instead of the first made, the latest active last: the board reads to the end, and takes no `after`. */
286
+ latest: flag.optional()
287
+ }).refine((query) => !query.latest || query.after === void 0, {
288
+ message: "`latest` reads every task to find the last active: it takes no `after`",
289
+ path: ["latest"]
274
290
  });
275
- const ClaimTaskBody = z.object({ lease: Lease.optional() }).optional();
291
+ const ClaimTaskBody = z.object({
292
+ lease: Lease.optional(),
293
+ ...ClaimToken
294
+ }).optional();
276
295
  /**
277
296
  * Claims the oldest ready task in `channel` that has every label in `label`: one assigned to the
278
297
  * caller first, then an unassigned one it owns, or whose owner `from` names by ID. `wait`
@@ -284,7 +303,8 @@ const ClaimReadyTaskBody = z.object({
284
303
  /** How many owners one claim takes from is the backend's to say. */
285
304
  from: z.array(z.string().min(1).max(256)).optional(),
286
305
  lease: Lease.optional(),
287
- wait: z.number().min(0).max(300).optional()
306
+ wait: z.number().min(0).max(300).optional(),
307
+ ...ClaimToken
288
308
  });
289
309
  const RenewTaskBody = z.object({
290
310
  ...Claimed,
@@ -431,7 +451,7 @@ const InboxQuery = z.object({
431
451
  });
432
452
  /** What every registration carries: its watchers' tails, and its sync entries. */
433
453
  const Registering = z.object({
434
- watch: z.record(z.string().max(100), z.object({ tail: z.string().max(1e3) })).refine((watch) => Object.keys(watch).length <= 32, `a board registers at most 32 watchers`),
454
+ watch: z.record(z.string().max(100), z.object({ tail: z.string().max(1e3) })),
435
455
  /**
436
456
  * Its sync entries: its sync subscribes too, to every post, change, and thread sync in the channels
437
457
  * where it may sync, and the board lists the entries.
@@ -1,9 +1,9 @@
1
- import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DbCKqGXp.mjs";
2
- import { i as hostCheckedBy } from "./exports-BFeX9HNn.mjs";
3
- import { i as LOGINS, r as LOGIN } from "./auth-zPqFJocD.mjs";
4
- import { h as localTokenFile, t as board } from "./server-DbYDp2Lr.mjs";
5
- import { t as oidcTokens } from "./tokens-C-T0B1uF.mjs";
6
- import { t as local } from "./local-DTzfnJAf.mjs";
1
+ import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-Cv0TGBt5.mjs";
2
+ import { i as hostCheckedBy } from "./exports-CBukc8T3.mjs";
3
+ import { i as LOGINS, r as LOGIN } from "./auth-C2CxMl2p.mjs";
4
+ import { h as localTokenFile, t as board } from "./server-XsbC50nY.mjs";
5
+ import { t as oidcTokens } from "./tokens-tulRtEWx.mjs";
6
+ import { t as local } from "./local-CwcmqEoa.mjs";
7
7
  import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
8
8
  import { userInfo } from "node:os";
9
9
  import { dirname, join, resolve } from "node:path";
@@ -1,10 +1,10 @@
1
1
  import { n as formatProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
- import { $ as routes } from "./routes-C85Sbhtm.mjs";
4
- import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DbCKqGXp.mjs";
5
- import { g as keyId, p as DERIVED_ID } from "./middleware-iVTNf5Su.mjs";
6
- import { l as METHODS, o as compileWatcher } from "./task-batch-Da6Q_7AK.mjs";
7
- import { d as tailWatchers, f as deployedOnVercel, l as PROTOCOL_ROUTES, r as createBoard, s as createVercel, u as withoutToken } from "./exports-BFeX9HNn.mjs";
3
+ import { $ as routes } from "./routes-GF5ukHYX.mjs";
4
+ import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-Cv0TGBt5.mjs";
5
+ import { g as keyId, p as DERIVED_ID } from "./middleware-DXiwepsR.mjs";
6
+ import { l as METHODS, o as compileWatcher } from "./task-batch-nqYGszDJ.mjs";
7
+ import { d as tailWatchers, f as deployedOnVercel, l as PROTOCOL_ROUTES, r as createBoard, s as createVercel, u as withoutToken } from "./exports-CBukc8T3.mjs";
8
8
  import { execFile } from "node:child_process";
9
9
  import { createHash } from "node:crypto";
10
10
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
@@ -1057,8 +1057,8 @@ function vercel(options = {}) {
1057
1057
  function board(options = {}) {
1058
1058
  return createBoard(options, {
1059
1059
  backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
1060
- sync: () => import("./engine-D8YAsQS_.mjs"),
1061
- serving: () => import("./serving-aOQsBok0.mjs"),
1060
+ sync: () => import("./engine-506f7GEM.mjs"),
1061
+ serving: () => import("./serving-C6Ao7i-7.mjs"),
1062
1062
  sandbox: (url, token) => sandboxHeaders(url, url, token)
1063
1063
  });
1064
1064
  }
@@ -1,2 +1,2 @@
1
- import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-C-T0B1uF.mjs";
1
+ import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-tulRtEWx.mjs";
2
2
  export { discoveryIdentity, oidcTokens, ownProjectId, ownTeamId };
@@ -1,4 +1,4 @@
1
- import { t as VERSION } from "./version-BltS6V9X.mjs";
1
+ import { t as VERSION } from "./version-CBjh_ogp.mjs";
2
2
  //#region src/inspect/style.ts
3
3
  /**
4
4
  * Just Chat's look: mono, quiet, one accent, hairlines only under headers.
@@ -502,6 +502,11 @@ button.file:hover { background: var(--shade-hover); color: var(--bright); }
502
502
  .task-now .need + .need { margin-left: 8px; }
503
503
  .task-where { color: var(--faint); font-size: 12px; white-space: nowrap; }
504
504
  .task-row .time { text-align: right; }
505
+ .task-places { display: grid; padding: 0 12px; }
506
+ .task-place { display: flex; align-items: center; gap: 12px; padding: 5px 8px; color: var(--dim); }
507
+ .task-place:hover { background: var(--shade); color: var(--bright); }
508
+ .task-place .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
509
+ .task-place .count { color: var(--faint); font-size: 12px; white-space: nowrap; }
505
510
  @media (max-width: 700px) {
506
511
  .task-row { grid-template-columns: 88px minmax(0, 1fr) 30px; row-gap: 0; }
507
512
  .task-where { display: none; }
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-CGicSMdu.mjs";
2
- import { r as ChatTransport, t as ChatInput } from "./chat-provider-BHyX6H8H.mjs";
1
+ import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-WjdBsRLR.mjs";
2
+ import { r as ChatTransport, t as ChatInput } from "./chat-provider-BSHlV2lw.mjs";
3
3
  import { z } from "zod";
4
4
  import { ReactionEvent } from "chat";
5
5
  //#region src/sync/chat-sdk.d.ts