@cogitator-ai/hono 0.7.16 → 0.7.17
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 +16 -16
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -44,21 +44,21 @@ Creates a Hono sub-application with all Cogitator endpoints.
|
|
|
44
44
|
|
|
45
45
|
**Options:**
|
|
46
46
|
|
|
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` | `(c) => AuthContext \| undefined` (sync or async), receives the Hono Context, throw to answer `401 UNAUTHORIZED`
|
|
54
|
-
| `enableSwagger` | `boolean` | Serve `/openapi.json` and Swagger UI at `/docs`
|
|
55
|
-
| `swagger` | `SwaggerConfig` | Swagger configuration
|
|
56
|
-
| `enableWebSocket` | `boolean` | Enable the WebSocket endpoint
|
|
57
|
-
| `websocket` | `WebSocketConfig` | `{ path?, maxPayloadSize?, upgradeWebSocket? }` (see below)
|
|
58
|
-
| `bodyLimit` | `number` | Max request body size in bytes (default 1 MiB)
|
|
59
|
-
| `sseHeartbeatMs` | `number` | How often SSE streams write a `: keep-alive` comment while a run is silent (default `5000`, `0` turns it off)
|
|
60
|
-
| `acceptContext` | `boolean \| string[]` | Keys of a run `context` clients may send: none by default, a list, or `true` for any (it
|
|
61
|
-
| `threadMessageRoles` | `ThreadMessageRole[]` | Roles `POST /threads/:id/messages` accepts (default `user` and `assistant`)
|
|
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` | `(c) => AuthContext \| undefined` (sync or async), receives the Hono Context, throw to answer `401 UNAUTHORIZED` |
|
|
54
|
+
| `enableSwagger` | `boolean` | Serve `/openapi.json` and Swagger UI at `/docs` |
|
|
55
|
+
| `swagger` | `SwaggerConfig` | Swagger configuration |
|
|
56
|
+
| `enableWebSocket` | `boolean` | Enable the WebSocket endpoint |
|
|
57
|
+
| `websocket` | `WebSocketConfig` | `{ path?, maxPayloadSize?, upgradeWebSocket? }` (see below) |
|
|
58
|
+
| `bodyLimit` | `number` | Max request body size in bytes (default 1 MiB) |
|
|
59
|
+
| `sseHeartbeatMs` | `number` | How often SSE streams write a `: keep-alive` comment while a run is silent (default `5000`, `0` turns it off) |
|
|
60
|
+
| `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) |
|
|
61
|
+
| `threadMessageRoles` | `ThreadMessageRole[]` | Roles `POST /threads/:id/messages` accepts (default `user` and `assistant`) |
|
|
62
62
|
|
|
63
63
|
## Request Handling
|
|
64
64
|
|
|
@@ -66,7 +66,7 @@ Creates a Hono sub-application with all Cogitator endpoints.
|
|
|
66
66
|
- The `usage` of a run answer carries `inputTokens`, `outputTokens` and `totalTokens`, plus `reasoningTokens`, `cachedInputTokens` and `cacheWriteTokens` when the model reported them, the same shape as every other adapter. The `finish` event of an agent stream carries the same `usage` (never the run's cost or duration).
|
|
67
67
|
- 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.
|
|
68
68
|
- Thread messages accept `role` of `user` or `assistant` (more with `threadMessageRoles`), `metadata` is stored with the entry and a token estimate is recorded.
|
|
69
|
-
- A run
|
|
69
|
+
- 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.
|
|
70
70
|
- 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.
|
|
71
71
|
- `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.
|
|
72
72
|
- 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/hono",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.17",
|
|
4
4
|
"description": "Hono server adapter for Cogitator AI runtime — works on Node.js, Bun, Deno, Cloudflare Workers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,21 +20,21 @@
|
|
|
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.50.0",
|
|
24
|
+
"@cogitator-ai/memory": "0.17.0",
|
|
25
|
+
"@cogitator-ai/types": "0.52.0",
|
|
26
|
+
"@cogitator-ai/server-shared": "0.5.17"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"hono": ">=4.0.0"
|
|
30
30
|
},
|
|
31
31
|
"optionalDependencies": {
|
|
32
|
-
"@cogitator-ai/workflows": "0.13.
|
|
33
|
-
"@cogitator-ai/swarms": "0.13.
|
|
32
|
+
"@cogitator-ai/workflows": "0.13.4",
|
|
33
|
+
"@cogitator-ai/swarms": "0.13.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@cogitator-ai/workflows": "0.13.
|
|
37
|
-
"@cogitator-ai/swarms": "0.13.
|
|
36
|
+
"@cogitator-ai/workflows": "0.13.4",
|
|
37
|
+
"@cogitator-ai/swarms": "0.13.4",
|
|
38
38
|
"@types/node": "^22.20.4",
|
|
39
39
|
"hono": "^4.13.12",
|
|
40
40
|
"typescript": "^6.0.3",
|