@agi-cli/server 0.1.125 → 0.1.127
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/package.json +3 -3
- package/src/routes/research.ts +6 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agi-cli/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.127",
|
|
4
4
|
"description": "HTTP API server for AGI CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agi-cli/sdk": "0.1.
|
|
33
|
-
"@agi-cli/database": "0.1.
|
|
32
|
+
"@agi-cli/sdk": "0.1.127",
|
|
33
|
+
"@agi-cli/database": "0.1.127",
|
|
34
34
|
"drizzle-orm": "^0.44.5",
|
|
35
35
|
"hono": "^4.9.9",
|
|
36
36
|
"zod": "^4.1.8"
|
package/src/routes/research.ts
CHANGED
|
@@ -233,50 +233,13 @@ export function registerResearchRoutes(app: Hono) {
|
|
|
233
233
|
|
|
234
234
|
const injectedContext = `<research-context from="${researchSessionId}" label="${label}" injected-at="${new Date().toISOString()}">\n${contextContent}</research-context>`;
|
|
235
235
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const now = Date.now();
|
|
239
|
-
|
|
240
|
-
await db.insert(messages).values({
|
|
241
|
-
id: msgId,
|
|
242
|
-
sessionId: parentId,
|
|
243
|
-
role: 'system',
|
|
244
|
-
status: 'complete',
|
|
245
|
-
agent: parentRows[0].agent,
|
|
246
|
-
provider: parentRows[0].provider,
|
|
247
|
-
model: parentRows[0].model,
|
|
248
|
-
createdAt: now,
|
|
249
|
-
completedAt: now,
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
await db.insert(messageParts).values({
|
|
253
|
-
id: partId,
|
|
254
|
-
messageId: msgId,
|
|
255
|
-
index: 0,
|
|
256
|
-
type: 'text',
|
|
257
|
-
content: injectedContext,
|
|
258
|
-
agent: parentRows[0].agent,
|
|
259
|
-
provider: parentRows[0].provider,
|
|
260
|
-
model: parentRows[0].model,
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
await db
|
|
264
|
-
.update(sessions)
|
|
265
|
-
.set({ lastActiveAt: now })
|
|
266
|
-
.where(eq(sessions.id, parentId));
|
|
267
|
-
|
|
268
|
-
publish({
|
|
269
|
-
type: 'message.created',
|
|
270
|
-
sessionId: parentId,
|
|
271
|
-
payload: {
|
|
272
|
-
id: msgId,
|
|
273
|
-
role: 'system',
|
|
274
|
-
content: injectedContext,
|
|
275
|
-
},
|
|
276
|
-
});
|
|
277
|
-
|
|
236
|
+
// Return the content to the client instead of creating a system message
|
|
237
|
+
// The client will store it in zustand and include it in the next user message
|
|
278
238
|
return c.json({
|
|
279
|
-
|
|
239
|
+
content: injectedContext,
|
|
240
|
+
label,
|
|
241
|
+
sessionId: researchSessionId,
|
|
242
|
+
parentSessionId: parentId,
|
|
280
243
|
tokenEstimate: Math.ceil(injectedContext.length / 4),
|
|
281
244
|
});
|
|
282
245
|
});
|