@openmuster/muster 0.3.1-alpha.5 → 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 +2 -2
- package/dist/{args-CaFBa2IP.js → args-C_XaUVTS.js} +456 -65
- package/dist/cli.js +3 -3
- package/dist/index.d.ts +231 -85
- package/dist/index.js +156 -10
- package/dist/main-C-3gchLr.js +6 -0
- package/dist/{main-BeEB08iI.js → main-D8R2IP1C.js} +1080 -119
- 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/skills/loop-card/SKILL.md +22 -3
- package/dist/{steps-FNDWY1P_.js → steps-DVxqtI61.js} +405 -9
- 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/16-workflows.md +20 -0
- 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/06-sandboxed-agents.md +47 -0
- package/docs/03-guides/17-mcp.md +44 -7
- package/docs/03-guides/20-a-feedback-loop.md +114 -1
- package/docs/03-guides/22-building-from-linear.md +19 -6
- package/docs/04-reference/01-cli.md +10 -1
- package/docs/04-reference/02-handle.md +1 -0
- package/docs/04-reference/03-http.md +56 -5
- package/docs/04-reference/05-errors.md +8 -1
- package/docs/04-reference/06-conformance.md +17 -5
- package/package.json +2 -2
- package/dist/main-CLzQkYeG.js +0 -6
- package/dist/mcp-CAAZRJgv.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';
|
|
@@ -2126,6 +2242,7 @@ type WorkflowStep = {
|
|
|
2126
2242
|
labels?: Record<string, string>;
|
|
2127
2243
|
push?: boolean;
|
|
2128
2244
|
title?: string;
|
|
2245
|
+
refs?: string;
|
|
2129
2246
|
};
|
|
2130
2247
|
type Workers = {
|
|
2131
2248
|
count: number;
|
|
@@ -2184,4 +2301,33 @@ declare function workflowResult(team: Board, id: number, owner: string): Promise
|
|
|
2184
2301
|
*/
|
|
2185
2302
|
declare function fenced(whose: string, text: string): string;
|
|
2186
2303
|
//#endregion
|
|
2187
|
-
|
|
2304
|
+
//#region src/runner/github.d.ts
|
|
2305
|
+
/** A pull request as `pullRequests` reads it. */
|
|
2306
|
+
type PullRequest = {
|
|
2307
|
+
number: number;
|
|
2308
|
+
state: 'open' | 'closed';
|
|
2309
|
+
merged: boolean;
|
|
2310
|
+
mergedAt: string | null;
|
|
2311
|
+
base: string;
|
|
2312
|
+
createdAt: string;
|
|
2313
|
+
url: string;
|
|
2314
|
+
};
|
|
2315
|
+
/**
|
|
2316
|
+
* The pull requests opened from `head` on a GitHub repository, newest first, and the repository's default branch.
|
|
2317
|
+
* It reads and writes nothing else. With `token`, it reads with that; without, with a token it asks the GitHub
|
|
2318
|
+
* App in `env` (GITHUB_APP_ID, and GITHUB_APP_KEY_FILE or GITHUB_APP_PRIVATE_KEY) for, that may only read pull
|
|
2319
|
+
* requests on this one repository. `repo` is its HTTPS clone address, as a workflow's `workers.repo` gives it.
|
|
2320
|
+
*/
|
|
2321
|
+
declare function pullRequests(options: {
|
|
2322
|
+
repo: string;
|
|
2323
|
+
head: string;
|
|
2324
|
+
token?: string;
|
|
2325
|
+
env?: NodeJS.ProcessEnv;
|
|
2326
|
+
api?: string;
|
|
2327
|
+
fetch?: typeof fetch;
|
|
2328
|
+
}): Promise<{
|
|
2329
|
+
defaultBranch: string;
|
|
2330
|
+
pulls: PullRequest[];
|
|
2331
|
+
}>;
|
|
2332
|
+
//#endregion
|
|
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 };
|