@loom-framework/backend 0.1.0-alpha.23 → 0.1.0-alpha.25
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/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +55 -88
- package/dist/routes/chat.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAW,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAW,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAkC1D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,QAAQ,CAAC;IACjB,cAAc,EAAE,cAAc,CAAC;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB;AAID;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,gBAAgB,GACxB,IAAI,CA0KN"}
|
package/dist/routes/chat.js
CHANGED
|
@@ -15,21 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { resolveButtonPrompt } from '../ai/button-resolver.js';
|
|
17
17
|
import { saveUploadedFile } from './upload.js';
|
|
18
|
-
// ── SSE Helpers ──
|
|
19
|
-
function sendSSE(reply, data) {
|
|
20
|
-
reply.raw.write(`data: ${JSON.stringify(data)}\n\n`);
|
|
21
|
-
}
|
|
22
|
-
function endSSE(reply) {
|
|
23
|
-
reply.raw.write('data: [DONE]\n\n');
|
|
24
|
-
reply.raw.end();
|
|
25
|
-
}
|
|
26
|
-
// ── ID Generators ──
|
|
27
|
-
function generateMessageId() {
|
|
28
|
-
return `msg_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
29
|
-
}
|
|
30
|
-
function generateSessionId() {
|
|
31
|
-
return `session_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
32
|
-
}
|
|
33
18
|
// ── Route Registration ──
|
|
34
19
|
/**
|
|
35
20
|
* Register chat SSE route and session REST routes
|
|
@@ -39,16 +24,12 @@ export function registerChatRoutes(fastify, options) {
|
|
|
39
24
|
// POST /api/v1/chat — SSE streaming AI response
|
|
40
25
|
fastify.post('/api/v1/chat', async (request, reply) => {
|
|
41
26
|
const body = request.body;
|
|
42
|
-
|
|
43
|
-
const { content, button_id, context, files } = body;
|
|
27
|
+
const { content, session_id, button_id, context, files } = body;
|
|
44
28
|
if (!content && !button_id) {
|
|
45
29
|
return reply.status(400).send({ error: 'content or button_id is required' });
|
|
46
30
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// Generate session_id if needed (will be replaced by Claude Code's session_id if new)
|
|
50
|
-
if (!session_id || session_id === '__new_session__') {
|
|
51
|
-
session_id = generateSessionId();
|
|
31
|
+
if (!session_id) {
|
|
32
|
+
return reply.status(400).send({ error: 'session_id is required' });
|
|
52
33
|
}
|
|
53
34
|
// Set SSE headers
|
|
54
35
|
reply.raw.writeHead(200, {
|
|
@@ -77,8 +58,7 @@ export function registerChatRoutes(fastify, options) {
|
|
|
77
58
|
// Resolve prompt: AI button or direct content
|
|
78
59
|
let prompt;
|
|
79
60
|
if (button_id) {
|
|
80
|
-
const
|
|
81
|
-
const resolved = resolveButtonPrompt(button_id, contextRecord, config);
|
|
61
|
+
const resolved = resolveButtonPrompt(button_id, context, config);
|
|
82
62
|
if (!resolved) {
|
|
83
63
|
sendSSE(reply, { type: 'error', error: `AI button "${button_id}" not found`, message_id: messageId, session_id });
|
|
84
64
|
endSSE(reply);
|
|
@@ -92,7 +72,7 @@ export function registerChatRoutes(fastify, options) {
|
|
|
92
72
|
prompt = resolved.prompt;
|
|
93
73
|
}
|
|
94
74
|
else {
|
|
95
|
-
prompt = content
|
|
75
|
+
prompt = content;
|
|
96
76
|
}
|
|
97
77
|
// Get or create session
|
|
98
78
|
const session = await sessionManager.getOrCreate(session_id);
|
|
@@ -109,7 +89,6 @@ export function registerChatRoutes(fastify, options) {
|
|
|
109
89
|
let aiContent = '';
|
|
110
90
|
let claudeSessionId;
|
|
111
91
|
let usage;
|
|
112
|
-
let actualSessionId = session_id;
|
|
113
92
|
try {
|
|
114
93
|
for await (const chunk of engine.call(prompt, {
|
|
115
94
|
sessionId: session_id,
|
|
@@ -118,31 +97,18 @@ export function registerChatRoutes(fastify, options) {
|
|
|
118
97
|
})) {
|
|
119
98
|
if (chunk.type === 'content' && chunk.content) {
|
|
120
99
|
aiContent += chunk.content;
|
|
121
|
-
sendSSE(reply, { type: 'content', content: chunk.content, message_id: messageId, session_id
|
|
100
|
+
sendSSE(reply, { type: 'content', content: chunk.content, message_id: messageId, session_id });
|
|
122
101
|
}
|
|
123
102
|
else if (chunk.type === 'thinking' && chunk.content) {
|
|
124
|
-
sendSSE(reply, { type: 'thinking', thinking: chunk.content, message_id: messageId, session_id
|
|
103
|
+
sendSSE(reply, { type: 'thinking', thinking: chunk.content, message_id: messageId, session_id });
|
|
125
104
|
}
|
|
126
105
|
else if (chunk.type === 'session_info') {
|
|
127
|
-
|
|
128
|
-
if (chunk.sessionId && isNewSession) {
|
|
129
|
-
actualSessionId = chunk.sessionId;
|
|
130
|
-
claudeSessionId = chunk.sessionId;
|
|
131
|
-
}
|
|
132
|
-
else if (chunk.sessionId) {
|
|
133
|
-
claudeSessionId = chunk.sessionId;
|
|
134
|
-
}
|
|
106
|
+
claudeSessionId = chunk.sessionId;
|
|
135
107
|
if (chunk.usage)
|
|
136
108
|
usage = chunk.usage;
|
|
137
|
-
// Send session_info to frontend so it can update conversationKey
|
|
138
|
-
sendSSE(reply, {
|
|
139
|
-
type: 'session_info',
|
|
140
|
-
session_id: actualSessionId,
|
|
141
|
-
is_new_session: isNewSession,
|
|
142
|
-
});
|
|
143
109
|
}
|
|
144
110
|
else if (chunk.type === 'error' && chunk.error) {
|
|
145
|
-
sendSSE(reply, { type: 'error', error: chunk.error, message_id: messageId, session_id
|
|
111
|
+
sendSSE(reply, { type: 'error', error: chunk.error, message_id: messageId, session_id });
|
|
146
112
|
}
|
|
147
113
|
else if (chunk.type === 'tool_call') {
|
|
148
114
|
sendSSE(reply, {
|
|
@@ -150,7 +116,6 @@ export function registerChatRoutes(fastify, options) {
|
|
|
150
116
|
toolUseId: chunk.toolUseId,
|
|
151
117
|
toolName: chunk.toolName,
|
|
152
118
|
toolInput: chunk.toolInput,
|
|
153
|
-
tool_status: 'started',
|
|
154
119
|
});
|
|
155
120
|
}
|
|
156
121
|
else if (chunk.type === 'tool_result') {
|
|
@@ -164,20 +129,8 @@ export function registerChatRoutes(fastify, options) {
|
|
|
164
129
|
}
|
|
165
130
|
catch (error) {
|
|
166
131
|
fastify.log.error('AI engine exception: %s', error);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
sessionId: actualSessionId,
|
|
170
|
-
messageId,
|
|
171
|
-
timestamp: new Date(startTime).toISOString(),
|
|
172
|
-
prompt,
|
|
173
|
-
response: '',
|
|
174
|
-
duration: Date.now() - startTime,
|
|
175
|
-
mcpCalls: [],
|
|
176
|
-
cliCalls: [],
|
|
177
|
-
error: error instanceof Error ? error.message : String(error),
|
|
178
|
-
}).catch(() => { });
|
|
179
|
-
}
|
|
180
|
-
sendSSE(reply, { type: 'error', error: `Processing error: ${error}`, message_id: messageId, session_id: actualSessionId });
|
|
132
|
+
recordLog(logger, session_id, messageId, prompt, '', startTime, [], [], error instanceof Error ? error.message : String(error), fastify);
|
|
133
|
+
sendSSE(reply, { type: 'error', error: `Processing error: ${error}`, message_id: messageId, session_id });
|
|
181
134
|
endSSE(reply);
|
|
182
135
|
return;
|
|
183
136
|
}
|
|
@@ -186,47 +139,22 @@ export function registerChatRoutes(fastify, options) {
|
|
|
186
139
|
type: 'done',
|
|
187
140
|
content: aiContent || '(empty response)',
|
|
188
141
|
message_id: messageId,
|
|
189
|
-
session_id
|
|
190
|
-
is_new_session: isNewSession,
|
|
142
|
+
session_id,
|
|
191
143
|
};
|
|
192
144
|
if (claudeSessionId)
|
|
193
145
|
completePayload.claude_session_id = claudeSessionId;
|
|
194
146
|
if (usage)
|
|
195
147
|
completePayload.usage = usage;
|
|
196
148
|
sendSSE(reply, completePayload);
|
|
197
|
-
// Persist assistant message
|
|
149
|
+
// Persist assistant message
|
|
198
150
|
const assistantMsg = {
|
|
199
|
-
id:
|
|
151
|
+
id: messageId,
|
|
200
152
|
role: 'assistant',
|
|
201
153
|
content: aiContent || '(empty response)',
|
|
202
154
|
timestamp: new Date().toISOString(),
|
|
203
155
|
};
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
// Create new session with actualSessionId
|
|
207
|
-
await sessionManager.createSession(actualSessionId);
|
|
208
|
-
// Add both messages to new session
|
|
209
|
-
await sessionManager.addMessages(actualSessionId, [userMsg, assistantMsg], claudeSessionId, usage);
|
|
210
|
-
// Delete old session
|
|
211
|
-
await sessionManager.deleteSession(session_id);
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
await sessionManager.addMessages(session_id, [assistantMsg], claudeSessionId, usage);
|
|
215
|
-
}
|
|
216
|
-
// Record log
|
|
217
|
-
if (logger) {
|
|
218
|
-
logger.log({
|
|
219
|
-
sessionId: actualSessionId,
|
|
220
|
-
messageId,
|
|
221
|
-
timestamp: new Date(startTime).toISOString(),
|
|
222
|
-
prompt,
|
|
223
|
-
response: aiContent || '(empty response)',
|
|
224
|
-
duration: Date.now() - startTime,
|
|
225
|
-
usage,
|
|
226
|
-
mcpCalls: [],
|
|
227
|
-
cliCalls: [],
|
|
228
|
-
}).catch(() => { });
|
|
229
|
-
}
|
|
156
|
+
await sessionManager.addMessages(session_id, [assistantMsg], claudeSessionId, usage);
|
|
157
|
+
recordLog(logger, session_id, messageId, prompt, aiContent || '(empty response)', startTime, [], [], undefined, fastify, usage);
|
|
230
158
|
endSSE(reply);
|
|
231
159
|
});
|
|
232
160
|
// GET /api/v1/sessions — List sessions
|
|
@@ -257,4 +185,43 @@ export function registerChatRoutes(fastify, options) {
|
|
|
257
185
|
return reply.send({ success: true });
|
|
258
186
|
});
|
|
259
187
|
}
|
|
188
|
+
// ── SSE Helpers ──
|
|
189
|
+
function sendSSE(reply, event) {
|
|
190
|
+
try {
|
|
191
|
+
reply.raw.write(`data: ${JSON.stringify(event)}\n\n`);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
// Client may have disconnected
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function endSSE(reply) {
|
|
198
|
+
try {
|
|
199
|
+
reply.raw.end();
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// Already closed
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function generateMessageId() {
|
|
206
|
+
return `msg_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
207
|
+
}
|
|
208
|
+
function recordLog(logger, sessionId, messageId, prompt, response, startTime, mcpCalls, cliCalls, error, fastify, usage) {
|
|
209
|
+
if (!logger)
|
|
210
|
+
return;
|
|
211
|
+
const logEntry = {
|
|
212
|
+
sessionId,
|
|
213
|
+
messageId,
|
|
214
|
+
timestamp: new Date().toISOString(),
|
|
215
|
+
prompt,
|
|
216
|
+
response,
|
|
217
|
+
duration: Date.now() - startTime,
|
|
218
|
+
usage: usage ? { inputTokens: usage.inputTokens, outputTokens: usage.outputTokens } : undefined,
|
|
219
|
+
mcpCalls,
|
|
220
|
+
cliCalls,
|
|
221
|
+
error,
|
|
222
|
+
};
|
|
223
|
+
logger.log(logEntry).catch((err) => {
|
|
224
|
+
fastify.log.warn('Failed to write interaction log: %s', err);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
260
227
|
//# sourceMappingURL=chat.js.map
|
package/dist/routes/chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAwC/C,2BAA2B;AAE3B;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAwB,EACxB,OAAyB;IAEzB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAExE,gDAAgD;IAChD,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,OAAuB,EAAE,KAAmB,EAAE,EAAE;QAClF,MAAM,IAAI,GAAG,OAAO,CAAC,IAAuB,CAAC;QAC7C,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAA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Q,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACjC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loom-framework/backend",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.25",
|
|
4
4
|
"description": "Loom framework backend - AI communication, SSE chat, REST routes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"lint": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@loom-framework/core": "^0.1.0-alpha.
|
|
28
|
+
"@loom-framework/core": "^0.1.0-alpha.25",
|
|
29
29
|
"fastify": "^5.2.0",
|
|
30
30
|
"@fastify/cors": "^10.0.0",
|
|
31
31
|
"@fastify/static": "^8.0.0"
|