agentgui 1.0.777 → 1.0.778
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/lib/ws-handlers-session.js +18 -1
- package/package.json +1 -1
- package/server.js +12 -16
|
@@ -99,7 +99,24 @@ export function register(router, deps) {
|
|
|
99
99
|
router.handle('sess.exec', (p) => {
|
|
100
100
|
const limit = Math.min(parseInt(p.limit || '1000'), 5000);
|
|
101
101
|
const offset = Math.max(parseInt(p.offset || '0'), 0);
|
|
102
|
-
|
|
102
|
+
const session = db.getSession(p.id);
|
|
103
|
+
const allChunks = session ? (db.getChunksSince(p.id, 0) || []) : [];
|
|
104
|
+
const filterType = p.filterType;
|
|
105
|
+
const filtered = filterType ? allChunks.filter(e => e.type === filterType) : allChunks;
|
|
106
|
+
return {
|
|
107
|
+
sessionId: p.id,
|
|
108
|
+
events: filtered.slice(offset, offset + limit),
|
|
109
|
+
total: filtered.length,
|
|
110
|
+
limit,
|
|
111
|
+
offset,
|
|
112
|
+
hasMore: offset + limit < filtered.length,
|
|
113
|
+
metadata: {
|
|
114
|
+
status: session?.status || 'unknown',
|
|
115
|
+
startTime: session?.created_at || null,
|
|
116
|
+
duration: session?.completed_at && session?.created_at ? session.completed_at - session.created_at : 0,
|
|
117
|
+
eventCount: filtered.length
|
|
118
|
+
}
|
|
119
|
+
};
|
|
103
120
|
});
|
|
104
121
|
|
|
105
122
|
router.handle('agent.ls', () => {
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -815,29 +815,25 @@ const server = http.createServer(async (req, res) => {
|
|
|
815
815
|
const filterType = url.searchParams.get('filterType');
|
|
816
816
|
|
|
817
817
|
try {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
818
|
+
const session = queries.getSession(sessionId);
|
|
819
|
+
const allChunks = session ? (queries.getChunksSince(sessionId, 0) || []) : [];
|
|
820
|
+
const filtered = filterType ? allChunks.filter(e => e.type === filterType) : allChunks;
|
|
821
821
|
const executionData = {
|
|
822
822
|
sessionId,
|
|
823
|
-
events:
|
|
824
|
-
total:
|
|
823
|
+
events: filtered.slice(offset, offset + limit),
|
|
824
|
+
total: filtered.length,
|
|
825
825
|
limit,
|
|
826
826
|
offset,
|
|
827
|
-
hasMore:
|
|
827
|
+
hasMore: offset + limit < filtered.length,
|
|
828
828
|
metadata: {
|
|
829
|
-
status: '
|
|
830
|
-
startTime:
|
|
831
|
-
duration: 0,
|
|
832
|
-
eventCount:
|
|
833
|
-
|
|
829
|
+
status: session?.status || 'unknown',
|
|
830
|
+
startTime: session?.created_at || null,
|
|
831
|
+
duration: session?.completed_at && session?.created_at ? session.completed_at - session.created_at : 0,
|
|
832
|
+
eventCount: filtered.length
|
|
833
|
+
}
|
|
834
834
|
};
|
|
835
835
|
|
|
836
|
-
|
|
837
|
-
executionData.events = executionData.events.filter(e => e.type === filterType);
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
sendJSON(req, res, 200, executionData);
|
|
836
|
+
sendJSON(req, res, 200, executionData);
|
|
841
837
|
} catch (err) {
|
|
842
838
|
sendJSON(req, res, 400, { error: err.message });
|
|
843
839
|
}
|