@cogitator-ai/tetsu 0.1.1 → 0.3.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 +85 -26
- package/dist/controller.d.ts +276 -7
- package/dist/controller.d.ts.map +1 -1
- package/dist/controller.js +119 -30
- package/dist/controller.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/operations.d.ts +14 -2
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +55 -2
- package/dist/operations.js.map +1 -1
- package/dist/schemas.d.ts +56 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +64 -8
- package/dist/schemas.js.map +1 -1
- package/dist/socket.d.ts +15 -0
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +28 -12
- package/dist/socket.js.map +1 -1
- package/dist/streaming.d.ts +17 -0
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js +44 -0
- package/dist/streaming.js.map +1 -1
- package/dist/types.d.ts +8 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -63,24 +63,26 @@ A Tetsu controller named `Cogitator`: `operationId`s in the OpenAPI document are
|
|
|
63
63
|
|
|
64
64
|
## Endpoints
|
|
65
65
|
|
|
66
|
-
| Method | Path
|
|
67
|
-
| -------- |
|
|
68
|
-
| `GET` | `/health`, `/ready`
|
|
69
|
-
| `GET` | `/agents`
|
|
70
|
-
| `POST` | `/agents/:name/run`
|
|
71
|
-
| `POST` | `/agents/:name/stream`
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `POST` | `/
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
66
|
+
| Method | Path | Description |
|
|
67
|
+
| -------- | ----------------------------- | --------------------------------------- |
|
|
68
|
+
| `GET` | `/health`, `/ready` | Liveness and readiness, without `auth` |
|
|
69
|
+
| `GET` | `/agents` | Agents with their description and tools |
|
|
70
|
+
| `POST` | `/agents/:name/run` | Run an agent and wait for the answer |
|
|
71
|
+
| `POST` | `/agents/:name/stream` | Run an agent over SSE |
|
|
72
|
+
| `POST` | `/agents/:name/resume` | Resume a run paused for approvals |
|
|
73
|
+
| `POST` | `/agents/:name/resume/stream` | Resume a paused run over SSE |
|
|
74
|
+
| `GET` | `/tools` | Tools of every agent, as JSON Schema |
|
|
75
|
+
| `GET` | `/threads/:id` | Messages of a memory thread |
|
|
76
|
+
| `POST` | `/threads/:id/messages` | Append a message |
|
|
77
|
+
| `DELETE` | `/threads/:id` | Delete a thread |
|
|
78
|
+
| `GET` | `/workflows` | Workflows with their nodes |
|
|
79
|
+
| `POST` | `/workflows/:name/run` | Run a workflow |
|
|
80
|
+
| `POST` | `/workflows/:name/stream` | Run a workflow over SSE |
|
|
81
|
+
| `GET` | `/swarms` | Swarms with their agents |
|
|
82
|
+
| `POST` | `/swarms/:name/run` | Run a swarm |
|
|
83
|
+
| `POST` | `/swarms/:name/stream` | Run a swarm over SSE |
|
|
84
|
+
| `GET` | `/swarms/:name/blackboard` | Configured blackboard sections |
|
|
85
|
+
| `GET` | `/ws` | WebSocket, when `websocket` is set |
|
|
84
86
|
|
|
85
87
|
Request bodies:
|
|
86
88
|
|
|
@@ -88,6 +90,13 @@ Request bodies:
|
|
|
88
90
|
// POST /agents/:name/run, /agents/:name/stream
|
|
89
91
|
{ input: string; context?: Record<string, unknown>; threadId?: string }
|
|
90
92
|
|
|
93
|
+
// POST /agents/:name/resume, /agents/:name/resume/stream
|
|
94
|
+
{
|
|
95
|
+
threadId: string;
|
|
96
|
+
decisions?: Record<string, { approved: boolean; reason?: string }>; // by tool call id
|
|
97
|
+
defaultDecision?: { approved: boolean; reason?: string };
|
|
98
|
+
}
|
|
99
|
+
|
|
91
100
|
// POST /swarms/:name/run, /swarms/:name/stream
|
|
92
101
|
{ input: string; context?: Record<string, unknown>; threadId?: string; timeout?: number }
|
|
93
102
|
|
|
@@ -109,9 +118,11 @@ Every error is answered in Tetsu's envelope:
|
|
|
109
118
|
| Status | `error` | When |
|
|
110
119
|
| ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
111
120
|
| 401 | `UNAUTHORIZED` | `auth` returned `undefined` |
|
|
121
|
+
| 403 | `THREAD_ACCESS_DENIED` | The thread belongs to another user |
|
|
112
122
|
| 403 | `THREAD_FORBIDDEN` | `authorizeThread` refused the thread |
|
|
113
123
|
| 404 | `AGENT_NOT_FOUND`, `WORKFLOW_NOT_FOUND`, `SWARM_NOT_FOUND` | No such name |
|
|
114
124
|
| 409 | `BLACKBOARD_DISABLED` | The swarm has no blackboard |
|
|
125
|
+
| 409 | `RUN_NOT_PAUSED` | A resume named a thread without a paused run |
|
|
115
126
|
| 422 | `VALIDATION_FAILED` | The body or the path failed its schema; `issues` lists every problem |
|
|
116
127
|
| 501 | `PACKAGE_NOT_INSTALLED` | `@cogitator-ai/workflows` or `@cogitator-ai/swarms` is missing |
|
|
117
128
|
| 503 | `MEMORY_NOT_CONFIGURED` | A thread endpoint was called on a runtime without memory |
|
|
@@ -142,7 +153,7 @@ cogitatorController({
|
|
|
142
153
|
});
|
|
143
154
|
```
|
|
144
155
|
|
|
145
|
-
The caller's `userId` is passed to every run, so
|
|
156
|
+
The caller's `userId` is passed to every run, so tools (`context.userId`) know who is asking, and runs and thread endpoints are scoped to the caller; see [Users and threads](#users-and-threads).
|
|
146
157
|
|
|
147
158
|
To have the OpenAPI document describe the scheme and the `401`, build the hook with `callerHook()` and wrap it in `secured()`. The same hook can guard your own routes, where the caller is `ctx.cogitatorAuth`:
|
|
148
159
|
|
|
@@ -175,7 +186,19 @@ createApp({
|
|
|
175
186
|
|
|
176
187
|
## Users and threads
|
|
177
188
|
|
|
178
|
-
|
|
189
|
+
### Multiple users
|
|
190
|
+
|
|
191
|
+
A thread belongs to the user whose run or message created it, recorded as its `userId`. Runs and the thread endpoints only let that user in: another user's `threadId` answers `403 THREAD_ACCESS_DENIED` and leaves the thread untouched. Callers without a `userId` share the threads that have no owner, and cannot open an owned one.
|
|
192
|
+
|
|
193
|
+
- `GET` and `DELETE /threads/:id` check the owner first; a thread that does not exist yet reads as empty.
|
|
194
|
+
- `POST /threads/:id/messages` creates a missing thread owned by the caller.
|
|
195
|
+
- A run or stream on another user's thread is refused before the model is called; a stream ends with an `error` event carrying `THREAD_ACCESS_DENIED`.
|
|
196
|
+
|
|
197
|
+
So whenever several people share a server, have `auth` return a `userId`.
|
|
198
|
+
|
|
199
|
+
### `authorizeThread`
|
|
200
|
+
|
|
201
|
+
On top of ownership, `authorizeThread` is checked on the thread endpoints and on every run, stream and WebSocket run that names a `threadId`, before the model is called:
|
|
179
202
|
|
|
180
203
|
```typescript
|
|
181
204
|
cogitatorController({
|
|
@@ -186,7 +209,40 @@ cogitatorController({
|
|
|
186
209
|
});
|
|
187
210
|
```
|
|
188
211
|
|
|
189
|
-
|
|
212
|
+
Use it for rules ownership does not express, such as thread ids your server hands out.
|
|
213
|
+
|
|
214
|
+
## Approvals
|
|
215
|
+
|
|
216
|
+
A tool with `requiresApproval` pauses the run before it executes. `POST /agents/:name/run` then answers with `status: 'paused'` and the calls waiting for a decision; the run's checkpoint stays on the server, stored by the runtime per thread:
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"output": "Let me refund that.",
|
|
221
|
+
"threadId": "thread_…",
|
|
222
|
+
"status": "paused",
|
|
223
|
+
"pendingApprovals": [
|
|
224
|
+
{
|
|
225
|
+
"toolCallId": "call_1",
|
|
226
|
+
"toolName": "refund",
|
|
227
|
+
"arguments": { "order": "A-1", "amount": 500 },
|
|
228
|
+
"description": "Refund an order",
|
|
229
|
+
"sideEffects": ["payment"]
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
"usage": { "inputTokens": 10, "outputTokens": 5, "totalTokens": 15 },
|
|
233
|
+
"toolCalls": []
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
A stream that pauses sends `{"type":"approval-required","threadId":"…","approvals":[…]}` right before `finish`. Continue with the decisions:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
curl -X POST localhost:3000/cogitator/agents/support/resume \
|
|
241
|
+
-H 'content-type: application/json' \
|
|
242
|
+
-d '{ "threadId": "thread_…", "decisions": { "call_1": { "approved": true } } }'
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Approved calls run, declined ones answer the model with the `reason`, and calls without a decision (and no `defaultDecision`) pause the run again. `/agents/:name/resume/stream` streams the rest of the run like `/stream`. Only the user the run belongs to can resume it (`403 THREAD_ACCESS_DENIED` otherwise; `authorizeThread` is checked too), and a thread without a paused run answers `409 RUN_NOT_PAUSED`. Over the WebSocket, send `{ type: 'resume', id?, payload: { name, threadId, decisions?, defaultDecision? } }`.
|
|
190
246
|
|
|
191
247
|
## Streaming
|
|
192
248
|
|
|
@@ -205,6 +261,8 @@ data: {"type":"finish","messageId":"msg_…","usage":{"inputTokens":12,"outputTo
|
|
|
205
261
|
data: [DONE]
|
|
206
262
|
```
|
|
207
263
|
|
|
264
|
+
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. `POST /agents/:name/run` returns the summary as `reasoning`, and `usage` gains `reasoningTokens`, `cachedInputTokens` and `cacheWriteTokens` when the provider reports them.
|
|
265
|
+
|
|
208
266
|
A run that fails ends with `{"type":"error","message":"…","code":"…"}` instead of `finish`. An unexpected failure is also reported to the application's `reportError` with `source: "stream"`. Workflow streams send `workflow` events (`node_started`, `node_completed`, `node_error`, `node_progress`, `workflow_completed`), swarm streams send `swarm` events (`agent_start`, `agent_complete`, `agent_error`, `message`, `swarm_completed`).
|
|
209
267
|
|
|
210
268
|
Validation, `401`, `403` and `404` are answered as JSON before the stream opens.
|
|
@@ -217,11 +275,12 @@ cogitatorController({ cogitator, agents, auth, websocket: true });
|
|
|
217
275
|
|
|
218
276
|
The handshake runs `auth` like any route. Each socket runs one agent, workflow or swarm at a time.
|
|
219
277
|
|
|
220
|
-
| Client sends | Server answers
|
|
221
|
-
| ------------------------------------------------------------------------------------------------------------- |
|
|
222
|
-
| `{ type: 'run', id?, payload: { type: 'agent' \| 'workflow' \| 'swarm', name, input, context?, threadId? } }` | `event` frames: `token`, `tool-call`, `tool-result`, then `complete` with the result, or `cancelled` |
|
|
223
|
-
| `{ type: '
|
|
224
|
-
| `{ type: '
|
|
278
|
+
| Client sends | Server answers |
|
|
279
|
+
| ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
280
|
+
| `{ type: 'run', id?, payload: { type: 'agent' \| 'workflow' \| 'swarm', name, input, context?, threadId? } }` | `event` frames: `token`, `reasoning`, `tool-call`, `tool-result`, then `complete` with the result, or `cancelled` |
|
|
281
|
+
| `{ type: 'resume', id?, payload: { name, threadId, decisions?, defaultDecision? } }` | the same frames for an agent run paused for [approvals](#approvals) |
|
|
282
|
+
| `{ type: 'stop' }` | cancels the current run |
|
|
283
|
+
| `{ type: 'ping', id? }` | `{ type: 'pong', id }` |
|
|
225
284
|
|
|
226
285
|
Errors arrive as `{ type: 'error', id, error, code }` and leave the socket open; an invalid frame gets `code: 'INVALID_MESSAGE'`. Closing the socket cancels its run. Bun's server-level options such as `maxPayloadLength` are set where the app is served:
|
|
227
286
|
|
package/dist/controller.d.ts
CHANGED
|
@@ -40,6 +40,21 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
40
40
|
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
41
41
|
threadId: z.ZodOptional<z.ZodString>;
|
|
42
42
|
}, z.core.$strip>;
|
|
43
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
44
|
+
type: z.ZodLiteral<"resume">;
|
|
45
|
+
id: z.ZodOptional<z.ZodString>;
|
|
46
|
+
payload: z.ZodObject<{
|
|
47
|
+
threadId: z.ZodString;
|
|
48
|
+
decisions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
49
|
+
approved: z.ZodBoolean;
|
|
50
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>>>;
|
|
52
|
+
defaultDecision: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
approved: z.ZodBoolean;
|
|
54
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
}, z.core.$strip>;
|
|
43
58
|
}, z.core.$strip>], "type">;
|
|
44
59
|
}, {
|
|
45
60
|
readonly beforeParse: readonly [import("@tetsujs/core").Hook<"beforeParse", import("@tetsujs/core").BaseCtx & {
|
|
@@ -116,17 +131,34 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
116
131
|
inputTokens: z.ZodNumber;
|
|
117
132
|
outputTokens: z.ZodNumber;
|
|
118
133
|
totalTokens: z.ZodNumber;
|
|
134
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
cachedInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
|
|
119
137
|
}, z.core.$strip>;
|
|
120
138
|
toolCalls: z.ZodArray<z.ZodObject<{
|
|
121
139
|
id: z.ZodString;
|
|
122
140
|
name: z.ZodString;
|
|
123
141
|
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
124
142
|
}, z.core.$strip>>;
|
|
143
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
144
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
145
|
+
completed: "completed";
|
|
146
|
+
paused: "paused";
|
|
147
|
+
}>>;
|
|
148
|
+
pendingApprovals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
149
|
+
toolCallId: z.ZodString;
|
|
150
|
+
toolName: z.ZodString;
|
|
151
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
152
|
+
description: z.ZodString;
|
|
153
|
+
sideEffects: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
154
|
+
}, z.core.$strip>>>;
|
|
125
155
|
}, z.core.$strip>;
|
|
126
156
|
readonly 403: z.ZodObject<{
|
|
127
157
|
status: z.ZodNumber;
|
|
128
158
|
message: z.ZodString;
|
|
129
|
-
error: z.
|
|
159
|
+
error: z.ZodEnum<{
|
|
160
|
+
[x: string]: string;
|
|
161
|
+
}>;
|
|
130
162
|
}, z.core.$strip>;
|
|
131
163
|
readonly 404: z.ZodObject<{
|
|
132
164
|
status: z.ZodNumber;
|
|
@@ -208,6 +240,9 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
208
240
|
inputTokens: number;
|
|
209
241
|
outputTokens: number;
|
|
210
242
|
totalTokens: number;
|
|
243
|
+
reasoningTokens?: number | undefined;
|
|
244
|
+
cachedInputTokens?: number | undefined;
|
|
245
|
+
cacheWriteTokens?: number | undefined;
|
|
211
246
|
};
|
|
212
247
|
toolCalls: {
|
|
213
248
|
id: string;
|
|
@@ -215,6 +250,15 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
215
250
|
arguments: Record<string, unknown>;
|
|
216
251
|
}[];
|
|
217
252
|
structured?: unknown;
|
|
253
|
+
reasoning?: string | undefined;
|
|
254
|
+
status?: "completed" | "paused" | undefined;
|
|
255
|
+
pendingApprovals?: {
|
|
256
|
+
toolCallId: string;
|
|
257
|
+
toolName: string;
|
|
258
|
+
arguments: Record<string, unknown>;
|
|
259
|
+
description: string;
|
|
260
|
+
sideEffects?: string[] | undefined;
|
|
261
|
+
}[] | undefined;
|
|
218
262
|
}>, false>;
|
|
219
263
|
streamAgent: import("@tetsujs/core").RouteDef<"/agents/:name/stream", {
|
|
220
264
|
readonly params: z.ZodObject<{
|
|
@@ -229,7 +273,201 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
229
273
|
readonly 403: z.ZodObject<{
|
|
230
274
|
status: z.ZodNumber;
|
|
231
275
|
message: z.ZodString;
|
|
232
|
-
error: z.
|
|
276
|
+
error: z.ZodEnum<{
|
|
277
|
+
[x: string]: string;
|
|
278
|
+
}>;
|
|
279
|
+
}, z.core.$strip>;
|
|
280
|
+
readonly 404: z.ZodObject<{
|
|
281
|
+
status: z.ZodNumber;
|
|
282
|
+
message: z.ZodString;
|
|
283
|
+
error: z.ZodLiteral<"AGENT_NOT_FOUND">;
|
|
284
|
+
}, z.core.$strip>;
|
|
285
|
+
};
|
|
286
|
+
}, {
|
|
287
|
+
readonly beforeParse: readonly [import("@tetsujs/core").Hook<"beforeParse", import("@tetsujs/core").BaseCtx & {
|
|
288
|
+
readonly params: {
|
|
289
|
+
[x: string]: string;
|
|
290
|
+
};
|
|
291
|
+
}, Pick<import("./auth.js").CallerFields, "cogitatorAuth">>];
|
|
292
|
+
readonly onError: readonly [import("@tetsujs/core").Hook<"onError", import("@tetsujs/core").BaseCtx & {
|
|
293
|
+
readonly error: unknown;
|
|
294
|
+
}, unknown>];
|
|
295
|
+
}, undefined, "POST", Promise<Response>, false>;
|
|
296
|
+
resumeAgent: import("@tetsujs/core").RouteDef<"/agents/:name/resume", {
|
|
297
|
+
readonly params: z.ZodObject<{
|
|
298
|
+
name: z.ZodString;
|
|
299
|
+
}, z.core.$strip>;
|
|
300
|
+
readonly body: z.ZodObject<{
|
|
301
|
+
threadId: z.ZodString;
|
|
302
|
+
decisions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
303
|
+
approved: z.ZodBoolean;
|
|
304
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
305
|
+
}, z.core.$strip>>>;
|
|
306
|
+
defaultDecision: z.ZodOptional<z.ZodObject<{
|
|
307
|
+
approved: z.ZodBoolean;
|
|
308
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
309
|
+
}, z.core.$strip>>;
|
|
310
|
+
}, z.core.$strip>;
|
|
311
|
+
readonly response: {
|
|
312
|
+
readonly 200: z.ZodObject<{
|
|
313
|
+
output: z.ZodString;
|
|
314
|
+
structured: z.ZodOptional<z.ZodUnknown>;
|
|
315
|
+
threadId: z.ZodString;
|
|
316
|
+
usage: z.ZodObject<{
|
|
317
|
+
inputTokens: z.ZodNumber;
|
|
318
|
+
outputTokens: z.ZodNumber;
|
|
319
|
+
totalTokens: z.ZodNumber;
|
|
320
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
321
|
+
cachedInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
322
|
+
cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
|
|
323
|
+
}, z.core.$strip>;
|
|
324
|
+
toolCalls: z.ZodArray<z.ZodObject<{
|
|
325
|
+
id: z.ZodString;
|
|
326
|
+
name: z.ZodString;
|
|
327
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
328
|
+
}, z.core.$strip>>;
|
|
329
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
330
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
331
|
+
completed: "completed";
|
|
332
|
+
paused: "paused";
|
|
333
|
+
}>>;
|
|
334
|
+
pendingApprovals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
335
|
+
toolCallId: z.ZodString;
|
|
336
|
+
toolName: z.ZodString;
|
|
337
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
338
|
+
description: z.ZodString;
|
|
339
|
+
sideEffects: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
340
|
+
}, z.core.$strip>>>;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
readonly 403: z.ZodObject<{
|
|
343
|
+
status: z.ZodNumber;
|
|
344
|
+
message: z.ZodString;
|
|
345
|
+
error: z.ZodEnum<{
|
|
346
|
+
[x: string]: string;
|
|
347
|
+
}>;
|
|
348
|
+
}, z.core.$strip>;
|
|
349
|
+
readonly 404: z.ZodObject<{
|
|
350
|
+
status: z.ZodNumber;
|
|
351
|
+
message: z.ZodString;
|
|
352
|
+
error: z.ZodEnum<{
|
|
353
|
+
[x: string]: string;
|
|
354
|
+
}>;
|
|
355
|
+
}, z.core.$strip>;
|
|
356
|
+
readonly 409: z.ZodObject<{
|
|
357
|
+
status: z.ZodNumber;
|
|
358
|
+
message: z.ZodString;
|
|
359
|
+
error: z.ZodEnum<{
|
|
360
|
+
[x: string]: string;
|
|
361
|
+
}>;
|
|
362
|
+
}, z.core.$strip>;
|
|
363
|
+
readonly 400: z.ZodObject<{
|
|
364
|
+
status: z.ZodNumber;
|
|
365
|
+
message: z.ZodString;
|
|
366
|
+
error: z.ZodEnum<{
|
|
367
|
+
[x: string]: string;
|
|
368
|
+
}>;
|
|
369
|
+
}, z.core.$strip>;
|
|
370
|
+
readonly 429: z.ZodObject<{
|
|
371
|
+
status: z.ZodNumber;
|
|
372
|
+
message: z.ZodString;
|
|
373
|
+
error: z.ZodEnum<{
|
|
374
|
+
[x: string]: string;
|
|
375
|
+
}>;
|
|
376
|
+
}, z.core.$strip>;
|
|
377
|
+
readonly 500: z.ZodObject<{
|
|
378
|
+
status: z.ZodNumber;
|
|
379
|
+
message: z.ZodString;
|
|
380
|
+
error: z.ZodEnum<{
|
|
381
|
+
[x: string]: string;
|
|
382
|
+
}>;
|
|
383
|
+
}, z.core.$strip>;
|
|
384
|
+
readonly 502: z.ZodObject<{
|
|
385
|
+
status: z.ZodNumber;
|
|
386
|
+
message: z.ZodString;
|
|
387
|
+
error: z.ZodEnum<{
|
|
388
|
+
[x: string]: string;
|
|
389
|
+
}>;
|
|
390
|
+
}, z.core.$strip>;
|
|
391
|
+
readonly 503: z.ZodObject<{
|
|
392
|
+
status: z.ZodNumber;
|
|
393
|
+
message: z.ZodString;
|
|
394
|
+
error: z.ZodEnum<{
|
|
395
|
+
[x: string]: string;
|
|
396
|
+
}>;
|
|
397
|
+
}, z.core.$strip>;
|
|
398
|
+
readonly 504: z.ZodObject<{
|
|
399
|
+
status: z.ZodNumber;
|
|
400
|
+
message: z.ZodString;
|
|
401
|
+
error: z.ZodEnum<{
|
|
402
|
+
[x: string]: string;
|
|
403
|
+
}>;
|
|
404
|
+
}, z.core.$strip>;
|
|
405
|
+
readonly 507: z.ZodObject<{
|
|
406
|
+
status: z.ZodNumber;
|
|
407
|
+
message: z.ZodString;
|
|
408
|
+
error: z.ZodEnum<{
|
|
409
|
+
[x: string]: string;
|
|
410
|
+
}>;
|
|
411
|
+
}, z.core.$strip>;
|
|
412
|
+
};
|
|
413
|
+
}, {
|
|
414
|
+
readonly beforeParse: readonly [import("@tetsujs/core").Hook<"beforeParse", import("@tetsujs/core").BaseCtx & {
|
|
415
|
+
readonly params: {
|
|
416
|
+
[x: string]: string;
|
|
417
|
+
};
|
|
418
|
+
}, Pick<import("./auth.js").CallerFields, "cogitatorAuth">>];
|
|
419
|
+
readonly onError: readonly [import("@tetsujs/core").Hook<"onError", import("@tetsujs/core").BaseCtx & {
|
|
420
|
+
readonly error: unknown;
|
|
421
|
+
}, unknown>];
|
|
422
|
+
}, undefined, "POST", Promise<{
|
|
423
|
+
output: string;
|
|
424
|
+
threadId: string;
|
|
425
|
+
usage: {
|
|
426
|
+
inputTokens: number;
|
|
427
|
+
outputTokens: number;
|
|
428
|
+
totalTokens: number;
|
|
429
|
+
reasoningTokens?: number | undefined;
|
|
430
|
+
cachedInputTokens?: number | undefined;
|
|
431
|
+
cacheWriteTokens?: number | undefined;
|
|
432
|
+
};
|
|
433
|
+
toolCalls: {
|
|
434
|
+
id: string;
|
|
435
|
+
name: string;
|
|
436
|
+
arguments: Record<string, unknown>;
|
|
437
|
+
}[];
|
|
438
|
+
structured?: unknown;
|
|
439
|
+
reasoning?: string | undefined;
|
|
440
|
+
status?: "completed" | "paused" | undefined;
|
|
441
|
+
pendingApprovals?: {
|
|
442
|
+
toolCallId: string;
|
|
443
|
+
toolName: string;
|
|
444
|
+
arguments: Record<string, unknown>;
|
|
445
|
+
description: string;
|
|
446
|
+
sideEffects?: string[] | undefined;
|
|
447
|
+
}[] | undefined;
|
|
448
|
+
}>, false>;
|
|
449
|
+
streamResumeAgent: import("@tetsujs/core").RouteDef<"/agents/:name/resume/stream", {
|
|
450
|
+
readonly params: z.ZodObject<{
|
|
451
|
+
name: z.ZodString;
|
|
452
|
+
}, z.core.$strip>;
|
|
453
|
+
readonly body: z.ZodObject<{
|
|
454
|
+
threadId: z.ZodString;
|
|
455
|
+
decisions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
456
|
+
approved: z.ZodBoolean;
|
|
457
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
458
|
+
}, z.core.$strip>>>;
|
|
459
|
+
defaultDecision: z.ZodOptional<z.ZodObject<{
|
|
460
|
+
approved: z.ZodBoolean;
|
|
461
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
462
|
+
}, z.core.$strip>>;
|
|
463
|
+
}, z.core.$strip>;
|
|
464
|
+
readonly response: {
|
|
465
|
+
readonly 403: z.ZodObject<{
|
|
466
|
+
status: z.ZodNumber;
|
|
467
|
+
message: z.ZodString;
|
|
468
|
+
error: z.ZodEnum<{
|
|
469
|
+
[x: string]: string;
|
|
470
|
+
}>;
|
|
233
471
|
}, z.core.$strip>;
|
|
234
472
|
readonly 404: z.ZodObject<{
|
|
235
473
|
status: z.ZodNumber;
|
|
@@ -295,7 +533,16 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
295
533
|
readonly 403: z.ZodObject<{
|
|
296
534
|
status: z.ZodNumber;
|
|
297
535
|
message: z.ZodString;
|
|
298
|
-
error: z.
|
|
536
|
+
error: z.ZodEnum<{
|
|
537
|
+
[x: string]: string;
|
|
538
|
+
}>;
|
|
539
|
+
}, z.core.$strip>;
|
|
540
|
+
readonly 500: z.ZodObject<{
|
|
541
|
+
status: z.ZodNumber;
|
|
542
|
+
message: z.ZodString;
|
|
543
|
+
error: z.ZodEnum<{
|
|
544
|
+
[x: string]: string;
|
|
545
|
+
}>;
|
|
299
546
|
}, z.core.$strip>;
|
|
300
547
|
readonly 503: z.ZodObject<{
|
|
301
548
|
status: z.ZodNumber;
|
|
@@ -338,7 +585,16 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
338
585
|
readonly 403: z.ZodObject<{
|
|
339
586
|
status: z.ZodNumber;
|
|
340
587
|
message: z.ZodString;
|
|
341
|
-
error: z.
|
|
588
|
+
error: z.ZodEnum<{
|
|
589
|
+
[x: string]: string;
|
|
590
|
+
}>;
|
|
591
|
+
}, z.core.$strip>;
|
|
592
|
+
readonly 500: z.ZodObject<{
|
|
593
|
+
status: z.ZodNumber;
|
|
594
|
+
message: z.ZodString;
|
|
595
|
+
error: z.ZodEnum<{
|
|
596
|
+
[x: string]: string;
|
|
597
|
+
}>;
|
|
342
598
|
}, z.core.$strip>;
|
|
343
599
|
readonly 503: z.ZodObject<{
|
|
344
600
|
status: z.ZodNumber;
|
|
@@ -367,7 +623,16 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
367
623
|
readonly 403: z.ZodObject<{
|
|
368
624
|
status: z.ZodNumber;
|
|
369
625
|
message: z.ZodString;
|
|
370
|
-
error: z.
|
|
626
|
+
error: z.ZodEnum<{
|
|
627
|
+
[x: string]: string;
|
|
628
|
+
}>;
|
|
629
|
+
}, z.core.$strip>;
|
|
630
|
+
readonly 500: z.ZodObject<{
|
|
631
|
+
status: z.ZodNumber;
|
|
632
|
+
message: z.ZodString;
|
|
633
|
+
error: z.ZodEnum<{
|
|
634
|
+
[x: string]: string;
|
|
635
|
+
}>;
|
|
371
636
|
}, z.core.$strip>;
|
|
372
637
|
readonly 503: z.ZodObject<{
|
|
373
638
|
status: z.ZodNumber;
|
|
@@ -634,7 +899,9 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
634
899
|
readonly 403: z.ZodObject<{
|
|
635
900
|
status: z.ZodNumber;
|
|
636
901
|
message: z.ZodString;
|
|
637
|
-
error: z.
|
|
902
|
+
error: z.ZodEnum<{
|
|
903
|
+
[x: string]: string;
|
|
904
|
+
}>;
|
|
638
905
|
}, z.core.$strip>;
|
|
639
906
|
readonly 404: z.ZodObject<{
|
|
640
907
|
status: z.ZodNumber;
|
|
@@ -751,7 +1018,9 @@ export declare const cogitatorController: (deps: CogitatorDeps) => {
|
|
|
751
1018
|
readonly 403: z.ZodObject<{
|
|
752
1019
|
status: z.ZodNumber;
|
|
753
1020
|
message: z.ZodString;
|
|
754
|
-
error: z.
|
|
1021
|
+
error: z.ZodEnum<{
|
|
1022
|
+
[x: string]: string;
|
|
1023
|
+
}>;
|
|
755
1024
|
}, z.core.$strip>;
|
|
756
1025
|
readonly 404: z.ZodObject<{
|
|
757
1026
|
status: z.ZodNumber;
|
package/dist/controller.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmD7B,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,YAAY,CAAC;AA0D7D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8b9B,CAAC"}
|