@ppdocs/mcp 3.3.0 → 3.4.0
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.
|
@@ -29,6 +29,8 @@ export declare class PpdocsApiClient {
|
|
|
29
29
|
saveReference(reference: Reference): Promise<boolean>;
|
|
30
30
|
deleteReference(refId: string): Promise<boolean>;
|
|
31
31
|
readReferenceFile(path: string): Promise<string>;
|
|
32
|
+
/** 复制本地文件到参考文件库, 返回相对路径列表 */
|
|
33
|
+
copyReferenceFiles(paths: string[], targetDir?: string): Promise<string[]>;
|
|
32
34
|
listTasks(status?: 'active' | 'archived'): Promise<TaskSummary[]>;
|
|
33
35
|
getTask(taskId: string, mode?: 'smart' | 'full'): Promise<Task | null>;
|
|
34
36
|
createTask(task: {
|
|
@@ -152,6 +152,13 @@ export class PpdocsApiClient {
|
|
|
152
152
|
async readReferenceFile(path) {
|
|
153
153
|
return this.request(`/refs/files/${cleanPath(path)}`);
|
|
154
154
|
}
|
|
155
|
+
/** 复制本地文件到参考文件库, 返回相对路径列表 */
|
|
156
|
+
async copyReferenceFiles(paths, targetDir = '.') {
|
|
157
|
+
return this.request('/refs/copy-in', {
|
|
158
|
+
method: 'POST',
|
|
159
|
+
body: JSON.stringify({ paths, target_dir: targetDir }),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
155
162
|
// ============ 任务管理 ============
|
|
156
163
|
async listTasks(status) {
|
|
157
164
|
const query = status ? `?status=${status}` : '';
|
package/dist/tools/discussion.js
CHANGED
|
@@ -103,9 +103,9 @@ function formatDetailView(d) {
|
|
|
103
103
|
}
|
|
104
104
|
export function registerDiscussionTools(server, ctx) {
|
|
105
105
|
const client = () => getClient();
|
|
106
|
-
server.tool('kg_discuss', '💬 跨项目讨论 — action
|
|
107
|
-
action: z.enum(['list', 'read', 'create', 'reply', 'complete', 'close', 'delete', 'history'])
|
|
108
|
-
.describe('
|
|
106
|
+
server.tool('kg_discuss', '💬 跨项目讨论 — action 可选: 省略时无 id/ids 则列出讨论,有 id/ids 则读取详情。亦可显式指定 list|read|create|reply|complete|close|delete|history。权限: 仅成员可读写,仅发起人可删除/归档', {
|
|
107
|
+
action: z.enum(['list', 'read', 'create', 'reply', 'complete', 'close', 'delete', 'history']).optional()
|
|
108
|
+
.describe('操作类型(可选:省略时根据 id/ids 自动为 read,否则为 list)'),
|
|
109
109
|
id: z.string().optional()
|
|
110
110
|
.describe('讨论哈希ID (read/reply/complete/close/delete)'),
|
|
111
111
|
ids: z.array(z.string()).optional()
|
|
@@ -128,7 +128,13 @@ export function registerDiscussionTools(server, ctx) {
|
|
|
128
128
|
const decoded = decodeObjectStrings(args);
|
|
129
129
|
const me = sender(ctx);
|
|
130
130
|
const myPid = ctx.projectId;
|
|
131
|
-
|
|
131
|
+
// 智能默认:未指定 action 时,有 id/ids → read,否则 → list
|
|
132
|
+
let action = decoded.action;
|
|
133
|
+
if (!action) {
|
|
134
|
+
const hasIds = Boolean(decoded.id) || (Array.isArray(decoded.ids) && decoded.ids.length > 0);
|
|
135
|
+
action = hasIds ? 'read' : 'list';
|
|
136
|
+
}
|
|
137
|
+
switch (action) {
|
|
132
138
|
// ============ 公开操作 ============
|
|
133
139
|
case 'list': {
|
|
134
140
|
const active = await client().discussionList();
|
|
@@ -249,7 +255,7 @@ export function registerDiscussionTools(server, ctx) {
|
|
|
249
255
|
return wrap(`✅ 讨论已删除 (ID: ${decoded.id})`);
|
|
250
256
|
}
|
|
251
257
|
default:
|
|
252
|
-
return wrap(`❌ 未知 action: ${
|
|
258
|
+
return wrap(`❌ 未知 action: ${action}`);
|
|
253
259
|
}
|
|
254
260
|
}));
|
|
255
261
|
}
|
package/dist/tools/refs.js
CHANGED
|
@@ -91,6 +91,11 @@ export function registerReferenceTools(server) {
|
|
|
91
91
|
return wrap('❌ save 需要 title');
|
|
92
92
|
const existing = await client().getReference(decoded.id);
|
|
93
93
|
const now = new Date().toISOString();
|
|
94
|
+
// 直接传递原始路径给后端, Rust save_reference 会自动:
|
|
95
|
+
// 1. 检测绝对路径文件
|
|
96
|
+
// 2. 复制到公共文件池/外部参考/{项目名}/
|
|
97
|
+
// 3. 复制到 ref-files/ (供 read_file API 读取)
|
|
98
|
+
// 4. 替换为相对路径保存
|
|
94
99
|
await client().saveReference({
|
|
95
100
|
id: decoded.id,
|
|
96
101
|
title: decoded.title,
|