Versions 116 to 318
new file, 212 lines
1+// The issues routes, apart from the Durable Object so they run under node --test with a store on node:sqlite.
2+// Paths are the client's: /p/:project/<read> for reads, and /p/:project/a/:agent/<op> for an agent's writes and
3+// its own reads (waiting, asked, drafts, news). Who may call which path was decided before a request gets here.
4+
6+
9+
11+ new Response(JSON.stringify(body), { status, headers: { "content-type": "application/json" } });
12+
14+ * One request to a project's issues. `seatError` says why a new ask's `of` isn't an agent in the project, or null
33+
59+ // An agent's news here: answers, replies, @mentions, and changes on issues it watches, by others.
63+ news: store.newsFor(actor, [who(actor)], before === null ? undefined : Number(before) || undefined),
78+ ...(q.getAll("label").length > 0 ? { labels: q.getAll("label").flatMap((l) => l.split(",")) } : {}),
84+ // The change count: what a reader can cache issue reads under, cheap enough to ask every request.
88+ return json(200, { hits: store.search((q.get("q") ?? "").slice(0, 200), Number.isInteger(limit) ? limit : 20) });
129+ if (typeof at !== "number" || !Number.isFinite(at)) return json(400, { error: "at is a time in milliseconds" });
145+
147+ * The body, read a chunk at a time and refused (413) the moment it passes `max`, so a body with no
150+export async function readCapped(request: Request, max: number): Promise<Uint8Array<ArrayBuffer>> {
152+ if (declared > max) throw new IssuesError(`the body is ${declared} bytes; the most is ${max}`, 413);
175+
176+/** A write that can carry news, to run once the writer's limit allows it; undefined when no route matches. */
- MCP
- compare on this site's /mcp
- CLI
- abso diff 116 318 server/src/issues/routes.ts --json
- JSON
- /christopher/abso-core/compare/116..318?file=server%2Fsrc%2Fissues%2Froutes.ts&format=json