@cogitator-ai/koa 0.7.16 → 0.7.18
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 +14 -14
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -45,19 +45,19 @@ Creates a Koa Router with all Cogitator endpoints.
|
|
|
45
45
|
|
|
46
46
|
**Options:**
|
|
47
47
|
|
|
48
|
-
| Option | Type | Description
|
|
49
|
-
| -------------------- | ----------------------------- |
|
|
50
|
-
| `cogitator` | `Cogitator` | **Required.** Cogitator runtime instance
|
|
51
|
-
| `agents` | `Record<string, Agent>` | Named agents to expose
|
|
52
|
-
| `workflows` | `Record<string, Workflow>` | Named workflows
|
|
53
|
-
| `swarms` | `Record<string, SwarmConfig>` | Named swarms
|
|
54
|
-
| `auth` | `AuthFunction` | `(ctx) => AuthContext \| undefined` (sync or async), receives the Koa Context, throw to answer `401 UNAUTHORIZED`
|
|
55
|
-
| `enableSwagger` | `boolean` | Serve `/openapi.json` and Swagger UI at `/docs`
|
|
56
|
-
| `swagger` | `SwaggerConfig` | Swagger configuration
|
|
57
|
-
| `bodyLimit` | `number` | Max JSON body size in bytes (default 1 MiB)
|
|
58
|
-
| `sseHeartbeatMs` | `number` | How often SSE streams write a `: keep-alive` comment while a run is silent (default `5000`, `0` turns it off)
|
|
59
|
-
| `acceptContext` | `boolean \| string[]` | Keys of a run `context` clients may send: none by default, a list, or `true` for any (it
|
|
60
|
-
| `threadMessageRoles` | `ThreadMessageRole[]` | Roles `POST /threads/:id/messages` accepts (default `user` and `assistant`)
|
|
48
|
+
| Option | Type | Description |
|
|
49
|
+
| -------------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `cogitator` | `Cogitator` | **Required.** Cogitator runtime instance |
|
|
51
|
+
| `agents` | `Record<string, Agent>` | Named agents to expose |
|
|
52
|
+
| `workflows` | `Record<string, Workflow>` | Named workflows |
|
|
53
|
+
| `swarms` | `Record<string, SwarmConfig>` | Named swarms |
|
|
54
|
+
| `auth` | `AuthFunction` | `(ctx) => AuthContext \| undefined` (sync or async), receives the Koa Context, throw to answer `401 UNAUTHORIZED` |
|
|
55
|
+
| `enableSwagger` | `boolean` | Serve `/openapi.json` and Swagger UI at `/docs` |
|
|
56
|
+
| `swagger` | `SwaggerConfig` | Swagger configuration |
|
|
57
|
+
| `bodyLimit` | `number` | Max JSON body size in bytes (default 1 MiB) |
|
|
58
|
+
| `sseHeartbeatMs` | `number` | How often SSE streams write a `: keep-alive` comment while a run is silent (default `5000`, `0` turns it off) |
|
|
59
|
+
| `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) |
|
|
60
|
+
| `threadMessageRoles` | `ThreadMessageRole[]` | Roles `POST /threads/:id/messages` accepts (default `user` and `assistant`) |
|
|
61
61
|
|
|
62
62
|
WebSocket support is attached to the HTTP server with [`setupWebSocket`](#websocket), not through router options.
|
|
63
63
|
|
|
@@ -68,7 +68,7 @@ WebSocket support is attached to the HTTP server with [`setupWebSocket`](#websoc
|
|
|
68
68
|
- While an SSE stream is open it writes a `: keep-alive` comment every `sseHeartbeatMs` (5 s by default, `0` turns it off), which SSE clients skip, so a proxy or load balancer does not close a stream that waits on a slow tool or model (nginx closes a connection silent for 60 s).
|
|
69
69
|
- Workflow runs accept an optional body. `options` is limited to `maxConcurrency` and `maxIterations` (positive integers). Any other option is dropped and a wrongly typed one returns `400 INVALID_INPUT`. `checkpoint: true` is refused, since the server runs each workflow on a fresh executor and keeps no checkpoint store to resume from.
|
|
70
70
|
- Thread messages accept `role` of `user` or `assistant` (more with `threadMessageRoles`), `metadata` is stored with the entry and a token estimate is recorded.
|
|
71
|
-
- A run
|
|
71
|
+
- A run sends `context` to the model as data the application supplied, and the model reads a `system` thread message as operator instructions, so clients may set neither unless the server allows it: `acceptContext` lists the `context` keys clients may send (`true` accepts any key, for clients trusted like your own code), and `threadMessageRoles` the roles of `POST /threads/:id/messages` (`user` and `assistant` by default). Anything else is refused with `400 INVALID_INPUT`, over HTTP and WebSocket alike.
|
|
72
72
|
- A `POST` body that is not JSON (`text/plain`, a form) is refused with `415 UNSUPPORTED_MEDIA_TYPE` before it is parsed: browsers send those across origins without a CORS preflight.
|
|
73
73
|
- `POST /agents/:name/run` and `/resume` answer `toAgentRunResponse()` of `@cogitator-ai/server-shared`: `output`, `threadId`, `usage`, `toolCalls` (`{ id, name, arguments }`), `status` and `traceId`, plus `reasoning`, `pendingApprovals`, `structured`, `structuredError`, `truncated`, `blocked` and `iterationLimitReached` when they apply. The WebSocket `complete` event carries the same object, never the system prompt, the history, trace spans or a paused run's checkpoint.
|
|
74
74
|
- 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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogitator-ai/koa",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.18",
|
|
4
4
|
"description": "Koa server adapter for Cogitator AI runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,23 +20,23 @@
|
|
|
20
20
|
"node": ">=22.12.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@cogitator-ai/core": "0.
|
|
24
|
-
"@cogitator-ai/memory": "0.
|
|
25
|
-
"@cogitator-ai/types": "0.
|
|
26
|
-
"@cogitator-ai/server-shared": "0.5.
|
|
23
|
+
"@cogitator-ai/core": "0.51.0",
|
|
24
|
+
"@cogitator-ai/memory": "0.18.0",
|
|
25
|
+
"@cogitator-ai/types": "0.53.0",
|
|
26
|
+
"@cogitator-ai/server-shared": "0.5.18"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"koa": ">=2.15.0",
|
|
30
30
|
"@koa/router": ">=12.0.0"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@cogitator-ai/workflows": "0.13.
|
|
34
|
-
"@cogitator-ai/swarms": "0.13.
|
|
33
|
+
"@cogitator-ai/workflows": "0.13.5",
|
|
34
|
+
"@cogitator-ai/swarms": "0.13.5",
|
|
35
35
|
"ws": "^8.22.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@cogitator-ai/workflows": "0.13.
|
|
39
|
-
"@cogitator-ai/swarms": "0.13.
|
|
38
|
+
"@cogitator-ai/workflows": "0.13.5",
|
|
39
|
+
"@cogitator-ai/swarms": "0.13.5",
|
|
40
40
|
"supertest": "^7.3.0",
|
|
41
41
|
"@types/supertest": "^7.2.1",
|
|
42
42
|
"vitest": "^5.0.3",
|