@seastudio/sdk 3.0.1 → 3.0.3

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.
Files changed (57) hide show
  1. package/bin/seastudio.js +0 -0
  2. package/dist/chunk-D7ONFXVY.js +98 -0
  3. package/dist/chunk-EIOFZMTC.cjs +109 -0
  4. package/dist/{chunk-AGBZJGTY.cjs → chunk-SUF5BPSK.cjs} +3 -1
  5. package/dist/{chunk-DDVRUPMZ.js → chunk-XU5GEWWL.js} +3 -1
  6. package/dist/develop-tool/cli/index.cjs +79 -7
  7. package/dist/develop-tool/cli/index.js +79 -7
  8. package/dist/index.cjs +42 -167
  9. package/dist/index.d.cts +2 -6
  10. package/dist/index.d.ts +2 -6
  11. package/dist/index.js +2 -7
  12. package/dist/mcp/core/index.d.cts +2 -2
  13. package/dist/mcp/core/index.d.ts +2 -2
  14. package/dist/mcp/index.cjs +27 -152
  15. package/dist/mcp/index.d.cts +12 -77
  16. package/dist/mcp/index.d.ts +12 -77
  17. package/dist/mcp/index.js +2 -7
  18. package/dist/mcp/seastudio/index.cjs +18 -18
  19. package/dist/mcp/seastudio/index.d.cts +34 -2
  20. package/dist/mcp/seastudio/index.d.ts +34 -2
  21. package/dist/mcp/seastudio/index.js +1 -1
  22. package/dist/{types-Clgf5gBf.d.cts → types-B32sUvc0.d.cts} +10 -2
  23. package/dist/{types-Clgf5gBf.d.ts → types-B32sUvc0.d.ts} +10 -2
  24. package/package.json +2 -22
  25. package/src/develop-tool/templates/plugin/frontend/package.json.tmpl +1 -1
  26. package/src/develop-tool/templates/plugin/frontend/src/main.tsx +3 -0
  27. package/src/develop-tool/templates/plugin/frontend/src/mcp-entry.ts.tmpl +12 -0
  28. package/dist/chunk-4ITOR5QE.js +0 -901
  29. package/dist/chunk-CSXDT47Y.cjs +0 -105
  30. package/dist/chunk-CVF4QHS6.cjs +0 -436
  31. package/dist/chunk-DSOSHJH2.js +0 -643
  32. package/dist/chunk-FLATZQA2.js +0 -174
  33. package/dist/chunk-HJJTBVKQ.cjs +0 -909
  34. package/dist/chunk-ISI2OLPI.cjs +0 -179
  35. package/dist/chunk-MYURVLGP.cjs +0 -165
  36. package/dist/chunk-QD4KISXM.js +0 -160
  37. package/dist/chunk-SNGU4SHO.cjs +0 -654
  38. package/dist/chunk-V7MNKGS7.js +0 -94
  39. package/dist/chunk-Z7LV7DCO.js +0 -429
  40. package/dist/mcp/plugin-editor/index.cjs +0 -47
  41. package/dist/mcp/plugin-editor/index.d.cts +0 -98
  42. package/dist/mcp/plugin-editor/index.d.ts +0 -98
  43. package/dist/mcp/plugin-editor/index.js +0 -2
  44. package/dist/mcp/plugin-excel/index.cjs +0 -31
  45. package/dist/mcp/plugin-excel/index.d.cts +0 -86
  46. package/dist/mcp/plugin-excel/index.d.ts +0 -86
  47. package/dist/mcp/plugin-excel/index.js +0 -2
  48. package/dist/mcp/plugin-preview/index.cjs +0 -23
  49. package/dist/mcp/plugin-preview/index.d.cts +0 -109
  50. package/dist/mcp/plugin-preview/index.d.ts +0 -109
  51. package/dist/mcp/plugin-preview/index.js +0 -2
  52. package/dist/mcp/plugin-seaflow/index.cjs +0 -35
  53. package/dist/mcp/plugin-seaflow/index.d.cts +0 -318
  54. package/dist/mcp/plugin-seaflow/index.d.ts +0 -318
  55. package/dist/mcp/plugin-seaflow/index.js +0 -2
  56. package/dist/tools-LMW67LIY.js +0 -2
  57. package/dist/tools-TU7PBMDO.cjs +0 -23
