@cogitator-ai/tetsu 0.6.0 → 0.6.1

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.
Files changed (2) hide show
  1. package/README.md +12 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -329,6 +329,8 @@ data: {"type":"finish","messageId":"msg_…","usage":{"inputTokens":12,"outputTo
329
329
  data: [DONE]
330
330
  ```
331
331
 
332
+ Each event matches `StreamEventSchema` from `@cogitator-ai/server-shared`, which a client can parse events with (see [OpenAPI](#openapi) for the event schemas in the document).
333
+
332
334
  `start` names the run's thread: the `threadId` of the request, or the thread the controller opened for it, so a client that sent none continues the conversation with this one even if the stream breaks. `finish` repeats it with `status` and the other outcome fields of the JSON answer.
333
335
 
334
336
  An agent with `reasoning: { summary: true }` also streams its reasoning summary as `reasoning-start`, `reasoning-delta` and `reasoning-end` events. A text or reasoning part opens with its first delta and is closed before a part of the other kind, a tool call or `finish`, so parts never overlap and text after a tool call starts a new part. An answer the model gave in one piece arrives as one text part before `finish`, and a resumed run that pauses again sends `approval-required` before `finish`. `POST /agents/:name/run` returns the summary as `reasoning`, and `usage` gains `reasoningTokens`, `cachedInputTokens` and `cacheWriteTokens` when the provider reports them. The `finish` event of an agent stream carries the same `usage` as the JSON answer, these counts included.
@@ -376,7 +378,16 @@ shutdown = onShutdownSignals(server);
376
378
 
377
379
  ## OpenAPI
378
380
 
379
- Request and response schemas are Zod, so `docs()` and `openapi()` from `@tetsujs/openapi` describe every route, the run failures a `CogitatorError` can produce, the thread page query, the `limits` as field defaults, and the schemes of a `secured()` caller hook. SSE and WebSocket endpoints are documented by their description only, since OpenAPI cannot describe what follows the headers.
381
+ Request and response schemas are Zod, so `docs()` and `openapi()` from `@tetsujs/openapi` describe every route, the run failures a `CogitatorError` can produce, the thread page query, the `limits` as field defaults, and the schemes of a `secured()` caller hook. `@tetsujs/openapi` has no way yet to give a route a `text/event-stream` body, so the SSE endpoints come out with a description and no body schema, and the WebSocket endpoint with its description only. To have the stream events in the document, build it with `openapi()` and pass it through `documentStreamEvents` from `@cogitator-ai/server-shared`, which adds the `StreamEvent` components and gives every `/stream` route that body:
382
+
383
+ ```ts
384
+ import { openapi } from '@tetsujs/openapi';
385
+ import { documentStreamEvents } from '@cogitator-ai/server-shared';
386
+
387
+ const document = documentStreamEvents(openapi(app, { info }).document);
388
+ ```
389
+
390
+ `docs()` builds its document itself and takes no transform, so the document it serves leaves the stream bodies out.
380
391
 
381
392
  The request and response schemas (`RunBody`, `ResumeBody`, `AgentRunResponse`, `SocketMessage`, …) and their TypeScript types (`AgentRunRequest`, `AgentRunResponseBody`, `WebSocketClientMessage`, …) are exported for clients and your own routes, along with `ThreadQuery`, the error helpers `cogitatorErrorResponse()`, `cogitatorErrorStatus()` and `describeError()`, and the `RunLimits` and `AnonymousPolicy` types.
382
393
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cogitator-ai/tetsu",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Tetsu server adapter for Cogitator AI runtime — a controller with agents, threads, workflows, swarms, SSE and WebSocket on Bun",
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,7 +23,7 @@
23
23
  "@cogitator-ai/core": "0.56.4",
24
24
  "@cogitator-ai/memory": "0.24.3",
25
25
  "@cogitator-ai/types": "0.61.0",
26
- "@cogitator-ai/server-shared": "0.7.0",
26
+ "@cogitator-ai/server-shared": "0.8.0",
27
27
  "zod": "^4.6.5"
28
28
  },
29
29
  "peerDependencies": {