@cogitator-ai/tetsu 0.5.26 → 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.
- package/README.md +108 -49
- package/dist/auth.d.ts +8 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +14 -0
- package/dist/auth.js.map +1 -1
- package/dist/controller.d.ts +33 -30
- package/dist/controller.d.ts.map +1 -1
- package/dist/controller.js +56 -39
- package/dist/controller.js.map +1 -1
- package/dist/errors.d.ts +11 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +27 -20
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/operations.d.ts +18 -6
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +27 -14
- package/dist/operations.js.map +1 -1
- package/dist/schemas.d.ts +23 -3
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +70 -19
- package/dist/schemas.js.map +1 -1
- package/dist/socket.d.ts +15 -6
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +29 -15
- package/dist/socket.js.map +1 -1
- package/dist/types.d.ts +30 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CallerHook } from './auth.js';
|
|
|
3
3
|
import type { z } from 'zod';
|
|
4
4
|
import type { Agent, Cogitator } from '@cogitator-ai/core';
|
|
5
5
|
import type { SwarmConfig, Workflow, WorkflowState } from '@cogitator-ai/types';
|
|
6
|
-
import type { ContextPolicy, ThreadMessageRole } from '@cogitator-ai/server-shared';
|
|
6
|
+
import type { AnonymousPolicy, AuthorizeThread as SharedAuthorizeThread, ContextPolicy, RunLimits, ThreadMessageRole } from '@cogitator-ai/server-shared';
|
|
7
7
|
import type { AddMessageBody, AgentListResponse, AgentRunResponse, BlackboardResponse, HealthResponse, ResumeBody, RunBody, SocketMessage, SwarmListResponse, SwarmRunBody, SwarmRunResponse, ThreadResponse, ToolListResponse, WorkflowListResponse, WorkflowRunBody, WorkflowRunResponse } from './schemas.js';
|
|
8
8
|
/**
|
|
9
9
|
* Who is calling, as the `auth` function established it.
|
|
@@ -25,7 +25,8 @@ export interface AuthContext {
|
|
|
25
25
|
* Return the caller to let the request through, or `undefined` to refuse it
|
|
26
26
|
* with `401 UNAUTHORIZED`; any other error it throws or rejects with (an expired
|
|
27
27
|
* token, say) refuses it with `401` too. Throw an `HttpError` to answer with
|
|
28
|
-
* another status. Return an empty object to accept anonymous callers
|
|
28
|
+
* another status. Return an empty object to accept anonymous callers, unless
|
|
29
|
+
* `anonymous` is `'deny'`.
|
|
29
30
|
*/
|
|
30
31
|
export type Authenticate = (ctx: BaseCtx) => AuthContext | undefined | Promise<AuthContext | undefined>;
|
|
31
32
|
/**
|
|
@@ -35,7 +36,12 @@ export type Authenticate = (ctx: BaseCtx) => AuthContext | undefined | Promise<A
|
|
|
35
36
|
* Checked on the thread routes and on every run, stream and WebSocket run
|
|
36
37
|
* that names a `threadId`. A refusal answers `403 THREAD_FORBIDDEN`.
|
|
37
38
|
*/
|
|
38
|
-
export type AuthorizeThread =
|
|
39
|
+
export type AuthorizeThread = SharedAuthorizeThread<AuthContext>;
|
|
40
|
+
/**
|
|
41
|
+
* Builds the `deps` of the agent runs and resumes of a request, which tools get as
|
|
42
|
+
* `context.deps` and the model never sees: a database handle, a tenant, a client.
|
|
43
|
+
*/
|
|
44
|
+
export type DepsBuilder = (ctx: BaseCtx) => unknown | Promise<unknown>;
|
|
39
45
|
/**
|
|
40
46
|
* A signal that ends open SSE streams and WebSocket connections, such as
|
|
41
47
|
* `draining` from `@tetsujs/lifecycle`, or a function that returns it.
|
|
@@ -57,7 +63,28 @@ export interface CogitatorDeps {
|
|
|
57
63
|
* `secured()` from `@tetsujs/openapi` to document it.
|
|
58
64
|
*/
|
|
59
65
|
auth?: Authenticate | CallerHook;
|
|
66
|
+
/**
|
|
67
|
+
* Whether a caller without a `userId` may use the API: `'allow'` (the default) lets them
|
|
68
|
+
* in, `'deny'` answers `401 UNAUTHORIZED`, on every route but `/health` and `/ready` and on
|
|
69
|
+
* the WebSocket handshake. It covers callers `auth` returned `{}` for and, without `auth`,
|
|
70
|
+
* every caller. `auth` returning `undefined` answers `401` under either policy.
|
|
71
|
+
*/
|
|
72
|
+
anonymous?: AnonymousPolicy;
|
|
60
73
|
authorizeThread?: AuthorizeThread;
|
|
74
|
+
/**
|
|
75
|
+
* Caps on what a request may ask a run for. A swarm run times out after at most
|
|
76
|
+
* `swarmTimeout` ms and a workflow run takes at most `workflowMaxIterations` iterations and
|
|
77
|
+
* `workflowMaxConcurrency` nodes at once, over HTTP, SSE and WebSocket alike. A request that
|
|
78
|
+
* asks for more is held to the cap, one that asks for nothing gets it. Each limit must be a
|
|
79
|
+
* positive integer, or building the controller throws.
|
|
80
|
+
*/
|
|
81
|
+
limits?: RunLimits;
|
|
82
|
+
/**
|
|
83
|
+
* Builds the `deps` of the agent runs and resumes of a request (`RunOptions.deps`). Called
|
|
84
|
+
* for each HTTP run with its request context, and once for a WebSocket connection with its
|
|
85
|
+
* handshake, whose runs all get what it built. Deps never come from the request body.
|
|
86
|
+
*/
|
|
87
|
+
deps?: DepsBuilder;
|
|
61
88
|
/** Serve the WebSocket endpoint. Default: `false`. */
|
|
62
89
|
websocket?: boolean | WebSocketOptions;
|
|
63
90
|
/** Ends streams and sockets when the server starts draining. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,K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,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACzE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEnE,mDAAmD;AACnD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogitator-ai/tetsu",
|
|
3
|
-
"version": "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": {
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"bun": ">=1.4"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@cogitator-ai/core": "0.56.
|
|
24
|
-
"@cogitator-ai/memory": "0.24.
|
|
23
|
+
"@cogitator-ai/core": "0.56.4",
|
|
24
|
+
"@cogitator-ai/memory": "0.24.3",
|
|
25
25
|
"@cogitator-ai/types": "0.61.0",
|
|
26
|
-
"@cogitator-ai/server-shared": "0.
|
|
26
|
+
"@cogitator-ai/server-shared": "0.8.0",
|
|
27
27
|
"zod": "^4.6.5"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"@tetsujs/sse": "^0.6.1"
|
|
32
32
|
},
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"@cogitator-ai/workflows": "0.14.
|
|
35
|
-
"@cogitator-ai/swarms": "0.14.
|
|
34
|
+
"@cogitator-ai/workflows": "0.14.2",
|
|
35
|
+
"@cogitator-ai/swarms": "0.14.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@cogitator-ai/workflows": "0.14.
|
|
39
|
-
"@cogitator-ai/swarms": "0.14.
|
|
38
|
+
"@cogitator-ai/workflows": "0.14.2",
|
|
39
|
+
"@cogitator-ai/swarms": "0.14.1",
|
|
40
40
|
"@tetsujs/core": "^0.6.1",
|
|
41
41
|
"@tetsujs/openapi": "^0.6.1",
|
|
42
42
|
"@tetsujs/sse": "^0.6.1",
|