@openmuster/muster 0.3.1-alpha.6 → 0.3.1-alpha.7
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/README.md +1 -1
- package/dist/{args-CaFBa2IP.js → args-C_XaUVTS.js} +456 -65
- package/dist/cli.js +3 -3
- package/dist/index.d.ts +201 -85
- package/dist/index.js +156 -10
- package/dist/main-C-3gchLr.js +6 -0
- package/dist/{main-3kE64MlN.js → main-D8R2IP1C.js} +1043 -115
- package/dist/mcp-uFonN-GE.js +6 -0
- package/dist/{module-BX2IjSiv.js → module-D6Kgl3Do.js} +2 -2
- package/dist/{module-D9KdbEpS.js → module-DkA_1NkG.js} +1 -1
- package/dist/{steps-cnWo2Wvx.js → steps-DVxqtI61.js} +122 -1
- package/docs/01-concepts/06-actors.md +3 -1
- package/docs/01-concepts/08-tasks.md +3 -0
- package/docs/01-concepts/10-schedules.md +9 -1
- package/docs/01-concepts/11-access.md +86 -2
- package/docs/01-concepts/12-files-and-data.md +139 -6
- package/docs/01-concepts/17-board-module.md +3 -1
- package/docs/01-quickstart.md +1 -1
- package/docs/02-sync/04-slack.md +5 -0
- package/docs/03-guides/17-mcp.md +44 -7
- package/docs/04-reference/01-cli.md +10 -1
- package/docs/04-reference/03-http.md +56 -5
- package/docs/04-reference/05-errors.md +5 -1
- package/docs/04-reference/06-conformance.md +17 -5
- package/package.json +2 -2
- package/dist/main-o4m_lGDG.js +0 -6
- package/dist/mcp-D6Xt2ixk.js +0 -6
package/dist/cli.js
CHANGED
|
@@ -9,10 +9,10 @@ process.emitWarning = ((warning, ...rest) => {
|
|
|
9
9
|
if ((typeof warning === "string" ? warning : warning.message).includes("SQLite is an experimental feature")) return;
|
|
10
10
|
return emitWarning.call(process, warning, ...rest);
|
|
11
11
|
});
|
|
12
|
-
await (await import("./module-
|
|
13
|
-
const { main } = await import("./main-
|
|
12
|
+
await (await import("./module-D6Kgl3Do.js")).prepare(process.argv.slice(2), process.env);
|
|
13
|
+
const { main } = await import("./main-C-3gchLr.js");
|
|
14
14
|
if (process.argv[2] === "mcp" && process.argv.length === 3) {
|
|
15
|
-
const { mcp } = await import("./mcp-
|
|
15
|
+
const { mcp } = await import("./mcp-uFonN-GE.js");
|
|
16
16
|
await mcp(process.stdin, process.stdout, process.env, main);
|
|
17
17
|
process.exit(0);
|
|
18
18
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
import { DatabaseSync } from "node:sqlite";
|
|
2
2
|
import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
3
3
|
|
|
4
|
+
//#region src/store/files.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where a board keeps the bytes of its files, by ID: the sha256 of the bytes, in hex. The board writes each
|
|
8
|
+
* file once and never changes or deletes one, so a store needs no more than these two calls. The default is
|
|
9
|
+
* the folder beside the board's file; give another with `board({ files })` or `file({ files })`.
|
|
10
|
+
*
|
|
11
|
+
* The shape follows `BlobStore` in @vercel/board's `server/blob.ts` (Apache-2.0, Copyright Vercel, Inc.).
|
|
12
|
+
*/
|
|
13
|
+
type FileStore = {
|
|
14
|
+
/**
|
|
15
|
+
* Where the files are, such as `s3://bucket/prefix`. The board keeps it, and a process that opens the board
|
|
16
|
+
* with no store, or another one, is refused files instead of looking in the wrong place.
|
|
17
|
+
*/
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/** Stores the bytes under `id`. Called again with the same bytes, it may do nothing. Throws when it can't. */
|
|
20
|
+
put(id: string, bytes: Uint8Array): Promise<void>;
|
|
21
|
+
/** The bytes under `id`, or null when there are none. Throws when the store can't be reached, which is not the same. */
|
|
22
|
+
get(id: string): Promise<Uint8Array | null>;
|
|
23
|
+
/**
|
|
24
|
+
* The store this one takes over from, by its `name`: say it once you have copied the files across, and the
|
|
25
|
+
* board keeps this one's name from then on. `'disk'` is the folder beside the board's file.
|
|
26
|
+
*/
|
|
27
|
+
readonly replaces?: string;
|
|
28
|
+
};
|
|
29
|
+
/** A store in this process's memory, for tests: gone with the process. */
|
|
30
|
+
declare function memoryFiles(options?: {
|
|
31
|
+
name?: string;
|
|
32
|
+
replaces?: string;
|
|
33
|
+
}): FileStore;
|
|
34
|
+
/**
|
|
35
|
+
* Moves a board's files back to the folder beside its file from the store named `from`, once you have copied
|
|
36
|
+
* them there: the board forgets the store, and needs none from then on.
|
|
37
|
+
*/
|
|
38
|
+
declare function backToDisk(from: string): FileStore;
|
|
39
|
+
//#endregion
|
|
4
40
|
//#region src/model.d.ts
|
|
5
41
|
/** Who a request is from, as the policy verified it. A request body never says. */
|
|
6
42
|
type Caller = {
|
|
@@ -81,6 +117,8 @@ type Context = {
|
|
|
81
117
|
now: () => Date;
|
|
82
118
|
/** Whether the process a claim recorded is still the one running. Injected in tests. */
|
|
83
119
|
alive: (pid: number, start: string) => boolean;
|
|
120
|
+
/** Where the board keeps its files' bytes, when not the folder beside its file. */
|
|
121
|
+
files?: FileStore;
|
|
84
122
|
};
|
|
85
123
|
/**
|
|
86
124
|
* How a repeat with the same idempotency key is compared with the first. `exact` (the default): the
|
|
@@ -183,7 +221,7 @@ type Delivery$1 = {
|
|
|
183
221
|
files?: string[];
|
|
184
222
|
};
|
|
185
223
|
/** A board file's bytes, for a provider sending it out: null when the board no longer has it. */
|
|
186
|
-
type ReadFile = (id: string) => Buffer | null
|
|
224
|
+
type ReadFile = (id: string) => Promise<Buffer | null>;
|
|
187
225
|
/** A platform: how to check that a webhook is its own, read it, and send a message back. */
|
|
188
226
|
type Provider = ProviderExtras & {
|
|
189
227
|
type: string;
|
|
@@ -198,10 +236,14 @@ type Provider = ProviderExtras & {
|
|
|
198
236
|
placeFor(channel: string): string | null;
|
|
199
237
|
/** Whether board replies in a synced thread go back to the platform. */
|
|
200
238
|
mirrors(place: string): boolean;
|
|
201
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* Posts a board message on the platform. `threadExternal` is null for a new root. `external` says its text came
|
|
241
|
+
* from another platform, so nobody who wrote it on the board vouches for what it does here.
|
|
242
|
+
*/
|
|
202
243
|
deliver(message: Message, target: {
|
|
203
244
|
place: string;
|
|
204
245
|
threadExternal: string | null;
|
|
246
|
+
external?: boolean;
|
|
205
247
|
}, fetcher: typeof fetch, read: ReadFile, marker?: string): Promise<Delivery$1>;
|
|
206
248
|
/**
|
|
207
249
|
* Looks on the platform for a message an earlier try may have posted, by the `marker` `deliver` was given, and
|
|
@@ -215,8 +257,10 @@ type Provider = ProviderExtras & {
|
|
|
215
257
|
};
|
|
216
258
|
/** What a provider may also do. Each is optional: a platform that can't simply doesn't. */
|
|
217
259
|
type ProviderExtras = {
|
|
218
|
-
/** Changes a message the board delivered earlier. Best effort: a failure is skipped. */
|
|
219
|
-
update?(external: string, text: string, place: string, fetcher: typeof fetch
|
|
260
|
+
/** Changes a message the board delivered earlier. Best effort: a failure is skipped. `from.external` is as for `deliver`. */
|
|
261
|
+
update?(external: string, text: string, place: string, fetcher: typeof fetch, from?: {
|
|
262
|
+
external?: boolean;
|
|
263
|
+
}): Promise<void>;
|
|
220
264
|
/** Removes a message the board delivered earlier. Best effort. */
|
|
221
265
|
remove?(external: string, place: string, fetcher: typeof fetch): Promise<void>;
|
|
222
266
|
/**
|
|
@@ -452,9 +496,9 @@ declare function filePut(ctx: Context, caller: Caller, request: {
|
|
|
452
496
|
declare function fileGet(ctx: Context, caller: Caller, request: {
|
|
453
497
|
message: number;
|
|
454
498
|
id: string;
|
|
455
|
-
}): Attachment & {
|
|
499
|
+
}): Promise<Attachment & {
|
|
456
500
|
data: string;
|
|
457
|
-
}
|
|
501
|
+
}>;
|
|
458
502
|
//#endregion
|
|
459
503
|
//#region src/core/leases.d.ts
|
|
460
504
|
/** Taken: the role is yours until `expires` unless renewed. Not taken: who has it, and until when. */
|
|
@@ -889,6 +933,8 @@ type ScheduleRequest = {
|
|
|
889
933
|
every?: number;
|
|
890
934
|
times?: number;
|
|
891
935
|
until?: string;
|
|
936
|
+
/** What it sends stays on the board, never mirrored to a synced platform, as a post's `noSync`. */
|
|
937
|
+
noSync?: boolean;
|
|
892
938
|
};
|
|
893
939
|
declare function create(ctx: Context, caller: Caller, request: ScheduleRequest): Schedule;
|
|
894
940
|
declare function list(ctx: Context, caller: Caller): {
|
|
@@ -927,7 +973,7 @@ declare function request(ctx: Context, caller: Caller, req: WorkflowRequest): {
|
|
|
927
973
|
};
|
|
928
974
|
//#endregion
|
|
929
975
|
//#region src/backend/types.d.ts
|
|
930
|
-
type Op<F> = F extends ((ctx: any, caller: Caller, request: infer R) => infer T) ? (caller: Caller, request: R) => Promise<T
|
|
976
|
+
type Op<F> = F extends ((ctx: any, caller: Caller, request: infer R) => infer T) ? (caller: Caller, request: R) => Promise<Awaited<T>> : never;
|
|
931
977
|
type Read<F> = F extends ((ctx: any, caller: Caller, request?: infer R) => infer T) ? (caller: Caller, request?: R) => Promise<T> : never;
|
|
932
978
|
/**
|
|
933
979
|
* What a board answers. `file()` answers from the SQLite file in this process; `http()` asks a
|
|
@@ -945,7 +991,7 @@ type Backend = {
|
|
|
945
991
|
signingKey?: () => Buffer;
|
|
946
992
|
/** Keys the board signed with before, whose tokens are still good: see `mu token rotate-key`. */
|
|
947
993
|
retiredKeys?: () => Buffer[];
|
|
948
|
-
/** The board's tokens: making one, listing them, stopping one. For the owner, or a token as wide as the owner's. */
|
|
994
|
+
/** The board's tokens: making one, listing them, stopping one. For the owner, or a token as wide as the owner's: one held to a profile reaches only that profile's. */
|
|
949
995
|
tokens: {
|
|
950
996
|
create(request: MintRequest): Promise<{
|
|
951
997
|
token: string;
|
|
@@ -1141,6 +1187,11 @@ type FileOptions = {
|
|
|
1141
1187
|
/** The platforms this board syncs with: secrets named with `env()` are read on first use. */
|
|
1142
1188
|
sync?: Sync;
|
|
1143
1189
|
fetch?: typeof fetch;
|
|
1190
|
+
/**
|
|
1191
|
+
* Where the board keeps its files' bytes. Default: the folder beside its file. The board remembers the first
|
|
1192
|
+
* store it is given, and refuses files to a process with none, or another; see `FileStore`.
|
|
1193
|
+
*/
|
|
1194
|
+
files?: FileStore;
|
|
1144
1195
|
};
|
|
1145
1196
|
declare function boardPath(options?: {
|
|
1146
1197
|
dir?: string;
|
|
@@ -1149,6 +1200,115 @@ declare function boardPath(options?: {
|
|
|
1149
1200
|
/** A board in a SQLite file, answered in this process. Every process that opens it is one trust domain. */
|
|
1150
1201
|
declare function file(options?: FileOptions): Backend;
|
|
1151
1202
|
//#endregion
|
|
1203
|
+
//#region src/serve/oidc.d.ts
|
|
1204
|
+
/**
|
|
1205
|
+
* A workload the board's owner trusts to sign in with a token its platform signed: a CI job, with the
|
|
1206
|
+
* OIDC token its runner gives it. It is the owner's configuration, in a file beside the board's key and
|
|
1207
|
+
* never on a board, and it says everything the board token will be: who it writes as and where.
|
|
1208
|
+
*/
|
|
1209
|
+
type Trust = {
|
|
1210
|
+
name: string;
|
|
1211
|
+
/** Who signed the token, exactly as its `iss` says. */
|
|
1212
|
+
issuer: string;
|
|
1213
|
+
/** Who the token must be made out to: this board, by a name the owner chose. Never read from a request. */
|
|
1214
|
+
audience: string;
|
|
1215
|
+
/** Which workload: the token's `sub`, exactly, or a prefix ending in `*` after a `:` or `/`. */
|
|
1216
|
+
sub: string;
|
|
1217
|
+
/** The profile the board token writes as. */
|
|
1218
|
+
as: string;
|
|
1219
|
+
can: Record<string, Permission[]>;
|
|
1220
|
+
/** How long the board token lives, in seconds. */
|
|
1221
|
+
ttl: number;
|
|
1222
|
+
/** Where the issuer's keys are, when it publishes no discovery document. */
|
|
1223
|
+
jwks?: string;
|
|
1224
|
+
/** What the job writes stays on the board, and goes to no platform sync is set up with. */
|
|
1225
|
+
noSync?: true;
|
|
1226
|
+
};
|
|
1227
|
+
//#endregion
|
|
1228
|
+
//#region src/serve/routes.d.ts
|
|
1229
|
+
/**
|
|
1230
|
+
* What a sandbox's agent may call, by name: reading and writing the board, never running it. A route
|
|
1231
|
+
* is here because an agent doing a task needs it. A new route is closed to sandboxes until it is added.
|
|
1232
|
+
*/
|
|
1233
|
+
declare const SANDBOX_ROUTES: readonly ["post", "reply", "edit", "remove", "label", "react", "createChannel", "readChannel", "readThread", "events", "channels", "search", "actors", "head", "taskCreate", "taskPlan", "taskClaim", "taskRenew", "taskRelease", "taskComplete", "taskFail", "taskBlock", "taskUnblock", "taskReopen", "taskCancel", "taskAssign", "taskNeeds", "taskList", "task", "schemaList", "filePut", "fileGet", "budgets"];
|
|
1234
|
+
//#endregion
|
|
1235
|
+
//#region src/serve/server.d.ts
|
|
1236
|
+
/**
|
|
1237
|
+
* A request as `authenticate` is handed it: what it says, none of it checked yet. Never its body. `path` is the
|
|
1238
|
+
* path and query the request asked for; the host it came for is in `headers.host`.
|
|
1239
|
+
*/
|
|
1240
|
+
type SignInRequest = {
|
|
1241
|
+
method: string;
|
|
1242
|
+
path: string;
|
|
1243
|
+
headers: Readonly<Record<string, string | undefined>>;
|
|
1244
|
+
};
|
|
1245
|
+
/**
|
|
1246
|
+
* Who signed in, as the owner's own code says. `id` becomes the principal `sso:<id>`, lowercased, so a sign-in
|
|
1247
|
+
* never speaks as the board, a token's subject or a synced author. `can` is required, as on a narrowed token:
|
|
1248
|
+
* `{ '*': [...] }` reaches every channel.
|
|
1249
|
+
*/
|
|
1250
|
+
type SignedIn = {
|
|
1251
|
+
id: string;
|
|
1252
|
+
profile?: string | null;
|
|
1253
|
+
can: Readonly<Record<string, readonly Permission[]>>;
|
|
1254
|
+
noSync?: boolean;
|
|
1255
|
+
};
|
|
1256
|
+
/**
|
|
1257
|
+
* Says who a request with no token is from, for a board behind a sign-in such as an SSO proxy, or null for
|
|
1258
|
+
* nobody. Called for every such request. It is trusted with the board: if it reads a header a proxy sets, the
|
|
1259
|
+
* board must be reachable only through that proxy. Verify a signed assertion where the proxy gives one.
|
|
1260
|
+
*/
|
|
1261
|
+
type Authenticate = (request: SignInRequest) => SignedIn | null | Promise<SignedIn | null>;
|
|
1262
|
+
type ServeOptions = {
|
|
1263
|
+
backend: Backend;
|
|
1264
|
+
key: Buffer;
|
|
1265
|
+
/** Keys the board signed with before `key`, whose tokens are still good. */
|
|
1266
|
+
retired?: readonly Buffer[];
|
|
1267
|
+
now?: () => number;
|
|
1268
|
+
/** The board's list of tokens it made. Default: the backend's own. */
|
|
1269
|
+
tokens?: Registry;
|
|
1270
|
+
/** Host names requests may come for, beside the address it listens on. */
|
|
1271
|
+
hosts?: readonly string[];
|
|
1272
|
+
/** Milliseconds between looks at the log for an open feed. */
|
|
1273
|
+
feedInterval?: number;
|
|
1274
|
+
/**
|
|
1275
|
+
* MCP over HTTP at `/api/board/mcp`, for agents on other machines. It is handed one JSON-RPC message
|
|
1276
|
+
* and the caller's own token and profile, so the tool can do exactly what that token can, and no more.
|
|
1277
|
+
*/
|
|
1278
|
+
mcp?: (message: unknown, as: {
|
|
1279
|
+
token: string;
|
|
1280
|
+
profile: string | null;
|
|
1281
|
+
}, signal: AbortSignal, notify: (note: object) => void) => Promise<object | null>;
|
|
1282
|
+
/** Checks a request's routing headers against its body before it runs: a refusal and its HTTP status, or null. */
|
|
1283
|
+
mcpHeaders?: (message: unknown, header: (name: string) => string | undefined) => {
|
|
1284
|
+
status: number;
|
|
1285
|
+
body: object;
|
|
1286
|
+
} | null;
|
|
1287
|
+
/** Whether an agent with no token may ask to join. Off unless the owner says so. */
|
|
1288
|
+
allowJoins?: boolean;
|
|
1289
|
+
/** The workloads the owner trusts to sign in with their platform's token. None unless the owner names some. */
|
|
1290
|
+
oidc?: readonly Trust[];
|
|
1291
|
+
/** How the board reaches an issuer for its keys. Default: `fetch`. */
|
|
1292
|
+
fetch?: typeof fetch;
|
|
1293
|
+
/** Where the board says what only its owner should read, such as why an issuer's keys couldn't be fetched. */
|
|
1294
|
+
log?: (line: string) => void;
|
|
1295
|
+
/** Who a request with no token is from, for a board behind a sign-in. None unless the owner's module gives one. */
|
|
1296
|
+
authenticate?: Authenticate;
|
|
1297
|
+
};
|
|
1298
|
+
/**
|
|
1299
|
+
* The board over HTTP. Every request names its caller with a token this board signed: the token fixes
|
|
1300
|
+
* the principal and what it may do, and nothing in a request body can change either.
|
|
1301
|
+
*/
|
|
1302
|
+
declare function createHandler(options: ServeOptions): (req: IncomingMessage, res: ServerResponse) => Promise<void | ServerResponse<IncomingMessage>>;
|
|
1303
|
+
declare function listen(options: ServeOptions & {
|
|
1304
|
+
port?: number;
|
|
1305
|
+
host?: string;
|
|
1306
|
+
}): Promise<{
|
|
1307
|
+
server: Server;
|
|
1308
|
+
url: string;
|
|
1309
|
+
close(): Promise<void>;
|
|
1310
|
+
}>;
|
|
1311
|
+
//#endregion
|
|
1152
1312
|
//#region src/serve/fetch.d.ts
|
|
1153
1313
|
type MountOptions = {
|
|
1154
1314
|
/** The path the board is mounted at, as a request's URL has it: `/api/board` unless you say otherwise. */
|
|
@@ -1160,6 +1320,11 @@ type MountOptions = {
|
|
|
1160
1320
|
hosts?: readonly string[];
|
|
1161
1321
|
/** Where the board says what only its owner should read, such as why a request failed. Default: standard error. */
|
|
1162
1322
|
log?: (line: string) => void;
|
|
1323
|
+
/**
|
|
1324
|
+
* Who a request with no token is from, for a board behind a sign-in such as an SSO proxy. `mu serve` uses the
|
|
1325
|
+
* module's too. See "Sign in through your own code" in the access page.
|
|
1326
|
+
*/
|
|
1327
|
+
authenticate?: Authenticate;
|
|
1163
1328
|
};
|
|
1164
1329
|
//#endregion
|
|
1165
1330
|
//#region src/config/env.d.ts
|
|
@@ -1420,6 +1585,33 @@ type Check = {
|
|
|
1420
1585
|
*/
|
|
1421
1586
|
declare function conformance(team: Board): Promise<Check[]>;
|
|
1422
1587
|
//#endregion
|
|
1588
|
+
//#region src/files/s3.d.ts
|
|
1589
|
+
/** A secret written out, or named with `env()` and read the first time a file is stored or read. */
|
|
1590
|
+
type Secret$1 = string | Env;
|
|
1591
|
+
type S3Options = {
|
|
1592
|
+
bucket: string;
|
|
1593
|
+
/** Default `us-east-1`. Cloudflare R2 takes `auto`. */
|
|
1594
|
+
region?: string;
|
|
1595
|
+
/**
|
|
1596
|
+
* Where the S3 API is, for anything but AWS: `https://<account>.r2.cloudflarestorage.com` for R2. With one,
|
|
1597
|
+
* a file's URL is `<endpoint>/<bucket>/<key>`; without, it is AWS's `https://<bucket>.s3.<region>.amazonaws.com/<key>`.
|
|
1598
|
+
*/
|
|
1599
|
+
endpoint?: string;
|
|
1600
|
+
/** Put before each file's ID: `board/` keeps them under `board/<id>`. */
|
|
1601
|
+
prefix?: string;
|
|
1602
|
+
accessKeyId: Secret$1;
|
|
1603
|
+
secretAccessKey: Secret$1;
|
|
1604
|
+
/** For temporary credentials. */
|
|
1605
|
+
sessionToken?: Secret$1;
|
|
1606
|
+
fetch?: typeof fetch;
|
|
1607
|
+
};
|
|
1608
|
+
/**
|
|
1609
|
+
* A board's files in an S3 bucket, or any store that speaks S3's API: Cloudflare R2, MinIO, Backblaze B2,
|
|
1610
|
+
* Google Cloud Storage's interoperability mode. Each file is one object, `<prefix><id>`, written once.
|
|
1611
|
+
* Secrets named with `env()` are read on first use, never when the module is imported.
|
|
1612
|
+
*/
|
|
1613
|
+
declare function s3Files(options: S3Options): FileStore;
|
|
1614
|
+
//#endregion
|
|
1423
1615
|
//#region src/backend/http.d.ts
|
|
1424
1616
|
type HttpOptions = {
|
|
1425
1617
|
/** The board's URL, as `mu serve` prints it: `http://127.0.0.1:4100/api/board`. */
|
|
@@ -1438,82 +1630,6 @@ type HttpOptions = {
|
|
|
1438
1630
|
/** A board at a URL, answered by a `mu serve`. The token says who you are and what you may do. */
|
|
1439
1631
|
declare function http(options: HttpOptions): Backend;
|
|
1440
1632
|
//#endregion
|
|
1441
|
-
//#region src/serve/oidc.d.ts
|
|
1442
|
-
/**
|
|
1443
|
-
* A workload the board's owner trusts to sign in with a token its platform signed: a CI job, with the
|
|
1444
|
-
* OIDC token its runner gives it. It is the owner's configuration, in a file beside the board's key and
|
|
1445
|
-
* never on a board, and it says everything the board token will be: who it writes as and where.
|
|
1446
|
-
*/
|
|
1447
|
-
type Trust = {
|
|
1448
|
-
name: string;
|
|
1449
|
-
/** Who signed the token, exactly as its `iss` says. */
|
|
1450
|
-
issuer: string;
|
|
1451
|
-
/** Who the token must be made out to: this board, by a name the owner chose. Never read from a request. */
|
|
1452
|
-
audience: string;
|
|
1453
|
-
/** Which workload: the token's `sub`, exactly, or a prefix ending in `*` after a `:` or `/`. */
|
|
1454
|
-
sub: string;
|
|
1455
|
-
/** The profile the board token writes as. */
|
|
1456
|
-
as: string;
|
|
1457
|
-
can: Record<string, Permission[]>;
|
|
1458
|
-
/** How long the board token lives, in seconds. */
|
|
1459
|
-
ttl: number;
|
|
1460
|
-
/** Where the issuer's keys are, when it publishes no discovery document. */
|
|
1461
|
-
jwks?: string;
|
|
1462
|
-
/** What the job writes stays on the board, and goes to no platform sync is set up with. */
|
|
1463
|
-
noSync?: true;
|
|
1464
|
-
};
|
|
1465
|
-
//#endregion
|
|
1466
|
-
//#region src/serve/routes.d.ts
|
|
1467
|
-
/**
|
|
1468
|
-
* What a sandbox's agent may call, by name: reading and writing the board, never running it. A route
|
|
1469
|
-
* is here because an agent doing a task needs it. A new route is closed to sandboxes until it is added.
|
|
1470
|
-
*/
|
|
1471
|
-
declare const SANDBOX_ROUTES: readonly ["post", "reply", "edit", "remove", "label", "react", "createChannel", "readChannel", "readThread", "events", "channels", "search", "actors", "head", "taskCreate", "taskPlan", "taskClaim", "taskRenew", "taskRelease", "taskComplete", "taskFail", "taskBlock", "taskUnblock", "taskReopen", "taskCancel", "taskAssign", "taskNeeds", "taskList", "task", "schemaList", "filePut", "fileGet", "budgets"];
|
|
1472
|
-
//#endregion
|
|
1473
|
-
//#region src/serve/server.d.ts
|
|
1474
|
-
type ServeOptions = {
|
|
1475
|
-
backend: Backend;
|
|
1476
|
-
key: Buffer;
|
|
1477
|
-
/** Keys the board signed with before `key`, whose tokens are still good. */
|
|
1478
|
-
retired?: readonly Buffer[];
|
|
1479
|
-
now?: () => number;
|
|
1480
|
-
/** The board's list of tokens it made. Default: the backend's own. */
|
|
1481
|
-
tokens?: Registry;
|
|
1482
|
-
/** Host names requests may come for, beside the address it listens on. */
|
|
1483
|
-
hosts?: readonly string[];
|
|
1484
|
-
/** Milliseconds between looks at the log for an open feed. */
|
|
1485
|
-
feedInterval?: number;
|
|
1486
|
-
/**
|
|
1487
|
-
* MCP over HTTP at `/api/board/mcp`, for agents on other machines. It is handed one JSON-RPC message
|
|
1488
|
-
* and the caller's own token and profile, so the tool can do exactly what that token can, and no more.
|
|
1489
|
-
*/
|
|
1490
|
-
mcp?: (message: unknown, as: {
|
|
1491
|
-
token: string;
|
|
1492
|
-
profile: string | null;
|
|
1493
|
-
}) => Promise<object | null>;
|
|
1494
|
-
/** Whether an agent with no token may ask to join. Off unless the owner says so. */
|
|
1495
|
-
allowJoins?: boolean;
|
|
1496
|
-
/** The workloads the owner trusts to sign in with their platform's token. None unless the owner names some. */
|
|
1497
|
-
oidc?: readonly Trust[];
|
|
1498
|
-
/** How the board reaches an issuer for its keys. Default: `fetch`. */
|
|
1499
|
-
fetch?: typeof fetch;
|
|
1500
|
-
/** Where the board says what only its owner should read, such as why an issuer's keys couldn't be fetched. */
|
|
1501
|
-
log?: (line: string) => void;
|
|
1502
|
-
};
|
|
1503
|
-
/**
|
|
1504
|
-
* The board over HTTP. Every request names its caller with a token this board signed: the token fixes
|
|
1505
|
-
* the principal and what it may do, and nothing in a request body can change either.
|
|
1506
|
-
*/
|
|
1507
|
-
declare function createHandler(options: ServeOptions): (req: IncomingMessage, res: ServerResponse) => Promise<void | ServerResponse<IncomingMessage>>;
|
|
1508
|
-
declare function listen(options: ServeOptions & {
|
|
1509
|
-
port?: number;
|
|
1510
|
-
host?: string;
|
|
1511
|
-
}): Promise<{
|
|
1512
|
-
server: Server;
|
|
1513
|
-
url: string;
|
|
1514
|
-
close(): Promise<void>;
|
|
1515
|
-
}>;
|
|
1516
|
-
//#endregion
|
|
1517
1633
|
//#region src/runner/agents.d.ts
|
|
1518
1634
|
/** How a run ended, as far as the board cares. */
|
|
1519
1635
|
type ExitKind = 'ok' | 'quota' | 'auth' | 'bad_resume' | 'crash' | 'timeout' | 'stopped';
|
|
@@ -2214,4 +2330,4 @@ declare function pullRequests(options: {
|
|
|
2214
2330
|
pulls: PullRequest[];
|
|
2215
2331
|
}>;
|
|
2216
2332
|
//#endregion
|
|
2217
|
-
export { AGENTS, type Agent, type Argv, type Attachment, type Backend, type Block, type Board, type BoardEvent, type BoardOptions, type By, type Caller, type Check, type Claims, type CloudRequest, type CloudRunner, type CommandOptions, type DeclaredHook, type DeclaredSync, type DeclaredWatcher, type Delivered, type Duration, type E2bSdk, type Env, type ExitKind, Failure, type FeedEvent, type FileOptions, type Filter, type GitHubOptions, type HookOptions, type Host, type HttpOptions, type Inbound, LINEAR_SCOPES, type LinearOptions, type Message, type NetworkPolicy, type NotionOptions, type Permission, type PlanTask, type Provider, type PullRequest, type RunRequest, type RunResult, SANDBOX_ROUTES, type Secret, type SlackOptions, type StartOptions, type SyncOptions, type Task, type TaskListing, type TaskState, type ThreadSummary, type Watch, type WatchContext, type WatchEvent, type Workers, type Workflow, type WorkflowStep, agentEnv, applyPolicy, board, boardKey, boardPath, boardPolicy, claude, cloudflare, codex, command, conformance, createHandler, e2b, env, fenced, file, generic, github, http, linear, listen, loadWorkflows, mint, notion, pullRequests, runLocal, slack, vercel, verify, workflowResult, workflowsPath };
|
|
2333
|
+
export { AGENTS, type Agent, type Argv, type Attachment, type Authenticate, type Backend, type Block, type Board, type BoardEvent, type BoardOptions, type By, type Caller, type Check, type Claims, type CloudRequest, type CloudRunner, type CommandOptions, type DeclaredHook, type DeclaredSync, type DeclaredWatcher, type Delivered, type Duration, type E2bSdk, type Env, type ExitKind, Failure, type FeedEvent, type FileOptions, type FileStore, type Filter, type GitHubOptions, type HookOptions, type Host, type HttpOptions, type Inbound, LINEAR_SCOPES, type LinearOptions, type Message, type MountOptions, type NetworkPolicy, type NotionOptions, type Permission, type PlanTask, type Provider, type PullRequest, type RunRequest, type RunResult, type S3Options, SANDBOX_ROUTES, type Secret, type SignInRequest, type SignedIn, type SlackOptions, type StartOptions, type SyncOptions, type Task, type TaskListing, type TaskState, type ThreadSummary, type Watch, type WatchContext, type WatchEvent, type Workers, type Workflow, type WorkflowStep, agentEnv, applyPolicy, backToDisk, board, boardKey, boardPath, boardPolicy, claude, cloudflare, codex, command, conformance, createHandler, e2b, env, fenced, file, generic, github, http, linear, listen, loadWorkflows, memoryFiles, mint, notion, pullRequests, runLocal, s3Files, slack, vercel, verify, workflowResult, workflowsPath };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as boardPath, C as listen, G as
|
|
2
|
-
import { A as boardPolicy, D as pullRequests, F as runLocal, H as conformance, I as AGENTS, L as claude, M as installationToken, P as agentEnv, R as codex, V as http, _ as e2b, b as vercel, d as fenced, g as workflowsPath, h as loadWorkflows, j as githubApp, k as applyPolicy, u as workflowResult, y as cloudflare, z as generic } from "./steps-
|
|
1
|
+
import { A as boardPath, C as listen, G as nameOf, H as declared, J as refused, K as fetchFile, L as verify, M as boardKey, P as mint, T as SANDBOX_ROUTES, U as env, W as isEnv, X as withLines, Y as sizeOf, Z as SEND_MS, et as backToDisk, f as board, ht as misuse, j as file, pt as Failure, q as noteOut, st as channelPath, tt as memoryFiles, x as createHandler } from "./args-C_XaUVTS.js";
|
|
2
|
+
import { A as boardPolicy, D as pullRequests, F as runLocal, H as conformance, I as AGENTS, L as claude, M as installationToken, P as agentEnv, R as codex, V as http, _ as e2b, b as vercel, d as fenced, g as workflowsPath, h as loadWorkflows, j as githubApp, k as applyPolicy, u as workflowResult, y as cloudflare, z as generic } from "./steps-DVxqtI61.js";
|
|
3
3
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { basename, dirname, join } from "node:path";
|
|
6
|
-
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
6
|
+
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
|
|
9
9
|
//#region src/watch/command.ts
|
|
@@ -158,6 +158,143 @@ function command(argv, options = {}) {
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/files/s3.ts
|
|
163
|
+
const EMPTY = createHash("sha256").update("").digest("hex");
|
|
164
|
+
const BUCKET = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
|
|
165
|
+
const PREFIX = /^([A-Za-z0-9._-]+\/)*$/;
|
|
166
|
+
/** How long one request may take, so a store that hangs fails a file instead of holding the board. */
|
|
167
|
+
const S3_MS = 3e4;
|
|
168
|
+
const sha256 = (data) => createHash("sha256").update(data).digest("hex");
|
|
169
|
+
const hmac$1 = (key, data) => createHmac("sha256", key).update(data).digest();
|
|
170
|
+
/** A path as SigV4 signs it for S3: each segment encoded as RFC 3986 says, the slashes kept. */
|
|
171
|
+
const canonicalPath = (path) => path.split("/").map((part) => encodeURIComponent(decodeURIComponent(part)).replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`)).join("/");
|
|
172
|
+
/**
|
|
173
|
+
* Signs a request with AWS Signature Version 4, as its headers: what every S3-compatible store checks. Exported
|
|
174
|
+
* for its test against AWS's own test suite. `headers` are the ones signed, `host` and `x-amz-date` among them.
|
|
175
|
+
*/
|
|
176
|
+
function signV4(request) {
|
|
177
|
+
const names = Object.keys(request.headers).map((name) => name.toLowerCase()).sort();
|
|
178
|
+
const lower = Object.fromEntries(Object.entries(request.headers).map(([name, value]) => [name.toLowerCase(), value.trim().replace(/\s+/g, " ")]));
|
|
179
|
+
const amzDate = lower["x-amz-date"];
|
|
180
|
+
const scope = `${amzDate.slice(0, 8)}/${request.region}/${request.service}/aws4_request`;
|
|
181
|
+
const signedHeaders = names.join(";");
|
|
182
|
+
const query = [...request.url.searchParams].map(([key$1, value]) => `${encodeURIComponent(key$1)}=${encodeURIComponent(value)}`).sort().join("&");
|
|
183
|
+
const canonical = [
|
|
184
|
+
request.method,
|
|
185
|
+
canonicalPath(request.url.pathname),
|
|
186
|
+
query,
|
|
187
|
+
names.map((name) => `${name}:${lower[name]}\n`).join(""),
|
|
188
|
+
signedHeaders,
|
|
189
|
+
request.payloadHash
|
|
190
|
+
].join("\n");
|
|
191
|
+
const toSign = [
|
|
192
|
+
"AWS4-HMAC-SHA256",
|
|
193
|
+
amzDate,
|
|
194
|
+
scope,
|
|
195
|
+
sha256(canonical)
|
|
196
|
+
].join("\n");
|
|
197
|
+
let key = hmac$1(`AWS4${request.secretAccessKey}`, amzDate.slice(0, 8));
|
|
198
|
+
for (const part of [
|
|
199
|
+
request.region,
|
|
200
|
+
request.service,
|
|
201
|
+
"aws4_request"
|
|
202
|
+
]) key = hmac$1(key, part);
|
|
203
|
+
const signature = createHmac("sha256", key).update(toSign).digest("hex");
|
|
204
|
+
return {
|
|
205
|
+
canonical,
|
|
206
|
+
toSign,
|
|
207
|
+
authorization: `AWS4-HMAC-SHA256 Credential=${request.accessKeyId}/${scope}, SignedHeaders=${signedHeaders}, Signature=${signature}`
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
const isLoopback = (host) => host === "127.0.0.1" || host === "localhost" || host === "[::1]";
|
|
211
|
+
/**
|
|
212
|
+
* A board's files in an S3 bucket, or any store that speaks S3's API: Cloudflare R2, MinIO, Backblaze B2,
|
|
213
|
+
* Google Cloud Storage's interoperability mode. Each file is one object, `<prefix><id>`, written once.
|
|
214
|
+
* Secrets named with `env()` are read on first use, never when the module is imported.
|
|
215
|
+
*/
|
|
216
|
+
function s3Files(options) {
|
|
217
|
+
if (typeof options.bucket !== "string" || !BUCKET.test(options.bucket)) throw misuse("invalid_files", `"${String(options.bucket)}" isn't a bucket name.`, "A bucket is 3 to 63 lowercase letters, numbers, \".\" and \"-\".");
|
|
218
|
+
if (options.endpoint === void 0 && options.bucket.includes(".")) throw misuse("invalid_files", `"${options.bucket}" has a ".", which AWS's https addresses for a bucket don't take.`, `Give endpoint: 'https://s3.${options.region ?? "us-east-1"}.amazonaws.com', and it is reached by path instead.`);
|
|
219
|
+
const prefix = options.prefix ?? "";
|
|
220
|
+
if (!PREFIX.test(prefix)) throw misuse("invalid_files", `"${prefix}" isn't a prefix: folders of letters, numbers, ".", "_" and "-", each ending in "/".`);
|
|
221
|
+
const region = options.region ?? "us-east-1";
|
|
222
|
+
let base;
|
|
223
|
+
try {
|
|
224
|
+
base = new URL(options.endpoint ?? `https://${options.bucket}.s3.${region}.amazonaws.com`);
|
|
225
|
+
} catch {
|
|
226
|
+
throw misuse("invalid_files", `"${options.endpoint}" isn't a URL.`);
|
|
227
|
+
}
|
|
228
|
+
if (base.protocol !== "https:" && !(base.protocol === "http:" && isLoopback(base.hostname))) throw misuse("invalid_files", `The S3 endpoint must be https: ${base.href}`);
|
|
229
|
+
const pathStyle = options.endpoint !== void 0;
|
|
230
|
+
const at = (id) => new URL(`${base.origin}${base.pathname.replace(/\/$/, "")}${pathStyle ? `/${options.bucket}` : ""}/${prefix}${id}`);
|
|
231
|
+
const reveal = (secret, field) => {
|
|
232
|
+
if (secret === void 0) return void 0;
|
|
233
|
+
if (!isEnv(secret)) return secret;
|
|
234
|
+
const value = process.env[nameOf(secret)];
|
|
235
|
+
if (!value) throw new Error(`${nameOf(secret)} ${value === void 0 ? "isn't set" : "is empty"}, and the S3 store's ${field} names it`);
|
|
236
|
+
return value;
|
|
237
|
+
};
|
|
238
|
+
const doFetch = options.fetch ?? fetch;
|
|
239
|
+
const send$1 = async (method, id, body) => {
|
|
240
|
+
if (!/^[0-9a-f]{64}$/.test(id)) throw new Error(`"${id}" isn't a file's ID`);
|
|
241
|
+
const url = at(id);
|
|
242
|
+
const amzDate = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "");
|
|
243
|
+
const payloadHash = body ? id : EMPTY;
|
|
244
|
+
const token = reveal(options.sessionToken, "sessionToken");
|
|
245
|
+
const headers = {
|
|
246
|
+
host: url.host,
|
|
247
|
+
"x-amz-date": amzDate,
|
|
248
|
+
"x-amz-content-sha256": payloadHash,
|
|
249
|
+
...token ? { "x-amz-security-token": token } : {}
|
|
250
|
+
};
|
|
251
|
+
const { authorization } = signV4({
|
|
252
|
+
method,
|
|
253
|
+
url,
|
|
254
|
+
headers,
|
|
255
|
+
payloadHash,
|
|
256
|
+
region,
|
|
257
|
+
service: "s3",
|
|
258
|
+
accessKeyId: reveal(options.accessKeyId, "accessKeyId"),
|
|
259
|
+
secretAccessKey: reveal(options.secretAccessKey, "secretAccessKey")
|
|
260
|
+
});
|
|
261
|
+
const { host: _host,...sent } = headers;
|
|
262
|
+
return doFetch(url, {
|
|
263
|
+
method,
|
|
264
|
+
headers: {
|
|
265
|
+
...sent,
|
|
266
|
+
authorization
|
|
267
|
+
},
|
|
268
|
+
...body ? { body } : {},
|
|
269
|
+
redirect: "manual",
|
|
270
|
+
signal: AbortSignal.timeout(S3_MS)
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
/** What S3 said went wrong, by its error code where it gave one: never the request, which is signed. */
|
|
274
|
+
const refused$1 = async (response, what) => {
|
|
275
|
+
const text = await response.text().catch(() => "");
|
|
276
|
+
const code = /<Code>([^<]{1,64})<\/Code>/.exec(text)?.[1];
|
|
277
|
+
return /* @__PURE__ */ new Error(`S3 answered ${response.status}${code ? ` ${code}` : ""} to ${what}`);
|
|
278
|
+
};
|
|
279
|
+
return {
|
|
280
|
+
name: `s3://${pathStyle ? `${base.host}/` : ""}${options.bucket}/${prefix}`,
|
|
281
|
+
async put(id, bytes) {
|
|
282
|
+
const response = await send$1("PUT", id, bytes);
|
|
283
|
+
if (!response.ok) throw await refused$1(response, `storing ${id.slice(0, 12)}`);
|
|
284
|
+
await response.body?.cancel();
|
|
285
|
+
},
|
|
286
|
+
async get(id) {
|
|
287
|
+
const response = await send$1("GET", id);
|
|
288
|
+
if (response.status === 404) {
|
|
289
|
+
await response.body?.cancel();
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
if (!response.ok) throw await refused$1(response, `reading ${id.slice(0, 12)}`);
|
|
293
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
161
298
|
//#endregion
|
|
162
299
|
//#region src/sync/providers.ts
|
|
163
300
|
const hmac = (secret, body) => createHmac("sha256", secret).update(body).digest("hex");
|
|
@@ -1113,7 +1250,7 @@ function linearWith(options) {
|
|
|
1113
1250
|
const post = (query, variables) => postAs(query, variables, fetcher);
|
|
1114
1251
|
const lines = [];
|
|
1115
1252
|
for (const file$1 of message.attachments) {
|
|
1116
|
-
const bytes = read(file$1.id);
|
|
1253
|
+
const bytes = await read(file$1.id);
|
|
1117
1254
|
if (!bytes) {
|
|
1118
1255
|
lines.push(noteOut(file$1.name, "the board no longer has it"));
|
|
1119
1256
|
continue;
|
|
@@ -1205,6 +1342,14 @@ const fromTs = (ts) => {
|
|
|
1205
1342
|
const toTs = (us) => `${Math.floor(us / 1e6)}.${String(us % 1e6).padStart(6, "0")}`;
|
|
1206
1343
|
/** Slack: messages in mapped channels come in as threads, and board replies go back into the Slack thread. */
|
|
1207
1344
|
const slack = (options) => declared("slack", options, slackWith);
|
|
1345
|
+
/**
|
|
1346
|
+
* Slack text with its broadcasts and group mentions (`<!channel>`, `<!here>`, `<!everyone>`, `<!subteam^S1>`)
|
|
1347
|
+
* broken by a word joiner, so they read the same and notify nobody. For text written on another platform: anyone
|
|
1348
|
+
* who can comment on a synced GitHub issue could otherwise ping a whole Slack channel. Code spans are not spared,
|
|
1349
|
+
* as Slack and a regex disagree on where code is. Follows `withoutBroadcasts` in @vercel/board's Slack provider
|
|
1350
|
+
* (Apache-2.0, Copyright Vercel, Inc.).
|
|
1351
|
+
*/
|
|
1352
|
+
const withoutBroadcasts = (text) => text.replace(/<!(?=[a-z^])/gi, "<!");
|
|
1208
1353
|
function slackWith(options) {
|
|
1209
1354
|
const now = options.now ?? (() => Date.now());
|
|
1210
1355
|
const base = options.api ?? "https://slack.com/api";
|
|
@@ -1394,7 +1539,7 @@ function slackWith(options) {
|
|
|
1394
1539
|
for (const [id, to] of Object.entries(options.channels)) if ((typeof to === "string" ? to : to.channel) === channel) return id;
|
|
1395
1540
|
return null;
|
|
1396
1541
|
},
|
|
1397
|
-
async update(external, text, _place, fetcher) {
|
|
1542
|
+
async update(external, text, _place, fetcher, from) {
|
|
1398
1543
|
const [channel, ts] = external.split(":");
|
|
1399
1544
|
await send(fetcher, `${base}/chat.update`, {
|
|
1400
1545
|
method: "POST",
|
|
@@ -1405,7 +1550,7 @@ function slackWith(options) {
|
|
|
1405
1550
|
body: JSON.stringify({
|
|
1406
1551
|
channel,
|
|
1407
1552
|
ts,
|
|
1408
|
-
text
|
|
1553
|
+
text: from?.external ? withoutBroadcasts(text) : text
|
|
1409
1554
|
})
|
|
1410
1555
|
});
|
|
1411
1556
|
},
|
|
@@ -1511,7 +1656,7 @@ function slackWith(options) {
|
|
|
1511
1656
|
const uploaded = [];
|
|
1512
1657
|
const lines = [];
|
|
1513
1658
|
for (const file$1 of message.attachments) {
|
|
1514
|
-
const bytes = read(file$1.id);
|
|
1659
|
+
const bytes = await read(file$1.id);
|
|
1515
1660
|
if (!bytes) {
|
|
1516
1661
|
lines.push(noteOut(file$1.name, "the board no longer has it"));
|
|
1517
1662
|
continue;
|
|
@@ -1546,7 +1691,8 @@ function slackWith(options) {
|
|
|
1546
1691
|
lines.push(noteOut(file$1.name, "Slack did not take it"));
|
|
1547
1692
|
}
|
|
1548
1693
|
}
|
|
1549
|
-
const
|
|
1694
|
+
const written = withLines(message.text, lines);
|
|
1695
|
+
const text = target.external ? withoutBroadcasts(written) : written;
|
|
1550
1696
|
const made = await send(fetcher, `${base}/chat.postMessage`, {
|
|
1551
1697
|
method: "POST",
|
|
1552
1698
|
headers: {
|
|
@@ -1972,7 +2118,7 @@ function notionWith(options) {
|
|
|
1972
2118
|
} : out;
|
|
1973
2119
|
},
|
|
1974
2120
|
async deliver(message, target, fetcher, read) {
|
|
1975
|
-
const lines = message.attachments.map((file$1) => read(file$1.id) ? noteOut(file$1.name, "the Notion sync sends no files yet") : noteOut(file$1.name, "the board no longer has it"));
|
|
2121
|
+
const lines = await Promise.all(message.attachments.map(async (file$1) => await read(file$1.id) ? noteOut(file$1.name, "the Notion sync sends no files yet") : noteOut(file$1.name, "the board no longer has it")));
|
|
1976
2122
|
if (target.threadExternal === null) {
|
|
1977
2123
|
const source = await call(fetcher, `/data_sources/${target.place}`);
|
|
1978
2124
|
const title = Object.entries(source?.properties ?? {}).find(([, property]) => property?.type === "title")?.[0];
|
|
@@ -2013,4 +2159,4 @@ function notionWith(options) {
|
|
|
2013
2159
|
}
|
|
2014
2160
|
|
|
2015
2161
|
//#endregion
|
|
2016
|
-
export { AGENTS, Failure, LINEAR_SCOPES, SANDBOX_ROUTES, agentEnv, applyPolicy, board, boardKey, boardPath, boardPolicy, claude, cloudflare, codex, command, conformance, createHandler, e2b, env, fenced, file, generic, github, http, linear, listen, loadWorkflows, mint, notion, pullRequests, runLocal, slack, vercel, verify, workflowResult, workflowsPath };
|
|
2162
|
+
export { AGENTS, Failure, LINEAR_SCOPES, SANDBOX_ROUTES, agentEnv, applyPolicy, backToDisk, board, boardKey, boardPath, boardPolicy, claude, cloudflare, codex, command, conformance, createHandler, e2b, env, fenced, file, generic, github, http, linear, listen, loadWorkflows, memoryFiles, mint, notion, pullRequests, runLocal, s3Files, slack, vercel, verify, workflowResult, workflowsPath };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { D as VERSION } from "./args-C_XaUVTS.js";
|
|
2
|
+
import "./steps-DVxqtI61.js";
|
|
3
|
+
import { a as main, i as attend, n as agentPrompt, o as meantCommand, r as agentToken, s as repoUrl, t as SPECS } from "./main-D8R2IP1C.js";
|
|
4
|
+
import "./module-DkA_1NkG.js";
|
|
5
|
+
|
|
6
|
+
export { SPECS, VERSION, agentPrompt, agentToken, attend, main, meantCommand, repoUrl };
|