@myassis/gateway 1.0.11 → 1.0.12

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.
@@ -0,0 +1,38 @@
1
+ -- 创建 agents 表
2
+ CREATE TABLE IF NOT EXISTS agents (
3
+ id TEXT PRIMARY KEY,
4
+ user_id TEXT NOT NULL,
5
+ name TEXT NOT NULL,
6
+ description TEXT,
7
+ system_prompt TEXT,
8
+ avatar TEXT,
9
+ config TEXT,
10
+ created_at INTEGER NOT NULL,
11
+ updated_at INTEGER NOT NULL
12
+ );
13
+
14
+ -- 为 sessions 表添加 agent_id 外键
15
+ CREATE TABLE IF NOT EXISTS sessions (
16
+ id TEXT PRIMARY KEY,
17
+ user_id TEXT NOT NULL,
18
+ agent_id TEXT,
19
+ title TEXT NOT NULL,
20
+ select_model_id TEXT,
21
+ voice_state TEXT,
22
+ created_at INTEGER NOT NULL,
23
+ updated_at INTEGER NOT NULL,
24
+ FOREIGN KEY (agent_id) REFERENCES agents(id) ON DELETE CASCADE
25
+ );
26
+
27
+ -- 创建 messages 表的 tool_calls 列
28
+ CREATE TABLE IF NOT EXISTS messages (
29
+ id TEXT PRIMARY KEY,
30
+ session_id TEXT NOT NULL,
31
+ role TEXT NOT NULL,
32
+ content TEXT,
33
+ attachments TEXT DEFAULT '[]',
34
+ tool_calls TEXT DEFAULT '[]',
35
+ created_at INTEGER NOT NULL,
36
+ updated_at INTEGER NOT NULL,
37
+ FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
38
+ );
@@ -0,0 +1,3 @@
1
+ alter table messages drop column tool_calls;
2
+ alter table messages add column tool_call_id TEXT;
3
+ alter table messages add column tool_call_name TEXT;
@@ -0,0 +1,2 @@
1
+ -- Add tool_calls_data column to store the new nested toolCalls structure
2
+ alter table messages add column tool_calls_data TEXT;
@@ -0,0 +1,2 @@
1
+ alter table sessions add column last_message_summary text default null;
2
+ alter table sessions add column last_message_summary_at INTEGER default null;
@@ -0,0 +1 @@
1
+ alter table messages add column model_name text default null;
@@ -0,0 +1 @@
1
+ alter table sessions add column unread_count integer default 0 not null;
@@ -0,0 +1,12 @@
1
+ -- Add is_current column to agents table
2
+ ALTER TABLE agents ADD COLUMN is_current INTEGER DEFAULT 0;
3
+
4
+ -- Set the first agent (by created_at) as current for each user
5
+ UPDATE agents
6
+ SET is_current = 1
7
+ WHERE id IN (
8
+ SELECT id FROM agents
9
+ GROUP BY user_id
10
+ ORDER BY created_at ASC
11
+ LIMIT 1
12
+ );
@@ -0,0 +1 @@
1
+ alter table sessions add column is_current INTEGER DEFAULT 0;
@@ -0,0 +1,4 @@
1
+ alter table messages drop column tool_call_id;
2
+ alter table messages drop column tool_call_name;
3
+ alter table messages drop column tool_calls;
4
+ alter table messages rename column tool_calls_data to tool_calls;
@@ -0,0 +1 @@
1
+ alter table messages drop column tool_calls_data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myassis/gateway",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "我的助手 Gateway Service - 本地 AI 网关服务,支持认证、WebSocket 实时通信和任务调度",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -12,7 +12,8 @@
12
12
  "dist",
13
13
  "scripts",
14
14
  "README.md",
15
- "LICENSE"
15
+ "LICENSE",
16
+ "migrations"
16
17
  ],
17
18
  "exports": {
18
19
  ".": {