@cogitator-ai/koa 0.8.6 → 0.10.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/README.md +102 -40
- package/dist/app.d.ts +7 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +31 -14
- package/dist/app.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware/auth.d.ts +6 -0
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +17 -2
- package/dist/middleware/auth.js.map +1 -1
- package/dist/middleware/body-parser.d.ts.map +1 -1
- package/dist/middleware/body-parser.js +3 -4
- package/dist/middleware/body-parser.js.map +1 -1
- package/dist/middleware/context.d.ts +5 -0
- package/dist/middleware/context.d.ts.map +1 -1
- package/dist/middleware/context.js +10 -1
- package/dist/middleware/context.js.map +1 -1
- package/dist/middleware/error-handler.d.ts.map +1 -1
- package/dist/middleware/error-handler.js +16 -36
- package/dist/middleware/error-handler.js.map +1 -1
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/unmatched.d.ts +20 -0
- package/dist/middleware/unmatched.d.ts.map +1 -0
- package/dist/middleware/unmatched.js +83 -0
- package/dist/middleware/unmatched.js.map +1 -0
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +91 -50
- package/dist/routes/agents.js.map +1 -1
- package/dist/routes/swarms.d.ts.map +1 -1
- package/dist/routes/swarms.js +32 -26
- package/dist/routes/swarms.js.map +1 -1
- package/dist/routes/threads.d.ts.map +1 -1
- package/dist/routes/threads.js +25 -26
- package/dist/routes/threads.js.map +1 -1
- package/dist/routes/workflows.d.ts.map +1 -1
- package/dist/routes/workflows.js +16 -25
- package/dist/routes/workflows.js.map +1 -1
- package/dist/types.d.ts +66 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/errors.d.ts +14 -6
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +29 -12
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/request.d.ts +10 -0
- package/dist/utils/request.d.ts.map +1 -1
- package/dist/utils/request.js +14 -0
- package/dist/utils/request.js.map +1 -1
- package/dist/websocket/handler.d.ts +6 -0
- package/dist/websocket/handler.d.ts.map +1 -1
- package/dist/websocket/handler.js +48 -18
- package/dist/websocket/handler.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -32,7 +32,6 @@ const router = cogitatorApp({
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
app.use(router.routes());
|
|
35
|
-
app.use(router.allowedMethods());
|
|
36
35
|
|
|
37
36
|
app.listen(3000);
|
|
38
37
|
```
|
|
@@ -45,22 +44,28 @@ Creates a Koa Router with all Cogitator endpoints.
|
|
|
45
44
|
|
|
46
45
|
**Options:**
|
|
47
46
|
|
|
48
|
-
| Option | Type
|
|
49
|
-
| -------------------- |
|
|
50
|
-
| `cogitator` | `Cogitator`
|
|
51
|
-
| `agents` | `Record<string, Agent>`
|
|
52
|
-
| `workflows` | `Record<string, Workflow>`
|
|
53
|
-
| `swarms` | `Record<string, SwarmConfig>`
|
|
54
|
-
| `auth` | `AuthFunction`
|
|
55
|
-
| `enableSwagger` | `boolean`
|
|
56
|
-
| `swagger` | `SwaggerConfig`
|
|
57
|
-
| `bodyLimit` | `number`
|
|
58
|
-
| `sseHeartbeatMs` | `number`
|
|
59
|
-
| `acceptContext` | `boolean \| string[]`
|
|
60
|
-
| `threadMessageRoles` | `ThreadMessageRole[]`
|
|
47
|
+
| Option | Type | Description |
|
|
48
|
+
| -------------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `cogitator` | `Cogitator` | **Required.** Cogitator runtime instance |
|
|
50
|
+
| `agents` | `Record<string, Agent>` | Named agents to expose |
|
|
51
|
+
| `workflows` | `Record<string, Workflow>` | Named workflows |
|
|
52
|
+
| `swarms` | `Record<string, SwarmConfig>` | Named swarms |
|
|
53
|
+
| `auth` | `AuthFunction` | `(ctx) => AuthContext \| undefined` (sync or async), receives the Koa Context, throw to answer `401 UNAUTHORIZED` |
|
|
54
|
+
| `enableSwagger` | `boolean` | Serve `/openapi.json` and Swagger UI at `/docs` |
|
|
55
|
+
| `swagger` | `SwaggerConfig` | Swagger configuration |
|
|
56
|
+
| `bodyLimit` | `number` | Max JSON body size in bytes (default 1 MiB) |
|
|
57
|
+
| `sseHeartbeatMs` | `number` | How often SSE streams write a `: keep-alive` comment while a run is silent (default `5000`, `0` turns it off) |
|
|
58
|
+
| `acceptContext` | `boolean \| string[]` | Keys of a run `context` clients may send: none by default, a list, or `true` for any (the model reads it as data from the application) |
|
|
59
|
+
| `threadMessageRoles` | `ThreadMessageRole[]` | Roles `POST /threads/:id/messages` accepts (default `user` and `assistant`) |
|
|
60
|
+
| `limits` | `RunLimits` | `{ swarmTimeout?, workflowMaxIterations?, workflowMaxConcurrency? }`: caps on what a request may ask a swarm or workflow run for (see [Run limits](#run-limits)) |
|
|
61
|
+
| `anonymous` | `'allow' \| 'deny'` | Whether callers without a `userId` may use the API (default `'allow'`), `'deny'` answers `401 UNAUTHORIZED` |
|
|
62
|
+
| `authorizeThread` | `(auth, threadId) => boolean \| Promise<boolean>` | Decides whether a caller may touch a thread, on top of the owner check, `false` answers `403 THREAD_FORBIDDEN` |
|
|
63
|
+
| `deps` | `(ctx) => unknown \| Promise<unknown>` | Builds the `deps` agent runs pass to their tools, from the Koa Context (see [Run deps](#run-deps)) |
|
|
61
64
|
|
|
62
65
|
WebSocket support is attached to the HTTP server with [`setupWebSocket`](#websocket), not through router options.
|
|
63
66
|
|
|
67
|
+
The router answers `OPTIONS` for its own paths with `204` and the methods they serve in `Allow`, so it needs no `router.allowedMethods()`. A CORS middleware (such as `@koa/cors`) goes before the router, so it answers preflight requests itself.
|
|
68
|
+
|
|
64
69
|
## Request Handling
|
|
65
70
|
|
|
66
71
|
- Request bodies are validated before anything reaches the runtime: `input` must contain more than whitespace (`""` and `" "` are refused before the model is called), `context` an object, `threadId` a non-empty string, swarm `timeout` a positive number. Invalid bodies return `400 INVALID_INPUT` with the offending field in the message. The validator comes from `@cogitator-ai/server-shared`, so Express, Fastify, Hono and Koa refuse exactly the same bodies.
|
|
@@ -74,7 +79,8 @@ WebSocket support is attached to the HTTP server with [`setupWebSocket`](#websoc
|
|
|
74
79
|
- The `start` event of an agent stream names the run's thread (the request's `threadId`, or a new one), and `finish` repeats it with the run's outcome, so a client that sent no thread continues the conversation with this one.
|
|
75
80
|
- Swarm routes close each swarm they build once its run ends, so a distributed swarm leaves no Redis connections behind and its state expires. `GET /swarms` lists every agent, the router and pipeline stages included.
|
|
76
81
|
- Thread routes use `cogitator.getMemory()`, which connects the configured memory adapter on first use, so threads can be read on a fresh server before any agent has run. Only a `Cogitator` without `memory` configured answers `503 UNAVAILABLE`.
|
|
77
|
-
- `
|
|
82
|
+
- `GET /threads/:id` answers the whole thread, or one page of it with `?limit=50`: the newest 50 messages (oldest first within the page) and a `nextCursor`. Pass it back as `?limit=50&cursor=<nextCursor>` for the 50 before them, until an answer has no `nextCursor`. Messages written in the same millisecond are neither skipped nor repeated across pages. A `limit` outside 1 to 1000 or a cursor the server did not give answers `400 INVALID_INPUT`.
|
|
83
|
+
- Every error answer has the same envelope, `{ error: { message, code } }`, the one Express, Fastify, Hono and Next use. A `CogitatorError` is answered with its HTTP status and code (for example `429 LLM_RATE_LIMITED`), plus a `Retry-After` header in whole seconds when the provider said when to retry. A swarm that ran out of time answers `504 RUN_TIMEOUT`. Any other error is logged and answered as `500 Internal server error` (code `INTERNAL_ERROR`) without internal details, and the same masking applies to SSE `error` events, `node_error` and `agent_error` stream events and WebSocket errors. A workflow that finishes with an error is answered like a thrown error (its `CogitatorError` status, otherwise `500`), never as a successful result. Missing optional packages (`@cogitator-ai/workflows`, `@cogitator-ai/swarms`) answer `501 UNIMPLEMENTED`.
|
|
78
84
|
- When the client disconnects, the running agent, workflow or swarm is aborted, for both JSON and SSE endpoints.
|
|
79
85
|
- `GET /agents` returns each agent's `description` and never exposes its `instructions`.
|
|
80
86
|
- `GET /tools` returns tool parameters as JSON Schema.
|
|
@@ -83,20 +89,21 @@ WebSocket support is attached to the HTTP server with [`setupWebSocket`](#websoc
|
|
|
83
89
|
|
|
84
90
|
### Agents
|
|
85
91
|
|
|
86
|
-
| Method | Path
|
|
87
|
-
| ------ |
|
|
88
|
-
| `GET` | `/agents`
|
|
89
|
-
| `POST` | `/agents/:name/run`
|
|
90
|
-
| `POST` | `/agents/:name/stream`
|
|
91
|
-
| `POST` | `/agents/:name/resume`
|
|
92
|
+
| Method | Path | Description |
|
|
93
|
+
| ------ | ----------------------------- | -------------------------------- |
|
|
94
|
+
| `GET` | `/agents` | List all agents |
|
|
95
|
+
| `POST` | `/agents/:name/run` | Run agent (JSON response) |
|
|
96
|
+
| `POST` | `/agents/:name/stream` | Run agent (SSE stream) |
|
|
97
|
+
| `POST` | `/agents/:name/resume` | Resume a paused run |
|
|
98
|
+
| `POST` | `/agents/:name/resume/stream` | Resume a paused run (SSE stream) |
|
|
92
99
|
|
|
93
100
|
### Threads (Memory)
|
|
94
101
|
|
|
95
|
-
| Method | Path | Description
|
|
96
|
-
| -------- | ----------------------- |
|
|
97
|
-
| `GET` | `/threads/:id` | Get thread messages
|
|
98
|
-
| `POST` | `/threads/:id/messages` | Add message to thread
|
|
99
|
-
| `DELETE` | `/threads/:id` | Delete thread
|
|
102
|
+
| Method | Path | Description |
|
|
103
|
+
| -------- | ----------------------- | ------------------------------------------------ |
|
|
104
|
+
| `GET` | `/threads/:id` | Get thread messages, a page with `?limit&cursor` |
|
|
105
|
+
| `POST` | `/threads/:id/messages` | Add message to thread |
|
|
106
|
+
| `DELETE` | `/threads/:id` | Delete thread |
|
|
100
107
|
|
|
101
108
|
### Workflows
|
|
102
109
|
|
|
@@ -156,6 +163,51 @@ When `auth` returns a `userId`, everything a caller does with threads is scoped
|
|
|
156
163
|
- Another user's thread answers `403` with code `THREAD_ACCESS_DENIED`, and its messages are neither returned nor changed.
|
|
157
164
|
- Threads created earlier without an owner (no `userId`) stay open only to callers without a `userId`, such as servers with no `auth` configured.
|
|
158
165
|
|
|
166
|
+
### Anonymous callers
|
|
167
|
+
|
|
168
|
+
By default a caller without a `userId` (no `auth`, or `auth` returned none) may use the API as an anonymous user. With `anonymous: 'deny'` such a caller gets `401 UNAUTHORIZED` on every API route. `/health`, `/ready`, `/openapi.json` and `/docs` stay open, so probes and API docs keep working. A path under the router that nothing answers gets `401` under `'deny'` too, so an anonymous caller cannot tell which paths exist, and `404 NOT_FOUND` in the error envelope under `'allow'`. WebSocket connections take the `anonymous` option of `setupWebSocket`, or the `anonymous` of its route context when the option is not set.
|
|
169
|
+
|
|
170
|
+
### Thread authorization
|
|
171
|
+
|
|
172
|
+
Core lets a caller touch only threads they own. `authorizeThread` adds your own rule on top, for example a tenant check:
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
const router = cogitatorApp({
|
|
176
|
+
cogitator,
|
|
177
|
+
agents,
|
|
178
|
+
auth,
|
|
179
|
+
authorizeThread: (auth, threadId) => tenants.ownsThread(auth?.metadata?.tenant, threadId),
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
It is called with what `auth` returned and the thread a request names: the body `threadId` of agent runs, streams and resumes and of swarm runs and streams, and the `:id` of `GET`, `DELETE` and `POST /threads/:id/messages`. It runs after the body is validated and before the owner check, and `false` answers `403 THREAD_FORBIDDEN` without starting a run. WebSocket runs and resumes are checked by the `authorizeThread` of the route context given to `setupWebSocket`, and a refusal is an `error` message.
|
|
184
|
+
|
|
185
|
+
### Run deps
|
|
186
|
+
|
|
187
|
+
`deps` builds what an agent's tools get as `context.deps` for one request: a database handle, the tenant, a client with the caller's credentials. The model never sees them, and they never come from the request body.
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
const router = cogitatorApp({
|
|
191
|
+
cogitator,
|
|
192
|
+
agents,
|
|
193
|
+
deps: async (ctx) => ({ db: await pool.connect(), tenant: ctx.get('x-tenant') }),
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Agent runs, streams and resumes call it once per run. WebSocket runs take the `deps` option of `setupWebSocket`, called with the upgrade request.
|
|
198
|
+
|
|
199
|
+
### Run limits
|
|
200
|
+
|
|
201
|
+
`limits` caps what a request may ask a run for: `swarmTimeout` (ms) for swarm runs, `workflowMaxIterations` and `workflowMaxConcurrency` for workflow runs. A request that asks for more is held to the cap, and one that asks for nothing gets the cap. Each limit must be a positive integer, or `cogitatorApp` throws. The OpenAPI spec shows each limit as the default of its field. WebSocket runs take the `limits` of the route context given to `setupWebSocket`.
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
const router = cogitatorApp({
|
|
205
|
+
cogitator,
|
|
206
|
+
swarms: { research: researchSwarm },
|
|
207
|
+
limits: { swarmTimeout: 120_000, workflowMaxIterations: 50, workflowMaxConcurrency: 4 },
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
159
211
|
### Approvals
|
|
160
212
|
|
|
161
213
|
A tool with `requiresApproval` (`true`, or a function of the arguments) pauses the run before that turn executes:
|
|
@@ -178,6 +230,8 @@ await fetch('/agents/support/resume', {
|
|
|
178
230
|
|
|
179
231
|
The body is `{ threadId, decisions?, defaultDecision? }`, where a decision is `{ approved: boolean, reason?: string }`; malformed bodies get `400 INVALID_INPUT`. The response has the same shape as `/run` and may pause again for calls left without a decision. The run resumes as the authenticated `userId`: a thread with no paused run answers `409 RUN_NOT_PAUSED`, and another user's paused run `403 THREAD_ACCESS_DENIED`. Over WebSocket, send `resume` with `{ name, threadId, decisions?, defaultDecision? }`; a paused run's `complete` event carries `status` and `pendingApprovals`.
|
|
180
232
|
|
|
233
|
+
`POST /agents/:name/resume/stream` takes the same body and streams the rest of the run like `/stream`. `start` and `finish` name the resumed thread, and a body, agent or thread refused before the stream opens is answered as JSON, just like `/resume`. A thread with no paused run ends the open stream with an `error` event, `code: 'RUN_NOT_PAUSED'`, and disconnecting aborts the resume.
|
|
234
|
+
|
|
181
235
|
## Route Prefix
|
|
182
236
|
|
|
183
237
|
```typescript
|
|
@@ -189,7 +243,7 @@ const app = new Koa();
|
|
|
189
243
|
const main = new Router();
|
|
190
244
|
const api = cogitatorApp({ cogitator, agents });
|
|
191
245
|
|
|
192
|
-
main.use('/api/v1', api.routes()
|
|
246
|
+
main.use('/api/v1', api.routes());
|
|
193
247
|
app.use(main.routes());
|
|
194
248
|
```
|
|
195
249
|
|
|
@@ -204,12 +258,11 @@ import { cogitatorApp, setupWebSocket } from '@cogitator-ai/koa';
|
|
|
204
258
|
const app = new Koa();
|
|
205
259
|
const router = cogitatorApp({ cogitator, agents });
|
|
206
260
|
app.use(router.routes());
|
|
207
|
-
app.use(router.allowedMethods());
|
|
208
261
|
|
|
209
262
|
const server = createServer(app.callback());
|
|
210
263
|
await setupWebSocket(
|
|
211
264
|
server,
|
|
212
|
-
{ runtime: cogitator, agents, workflows: {}, swarms: {} },
|
|
265
|
+
{ runtime: cogitator, agents, workflows: {}, swarms: {}, limits: { swarmTimeout: 120_000 } },
|
|
213
266
|
{
|
|
214
267
|
path: '/ws',
|
|
215
268
|
pingInterval: 30000,
|
|
@@ -221,13 +274,15 @@ await setupWebSocket(
|
|
|
221
274
|
}
|
|
222
275
|
return { userId: 'api' };
|
|
223
276
|
},
|
|
277
|
+
anonymous: 'deny',
|
|
278
|
+
deps: (req) => ({ tenant: req.headers['x-tenant'] }),
|
|
224
279
|
}
|
|
225
280
|
);
|
|
226
281
|
|
|
227
282
|
server.listen(3000);
|
|
228
283
|
```
|
|
229
284
|
|
|
230
|
-
The router's `auth` option does not cover WebSocket connections, so pass `auth` to `setupWebSocket` to protect them: it receives the upgrade `IncomingMessage`, and throwing rejects the handshake with `401` (or `500` when the error carries a `status >= 500`). Upgrades on other paths are left to other `upgrade` listeners (or rejected with `404` when there are none), so the socket can share the HTTP server with other WebSocket servers. A client that does not answer a ping within `pingTimeout` (defaults to `pingInterval`) is terminated, and closing a connection aborts its active run.
|
|
285
|
+
The router's `auth` option does not cover WebSocket connections, so pass `auth` to `setupWebSocket` to protect them: it receives the upgrade `IncomingMessage`, and throwing rejects the handshake with `401` (or `500` when the error carries a `status >= 500`). With `anonymous: 'deny'` a connection without a `userId` is refused with `401` too. `deps` builds the deps of each agent run on the connection from its upgrade request, called for each run. The route context can carry `limits` and `authorizeThread`, which WebSocket runs and resumes follow like the HTTP routes, and `anonymous`, which the handshake follows when the `anonymous` option is not set (the option wins). Its `deps` builds the deps of HTTP runs from a Koa `Context`, which an upgrade request does not have, so `setupWebSocket` ignores it and takes the `deps` option instead. Upgrades on other paths are left to other `upgrade` listeners (or rejected with `404` when there are none), so the socket can share the HTTP server with other WebSocket servers. A client that does not answer a ping within `pingTimeout` (defaults to `pingInterval`) is terminated, and closing a connection aborts its active run.
|
|
231
286
|
|
|
232
287
|
**Message types:**
|
|
233
288
|
|
|
@@ -238,11 +293,11 @@ The router's `auth` option does not cover WebSocket connections, so pass `auth`
|
|
|
238
293
|
| `stop` | Cancels the current run |
|
|
239
294
|
| `ping` | Answered with `pong` (echoes `id`) |
|
|
240
295
|
|
|
241
|
-
| Server sends | Description
|
|
242
|
-
| ------------ |
|
|
243
|
-
| `event` | `token`, `reasoning`, `tool-call`, `tool-result`, `complete` (with the serialized result), `cancelled`
|
|
244
|
-
| `error` | Invalid message, unknown resource, run already in progress, or a masked run failure
|
|
245
|
-
| `pong` | Heartbeat reply
|
|
296
|
+
| Server sends | Description |
|
|
297
|
+
| ------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
|
298
|
+
| `event` | `token`, `reasoning`, `tool-call`, `tool-result`, `complete` (with the serialized result), `cancelled` |
|
|
299
|
+
| `error` | Invalid message, unknown resource, a thread `authorizeThread` refused, run already in progress, or a masked run failure |
|
|
300
|
+
| `pong` | Heartbeat reply |
|
|
246
301
|
|
|
247
302
|
## SSE Streaming
|
|
248
303
|
|
|
@@ -307,21 +362,28 @@ import {
|
|
|
307
362
|
|
|
308
363
|
Built-in middleware stack (applied automatically by `cogitatorApp`):
|
|
309
364
|
|
|
310
|
-
- **Error handler
|
|
311
|
-
- **Body parser
|
|
312
|
-
- **Context
|
|
313
|
-
- **Auth
|
|
365
|
+
- **Error handler**, catches errors and returns structured `ErrorResponse`
|
|
366
|
+
- **Body parser**, parses JSON for POST, PUT, PATCH requests (`bodyLimit`, 1 MiB by default, returns `413` above it). A body already parsed by upstream middleware such as `koa-bodyparser` is reused
|
|
367
|
+
- **Context**, injects `RouteContext` with `runtime`, `agents`, `workflows`, `swarms` into Koa state
|
|
368
|
+
- **Auth**, optional authentication via the `auth` callback
|
|
369
|
+
- **Anonymous policy**, after the health and docs routes, answers `401` to callers without a `userId` under `anonymous: 'deny'` (`createAnonymousMiddleware`)
|
|
370
|
+
- **Unmatched paths**, a request no route serves skips the middleware above and goes on to the middleware after the router untouched. What nothing answers goes through auth and the anonymous policy and gets `404 NOT_FOUND` in the error envelope, or `401` under `anonymous: 'deny'`. A method a path does not take is answered the same way. Under a prefix, only paths under it are answered
|
|
314
371
|
|
|
315
372
|
## Key Types
|
|
316
373
|
|
|
317
374
|
```typescript
|
|
318
375
|
import type {
|
|
319
|
-
RouteContext, // { runtime, agents, workflows, swarms }
|
|
376
|
+
RouteContext, // { runtime, agents, workflows, swarms, limits?, authorizeThread?, anonymous?, deps? }, deps is for HTTP runs only
|
|
320
377
|
CogitatorAppOptions,
|
|
321
378
|
AuthContext,
|
|
322
379
|
AuthFunction,
|
|
380
|
+
DepsFunction,
|
|
381
|
+
RunLimits,
|
|
382
|
+
AnonymousPolicy,
|
|
383
|
+
AuthorizeThread,
|
|
323
384
|
WebSocketConfig,
|
|
324
385
|
WebSocketAuthFunction,
|
|
386
|
+
WebSocketDepsFunction,
|
|
325
387
|
WebSocketRunPayload,
|
|
326
388
|
BodyParserOptions,
|
|
327
389
|
WorkflowStatusResponse,
|
package/dist/app.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import Router from '@koa/router';
|
|
2
2
|
import type { CogitatorAppOptions, CogitatorState } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The Cogitator API as a Koa router. A request no route serves passes on to the middleware
|
|
5
|
+
* after the router, and what is left unanswered gets `404 NOT_FOUND` in the error envelope, or
|
|
6
|
+
* `401 UNAUTHORIZED` for an anonymous caller under `anonymous: 'deny'`.
|
|
7
|
+
*
|
|
8
|
+
* @throws Error when `opts.limits` holds a limit that is not a positive integer
|
|
9
|
+
*/
|
|
3
10
|
export declare function cogitatorApp(opts: CogitatorAppOptions): Router<CogitatorState>;
|
|
4
11
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmBtE;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAAC,cAAc,CAAC,CAsC9E"}
|
package/dist/app.js
CHANGED
|
@@ -1,30 +1,47 @@
|
|
|
1
1
|
import Router from '@koa/router';
|
|
2
|
-
import { createContextMiddleware, createAuthMiddleware, createBodyParser, createErrorHandler, } from './middleware/index.js';
|
|
2
|
+
import { createContextMiddleware, createAnonymousMiddleware, createAuthMiddleware, createBodyParser, createErrorHandler, } from './middleware/index.js';
|
|
3
3
|
import { createHealthRoutes, createAgentRoutes, createThreadRoutes, createToolRoutes, createWorkflowRoutes, createSwarmRoutes, } from './routes/index.js';
|
|
4
4
|
import { createSwaggerRoutes } from './swagger/index.js';
|
|
5
|
+
import { forRoutes, routeUnmatched } from './middleware/unmatched.js';
|
|
6
|
+
/**
|
|
7
|
+
* The Cogitator API as a Koa router. A request no route serves passes on to the middleware
|
|
8
|
+
* after the router, and what is left unanswered gets `404 NOT_FOUND` in the error envelope, or
|
|
9
|
+
* `401 UNAUTHORIZED` for an anonymous caller under `anonymous: 'deny'`.
|
|
10
|
+
*
|
|
11
|
+
* @throws Error when `opts.limits` holds a limit that is not a positive integer
|
|
12
|
+
*/
|
|
5
13
|
export function cogitatorApp(opts) {
|
|
6
14
|
const router = new Router();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
const errorHandler = createErrorHandler();
|
|
16
|
+
const context = createContextMiddleware(opts);
|
|
17
|
+
const authenticate = opts.auth ? [createAuthMiddleware(opts.auth)] : [];
|
|
18
|
+
const anonymous = createAnonymousMiddleware(opts.anonymous);
|
|
19
|
+
router.use(forRoutes(errorHandler));
|
|
20
|
+
router.use(forRoutes(createBodyParser({ limit: opts.bodyLimit })));
|
|
21
|
+
router.use(forRoutes(context));
|
|
22
|
+
for (const middleware of authenticate)
|
|
23
|
+
router.use(forRoutes(middleware));
|
|
24
|
+
const publicRouters = [createHealthRoutes()];
|
|
25
|
+
if (opts.enableSwagger) {
|
|
26
|
+
publicRouters.push(createSwaggerRoutes({
|
|
27
|
+
...opts.swagger,
|
|
28
|
+
auth: opts.swagger?.auth ?? Boolean(opts.auth),
|
|
29
|
+
...(opts.limits && { limits: opts.limits }),
|
|
30
|
+
}));
|
|
12
31
|
}
|
|
13
|
-
const
|
|
14
|
-
createHealthRoutes(),
|
|
32
|
+
const apiRouters = [
|
|
15
33
|
createAgentRoutes(),
|
|
16
34
|
createThreadRoutes(),
|
|
17
35
|
createToolRoutes(),
|
|
18
36
|
createWorkflowRoutes(),
|
|
19
37
|
createSwarmRoutes(),
|
|
20
38
|
];
|
|
21
|
-
|
|
22
|
-
subrouters.push(createSwaggerRoutes({ ...opts.swagger, auth: opts.swagger?.auth ?? Boolean(opts.auth) }));
|
|
23
|
-
}
|
|
24
|
-
for (const sub of subrouters) {
|
|
39
|
+
for (const sub of publicRouters)
|
|
25
40
|
router.use(sub.routes());
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
router.use(forRoutes(anonymous));
|
|
42
|
+
for (const sub of apiRouters)
|
|
43
|
+
router.use(sub.routes());
|
|
44
|
+
routeUnmatched(router, [errorHandler, context, ...authenticate, anonymous]);
|
|
28
45
|
return router;
|
|
29
46
|
}
|
|
30
47
|
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,E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9C,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;SAC5C,CAAC,CACH,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG;QACjB,iBAAiB,EAAE;QACnB,kBAAkB,EAAE;QACpB,gBAAgB,EAAE;QAClB,oBAAoB,EAAE;QACtB,iBAAiB,EAAE;KACpB,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,aAAa;QAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1D,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IACjC,KAAK,MAAM,GAAG,IAAI,UAAU;QAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAEvD,cAAc,CAAC,MAAM,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,GAAG,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IAE5E,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { cogitatorApp } from './app.js';
|
|
2
|
-
export type { AuthContext, AuthFunction, CogitatorAppOptions, CogitatorState, RouteContext, WebSocketConfig, WebSocketAuthFunction, AgentListResponse, AgentRunRequest, AgentRunResponse, AgentResumeRequest, PendingApproval, ThreadResponse, AddMessageRequest, ToolListResponse, WorkflowListResponse, WorkflowRunRequest, WorkflowRunResponse, WorkflowStatusResponse, SwarmListResponse, SwarmRunRequest, SwarmRunResponse, BlackboardResponse, HealthResponse, ReadinessResponse, ReadinessCheckStatus, ErrorResponse, SwaggerConfig, WebSocketMessage, WebSocketResponse, WebSocketRunPayload, WebSocketResumePayload, } from './types.js';
|
|
3
|
-
export { createContextMiddleware, createAuthMiddleware, createBodyParser, createErrorHandler, } from './middleware/index.js';
|
|
2
|
+
export type { AuthContext, AuthFunction, CogitatorAppOptions, CogitatorState, RouteContext, WebSocketConfig, WebSocketAuthFunction, WebSocketDepsFunction, DepsFunction, RunLimits, AnonymousPolicy, AuthorizeThread, AgentListResponse, AgentRunRequest, AgentRunResponse, AgentResumeRequest, PendingApproval, ThreadResponse, AddMessageRequest, ToolListResponse, WorkflowListResponse, WorkflowRunRequest, WorkflowRunResponse, WorkflowStatusResponse, SwarmListResponse, SwarmRunRequest, SwarmRunResponse, BlackboardResponse, HealthResponse, ReadinessResponse, ReadinessCheckStatus, ErrorResponse, SwaggerConfig, WebSocketMessage, WebSocketResponse, WebSocketRunPayload, WebSocketResumePayload, } from './types.js';
|
|
3
|
+
export { createContextMiddleware, createAnonymousMiddleware, createAuthMiddleware, createBodyParser, createErrorHandler, } from './middleware/index.js';
|
|
4
4
|
export type { BodyParserOptions } from './middleware/body-parser.js';
|
|
5
5
|
export { createHealthRoutes, createAgentRoutes, createThreadRoutes, createToolRoutes, createWorkflowRoutes, createSwarmRoutes, } from './routes/index.js';
|
|
6
6
|
export { createSwaggerRoutes } from './swagger/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,YAAY,EACV,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACpF,YAAY,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE/E,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,YAAY,EACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,KAAK,GACN,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,YAAY,EACV,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B,GACjB,MAAM,6BAA6B,CAAC;AAErC,YAAY,EACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,KAAK,GACN,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { cogitatorApp } from './app.js';
|
|
2
|
-
export { createContextMiddleware, createAuthMiddleware, createBodyParser, createErrorHandler, } from './middleware/index.js';
|
|
2
|
+
export { createContextMiddleware, createAnonymousMiddleware, createAuthMiddleware, createBodyParser, createErrorHandler, } from './middleware/index.js';
|
|
3
3
|
export { createHealthRoutes, createAgentRoutes, createThreadRoutes, createToolRoutes, createWorkflowRoutes, createSwarmRoutes, } from './routes/index.js';
|
|
4
4
|
export { createSwaggerRoutes } from './swagger/index.js';
|
|
5
5
|
export { KoaStreamWriter, setupSSEHeaders } from './streaming/koa-stream-writer.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA0CxC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGpF,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAqBrC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Context, Next } from 'koa';
|
|
2
|
+
import { type AnonymousPolicy } from '@cogitator-ai/server-shared';
|
|
2
3
|
import type { AuthFunction } from '../types.js';
|
|
3
4
|
export declare function createAuthMiddleware(authFn: AuthFunction): (ctx: Context, next: Next) => Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Turns away callers without a `userId` when `anonymous` is `'deny'`, with
|
|
7
|
+
* `401 UNAUTHORIZED`. Routes registered before it, such as health and docs, stay open.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createAnonymousMiddleware(anonymous: AnonymousPolicy | undefined): (ctx: Context, next: Next) => Promise<void>;
|
|
4
10
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/middleware/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,KAAK,EAAe,YAAY,EAAkB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/middleware/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9F,OAAO,KAAK,EAAe,YAAY,EAAkB,MAAM,aAAa,CAAC;AAG7E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,IACzC,KAAK,OAAO,EAAE,MAAM,IAAI,mBAgBvC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,eAAe,GAAG,SAAS,IAChE,KAAK,OAAO,EAAE,MAAM,IAAI,mBAQvC"}
|
package/dist/middleware/auth.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { UNAUTHORIZED, admitCaller } from '@cogitator-ai/server-shared';
|
|
2
|
+
import { sendError } from '../utils/errors.js';
|
|
1
3
|
export function createAuthMiddleware(authFn) {
|
|
2
4
|
return async (ctx, next) => {
|
|
3
5
|
let auth;
|
|
@@ -9,12 +11,25 @@ export function createAuthMiddleware(authFn) {
|
|
|
9
11
|
if (status !== undefined && status >= 500) {
|
|
10
12
|
throw err;
|
|
11
13
|
}
|
|
12
|
-
ctx
|
|
13
|
-
ctx.body = { error: { message: 'Unauthorized', code: 'UNAUTHORIZED' } };
|
|
14
|
+
sendError(ctx, { ...UNAUTHORIZED, message: 'Unauthorized' });
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
17
|
ctx.state.auth = auth;
|
|
17
18
|
await next();
|
|
18
19
|
};
|
|
19
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Turns away callers without a `userId` when `anonymous` is `'deny'`, with
|
|
23
|
+
* `401 UNAUTHORIZED`. Routes registered before it, such as health and docs, stay open.
|
|
24
|
+
*/
|
|
25
|
+
export function createAnonymousMiddleware(anonymous) {
|
|
26
|
+
return async (ctx, next) => {
|
|
27
|
+
const refusal = admitCaller(ctx.state.auth?.userId, anonymous);
|
|
28
|
+
if (refusal) {
|
|
29
|
+
sendError(ctx, refusal);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
await next();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
20
35
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/middleware/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/middleware/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwB,MAAM,6BAA6B,CAAC;AAE9F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,oBAAoB,CAAC,MAAoB;IACvD,OAAO,KAAK,EAAE,GAAY,EAAE,IAAU,EAAE,EAAE;QACxC,IAAI,IAA6B,CAAC;QAClC,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,MAAM,GAAI,GAAkC,EAAE,MAAM,CAAC;YAC3D,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;gBAC1C,MAAM,GAAG,CAAC;YACZ,CAAC;YACD,SAAS,CAAC,GAAG,EAAE,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;YAC7D,OAAO;QACT,CAAC;QAEA,GAAG,CAAC,KAAwB,CAAC,IAAI,GAAG,IAAI,CAAC;QAC1C,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,SAAsC;IAC9E,OAAO,KAAK,EAAE,GAAY,EAAE,IAAU,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,WAAW,CAAE,GAAG,CAAC,KAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACnF,IAAI,OAAO,EAAE,CAAC;YACZ,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YACxB,OAAO;QACT,CAAC;QACD,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-parser.d.ts","sourceRoot":"","sources":["../../src/middleware/body-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"body-parser.d.ts","sourceRoot":"","sources":["../../src/middleware/body-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAGzC,eAAO,MAAM,kBAAkB,QAAc,CAAC;AAI9C,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,IAGhD,KAAK,OAAO,EAAE,MAAM,IAAI,mBA0BvC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { refuseNonJsonBody } from '@cogitator-ai/server-shared';
|
|
2
|
+
import { invalidInput, sendError } from '../utils/errors.js';
|
|
2
3
|
export const DEFAULT_BODY_LIMIT = 1024 * 1024;
|
|
3
4
|
const BODY_METHODS = new Set(['POST', 'PUT', 'PATCH']);
|
|
4
5
|
export function createBodyParser(options = {}) {
|
|
@@ -7,8 +8,7 @@ export function createBodyParser(options = {}) {
|
|
|
7
8
|
const refusal = refuseNonJsonBody(ctx.method, ctx.headers);
|
|
8
9
|
if (refusal) {
|
|
9
10
|
await discardBody(ctx);
|
|
10
|
-
ctx
|
|
11
|
-
ctx.body = { error: { message: refusal.message, code: refusal.code } };
|
|
11
|
+
sendError(ctx, refusal);
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
if (BODY_METHODS.has(ctx.method) && ctx.is('application/json') && !isBodyConsumed(ctx)) {
|
|
@@ -23,8 +23,7 @@ export function createBodyParser(options = {}) {
|
|
|
23
23
|
ctx.request.body = JSON.parse(raw);
|
|
24
24
|
}
|
|
25
25
|
catch {
|
|
26
|
-
ctx
|
|
27
|
-
ctx.body = { error: { message: 'Invalid JSON body', code: 'INVALID_INPUT' } };
|
|
26
|
+
invalidInput(ctx, 'Invalid JSON body');
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
30
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-parser.js","sourceRoot":"","sources":["../../src/middleware/body-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"body-parser.js","sourceRoot":"","sources":["../../src/middleware/body-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAM5E,MAAM,UAAU,gBAAgB,CAAC,UAA6B,EAAE;IAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,kBAAkB,CAAC;IAElD,OAAO,KAAK,EAAE,GAAY,EAAE,IAAU,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3D,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;YACvB,SAAS,CAAC,G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,GAAG,CAAC;IACb,MAAM,GAAG,IAAI,CAAC;IAEvB;QACE,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,MAAM,mBAAoB,SAAQ,KAAK;IAC5B,MAAM,GAAG,GAAG,CAAC;IACb,MAAM,GAAG,IAAI,CAAC;IAEvB;QACE,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { Context, Next } from 'koa';
|
|
2
2
|
import type { CogitatorAppOptions } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Sets the Cogitator state of each request.
|
|
5
|
+
*
|
|
6
|
+
* @throws Error when `opts.limits` holds a limit that is not a positive integer
|
|
7
|
+
*/
|
|
3
8
|
export declare function createContextMiddleware(opts: CogitatorAppOptions): (ctx: Context, next: Next) => Promise<void>;
|
|
4
9
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/middleware/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAgC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/middleware/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAgC,MAAM,aAAa,CAAC;AAQrF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,IAejD,KAAK,OAAO,EAAE,MAAM,IAAI,mBAOvC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { DEFAULT_THREAD_MESSAGE_ROLES, generateId, resolveSseHeartbeatMs, } from '@cogitator-ai/server-shared';
|
|
1
|
+
import { DEFAULT_THREAD_MESSAGE_ROLES, checkRunLimits, generateId, resolveSseHeartbeatMs, } from '@cogitator-ai/server-shared';
|
|
2
|
+
/**
|
|
3
|
+
* Sets the Cogitator state of each request.
|
|
4
|
+
*
|
|
5
|
+
* @throws Error when `opts.limits` holds a limit that is not a positive integer
|
|
6
|
+
*/
|
|
2
7
|
export function createContextMiddleware(opts) {
|
|
3
8
|
const routeCtx = {
|
|
4
9
|
runtime: opts.cogitator,
|
|
@@ -8,6 +13,10 @@ export function createContextMiddleware(opts) {
|
|
|
8
13
|
sseHeartbeatMs: resolveSseHeartbeatMs(opts.sseHeartbeatMs),
|
|
9
14
|
acceptContext: opts.acceptContext ?? false,
|
|
10
15
|
threadMessageRoles: opts.threadMessageRoles ?? DEFAULT_THREAD_MESSAGE_ROLES,
|
|
16
|
+
limits: checkRunLimits(opts.limits),
|
|
17
|
+
authorizeThread: opts.authorizeThread,
|
|
18
|
+
anonymous: opts.anonymous,
|
|
19
|
+
deps: opts.deps,
|
|
11
20
|
};
|
|
12
21
|
return async (ctx, next) => {
|
|
13
22
|
const state = ctx.state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/middleware/context.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,4BAA4B,EAC5B,UAAU,EACV,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AAErC,MAAM,UAAU,uBAAuB,CAAC,IAAyB;IAC/D,MAAM,QAAQ,GAAiB;QAC7B,OAAO,EAAE,IAAI,CAAC,SAAS;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;QACzB,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;QAC/B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;QACzB,cAAc,E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C;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/middleware/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/middleware/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAIzC,wBAAgB,kBAAkB,KAClB,KAAK,OAAO,EAAE,MAAM,IAAI,mBA6BvC"}
|