@@ -1,643 +0,0 @@
1
- import { getDefaultClient } from './chunk-ANWOL7SM.js';
2
-
3
- // src/mcp/plugin-editor/tools.ts
4
- function annotateTool(tool, annotations, outputSchema) {
5
- return {
6
- ...tool,
7
- annotations,
8
- ...outputSchema ? { outputSchema } : {}
9
- };
10
- }
11
- var editorPathEvidenceOutputSchema = {
12
- type: "object",
13
- properties: {
14
- path: { type: "string" }
15
- },
16
- required: ["path"]
17
- };
18
- var fileOperationTools = [
19
- annotateTool({
20
- name: "editor-open_file",
21
- description: "\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u6307\u5B9A\u6587\u4EF6\uFF0C\u53EF\u9009\u8DF3\u8F6C\u5230\u884C\u5217\u4F4D\u7F6E\u3002\u9002\u7528\u4E8E\u628A\u76EE\u6807\u6587\u4EF6\u5E26\u5230\u524D\u53F0\u4F9B\u7528\u6237\u67E5\u770B\u6216\u7EE7\u7EED\u7F16\u8F91\u3002",
22
- inputSchema: {
23
- type: "object",
24
- properties: {
25
- path: { type: "string", description: "\u6587\u4EF6\u8DEF\u5F84" },
26
- line: { type: "number", description: "\u8DF3\u8F6C\u5230\u7684\u884C\u53F7\uFF08\u53EF\u9009\uFF09" },
27
- column: { type: "number", description: "\u8DF3\u8F6C\u5230\u7684\u5217\u53F7\uFF08\u53EF\u9009\uFF09" }
28
- },
29
- required: ["path"]
30
- }
31
- }, {
32
- operationKind: "system",
33
- requiresExecutionEvidence: true,
34
- rawDomain: "editor"
35
- }, editorPathEvidenceOutputSchema),
36
- annotateTool({
37
- name: "editor-save_file",
38
- description: "\u4FDD\u5B58\u6307\u5B9A\u6587\u4EF6",
39
- inputSchema: {
40
- type: "object",
41
- properties: {
42
- path: { type: "string", description: "\u6587\u4EF6\u8DEF\u5F84\uFF0C\u4E0D\u4F20\u5219\u4FDD\u5B58\u5F53\u524D\u6587\u4EF6" }
43
- }
44
- }
45
- }, {
46
- operationKind: "mutate",
47
- requiresExecutionEvidence: true,
48
- rawDomain: "editor"
49
- }, editorPathEvidenceOutputSchema),
50
- annotateTool({
51
- name: "editor-get_dirty_files",
52
- description: "\u83B7\u53D6\u7F16\u8F91\u5668\u4E2D\u6240\u6709\u672A\u4FDD\u5B58\u6587\u4EF6\u5217\u8868\u3002\u9002\u7528\u4E8E\u5728\u8BFB\u5199\u524D\u5224\u65AD\u662F\u5426\u5B58\u5728\u672A\u843D\u76D8\u5185\u5BB9\u3002",
53
- inputSchema: {
54
- type: "object",
55
- properties: {}
56
- }
57
- }, {
58
- operationKind: "read",
59
- requiresExecutionEvidence: false,
60
- rawDomain: "editor"
61
- }, {
62
- type: "object",
63
- properties: {
64
- files: {
65
- type: "array",
66
- items: {
67
- type: "object",
68
- properties: {
69
- path: { type: "string" },
70
- isDirty: { type: "boolean" }
71
- }
72
- }
73
- }
74
- }
75
- }),
76
- annotateTool({
77
- name: "editor-get_editing_file",
78
- description: '\u83B7\u53D6\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u6587\u4EF6\u7684\u8DEF\u5F84\u3001\u5185\u5BB9\u548C\u810F\u72B6\u6001\u3002\u9002\u7528\u4E8E\u7EED\u63A5"\u5F53\u524D\u6587\u4EF6/\u8FD9\u4E2A\u6587\u4EF6"\u7684\u4E0A\u4E0B\u6587\u3002',
79
- inputSchema: {
80
- type: "object",
81
- properties: {}
82
- }
83
- }, {
84
- operationKind: "read",
85
- requiresExecutionEvidence: false,
86
- rawDomain: "editor"
87
- }, {
88
- type: "object",
89
- properties: {
90
- path: { type: "string" },
91
- content: { type: "string" },
92
- isDirty: { type: "boolean" }
93
- }
94
- }),
95
- annotateTool({
96
- name: "editor-file_saved",
97
- description: "\u67E5\u8BE2\u6307\u5B9A\u6587\u4EF6\u662F\u5426\u5DF2\u4FDD\u5B58",
98
- inputSchema: {
99
- type: "object",
100
- properties: {
101
- path: { type: "string", description: "\u6587\u4EF6\u8DEF\u5F84" }
102
- },
103
- required: ["path"]
104
- }
105
- }, {
106
- operationKind: "read",
107
- requiresExecutionEvidence: false,
108
- rawDomain: "editor"
109
- }),
110
- annotateTool({
111
- name: "editor-file_editing",
112
- description: "\u67E5\u8BE2\u6307\u5B9A\u6587\u4EF6\u662F\u5426\u6B63\u5728\u7F16\u8F91\u4E2D",
113
- inputSchema: {
114
- type: "object",
115
- properties: {
116
- path: { type: "string", description: "\u6587\u4EF6\u8DEF\u5F84" }
117
- },
118
- required: ["path"]
119
- }
120
- }, {
121
- operationKind: "read",
122
- requiresExecutionEvidence: false,
123
- rawDomain: "editor"
124
- })
125
- ];
126
- var sessionTools = [
127
- annotateTool({
128
- name: "editor-list_open_files",
129
- description: "\u5217\u51FA\u7F16\u8F91\u5668\u5F53\u524D\u6240\u6709\u5DF2\u6253\u5F00\u7684\u6587\u4EF6\u6807\u7B7E\u9875\uFF0C\u5305\u542B\u8DEF\u5F84\u3001\u8BED\u8A00\u3001\u810F\u72B6\u6001\u3002",
130
- inputSchema: { type: "object", properties: {} }
131
- }, {
132
- operationKind: "read",
133
- requiresExecutionEvidence: false,
134
- rawDomain: "editor"
135
- }),
136
- annotateTool({
137
- name: "editor-get_active_file",
138
- description: "\u83B7\u53D6\u7F16\u8F91\u5668\u5F53\u524D\u6FC0\u6D3B\u6587\u4EF6\u7684\u5B8C\u6574\u4FE1\u606F\uFF1A\u8DEF\u5F84\u3001\u5185\u5BB9\u3001\u8BED\u8A00\u3001\u810F\u72B6\u6001\u3002",
139
- inputSchema: { type: "object", properties: {} }
140
- }, {
141
- operationKind: "read",
142
- requiresExecutionEvidence: false,
143
- rawDomain: "editor"
144
- }),
145
- annotateTool({
146
- name: "editor-focus_file",
147
- description: "\u5C06\u7F16\u8F91\u5668\u7126\u70B9\u5207\u6362\u5230\u6307\u5B9A\u5DF2\u6253\u5F00\u7684\u6587\u4EF6\u6807\u7B7E\u9875\u3002",
148
- inputSchema: {
149
- type: "object",
150
- properties: {
151
- file_key: { type: "string", description: "\u6587\u4EF6\u6807\u7B7E\u9875\u7684 key (rootId:path)" }
152
- },
153
- required: ["file_key"]
154
- }
155
- }, {
156
- operationKind: "system",
157
- requiresExecutionEvidence: true,
158
- rawDomain: "editor"
159
- }),
160
- annotateTool({
161
- name: "editor-close_file",
162
- description: "\u5173\u95ED\u7F16\u8F91\u5668\u4E2D\u6307\u5B9A\u7684\u6587\u4EF6\u6807\u7B7E\u9875\u3002",
163
- inputSchema: {
164
- type: "object",
165
- properties: {
166
- file_key: { type: "string", description: "\u6587\u4EF6\u6807\u7B7E\u9875\u7684 key (rootId:path)" }
167
- },
168
- required: ["file_key"]
169
- }
170
- }, {
171
- operationKind: "system",
172
- requiresExecutionEvidence: true,
173
- rawDomain: "editor"
174
- }),
175
- annotateTool({
176
- name: "editor-save_all_files",
177
- description: "\u4FDD\u5B58\u7F16\u8F91\u5668\u4E2D\u6240\u6709\u672A\u4FDD\u5B58\u7684\u6587\u4EF6\u3002",
178
- inputSchema: { type: "object", properties: {} }
179
- }, {
180
- operationKind: "mutate",
181
- requiresExecutionEvidence: true,
182
- rawDomain: "editor"
183
- })
184
- ];
185
- var fileMutationTools = [
186
- annotateTool({
187
- name: "editor-create_file",
188
- description: "\u521B\u5EFA\u65B0\u6587\u4EF6\u5E76\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u3002\u4EC5\u7528\u4E8E\u521B\u5EFA\u4E0D\u5B58\u5728\u7684\u65B0\u6587\u4EF6\u3002\u4FEE\u6539\u5DF2\u6709\u6587\u4EF6\u5FC5\u987B\u4F7F\u7528 editor-proposal_create\u3002",
189
- inputSchema: {
190
- type: "object",
191
- properties: {
192
- path: { type: "string", description: "\u6587\u4EF6\u8DEF\u5F84" },
193
- content: { type: "string", description: "\u6587\u4EF6\u5185\u5BB9\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4\u7A7A\uFF09" },
194
- root_id: { type: "string", enum: ["workspace"], description: "\u6587\u4EF6\u6839\uFF08\u9ED8\u8BA4 workspace\uFF09" }
195
- },
196
- required: ["path"]
197
- }
198
- }, {
199
- operationKind: "mutate",
200
- requiresExecutionEvidence: true,
201
- rawDomain: "editor"
202
- }),
203
- annotateTool({
204
- name: "editor-create_dir",
205
- description: "\u521B\u5EFA\u76EE\u5F55\u3002",
206
- inputSchema: {
207
- type: "object",
208
- properties: {
209
- path: { type: "string", description: "\u76EE\u5F55\u8DEF\u5F84" }
210
- },
211
- required: ["path"]
212
- }
213
- }, {
214
- operationKind: "mutate",
215
- requiresExecutionEvidence: true,
216
- rawDomain: "editor"
217
- }),
218
- annotateTool({
219
- name: "editor-rename_path",
220
- description: "\u91CD\u547D\u540D\u6587\u4EF6\u6216\u76EE\u5F55\u3002\u5982\u679C\u6587\u4EF6\u5728\u7F16\u8F91\u5668\u4E2D\u5DF2\u6253\u5F00\uFF0C\u6807\u7B7E\u9875\u4F1A\u540C\u6B65\u66F4\u65B0\u3002",
221
- inputSchema: {
222
- type: "object",
223
- properties: {
224
- old_path: { type: "string", description: "\u539F\u8DEF\u5F84" },
225
- new_path: { type: "string", description: "\u65B0\u8DEF\u5F84" }
226
- },
227
- required: ["old_path", "new_path"]
228
- }
229
- }, {
230
- operationKind: "mutate",
231
- requiresExecutionEvidence: true,
232
- rawDomain: "editor"
233
- }),
234
- annotateTool({
235
- name: "editor-delete_path",
236
- description: "\u5220\u9664\u6587\u4EF6\u6216\u76EE\u5F55\u3002\u5982\u679C\u6587\u4EF6\u5728\u7F16\u8F91\u5668\u4E2D\u5DF2\u6253\u5F00\uFF0C\u6807\u7B7E\u9875\u4F1A\u81EA\u52A8\u5173\u95ED\u3002",
237
- inputSchema: {
238
- type: "object",
239
- properties: {
240
- path: { type: "string", description: "\u8981\u5220\u9664\u7684\u8DEF\u5F84" }
241
- },
242
- required: ["path"]
243
- }
244
- }, {
245
- operationKind: "mutate",
246
- requiresExecutionEvidence: true,
247
- rawDomain: "editor"
248
- }),
249
- annotateTool({
250
- name: "editor-write_file",
251
- description: "\u521B\u5EFA\u65B0\u6587\u4EF6\u5E76\u5199\u5165\u5185\u5BB9\u540E\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u3002\u4EC5\u7528\u4E8E\u4E0D\u5B58\u5728\u7684\u65B0\u6587\u4EF6\u3002\u4FEE\u6539\u5DF2\u6709\u6587\u4EF6\u7981\u6B62\u4F7F\u7528\u6B64\u5DE5\u5177\uFF0C\u5FC5\u987B\u4F7F\u7528 editor-proposal_create \u521B\u5EFA\u63D0\u6848\u8BA9\u7528\u6237\u5BA1\u9605\u3002",
252
- inputSchema: {
253
- type: "object",
254
- properties: {
255
- path: { type: "string", description: "\u6587\u4EF6\u8DEF\u5F84" },
256
- content: { type: "string", description: "\u6587\u4EF6\u5185\u5BB9" },
257
- root_id: { type: "string", enum: ["workspace"], description: "\u6587\u4EF6\u6839\uFF08\u9ED8\u8BA4 workspace\uFF09" }
258
- },
259
- required: ["path", "content"]
260
- }
261
- }, {
262
- operationKind: "mutate",
263
- requiresExecutionEvidence: true,
264
- rawDomain: "editor"
265
- }),
266
- annotateTool({
267
- name: "editor-write_batch",
268
- description: "\u6279\u91CF\u521B\u5EFA\u591A\u4E2A\u65B0\u6587\u4EF6\u3002\u4EC5\u7528\u4E8E\u4E0D\u5B58\u5728\u7684\u65B0\u6587\u4EF6\u3002\u4FEE\u6539\u5DF2\u6709\u6587\u4EF6\u7981\u6B62\u4F7F\u7528\u6B64\u5DE5\u5177\uFF0C\u5FC5\u987B\u4F7F\u7528 editor-proposal_create\u3002",
269
- inputSchema: {
270
- type: "object",
271
- properties: {
272
- changes: {
273
- type: "array",
274
- items: {
275
- type: "object",
276
- properties: {
277
- path: { type: "string" },
278
- content: { type: "string" }
279
- },
280
- required: ["path", "content"]
281
- },
282
- description: "\u8981\u5199\u5165\u7684\u6587\u4EF6\u5217\u8868"
283
- }
284
- },
285
- required: ["changes"]
286
- }
287
- }, {
288
- operationKind: "mutate",
289
- requiresExecutionEvidence: true,
290
- rawDomain: "editor"
291
- })
292
- ];
293
- var previewTools = [
294
- annotateTool({
295
- name: "editor-get_view_mode",
296
- description: "\u83B7\u53D6\u7F16\u8F91\u5668\u5F53\u524D\u6587\u4EF6\u7684\u89C6\u56FE\u6A21\u5F0F\uFF08edit \u6216 preview\uFF09\u3002",
297
- inputSchema: {
298
- type: "object",
299
- properties: {
300
- file_key: { type: "string", description: "\u6587\u4EF6\u6807\u7B7E\u9875 key\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4\u5F53\u524D\u6587\u4EF6\uFF09" }
301
- }
302
- }
303
- }, {
304
- operationKind: "read",
305
- requiresExecutionEvidence: false,
306
- rawDomain: "editor"
307
- }),
308
- annotateTool({
309
- name: "editor-set_view_mode",
310
- description: "\u5207\u6362\u7F16\u8F91\u5668\u7684\u89C6\u56FE\u6A21\u5F0F\u3002\u5BF9 Markdown \u6587\u4EF6\u53EF\u5728\u7F16\u8F91\u548C\u9884\u89C8\u4E4B\u95F4\u5207\u6362\u3002",
311
- inputSchema: {
312
- type: "object",
313
- properties: {
314
- mode: { type: "string", enum: ["edit", "preview"], description: "\u76EE\u6807\u89C6\u56FE\u6A21\u5F0F" },
315
- file_key: { type: "string", description: "\u6587\u4EF6\u6807\u7B7E\u9875 key\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4\u5F53\u524D\u6587\u4EF6\uFF09" }
316
- },
317
- required: ["mode"]
318
- }
319
- }, {
320
- operationKind: "system",
321
- requiresExecutionEvidence: true,
322
- rawDomain: "editor"
323
- }),
324
- annotateTool({
325
- name: "editor-render_markdown_preview",
326
- description: "\u83B7\u53D6 Markdown \u6587\u4EF6\u7684\u9884\u89C8\u5185\u5BB9\u3002\u8FD4\u56DE\u539F\u59CB Markdown \u5185\u5BB9\u548C\u5143\u6570\u636E\u3002",
327
- inputSchema: {
328
- type: "object",
329
- properties: {
330
- path: { type: "string", description: "\u6587\u4EF6\u8DEF\u5F84\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4\u5F53\u524D\u6587\u4EF6\uFF09" }
331
- }
332
- }
333
- }, {
334
- operationKind: "read",
335
- requiresExecutionEvidence: false,
336
- rawDomain: "editor"
337
- })
338
- ];
339
- var referenceTools = [
340
- annotateTool({
341
- name: "editor-resolve_path_reference",
342
- description: "\u89E3\u6790\u6587\u4EF6\u8DEF\u5F84\u5F15\u7528\u3002\u652F\u6301\u76F8\u5BF9\u8DEF\u5F84\u3001\u7EDD\u5BF9\u8DEF\u5F84\u3001./ \u524D\u7F00\u7B49\u591A\u79CD\u98CE\u683C\uFF0C\u7EDF\u4E00\u89E3\u6790\u5230\u5B9E\u9645\u8DEF\u5F84\u3002",
343
- inputSchema: {
344
- type: "object",
345
- properties: {
346
- path: { type: "string", description: "\u5F85\u89E3\u6790\u7684\u8DEF\u5F84\u5F15\u7528" }
347
- },
348
- required: ["path"]
349
- }
350
- }, {
351
- operationKind: "read",
352
- requiresExecutionEvidence: false,
353
- rawDomain: "editor"
354
- }),
355
- annotateTool({
356
- name: "editor-open_reference",
357
- description: "\u89E3\u6790\u8DEF\u5F84\u5F15\u7528\u5E76\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u5BF9\u5E94\u6587\u4EF6\u3002\u9002\u7528\u4E8E\u4EE3\u7801\u4E2D\u7684 import/require \u8DF3\u8F6C\u3002",
358
- inputSchema: {
359
- type: "object",
360
- properties: {
361
- path: { type: "string", description: "\u8DEF\u5F84\u5F15\u7528" }
362
- },
363
- required: ["path"]
364
- }
365
- }, {
366
- operationKind: "system",
367
- requiresExecutionEvidence: true,
368
- rawDomain: "editor"
369
- }),
370
- annotateTool({
371
- name: "editor-search_paths",
372
- description: "\u5728\u5DE5\u4F5C\u533A\u4E2D\u6309\u6587\u4EF6\u540D\u6A21\u7CCA\u641C\u7D22\u8DEF\u5F84\u3002",
373
- inputSchema: {
374
- type: "object",
375
- properties: {
376
- query: { type: "string", description: "\u641C\u7D22\u5173\u952E\u8BCD" }
377
- },
378
- required: ["query"]
379
- }
380
- }, {
381
- operationKind: "read",
382
- requiresExecutionEvidence: false,
383
- rawDomain: "editor"
384
- })
385
- ];
386
- var proposalTools = [
387
- annotateTool({
388
- name: "editor-proposal_create",
389
- description: "\u3010\u4FEE\u6539\u5DF2\u6709\u6587\u4EF6\u7684\u552F\u4E00\u65B9\u5F0F\u3011\u521B\u5EFA\u53D8\u66F4\u63D0\u6848\uFF0C\u5728\u7F16\u8F91\u5668\u4E2D\u4EE5\u7EA2\u8272(\u5220\u9664)\u7EFF\u8272(\u65B0\u589E)\u5185\u8054 diff \u5C55\u793A\uFF0C\u7528\u6237\u53EF\u9010\u5757\u63A5\u53D7\u6216\u62D2\u7EDD\u3002\u6D41\u7A0B\uFF1A1)\u5148 read_file \u83B7\u53D6\u539F\u5185\u5BB9 2)\u6784\u9020 hunks\uFF08\u6BCF\u4E2A hunk \u5BF9\u5E94\u4E00\u5904\u903B\u8F91\u53D8\u66F4\uFF093)\u8C03\u7528\u6B64\u5DE5\u5177 4)\u544A\u77E5\u7528\u6237\u63D0\u6848\u5DF2\u5C31\u7EEA\u5E76\u7B49\u5F85\u7528\u6237\u64CD\u4F5C\u3002\u9002\u7528\u4E8E\u6240\u6709\u6587\u4EF6\u7C7B\u578B\uFF1A\u4EE3\u7801\u3001markdown\u3001\u6587\u672C\u3001\u914D\u7F6E\u7B49\u3002\u521B\u5EFA\u540E\u4E0D\u8981\u81EA\u52A8\u8C03\u7528 apply\u3002",
390
- inputSchema: {
391
- type: "object",
392
- properties: {
393
- title: { type: "string", description: "\u63D0\u6848\u6807\u9898" },
394
- files: {
395
- type: "array",
396
- items: {
397
- type: "object",
398
- properties: {
399
- path: { type: "string" },
400
- rootId: { type: "string", enum: ["workspace"] },
401
- originalContent: { type: "string" },
402
- proposedContent: { type: "string" },
403
- hunks: {
404
- type: "array",
405
- items: {
406
- type: "object",
407
- properties: {
408
- id: { type: "string" },
409
- startLine: { type: "number" },
410
- endLine: { type: "number" },
411
- originalContent: { type: "string" },
412
- proposedContent: { type: "string" }
413
- },
414
- required: ["id", "startLine", "endLine", "originalContent", "proposedContent"]
415
- }
416
- }
417
- },
418
- required: ["path", "originalContent", "proposedContent", "hunks"]
419
- },
420
- description: "\u6D89\u53CA\u7684\u6587\u4EF6\u53D8\u66F4\u5217\u8868"
421
- }
422
- },
423
- required: ["title", "files"]
424
- }
425
- }, {
426
- operationKind: "mutate",
427
- requiresExecutionEvidence: true,
428
- rawDomain: "editor"
429
- }),
430
- annotateTool({
431
- name: "editor-proposal_list",
432
- description: "\u5217\u51FA\u6240\u6709\u4EE3\u7801\u53D8\u66F4\u63D0\u6848\u3002",
433
- inputSchema: { type: "object", properties: {} }
434
- }, {
435
- operationKind: "read",
436
- requiresExecutionEvidence: false,
437
- rawDomain: "editor"
438
- }),
439
- annotateTool({
440
- name: "editor-proposal_get_diff",
441
- description: "\u83B7\u53D6\u6307\u5B9A\u63D0\u6848\u7684 diff \u8BE6\u60C5\uFF0C\u5305\u542B\u6240\u6709\u6587\u4EF6\u7684 hunk \u5217\u8868\u3002",
442
- inputSchema: {
443
- type: "object",
444
- properties: {
445
- proposal_id: { type: "string", description: "\u63D0\u6848 ID" }
446
- },
447
- required: ["proposal_id"]
448
- }
449
- }, {
450
- operationKind: "read",
451
- requiresExecutionEvidence: false,
452
- rawDomain: "editor"
453
- }),
454
- annotateTool({
455
- name: "editor-proposal_apply_all",
456
- description: "\u91C7\u7EB3\u63D0\u6848\u4E2D\u6240\u6709\u53D8\u66F4\u5E76\u5199\u5165\u6587\u4EF6\u3002\u4E0D\u8981\u5728 proposal_create \u4E4B\u540E\u81EA\u52A8\u8C03\u7528\u2014\u2014\u7528\u6237\u901A\u8FC7\u7F16\u8F91\u5668 UI \u51B3\u5B9A\u3002\u4EC5\u5728\u7528\u6237\u660E\u786E\u8981\u6C42\u65F6\u8C03\u7528\u3002",
457
- inputSchema: {
458
- type: "object",
459
- properties: {
460
- proposal_id: { type: "string", description: "\u63D0\u6848 ID" }
461
- },
462
- required: ["proposal_id"]
463
- }
464
- }, {
465
- operationKind: "mutate",
466
- requiresExecutionEvidence: true,
467
- rawDomain: "editor"
468
- }),
469
- annotateTool({
470
- name: "editor-proposal_apply_hunks",
471
- description: "\u9009\u62E9\u6027\u91C7\u7EB3\u63D0\u6848\u4E2D\u7684\u90E8\u5206 hunk\u3002\u4E0D\u8981\u81EA\u52A8\u8C03\u7528\u2014\u2014\u7528\u6237\u901A\u8FC7\u7F16\u8F91\u5668 UI \u51B3\u5B9A\u3002\u4EC5\u5728\u7528\u6237\u660E\u786E\u8981\u6C42\u65F6\u8C03\u7528\u3002",
472
- inputSchema: {
473
- type: "object",
474
- properties: {
475
- proposal_id: { type: "string", description: "\u63D0\u6848 ID" },
476
- hunk_ids: {
477
- type: "array",
478
- items: { type: "string" },
479
- description: "\u8981\u91C7\u7EB3\u7684 hunk ID \u5217\u8868"
480
- }
481
- },
482
- required: ["proposal_id", "hunk_ids"]
483
- }
484
- }, {
485
- operationKind: "mutate",
486
- requiresExecutionEvidence: true,
487
- rawDomain: "editor"
488
- }),
489
- annotateTool({
490
- name: "editor-proposal_reject",
491
- description: "\u62D2\u7EDD\u63D0\u6848\u7684\u6240\u6709\u53D8\u66F4\u3002\u4E0D\u8981\u81EA\u52A8\u8C03\u7528\u2014\u2014\u7528\u6237\u901A\u8FC7\u7F16\u8F91\u5668 UI \u51B3\u5B9A\u3002\u4EC5\u5728\u7528\u6237\u660E\u786E\u8981\u6C42\u65F6\u8C03\u7528\u3002",
492
- inputSchema: {
493
- type: "object",
494
- properties: {
495
- proposal_id: { type: "string", description: "\u63D0\u6848 ID" }
496
- },
497
- required: ["proposal_id"]
498
- }
499
- }, {
500
- operationKind: "mutate",
501
- requiresExecutionEvidence: true,
502
- rawDomain: "editor"
503
- })
504
- ];
505
- var extensionTools = [
506
- annotateTool({
507
- name: "editor-ext_list",
508
- description: "\u5217\u51FA\u7F16\u8F91\u5668\u4E2D\u6240\u6709\u5DF2\u6CE8\u518C\u7684\u6269\u5C55\uFF0C\u6309\u7C7B\u578B\u5206\u7EC4\u3002",
509
- inputSchema: {
510
- type: "object",
511
- properties: {
512
- type: { type: "string", enum: ["diagnostics", "proposal", "preview", "command", "completion"], description: "\u53EF\u9009\uFF0C\u6309\u7C7B\u578B\u8FC7\u6EE4" }
513
- }
514
- }
515
- }, {
516
- operationKind: "read",
517
- requiresExecutionEvidence: false,
518
- rawDomain: "editor"
519
- }),
520
- annotateTool({
521
- name: "editor-ext_run_command",
522
- description: "\u6267\u884C\u7F16\u8F91\u5668\u4E2D\u5DF2\u6CE8\u518C\u7684\u547D\u4EE4\u6269\u5C55\u3002",
523
- inputSchema: {
524
- type: "object",
525
- properties: {
526
- extension_id: { type: "string", description: "\u547D\u4EE4\u6269\u5C55\u7684 ID" },
527
- file_path: { type: "string", description: "\u5F53\u524D\u6587\u4EF6\u8DEF\u5F84\uFF08\u53EF\u9009\uFF09" },
528
- content: { type: "string", description: "\u5F53\u524D\u6587\u4EF6\u5185\u5BB9\uFF08\u53EF\u9009\uFF09" },
529
- selection: {
530
- type: "object",
531
- properties: {
532
- startLine: { type: "number" },
533
- startColumn: { type: "number" },
534
- endLine: { type: "number" },
535
- endColumn: { type: "number" },
536
- text: { type: "string" }
537
- },
538
- description: "\u5F53\u524D\u9009\u533A\uFF08\u53EF\u9009\uFF09"
539
- }
540
- },
541
- required: ["extension_id"]
542
- }
543
- }, {
544
- operationKind: "mutate",
545
- requiresExecutionEvidence: true,
546
- rawDomain: "editor"
547
- }),
548
- annotateTool({
549
- name: "editor-ext_run_diagnostics",
550
- description: "\u4F7F\u7528\u6307\u5B9A\u7684\u8BCA\u65AD\u6269\u5C55\u5BF9\u6587\u4EF6\u6267\u884C\u8BCA\u65AD\u68C0\u67E5\u3002",
551
- inputSchema: {
552
- type: "object",
553
- properties: {
554
- extension_id: { type: "string", description: "\u8BCA\u65AD\u6269\u5C55 ID\uFF08\u53EF\u9009\uFF0C\u4E0D\u4F20\u5219\u8FD0\u884C\u6240\u6709\u5339\u914D\u7684\u8BCA\u65AD\u6269\u5C55\uFF09" },
555
- file_path: { type: "string", description: "\u6587\u4EF6\u8DEF\u5F84" },
556
- language: { type: "string", description: "\u8BED\u8A00\u6807\u8BC6\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4\u81EA\u52A8\u68C0\u6D4B\uFF09" },
557
- content: { type: "string", description: "\u6587\u4EF6\u5185\u5BB9" }
558
- },
559
- required: ["file_path", "content"]
560
- }
561
- }, {
562
- operationKind: "read",
563
- requiresExecutionEvidence: false,
564
- rawDomain: "editor"
565
- }),
566
- annotateTool({
567
- name: "editor-ext_get_completions",
568
- description: "\u4F7F\u7528\u8865\u5168\u6269\u5C55\u83B7\u53D6\u4EE3\u7801\u8865\u5168\u5EFA\u8BAE\u3002",
569
- inputSchema: {
570
- type: "object",
571
- properties: {
572
- file_path: { type: "string", description: "\u6587\u4EF6\u8DEF\u5F84" },
573
- language: { type: "string", description: "\u8BED\u8A00\u6807\u8BC6" },
574
- content: { type: "string", description: "\u6587\u4EF6\u5185\u5BB9" },
575
- line: { type: "number", description: "\u5149\u6807\u884C\u53F7" },
576
- column: { type: "number", description: "\u5149\u6807\u5217\u53F7" },
577
- prefix: { type: "string", description: "\u5F53\u524D\u8F93\u5165\u524D\u7F00" }
578
- },
579
- required: ["file_path", "content", "line", "column", "prefix"]
580
- }
581
- }, {
582
- operationKind: "read",
583
- requiresExecutionEvidence: false,
584
- rawDomain: "editor"
585
- })
586
- ];
587
- var tools = fileOperationTools;
588
- var allTools = [
589
- ...fileOperationTools,
590
- ...sessionTools,
591
- ...fileMutationTools,
592
- ...previewTools,
593
- ...referenceTools,
594
- ...proposalTools,
595
- ...extensionTools
596
- ];
597
- async function callTool(name, args = {}) {
598
- return getDefaultClient().callTool(name, args);
599
- }
600
- var editor = {
601
- // Original
602
- openFile: (path, line, column) => callTool("editor-open_file", { path, line, column }),
603
- saveFile: (path) => callTool("editor-save_file", { path }),
604
- getDirtyFiles: () => callTool("editor-get_dirty_files", {}),
605
- getEditingFile: () => callTool("editor-get_editing_file", {}),
606
- fileSaved: (path) => callTool("editor-file_saved", { path }),
607
- fileEditing: (path) => callTool("editor-file_editing", { path }),
608
- // Session / State
609
- listOpenFiles: () => callTool("editor-list_open_files", {}),
610
- getActiveFile: () => callTool("editor-get_active_file", {}),
611
- focusFile: (fileKey) => callTool("editor-focus_file", { file_key: fileKey }),
612
- closeFile: (fileKey) => callTool("editor-close_file", { file_key: fileKey }),
613
- saveAllFiles: () => callTool("editor-save_all_files", {}),
614
- // File Mutation
615
- createFile: (path, content, rootId) => callTool("editor-create_file", { path, content, root_id: rootId }),
616
- createDir: (path) => callTool("editor-create_dir", { path }),
617
- renamePath: (oldPath, newPath) => callTool("editor-rename_path", { old_path: oldPath, new_path: newPath }),
618
- deletePath: (path) => callTool("editor-delete_path", { path }),
619
- writeFile: (path, content, rootId) => callTool("editor-write_file", { path, content, root_id: rootId }),
620
- writeBatch: (changes) => callTool("editor-write_batch", { changes }),
621
- // Preview
622
- getViewMode: (fileKey) => callTool("editor-get_view_mode", { file_key: fileKey }),
623
- setViewMode: (mode, fileKey) => callTool("editor-set_view_mode", { mode, file_key: fileKey }),
624
- renderMarkdownPreview: (path) => callTool("editor-render_markdown_preview", { path }),
625
- // References
626
- resolvePathReference: (path) => callTool("editor-resolve_path_reference", { path }),
627
- openReference: (path) => callTool("editor-open_reference", { path }),
628
- searchPaths: (query) => callTool("editor-search_paths", { query }),
629
- // Proposals
630
- createProposal: (title, files) => callTool("editor-proposal_create", { title, files }),
631
- listProposals: () => callTool("editor-proposal_list", {}),
632
- getProposalDiff: (proposalId) => callTool("editor-proposal_get_diff", { proposal_id: proposalId }),
633
- applyProposalAll: (proposalId) => callTool("editor-proposal_apply_all", { proposal_id: proposalId }),
634
- applyProposalHunks: (proposalId, hunkIds) => callTool("editor-proposal_apply_hunks", { proposal_id: proposalId, hunk_ids: hunkIds }),
635
- rejectProposal: (proposalId) => callTool("editor-proposal_reject", { proposal_id: proposalId }),
636
- // Extensions
637
- listExtensions: (type) => callTool("editor-ext_list", { type }),
638
- runCommand: (extensionId, filePath, content, selection) => callTool("editor-ext_run_command", { extension_id: extensionId, file_path: filePath, content, selection }),
639
- runDiagnostics: (filePath, content, extensionId, language) => callTool("editor-ext_run_diagnostics", { extension_id: extensionId, file_path: filePath, content, language }),
640
- getCompletions: (filePath, content, line, column, prefix, language) => callTool("editor-ext_get_completions", { file_path: filePath, content, line, column, prefix, language })
641
- };
642
-
643
- export { allTools, editor, extensionTools, fileMutationTools, fileOperationTools, previewTools, proposalTools, referenceTools, sessionTools, tools };