@seastudio/sdk 3.7.2 → 4.0.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.
- package/dist/chunk-2W5YYT5U.js +959 -0
- package/dist/{chunk-XH5RBIDC.js → chunk-7X4BSYXP.js} +1 -1
- package/dist/chunk-N2R5CFQG.cjs +991 -0
- package/dist/{chunk-YJJDS46Z.cjs → chunk-N3KDYKNM.cjs} +4 -4
- package/dist/{chunk-UZ6SEVW3.cjs → chunk-TKROLSLX.cjs} +2 -1
- package/dist/{chunk-XWORXNCU.js → chunk-UZWEOUCK.js} +2 -1
- package/dist/index.cjs +38 -38
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/mcp/index.cjs +24 -24
- package/dist/mcp/index.d.cts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +2 -2
- package/dist/mcp/seastudio/index.cjs +32 -32
- package/dist/mcp/seastudio/index.d.cts +21 -29
- package/dist/mcp/seastudio/index.d.ts +21 -29
- package/dist/mcp/seastudio/index.js +1 -1
- package/dist/ui/index.cjs +14 -14
- package/dist/ui/index.d.cts +2 -1
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-F4DUBO7S.cjs +0 -1852
- package/dist/chunk-MUF4S4BF.js +0 -1820
|
@@ -0,0 +1,959 @@
|
|
|
1
|
+
import { getDefaultClient } from './chunk-TJ3CGHWJ.js';
|
|
2
|
+
|
|
3
|
+
// src/mcp/seastudio/tools/file.ts
|
|
4
|
+
function annotateTool(tool, annotations, outputSchema) {
|
|
5
|
+
return {
|
|
6
|
+
...tool,
|
|
7
|
+
annotations,
|
|
8
|
+
...outputSchema ? { outputSchema } : {}
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
var rootedPathEvidenceOutputSchema = {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
rootId: { type: "string" },
|
|
15
|
+
path: { type: "string" }
|
|
16
|
+
},
|
|
17
|
+
required: ["rootId", "path"]
|
|
18
|
+
};
|
|
19
|
+
var rootedWriteEvidenceOutputSchema = {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
rootId: { type: "string" },
|
|
23
|
+
path: { type: "string" },
|
|
24
|
+
written: { type: "boolean" }
|
|
25
|
+
},
|
|
26
|
+
required: ["rootId", "path", "written"]
|
|
27
|
+
};
|
|
28
|
+
var dualPathEvidenceOutputSchema = {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
sourceRootId: { type: "string" },
|
|
32
|
+
sourcePath: { type: "string" },
|
|
33
|
+
destRootId: { type: "string" },
|
|
34
|
+
destPath: { type: "string" }
|
|
35
|
+
},
|
|
36
|
+
required: ["sourceRootId", "sourcePath", "destRootId", "destPath"]
|
|
37
|
+
};
|
|
38
|
+
var batchFlattenCopyEvidenceOutputSchema = {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
sourceRootId: { type: "string" },
|
|
42
|
+
sourcePath: { type: "string" },
|
|
43
|
+
destRootId: { type: "string" },
|
|
44
|
+
destPath: { type: "string" },
|
|
45
|
+
copiedCount: { type: "number" },
|
|
46
|
+
totalCount: { type: "number" },
|
|
47
|
+
errors: { type: "array", items: { type: "object", additionalProperties: true } }
|
|
48
|
+
},
|
|
49
|
+
required: ["sourceRootId", "sourcePath", "destRootId", "destPath", "copiedCount", "totalCount", "errors"]
|
|
50
|
+
};
|
|
51
|
+
var fileDownloadEvidenceOutputSchema = {
|
|
52
|
+
type: "object",
|
|
53
|
+
properties: {
|
|
54
|
+
location: { type: "string", enum: ["workspace", "absolute"] },
|
|
55
|
+
rootId: { type: "string" },
|
|
56
|
+
absoluteDir: { type: "string" },
|
|
57
|
+
path: { type: "string" },
|
|
58
|
+
savedPath: { type: "string" },
|
|
59
|
+
size: { type: "number" },
|
|
60
|
+
mime: { type: "string" }
|
|
61
|
+
},
|
|
62
|
+
required: ["location", "path", "savedPath", "size"]
|
|
63
|
+
};
|
|
64
|
+
var fileUrlEvidenceOutputSchema = {
|
|
65
|
+
type: "object",
|
|
66
|
+
properties: {
|
|
67
|
+
rootId: { type: "string" },
|
|
68
|
+
path: { type: "string" },
|
|
69
|
+
url: { type: "string" },
|
|
70
|
+
filename: { type: "string" },
|
|
71
|
+
size: { type: "number" },
|
|
72
|
+
checksum: { type: "string" }
|
|
73
|
+
},
|
|
74
|
+
required: ["rootId", "path", "url", "filename", "size"]
|
|
75
|
+
};
|
|
76
|
+
var shellSessionSnapshotEvidenceOutputSchema = {
|
|
77
|
+
type: "object",
|
|
78
|
+
properties: {
|
|
79
|
+
sessionId: { type: "string" },
|
|
80
|
+
shell: { type: "string", enum: ["bash", "pwsh", "cmd", "sh"] },
|
|
81
|
+
cwd: { type: "string" },
|
|
82
|
+
pid: { type: "number" },
|
|
83
|
+
alive: { type: "boolean" },
|
|
84
|
+
openedAt: { type: "number" },
|
|
85
|
+
label: { type: "string" },
|
|
86
|
+
pluginId: { type: "string" },
|
|
87
|
+
projectId: { type: "string" },
|
|
88
|
+
agentInstanceId: { type: "string" },
|
|
89
|
+
pendingCommandId: { type: "string" },
|
|
90
|
+
lastCommandId: { type: "string" },
|
|
91
|
+
lastExitCode: { type: "number" },
|
|
92
|
+
lastDurationMs: { type: "number" },
|
|
93
|
+
entryCount: { type: "number" },
|
|
94
|
+
droppedCount: { type: "number" }
|
|
95
|
+
},
|
|
96
|
+
required: ["sessionId", "shell", "pid", "alive", "openedAt", "entryCount", "droppedCount"]
|
|
97
|
+
};
|
|
98
|
+
var shellSessionOpenEvidenceOutputSchema = {
|
|
99
|
+
type: "object",
|
|
100
|
+
properties: {
|
|
101
|
+
sessionId: { type: "string" },
|
|
102
|
+
shell: { type: "string", enum: ["bash", "pwsh", "cmd", "sh"] },
|
|
103
|
+
cwd: { type: "string" },
|
|
104
|
+
pid: { type: "number" },
|
|
105
|
+
openedAt: { type: "number" }
|
|
106
|
+
},
|
|
107
|
+
required: ["sessionId", "shell", "pid", "openedAt"]
|
|
108
|
+
};
|
|
109
|
+
var shellSessionRunEvidenceOutputSchema = {
|
|
110
|
+
type: "object",
|
|
111
|
+
properties: {
|
|
112
|
+
sessionId: { type: "string" },
|
|
113
|
+
commandId: { type: "string" },
|
|
114
|
+
startedAt: { type: "number" },
|
|
115
|
+
running: { type: "boolean" }
|
|
116
|
+
},
|
|
117
|
+
required: ["sessionId", "commandId", "startedAt", "running"]
|
|
118
|
+
};
|
|
119
|
+
var shellSessionSignalEvidenceOutputSchema = {
|
|
120
|
+
type: "object",
|
|
121
|
+
properties: {
|
|
122
|
+
sessionId: { type: "string" },
|
|
123
|
+
signal: { type: "string", enum: ["INT", "TERM", "KILL"] },
|
|
124
|
+
ok: { type: "boolean" },
|
|
125
|
+
deliveredAt: { type: "number" }
|
|
126
|
+
},
|
|
127
|
+
required: ["sessionId", "signal", "ok", "deliveredAt"]
|
|
128
|
+
};
|
|
129
|
+
var shellSessionCloseEvidenceOutputSchema = {
|
|
130
|
+
type: "object",
|
|
131
|
+
properties: {
|
|
132
|
+
sessionId: { type: "string" },
|
|
133
|
+
closed: { type: "boolean" },
|
|
134
|
+
exitCode: { type: "number" }
|
|
135
|
+
},
|
|
136
|
+
required: ["sessionId", "closed"]
|
|
137
|
+
};
|
|
138
|
+
var rootIdParam = {
|
|
139
|
+
type: "string",
|
|
140
|
+
description: "\u76EE\u6807\u9879\u76EE\u6839\uFF1A'workspace' \u8868\u793A\u5F53\u524D\u6FC0\u6D3B\u9879\u76EE\uFF1B'proj-<projectId>' \u8868\u793A\u6309 id \u5BFB\u5740\u67D0\u4E2A\u9879\u76EE"
|
|
141
|
+
};
|
|
142
|
+
var pathParam = {
|
|
143
|
+
type: "string",
|
|
144
|
+
description: "\u76F8\u5BF9\u4E8E rootId \u7684\u6587\u4EF6\u6216\u76EE\u5F55\u8DEF\u5F84\u3002"
|
|
145
|
+
};
|
|
146
|
+
var fileTools = [
|
|
147
|
+
annotateTool({
|
|
148
|
+
name: "seastudio-filesystem_read",
|
|
149
|
+
description: "\u8BFB\u53D6\u548C\u67E5\u8BE2\u9879\u76EE\u6587\u4EF6\u7CFB\u7EDF\uFF0C\u4E0D\u4FEE\u6539\u6587\u4EF6\u3002\u4F7F\u7528 action \u9009\u62E9 getSelected\u3001read\u3001readBinary\u3001list\u3001tree\u3001exists\u3001info\u3001search\u3001codeSearch \u6216 batchFlattenPreview\u3002",
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
action: {
|
|
154
|
+
type: "string",
|
|
155
|
+
enum: ["getSelected", "read", "readBinary", "list", "tree", "exists", "info", "search", "codeSearch", "batchFlattenPreview"],
|
|
156
|
+
description: "\u8BFB\u53D6\u52A8\u4F5C\uFF1A\u83B7\u53D6\u5F53\u524D\u9009\u62E9\u3001\u8BFB\u53D6\u6587\u672C/\u4E8C\u8FDB\u5236\u3001\u5217\u76EE\u5F55\u3001\u67E5\u4FE1\u606F\u6216\u641C\u7D22\u3002"
|
|
157
|
+
},
|
|
158
|
+
rootId: rootIdParam,
|
|
159
|
+
path: pathParam,
|
|
160
|
+
sourceRootId: rootIdParam,
|
|
161
|
+
sourcePath: { type: "string", description: "\u6279\u91CF\u5E73\u94FA\u9884\u89C8\u7684\u6E90\u76EE\u5F55\u8DEF\u5F84\u3002" },
|
|
162
|
+
encoding: { type: "string", description: "\u6587\u672C\u7F16\u7801\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4 'utf-8'\uFF09\u3002" },
|
|
163
|
+
offset: { type: "number", description: "\u8BFB\u53D6\u8D77\u59CB\u884C\u504F\u79FB\uFF08\u53EF\u9009\uFF09\u3002" },
|
|
164
|
+
limit: { type: "number", description: "\u8BFB\u53D6\u884C\u6570\u9650\u5236\uFF08\u53EF\u9009\uFF09\u3002" },
|
|
165
|
+
maxDepth: { type: "number", description: "tree \u6700\u5927\u9012\u5F52\u6DF1\u5EA6\uFF08\u53EF\u9009\uFF09\u3002" },
|
|
166
|
+
maxEntries: { type: "number", description: "tree \u6700\u591A\u8FD4\u56DE\u6761\u76EE\u6570\uFF08\u53EF\u9009\uFF09\u3002" },
|
|
167
|
+
query: { type: "string", description: "search \u7684\u67E5\u8BE2\u5185\u5BB9\u3002" },
|
|
168
|
+
pattern: { type: "string", description: "codeSearch \u7684\u6B63\u5219\u6A21\u5F0F\u3002" },
|
|
169
|
+
glob: { type: "string", description: "\u641C\u7D22\u6587\u4EF6 glob\uFF08\u53EF\u9009\uFF09\u3002" },
|
|
170
|
+
headLimit: { type: "number", description: "\u641C\u7D22\u7ED3\u679C\u6570\u91CF\u9650\u5236\uFF08\u53EF\u9009\uFF09\u3002" }
|
|
171
|
+
},
|
|
172
|
+
required: ["action"]
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
operationKind: "read",
|
|
176
|
+
requiresExecutionEvidence: false,
|
|
177
|
+
rawDomain: "filesystem"
|
|
178
|
+
}),
|
|
179
|
+
annotateTool({
|
|
180
|
+
name: "seastudio-filesystem_mutate",
|
|
181
|
+
description: "\u6279\u91CF\u6267\u884C\u6587\u4EF6\u5199\u5165\u3001\u5220\u9664\u3001\u79FB\u52A8\u3001\u590D\u5236\u3001\u56DE\u6536\u7AD9\u7B49\u4F1A\u4FEE\u6539\u9879\u76EE\u7684\u64CD\u4F5C\u3002operations \u6309\u987A\u5E8F\u6267\u884C\uFF0C\u9ED8\u8BA4\u9047\u5230\u9519\u8BEF\u505C\u6B62\u3002",
|
|
182
|
+
inputSchema: {
|
|
183
|
+
type: "object",
|
|
184
|
+
properties: {
|
|
185
|
+
operations: {
|
|
186
|
+
type: "array",
|
|
187
|
+
description: "\u6587\u4EF6\u53D8\u66F4\u64CD\u4F5C\u5217\u8868\u3002",
|
|
188
|
+
items: {
|
|
189
|
+
type: "object",
|
|
190
|
+
properties: {
|
|
191
|
+
op: {
|
|
192
|
+
type: "string",
|
|
193
|
+
enum: ["write", "writeBinary", "delete", "mkdir", "rename", "move", "copyTo", "trash", "batchFlattenCopy"],
|
|
194
|
+
description: "\u8981\u6267\u884C\u7684\u6587\u4EF6\u53D8\u66F4\u7C7B\u578B\u3002"
|
|
195
|
+
},
|
|
196
|
+
rootId: rootIdParam,
|
|
197
|
+
path: pathParam,
|
|
198
|
+
content: { type: "string", description: "write \u7684\u6587\u672C\u5185\u5BB9\u3002" },
|
|
199
|
+
base64: { type: "string", description: "writeBinary \u7684 base64 \u5185\u5BB9\u3002" },
|
|
200
|
+
newName: { type: "string", description: "rename \u7684\u65B0\u540D\u79F0\u3002" },
|
|
201
|
+
sourceRootId: rootIdParam,
|
|
202
|
+
sourcePath: { type: "string", description: "move/copyTo/batchFlattenCopy \u7684\u6E90\u8DEF\u5F84\u3002" },
|
|
203
|
+
destRootId: rootIdParam,
|
|
204
|
+
destPath: { type: "string", description: "move/copyTo/batchFlattenCopy \u7684\u76EE\u6807\u8DEF\u5F84\u3002" },
|
|
205
|
+
taskId: { type: "string", description: "\u6279\u91CF\u4EFB\u52A1 ID\uFF08\u53EF\u9009\uFF0C\u7528\u4E8E\u8FDB\u5EA6\u901A\u77E5\uFF09\u3002" }
|
|
206
|
+
},
|
|
207
|
+
required: ["op"]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
stopOnError: { type: "boolean", description: "\u662F\u5426\u9047\u5230\u9996\u4E2A\u9519\u8BEF\u5C31\u505C\u6B62\u540E\u7EED operations\uFF0C\u9ED8\u8BA4 true\u3002" }
|
|
211
|
+
},
|
|
212
|
+
required: ["operations"]
|
|
213
|
+
}
|
|
214
|
+
}, {
|
|
215
|
+
operationKind: "mutate",
|
|
216
|
+
requiresExecutionEvidence: true,
|
|
217
|
+
rawDomain: "workspace"
|
|
218
|
+
}),
|
|
219
|
+
annotateTool({
|
|
220
|
+
name: "seastudio-filesystem_transfer",
|
|
221
|
+
description: "\u5904\u7406\u6587\u4EF6 URL\u3001\u8FDC\u7A0B\u4E0B\u8F7D\u3001\u590D\u5236\u7C98\u8D34\u548C\u526A\u8D34\u677F\u7B49\u7CFB\u7EDF\u6216\u5916\u90E8\u4EA4\u4E92\u3002\u4F7F\u7528 action \u9009\u62E9 getUrl\u3001download\u3001copy\u3001paste\u3001clipboardCheck \u6216 copyPath\u3002",
|
|
222
|
+
inputSchema: {
|
|
223
|
+
type: "object",
|
|
224
|
+
properties: {
|
|
225
|
+
action: {
|
|
226
|
+
type: "string",
|
|
227
|
+
enum: ["getUrl", "download", "copy", "paste", "clipboardCheck", "copyPath"],
|
|
228
|
+
description: "\u6587\u4EF6\u4F20\u8F93\u6216\u526A\u8D34\u677F\u52A8\u4F5C\u3002"
|
|
229
|
+
},
|
|
230
|
+
rootId: rootIdParam,
|
|
231
|
+
path: pathParam,
|
|
232
|
+
url: { type: "string", description: "download \u7684\u8FDC\u7A0B\u6587\u4EF6 URL\u3002" },
|
|
233
|
+
absoluteDir: { type: "string", description: "download \u7684\u672C\u5730\u7EDD\u5BF9\u4FDD\u5B58\u76EE\u5F55\uFF08\u53EF\u9009\uFF09\u3002" },
|
|
234
|
+
filenameHint: { type: "string", description: "download \u7684\u6587\u4EF6\u540D\u63D0\u793A\uFF08\u53EF\u9009\uFF09\u3002" }
|
|
235
|
+
},
|
|
236
|
+
required: ["action"]
|
|
237
|
+
}
|
|
238
|
+
}, {
|
|
239
|
+
operationKind: "system",
|
|
240
|
+
requiresExecutionEvidence: true,
|
|
241
|
+
rawDomain: "filesystem"
|
|
242
|
+
})
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
// src/mcp/seastudio/tools/shell.ts
|
|
246
|
+
var shellActionParam = {
|
|
247
|
+
type: "string",
|
|
248
|
+
enum: ["auto", "bash", "pwsh", "cmd", "sh"],
|
|
249
|
+
description: "shell \u7C7B\u578B\uFF0C\u9ED8\u8BA4 auto\uFF08Win\u2192pwsh\uFF0CPOSIX\u2192bash\uFF09"
|
|
250
|
+
};
|
|
251
|
+
var shellTools = [
|
|
252
|
+
annotateTool({
|
|
253
|
+
name: "seastudio-shell_session_read",
|
|
254
|
+
description: "\u8BFB\u53D6 shell session \u5217\u8868\u3001\u72B6\u6001\u3001\u547D\u4EE4\u5B8C\u6210\u72B6\u6001\u548C\u8F93\u51FA\u6D41\u3002\u4F7F\u7528 action \u9009\u62E9 list\u3001get\u3001wait \u6216 getEntries\u3002",
|
|
255
|
+
inputSchema: {
|
|
256
|
+
type: "object",
|
|
257
|
+
properties: {
|
|
258
|
+
action: {
|
|
259
|
+
type: "string",
|
|
260
|
+
enum: ["list", "get", "wait", "getEntries"],
|
|
261
|
+
description: "\u8BFB\u53D6\u52A8\u4F5C\uFF1A\u5217\u51FA sessions\u3001\u83B7\u53D6\u5FEB\u7167\u3001\u7B49\u5F85\u547D\u4EE4\u5B8C\u6210\u6216\u589E\u91CF\u8BFB\u53D6\u8F93\u51FA\u3002"
|
|
262
|
+
},
|
|
263
|
+
sessionId: { type: "string", description: "shell_session_control open \u8FD4\u56DE\u7684 sessionId\u3002" },
|
|
264
|
+
commandId: { type: "string", description: "shell_session_control run \u8FD4\u56DE\u7684 commandId\u3002" },
|
|
265
|
+
timeoutMs: { type: "number", description: "wait \u7684\u53EF\u9009\u7B49\u5F85\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09\u3002" },
|
|
266
|
+
sinceId: { type: "number", description: "getEntries \u53EA\u8FD4\u56DE id > sinceId \u7684 entries\uFF08\u9ED8\u8BA4 0\uFF09\u3002" },
|
|
267
|
+
limit: { type: "number", description: "getEntries \u672C\u6B21\u6700\u591A\u8FD4\u56DE\u591A\u5C11\u6761\u3002" }
|
|
268
|
+
},
|
|
269
|
+
required: ["action"]
|
|
270
|
+
}
|
|
271
|
+
}, {
|
|
272
|
+
operationKind: "read",
|
|
273
|
+
requiresExecutionEvidence: false,
|
|
274
|
+
rawDomain: "shell"
|
|
275
|
+
}),
|
|
276
|
+
annotateTool({
|
|
277
|
+
name: "seastudio-shell_session_control",
|
|
278
|
+
description: "\u521B\u5EFA\u3001\u8FD0\u884C\u3001\u4E2D\u65AD\u3001\u6E05\u7406\u6216\u5173\u95ED shell session\u3002\u4F7F\u7528 action \u9009\u62E9 open\u3001run\u3001signal\u3001clearEntries \u6216 close\u3002",
|
|
279
|
+
inputSchema: {
|
|
280
|
+
type: "object",
|
|
281
|
+
properties: {
|
|
282
|
+
action: {
|
|
283
|
+
type: "string",
|
|
284
|
+
enum: ["open", "run", "signal", "clearEntries", "close"],
|
|
285
|
+
description: "\u63A7\u5236\u52A8\u4F5C\uFF1A\u521B\u5EFA session\u3001\u8FD0\u884C\u547D\u4EE4\u3001\u53D1\u9001\u4FE1\u53F7\u3001\u6E05\u7406\u8F93\u51FA\u6216\u5173\u95ED session\u3002"
|
|
286
|
+
},
|
|
287
|
+
sessionId: { type: "string", description: "\u5DF2\u6709 shell session ID\u3002run/signal/clearEntries/close \u5FC5\u586B\u3002" },
|
|
288
|
+
shell: shellActionParam,
|
|
289
|
+
cwd: { type: "string", description: "open \u7684\u5DE5\u4F5C\u76EE\u5F55\uFF08\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u9ED8\u8BA4\u9879\u76EE\u6839\u76EE\u5F55\uFF09\u3002" },
|
|
290
|
+
env: {
|
|
291
|
+
type: "object",
|
|
292
|
+
description: "open \u7684\u9644\u52A0\u73AF\u5883\u53D8\u91CF\uFF08\u4EC5\u5141\u8BB8\u5927\u5199\u5B57\u6BCD/\u4E0B\u5212\u7EBF\u5F00\u5934\u7684 key\uFF09\u3002",
|
|
293
|
+
additionalProperties: { type: "string" }
|
|
294
|
+
},
|
|
295
|
+
label: { type: "string", description: "open \u7684\u4F1A\u8BDD\u5907\u6CE8\uFF08\u4EC5\u7528\u4E8E\u663E\u793A\uFF09\u3002" },
|
|
296
|
+
cols: { type: "number", description: "open \u7684 PTY \u5217\u6570\uFF08\u9ED8\u8BA4 120\uFF09\u3002" },
|
|
297
|
+
rows: { type: "number", description: "open \u7684 PTY \u884C\u6570\uFF08\u9ED8\u8BA4 30\uFF09\u3002" },
|
|
298
|
+
command: { type: "string", description: "run \u8981\u5199\u5165 session \u7684 shell \u547D\u4EE4\u3002" },
|
|
299
|
+
timeoutMs: { type: "number", description: "run \u7684\u53EF\u9009\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09\u3002" },
|
|
300
|
+
signal: { type: "string", enum: ["INT", "TERM", "KILL"], description: "signal \u8981\u53D1\u9001\u7684\u4FE1\u53F7\u3002" },
|
|
301
|
+
commandId: { type: "string", description: "signal \u7684\u53EF\u9009 commandId\uFF0C\u4EC5\u7528\u4E8E\u8BB0\u5F55\u3002" },
|
|
302
|
+
force: { type: "boolean", description: "close \u65F6\u662F\u5426\u5F3A\u5236 KILL\uFF0C\u9ED8\u8BA4 false\u3002" }
|
|
303
|
+
},
|
|
304
|
+
required: ["action"]
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
operationKind: "mutate",
|
|
308
|
+
requiresExecutionEvidence: true,
|
|
309
|
+
rawDomain: "shell"
|
|
310
|
+
}, {
|
|
311
|
+
anyOf: [
|
|
312
|
+
shellSessionOpenEvidenceOutputSchema,
|
|
313
|
+
shellSessionRunEvidenceOutputSchema,
|
|
314
|
+
shellSessionSignalEvidenceOutputSchema,
|
|
315
|
+
shellSessionCloseEvidenceOutputSchema,
|
|
316
|
+
shellSessionSnapshotEvidenceOutputSchema
|
|
317
|
+
]
|
|
318
|
+
})
|
|
319
|
+
];
|
|
320
|
+
|
|
321
|
+
// src/mcp/seastudio/tools/aigc.ts
|
|
322
|
+
var seaCloudTools = [
|
|
323
|
+
annotateTool({
|
|
324
|
+
name: "seastudio-seacloud_task",
|
|
325
|
+
description: "\u67E5\u8BE2 SeaCloud \u6A21\u578B\uFF0C\u521B\u5EFA\u4E91\u7AEF\u4EFB\u52A1\u5E76\u67E5\u8BE2\u4EFB\u52A1\u72B6\u6001\u3002\u4F7F\u7528 action \u9009\u62E9 listModels\u3001createTask \u6216 queryTask\u3002",
|
|
326
|
+
inputSchema: {
|
|
327
|
+
type: "object",
|
|
328
|
+
properties: {
|
|
329
|
+
action: {
|
|
330
|
+
type: "string",
|
|
331
|
+
enum: ["listModels", "createTask", "queryTask"],
|
|
332
|
+
description: "SeaCloud \u52A8\u4F5C\u3002listModels \u53EF\u4F20 tag\uFF1BcreateTask \u9700\u8981 model/params\uFF1BqueryTask \u9700\u8981 task_id\u3002"
|
|
333
|
+
},
|
|
334
|
+
tag: { type: "string", description: 'listModels \u6309\u6807\u7B7E\u8FC7\u6EE4\u6A21\u578B\uFF08\u53EF\u9009\uFF09\uFF0C\u5982 "vidu"\u3001"musicfy"\u3001"tencent"\u3002' },
|
|
335
|
+
model: { type: "string", description: "createTask \u7684\u6A21\u578B\u540D\u79F0\uFF08\u6765\u81EA listModels \u8FD4\u56DE\u7684 model \u5B57\u6BB5\uFF09\u3002" },
|
|
336
|
+
params: { type: "object", description: "createTask \u7684\u6A21\u578B\u53C2\u6570\uFF08\u6765\u81EA listModels \u8FD4\u56DE\u7684\u53C2\u6570 schema\uFF09\u3002" },
|
|
337
|
+
dash_scope: { type: "boolean", description: "createTask \u662F\u5426\u89E3\u9664\u533A\u57DF\u9650\u5236\uFF0C\u9ED8\u8BA4 true\u3002" },
|
|
338
|
+
moderation: { type: "boolean", description: "createTask \u662F\u5426\u89E3\u9664\u529F\u80FD\u9650\u5236\uFF0C\u9ED8\u8BA4 false\u3002" },
|
|
339
|
+
task_id: { type: "string", description: "queryTask \u7684\u4EFB\u52A1 ID\uFF08\u7531 createTask \u8FD4\u56DE\uFF09\u3002" }
|
|
340
|
+
},
|
|
341
|
+
required: ["action"]
|
|
342
|
+
}
|
|
343
|
+
}, {
|
|
344
|
+
operationKind: "workflow",
|
|
345
|
+
requiresExecutionEvidence: false,
|
|
346
|
+
rawDomain: "asset"
|
|
347
|
+
})
|
|
348
|
+
];
|
|
349
|
+
|
|
350
|
+
// src/mcp/seastudio/client.ts
|
|
351
|
+
function parseToolResult(result) {
|
|
352
|
+
if (result.isError) {
|
|
353
|
+
const message = result.content.find((entry) => entry.type === "text")?.text ?? "MCP tool failed";
|
|
354
|
+
throw new Error(message);
|
|
355
|
+
}
|
|
356
|
+
if (result.structuredContent !== void 0) {
|
|
357
|
+
return result.structuredContent;
|
|
358
|
+
}
|
|
359
|
+
const text = result.content.find((entry) => entry.type === "text")?.text;
|
|
360
|
+
return text ? JSON.parse(text) : {};
|
|
361
|
+
}
|
|
362
|
+
async function callTool(name, args = {}) {
|
|
363
|
+
return getDefaultClient().callTool(name, args);
|
|
364
|
+
}
|
|
365
|
+
async function request(method, params) {
|
|
366
|
+
return getDefaultClient().request(method, params);
|
|
367
|
+
}
|
|
368
|
+
async function callToolText(name, args = {}) {
|
|
369
|
+
return getDefaultClient().callToolText(name, args);
|
|
370
|
+
}
|
|
371
|
+
function usesAbsolutePathMode(mode) {
|
|
372
|
+
return mode === "absolute";
|
|
373
|
+
}
|
|
374
|
+
function getPathBasename(path) {
|
|
375
|
+
const trimmed = path.replace(/[\\/]+$/g, "");
|
|
376
|
+
if (!trimmed) return "";
|
|
377
|
+
const parts = trimmed.split(/[\\/]/).filter(Boolean);
|
|
378
|
+
return parts[parts.length - 1] ?? "";
|
|
379
|
+
}
|
|
380
|
+
function joinWorkspacePath(dir, name) {
|
|
381
|
+
const normalizedDir = dir.replace(/\\/g, "/").replace(/\/+$/g, "");
|
|
382
|
+
const normalizedName = name.replace(/^\/+/g, "");
|
|
383
|
+
return normalizedDir ? `${normalizedDir}/${normalizedName}` : normalizedName;
|
|
384
|
+
}
|
|
385
|
+
function callFilesystemRead(action, args = {}) {
|
|
386
|
+
return callTool("seastudio-filesystem_read", { action, ...args });
|
|
387
|
+
}
|
|
388
|
+
function callFilesystemMutate(op, args = {}) {
|
|
389
|
+
return callTool("seastudio-filesystem_mutate", { operations: [{ op, ...args }] });
|
|
390
|
+
}
|
|
391
|
+
function callFilesystemTransfer(action, args = {}) {
|
|
392
|
+
return callTool("seastudio-filesystem_transfer", { action, ...args });
|
|
393
|
+
}
|
|
394
|
+
function callShellSessionRead(action, args = {}) {
|
|
395
|
+
return callTool("seastudio-shell_session_read", { action, ...args });
|
|
396
|
+
}
|
|
397
|
+
function callShellSessionControl(action, args = {}) {
|
|
398
|
+
return callTool("seastudio-shell_session_control", { action, ...args });
|
|
399
|
+
}
|
|
400
|
+
var seastudio = {
|
|
401
|
+
roots: {
|
|
402
|
+
list: () => request("roots/list")
|
|
403
|
+
},
|
|
404
|
+
project: {
|
|
405
|
+
list: () => callTool("seastudio-project_manage", { action: "list" }),
|
|
406
|
+
getActive: () => callTool("seastudio-project_manage", { action: "getActive" })
|
|
407
|
+
},
|
|
408
|
+
file: {
|
|
409
|
+
getSelected: () => callFilesystemRead("getSelected"),
|
|
410
|
+
read: (path, options) => callFilesystemRead("read", {
|
|
411
|
+
rootId: options?.rootId ?? "workspace",
|
|
412
|
+
path,
|
|
413
|
+
...typeof options?.encoding === "string" ? { encoding: options.encoding } : {},
|
|
414
|
+
...typeof options?.offset === "number" ? { offset: options.offset } : {},
|
|
415
|
+
...typeof options?.limit === "number" ? { limit: options.limit } : {}
|
|
416
|
+
}),
|
|
417
|
+
write: (path, content, options) => callFilesystemMutate("write", { rootId: options?.rootId ?? "workspace", path, content }),
|
|
418
|
+
list: (path = "", options) => callFilesystemRead("list", {
|
|
419
|
+
rootId: options?.rootId ?? "workspace",
|
|
420
|
+
path
|
|
421
|
+
}),
|
|
422
|
+
tree: (path = "", options) => callFilesystemRead("tree", {
|
|
423
|
+
rootId: options?.rootId ?? "workspace",
|
|
424
|
+
path,
|
|
425
|
+
...typeof options?.maxDepth === "number" ? { maxDepth: options.maxDepth } : {},
|
|
426
|
+
...typeof options?.maxEntries === "number" ? { maxEntries: options.maxEntries } : {}
|
|
427
|
+
}),
|
|
428
|
+
delete: (path, options) => callFilesystemMutate("delete", { rootId: options?.rootId ?? "workspace", path }),
|
|
429
|
+
mkdir: (path, options) => callFilesystemMutate("mkdir", { rootId: options?.rootId ?? "workspace", path }),
|
|
430
|
+
exists: (path, options) => callFilesystemRead("exists", { rootId: options?.rootId ?? "workspace", path }),
|
|
431
|
+
stat: (path, options) => callFilesystemRead("info", {
|
|
432
|
+
rootId: options?.rootId ?? "workspace",
|
|
433
|
+
path
|
|
434
|
+
}),
|
|
435
|
+
info: (path, options) => callFilesystemRead("info", {
|
|
436
|
+
rootId: options?.rootId ?? "workspace",
|
|
437
|
+
path
|
|
438
|
+
}),
|
|
439
|
+
search: (query, options) => callFilesystemRead("search", {
|
|
440
|
+
query,
|
|
441
|
+
rootId: options?.rootId ?? "workspace",
|
|
442
|
+
path: options?.path ?? "",
|
|
443
|
+
...options?.glob ? { glob: options.glob } : {},
|
|
444
|
+
...typeof options?.headLimit === "number" ? { headLimit: options.headLimit } : {}
|
|
445
|
+
}),
|
|
446
|
+
codeSearch: (pattern, path, glob, headLimit) => callFilesystemRead("codeSearch", { pattern, path, glob, headLimit }),
|
|
447
|
+
rename: (path, newName, options) => callFilesystemMutate("rename", { rootId: options?.rootId ?? "workspace", path, newName }),
|
|
448
|
+
move: (sourcePath, destDir, options) => {
|
|
449
|
+
if (usesAbsolutePathMode(options?.sourcePathMode) || usesAbsolutePathMode(options?.destPathMode)) {
|
|
450
|
+
return callFilesystemMutate("move", { sourcePath, destDir, ...options });
|
|
451
|
+
}
|
|
452
|
+
const srcRoot = options?.sourceRootId ?? "workspace";
|
|
453
|
+
const dstRoot = options?.destRootId ?? srcRoot;
|
|
454
|
+
return callFilesystemMutate("move", {
|
|
455
|
+
sourceRootId: srcRoot,
|
|
456
|
+
sourcePath,
|
|
457
|
+
destRootId: dstRoot,
|
|
458
|
+
destPath: joinWorkspacePath(destDir, getPathBasename(sourcePath))
|
|
459
|
+
});
|
|
460
|
+
},
|
|
461
|
+
copyTo: (sourcePath, destDir, options) => {
|
|
462
|
+
if (usesAbsolutePathMode(options?.sourcePathMode) || usesAbsolutePathMode(options?.destPathMode)) {
|
|
463
|
+
return callFilesystemMutate("copyTo", { sourcePath, destDir, ...options });
|
|
464
|
+
}
|
|
465
|
+
const srcRoot = options?.sourceRootId ?? "workspace";
|
|
466
|
+
const dstRoot = options?.destRootId ?? srcRoot;
|
|
467
|
+
return callFilesystemMutate("copyTo", {
|
|
468
|
+
sourceRootId: srcRoot,
|
|
469
|
+
sourcePath,
|
|
470
|
+
destRootId: dstRoot,
|
|
471
|
+
destPath: joinWorkspacePath(destDir, getPathBasename(sourcePath))
|
|
472
|
+
});
|
|
473
|
+
},
|
|
474
|
+
copy: (path, options) => callFilesystemTransfer("copy", { rootId: options?.rootId ?? "workspace", path }),
|
|
475
|
+
paste: (path = "", options) => callFilesystemTransfer("paste", { rootId: options?.rootId ?? "workspace", path }),
|
|
476
|
+
clipboardCheck: () => callFilesystemTransfer("clipboardCheck"),
|
|
477
|
+
copyPath: (path, options) => callFilesystemTransfer("copyPath", { rootId: options?.rootId ?? "workspace", path }),
|
|
478
|
+
trash: (path, options) => callFilesystemMutate("trash", { rootId: options?.rootId ?? "workspace", path }),
|
|
479
|
+
batchFlattenPreview: (sourcePath, options) => {
|
|
480
|
+
if (usesAbsolutePathMode(options?.sourcePathMode)) {
|
|
481
|
+
return callFilesystemRead("batchFlattenPreview", { sourcePath, ...options });
|
|
482
|
+
}
|
|
483
|
+
return callFilesystemRead("batchFlattenPreview", {
|
|
484
|
+
sourceRootId: options?.sourceRootId ?? "workspace",
|
|
485
|
+
sourcePath
|
|
486
|
+
});
|
|
487
|
+
},
|
|
488
|
+
batchFlattenCopy: (sourcePath, destDir, taskId, options) => {
|
|
489
|
+
if (usesAbsolutePathMode(options?.sourcePathMode) || usesAbsolutePathMode(options?.destPathMode)) {
|
|
490
|
+
return callFilesystemMutate("batchFlattenCopy", { sourcePath, destDir, taskId, ...options });
|
|
491
|
+
}
|
|
492
|
+
const srcRoot = options?.sourceRootId ?? "workspace";
|
|
493
|
+
const dstRoot = options?.destRootId ?? srcRoot;
|
|
494
|
+
return callFilesystemMutate("batchFlattenCopy", {
|
|
495
|
+
sourceRootId: srcRoot,
|
|
496
|
+
sourcePath,
|
|
497
|
+
destRootId: dstRoot,
|
|
498
|
+
destPath: destDir,
|
|
499
|
+
...typeof taskId === "string" ? { taskId } : {}
|
|
500
|
+
});
|
|
501
|
+
},
|
|
502
|
+
getUrl: (path, options) => callFilesystemTransfer("getUrl", { rootId: options?.rootId ?? "workspace", path }),
|
|
503
|
+
download: (url, path, filenameHint, options) => {
|
|
504
|
+
const absoluteDir = options?.absoluteDir?.trim();
|
|
505
|
+
if (absoluteDir) {
|
|
506
|
+
return callFilesystemTransfer("download", { url, absoluteDir, filenameHint });
|
|
507
|
+
}
|
|
508
|
+
return callFilesystemTransfer("download", { rootId: options?.rootId ?? "workspace", path, url, filenameHint });
|
|
509
|
+
},
|
|
510
|
+
writeBinary: (path, base64, options) => callFilesystemMutate("writeBinary", { rootId: options?.rootId ?? "workspace", path, base64 }),
|
|
511
|
+
readBinary: (path, options) => callFilesystemRead("readBinary", { rootId: options?.rootId ?? "workspace", path })
|
|
512
|
+
},
|
|
513
|
+
shell: {
|
|
514
|
+
session: {
|
|
515
|
+
open: (options = {}) => callShellSessionControl("open", { ...options }),
|
|
516
|
+
list: () => callShellSessionRead("list"),
|
|
517
|
+
get: (sessionId) => callShellSessionRead("get", { sessionId }),
|
|
518
|
+
run: (sessionId, command, options = {}) => callShellSessionControl("run", {
|
|
519
|
+
sessionId,
|
|
520
|
+
command,
|
|
521
|
+
...typeof options.timeoutMs === "number" ? { timeoutMs: options.timeoutMs } : {}
|
|
522
|
+
}),
|
|
523
|
+
wait: (sessionId, commandId, timeoutMs) => callShellSessionRead("wait", {
|
|
524
|
+
sessionId,
|
|
525
|
+
commandId,
|
|
526
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {}
|
|
527
|
+
}),
|
|
528
|
+
getEntries: (sessionId, options = {}) => callShellSessionRead("getEntries", {
|
|
529
|
+
sessionId,
|
|
530
|
+
...typeof options.sinceId === "number" ? { sinceId: options.sinceId } : {},
|
|
531
|
+
...typeof options.limit === "number" ? { limit: options.limit } : {}
|
|
532
|
+
}),
|
|
533
|
+
signal: (sessionId, signal, commandId) => callShellSessionControl("signal", {
|
|
534
|
+
sessionId,
|
|
535
|
+
signal,
|
|
536
|
+
...commandId ? { commandId } : {}
|
|
537
|
+
}),
|
|
538
|
+
clearEntries: (sessionId) => callShellSessionControl("clearEntries", { sessionId }),
|
|
539
|
+
close: (sessionId, force = false) => callShellSessionControl("close", { sessionId, force })
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
browser: {
|
|
543
|
+
session: {
|
|
544
|
+
open: async (options = {}) => parseToolResult(await callTool("seastudio-browser_session", { action: "open", ...options })),
|
|
545
|
+
list: async () => parseToolResult(await callTool("seastudio-browser_session", { action: "list" })),
|
|
546
|
+
get: async (browserSessionId) => parseToolResult(await callTool("seastudio-browser_session", { action: "get", browserSessionId })),
|
|
547
|
+
close: async (browserSessionId) => parseToolResult(
|
|
548
|
+
await callTool("seastudio-browser_session", { action: "close", browserSessionId })
|
|
549
|
+
)
|
|
550
|
+
},
|
|
551
|
+
tab: {
|
|
552
|
+
create: async (browserSessionId, url) => parseToolResult(
|
|
553
|
+
await callTool("seastudio-browser_tab", { action: "create", browserSessionId, url })
|
|
554
|
+
),
|
|
555
|
+
close: async (browserSessionId, tabId) => parseToolResult(
|
|
556
|
+
await callTool("seastudio-browser_tab", { action: "close", browserSessionId, tabId })
|
|
557
|
+
),
|
|
558
|
+
activate: async (browserSessionId, tabId) => parseToolResult(
|
|
559
|
+
await callTool("seastudio-browser_tab", { action: "activate", browserSessionId, tabId })
|
|
560
|
+
),
|
|
561
|
+
navigate: async (browserSessionId, tabId, url) => parseToolResult(
|
|
562
|
+
await callTool("seastudio-browser_tab", { action: "navigate", browserSessionId, tabId, url })
|
|
563
|
+
),
|
|
564
|
+
goBack: async (browserSessionId, tabId) => parseToolResult(await callTool("seastudio-browser_tab", { action: "goBack", browserSessionId, tabId })),
|
|
565
|
+
goForward: async (browserSessionId, tabId) => parseToolResult(await callTool("seastudio-browser_tab", { action: "goForward", browserSessionId, tabId })),
|
|
566
|
+
reload: async (browserSessionId, tabId) => parseToolResult(await callTool("seastudio-browser_tab", { action: "reload", browserSessionId, tabId })),
|
|
567
|
+
stop: async (browserSessionId, tabId) => parseToolResult(await callTool("seastudio-browser_tab", { action: "stop", browserSessionId, tabId }))
|
|
568
|
+
},
|
|
569
|
+
viewport: {
|
|
570
|
+
bind: async (browserSessionId, rect, ownerInstanceId) => parseToolResult(
|
|
571
|
+
await callTool("seastudio-browser_runtime", {
|
|
572
|
+
action: "bindViewport",
|
|
573
|
+
browserSessionId,
|
|
574
|
+
rect,
|
|
575
|
+
...ownerInstanceId ? { ownerInstanceId } : {}
|
|
576
|
+
})
|
|
577
|
+
)
|
|
578
|
+
},
|
|
579
|
+
certificate: {
|
|
580
|
+
respond: async (browserSessionId, requestId, allow) => parseToolResult(
|
|
581
|
+
await callTool("seastudio-browser_runtime", { action: "respondCertificate", browserSessionId, requestId, allow })
|
|
582
|
+
)
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
async function runOneShotShellCommand(command, options = {}) {
|
|
587
|
+
const { timeoutMs, ...openOpts } = options;
|
|
588
|
+
const openRaw = await seastudio.shell.session.open(openOpts);
|
|
589
|
+
const openText = openRaw.content?.[0]?.text ?? "{}";
|
|
590
|
+
const opened = JSON.parse(openText);
|
|
591
|
+
const sessionId = opened.sessionId;
|
|
592
|
+
if (!sessionId) {
|
|
593
|
+
throw new Error("shell_session_open did not return sessionId");
|
|
594
|
+
}
|
|
595
|
+
try {
|
|
596
|
+
const runRaw = await seastudio.shell.session.run(sessionId, command, {
|
|
597
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {}
|
|
598
|
+
});
|
|
599
|
+
const runText = runRaw.content?.[0]?.text ?? "{}";
|
|
600
|
+
const run = JSON.parse(runText);
|
|
601
|
+
const waitRaw = await seastudio.shell.session.wait(
|
|
602
|
+
sessionId,
|
|
603
|
+
run.commandId,
|
|
604
|
+
typeof timeoutMs === "number" ? timeoutMs + 5e3 : void 0
|
|
605
|
+
);
|
|
606
|
+
const waitText = waitRaw.content?.[0]?.text ?? "{}";
|
|
607
|
+
const wait = JSON.parse(waitText);
|
|
608
|
+
const entriesRaw = await seastudio.shell.session.getEntries(sessionId, {});
|
|
609
|
+
const entriesText = entriesRaw.content?.[0]?.text ?? "{}";
|
|
610
|
+
const entries = JSON.parse(entriesText);
|
|
611
|
+
const stdout = entries.entries.filter((e) => e.commandId === run.commandId && e.level === "stdout").map((e) => e.content).join("\n");
|
|
612
|
+
return {
|
|
613
|
+
exitCode: wait.exitCode,
|
|
614
|
+
stdout,
|
|
615
|
+
durationMs: wait.durationMs,
|
|
616
|
+
timedOut: wait.timedOut
|
|
617
|
+
};
|
|
618
|
+
} finally {
|
|
619
|
+
try {
|
|
620
|
+
await seastudio.shell.session.close(sessionId);
|
|
621
|
+
} catch {
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// src/mcp/seastudio/tools/plugin.ts
|
|
627
|
+
var pluginManagementTools = [
|
|
628
|
+
annotateTool({
|
|
629
|
+
name: "seastudio-plugin_manage",
|
|
630
|
+
description: "\u7BA1\u7406\u63D2\u4EF6 registry\u3001\u672C\u5730\u5B89\u88C5\u72B6\u6001\uFF0C\u4EE5\u53CA\u63D2\u4EF6\u5B89\u88C5/\u5378\u8F7D\u3002\u4F7F\u7528 action \u9009\u62E9 listOfficial\u3001listInstalled\u3001install\u3001uninstall \u6216 getStatus\u3002",
|
|
631
|
+
inputSchema: {
|
|
632
|
+
type: "object",
|
|
633
|
+
properties: {
|
|
634
|
+
action: {
|
|
635
|
+
type: "string",
|
|
636
|
+
enum: ["listOfficial", "listInstalled", "install", "uninstall", "getStatus"],
|
|
637
|
+
description: "\u63D2\u4EF6\u7BA1\u7406\u52A8\u4F5C\u3002install/uninstall/getStatus \u9700\u8981 pluginId\u3002"
|
|
638
|
+
},
|
|
639
|
+
pluginId: { type: "string", description: "\u63D2\u4EF6 ID\u3002install\u3001uninstall\u3001getStatus \u5FC5\u586B\u3002" }
|
|
640
|
+
},
|
|
641
|
+
required: ["action"]
|
|
642
|
+
}
|
|
643
|
+
}, {
|
|
644
|
+
operationKind: "workflow",
|
|
645
|
+
requiresExecutionEvidence: true,
|
|
646
|
+
rawDomain: "workspace"
|
|
647
|
+
})
|
|
648
|
+
];
|
|
649
|
+
var pluginTabTools = [
|
|
650
|
+
annotateTool({
|
|
651
|
+
name: "seastudio-plugin_tab",
|
|
652
|
+
description: "\u67E5\u8BE2\u3001\u6253\u5F00\u3001\u5207\u6362\u548C\u5173\u95ED\u63D2\u4EF6\u6807\u7B7E\u9875\u3002\u4F7F\u7528 action \u9009\u62E9 list\u3001getActive\u3001open\u3001switch\u3001close \u6216 getStatus\u3002",
|
|
653
|
+
inputSchema: {
|
|
654
|
+
type: "object",
|
|
655
|
+
properties: {
|
|
656
|
+
action: {
|
|
657
|
+
type: "string",
|
|
658
|
+
enum: ["list", "getActive", "open", "switch", "close", "getStatus"],
|
|
659
|
+
description: "\u63D2\u4EF6\u6807\u7B7E\u9875\u52A8\u4F5C\u3002open/getStatus \u9700\u8981 pluginId\uFF1Bswitch/close \u9700\u8981 instanceId\u3002"
|
|
660
|
+
},
|
|
661
|
+
pluginId: { type: "string", description: "\u63D2\u4EF6 ID\u3002open\u3001getStatus \u5FC5\u586B\u3002" },
|
|
662
|
+
instanceId: { type: "string", description: "\u63D2\u4EF6\u6807\u7B7E\u9875\u5B9E\u4F8B ID\u3002switch\u3001close \u5FC5\u586B\u3002" }
|
|
663
|
+
},
|
|
664
|
+
required: ["action"]
|
|
665
|
+
}
|
|
666
|
+
}, {
|
|
667
|
+
operationKind: "workflow",
|
|
668
|
+
requiresExecutionEvidence: true,
|
|
669
|
+
rawDomain: "workspace"
|
|
670
|
+
})
|
|
671
|
+
];
|
|
672
|
+
|
|
673
|
+
// src/mcp/seastudio/tools/agent.ts
|
|
674
|
+
var agentManagementTools = [
|
|
675
|
+
annotateTool({
|
|
676
|
+
name: "seastudio-agent_manage",
|
|
677
|
+
description: "\u7BA1\u7406 Agent registry\u3001\u672C\u5730\u5B89\u88C5\u72B6\u6001\uFF0C\u4EE5\u53CA Agent \u5B89\u88C5/\u5378\u8F7D\u3002\u4F7F\u7528 action \u9009\u62E9 listOfficial\u3001listInstalled\u3001install\u3001uninstall \u6216 getStatus\u3002",
|
|
678
|
+
inputSchema: {
|
|
679
|
+
type: "object",
|
|
680
|
+
properties: {
|
|
681
|
+
action: {
|
|
682
|
+
type: "string",
|
|
683
|
+
enum: ["listOfficial", "listInstalled", "install", "uninstall", "getStatus"],
|
|
684
|
+
description: "Agent \u7BA1\u7406\u52A8\u4F5C\u3002install/uninstall/getStatus \u9700\u8981 agentId\u3002"
|
|
685
|
+
},
|
|
686
|
+
agentId: { type: "string", description: "Agent ID\u3002install\u3001uninstall\u3001getStatus \u5FC5\u586B\u3002" }
|
|
687
|
+
},
|
|
688
|
+
required: ["action"]
|
|
689
|
+
}
|
|
690
|
+
}, {
|
|
691
|
+
operationKind: "workflow",
|
|
692
|
+
requiresExecutionEvidence: true,
|
|
693
|
+
rawDomain: "workspace"
|
|
694
|
+
})
|
|
695
|
+
];
|
|
696
|
+
var agentTabTools = [
|
|
697
|
+
annotateTool({
|
|
698
|
+
name: "seastudio-agent_tab",
|
|
699
|
+
description: "\u67E5\u8BE2\u3001\u6253\u5F00\u3001\u5207\u6362\u548C\u5173\u95ED Agent \u6807\u7B7E\u9875\u3002\u4F7F\u7528 action \u9009\u62E9 list\u3001getActive\u3001open\u3001switch\u3001close \u6216 getStatus\u3002",
|
|
700
|
+
inputSchema: {
|
|
701
|
+
type: "object",
|
|
702
|
+
properties: {
|
|
703
|
+
action: {
|
|
704
|
+
type: "string",
|
|
705
|
+
enum: ["list", "getActive", "open", "switch", "close", "getStatus"],
|
|
706
|
+
description: "Agent \u6807\u7B7E\u9875\u52A8\u4F5C\u3002open/getStatus \u9700\u8981 agentId\uFF1Bswitch/close \u9700\u8981 instanceId\u3002"
|
|
707
|
+
},
|
|
708
|
+
agentId: { type: "string", description: "Agent ID\u3002open\u3001getStatus \u5FC5\u586B\u3002" },
|
|
709
|
+
instanceId: { type: "string", description: "Agent \u6807\u7B7E\u9875\u5B9E\u4F8B ID\u3002switch\u3001close \u5FC5\u586B\u3002" }
|
|
710
|
+
},
|
|
711
|
+
required: ["action"]
|
|
712
|
+
}
|
|
713
|
+
}, {
|
|
714
|
+
operationKind: "workflow",
|
|
715
|
+
requiresExecutionEvidence: true,
|
|
716
|
+
rawDomain: "workspace"
|
|
717
|
+
})
|
|
718
|
+
];
|
|
719
|
+
|
|
720
|
+
// src/mcp/seastudio/tools/project.ts
|
|
721
|
+
var projectTools = [
|
|
722
|
+
annotateTool({
|
|
723
|
+
name: "seastudio-project_manage",
|
|
724
|
+
description: "\u67E5\u8BE2 SeaStudio \u9879\u76EE\u5217\u8868\u548C\u5F53\u524D\u6FC0\u6D3B\u9879\u76EE\u3002\u4F7F\u7528 action \u9009\u62E9 list \u6216 getActive\u3002",
|
|
725
|
+
inputSchema: {
|
|
726
|
+
type: "object",
|
|
727
|
+
properties: {
|
|
728
|
+
action: {
|
|
729
|
+
type: "string",
|
|
730
|
+
enum: ["list", "getActive"],
|
|
731
|
+
description: "\u9879\u76EE\u67E5\u8BE2\u52A8\u4F5C\u3002list \u8FD4\u56DE\u6240\u6709\u9879\u76EE\uFF1BgetActive \u8FD4\u56DE\u5F53\u524D MCP \u4E0A\u4E0B\u6587\u6216\u524D\u53F0\u805A\u7126\u9879\u76EE\u3002"
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
required: ["action"]
|
|
735
|
+
}
|
|
736
|
+
}, {
|
|
737
|
+
operationKind: "read",
|
|
738
|
+
requiresExecutionEvidence: false,
|
|
739
|
+
rawDomain: "workspace"
|
|
740
|
+
})
|
|
741
|
+
];
|
|
742
|
+
|
|
743
|
+
// src/mcp/seastudio/tools/skill.ts
|
|
744
|
+
var skillTools = [
|
|
745
|
+
annotateTool({
|
|
746
|
+
name: "seastudio-skill_manage",
|
|
747
|
+
description: "\u5217\u51FA\u3001\u83B7\u53D6\u548C\u8BFB\u53D6 SeaStudio skills\u3002\u4F7F\u7528 action \u9009\u62E9 list\u3001get \u6216 read\u3002",
|
|
748
|
+
inputSchema: {
|
|
749
|
+
type: "object",
|
|
750
|
+
properties: {
|
|
751
|
+
action: {
|
|
752
|
+
type: "string",
|
|
753
|
+
enum: ["list", "get", "read"],
|
|
754
|
+
description: "Skill \u8BFB\u53D6\u52A8\u4F5C\u3002list \u53EF\u6309 projectId/source \u8FC7\u6EE4\uFF1Bget/read \u9700\u8981 id\uFF1Bread \u8FD8\u9700\u8981 path\u3002"
|
|
755
|
+
},
|
|
756
|
+
id: { type: "string", description: 'Skill \u7684\u7A33\u5B9A id\uFF08\u5982 "seastudio:my-skill"\uFF09\u3002get/read \u5FC5\u586B\u3002' },
|
|
757
|
+
path: { type: "string", description: "read \u8981\u8BFB\u53D6\u7684 skill \u5185\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u5FC5\u987B\u6765\u81EA get \u8FD4\u56DE\u7684 files \u6E05\u5355\u3002" },
|
|
758
|
+
projectId: { type: "string", description: "\u53EF\u9009\uFF1A\u5F53\u524D\u4F1A\u8BDD\u6240\u5C5E\u9879\u76EE ID\uFF0C\u7528\u4E8E\u9650\u5B9A\u9879\u76EE\u53EF\u89C1 skill\u3002" },
|
|
759
|
+
source: {
|
|
760
|
+
type: "string",
|
|
761
|
+
enum: ["seastudio", "claude-code", "codex", "cursor", "custom"],
|
|
762
|
+
description: "list \u7684\u53EF\u9009\u6765\u6E90\u8FC7\u6EE4\u3002"
|
|
763
|
+
},
|
|
764
|
+
offset: { type: "integer", minimum: 0, description: "read \u7684\u53EF\u9009 byte offset\uFF0C\u7528\u4E8E\u5206\u6BB5\u8BFB\u53D6\u5927\u6587\u4EF6\u3002" }
|
|
765
|
+
},
|
|
766
|
+
required: ["action"]
|
|
767
|
+
}
|
|
768
|
+
}, {
|
|
769
|
+
operationKind: "read",
|
|
770
|
+
requiresExecutionEvidence: false,
|
|
771
|
+
rawDomain: "skill"
|
|
772
|
+
})
|
|
773
|
+
];
|
|
774
|
+
|
|
775
|
+
// src/mcp/seastudio/tools/browser.ts
|
|
776
|
+
var browserSessionIdParam = {
|
|
777
|
+
browserSessionId: { type: "string", description: "Browser session ID\u3002get/close/tab/runtime \u52A8\u4F5C\u9700\u8981\u3002" }
|
|
778
|
+
};
|
|
779
|
+
var tabIdParam = {
|
|
780
|
+
tabId: { type: "string", description: "Browser tab ID\u3002close/activate/navigate/goBack/goForward/reload/stop \u9700\u8981\u3002" }
|
|
781
|
+
};
|
|
782
|
+
var browserRuntimeTools = [
|
|
783
|
+
annotateTool({
|
|
784
|
+
name: "seastudio-browser_session",
|
|
785
|
+
description: "\u521B\u5EFA\u3001\u5217\u51FA\u3001\u8BFB\u53D6\u6216\u5173\u95ED Browser Session\u3002\u4F7F\u7528 action \u9009\u62E9 open\u3001list\u3001get \u6216 close\u3002",
|
|
786
|
+
inputSchema: {
|
|
787
|
+
type: "object",
|
|
788
|
+
properties: {
|
|
789
|
+
action: {
|
|
790
|
+
type: "string",
|
|
791
|
+
enum: ["open", "list", "get", "close"],
|
|
792
|
+
description: "Browser Session \u52A8\u4F5C\u3002get/close \u9700\u8981 browserSessionId\u3002"
|
|
793
|
+
},
|
|
794
|
+
...browserSessionIdParam,
|
|
795
|
+
label: { type: "string", description: "open \u7684\u53EF\u9009 session \u663E\u793A\u540D\u79F0\u3002" },
|
|
796
|
+
partitionKey: { type: "string", description: "open \u7684\u53EF\u9009\u7F51\u7AD9\u6570\u636E\u5206\u533A key\uFF1B\u76F8\u540C key \u5171\u4EAB cookie/localStorage\u3002" },
|
|
797
|
+
homepage: { type: "string", description: "open \u7684\u53EF\u9009\u9ED8\u8BA4\u9996\u9875\u3002" }
|
|
798
|
+
},
|
|
799
|
+
required: ["action"]
|
|
800
|
+
}
|
|
801
|
+
}, {
|
|
802
|
+
operationKind: "workflow",
|
|
803
|
+
requiresExecutionEvidence: false,
|
|
804
|
+
rawDomain: "browser"
|
|
805
|
+
}),
|
|
806
|
+
annotateTool({
|
|
807
|
+
name: "seastudio-browser_tab",
|
|
808
|
+
description: "\u7BA1\u7406 Browser Session \u4E2D\u7684 tab\uFF0C\u5305\u62EC\u521B\u5EFA\u3001\u5BFC\u822A\u3001\u6FC0\u6D3B\u548C\u52A0\u8F7D\u63A7\u5236\u3002\u4F7F\u7528 action \u9009\u62E9 create\u3001close\u3001activate\u3001navigate\u3001goBack\u3001goForward\u3001reload \u6216 stop\u3002",
|
|
809
|
+
inputSchema: {
|
|
810
|
+
type: "object",
|
|
811
|
+
properties: {
|
|
812
|
+
action: {
|
|
813
|
+
type: "string",
|
|
814
|
+
enum: ["create", "close", "activate", "navigate", "goBack", "goForward", "reload", "stop"],
|
|
815
|
+
description: "Browser tab \u52A8\u4F5C\u3002\u6240\u6709\u52A8\u4F5C\u9700\u8981 browserSessionId\uFF1B\u9664 create \u5916\u901A\u5E38\u9700\u8981 tabId\uFF1Bnavigate \u8FD8\u9700\u8981 url\u3002"
|
|
816
|
+
},
|
|
817
|
+
...browserSessionIdParam,
|
|
818
|
+
...tabIdParam,
|
|
819
|
+
url: { type: "string", description: "create \u7684\u521D\u59CB URL\uFF0C\u6216 navigate \u7684\u76EE\u6807 URL/\u641C\u7D22\u8BCD\u3002" }
|
|
820
|
+
},
|
|
821
|
+
required: ["action", "browserSessionId"]
|
|
822
|
+
}
|
|
823
|
+
}, {
|
|
824
|
+
operationKind: "mutate",
|
|
825
|
+
requiresExecutionEvidence: false,
|
|
826
|
+
rawDomain: "browser"
|
|
827
|
+
}),
|
|
828
|
+
annotateTool({
|
|
829
|
+
name: "seastudio-browser_runtime",
|
|
830
|
+
description: "\u5904\u7406 Browser runtime \u4E0E UI viewport\u3001\u8BC1\u4E66\u9519\u8BEF\u76F8\u5173\u7684\u5BBF\u4E3B\u4EA4\u4E92\u3002\u4F7F\u7528 action \u9009\u62E9 bindViewport \u6216 respondCertificate\u3002",
|
|
831
|
+
inputSchema: {
|
|
832
|
+
type: "object",
|
|
833
|
+
properties: {
|
|
834
|
+
action: {
|
|
835
|
+
type: "string",
|
|
836
|
+
enum: ["bindViewport", "respondCertificate"],
|
|
837
|
+
description: "Browser runtime \u52A8\u4F5C\u3002bindViewport \u9700\u8981 rect\uFF1BrespondCertificate \u9700\u8981 requestId \u548C allow\u3002"
|
|
838
|
+
},
|
|
839
|
+
...browserSessionIdParam,
|
|
840
|
+
ownerInstanceId: { type: "string", description: "bindViewport \u7684\u53EF\u9009 UI owner instance id\u3002" },
|
|
841
|
+
rect: {
|
|
842
|
+
type: "object",
|
|
843
|
+
description: "bindViewport \u7684 UI viewport \u77E9\u5F62\u3002",
|
|
844
|
+
properties: {
|
|
845
|
+
x: { type: "number" },
|
|
846
|
+
y: { type: "number" },
|
|
847
|
+
width: { type: "number" },
|
|
848
|
+
height: { type: "number" }
|
|
849
|
+
},
|
|
850
|
+
required: ["x", "y", "width", "height"]
|
|
851
|
+
},
|
|
852
|
+
requestId: { type: "string", description: "respondCertificate \u7684\u8BC1\u4E66\u9519\u8BEF\u8BF7\u6C42 ID\u3002" },
|
|
853
|
+
allow: { type: "boolean", description: "respondCertificate \u662F\u5426\u7EE7\u7EED\u52A0\u8F7D\u8BE5\u8BC1\u4E66\u9519\u8BEF\u9875\u9762\u3002" }
|
|
854
|
+
},
|
|
855
|
+
required: ["action", "browserSessionId"]
|
|
856
|
+
}
|
|
857
|
+
}, {
|
|
858
|
+
operationKind: "workflow",
|
|
859
|
+
requiresExecutionEvidence: false,
|
|
860
|
+
rawDomain: "browser"
|
|
861
|
+
})
|
|
862
|
+
];
|
|
863
|
+
|
|
864
|
+
// src/mcp/seastudio/notify/topics.ts
|
|
865
|
+
var SeastudioRequests = {
|
|
866
|
+
/** 请求打开文件 -> 主程序发布 FILE_OPEN_REQUESTED */
|
|
867
|
+
FILE_OPEN: "request:file_open",
|
|
868
|
+
/** 请求标记文件已修改 -> 主程序发布 FILE_MODIFIED */
|
|
869
|
+
FILE_MODIFIED: "request:file_modified",
|
|
870
|
+
/** 请求标记文件已保存 -> 主程序发布 FILE_SAVED */
|
|
871
|
+
FILE_SAVED: "request:file_saved",
|
|
872
|
+
/** 请求发送文本给 Agent -> 主程序发布 TEXT_SEND_REQUESTED */
|
|
873
|
+
TEXT_SEND: "request:text_send"
|
|
874
|
+
};
|
|
875
|
+
var SeastudioNotifications = {
|
|
876
|
+
/** 文件系统变化通知(fs.watch 触发) */
|
|
877
|
+
FILES_CHANGED: "files:changed",
|
|
878
|
+
/** 文件或目录被重命名/移动 */
|
|
879
|
+
FILE_RENAMED: "file:renamed",
|
|
880
|
+
/** 文件或目录被删除/移入回收站 */
|
|
881
|
+
FILE_DELETED: "file:deleted",
|
|
882
|
+
/** 根目录变化通知 */
|
|
883
|
+
ROOTS_CHANGED: "roots:changed",
|
|
884
|
+
/** 文件打开请求,可广播也可定向 */
|
|
885
|
+
FILE_OPEN_REQUESTED: "seastudio:file-open_requested",
|
|
886
|
+
/** 文件固定请求:将当前临时打开的文件实例转为固定 */
|
|
887
|
+
FILE_KEEP_REQUESTED: "seastudio:file-keep_requested",
|
|
888
|
+
/** 文件已修改通知(内容变化,未保存) */
|
|
889
|
+
FILE_MODIFIED: "file:modified",
|
|
890
|
+
/** 文件已保存通知 */
|
|
891
|
+
FILE_SAVED: "file:saved",
|
|
892
|
+
/** 文件被选中通知 */
|
|
893
|
+
FILE_SELECTED: "file:selected",
|
|
894
|
+
/** 文件发送请求 */
|
|
895
|
+
FILE_SEND_REQUESTED: "seastudio:file-send_requested",
|
|
896
|
+
/** 文本发送请求 */
|
|
897
|
+
TEXT_SEND_REQUESTED: "seastudio:text-send_requested",
|
|
898
|
+
/** 代码提案审核反馈 */
|
|
899
|
+
PROPOSAL_FEEDBACK: "seastudio:proposal-feedback",
|
|
900
|
+
/** 插件实例请求更新宿主 plugin tab 标题 */
|
|
901
|
+
PLUGIN_TAB_TITLE_CHANGED: "plugin:tab-title_changed",
|
|
902
|
+
/** Browser Session 状态变化 */
|
|
903
|
+
BROWSER_SESSION_CHANGED: "browser:session_changed",
|
|
904
|
+
/** Browser Session 关闭 */
|
|
905
|
+
BROWSER_SESSION_CLOSED: "browser:session_closed",
|
|
906
|
+
/** Browser Session 证书错误,需要客户端 UI 决策 */
|
|
907
|
+
BROWSER_CERTIFICATE_ERROR: "browser:certificate_error",
|
|
908
|
+
/** Browser Session 收到网页新标签请求 */
|
|
909
|
+
BROWSER_NEW_TAB_REQUESTED: "browser:new_tab_requested",
|
|
910
|
+
/**
|
|
911
|
+
* Agent 对话 session:新建。消息历史仍由 Agent 前端持有,宿主仅同步列表用于侧栏。
|
|
912
|
+
* 通常由 Agent 通过 notifications/publish 发出;其他订阅者(含 host-ui)可据此更新 UI。
|
|
913
|
+
*/
|
|
914
|
+
SESSION_CREATED: "session:created",
|
|
915
|
+
/**
|
|
916
|
+
* Agent 对话 session:当前选中项变化。
|
|
917
|
+
* 可由 Agent 广播,或由宿主侧栏通过 publishTo(targetPluginId, targetInstanceId) 定向到单个 Agent 标签。
|
|
918
|
+
*/
|
|
919
|
+
SESSION_SELECTED: "session:selected",
|
|
920
|
+
/** Agent 对话 session:摘要或标题更新,供侧栏展示 */
|
|
921
|
+
SESSION_SUMMARY: "session:summary",
|
|
922
|
+
/** Agent 对话 session:运行状态更新,供宿主侧栏展示 */
|
|
923
|
+
SESSION_STATUS: "session:status",
|
|
924
|
+
/** Agent 对话 session:从宿主列表移除(删除/归档等) */
|
|
925
|
+
SESSION_REMOVED: "session:removed",
|
|
926
|
+
/**
|
|
927
|
+
* Agent 在初始化或线程列表与当前选中稳定后,向宿主全量同步:
|
|
928
|
+
* 每个 agent 实例(通常每项目一个)下的会话列表与当前选中的 sessionId。
|
|
929
|
+
* 宿主应用此通知重建侧栏列表,避免仅靠逐条 SESSION_CREATED 时重启后空白。
|
|
930
|
+
*/
|
|
931
|
+
SESSION_STATE_SNAPSHOT: "session:state_snapshot",
|
|
932
|
+
/**
|
|
933
|
+
* 宿主请求 Agent 新建一条对话会话(例如侧栏项目行的「+」)。
|
|
934
|
+
* 通过 notifications/publish + publishTo 定向到对应 Agent 实例。
|
|
935
|
+
*/
|
|
936
|
+
SESSION_NEW_REQUESTED: "session:new_requested",
|
|
937
|
+
/**
|
|
938
|
+
* 宿主请求 Agent 删除/关闭某条对话会话(例如侧栏会话行「×」)。
|
|
939
|
+
* 通过 notifications/publish + publishTo 定向到对应 Agent 实例。
|
|
940
|
+
*/
|
|
941
|
+
SESSION_DELETE_REQUESTED: "session:delete_requested"
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
// src/mcp/seastudio/index.ts
|
|
945
|
+
var allTools = [
|
|
946
|
+
...fileTools,
|
|
947
|
+
...shellTools,
|
|
948
|
+
...seaCloudTools,
|
|
949
|
+
...pluginManagementTools,
|
|
950
|
+
...agentManagementTools,
|
|
951
|
+
...pluginTabTools,
|
|
952
|
+
...agentTabTools,
|
|
953
|
+
...projectTools,
|
|
954
|
+
...skillTools,
|
|
955
|
+
...browserRuntimeTools
|
|
956
|
+
];
|
|
957
|
+
var tools = allTools;
|
|
958
|
+
|
|
959
|
+
export { SeastudioNotifications, SeastudioRequests, agentManagementTools, agentTabTools, allTools, annotateTool, batchFlattenCopyEvidenceOutputSchema, browserRuntimeTools, callTool, callToolText, dualPathEvidenceOutputSchema, fileDownloadEvidenceOutputSchema, fileTools, fileUrlEvidenceOutputSchema, pluginManagementTools, pluginTabTools, projectTools, request, rootedPathEvidenceOutputSchema, rootedWriteEvidenceOutputSchema, runOneShotShellCommand, seaCloudTools, seastudio, shellSessionCloseEvidenceOutputSchema, shellSessionOpenEvidenceOutputSchema, shellSessionRunEvidenceOutputSchema, shellSessionSignalEvidenceOutputSchema, shellSessionSnapshotEvidenceOutputSchema, shellTools, skillTools, tools };
|