@cogitator-ai/fastify 0.1.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/LICENSE +21 -0
- package/README.md +380 -0
- package/dist/hooks/auth.d.ts +4 -0
- package/dist/hooks/auth.d.ts.map +1 -0
- package/dist/hooks/auth.js +23 -0
- package/dist/hooks/auth.js.map +1 -0
- package/dist/hooks/error-handler.d.ts +3 -0
- package/dist/hooks/error-handler.d.ts.map +1 -0
- package/dist/hooks/error-handler.js +24 -0
- package/dist/hooks/error-handler.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +90 -0
- package/dist/plugin.js.map +1 -0
- package/dist/routes/agents.d.ts +3 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/agents.js +125 -0
- package/dist/routes/agents.js.map +1 -0
- package/dist/routes/health.d.ts +3 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/health.js +15 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/index.d.ts +7 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +7 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/swarms.d.ts +3 -0
- package/dist/routes/swarms.d.ts.map +1 -0
- package/dist/routes/swarms.js +193 -0
- package/dist/routes/swarms.js.map +1 -0
- package/dist/routes/threads.d.ts +3 -0
- package/dist/routes/threads.d.ts.map +1 -0
- package/dist/routes/threads.js +122 -0
- package/dist/routes/threads.js.map +1 -0
- package/dist/routes/tools.d.ts +3 -0
- package/dist/routes/tools.d.ts.map +1 -0
- package/dist/routes/tools.js +26 -0
- package/dist/routes/tools.js.map +1 -0
- package/dist/routes/workflows.d.ts +3 -0
- package/dist/routes/workflows.d.ts.map +1 -0
- package/dist/routes/workflows.js +120 -0
- package/dist/routes/workflows.js.map +1 -0
- package/dist/streaming/fastify-stream-writer.d.ts +24 -0
- package/dist/streaming/fastify-stream-writer.d.ts.map +1 -0
- package/dist/streaming/fastify-stream-writer.js +75 -0
- package/dist/streaming/fastify-stream-writer.js.map +1 -0
- package/dist/streaming/helpers.d.ts +2 -0
- package/dist/streaming/helpers.d.ts.map +1 -0
- package/dist/streaming/helpers.js +2 -0
- package/dist/streaming/helpers.js.map +1 -0
- package/dist/streaming/index.d.ts +4 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +4 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/protocol.d.ts +3 -0
- package/dist/streaming/protocol.d.ts.map +1 -0
- package/dist/streaming/protocol.js +2 -0
- package/dist/streaming/protocol.js.map +1 -0
- package/dist/types.d.ts +344 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +59 -0
- package/dist/types.js.map +1 -0
- package/dist/websocket/handler.d.ts +7 -0
- package/dist/websocket/handler.d.ts.map +1 -0
- package/dist/websocket/handler.js +132 -0
- package/dist/websocket/handler.js.map +1 -0
- package/package.json +70 -0
package/dist/types.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const AgentRunRequestSchema = {
|
|
2
|
+
type: 'object',
|
|
3
|
+
properties: {
|
|
4
|
+
input: { type: 'string' },
|
|
5
|
+
context: { type: 'object', additionalProperties: true },
|
|
6
|
+
threadId: { type: 'string' },
|
|
7
|
+
},
|
|
8
|
+
required: ['input'],
|
|
9
|
+
};
|
|
10
|
+
export const AgentRunResponseSchema = {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
output: { type: 'string' },
|
|
14
|
+
threadId: { type: 'string' },
|
|
15
|
+
usage: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
inputTokens: { type: 'number' },
|
|
19
|
+
outputTokens: { type: 'number' },
|
|
20
|
+
totalTokens: { type: 'number' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
toolCalls: { type: 'array' },
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const AddMessageRequestSchema = {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
role: { type: 'string', enum: ['user', 'assistant', 'system'] },
|
|
30
|
+
content: { type: 'string' },
|
|
31
|
+
metadata: { type: 'object', additionalProperties: true },
|
|
32
|
+
},
|
|
33
|
+
required: ['role', 'content'],
|
|
34
|
+
};
|
|
35
|
+
export const WorkflowRunRequestSchema = {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
input: { type: 'object', additionalProperties: true },
|
|
39
|
+
options: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
maxConcurrency: { type: 'number' },
|
|
43
|
+
maxIterations: { type: 'number' },
|
|
44
|
+
checkpoint: { type: 'boolean' },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
export const SwarmRunRequestSchema = {
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
input: { type: 'string' },
|
|
53
|
+
context: { type: 'object', additionalProperties: true },
|
|
54
|
+
threadId: { type: 'string' },
|
|
55
|
+
timeout: { type: 'number' },
|
|
56
|
+
},
|
|
57
|
+
required: ['input'],
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA+RA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;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ACd,UAAU,EAAE;gBACV,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAClC,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACjC,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aAChC;SACF;KACF;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE;QACvD,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC5B;IACD,QAAQ,EAAE,CAAC,OAAO,CAAC;CACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/websocket/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,SAAS,CAAC;AAiBlE,UAAU,sBAAsB;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,eAAe,EAAE,kBAAkB,CAAC,sBAAsB,CAgCtE,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { generateId } from '../streaming/helpers.js';
|
|
2
|
+
export const websocketRoutes = async (fastify, opts) => {
|
|
3
|
+
const path = opts.path ?? '/ws';
|
|
4
|
+
fastify.get(path, { websocket: true }, (socket, _request) => {
|
|
5
|
+
const clientState = {
|
|
6
|
+
id: generateId('ws'),
|
|
7
|
+
subscriptions: new Map(),
|
|
8
|
+
};
|
|
9
|
+
socket.on('message', async (data) => {
|
|
10
|
+
try {
|
|
11
|
+
const message = JSON.parse(data.toString());
|
|
12
|
+
await handleMessage(socket, message, fastify, clientState);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
sendResponse(socket, {
|
|
16
|
+
type: 'error',
|
|
17
|
+
error: error instanceof Error ? error.message : 'Invalid message',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
socket.on('close', () => {
|
|
22
|
+
clientState.abortController?.abort();
|
|
23
|
+
});
|
|
24
|
+
socket.on('error', () => {
|
|
25
|
+
clientState.abortController?.abort();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
async function handleMessage(socket, message, fastify, state) {
|
|
30
|
+
switch (message.type) {
|
|
31
|
+
case 'ping':
|
|
32
|
+
sendResponse(socket, { type: 'pong' });
|
|
33
|
+
break;
|
|
34
|
+
case 'subscribe':
|
|
35
|
+
if (message.channel) {
|
|
36
|
+
state.subscriptions.set(message.channel, {
|
|
37
|
+
channel: message.channel,
|
|
38
|
+
callback: (data) => {
|
|
39
|
+
sendResponse(socket, { type: 'event', channel: message.channel, payload: data });
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
sendResponse(socket, { type: 'subscribed', channel: message.channel });
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
case 'unsubscribe':
|
|
46
|
+
if (message.channel) {
|
|
47
|
+
state.subscriptions.delete(message.channel);
|
|
48
|
+
sendResponse(socket, { type: 'unsubscribed', channel: message.channel });
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case 'run':
|
|
52
|
+
await handleRun(socket, message, fastify, state);
|
|
53
|
+
break;
|
|
54
|
+
case 'stop':
|
|
55
|
+
state.abortController?.abort();
|
|
56
|
+
state.abortController = undefined;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function handleRun(socket, message, fastify, state) {
|
|
61
|
+
const payload = message.payload;
|
|
62
|
+
if (!payload?.type || !payload?.name || !payload?.input) {
|
|
63
|
+
sendResponse(socket, { type: 'error', id: message.id, error: 'Invalid run payload' });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
state.abortController = new AbortController();
|
|
67
|
+
try {
|
|
68
|
+
if (payload.type === 'agent') {
|
|
69
|
+
const agent = fastify.cogitator.agents[payload.name];
|
|
70
|
+
if (!agent) {
|
|
71
|
+
sendResponse(socket, {
|
|
72
|
+
type: 'error',
|
|
73
|
+
id: message.id,
|
|
74
|
+
error: `Agent '${payload.name}' not found`,
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const result = await fastify.cogitator.runtime.run(agent, {
|
|
79
|
+
input: payload.input,
|
|
80
|
+
context: payload.context,
|
|
81
|
+
stream: true,
|
|
82
|
+
onToken: (token) => {
|
|
83
|
+
sendResponse(socket, {
|
|
84
|
+
type: 'event',
|
|
85
|
+
id: message.id,
|
|
86
|
+
payload: { type: 'token', delta: token },
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
onToolCall: (toolCall) => {
|
|
90
|
+
sendResponse(socket, {
|
|
91
|
+
type: 'event',
|
|
92
|
+
id: message.id,
|
|
93
|
+
payload: { type: 'tool-call', ...toolCall },
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
onToolResult: (toolResult) => {
|
|
97
|
+
sendResponse(socket, {
|
|
98
|
+
type: 'event',
|
|
99
|
+
id: message.id,
|
|
100
|
+
payload: { type: 'tool-result', ...toolResult },
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
sendResponse(socket, {
|
|
105
|
+
type: 'event',
|
|
106
|
+
id: message.id,
|
|
107
|
+
payload: { type: 'complete', result },
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if (state.abortController?.signal.aborted) {
|
|
113
|
+
sendResponse(socket, { type: 'event', id: message.id, payload: { type: 'cancelled' } });
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
sendResponse(socket, {
|
|
117
|
+
type: 'error',
|
|
118
|
+
id: message.id,
|
|
119
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function sendResponse(socket, response) {
|
|
125
|
+
try {
|
|
126
|
+
if (socket.readyState === 1) {
|
|
127
|
+
socket.send(JSON.stringify(response));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch { }
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/websocket/handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAkBrD,MAAM,CAAC,MAAM,eAAe,GAA+C,KAAK,EAC9E,OAAO,EACP,IAAI,EACJ,EAAE;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC;IAEhC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,MAAiB,EAAE,QAAwB,EAAE,EAAE;QACrF,MAAM,WAAW,GAAgB;YAC/B,EAAE,EAAE,UAAU,CAAC,IAAI,CAAC;YACpB,aAAa,EAAE,IAAI,GAAG,EAAE;SACzB,CAAC;QAEF,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,IAAY,EAAE,EAAE;YAC1C,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAqB,CAAC;gBAChE,MAAM,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YAC7D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,YAAY,CAAC,MAAM,EAAE;oBACnB,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,KAAK,YAAY,KAAK,C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AAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;QAC1F,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,MAAM,EAAE;gBACnB,IAAI,EAAE,OAAO;gBACb,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAChE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,MAAiB,EAAE,QAA2B;IAClE,IAAI,CAAC;QACH,IAAI,MAAM,CAAC,UAAU,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;AACZ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cogitator-ai/fastify",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Fastify server adapter for Cogitator AI runtime",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"fastify-plugin": "^5.0.0",
|
|
19
|
+
"@cogitator-ai/types": "0.19.3",
|
|
20
|
+
"@cogitator-ai/server-shared": "0.1.0",
|
|
21
|
+
"@cogitator-ai/core": "0.17.5"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"fastify": ">=5.0.0"
|
|
25
|
+
},
|
|
26
|
+
"optionalDependencies": {
|
|
27
|
+
"@fastify/swagger": "^9.0.0",
|
|
28
|
+
"@fastify/swagger-ui": "^5.0.0",
|
|
29
|
+
"@fastify/rate-limit": "^10.0.0",
|
|
30
|
+
"@fastify/websocket": "^11.0.0",
|
|
31
|
+
"@cogitator-ai/workflows": "0.5.4",
|
|
32
|
+
"@cogitator-ai/swarms": "0.4.7"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@fastify/swagger": "^9.4.2",
|
|
36
|
+
"@fastify/swagger-ui": "^5.2.2",
|
|
37
|
+
"@fastify/rate-limit": "^10.2.1",
|
|
38
|
+
"@fastify/websocket": "^11.0.2",
|
|
39
|
+
"@types/node": "^22.0.0",
|
|
40
|
+
"@types/ws": "^8.5.0",
|
|
41
|
+
"fastify": "^5.2.1",
|
|
42
|
+
"typescript": "^5.6.0",
|
|
43
|
+
"@cogitator-ai/workflows": "0.5.4",
|
|
44
|
+
"@cogitator-ai/swarms": "0.4.7"
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/cogitator-ai/Cogitator-AI.git",
|
|
49
|
+
"directory": "packages/fastify"
|
|
50
|
+
},
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"keywords": [
|
|
53
|
+
"cogitator",
|
|
54
|
+
"ai",
|
|
55
|
+
"agents",
|
|
56
|
+
"fastify",
|
|
57
|
+
"server",
|
|
58
|
+
"api",
|
|
59
|
+
"streaming",
|
|
60
|
+
"sse",
|
|
61
|
+
"websocket",
|
|
62
|
+
"llm"
|
|
63
|
+
],
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc",
|
|
66
|
+
"dev": "tsc --watch",
|
|
67
|
+
"typecheck": "tsc --noEmit",
|
|
68
|
+
"clean": "rm -rf dist"
|
|
69
|
+
}
|
|
70
|
+
}
|