@myassis/gateway 1.0.30 → 1.0.31

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.
@@ -261,8 +261,11 @@ router.post('/:id/sessions', ensureAgentManager, async (req, res) => {
261
261
  success: true,
262
262
  data: {
263
263
  id: session.id,
264
+ agentId: session.agentId,
264
265
  title: session.title,
265
266
  selectModelId: session.selectModelId,
267
+ messageQueue: session.messageQueue,
268
+ messageQueueAutoExecute: session.messageQueueAutoExecute,
266
269
  createdAt: session.createdAt,
267
270
  updatedAt: session.updatedAt,
268
271
  }
@@ -285,14 +288,17 @@ router.put('/:id/sessions/:sessionId', ensureAgentManager, async (req, res) => {
285
288
  if (!agent) {
286
289
  return res.status(404).json({ success: false, error: 'Agent not found' });
287
290
  }
288
- const { title, selectModelId, unreadCount } = req.body;
289
- const session = agent.updateSession(req.params.sessionId, { title, selectModelId, unreadCount });
291
+ const { title, selectModelId, unreadCount, messageQueue, messageQueueAutoExecute } = req.body;
292
+ const session = agent.updateSession(req.params.sessionId, { title, selectModelId, unreadCount, messageQueue, messageQueueAutoExecute });
290
293
  res.json({
291
294
  success: true,
292
295
  data: {
293
296
  id: session.id,
297
+ agentId: session.agentId,
294
298
  title: session.title,
295
299
  selectModelId: session.selectModelId,
300
+ messageQueue: session.messageQueue,
301
+ messageQueueAutoExecute: session.messageQueueAutoExecute,
296
302
  createdAt: session.createdAt,
297
303
  updatedAt: session.updatedAt,
298
304
  }
@@ -252,6 +252,8 @@ class AgentManager {
252
252
  unreadCount: s.unreadCount,
253
253
  createdAt: s.createdAt,
254
254
  updatedAt: s.updatedAt,
255
+ messageQueue: s.messageQueue,
256
+ messageQueueAutoExecute: s.messageQueueAutoExecute
255
257
  }));
256
258
  }
257
259
  /**
@@ -39,6 +39,8 @@ class Session {
39
39
  title;
40
40
  selectModelId;
41
41
  messages;
42
+ messageQueue;
43
+ messageQueueAutoExecute;
42
44
  voiceState;
43
45
  createdAt;
44
46
  updatedAt;
@@ -58,6 +60,8 @@ class Session {
58
60
  this.title = data.title || 'New Chat';
59
61
  this.selectModelId = data.selectModelId;
60
62
  this.messages = [];
63
+ this.messageQueue = data.messageQueue || [];
64
+ this.messageQueueAutoExecute = data.messageQueueAutoExecute ?? true;
61
65
  this.voiceState = data.voiceState || { isRecording: false, isPlaying: false };
62
66
  this.lastMessageSummary = data.lastMessageSummary ?? null;
63
67
  this.lastMessageSummaryAt = data.lastMessageSummaryAt ?? null;
@@ -390,7 +394,9 @@ class Session {
390
394
  lastMessageSummary: this.lastMessageSummary,
391
395
  lastMessageSummaryAt: this.lastMessageSummaryAt,
392
396
  unreadCount: this.unreadCount,
393
- isCurrent: this.isCurrent
397
+ isCurrent: this.isCurrent,
398
+ messageQueue: this.messageQueue,
399
+ messageQueueAutoExecute: this.messageQueueAutoExecute
394
400
  };
395
401
  }
396
402
  getStreamDelay(streamSpeed) {
@@ -63,7 +63,9 @@ class SessionManager {
63
63
  updatedAt: data.updatedAt,
64
64
  isCurrent: data.isCurrent,
65
65
  lastMessageSummary: data.lastMessageSummary,
66
- lastMessageSummaryAt: data.lastMessageSummaryAt
66
+ lastMessageSummaryAt: data.lastMessageSummaryAt,
67
+ messageQueue: data.messageQueue,
68
+ messageQueueAutoExecute: data.messageQueueAutoExecute
67
69
  });
68
70
  session.loadMessages();
69
71
  return session;
@@ -171,6 +173,10 @@ class SessionManager {
171
173
  session.agentId = updates.agentId;
172
174
  if (updates.unreadCount !== undefined)
173
175
  session.unreadCount = updates.unreadCount;
176
+ if (updates.messageQueue !== undefined)
177
+ session.messageQueue = updates.messageQueue;
178
+ if (updates.messageQueueAutoExecute !== undefined)
179
+ session.messageQueueAutoExecute = updates.messageQueueAutoExecute;
174
180
  session.updatedAt = Date.now();
175
181
  session.save();
176
182
  return session;
@@ -82,17 +82,17 @@ class SessionStore {
82
82
  // ========== Session Operations ==========
83
83
  insertSession(session) {
84
84
  this.db.prepare(`
85
- INSERT INTO sessions (id, user_id, agent_id, title, select_model_id, voice_state, created_at, updated_at,last_message_summary,last_message_summary_at,unread_count,is_current)
86
- VALUES (?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?)
87
- `).run(session.id, session.userId, session.agentId || null, session.title, session.selectModelId || '', JSON.stringify(session.voiceState), session.createdAt, session.updatedAt, session.lastMessageSummary, session.lastMessageSummaryAt, session.unreadCount || 0, session.isCurrent ? 1 : 0);
85
+ INSERT INTO sessions (id, user_id, agent_id, title, select_model_id, voice_state, created_at, updated_at,last_message_summary,last_message_summary_at,unread_count,is_current,message_queue,message_queue_auto_execute)
86
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?)
87
+ `).run(session.id, session.userId, session.agentId || null, session.title, session.selectModelId || '', JSON.stringify(session.voiceState), session.createdAt, session.updatedAt, session.lastMessageSummary, session.lastMessageSummaryAt, session.unreadCount || 0, session.isCurrent ? 1 : 0, JSON.stringify(session.messageQueue || []), session.messageQueueAutoExecute === false ? 0 : 1);
88
88
  }
89
89
  updateSession(session) {
90
90
  this.db.prepare(`
91
91
  UPDATE sessions
92
92
  SET user_id = ?, agent_id = ?, title = ?, select_model_id = ?,
93
- voice_state = ?, updated_at = ?,last_message_summary=?,last_message_summary_at=?,unread_count=?,is_current=?
93
+ voice_state = ?, updated_at = ?,last_message_summary=?,last_message_summary_at=?,unread_count=?,is_current=?,message_queue=?,message_queue_auto_execute=?
94
94
  WHERE id = ?
95
- `).run(session.userId, session.agentId || null, session.title, session.selectModelId || '', JSON.stringify(session.voiceState), session.updatedAt, session.lastMessageSummary, session.lastMessageSummaryAt, session.unreadCount || 0, session.isCurrent ? 1 : 0, session.id);
95
+ `).run(session.userId, session.agentId || null, session.title, session.selectModelId || '', JSON.stringify(session.voiceState), session.updatedAt, session.lastMessageSummary, session.lastMessageSummaryAt, session.unreadCount || 0, session.isCurrent ? 1 : 0, JSON.stringify(session.messageQueue || []), session.messageQueueAutoExecute === false ? 0 : 1, session.id);
96
96
  }
97
97
  // 支持部分更新的 updateSession
98
98
  updateSessionPartial(id, data) {
@@ -106,6 +106,14 @@ class SessionStore {
106
106
  updates.push('select_model_id = ?');
107
107
  values.push(data.selectModelId || '');
108
108
  }
109
+ if (data.messageQueue !== undefined) {
110
+ updates.push('message_queue = ?');
111
+ values.push(JSON.stringify(data.messageQueue || []));
112
+ }
113
+ if (data.messageQueueAutoExecute !== undefined) {
114
+ updates.push('message_queue_auto_execute = ?');
115
+ values.push(data.messageQueueAutoExecute ? 1 : 0);
116
+ }
109
117
  if (updates.length === 0)
110
118
  return;
111
119
  updates.push('updated_at = ?');
@@ -185,7 +193,9 @@ class SessionStore {
185
193
  lastMessageSummary: row.last_message_summary,
186
194
  lastMessageSummaryAt: row.last_message_summary_at,
187
195
  unreadCount: row.unread_count,
188
- isCurrent: !!row.is_current
196
+ isCurrent: !!row.is_current,
197
+ messageQueueAutoExecute: row.message_queue_auto_execute !== 0,
198
+ messageQueue: JSON.parse(row.message_queue || '[]'),
189
199
  };
190
200
  }
191
201
  /**
@@ -0,0 +1 @@
1
+ ALTER TABLE sessions ADD COLUMN message_queue_auto_execute INTEGER DEFAULT 1;
@@ -0,0 +1 @@
1
+ ALTER TABLE sessions ADD COLUMN message_queue TEXT DEFAULT '[]';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myassis/gateway",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "我的助手 Gateway Service - 本地 AI 网关服务,支持认证、WebSocket 实时通信和任务调度",
5
5
  "main": "dist/index.js",
6
6
  "bin": {