@vercel/board 0.45.1 → 0.46.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-3udXjJAg.mjs → access-Crbvd2Dm.mjs} +2 -2
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +5 -5
- package/dist/{actors-DasGZnfb.mjs → actors-BBphaJ_G.mjs} +3 -3
- package/dist/{auth-aiOVE82-.mjs → auth-C-pFnJBA.mjs} +2 -2
- package/dist/{auth-BG_whr9_.d.mts → auth-CkNXnQno.d.mts} +1 -1
- package/dist/{backend-D6yTo8Un.d.mts → backend-D3p8gjba.d.mts} +126 -4
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-BvNqOQFL.mjs → chat-provider-1zpY6Qo_.mjs} +2 -2
- package/dist/{chat-provider-V2jnjVLq.d.mts → chat-provider-Bn33acHd.d.mts} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +3 -2
- package/dist/cli.mjs +6 -6
- package/dist/{commands-DewS14_P.d.mts → commands-CSZPQ38I.d.mts} +54 -0
- package/dist/{commands-CqdnjUkm.mjs → commands-D0lyo8O8.mjs} +319 -0
- package/dist/{conformance-BInS4_6b.mjs → conformance-Blzd4CXG.mjs} +972 -6
- package/dist/conformance.d.mts +6 -5
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-XVBt02Bl.mjs → engine-C_SlBihU.mjs} +15 -7
- package/dist/{errors-ZazTZh-s.mjs → errors-DZ1tbwSM.mjs} +151 -3
- package/dist/{events-D17RndlV.mjs → events-mGuhF4i5.mjs} +2 -2
- package/dist/{exports-DCxecX15.mjs → exports-DQauuHrc.mjs} +1226 -42
- package/dist/exports-DUX_Yzo7.d.mts +44 -0
- package/dist/{external-DfhN7lKK.mjs → external-BVr1Sq0y.mjs} +1 -1
- package/dist/{index-Djmr4GzQ.d.mts → index-BHXg4Xdo.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +5 -5
- package/dist/index.node.d.mts +7 -6
- package/dist/index.node.mjs +5 -4
- package/dist/inspect/app.js +215 -115
- package/dist/inspect/engine.js +5 -5
- package/dist/{inspect-CHsgnf_5.mjs → inspect-2OIjv2lW.mjs} +242 -20
- package/dist/inspect-F-b4GPXX.mjs +2 -0
- package/dist/{local-DE9vmanM.mjs → local-11FMUJrU.mjs} +1593 -60
- package/dist/{main-CF1Me3jg.mjs → main-BYmbTDgo.mjs} +1167 -24
- package/dist/{memory-DyEL0fvN.mjs → memory-CZBdVNn8.mjs} +2 -2
- package/dist/{middleware-BHHKHA9q.mjs → middleware-BKsTcMAv.mjs} +2 -2
- package/dist/{provider-BC9mPYVh.d.mts → provider-D3bfHRHA.d.mts} +119 -3
- package/dist/{routes-CkUetTO2.mjs → routes-B2HHHD_C.mjs} +246 -6
- package/dist/{routes-zm4TXKCC.d.mts → routes-NEc6w3QC.d.mts} +540 -6
- package/dist/{schemas-BhZaystC.mjs → schemas-7VFdomFB.mjs} +34 -1
- package/dist/{serve-CEMvl0EH.mjs → serve-DS2T2iWI.mjs} +4 -4
- package/dist/{server-Bmz0zqYM.mjs → server-Ch3tuK2k.mjs} +10 -10
- package/dist/{serving-BLVRrJ7P.mjs → serving-9riPNrHk.mjs} +1 -1
- package/dist/{sql-CyVcjw8x.mjs → sql-Bml29DpM.mjs} +174 -9
- package/dist/{sqlite-Con-8duk.mjs → sqlite-4C5u7-ag.mjs} +2 -2
- package/dist/{sqlite-db-BdzxtUOV.mjs → sqlite-db-eVb9v3zc.mjs} +1 -1
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +2 -2
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-linear.mjs +2 -2
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +4 -4
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{origin-BbwhnKrg.mjs → task-batch-BJcLiYe1.mjs} +83 -8
- package/dist/{tokens-BErYXuHZ.mjs → tokens-DPKF_cb5.mjs} +2 -2
- package/docs/01-board/01-mounting.md +1 -1
- package/docs/01-board/08-middleware.md +7 -0
- package/docs/01-board/11-tasks.md +348 -0
- package/docs/03-guides/02-inspector.md +66 -9
- package/docs/03-guides/06-sandboxed-agents.md +5 -3
- package/docs/03-guides/07-build-a-ui.md +210 -0
- package/docs/04-reference/01-cli.md +216 -8
- package/docs/04-reference/02-board.md +277 -2
- package/docs/04-reference/03-http.md +184 -10
- package/docs/04-reference/05-conformance.md +10 -7
- package/package.json +1 -1
- package/dist/exports-Gspe1eEq.d.mts +0 -4
- package/dist/inspect-C8U3A4jQ.mjs +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as sqlTables } from "./sql-
|
|
1
|
+
import { r as sqlTables } from "./sql-Bml29DpM.mjs";
|
|
2
2
|
import { t as memory$1 } from "./store-memory-CKQVEzXN.mjs";
|
|
3
|
-
import { t as sqliteDb } from "./sqlite-db-
|
|
3
|
+
import { t as sqliteDb } from "./sqlite-db-eVb9v3zc.mjs";
|
|
4
4
|
//#region src/store/memory.ts
|
|
5
5
|
/**
|
|
6
6
|
* A board that lives in memory, for tests: its log in A2's memory store, its
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as HttpError } from "./errors-
|
|
2
|
-
import {
|
|
1
|
+
import { t as HttpError } from "./errors-DZ1tbwSM.mjs";
|
|
2
|
+
import { m as MESSAGE_TEXT_MAX, p as Labels } from "./schemas-7VFdomFB.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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as MessagesQueryInput, A as FiltersInput, An as ExternalAuthor, Bt as SyncThreadView, Ct as SchemaInput, En as Attachment, Ft as SyncFindView, Gt as TasksPage, Ht as TaskClaim, L as InboxEntry, Lt as SyncImportInput, Mn as ExternalFile, N as GrantInput, Nn as ExternalLink, Nt as SyncFindInput, O as Explanation, Ot as SourceRead, P as GrantView, Pn as Link, Qt as ThreadsQueryInput, R as InboxItem, S as Discovery, Tn as ExternalCopy, Tt as SourceJoin, Vt as SyncedView, X as MessageView, Xt as ThreadsPage, Y as Me, Yt as ThreadView, Z as MessagesPage, bt as SchedulesQueryInput, jn as ExternalEvent, lt as RegisterInput, n as ActorView, nn as UpdateGrantInput, q as MatchView, qt as TasksQueryInput, s as BoardEventView, u as ChannelView, ut as RegistrationView, vt as ScheduleView, w as EventsPage, wn as Actor, wt as SchemaView, zt as SyncReceiptInput } from "./routes-NEc6w3QC.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/client/client.d.ts
|
|
4
4
|
/**
|
|
@@ -77,6 +77,54 @@ type ScheduleTiming = {
|
|
|
77
77
|
times?: number;
|
|
78
78
|
};
|
|
79
79
|
type ScheduleOptions = Omit<PostOptions, 'sync' | 'id'> & ScheduleTiming;
|
|
80
|
+
/**
|
|
81
|
+
* What makes a thread a task: the tasks it waits for (`needs`, by their IDs), the one actor of
|
|
82
|
+
* yours that claims it (`for`, `<your principal>+<profile>`), and `claim`, which claims it in the
|
|
83
|
+
* same write, for `lease` seconds.
|
|
84
|
+
*/
|
|
85
|
+
type TaskOptions = {
|
|
86
|
+
needs?: string[];
|
|
87
|
+
for?: string | null;
|
|
88
|
+
claim?: boolean;
|
|
89
|
+
lease?: number;
|
|
90
|
+
};
|
|
91
|
+
/** A new thread that's a task: its root's text, labels, `noSync`, `attachments`, and `id`, as a post takes them, and what makes it a task. */
|
|
92
|
+
type NewTaskOptions = TaskOptions & Pick<PostOptions, 'text' | 'labels' | 'noSync' | 'attachments' | 'id'>;
|
|
93
|
+
/**
|
|
94
|
+
* One task of several made together: its root's text, labels, `noSync`, and `attachments`, as a
|
|
95
|
+
* post takes them. `key` is a name for it among the others, and `needs` takes a task's ID, or
|
|
96
|
+
* `{ key }` for one made with it, before or after it. `for` is the one actor of yours that claims it.
|
|
97
|
+
*/
|
|
98
|
+
type TaskInBatch = Required<Pick<PostOptions, 'text'>> & Pick<PostOptions, 'labels' | 'noSync' | 'attachments'> & {
|
|
99
|
+
key?: string;
|
|
100
|
+
needs?: (string | {
|
|
101
|
+
key: string;
|
|
102
|
+
})[];
|
|
103
|
+
for?: string | null;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* What a claim does, each fenced by the claim: once it's over (released, settled, held, taken over,
|
|
107
|
+
* or past its lease), they throw a 409 `claim_lost` and change nothing.
|
|
108
|
+
*/
|
|
109
|
+
type HeldTask = {
|
|
110
|
+
/** Extends the lease from now, by `lease` seconds (the board's default without one). Answers the claim with its new `until`. */
|
|
111
|
+
renew(lease?: number): Promise<ClaimedTask>;
|
|
112
|
+
/** Gives the task back: it's ready again. */
|
|
113
|
+
release(): Promise<MessageView>;
|
|
114
|
+
complete(result?: string): Promise<MessageView>;
|
|
115
|
+
fail(reason: string): Promise<MessageView>;
|
|
116
|
+
/** Holds the task for a person, which ends the claim: `kind` says what for (`needs_input`, `awaiting_approval`). */
|
|
117
|
+
block(reason: string, opts?: {
|
|
118
|
+
kind?: string;
|
|
119
|
+
}): Promise<MessageView>;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* A task you hold until `until`: its root as the claim left it, and the claim's `epoch` and
|
|
123
|
+
* `token`, which `held` takes to act on it from another process.
|
|
124
|
+
*/
|
|
125
|
+
type ClaimedTask = HeldTask & TaskClaim & {
|
|
126
|
+
task: MessageView;
|
|
127
|
+
};
|
|
80
128
|
/** What `upload` takes: the bytes, and what to call them. */
|
|
81
129
|
type UploadInput = {
|
|
82
130
|
data: Blob | Uint8Array<ArrayBuffer>;
|
|
@@ -168,7 +216,7 @@ declare function createBoardClient(options: ClientOptions): {
|
|
|
168
216
|
thread: (id: string) => Promise<ThreadView>;
|
|
169
217
|
/** Your own post with the client ID you gave it, as posting it answered: 404 `post_not_found` when there's none. */
|
|
170
218
|
posted: (id: string) => Promise<MessageView>;
|
|
171
|
-
/** Threads with a matching message, one summary each (root, reply count, latest reply), by latest activity. `limit` counts threads
|
|
219
|
+
/** Threads with a matching message, one summary each (root, reply count, latest reply), by latest activity. `limit` counts threads; `before` takes a page's `older`. */
|
|
172
220
|
threads: (query?: Filters & Omit<ThreadsQueryInput, keyof FiltersInput>) => Promise<ThreadsPage>;
|
|
173
221
|
post(channel: string, input: string | PostOptions): Promise<MessageView>;
|
|
174
222
|
reply(id: string, input: string | ReplyOptions): Promise<MessageView>;
|
|
@@ -189,6 +237,74 @@ declare function createBoardClient(options: ClientOptions): {
|
|
|
189
237
|
schedule: ScheduleView;
|
|
190
238
|
canceled: boolean;
|
|
191
239
|
}>;
|
|
240
|
+
/**
|
|
241
|
+
* Tasks: threads someone's agents are to do, with a state the board keeps. A task's ID is its
|
|
242
|
+
* root's, and its root's `task` says its state, whose it is, what it waits for, and who holds
|
|
243
|
+
* it. A board that keeps no tasks fails each of these with 501 `no_tasks`.
|
|
244
|
+
*/
|
|
245
|
+
tasks: {
|
|
246
|
+
/**
|
|
247
|
+
* Tasks, oldest first, each as its thread's summary: open ones (`waiting`, `ready`, `claimed`,
|
|
248
|
+
* `blocked`) unless `state` says `all` or names one. `owner` and `for` take a handle or an ID,
|
|
249
|
+
* `needs` a task's ID, for the tasks that wait for it. `cursor`, as `after`, reads the next page.
|
|
250
|
+
*/
|
|
251
|
+
list: (query?: Omit<TasksQueryInput, 'label'> & {
|
|
252
|
+
label?: Record<string, string> | string[];
|
|
253
|
+
}) => Promise<TasksPage>;
|
|
254
|
+
create: {
|
|
255
|
+
(target: string, input: string | NewTaskOptions): Promise<{
|
|
256
|
+
task: MessageView;
|
|
257
|
+
claim?: ClaimedTask;
|
|
258
|
+
}>;
|
|
259
|
+
(target: {
|
|
260
|
+
re: string;
|
|
261
|
+
}, input?: TaskOptions): Promise<{
|
|
262
|
+
task: MessageView;
|
|
263
|
+
claim?: ClaimedTask;
|
|
264
|
+
}>;
|
|
265
|
+
};
|
|
266
|
+
createMany: (channel: string, tasks: TaskInBatch[], opts?: {
|
|
267
|
+
id?: string;
|
|
268
|
+
}) => Promise<MessageView[]>;
|
|
269
|
+
claim: {
|
|
270
|
+
(target: string, opts?: {
|
|
271
|
+
lease?: number;
|
|
272
|
+
signal?: AbortSignal;
|
|
273
|
+
}): Promise<ClaimedTask>;
|
|
274
|
+
(target: {
|
|
275
|
+
channel: string;
|
|
276
|
+
label?: Record<string, string>;
|
|
277
|
+
from?: string[];
|
|
278
|
+
wait?: number;
|
|
279
|
+
lease?: number;
|
|
280
|
+
}, opts?: {
|
|
281
|
+
signal?: AbortSignal;
|
|
282
|
+
}): Promise<ClaimedTask | null>;
|
|
283
|
+
};
|
|
284
|
+
/** What a claim you hold does, from the `epoch` and `token` it answered: for a process that kept them, as `vb` does between commands. */
|
|
285
|
+
held: (id: string, proof: {
|
|
286
|
+
epoch: number;
|
|
287
|
+
token: string;
|
|
288
|
+
}) => HeldTask;
|
|
289
|
+
/** Holds a task no one has claimed for a person: yours, or any with manage in its channel. A claimed one's hold is its claim's (`claim.block`). */
|
|
290
|
+
block: (id: string, reason: string, opts?: {
|
|
291
|
+
kind?: string;
|
|
292
|
+
}) => Promise<MessageView>;
|
|
293
|
+
/** Lifts a hold: the task is ready again, or waiting while a task it needs hasn't completed. */
|
|
294
|
+
unblock: (id: string) => Promise<MessageView>;
|
|
295
|
+
/** Makes a failed task ready again, in place: what waits for it still does. */
|
|
296
|
+
reopen: (id: string) => Promise<MessageView>;
|
|
297
|
+
/** Assigns a task to one of its owner's actors (`<owner>+<profile>`), the only one that claims it then, or with null to anyone who may. */
|
|
298
|
+
assign: (id: string, actor: string | null) => Promise<MessageView>;
|
|
299
|
+
/**
|
|
300
|
+
* Replaces what a task waits for, by their IDs: it waits for those now, and is ready once they've all completed, or
|
|
301
|
+
* at once with none. For its owner, while no one holds it and it isn't finished. One that would make it wait for
|
|
302
|
+
* itself, through however many tasks, throws a 400 `invalid_needs`.
|
|
303
|
+
*/
|
|
304
|
+
needs: (id: string, needs: string[]) => Promise<MessageView>;
|
|
305
|
+
/** Cancels a task that hasn't completed, ending any claim. What waits for it keeps waiting. */
|
|
306
|
+
cancel: (id: string, reason: string) => Promise<MessageView>;
|
|
307
|
+
};
|
|
192
308
|
/**
|
|
193
309
|
* A new grant: `principals` may do what `can` says, a map from channel pattern to permissions
|
|
194
310
|
* (`[]` for none). The same principals again are another grant. At each channel, the most
|
|
@@ -1067,4 +1183,4 @@ declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
|
|
|
1067
1183
|
render(input: RenderInput): string;
|
|
1068
1184
|
}
|
|
1069
1185
|
//#endregion
|
|
1070
|
-
export { SyncRoot as A,
|
|
1186
|
+
export { duration as $, SyncRoot as A, ExplainPrincipal as B, mirror as C, RootOverride as D, ProviderEvent as E, BoardError as F, ProfileOption as G, HeldTask as H, ClaimedTask as I, ScheduleTiming as J, ReplyOptions as K, ErrorOrigin as L, eventSchema as M, VercelDeployment as N, SyncOverrides as O, BoardClient as P, WaitOptions as Q, EventsOptions as R, into as S, EventBase as T, NewTaskOptions as U, Filters as V, PostOptions as W, TaskOptions as X, TaskInBatch as Y, UploadInput as Z, SyncFn as _, ProviderOptions as a, SyncUnit as b, Receive as c, Renderer as d, ResolvedTarget as f, Sync as g, UnreadableError as h, ProviderFile as i, envelope as j, SyncResult as k, ReceivedEvent as l, SyncProvider as m, FileDelivery as n, ProviderPost as o, SyncContext as p, ScheduleOptions as q, ProviderDelivery as r, ProviderSender as s, FetchedLink as t, RenderInput as u, SyncIn as v, render as w, channels as x, SyncOut as y, EventsState as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-
|
|
1
|
+
import { b as DIRECT_UPLOAD_BYTES_MAX } from "./errors-DZ1tbwSM.mjs";
|
|
2
|
+
import { C as SentText, M as storable, O as TaskState, S as SentTaskNote, c as EDITED_HOLD, d as LabelKey, f as LabelValue, g as MessageText, j as platformAvatar, l as Emoji, m as MESSAGE_TEXT_MAX, o as CHANNEL_PATTERN_MAX, p as Labels, r as AttachmentId, s as ChannelPath, t as ActorId, x as SentTaskHoldKind } from "./schemas-7VFdomFB.mjs";
|
|
3
|
+
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-BVr1Sq0y.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/api/routes.ts
|
|
6
6
|
/**
|
|
@@ -53,10 +53,17 @@ const MessagesQuery = Filters.extend({
|
|
|
53
53
|
before: id.optional(),
|
|
54
54
|
limit: z.coerce.number().int().min(1).max(500).optional()
|
|
55
55
|
});
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* `limit` counts threads: each thread with a matching message, by its latest reply. `before` is a page's
|
|
58
|
+
* `older`, for the threads last active before it; it pages backward, so it takes no `after`.
|
|
59
|
+
*/
|
|
57
60
|
const ThreadsQuery = Filters.extend({
|
|
58
61
|
after: Ref.optional(),
|
|
62
|
+
before: z.string().min(1).max(1024).optional(),
|
|
59
63
|
limit: z.coerce.number().int().min(1).max(500).optional()
|
|
64
|
+
}).refine((query) => query.before === void 0 || query.after === void 0, {
|
|
65
|
+
message: "`before` pages back from a page's `older`, and `after` reads forward: pass one",
|
|
66
|
+
path: ["before"]
|
|
60
67
|
});
|
|
61
68
|
const EventsQuery = Filters.extend({
|
|
62
69
|
after: Ref.optional(),
|
|
@@ -129,6 +136,151 @@ const SchedulesQuery = z.object({
|
|
|
129
136
|
/** Include done and canceled schedules. */
|
|
130
137
|
all: flag.optional()
|
|
131
138
|
});
|
|
139
|
+
/** A channel, or with a trailing `/` it and every channel under it: `work`, `work/`. As long as a grant's pattern for either. */
|
|
140
|
+
const ChannelOrSubtree = z.string().max(CHANNEL_PATTERN_MAX).regex(/^[a-z0-9][a-z0-9_-]*(?:\/[a-z0-9][a-z0-9_-]*)*\/?$/, "name a channel, or a channel and its subtree (work/)");
|
|
141
|
+
/**
|
|
142
|
+
* How long a claim holds its task, in seconds, 900 when left out. How short and how long one may
|
|
143
|
+
* be is the backend's to say: the local board takes 30 to 3600, and a board gives what's asked up
|
|
144
|
+
* to its own cap, never under 300.
|
|
145
|
+
*/
|
|
146
|
+
const Lease = z.number();
|
|
147
|
+
/** What a claim's own writes carry: the `epoch` and `token` its claim answered. */
|
|
148
|
+
const Claimed = {
|
|
149
|
+
epoch: z.number().int().positive(),
|
|
150
|
+
token: z.string().min(1).max(128)
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* A new thread that's a task (`channel` and `text`, with `labels`, `noSync`, `attachments`, and an
|
|
154
|
+
* `id` as a post takes them), or the thread `re` roots made one. `needs` are the tasks it waits for,
|
|
155
|
+
* `for` the one actor of its owner's that claims it, and `claim` claims it in the same write, for
|
|
156
|
+
* `lease` seconds.
|
|
157
|
+
*/
|
|
158
|
+
const CreateTaskBody = z.object({
|
|
159
|
+
channel: ChannelPath.optional(),
|
|
160
|
+
re: Ref.optional(),
|
|
161
|
+
/** As long as a post's text may be: the backend says how long that is. */
|
|
162
|
+
text: z.string().optional(),
|
|
163
|
+
labels: Labels.optional(),
|
|
164
|
+
noSync: z.boolean().optional(),
|
|
165
|
+
/** IDs from `POST /attachments`, as a post takes them. */
|
|
166
|
+
attachments: z.array(AttachmentId).optional(),
|
|
167
|
+
/** How many tasks one may wait for is the backend's to say. */
|
|
168
|
+
needs: z.array(Ref).optional(),
|
|
169
|
+
for: ActorId.nullable().optional(),
|
|
170
|
+
claim: z.boolean().optional(),
|
|
171
|
+
lease: Lease.optional(),
|
|
172
|
+
id: z.string().min(1).max(200).refine(storable, "id has a NUL character or a lone surrogate").optional()
|
|
173
|
+
}).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, {
|
|
174
|
+
message: "message text is empty",
|
|
175
|
+
path: ["text"]
|
|
176
|
+
}).refine((body) => body.text === void 0 || storable(body.text), {
|
|
177
|
+
message: "message text has a NUL character or a lone surrogate",
|
|
178
|
+
path: ["text"]
|
|
179
|
+
}).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, {
|
|
180
|
+
message: "`lease` goes with `claim`",
|
|
181
|
+
path: ["lease"]
|
|
182
|
+
});
|
|
183
|
+
/** A digest of what a batch asks for: what tells the same request under an `id` from another. */
|
|
184
|
+
const BatchRequest = z.string().min(1).max(64);
|
|
185
|
+
/** A task another task of the same batch waits for, by the `key` it goes by there. */
|
|
186
|
+
const TaskKey = z.string().min(1).refine(storable, "key has a NUL character or a lone surrogate");
|
|
187
|
+
/**
|
|
188
|
+
* Several new threads in one channel, each a task, made in one write: all of them or none. A task is
|
|
189
|
+
* what `POST /tasks` starts a thread with, less `claim`. `key` names it for the batch's others, and
|
|
190
|
+
* `needs` takes a task's ID, or `{ key }` for one of the batch, before or after it. `id` names the
|
|
191
|
+
* batch: a retry with it answers the same tasks. At most `TASK_BATCH_MAX` tasks, 400
|
|
192
|
+
* `batch_too_large` past that, which a board that holds fewer in one write answers too.
|
|
193
|
+
*/
|
|
194
|
+
const CreateTasksBody = z.object({
|
|
195
|
+
channel: ChannelPath,
|
|
196
|
+
tasks: z.array(z.object({
|
|
197
|
+
key: TaskKey.optional(),
|
|
198
|
+
/** May be empty when the task's root has attachments. As long as a post's text may be: the backend says how long that is. */
|
|
199
|
+
text: z.string(),
|
|
200
|
+
labels: Labels.optional(),
|
|
201
|
+
noSync: z.boolean().optional(),
|
|
202
|
+
/** IDs from `POST /attachments`, as a post takes them. */
|
|
203
|
+
attachments: z.array(AttachmentId).optional(),
|
|
204
|
+
/** How many tasks one may wait for is the backend's to say. */
|
|
205
|
+
needs: z.array(z.union([Ref, z.object({ key: TaskKey }).strict()])).optional(),
|
|
206
|
+
for: ActorId.nullable().optional()
|
|
207
|
+
}).refine((task) => task.text.trim().length > 0 || (task.attachments?.length ?? 0) > 0, {
|
|
208
|
+
message: "message text is empty",
|
|
209
|
+
path: ["text"]
|
|
210
|
+
}).refine((task) => storable(task.text), {
|
|
211
|
+
message: "message text has a NUL character or a lone surrogate",
|
|
212
|
+
path: ["text"]
|
|
213
|
+
})).min(1).max(100),
|
|
214
|
+
id: z.string().min(1).max(200).refine(storable, "id has a NUL character or a lone surrogate").optional(),
|
|
215
|
+
/**
|
|
216
|
+
* From a board in front of this one: its digest of what the batch asked for as it was given, before
|
|
217
|
+
* its own middleware changed anything, so both boards tell a repeat by the same request. A board
|
|
218
|
+
* with none in front makes its own. It says nothing of who writes or what: a caller that sends one
|
|
219
|
+
* changes only which of its own requests its own `id` answers.
|
|
220
|
+
*/
|
|
221
|
+
request: BatchRequest.optional()
|
|
222
|
+
});
|
|
223
|
+
/**
|
|
224
|
+
* `request` is a board's digest of what a batch asked for, as it was given: with it, the batch
|
|
225
|
+
* answers only that request, and any other under the `id` is 409 `duplicate_id`.
|
|
226
|
+
*/
|
|
227
|
+
const CreatedTasksQuery = z.object({ request: BatchRequest.optional() });
|
|
228
|
+
/** Which tasks to list: open ones unless `state` says `all` or names one. A claim whose lease has run out counts as `ready`. */
|
|
229
|
+
const TasksQuery = z.object({
|
|
230
|
+
channel: z.string().optional(),
|
|
231
|
+
state: z.union([z.enum(["open", "all"]), TaskState]).optional(),
|
|
232
|
+
label: repeated.pipe(z.array(LabelFilter)).optional(),
|
|
233
|
+
/** Who wrote the root: a handle or an actor ID, as on `/messages`. */
|
|
234
|
+
by: z.string().optional(),
|
|
235
|
+
/** Whose task it is: a handle or a principal ID. */
|
|
236
|
+
owner: z.string().optional(),
|
|
237
|
+
/** The actor it's assigned to: a handle or an actor ID. */
|
|
238
|
+
for: z.string().optional(),
|
|
239
|
+
/** A task's ID: the tasks that wait for it. */
|
|
240
|
+
needs: Ref.optional(),
|
|
241
|
+
/** A `cursor` an earlier page reported. */
|
|
242
|
+
after: Ref.optional(),
|
|
243
|
+
limit: z.coerce.number().int().min(1).max(500).optional()
|
|
244
|
+
});
|
|
245
|
+
const ClaimTaskBody = z.object({ lease: Lease.optional() }).optional();
|
|
246
|
+
/**
|
|
247
|
+
* Claims the oldest ready task in `channel` that has every label in `label`: one assigned to the
|
|
248
|
+
* caller first, then an unassigned one it owns, or whose owner `from` names by ID. `wait`
|
|
249
|
+
* holds the request up to that many seconds for one.
|
|
250
|
+
*/
|
|
251
|
+
const ClaimReadyTaskBody = z.object({
|
|
252
|
+
channel: ChannelOrSubtree,
|
|
253
|
+
label: Labels.optional(),
|
|
254
|
+
/** How many owners one claim takes from is the backend's to say. */
|
|
255
|
+
from: z.array(z.string().min(1).max(256)).optional(),
|
|
256
|
+
lease: Lease.optional(),
|
|
257
|
+
wait: z.number().min(0).max(300).optional()
|
|
258
|
+
});
|
|
259
|
+
const RenewTaskBody = z.object({
|
|
260
|
+
...Claimed,
|
|
261
|
+
lease: Lease.optional()
|
|
262
|
+
});
|
|
263
|
+
const ReleaseTaskBody = z.object(Claimed);
|
|
264
|
+
const CompleteTaskBody = z.object({
|
|
265
|
+
...Claimed,
|
|
266
|
+
result: SentTaskNote.optional()
|
|
267
|
+
});
|
|
268
|
+
const FailTaskBody = z.object({
|
|
269
|
+
...Claimed,
|
|
270
|
+
reason: SentTaskNote
|
|
271
|
+
});
|
|
272
|
+
/** A hold for a person. A claimed task's comes from its claim, with the claim's `epoch` and `token`. Kind `edited` is the board's own, so none asks for it. */
|
|
273
|
+
const BlockTaskBody = z.object({
|
|
274
|
+
reason: SentTaskNote,
|
|
275
|
+
kind: SentTaskHoldKind.refine((kind) => kind !== EDITED_HOLD, "`edited` is the board's own kind, for a task whose root someone else edited: name another").optional(),
|
|
276
|
+
epoch: Claimed.epoch.optional(),
|
|
277
|
+
token: Claimed.token.optional()
|
|
278
|
+
}).refine((body) => body.epoch === void 0 === (body.token === void 0), { message: "a claim is its `epoch` and its `token`: pass both, or neither" });
|
|
279
|
+
/** The one actor of its owner's that claims the task, or null for anyone who may. */
|
|
280
|
+
const AssignTaskBody = z.object({ for: ActorId.nullable() });
|
|
281
|
+
/** The tasks it waits for now, in place of what it waited for: none, for a task that waits for nothing. How many it may wait for is the backend's to say. */
|
|
282
|
+
const TaskNeedsBody = z.object({ needs: z.array(Ref) });
|
|
283
|
+
const CancelTaskBody = z.object({ reason: SentTaskNote });
|
|
132
284
|
const CanGrant = z.union([z.literal("all"), z.array(z.string().min(1).max(16)).max(8)]);
|
|
133
285
|
const ClaimValue = z.string().min(1).max(1e3);
|
|
134
286
|
const Environments = z.array(z.string().min(1).max(100)).min(1).max(16);
|
|
@@ -505,7 +657,7 @@ const routes = {
|
|
|
505
657
|
method: "GET",
|
|
506
658
|
path: "/messages/:id"
|
|
507
659
|
},
|
|
508
|
-
/** Threads with a matching message, one summary each, by latest activity. */
|
|
660
|
+
/** Threads with a matching message, one summary each, by latest activity. `before` takes a page's `older`. */
|
|
509
661
|
threads: {
|
|
510
662
|
method: "GET",
|
|
511
663
|
path: "/threads",
|
|
@@ -575,6 +727,94 @@ const routes = {
|
|
|
575
727
|
method: "POST",
|
|
576
728
|
path: "/schedules/:id/cancel"
|
|
577
729
|
},
|
|
730
|
+
/** Tasks, oldest first: open ones unless `state` says otherwise. */
|
|
731
|
+
tasks: {
|
|
732
|
+
method: "GET",
|
|
733
|
+
path: "/tasks",
|
|
734
|
+
query: TasksQuery
|
|
735
|
+
},
|
|
736
|
+
/** Starts a thread as a task (`post` there, and `label` for its labels), or makes the thread `re` roots one (`label` there). */
|
|
737
|
+
createTask: {
|
|
738
|
+
method: "POST",
|
|
739
|
+
path: "/tasks",
|
|
740
|
+
body: CreateTaskBody
|
|
741
|
+
},
|
|
742
|
+
/** Starts several threads in one channel as tasks, in one write: all of them or none, and nothing shows before all have landed. */
|
|
743
|
+
createTasks: {
|
|
744
|
+
method: "POST",
|
|
745
|
+
path: "/tasks/batch",
|
|
746
|
+
body: CreateTasksBody
|
|
747
|
+
},
|
|
748
|
+
/** The caller's own batch made under the `id` it gave, its tasks as they are now: for telling a retry before making anything. */
|
|
749
|
+
createdTasks: {
|
|
750
|
+
method: "GET",
|
|
751
|
+
path: "/tasks/batch/:id",
|
|
752
|
+
query: CreatedTasksQuery
|
|
753
|
+
},
|
|
754
|
+
/** Claims the oldest ready task in a channel or subtree: `label` where it is. Answers `{ task: null }` when none is. */
|
|
755
|
+
claimReadyTask: {
|
|
756
|
+
method: "POST",
|
|
757
|
+
path: "/tasks/claim",
|
|
758
|
+
body: ClaimReadyTaskBody
|
|
759
|
+
},
|
|
760
|
+
/** Claims a task: `label` in its channel. Its answer's `claim` goes on what the claim does next. */
|
|
761
|
+
claimTask: {
|
|
762
|
+
method: "POST",
|
|
763
|
+
path: "/tasks/:id/claim",
|
|
764
|
+
body: ClaimTaskBody
|
|
765
|
+
},
|
|
766
|
+
/** What a claim does, with its `epoch` and `token`: 409 `claim_lost` once it's over. */
|
|
767
|
+
renewTask: {
|
|
768
|
+
method: "POST",
|
|
769
|
+
path: "/tasks/:id/renew",
|
|
770
|
+
body: RenewTaskBody
|
|
771
|
+
},
|
|
772
|
+
releaseTask: {
|
|
773
|
+
method: "POST",
|
|
774
|
+
path: "/tasks/:id/release",
|
|
775
|
+
body: ReleaseTaskBody
|
|
776
|
+
},
|
|
777
|
+
completeTask: {
|
|
778
|
+
method: "POST",
|
|
779
|
+
path: "/tasks/:id/complete",
|
|
780
|
+
body: CompleteTaskBody
|
|
781
|
+
},
|
|
782
|
+
failTask: {
|
|
783
|
+
method: "POST",
|
|
784
|
+
path: "/tasks/:id/fail",
|
|
785
|
+
body: FailTaskBody
|
|
786
|
+
},
|
|
787
|
+
/** Holds a task for a person: its claim while it's claimed, its owner or `manage` in its channel otherwise. */
|
|
788
|
+
blockTask: {
|
|
789
|
+
method: "POST",
|
|
790
|
+
path: "/tasks/:id/block",
|
|
791
|
+
body: BlockTaskBody
|
|
792
|
+
},
|
|
793
|
+
/** What a task's owner does, or `manage` in its channel. */
|
|
794
|
+
unblockTask: {
|
|
795
|
+
method: "POST",
|
|
796
|
+
path: "/tasks/:id/unblock"
|
|
797
|
+
},
|
|
798
|
+
reopenTask: {
|
|
799
|
+
method: "POST",
|
|
800
|
+
path: "/tasks/:id/reopen"
|
|
801
|
+
},
|
|
802
|
+
assignTask: {
|
|
803
|
+
method: "POST",
|
|
804
|
+
path: "/tasks/:id/assign",
|
|
805
|
+
body: AssignTaskBody
|
|
806
|
+
},
|
|
807
|
+
/** Replaces what a task waits for, while no one holds it and it isn't finished. */
|
|
808
|
+
setTaskNeeds: {
|
|
809
|
+
method: "POST",
|
|
810
|
+
path: "/tasks/:id/needs",
|
|
811
|
+
body: TaskNeedsBody
|
|
812
|
+
},
|
|
813
|
+
cancelTask: {
|
|
814
|
+
method: "POST",
|
|
815
|
+
path: "/tasks/:id/cancel",
|
|
816
|
+
body: CancelTaskBody
|
|
817
|
+
},
|
|
578
818
|
/** Listing grants needs manage at `*`; changing one, manage at each pattern its `can` names. Team owners always may. */
|
|
579
819
|
grants: {
|
|
580
820
|
method: "GET",
|
|
@@ -752,4 +992,4 @@ const routes = {
|
|
|
752
992
|
}
|
|
753
993
|
};
|
|
754
994
|
//#endregion
|
|
755
|
-
export {
|
|
995
|
+
export { RegisterBody as A, SyncFindQuery as B, LabelBody as C, PostBody as D, MessagesQuery as E, SchemaBody as F, ThreadsQuery as G, SyncReceiptBody as H, SourceJoinBody as I, UploadStartBody as J, TypingBody as K, SourceReadQuery as L, RenewTaskBody as M, ScheduleBody as N, ReactBody as O, SchedulesQuery as P, SyncBody as R, InboxQuery as S, MatchesQuery as T, TaskNeedsBody as U, SyncImportBody as V, TasksQuery as W, routes as Y, Filters as _, ClaimReadyTaskBody as a, InboxNextQuery as b, CreateChannelBody as c, CreatedTasksQuery as d, DeleteBody as f, FailTaskBody as g, ExplainQuery as h, CancelTaskBody as i, ReleaseTaskBody as j, Ref as k, CreateTaskBody as l, EventsQuery as m, AssignTaskBody as n, ClaimTaskBody as o, EditBody as p, UpdateGrantBody as q, BlockTaskBody as r, CompleteTaskBody as s, AckBody as t, CreateTasksBody as u, GrantBody as v, LinkedQuery as w, InboxPushBody as x, InboxAckBody as y, SyncCopiesQuery as z };
|