@datafrog-io/n2n-nexus 0.1.7 → 0.1.8
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/README.md +1 -0
- package/README_zh.md +143 -0
- package/build/index.js +1 -1
- package/build/resources/index.js +29 -1
- package/build/storage/index.js +1 -35
- package/build/storage/meetings.js +242 -0
- package/build/storage/sqlite-meeting.js +249 -0
- package/build/storage/sqlite.js +120 -0
- package/build/storage/store.js +139 -0
- package/build/tools/definitions.js +69 -9
- package/build/tools/handlers.js +153 -6
- package/build/utils/async-mutex.js +36 -0
- package/docs/ASSISTANT_GUIDE.md +66 -0
- package/docs/CHANGELOG.md +141 -0
- package/docs/CHANGELOG_zh.md +141 -0
- package/docs/MEETING_MINUTES_2025-12-29.md +160 -0
- package/docs/discussion_2025-12-29_en.json +330 -0
- package/docs/discussion_2025-12-29_en.md +717 -0
- package/package.json +6 -2
package/build/tools/handlers.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
|
2
2
|
import { promises as fs } from "fs";
|
|
3
3
|
import { CONFIG } from "../config.js";
|
|
4
4
|
import { StorageManager } from "../storage/index.js";
|
|
5
|
+
import { UnifiedMeetingStore } from "../storage/store.js";
|
|
5
6
|
/**
|
|
6
7
|
* Validation helper for Project IDs.
|
|
7
8
|
*/
|
|
@@ -48,10 +49,21 @@ export async function handleToolCall(name, toolArgs, ctx) {
|
|
|
48
49
|
return handleRenameProject(toolArgs, ctx);
|
|
49
50
|
case "list_projects":
|
|
50
51
|
return handleListProjects();
|
|
51
|
-
case "
|
|
52
|
+
case "moderator_delete_project":
|
|
52
53
|
return handleRemoveProject(toolArgs, ctx);
|
|
53
54
|
case "moderator_maintenance":
|
|
54
55
|
return handleModeratorMaintenance(toolArgs, ctx);
|
|
56
|
+
// --- Meeting Tools ---
|
|
57
|
+
case "start_meeting":
|
|
58
|
+
return handleStartMeeting(toolArgs, ctx);
|
|
59
|
+
case "end_meeting":
|
|
60
|
+
return handleEndMeeting(toolArgs, ctx);
|
|
61
|
+
case "list_meetings":
|
|
62
|
+
return handleListMeetings(toolArgs);
|
|
63
|
+
case "read_meeting":
|
|
64
|
+
return handleReadMeeting(toolArgs);
|
|
65
|
+
case "archive_meeting":
|
|
66
|
+
return handleArchiveMeeting(toolArgs);
|
|
55
67
|
default:
|
|
56
68
|
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
57
69
|
}
|
|
@@ -186,15 +198,73 @@ async function handleGetTopology() {
|
|
|
186
198
|
async function handlePostDiscussion(args, ctx) {
|
|
187
199
|
if (!args?.message)
|
|
188
200
|
throw new McpError(ErrorCode.InvalidParams, "Message content cannot be empty.");
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
201
|
+
const from = `${CONFIG.instanceId}@${ctx.currentProject || "Global"}`;
|
|
202
|
+
const message = {
|
|
203
|
+
timestamp: new Date().toISOString(),
|
|
204
|
+
from,
|
|
205
|
+
text: args.message,
|
|
206
|
+
category: args.category
|
|
207
|
+
};
|
|
208
|
+
// Check for active meeting - auto-route if exists
|
|
209
|
+
const activeMeeting = await UnifiedMeetingStore.getActiveMeeting();
|
|
210
|
+
if (activeMeeting) {
|
|
211
|
+
// Route to active meeting
|
|
212
|
+
await UnifiedMeetingStore.addMessage(activeMeeting.id, message);
|
|
213
|
+
ctx.notifyResourceUpdate(`mcp://meetings/${activeMeeting.id}`);
|
|
214
|
+
ctx.notifyResourceUpdate("mcp://chat/global");
|
|
215
|
+
return {
|
|
216
|
+
content: [{
|
|
217
|
+
type: "text",
|
|
218
|
+
text: `Message posted to active meeting '${activeMeeting.topic}' (${activeMeeting.id})${args.category ? ` [${args.category}]` : ""}.`
|
|
219
|
+
}]
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
// Fallback to global discussion (backward compatibility)
|
|
224
|
+
await StorageManager.addGlobalLog(from, args.message, args.category);
|
|
225
|
+
ctx.notifyResourceUpdate("mcp://chat/global");
|
|
226
|
+
return {
|
|
227
|
+
content: [{
|
|
228
|
+
type: "text",
|
|
229
|
+
text: `Message broadcasted to Nexus Room (no active meeting)${args.category ? ` [${args.category}]` : ""}.`
|
|
230
|
+
}]
|
|
231
|
+
};
|
|
232
|
+
}
|
|
193
233
|
}
|
|
194
234
|
async function handleReadRecentDiscussion(args) {
|
|
195
235
|
const count = args?.count || 10;
|
|
236
|
+
// If meetingId specified, read from that meeting
|
|
237
|
+
if (args?.meetingId) {
|
|
238
|
+
const messages = await UnifiedMeetingStore.getRecentMessages(count, args.meetingId);
|
|
239
|
+
return { content: [{ type: "text", text: JSON.stringify(messages, null, 2) }] };
|
|
240
|
+
}
|
|
241
|
+
// Check for active meeting first
|
|
242
|
+
const activeMeeting = await UnifiedMeetingStore.getActiveMeeting();
|
|
243
|
+
if (activeMeeting) {
|
|
244
|
+
const messages = await UnifiedMeetingStore.getRecentMessages(count, activeMeeting.id);
|
|
245
|
+
return {
|
|
246
|
+
content: [{
|
|
247
|
+
type: "text",
|
|
248
|
+
text: JSON.stringify({
|
|
249
|
+
source: "meeting",
|
|
250
|
+
meetingId: activeMeeting.id,
|
|
251
|
+
topic: activeMeeting.topic,
|
|
252
|
+
messages
|
|
253
|
+
}, null, 2)
|
|
254
|
+
}]
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
// Fallback to global logs
|
|
196
258
|
const logs = await StorageManager.getRecentLogs(count);
|
|
197
|
-
return {
|
|
259
|
+
return {
|
|
260
|
+
content: [{
|
|
261
|
+
type: "text",
|
|
262
|
+
text: JSON.stringify({
|
|
263
|
+
source: "global",
|
|
264
|
+
messages: logs
|
|
265
|
+
}, null, 2)
|
|
266
|
+
}]
|
|
267
|
+
};
|
|
198
268
|
}
|
|
199
269
|
async function handleUpdateStrategy(args, _ctx) {
|
|
200
270
|
if (!args?.content)
|
|
@@ -264,3 +334,80 @@ async function handleModeratorMaintenance(args, ctx) {
|
|
|
264
334
|
}
|
|
265
335
|
}
|
|
266
336
|
}
|
|
337
|
+
// --- Meeting Handlers ---
|
|
338
|
+
async function handleStartMeeting(args, ctx) {
|
|
339
|
+
if (!args?.topic)
|
|
340
|
+
throw new McpError(ErrorCode.InvalidParams, "Topic is required to start a meeting.");
|
|
341
|
+
const initiator = ctx.currentProject ? `${CONFIG.instanceId}@${ctx.currentProject}` : `${CONFIG.instanceId}@Global`;
|
|
342
|
+
const meeting = await UnifiedMeetingStore.startMeeting(args.topic, initiator);
|
|
343
|
+
// Notify updates
|
|
344
|
+
ctx.notifyResourceUpdate("mcp://nexus/status");
|
|
345
|
+
ctx.notifyResourceUpdate("mcp://chat/global");
|
|
346
|
+
return {
|
|
347
|
+
content: [{
|
|
348
|
+
type: "text",
|
|
349
|
+
text: JSON.stringify({
|
|
350
|
+
message: `Meeting started (Topic: '${args.topic}').`,
|
|
351
|
+
meetingId: meeting.id,
|
|
352
|
+
topic: args.topic,
|
|
353
|
+
status: meeting.status,
|
|
354
|
+
startTime: meeting.startTime
|
|
355
|
+
}, null, 2)
|
|
356
|
+
}]
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
async function handleEndMeeting(args, ctx) {
|
|
360
|
+
let targetId = args.meetingId;
|
|
361
|
+
if (!targetId) {
|
|
362
|
+
const active = await UnifiedMeetingStore.getActiveMeeting();
|
|
363
|
+
if (!active)
|
|
364
|
+
throw new McpError(ErrorCode.InvalidRequest, "No active meeting found to end. Please specify meetingId.");
|
|
365
|
+
targetId = active.id;
|
|
366
|
+
}
|
|
367
|
+
const { meeting, suggestedSyncTargets } = await UnifiedMeetingStore.endMeeting(targetId, args.summary);
|
|
368
|
+
ctx.notifyResourceUpdate("mcp://nexus/status");
|
|
369
|
+
ctx.notifyResourceUpdate("mcp://chat/global");
|
|
370
|
+
const suggestionText = suggestedSyncTargets.length > 0
|
|
371
|
+
? `\nSuggested sync targets: ${suggestedSyncTargets.join(", ")}`
|
|
372
|
+
: "";
|
|
373
|
+
return {
|
|
374
|
+
content: [{
|
|
375
|
+
type: "text",
|
|
376
|
+
text: JSON.stringify({
|
|
377
|
+
message: `Meeting '${meeting.topic}' closed.`,
|
|
378
|
+
meetingId: meeting.id,
|
|
379
|
+
topic: meeting.topic,
|
|
380
|
+
status: meeting.status,
|
|
381
|
+
decisionsCount: meeting.decisions.length,
|
|
382
|
+
suggestedSyncTargets
|
|
383
|
+
}, null, 2)
|
|
384
|
+
}]
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
async function handleListMeetings(args) {
|
|
388
|
+
const meetings = await UnifiedMeetingStore.listMeetings(args.status);
|
|
389
|
+
return { content: [{ type: "text", text: JSON.stringify(meetings, null, 2) }] };
|
|
390
|
+
}
|
|
391
|
+
async function handleReadMeeting(args) {
|
|
392
|
+
if (!args.meetingId)
|
|
393
|
+
throw new McpError(ErrorCode.InvalidParams, "meetingId is required.");
|
|
394
|
+
const meeting = await UnifiedMeetingStore.getMeeting(args.meetingId);
|
|
395
|
+
if (!meeting)
|
|
396
|
+
throw new McpError(ErrorCode.InvalidRequest, `Meeting '${args.meetingId}' not found.`);
|
|
397
|
+
return { content: [{ type: "text", text: JSON.stringify(meeting, null, 2) }] };
|
|
398
|
+
}
|
|
399
|
+
async function handleArchiveMeeting(args) {
|
|
400
|
+
if (!args.meetingId)
|
|
401
|
+
throw new McpError(ErrorCode.InvalidParams, "meetingId is required.");
|
|
402
|
+
await UnifiedMeetingStore.archiveMeeting(args.meetingId);
|
|
403
|
+
return {
|
|
404
|
+
content: [{
|
|
405
|
+
type: "text",
|
|
406
|
+
text: JSON.stringify({
|
|
407
|
+
message: `Meeting '${args.meetingId}' archived.`,
|
|
408
|
+
meetingId: args.meetingId,
|
|
409
|
+
status: "archived"
|
|
410
|
+
}, null, 2)
|
|
411
|
+
}]
|
|
412
|
+
};
|
|
413
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple mutex lock for preventing concurrent file writes.
|
|
3
|
+
* Ensures that only one write operation can happen at a time.
|
|
4
|
+
*/
|
|
5
|
+
export class AsyncMutex {
|
|
6
|
+
locked = false;
|
|
7
|
+
queue = [];
|
|
8
|
+
async acquire() {
|
|
9
|
+
if (!this.locked) {
|
|
10
|
+
this.locked = true;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
this.queue.push(resolve);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
release() {
|
|
18
|
+
if (this.queue.length > 0) {
|
|
19
|
+
const next = this.queue.shift();
|
|
20
|
+
if (next)
|
|
21
|
+
next();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.locked = false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async withLock(fn) {
|
|
28
|
+
await this.acquire();
|
|
29
|
+
try {
|
|
30
|
+
return await fn();
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
this.release();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Nexus 助手协作指令
|
|
2
|
+
|
|
3
|
+
你现在是 **n2ns Nexus** 协作网络的一员。该系统集成了实时通信与结构化资产管理,所有操作均落地在本地文件系统。
|
|
4
|
+
|
|
5
|
+
## 🚦 你的标准动作集
|
|
6
|
+
|
|
7
|
+
### 1. 启动即签到与角色发现
|
|
8
|
+
在任何任务开始前,你**必须**了解自己的身份:
|
|
9
|
+
- **查看身份与状态**:读取 `mcp://nexus/session` 查看个人标识,读取 `mcp://nexus/status` 查看系统版本、存储模式(SQLite/JSON)及活跃会议数。
|
|
10
|
+
- **声明位置**:调用 `register_session_context(projectId)`。这会让 Nexus 知道你现在负责哪个项目,并解锁该项目的写权限。
|
|
11
|
+
|
|
12
|
+
### 2. 信息归档与项目管理 (Project Hub)
|
|
13
|
+
当你完成架构设计或技术选型后,请同步资产:
|
|
14
|
+
|
|
15
|
+
* **全量同步 (初始化/重构)**:
|
|
16
|
+
* `sync_project_assets`:**强制要求**包含完整的 `manifest` 对象和 `internalDocs`。
|
|
17
|
+
* 务必准确填写 `relations`(依赖关系),这决定了全局拓扑图的形态。
|
|
18
|
+
|
|
19
|
+
* **增量维护 (日常开发)**:
|
|
20
|
+
* `update_project`: 当只修改个别字段(如新增 API 端点、更新技术栈列表)时使用。不要每次都全量覆盖。
|
|
21
|
+
* `rename_project`: 如果项目 ID 需要变更,**必须**使用此工具,系统会自动更新所有依赖该项目的 Manifest 引用,保持拓扑完整性。
|
|
22
|
+
|
|
23
|
+
* **素材上传**:
|
|
24
|
+
* `upload_project_asset`: 将 UI 稿、架构图等转为 Base64 上传。
|
|
25
|
+
|
|
26
|
+
### 3. 全局知识库 (Global Knowledge)
|
|
27
|
+
除了项目私有文档,我们维护一套跨项目的通用知识库:
|
|
28
|
+
- `list_global_docs`: 查找现有的通用规范(如“Coding Standards”, “Deployment Flow”)。
|
|
29
|
+
- `read_global_doc`: 读取具体内容。
|
|
30
|
+
- `sync_global_doc`: 创建或更新全局文档。适用于提炼通用的最佳实践。
|
|
31
|
+
|
|
32
|
+
### 4. 即时同步 (Communication)
|
|
33
|
+
- `post_global_discussion`:任何跨项目的冲突或依赖,必须在全局频道通报。
|
|
34
|
+
- `update_global_strategy`:在达成共识后,更新最高层级的战略蓝图 (`Master Plan`)。
|
|
35
|
+
|
|
36
|
+
### 5. 会议管理 (Meeting Management) 🆕
|
|
37
|
+
当需要结构化的跨 Agent 讨论时,使用会议功能:
|
|
38
|
+
|
|
39
|
+
* **发起会议**:
|
|
40
|
+
* `start_meeting(topic)`: 创建独立的会议文件,返回 `meetingId`。所有后续消息将自动路由到此会议。
|
|
41
|
+
|
|
42
|
+
* **参与讨论**:
|
|
43
|
+
* `post_global_discussion`: 消息会自动关联到当前活跃会议(无需手动指定 `meetingId`)。
|
|
44
|
+
|
|
45
|
+
* **结束会议**:
|
|
46
|
+
* `end_meeting(meetingId?, summary?)`: 锁定会议,禁止后续写入。返回 `suggestedSyncTargets`(基于参与者推断的项目列表)。
|
|
47
|
+
|
|
48
|
+
* **查阅历史**:
|
|
49
|
+
* `list_meetings(status?)`: 查看 `active`、`closed` 或 `archived` 状态的会议列表。
|
|
50
|
+
* **快速查阅**:直接读取 `mcp://nexus/active-meeting` 资源,获取当前默认活跃会议的完整 transcript。
|
|
51
|
+
* `read_meeting(meetingId)`: 读取指定会议内容,包括 `messages` 和 `decisions`。
|
|
52
|
+
|
|
53
|
+
* **归档**:
|
|
54
|
+
* `archive_meeting(meetingId)`: 将已关闭的会议归档,仅供只读查阅。
|
|
55
|
+
|
|
56
|
+
### 6. 视角切换 (Discovery)
|
|
57
|
+
- 读取 `mcp://hub/registry`:了解公司目前有哪些其他项目。
|
|
58
|
+
- 调用 `get_global_topology`:可视化项目间的依赖关系,避免重复造轮子。
|
|
59
|
+
- 调用 `read_project`:查阅其他项目的 API 定义 (`include: "api"`) 或技术文档 (`include: "docs"`),以便对接。
|
|
60
|
+
|
|
61
|
+
## 🛡️ 角色说明
|
|
62
|
+
- **Regular**: 拥有注册、同步资产、讨论和更新各类文档的完整权限。
|
|
63
|
+
- **Moderator**: 额外拥有清理历史记录(`moderator_maintenance`)及物理删除项目资产(`moderator_delete_project`)的权限。启动时需添加 `--moderator` 参数。
|
|
64
|
+
|
|
65
|
+
## ❌ 退出机制
|
|
66
|
+
本系统不依赖 GitHub,你的所有 `sync` 操作都是对本地磁盘的原子写入。请确保在同步时提供清晰的 `internalDocs`。
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [v0.1.8] - 2025-12-30
|
|
6
|
+
|
|
7
|
+
### 🎯 Meeting Architecture (Phase 1 & 2)
|
|
8
|
+
- **Hybrid Storage Backend**: Automatic selection between **SQLite** (preferred) and **JSON Fallback**.
|
|
9
|
+
- **SQLite Engine**: Powered by `better-sqlite3` with **WAL mode** for high-concurrency and multi-process safety.
|
|
10
|
+
- **New Lifecycle Entity**: `MeetingSession` replaces monolithic chat logs with discrete sessions.
|
|
11
|
+
- **Lifecycle Tools**:
|
|
12
|
+
- `start_meeting(topic)`: Creates dedicated session with unique ID and random entropy.
|
|
13
|
+
- `end_meeting(meetingId?, summary?)`: Closes meeting, collects decisions.
|
|
14
|
+
- `archive_meeting(meetingId)`: Moves sessions to historical archives.
|
|
15
|
+
- `list_meetings(status?)`: Filtered discovery of sessions.
|
|
16
|
+
- `read_meeting(meetingId)`: Detailed retrieval of history, participants, and decisions.
|
|
17
|
+
|
|
18
|
+
### 🏗️ API & Storage Improvements
|
|
19
|
+
- **Structured JSON Responses**: Meeting tools now return machine-readable JSON for better agent integration.
|
|
20
|
+
- **Smart Auto-Routing**: Global discussion messages are automatically routed to active meetings.
|
|
21
|
+
- **ID Generation**: Robust slug generation with Base64 fallback for non-ASCII topics (Chinese/Unicode).
|
|
22
|
+
- **Concurrency Control**: Shared `AsyncMutex` utility and native SQLite locking.
|
|
23
|
+
- **Status Reporting**: `mcp://nexus/status` now reports `storage_mode` and `is_degraded` flags.
|
|
24
|
+
|
|
25
|
+
### 🧪 Quality Assurance
|
|
26
|
+
- **Comprehensive Test Suite**: Added 24+ integration and stress tests (100% Green).
|
|
27
|
+
- **Concurrency Stress Tests**: Validated data integrity under rapid message bursts.
|
|
28
|
+
- **Fallback Verification**: Confirmed system stability when native modules are unavailable.
|
|
29
|
+
|
|
30
|
+
### 🛡️ Security
|
|
31
|
+
- **Hardened Project Deletion**: Renamed `delete_project` to `moderator_delete_project` and enforced explicit moderator validation to prevent unauthorized project destruction.
|
|
32
|
+
- **Path Sanitization**: Enhanced error handling to strip absolute local file paths from MCP error messages.
|
|
33
|
+
|
|
34
|
+
### 📄 Resources & Documentation
|
|
35
|
+
- **New Resource**: Added `mcp://nexus/active-meeting` for instant access to the current meeting transcript and decisions.
|
|
36
|
+
- **Improved Tooling UX**: Documented return value structures and administrative requirements in tool definitions.
|
|
37
|
+
- **Manuals**: Updated `ASSISTANT_GUIDE.md` and both README versions with new admin tool documentation and Phase 2 best practices.
|
|
38
|
+
|
|
39
|
+
## [v0.1.7] - 2025-12-30
|
|
40
|
+
|
|
41
|
+
### ⚙️ CLI Simplification
|
|
42
|
+
- **Moderator flag**: Replaced `--moderator-id <id>` with simple `--moderator` boolean flag.
|
|
43
|
+
- Moderator: `--id Master-AI --moderator`
|
|
44
|
+
- Regular AI: `--id Assistant-AI` (no extra flag needed)
|
|
45
|
+
|
|
46
|
+
### ✅ Tests
|
|
47
|
+
- Added session resource tests for role verification (Moderator/Regular).
|
|
48
|
+
- All 17 unit tests passing.
|
|
49
|
+
|
|
50
|
+
## [v0.1.6] - 2025-12-29
|
|
51
|
+
|
|
52
|
+
### 🔒 Concurrency Safety
|
|
53
|
+
- **AsyncMutex Lock**: Implemented mutex-based concurrency control to prevent race conditions during simultaneous file writes.
|
|
54
|
+
- Protected write operations:
|
|
55
|
+
- Discussion: `addGlobalLog()`, `pruneGlobalLogs()`, `clearGlobalLogs()`
|
|
56
|
+
- Registry: `saveProjectManifest()`, `renameProject()`, `deleteProject()`
|
|
57
|
+
|
|
58
|
+
### 📦 Schema v2.0
|
|
59
|
+
- **Manifest Schema Enhancements**: Added new optional fields for enterprise coordination:
|
|
60
|
+
- `apiDependencies`: Map of projectId to version constraint (e.g., `">=v2.1"`)
|
|
61
|
+
- `gatewayCompatibility`: Gateway version compatibility string
|
|
62
|
+
- `api_versions`: Feature-level API versions
|
|
63
|
+
- `feature_tier`: Capability tier declaration (`"free"` | `"pro"` | `"enterprise"`)
|
|
64
|
+
|
|
65
|
+
## [v0.1.5] - 2025-12-29
|
|
66
|
+
|
|
67
|
+
### 🚀 Major Features
|
|
68
|
+
- **Project ID Naming Convention**: Enforced `[prefix]_[technical-name]` standard with 13 type prefixes (web_, api_, chrome_, vscode_, mcp_, android_, ios_, flutter_, desktop_, lib_, bot_, infra_, doc_).
|
|
69
|
+
- **MCP Prompts Capability**: Added `init_project_nexus` prompt for guiding AI through proper project registration workflow.
|
|
70
|
+
- **delete_project Tool**: New admin tool for complete project removal (manifest, assets, registry entry).
|
|
71
|
+
|
|
72
|
+
### 🔒 Guardrails
|
|
73
|
+
- Added `validateProjectId()` with runtime regex validation in `handleRegisterSession`, `handleSyncProjectAssets`, and `handleRenameProject`.
|
|
74
|
+
- Projects with invalid ID formats are now rejected at the API level.
|
|
75
|
+
|
|
76
|
+
### ✨ Enhancements
|
|
77
|
+
- Resource names now display project type icons (e.g., "🌐 Website: web_example.com").
|
|
78
|
+
- Handler unit tests expanded to cover delete, rename, and validation scenarios.
|
|
79
|
+
|
|
80
|
+
### 📄 Documentation
|
|
81
|
+
- Added "Project ID Conventions" section to README.md.
|
|
82
|
+
- Updated tool descriptions with Prefix Dictionary guidance.
|
|
83
|
+
|
|
84
|
+
## [v0.1.4] - 2025-12-29
|
|
85
|
+
|
|
86
|
+
### 🐛 Bug Fix
|
|
87
|
+
- Added shebang (`#!/usr/bin/env node`) to fix npx execution on Windows.
|
|
88
|
+
|
|
89
|
+
## [v0.1.3] - 2025-12-29
|
|
90
|
+
|
|
91
|
+
### 🔧 CI/CD
|
|
92
|
+
- Switched to npm Trusted Publishing (OIDC) - no more NPM_TOKEN needed.
|
|
93
|
+
- Upgraded to Node.js 22 for npm 11.5.1+ support.
|
|
94
|
+
- Added `--provenance` flag for supply chain security.
|
|
95
|
+
|
|
96
|
+
## [v0.1.2] - 2025-12-29
|
|
97
|
+
|
|
98
|
+
### 🔧 Refactoring
|
|
99
|
+
- Modularized codebase into `tools/`, `resources/`, and `storage/` modules.
|
|
100
|
+
- Reduced `index.ts` from 535 to 115 lines.
|
|
101
|
+
- Moved tests from `src/__tests__/` to top-level `tests/` directory.
|
|
102
|
+
|
|
103
|
+
### 📦 CI/CD
|
|
104
|
+
- Changed GitHub Actions trigger from `release` to tag push (`v*`).
|
|
105
|
+
|
|
106
|
+
### 📄 Documentation
|
|
107
|
+
- Added npm downloads badge.
|
|
108
|
+
- Fixed repository URLs to `n2n-nexus`.
|
|
109
|
+
|
|
110
|
+
## [v0.1.1] - 2025-12-29
|
|
111
|
+
|
|
112
|
+
### 📦 npm Release
|
|
113
|
+
- Published to npm as `@datafrog-io/n2n-nexus`.
|
|
114
|
+
- Updated README with `npx` configuration for easy MCP integration.
|
|
115
|
+
- Added CLI arguments documentation table.
|
|
116
|
+
|
|
117
|
+
## [v0.1.0] - 2025-12-29
|
|
118
|
+
|
|
119
|
+
### 🚀 Major Features
|
|
120
|
+
- **Project Asset Hub**: Centralized storage for Project Manifests, Internal Docs, and Assets (Images/Files).
|
|
121
|
+
- **Communication Channels**:
|
|
122
|
+
- `mcp://chat/global`: Real-time inter-agent messaging stream.
|
|
123
|
+
- `post_global_discussion`: Broadcast tool for coordination.
|
|
124
|
+
- **Topology Engine**:
|
|
125
|
+
- `get_global_topology`: Auto-generates dependency graphs based on manifest `relations`.
|
|
126
|
+
- **Global Knowledge Base**:
|
|
127
|
+
- New `docs/` directory structure for shared standards.
|
|
128
|
+
- Tools: `sync_global_doc`, `read_global_doc`, `list_global_docs`.
|
|
129
|
+
- **Self-Healing Storage**:
|
|
130
|
+
- Automatic repair of corrupted JSON registries or logs.
|
|
131
|
+
- Safe-defaults for missing configurations.
|
|
132
|
+
|
|
133
|
+
### 🛠️ Tooling
|
|
134
|
+
- Added `update_project` for partial manifest patches.
|
|
135
|
+
- Added `rename_project` with auto-cascading reference updates across all projects.
|
|
136
|
+
- Added `register_session_context` for IDE session binding.
|
|
137
|
+
- Added `moderator_maintenance` for log pruning.
|
|
138
|
+
|
|
139
|
+
### 📚 Documentation
|
|
140
|
+
- Updated `README.md` with complete architecture diagrams and data persistence details.
|
|
141
|
+
- Added `ASSISTANT_GUIDE.md` for AI-to-AI operational protocols.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# 更新日志
|
|
2
|
+
|
|
3
|
+
本项目的所有重要变更都将记录在此文件中。
|
|
4
|
+
|
|
5
|
+
## [v0.1.8] - 2025-12-30
|
|
6
|
+
|
|
7
|
+
### 🎯 会议架构 (Phase 1 & 2)
|
|
8
|
+
- **混合存储后端**: 自动选择 **SQLite** (优先) 或 **JSON Fallback**。
|
|
9
|
+
- **SQLite 引擎**: 基于 `better-sqlite3` 并启用 **WAL 模式**,支持高并发和多进程安全访问。
|
|
10
|
+
- **新生命周期实体**: `MeetingSession` 取代单体日志,实现结构化会议管理。
|
|
11
|
+
- **生命周期工具**:
|
|
12
|
+
- `start_meeting(topic)`: 创建独立会议,具备防碰撞 ID 生成逻辑。
|
|
13
|
+
- `end_meeting(meetingId?, summary?)`: 关闭会议并自动汇总决策。
|
|
14
|
+
- `archive_meeting(meetingId)`: 将关闭的会议移至历史存档数据层。
|
|
15
|
+
- `list_meetings(status?)`: 按状态筛选浏览会议。
|
|
16
|
+
- `read_meeting(meetingId)`: 详细读取历史记录、参会者和决策。
|
|
17
|
+
|
|
18
|
+
### 🏗️ API 与存储优化
|
|
19
|
+
- **结构化 JSON 响应**: 会议工具现在返回机器可读的 JSON,方便 Agent 集成。
|
|
20
|
+
- **智能自动路由**: 全局讨论消息将自动路由至当前活跃的会议。
|
|
21
|
+
- **ID 生成增强**: 为非 ASCII 主题 (如中文) 增加 Base64 回退和随机后缀,确保 ID 唯一性。
|
|
22
|
+
- **并发控制**: 提取通用的 `AsyncMutex` 工具类,优化 SQLite 原生锁支持。
|
|
23
|
+
- **状态报告**: `mcp://nexus/status` 现在报告 `storage_mode` 和 `is_degraded` (降级) 标志。
|
|
24
|
+
|
|
25
|
+
### 🧪 质量保障
|
|
26
|
+
- **全方位测试套件**: 新增 24+ 项集成与压力测试 (100% 通过)。
|
|
27
|
+
- **并发压力测试**: 验证在高频消息并发情况下的数据完整性。
|
|
28
|
+
- **回退验证**: 确认系统在缺失原生模块时能稳定回退至 JSON 模式。
|
|
29
|
+
|
|
30
|
+
### 🛡️ 安全与权限 (Security)
|
|
31
|
+
- **工具权限加固**: 将 `delete_project` 重命名为 `moderator_delete_project`,并强制执行管理员身份验证,防止未授权删除项目。
|
|
32
|
+
- **错误信息脱敏**: 进一步优化了错误处理器,确保不向 AI 暴露本地绝对路径。
|
|
33
|
+
|
|
34
|
+
### 📄 资源与文档 (Resources & Docs)
|
|
35
|
+
- **新资源接口**: 增加了 `mcp://nexus/active-meeting` 资源,支持一键读取当前会议的完整 transcript 和决策。
|
|
36
|
+
- **README 补全**: 在中英文文档中同步更新了管理工具 (`Admin`) 章节,增加了新增工具的用法说明。
|
|
37
|
+
- **开发指南**: 更新了 `ASSISTANT_GUIDE.md`,提供了会议管理和同步的最佳实践。
|
|
38
|
+
|
|
39
|
+
## [v0.1.7] - 2025-12-30
|
|
40
|
+
|
|
41
|
+
### ⚙️ CLI 简化
|
|
42
|
+
- **Moderator 标志**: 将 `--moderator-id <id>` 替换为简单的 `--moderator` 布尔标志。
|
|
43
|
+
- 主持者: `--id Master-AI --moderator`
|
|
44
|
+
- 普通 AI: `--id Assistant-AI` (无需额外参数)
|
|
45
|
+
|
|
46
|
+
### ✅ 测试
|
|
47
|
+
- 新增 session 资源角色验证测试 (Moderator/Regular)。
|
|
48
|
+
- 全部 17 个单元测试通过。
|
|
49
|
+
|
|
50
|
+
## [v0.1.6] - 2025-12-29
|
|
51
|
+
|
|
52
|
+
### 🔒 并发安全
|
|
53
|
+
- **AsyncMutex 互斥锁**: 实现基于互斥锁的并发控制,防止多 AI 同时写入时的竞态条件。
|
|
54
|
+
- 受保护的写入操作:
|
|
55
|
+
- Discussion 文件: `addGlobalLog()`, `pruneGlobalLogs()`, `clearGlobalLogs()`
|
|
56
|
+
- Registry 文件: `saveProjectManifest()`, `renameProject()`, `deleteProject()`
|
|
57
|
+
|
|
58
|
+
### 📦 Schema v2.0
|
|
59
|
+
- **Manifest Schema 增强**: 新增可选字段,支持企业级协同:
|
|
60
|
+
- `apiDependencies`: 项目依赖版本映射 (如 `">=v2.1"`)
|
|
61
|
+
- `gatewayCompatibility`: 网关版本兼容性字符串
|
|
62
|
+
- `api_versions`: 功能级 API 版本
|
|
63
|
+
- `feature_tier`: 能力等级声明 (`"free"` | `"pro"` | `"enterprise"`)
|
|
64
|
+
|
|
65
|
+
## [v0.1.5] - 2025-12-29
|
|
66
|
+
|
|
67
|
+
### 🚀 主要功能
|
|
68
|
+
- **项目 ID 命名规范**: 强制执行 `[prefix]_[technical-name]` 格式,共 13 种类型前缀 (web_, api_, chrome_, vscode_, mcp_, android_, ios_, flutter_, desktop_, lib_, bot_, infra_, doc_)。
|
|
69
|
+
- **MCP Prompts 能力**: 新增 `init_project_nexus` Prompt,引导 AI 完成规范化项目注册流程。
|
|
70
|
+
- **delete_project 工具**: 新增管理员工具,用于完全删除项目(包括清单、资产、注册表条目)。
|
|
71
|
+
|
|
72
|
+
### 🔒 防护栏 (Guardrails)
|
|
73
|
+
- 新增 `validateProjectId()` 函数,在 `handleRegisterSession`、`handleSyncProjectAssets`、`handleRenameProject` 中进行运行时正则校验。
|
|
74
|
+
- 非法 ID 格式的项目将在 API 层被拒绝。
|
|
75
|
+
|
|
76
|
+
### ✨ 增强
|
|
77
|
+
- 资源名称现在显示项目类型图标(如 "🌐 Website: web_example.com")。
|
|
78
|
+
- Handler 单元测试扩展,覆盖删除、重命名和校验场景。
|
|
79
|
+
|
|
80
|
+
### 📄 文档
|
|
81
|
+
- 在 README.md 中新增 "Project ID Conventions" 章节。
|
|
82
|
+
- 更新工具描述,加入前缀字典 (Prefix Dictionary) 指引。
|
|
83
|
+
|
|
84
|
+
## [v0.1.4] - 2025-12-29
|
|
85
|
+
|
|
86
|
+
### 🐛 Bug 修复
|
|
87
|
+
- 添加 shebang (`#!/usr/bin/env node`) 以修复 Windows 上 npx 执行问题。
|
|
88
|
+
|
|
89
|
+
## [v0.1.3] - 2025-12-29
|
|
90
|
+
|
|
91
|
+
### 🔧 CI/CD
|
|
92
|
+
- 切换至 npm Trusted Publishing (OIDC) - 无需 NPM_TOKEN。
|
|
93
|
+
- 升级至 Node.js 22 以支持 npm 11.5.1+。
|
|
94
|
+
- 添加 `--provenance` 标志以增强供应链安全。
|
|
95
|
+
|
|
96
|
+
## [v0.1.2] - 2025-12-29
|
|
97
|
+
|
|
98
|
+
### 🔧 重构
|
|
99
|
+
- 代码模块化:拆分为 `tools/`、`resources/`、`storage/` 模块。
|
|
100
|
+
- `index.ts` 从 535 行精简至 115 行。
|
|
101
|
+
- 测试文件从 `src/__tests__/` 移至顶层 `tests/` 目录。
|
|
102
|
+
|
|
103
|
+
### 📦 CI/CD
|
|
104
|
+
- GitHub Actions 触发方式从 `release` 改为 tag 推送 (`v*`)。
|
|
105
|
+
|
|
106
|
+
### 📄 文档
|
|
107
|
+
- 新增 npm 下载量徽章。
|
|
108
|
+
- 修复仓库 URL 为 `n2n-nexus`。
|
|
109
|
+
|
|
110
|
+
## [v0.1.1] - 2025-12-29
|
|
111
|
+
|
|
112
|
+
### 📦 npm 发布
|
|
113
|
+
- 发布到 npm:`@datafrog-io/n2n-nexus`。
|
|
114
|
+
- 更新 README,添加 `npx` 配置方式以便快速集成 MCP。
|
|
115
|
+
- 新增 CLI 命令行参数说明表格。
|
|
116
|
+
|
|
117
|
+
## [v0.1.0] - 2025-12-29
|
|
118
|
+
|
|
119
|
+
### 🚀 主要功能
|
|
120
|
+
- **项目资产中心 (Project Asset Hub)**: 集中存储项目清单 (Manifest)、内部文档 (Internal Docs) 和资产 (图片/文件)。
|
|
121
|
+
- **通信频道 (Communication Channels)**:
|
|
122
|
+
- `mcp://chat/global`: 实时跨 Agent 消息流。
|
|
123
|
+
- `post_global_discussion`: 用于协调的广播工具。
|
|
124
|
+
- **拓扑引擎 (Topology Engine)**:
|
|
125
|
+
- `get_global_topology`: 基于 Manifest 中的 `relations` 自动生成依赖关系图。
|
|
126
|
+
- **全局知识库 (Global Knowledge Base)**:
|
|
127
|
+
- 新增 `docs/` 目录结构,用于存储共享标准。
|
|
128
|
+
- 工具: `sync_global_doc`, `read_global_doc`, `list_global_docs`.
|
|
129
|
+
- **自我修复存储 (Self-Healing Storage)**:
|
|
130
|
+
- 自动修复损坏的 JSON 注册表或日志文件。
|
|
131
|
+
- 缺失配置时的安全默认值。
|
|
132
|
+
|
|
133
|
+
### 🛠️ 工具集更新
|
|
134
|
+
- 新增 `update_project`: 支持 Manifest 局部字段更新。
|
|
135
|
+
- 新增 `rename_project`: 支持项目重命名,并自动级联更新所有引用。
|
|
136
|
+
- 新增 `register_session_context`: 用于 IDE 会话绑定。
|
|
137
|
+
- 新增 `moderator_maintenance`: 用于日志修剪。
|
|
138
|
+
|
|
139
|
+
### 📚 文档
|
|
140
|
+
- 更新 `README.md`: 补充了完整的架构图和数据持久化细节。
|
|
141
|
+
- 新增 `ASSISTANT_GUIDE.md`: AI 对 AI 的操作协议指南。
|