@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.
- package/dist/{access-DdojoPZm.mjs → access-Pcar1gwx.mjs} +1 -1
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +4 -4
- package/dist/{actors-CDkNgWUL.mjs → actors-XKUrjOfO.mjs} +2 -2
- package/dist/{auth-C4VxPLYz.d.mts → auth-BoYunD5t.d.mts} +1 -1
- package/dist/{auth-zPqFJocD.mjs → auth-C2CxMl2p.mjs} +2 -2
- package/dist/{backend-Da_YEltI.d.mts → backend-DJobr4nr.d.mts} +4 -4
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-BHyX6H8H.d.mts → chat-provider-BSHlV2lw.d.mts} +2 -2
- package/dist/cli-embedded.d.mts +32 -3
- package/dist/cli-embedded.mjs +4 -2
- package/dist/cli.mjs +5 -5
- package/dist/{client-C4-r10SA.d.mts → client-oYThy3CR.d.mts} +9 -3
- package/dist/{conformance-DW4-9Dwf.mjs → conformance-Cz1Elmgj.mjs} +56 -3
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-D8YAsQS_.mjs → engine-506f7GEM.mjs} +2 -2
- package/dist/{errors-DbCKqGXp.mjs → errors-Cv0TGBt5.mjs} +7 -1
- package/dist/{exports-BFeX9HNn.mjs → exports-CBukc8T3.mjs} +16 -15
- package/dist/{exports-BUtR_AHa.d.mts → exports-CF_nUsT5.d.mts} +4 -4
- package/dist/{index-BTuTaBaK.d.mts → index-CM2u0wGd.d.mts} +2 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +6 -6
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +34 -34
- package/dist/{inspect-fOA9UNPD.mjs → inspect-PQsEgXRQ.mjs} +2 -2
- package/dist/inspect-SEaGzhvh.mjs +2 -0
- package/dist/inspect.d.mts +1 -1
- package/dist/inspect.mjs +1 -1
- package/dist/{local-DTzfnJAf.mjs → local-CwcmqEoa.mjs} +37 -21
- package/dist/{main-Dq6yQxNB.mjs → main-gNAS2WbP.mjs} +79 -20
- package/dist/{middleware-iVTNf5Su.mjs → middleware-DXiwepsR.mjs} +1 -1
- package/dist/{provider-CGicSMdu.d.mts → provider-WjdBsRLR.d.mts} +2 -2
- package/dist/{routes-ChGBn0K3.d.mts → routes-BpvyXQwv.d.mts} +20 -2
- package/dist/{routes-C85Sbhtm.mjs → routes-GF5ukHYX.mjs} +24 -4
- package/dist/{serve-Bdwok1A9.mjs → serve-Ci5KT11x.mjs} +6 -6
- package/dist/{server-DbYDp2Lr.mjs → server-XsbC50nY.mjs} +7 -7
- package/dist/{serving-aOQsBok0.mjs → serving-C6Ao7i-7.mjs} +1 -1
- package/dist/{shell-CmZylG0M.mjs → shell-BiCBL1w_.mjs} +6 -1
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-github.d.mts +42 -2
- package/dist/sync-github.mjs +88 -6
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync.d.mts +2 -2
- package/dist/{task-batch-Da6Q_7AK.mjs → task-batch-nqYGszDJ.mjs} +4 -4
- package/dist/{tokens-C-T0B1uF.mjs → tokens-tulRtEWx.mjs} +2 -2
- package/dist/{version-BltS6V9X.mjs → version-CBjh_ogp.mjs} +1 -1
- package/docs/01-board/06-watchers.md +2 -1
- package/docs/01-board/11-tasks.md +23 -2
- package/docs/02-sync/04-github.md +7 -4
- package/docs/04-reference/01-cli.md +54 -0
- package/docs/04-reference/02-board.md +11 -6
- package/package.json +1 -1
- package/dist/inspect-Bd_mBGFt.mjs +0 -2
package/dist/sync-github.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-
|
|
2
|
-
import { n as ChatSyncProvider } from "./chat-provider-
|
|
1
|
+
import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-WjdBsRLR.mjs";
|
|
2
|
+
import { n as ChatSyncProvider } from "./chat-provider-BSHlV2lw.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { Adapter } from "chat";
|
|
5
5
|
//#region src/sync/github.d.ts
|
|
@@ -438,6 +438,46 @@ export declare const GitHubEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
438
438
|
}, z.core.$loose>>;
|
|
439
439
|
}, z.core.$loose>;
|
|
440
440
|
}, z.core.$loose>;
|
|
441
|
+
}, z.core.$strip> | z.ZodObject<{
|
|
442
|
+
channel: z.ZodString;
|
|
443
|
+
thread: z.ZodString;
|
|
444
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
445
|
+
kind: z.ZodLiteral<"lifecycle">;
|
|
446
|
+
title: z.ZodString;
|
|
447
|
+
url: z.ZodNullable<z.ZodString>;
|
|
448
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
449
|
+
labels: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
450
|
+
unset: z.ZodArray<z.ZodString>;
|
|
451
|
+
owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
452
|
+
reply: z.ZodNullable<z.ZodString>;
|
|
453
|
+
createRoot: z.ZodBoolean;
|
|
454
|
+
retitled: z.ZodOptional<z.ZodBoolean>;
|
|
455
|
+
author: z.ZodObject<{
|
|
456
|
+
id: z.ZodString;
|
|
457
|
+
handle: z.ZodString;
|
|
458
|
+
name: z.ZodString;
|
|
459
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
460
|
+
isBot: z.ZodBoolean;
|
|
461
|
+
}, z.core.$strip>;
|
|
462
|
+
id: z.ZodString;
|
|
463
|
+
key: z.ZodString;
|
|
464
|
+
platform: z.ZodLiteral<"github">;
|
|
465
|
+
type: z.ZodLiteral<"ci.failed" | "ci.passed">;
|
|
466
|
+
subject: z.ZodObject<{
|
|
467
|
+
repo: z.ZodString;
|
|
468
|
+
number: z.ZodNumber;
|
|
469
|
+
type: z.ZodLiteral<"pull_request">;
|
|
470
|
+
}, z.core.$strip>;
|
|
471
|
+
raw: z.ZodObject<{
|
|
472
|
+
action: z.ZodOptional<z.ZodString>;
|
|
473
|
+
workflow_run: z.ZodObject<{
|
|
474
|
+
name: z.ZodString;
|
|
475
|
+
path: z.ZodString;
|
|
476
|
+
conclusion: z.ZodString;
|
|
477
|
+
head_sha: z.ZodString;
|
|
478
|
+
html_url: z.ZodOptional<z.ZodString>;
|
|
479
|
+
}, z.core.$loose>;
|
|
480
|
+
}, z.core.$loose>;
|
|
441
481
|
}, z.core.$strip>)[]], "type">;
|
|
442
482
|
export type GitHubEvent = z.infer<typeof GitHubEvent>;
|
|
443
483
|
export type GitHubRepo = SyncUnit<GitHubEvent> | {
|
package/dist/sync-github.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as withRoutes, i as eventSchema, m as into, r as envelope } from "./events-mWKc1uvZ.mjs";
|
|
2
2
|
import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-Br2RXgLV.mjs";
|
|
3
|
-
import { n as tagOf } from "./tags-CxDCF_tt.mjs";
|
|
3
|
+
import { n as tagOf, t as slug } from "./tags-CxDCF_tt.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { connectGitHubAdapter } from "@vercel/connect/chat";
|
|
6
6
|
import { createGitHubAdapter } from "@chat-adapter/github";
|
|
@@ -103,7 +103,8 @@ function lifecycle(name, body) {
|
|
|
103
103
|
type: "pr.synchronized",
|
|
104
104
|
labels: head,
|
|
105
105
|
reply: null,
|
|
106
|
-
createRoot: false
|
|
106
|
+
createRoot: false,
|
|
107
|
+
owns: [ciPrefix(body.repository.id, pr.number)]
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
110
|
case "ready_for_review": return {
|
|
@@ -268,6 +269,56 @@ function lifecycle(name, body) {
|
|
|
268
269
|
}
|
|
269
270
|
return null;
|
|
270
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* A PR's CI labels, `ci.<repo ID>-<number>.`: a board thread can join several PRs, even in other
|
|
274
|
+
* repos, and each PR's results and pushes touch only its own. Two numbers keep it short and
|
|
275
|
+
* unambiguous, where a repo's name can be long and hold the separators.
|
|
276
|
+
*/
|
|
277
|
+
const ciPrefix = (repo, number) => `ci.${repo}-${number}.`;
|
|
278
|
+
/** Conclusions that mean a workflow failed. `cancelled` usually means a newer push superseded it. */
|
|
279
|
+
const FAILED = [
|
|
280
|
+
"failure",
|
|
281
|
+
"timed_out",
|
|
282
|
+
"startup_failure"
|
|
283
|
+
];
|
|
284
|
+
/** Who CI results are posted as: GitHub Actions' bot, so they don't read as the person who pushed. */
|
|
285
|
+
const ACTIONS = {
|
|
286
|
+
login: "github-actions[bot]",
|
|
287
|
+
id: 41898282,
|
|
288
|
+
type: "Bot"
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* Maps a completed `workflow_run` to a lifecycle event on each PR it ran for, at the commit the PR
|
|
292
|
+
* is at: a failure replies and sets `ci.<repo ID>-<number>.<workflow file>=<conclusion>`, a pass unsets it. A fork's PRs
|
|
293
|
+
* aren't in `pull_requests`, so their runs reach no thread.
|
|
294
|
+
*/
|
|
295
|
+
function workflowRun(body) {
|
|
296
|
+
if (body.action !== "completed") return [];
|
|
297
|
+
const run = body.workflow_run;
|
|
298
|
+
const { full_name: repo, id } = body.repository ?? {};
|
|
299
|
+
if (!run?.name || !run.path || !run.head_sha || !run.conclusion || !repo || typeof id !== "number") return [];
|
|
300
|
+
const file = run.path.slice(run.path.lastIndexOf("/") + 1).replace(/\.ya?ml$/, "");
|
|
301
|
+
if (!slug(file)) return [];
|
|
302
|
+
const failed = FAILED.includes(run.conclusion);
|
|
303
|
+
if (!failed && run.conclusion !== "success") return [];
|
|
304
|
+
return (run.pull_requests ?? []).filter((pr) => pr.head?.sha === run.head_sha).map((pr) => {
|
|
305
|
+
const key = `${ciPrefix(id, pr.number)}${slug(file)}`.slice(0, 64);
|
|
306
|
+
const verdict = run.conclusion === "failure" ? "failed" : run.conclusion.replace("_", " ");
|
|
307
|
+
return {
|
|
308
|
+
number: pr.number,
|
|
309
|
+
user: ACTIONS,
|
|
310
|
+
lifecycle: {
|
|
311
|
+
type: failed ? "ci.failed" : "ci.passed",
|
|
312
|
+
title: `PR #${pr.number}`,
|
|
313
|
+
url: `https://github.com/${repo}/pull/${pr.number}`,
|
|
314
|
+
labels: failed ? { [key]: run.conclusion } : {},
|
|
315
|
+
unset: failed ? [] : [key],
|
|
316
|
+
reply: failed ? `${run.name} ${verdict} on ${repo.slice(repo.indexOf("/") + 1)}#${pr.number} at ${run.head_sha.slice(0, 7)}${run.html_url ? `: ${run.html_url}` : ""}` : null,
|
|
317
|
+
createRoot: false
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
});
|
|
321
|
+
}
|
|
271
322
|
const GitHubSubject = z.object({
|
|
272
323
|
type: z.enum(["pull_request", "issue"]),
|
|
273
324
|
repo: z.string(),
|
|
@@ -303,6 +354,7 @@ const prTypes = [
|
|
|
303
354
|
"review.submitted",
|
|
304
355
|
"review.dismissed"
|
|
305
356
|
];
|
|
357
|
+
const ciTypes = ["ci.failed", "ci.passed"];
|
|
306
358
|
const issueTypes = [
|
|
307
359
|
"issue.opened",
|
|
308
360
|
"issue.edited",
|
|
@@ -328,13 +380,28 @@ const issueLifecycle = (type) => lifecycleEvent.extend({
|
|
|
328
380
|
subject: GitHubSubject.extend({ type: z.literal("issue") }),
|
|
329
381
|
raw: GitHubPayload.extend({ issue: NativeItem })
|
|
330
382
|
});
|
|
383
|
+
const ciLifecycle = (type) => lifecycleEvent.extend({
|
|
384
|
+
type: z.literal(type),
|
|
385
|
+
subject: GitHubSubject.extend({ type: z.literal("pull_request") }),
|
|
386
|
+
raw: z.looseObject({
|
|
387
|
+
action: z.string().optional(),
|
|
388
|
+
workflow_run: z.looseObject({
|
|
389
|
+
name: z.string(),
|
|
390
|
+
path: z.string(),
|
|
391
|
+
conclusion: z.string(),
|
|
392
|
+
head_sha: z.string(),
|
|
393
|
+
html_url: z.string().optional()
|
|
394
|
+
})
|
|
395
|
+
})
|
|
396
|
+
});
|
|
331
397
|
const GitHubEvent = z.discriminatedUnion("type", [
|
|
332
398
|
messageEvent.extend(githubFields),
|
|
333
399
|
editedEvent.extend(githubFields),
|
|
334
400
|
deletedEvent.extend(githubFields),
|
|
335
401
|
reactionEvent.extend(githubFields),
|
|
336
402
|
...prTypes.map(prLifecycle),
|
|
337
|
-
...issueTypes.map(issueLifecycle)
|
|
403
|
+
...issueTypes.map(issueLifecycle),
|
|
404
|
+
...ciTypes.map(ciLifecycle)
|
|
338
405
|
]);
|
|
339
406
|
/**
|
|
340
407
|
* Syncs GitHub with the board: `app` is a Vercel Connect connector
|
|
@@ -513,7 +580,8 @@ var GitHubProvider = class extends ChatSyncProvider {
|
|
|
513
580
|
if (![
|
|
514
581
|
"pull_request",
|
|
515
582
|
"pull_request_review",
|
|
516
|
-
"issues"
|
|
583
|
+
"issues",
|
|
584
|
+
"workflow_run"
|
|
517
585
|
].includes(name)) return [];
|
|
518
586
|
let parsed;
|
|
519
587
|
try {
|
|
@@ -521,6 +589,21 @@ var GitHubProvider = class extends ChatSyncProvider {
|
|
|
521
589
|
} catch {
|
|
522
590
|
return [];
|
|
523
591
|
}
|
|
592
|
+
const repo = parsed.repository.full_name;
|
|
593
|
+
if (name === "workflow_run") {
|
|
594
|
+
const delivery = headers.get("x-github-delivery") ?? `${name}:${parsed.workflow_run?.id}`;
|
|
595
|
+
return workflowRun(parsed).map((found) => ({
|
|
596
|
+
event: {
|
|
597
|
+
kind: "lifecycle",
|
|
598
|
+
channel: `${key}:${repo}:pulls`,
|
|
599
|
+
thread: `${key}:${repo}:${found.number}`,
|
|
600
|
+
author: author(found.user),
|
|
601
|
+
...found.lifecycle
|
|
602
|
+
},
|
|
603
|
+
raw: parsed,
|
|
604
|
+
dedupe: `lifecycle:${delivery}:${found.number}`
|
|
605
|
+
}));
|
|
606
|
+
}
|
|
524
607
|
const found = lifecycle(name, parsed);
|
|
525
608
|
if (!found) return [];
|
|
526
609
|
const item = parsed.pull_request ?? parsed.issue;
|
|
@@ -529,9 +612,8 @@ var GitHubProvider = class extends ChatSyncProvider {
|
|
|
529
612
|
...tagsOf(item),
|
|
530
613
|
...found.lifecycle.labels
|
|
531
614
|
},
|
|
532
|
-
owns: ownedBy(item)
|
|
615
|
+
owns: [...ownedBy(item), ...found.lifecycle.owns ?? []]
|
|
533
616
|
});
|
|
534
|
-
const repo = parsed.repository.full_name;
|
|
535
617
|
const thread = name === "issues" ? `${key}:${repo}:issue:${found.number}` : `${key}:${repo}:${found.number}`;
|
|
536
618
|
const delivery = headers.get("x-github-delivery") ?? `${name}:${found.lifecycle.type}:${found.number}`;
|
|
537
619
|
return [{
|
package/dist/sync-linear.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Rt as SourceRead } from "./routes-
|
|
2
|
-
import { _ as SyncFn, b as SyncUnit, f as ResolvedTarget, l as ReceivedEvent, o as ProviderPost, p as SyncContext, r as ProviderDelivery } from "./provider-
|
|
3
|
-
import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-
|
|
1
|
+
import { Rt as SourceRead } from "./routes-BpvyXQwv.mjs";
|
|
2
|
+
import { _ as SyncFn, b as SyncUnit, f as ResolvedTarget, l as ReceivedEvent, o as ProviderPost, p as SyncContext, r as ProviderDelivery } from "./provider-WjdBsRLR.mjs";
|
|
3
|
+
import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-BSHlV2lw.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { Adapter } from "chat";
|
|
6
6
|
//#region src/sync/linear.d.ts
|
package/dist/sync-slack.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { qn as ExternalLink } from "./routes-
|
|
2
|
-
import { _ as SyncFn, f as ResolvedTarget, o as ProviderPost, p as SyncContext, r as ProviderDelivery, s as ProviderSender, x as channels } from "./provider-
|
|
3
|
-
import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-
|
|
1
|
+
import { qn as ExternalLink } from "./routes-BpvyXQwv.mjs";
|
|
2
|
+
import { _ as SyncFn, f as ResolvedTarget, o as ProviderPost, p as SyncContext, r as ProviderDelivery, s as ProviderSender, x as channels } from "./provider-WjdBsRLR.mjs";
|
|
3
|
+
import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-BSHlV2lw.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { Adapter } from "chat";
|
|
6
6
|
//#region src/sync/slack-deployments.d.ts
|
package/dist/sync.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Gn as ExternalEvent, Kn as ExternalFile, Wn as ExternalAuthor } from "./routes-
|
|
2
|
-
import { A as SyncRoot, C as mirror, D as RootOverride, E as ProviderEvent, M as eventSchema, N as VercelDeployment, O as SyncOverrides, S as into, T as EventBase, _ as SyncFn, a as ProviderOptions, b as SyncUnit, c as Receive, d as Renderer, f as ResolvedTarget, g as Sync, h as UnreadableError, i as ProviderFile, j as envelope, k as SyncResult, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, p as SyncContext, r as ProviderDelivery, u as RenderInput, v as SyncIn, w as render, x as channels, y as SyncOut } from "./provider-
|
|
1
|
+
import { Gn as ExternalEvent, Kn as ExternalFile, Wn as ExternalAuthor } from "./routes-BpvyXQwv.mjs";
|
|
2
|
+
import { A as SyncRoot, C as mirror, D as RootOverride, E as ProviderEvent, M as eventSchema, N as VercelDeployment, O as SyncOverrides, S as into, T as EventBase, _ as SyncFn, a as ProviderOptions, b as SyncUnit, c as Receive, d as Renderer, f as ResolvedTarget, g as Sync, h as UnreadableError, i as ProviderFile, j as envelope, k as SyncResult, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, p as SyncContext, r as ProviderDelivery, u as RenderInput, v as SyncIn, w as render, x as channels, y as SyncOut } from "./provider-WjdBsRLR.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, type VercelDeployment, channels, envelope, eventSchema, into, mirror, render };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { c as fileNameProblem, i as ATTACHMENT_BYTES_MAX, s as fileName } from "./profile-header-O8wC8yk8.mjs";
|
|
2
2
|
import "./schemas-CUSTEFIy.mjs";
|
|
3
3
|
import { l as isThreadTarget } from "./external-DkWafjn-.mjs";
|
|
4
|
-
import { $ as routes, b as Filters } from "./routes-
|
|
5
|
-
import { r as badRequest, t as HttpError } from "./errors-
|
|
6
|
-
import { i as afterRetry } from "./middleware-
|
|
7
|
-
import { t as VERSION } from "./version-
|
|
4
|
+
import { $ as routes, b as Filters } from "./routes-GF5ukHYX.mjs";
|
|
5
|
+
import { r as badRequest, t as HttpError } from "./errors-Cv0TGBt5.mjs";
|
|
6
|
+
import { i as afterRetry } from "./middleware-DXiwepsR.mjs";
|
|
7
|
+
import { t as VERSION } from "./version-CBjh_ogp.mjs";
|
|
8
8
|
import { t as own } from "./own-OwgPWdmh.mjs";
|
|
9
9
|
import { o as options } from "./commands-B_gbi2sU.mjs";
|
|
10
10
|
import { z } from "zod";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as unauthorized } from "./errors-
|
|
2
|
-
import { S as trustedIssuers, _ as markVerified, a as TOKENS, h as issuerName, o as VERCEL_ISSUER, x as subFits, y as privateHost } from "./auth-
|
|
1
|
+
import { d as unauthorized } from "./errors-Cv0TGBt5.mjs";
|
|
2
|
+
import { S as trustedIssuers, _ as markVerified, a as TOKENS, h as issuerName, o as VERCEL_ISSUER, x as subFits, y as privateHost } from "./auth-C2CxMl2p.mjs";
|
|
3
3
|
import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
|
|
4
4
|
//#region src/server/identity.ts
|
|
5
5
|
let fromDisk;
|
|
@@ -207,7 +207,8 @@ matches the tails, and the route at the top of this page runs `run`:
|
|
|
207
207
|
`POST /watchers` to it, and when a wake-up shows the API holds an older set.
|
|
208
208
|
Nothing happens before that: creating the board does no I/O. On Vercel, its
|
|
209
209
|
URL is its production domain, or a preview's own; a request's `Host` never
|
|
210
|
-
counts.
|
|
210
|
+
counts. The API holds up to 64 watchers per registration, 256 per board
|
|
211
|
+
(400 `too_many_watchers`). Anyone else's credentials
|
|
211
212
|
get 403 `watchers_need_project`, so with them it doesn't try, and runs its
|
|
212
213
|
watchers as tails instead (off Vercel: see
|
|
213
214
|
[How it runs](#how-it-runs)).
|
|
@@ -233,8 +233,9 @@ vb tasks create work --file plan.json --idempotency-key cve-123
|
|
|
233
233
|
other key is refused before a task is made, so a `need` for `needs` can't
|
|
234
234
|
make a task that waits for nothing.
|
|
235
235
|
- **A task's `key` names it for the others of the plan.** `needs` takes
|
|
236
|
-
`{ "key": "fix" }` for a task of the plan, before it or after
|
|
237
|
-
for one that's there
|
|
236
|
+
`"fix"` or `{ "key": "fix" }` for a task of the plan, before it or after
|
|
237
|
+
it, or an ID for one that's there, as it is (`"812"`) or as
|
|
238
|
+
`{ "id": "812" }`. A string that's a key of the plan is that key.
|
|
238
239
|
- **Up to 100 tasks are one write:** all of them or none, and none shows
|
|
239
240
|
before all have landed. A longer plan goes in several writes, each task
|
|
240
241
|
after the ones it waits for, so it isn't one: a ready task of an earlier
|
|
@@ -329,6 +330,26 @@ A claim in code holds its own `epoch` and `token`, and `team.tasks.held(id,
|
|
|
329
330
|
{ epoch, token })` gives the same writes to a process that kept them. See
|
|
330
331
|
[`tasks`](../04-reference/02-board.md#tasks).
|
|
331
332
|
|
|
333
|
+
A run that can't keep a token can bring its own instead. Make it a secret
|
|
334
|
+
you can derive again from the run's ID, so every process of the run gets the
|
|
335
|
+
same one and nobody else can guess it. Anyone who can label in the channel
|
|
336
|
+
and knows the token can write through the claim:
|
|
337
|
+
|
|
338
|
+
```ts
|
|
339
|
+
import { createHmac } from 'node:crypto'
|
|
340
|
+
import { board } from '@vercel/board'
|
|
341
|
+
|
|
342
|
+
const team = board()
|
|
343
|
+
const id = process.env.TASK_ID!
|
|
344
|
+
const runId = process.env.RUN_ID!
|
|
345
|
+
const token = createHmac('sha256', process.env.CLAIM_SECRET!).update(runId).digest('base64url')
|
|
346
|
+
|
|
347
|
+
await team.tasks.claim(id, { token })
|
|
348
|
+
// Later, in another process:
|
|
349
|
+
const { message } = await team.thread(id, { limit: 1 })
|
|
350
|
+
await team.tasks.held(id, { epoch: message.task!.epoch, token }).complete('fixed')
|
|
351
|
+
```
|
|
352
|
+
|
|
332
353
|
## How it runs
|
|
333
354
|
|
|
334
355
|
- **The board that keeps the log keeps the tasks.** [`local()`](./10-local.md)
|
|
@@ -103,8 +103,10 @@ issue. Resolving review conversations isn't synced.
|
|
|
103
103
|
| `pr.edited`, `issue.edited` | A new title edits the root to say it, and its copies elsewhere follow. A new description changes nothing |
|
|
104
104
|
| `pr.ready`, `pr.draft` | Sets `state` to `open` or `draft` |
|
|
105
105
|
| `pr.reopened` | A reply ("reopened by julian") and `state=open`, or `state=draft` for a draft |
|
|
106
|
-
| `pr.synchronized` | New commits: sets `head` to the PR's latest commit
|
|
106
|
+
| `pr.synchronized` | New commits: sets `head` to the PR's latest commit and unsets the PR's `ci.<repo ID>-<number>.*`, with no reply |
|
|
107
107
|
| `pr.closed` | A reply ("merged by julian" or "closed by julian") and `state=merged` or `state=closed` |
|
|
108
|
+
| `ci.failed` | A GitHub Actions workflow failed, timed out, or didn't start on the PR's latest commit: a reply from `github-actions[bot]` ("check failed on www#123 at a1b2c3d: <run link>") and `ci.<repo ID>-<number>.<workflow file>=<conclusion>` |
|
|
109
|
+
| `ci.passed` | That workflow passed on the PR's latest commit: unsets `ci.<repo ID>-<number>.<workflow file>`, with no reply |
|
|
108
110
|
| `review.submitted` | A reply with the verdict ("approved by ada", "changes requested by ada") and the review's body. Approvals and change requests set `review` |
|
|
109
111
|
| `review.dismissed` | Unsets `review` |
|
|
110
112
|
| `issue.opened` | A root labeled `issue=owner/repo#45` and `state=open` |
|
|
@@ -124,7 +126,7 @@ without polling it:
|
|
|
124
126
|
|
|
125
127
|
| Root | Labels |
|
|
126
128
|
| --- | --- |
|
|
127
|
-
| PR | `state=draft\|open\|merged\|closed`, `review=approved\|changes_requested`, `head=<sha>` (the commit the PR is at) |
|
|
129
|
+
| PR | `state=draft\|open\|merged\|closed`, `review=approved\|changes_requested`, `head=<sha>` (the commit the PR is at), `ci.<repo ID>-<number>.<workflow file>=failure\|timed_out\|startup_failure` per workflow failing on it |
|
|
128
130
|
| Issue | `state=open\|closed` |
|
|
129
131
|
| Both | `tag.<label>=<name>` per GitHub label, `assignee.<login>=<login>` per assignee |
|
|
130
132
|
|
|
@@ -184,9 +186,10 @@ lookup.
|
|
|
184
186
|
## Setup
|
|
185
187
|
|
|
186
188
|
1. Create a GitHub App, through Vercel Connect or by hand.
|
|
187
|
-
2. Give it **Issues** and **Pull requests** read and write permissions
|
|
189
|
+
2. Give it **Issues** and **Pull requests** read and write permissions, and
|
|
190
|
+
**Actions** read for CI results.
|
|
188
191
|
3. Subscribe it to **Pull requests**, **Pull request reviews**, **Pull request
|
|
189
|
-
review comments**, **Issues**, and **
|
|
192
|
+
review comments**, **Issues**, **Issue comments**, and **Workflow runs**.
|
|
190
193
|
4. Point its webhook at `https://<host>/api/board/webhooks/github`: Connect's
|
|
191
194
|
trigger path, or the App's webhook URL with a secret.
|
|
192
195
|
5. Install it on the repos you map.
|
|
@@ -137,6 +137,60 @@ memory for that handle and its `--as`, so a later call on it settles the task,
|
|
|
137
137
|
and another handle holds none. `tasks run` answers 2: it runs a command on the CLI's
|
|
138
138
|
machine.
|
|
139
139
|
|
|
140
|
+
On a serverless host, the call that settles a task can run on another
|
|
141
|
+
instance. To support that, pass `claims`, a store for each profile a call
|
|
142
|
+
writes as (`null` for the handle's own). Claims then live there instead of in
|
|
143
|
+
memory:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { board } from '@vercel/board'
|
|
147
|
+
import { vb, type Claims } from '@vercel/board/cli'
|
|
148
|
+
|
|
149
|
+
const team = board().as('triage')
|
|
150
|
+
|
|
151
|
+
const claims = (profile: string | null): Claims => {
|
|
152
|
+
const key = (task: string) => `claims:${profile ?? '-'}:${task}`
|
|
153
|
+
return {
|
|
154
|
+
get: async (task) => /* await kv.get(key(task)) */ null,
|
|
155
|
+
put: async (task, claim) => { /* await kv.set(key(task), claim) */ },
|
|
156
|
+
drop: async (task) => { /* await kv.del(key(task)) */ },
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
await vb(team, ['tasks', 'claim', '812'], { claims })
|
|
161
|
+
// Later, on any instance:
|
|
162
|
+
await vb(team, ['tasks', 'complete', '812', 'fixed'], { claims })
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
A claim's token goes to the store and never to stdout, so keep the store
|
|
166
|
+
private. A claim's `until` tells you when its lease ends, so it can serve as
|
|
167
|
+
the store's expiry. A store is for one board: if one holds claims for several
|
|
168
|
+
boards, put the board in its keys.
|
|
169
|
+
|
|
170
|
+
A run with a stable ID can skip the store: pass `claimToken`, a secret it
|
|
171
|
+
derives again on every instance, such as an HMAC-SHA256 of the run's ID in
|
|
172
|
+
base64url. Claims then carry that token, so any call that has it renews and
|
|
173
|
+
settles the claim, and claiming a task you already hold answers the claim
|
|
174
|
+
you have:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
import { createHmac } from 'node:crypto'
|
|
178
|
+
import { board } from '@vercel/board'
|
|
179
|
+
import { vb } from '@vercel/board/cli'
|
|
180
|
+
|
|
181
|
+
const team = board().as('triage')
|
|
182
|
+
const runId = process.env.RUN_ID!
|
|
183
|
+
const claimToken = createHmac('sha256', process.env.CLAIM_SECRET!).update(runId).digest('base64url')
|
|
184
|
+
|
|
185
|
+
await vb(team, ['tasks', 'claim', '812'], { claimToken })
|
|
186
|
+
// Later, on any instance:
|
|
187
|
+
await vb(team, ['tasks', 'complete', '812', 'fixed'], { claimToken })
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The token never reaches stdout either. Anyone who can label in the task's
|
|
191
|
+
channel and knows it can write through the claim, so treat the secret like
|
|
192
|
+
any other credential.
|
|
193
|
+
|
|
140
194
|
`commandWord(argv)` answers the command `argv` runs (`tail` for
|
|
141
195
|
`['--as', 'triage', 'tail', 'dev']`), for a tool that keeps some commands to
|
|
142
196
|
itself.
|
|
@@ -352,9 +352,9 @@ with 501 `no_scheduler`. See
|
|
|
352
352
|
tasks.create(channel: string, input: string | NewTaskOptions): Promise<{ task: MessageView; claim?: ClaimedTask }>
|
|
353
353
|
tasks.create(thread: { re: string }, input?: TaskOptions): Promise<{ task: MessageView; claim?: ClaimedTask }>
|
|
354
354
|
tasks.createMany(channel: string, tasks: TaskInBatch[], opts?: { id?: string }): Promise<MessageView[]>
|
|
355
|
-
tasks.list(query?: { channel?: string; state?: string; label?: Record<string, string> | string[]; by?: string; owner?: string; for?: string; needs?: string; after?: string; limit?: number }): Promise<{ tasks: ThreadSummaryView[]; cursor: string }>
|
|
356
|
-
tasks.claim(id: string, opts?: { lease?: number; signal?: AbortSignal }): Promise<ClaimedTask>
|
|
357
|
-
tasks.claim(ready: { channel: string; label?: Record<string, string>; from?: string[]; wait?: number; lease?: number }, opts?: { signal?: AbortSignal }): Promise<ClaimedTask | null>
|
|
355
|
+
tasks.list(query?: { channel?: string; state?: string; label?: Record<string, string> | string[]; by?: string; owner?: string; for?: string; needs?: string; after?: string; limit?: number; latest?: boolean }): Promise<{ tasks: ThreadSummaryView[]; cursor: string }>
|
|
356
|
+
tasks.claim(id: string, opts?: { lease?: number; token?: string; signal?: AbortSignal }): Promise<ClaimedTask>
|
|
357
|
+
tasks.claim(ready: { channel: string; label?: Record<string, string>; from?: string[]; wait?: number; lease?: number; token?: string }, opts?: { signal?: AbortSignal }): Promise<ClaimedTask | null>
|
|
358
358
|
tasks.held(id: string, claim: { epoch: number; token: string }): HeldTask
|
|
359
359
|
tasks.block(id: string, reason: string, opts?: { kind?: string }): Promise<MessageView>
|
|
360
360
|
tasks.unblock(id: string): Promise<MessageView>
|
|
@@ -388,7 +388,7 @@ if (claim) {
|
|
|
388
388
|
thread as it is, files included.
|
|
389
389
|
`TaskOptions` is `needs` (the IDs of the tasks it waits for, none of them
|
|
390
390
|
canceled), `for` (the one actor of yours that claims it,
|
|
391
|
-
`<your principal>+<profile>`), `claim`, and `
|
|
391
|
+
`<your principal>+<profile>`), `claim`, `lease`, and `token`, the claim's own as `claim` below takes it. You own the task.
|
|
392
392
|
`claim` comes back when it was made with `claim: true`.
|
|
393
393
|
- **`createMany`** starts a thread for each task in one write: all of them
|
|
394
394
|
or none, and none shows before all have landed. It answers their roots in
|
|
@@ -404,7 +404,10 @@ if (claim) {
|
|
|
404
404
|
names by ID. A handle names no owner, since several can share one, and
|
|
405
405
|
fails with 400 `invalid_from`. It answers `null`
|
|
406
406
|
when nothing is ready, after waiting up to
|
|
407
|
-
`wait` seconds. `lease` is seconds.
|
|
407
|
+
`wait` seconds. `lease` is seconds. `token` is the claim's token, your own
|
|
408
|
+
in place of one the board makes: 32 bytes in base64url (43 characters).
|
|
409
|
+
Claiming a task by ID that you hold with its token answers the claim as it
|
|
410
|
+
is.
|
|
408
411
|
- **A backend holds its own limits on a task:** how long its text, a result,
|
|
409
412
|
or a reason may be, how many tasks it waits for, how short and long a lease
|
|
410
413
|
is. The local board takes 20 `needs`, a lease of 30 to 3600 seconds, and a
|
|
@@ -432,7 +435,9 @@ if (claim) {
|
|
|
432
435
|
task stays held, and the same set changes nothing.
|
|
433
436
|
- **`list`** answers open tasks, oldest first, as thread summaries. `state`
|
|
434
437
|
is `open`, `all`, or one state. Pass `cursor` back as `after` for the next
|
|
435
|
-
page.
|
|
438
|
+
page. `latest: true` answers the `limit` last active instead, by each
|
|
439
|
+
thread's latest message, the latest active last: the board reads every task
|
|
440
|
+
that matches to find them, and builds only those. It takes no `after`.
|
|
436
441
|
|
|
437
442
|
#### Several tasks at once
|
|
438
443
|
|
package/package.json
CHANGED