@seastudio/sdk 4.0.3 → 4.0.4

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNPAVHBYU_cjs = require('./chunk-NPAVHBYU.cjs');
3
+ var chunkPBK7SWE4_cjs = require('./chunk-PBK7SWE4.cjs');
4
4
  var chunk3I7UM66P_cjs = require('./chunk-3I7UM66P.cjs');
5
5
 
6
6
  // src/mcp/index.ts
@@ -11,7 +11,7 @@ async function loadPlugin(pluginName) {
11
11
  throw new Error(`Unknown plugin: ${pluginName}. \u63D2\u4EF6 MCP \u4E0D\u518D\u901A\u8FC7 SDK \u9759\u6001\u5BFC\u5165\u3002`);
12
12
  }
13
13
  var MCP_PACKAGES = [
14
- { id: "seastudio", name: "SeaStudio", description: "\u6587\u4EF6/Shell/AIGC \u57FA\u7840\u80FD\u529B", tools: chunkNPAVHBYU_cjs.allTools }
14
+ { id: "seastudio", name: "SeaStudio", description: "\u6587\u4EF6/Shell/AIGC \u57FA\u7840\u80FD\u529B", tools: chunkPBK7SWE4_cjs.allTools }
15
15
  ];
16
16
  function mcpToolToOpenAI(tool) {
17
17
  const normalizedTool = chunk3I7UM66P_cjs.normalizeMCPTool(tool);
@@ -29,7 +29,7 @@ function mcpToolToOpenAI(tool) {
29
29
  };
30
30
  }
31
31
  function listAllTools() {
32
- return [...chunkNPAVHBYU_cjs.allTools];
32
+ return [...chunkPBK7SWE4_cjs.allTools];
33
33
  }
34
34
  function toPackageName(source) {
35
35
  if (source === "seastudio") {
@@ -62,7 +62,7 @@ function normalizeAvailableTool(raw) {
62
62
  };
63
63
  }
64
64
  var MCP_TOOL_PACKAGE_INDEX = new Map(
65
- chunkNPAVHBYU_cjs.allTools.map((tool) => [tool.name, "seastudio"])
65
+ chunkPBK7SWE4_cjs.allTools.map((tool) => [tool.name, "seastudio"])
66
66
  );
67
67
  function getMCPToolPackageIndex() {
68
68
  return new Map(MCP_TOOL_PACKAGE_INDEX);
@@ -1,4 +1,4 @@
1
- import { allTools } from './chunk-QZTAT5OG.js';
1
+ import { allTools } from './chunk-YEN6XUZ2.js';
2
2
  import { normalizeMCPTool, normalizeMCPToolObjectSchema, getDefaultClient } from './chunk-TJ3CGHWJ.js';
3
3
 
4
4
  // src/mcp/index.ts
@@ -23,7 +23,9 @@ var rootedWriteEvidenceOutputSchema = {
23
23
  properties: {
24
24
  rootId: { type: "string" },
25
25
  path: { type: "string" },
26
- written: { type: "boolean" }
26
+ written: { type: "boolean" },
27
+ reviewed: { type: "boolean" },
28
+ proposalId: { type: "string" }
27
29
  },
28
30
  required: ["rootId", "path", "written"]
29
31
  };
@@ -180,7 +182,7 @@ var fileTools = [
180
182
  }),
181
183
  annotateTool({
182
184
  name: "seastudio-filesystem_mutate",
183
- 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",
185
+ 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\u3002\u9762\u5411 AI \u6539\u7801\u7684\u6587\u672C write \u9ED8\u8BA4 reviewMode=auto\uFF1A\u82E5\u76EE\u6807\u6587\u4EF6\u5DF2\u5728 Code Editor \u6253\u5F00\uFF0C\u4F1A\u5148\u843D\u76D8\u5E76\u751F\u6210 Keep/Undo proposal\uFF1BKeep \u4EC5\u786E\u8BA4\uFF0CUndo \u56DE\u6EDA\u539F\u5185\u5BB9\u3002operations \u6309\u987A\u5E8F\u6267\u884C\uFF0C\u9ED8\u8BA4\u9047\u5230\u9519\u8BEF\u505C\u6B62\u3002",
184
186
  inputSchema: {
185
187
  type: "object",
186
188
  properties: {
@@ -198,6 +200,11 @@ var fileTools = [
198
200
  rootId: rootIdParam,
199
201
  path: pathParam,
200
202
  content: { type: "string", description: "write \u7684\u6587\u672C\u5185\u5BB9\u3002" },
203
+ reviewMode: {
204
+ type: "string",
205
+ enum: ["auto", "direct", "proposal"],
206
+ description: "write \u7684\u5BA1\u6838\u6A21\u5F0F\uFF1Aauto \u9ED8\u8BA4\u5BF9\u6253\u5F00\u4E2D\u7684\u4EE3\u7801\u6587\u4EF6\u5148\u843D\u76D8\u5E76\u663E\u793A Keep/Undo proposal\uFF1Bdirect \u53EA\u76F4\u63A5\u5199\u76D8\uFF1Bproposal \u5F3A\u5236\u8981\u6C42\u663E\u793A proposal\uFF0C\u672A\u547D\u4E2D\u53EF\u5BA1\u6838\u7F16\u8F91\u5668\u65F6\u8FD4\u56DE\u9519\u8BEF\u3002"
207
+ },
201
208
  base64: { type: "string", description: "writeBinary \u7684 base64 \u5185\u5BB9\u3002" },
202
209
  newName: { type: "string", description: "rename \u7684\u65B0\u540D\u79F0\u3002" },
203
210
  sourceRootId: rootIdParam,
@@ -254,6 +261,170 @@ var fileTools = [
254
261
  })
255
262
  ];
256
263
 
264
+ // src/mcp/seastudio/tools/editor.ts
265
+ var editorTools = [
266
+ annotateTool({
267
+ name: "seastudio-editor_propose",
268
+ description: "\u63D0\u4EA4\u4EE3\u7801\u53D8\u66F4\u63D0\u6848\u7ED9 Code Editor\uFF0C\u4EE5 Cursor \u98CE\u683C Keep/Undo \u5185\u8054 diff \u8BA9\u7528\u6237\u5BA1\u6838\u3002Code Editor \u4F1A\u5148\u5E94\u7528 proposedContent\uFF0CKeep \u4EC5\u786E\u8BA4\uFF0CUndo \u56DE\u6EDA originalContent\u3002",
269
+ inputSchema: {
270
+ type: "object",
271
+ properties: {
272
+ proposalId: { type: "string", description: "\u63D0\u6848 ID\uFF0C\u53EF\u9009\uFF1B\u7F3A\u7701\u7531\u4E3B\u7A0B\u5E8F\u751F\u6210\u3002" },
273
+ title: { type: "string", description: "\u63D0\u6848\u6807\u9898\u3002" },
274
+ targetPluginId: { type: "string", description: "\u76EE\u6807\u63D2\u4EF6 ID\uFF0C\u9ED8\u8BA4 seastudio.codeEditor\u3002" },
275
+ targetInstanceId: { type: "string", description: "\u76EE\u6807 Code Editor \u5B9E\u4F8B ID\u3002" },
276
+ openFile: { type: "boolean", description: "\u662F\u5426\u8981\u6C42\u7F16\u8F91\u5668\u6253\u5F00/\u805A\u7126\u63D0\u6848\u6587\u4EF6\uFF0C\u9ED8\u8BA4 true\u3002" },
277
+ origin: {
278
+ type: "object",
279
+ additionalProperties: true,
280
+ description: "\u63D0\u6848\u6765\u6E90\u4FE1\u606F\uFF0C\u5982 agentInstanceId\u3001threadId\u3001projectId\u3002"
281
+ },
282
+ files: {
283
+ type: "array",
284
+ description: "\u63D0\u6848\u6D89\u53CA\u7684\u6587\u4EF6\u5217\u8868\u3002",
285
+ items: {
286
+ type: "object",
287
+ properties: {
288
+ path: { type: "string" },
289
+ rootId: { type: "string" },
290
+ originalContent: { type: "string" },
291
+ proposedContent: { type: "string" },
292
+ hunks: {
293
+ type: "array",
294
+ items: {
295
+ type: "object",
296
+ properties: {
297
+ id: { type: "string" },
298
+ filePath: { type: "string" },
299
+ rootId: { type: "string" },
300
+ startLine: { type: "number" },
301
+ endLine: { type: "number" },
302
+ originalContent: { type: "string" },
303
+ proposedContent: { type: "string" }
304
+ },
305
+ required: ["id", "startLine", "endLine", "originalContent", "proposedContent"]
306
+ }
307
+ }
308
+ },
309
+ required: ["path", "originalContent", "proposedContent"]
310
+ }
311
+ }
312
+ },
313
+ required: ["title", "files"]
314
+ }
315
+ }, {
316
+ operationKind: "mutate",
317
+ requiresExecutionEvidence: true,
318
+ rawDomain: "editor"
319
+ }, {
320
+ type: "object",
321
+ properties: {
322
+ proposalId: { type: "string" },
323
+ delivered: { type: "boolean" },
324
+ targetPluginId: { type: "string" },
325
+ targetInstanceId: { type: "string" }
326
+ },
327
+ required: ["proposalId", "delivered"]
328
+ }),
329
+ annotateTool({
330
+ name: "seastudio-editor_proposal",
331
+ description: "\u7BA1\u7406 Code Editor \u7684\u6301\u4E45 Keep/Undo \u4EE3\u7801\u63D0\u6848\u3002\u652F\u6301 list\u3001get\u3001getForFile\u3001keepAll\u3001undoAll\uFF1BAgent \u53EF\u7528 keepAll/undoAll \u4E3B\u52A8\u786E\u8BA4\u6216\u56DE\u6EDA\u63D0\u6848\u3002",
332
+ inputSchema: {
333
+ type: "object",
334
+ properties: {
335
+ action: {
336
+ type: "string",
337
+ enum: ["list", "get", "getForFile", "keepAll", "undoAll", "resolve"],
338
+ description: "proposal \u7BA1\u7406\u52A8\u4F5C\u3002"
339
+ },
340
+ proposalId: { type: "string", description: "\u76EE\u6807\u63D0\u6848 ID\u3002" },
341
+ rootId: { type: "string", description: "\u9879\u76EE\u6839 ID\u3002" },
342
+ path: { type: "string", description: "\u76F8\u5BF9 rootId \u7684\u6587\u4EF6\u8DEF\u5F84\u3002" },
343
+ decision: {
344
+ type: "string",
345
+ enum: ["keep", "undo"],
346
+ description: "resolve \u52A8\u4F5C\u7684\u51B3\u7B56\u3002"
347
+ }
348
+ },
349
+ required: ["action"]
350
+ }
351
+ }, {
352
+ operationKind: "mutate",
353
+ requiresExecutionEvidence: true,
354
+ rawDomain: "editor"
355
+ }, {
356
+ type: "object",
357
+ properties: {
358
+ proposalId: { type: "string" },
359
+ proposals: { type: "array", items: { type: "object", additionalProperties: true } },
360
+ proposal: { type: "object", additionalProperties: true },
361
+ resolved: { type: "boolean" },
362
+ decision: { type: "string" }
363
+ }
364
+ })
365
+ ];
366
+
367
+ // src/mcp/seastudio/tools/git.ts
368
+ var gitTools = [
369
+ annotateTool({
370
+ name: "seastudio-git_read",
371
+ description: "Read git repository state for the current project. Actions: status, diff, show, lineChanges, probe.",
372
+ inputSchema: {
373
+ type: "object",
374
+ properties: {
375
+ action: {
376
+ type: "string",
377
+ enum: ["status", "diff", "show", "lineChanges", "probe"],
378
+ description: "status: porcelain file list; diff: unified diff text; show: file at ref; lineChanges: editor gutter ranges; probe: runtime availability."
379
+ },
380
+ path: { type: "string", description: "Repo-relative file path (required for diff/show/lineChanges)." },
381
+ scope: {
382
+ type: "string",
383
+ enum: ["staged", "unstaged", "all"],
384
+ description: "diff scope (default all)."
385
+ },
386
+ ref: {
387
+ type: "string",
388
+ enum: ["HEAD", "INDEX"],
389
+ description: "show ref (default HEAD)."
390
+ },
391
+ rootId: { type: "string", description: "Filesystem root id (default workspace)." }
392
+ },
393
+ required: ["action"]
394
+ }
395
+ }, {
396
+ operationKind: "read",
397
+ requiresExecutionEvidence: false,
398
+ rawDomain: "git"
399
+ }),
400
+ annotateTool({
401
+ name: "seastudio-git_mutate",
402
+ description: "Mutate git state: init, stage, unstage, discard, commit, stageAll, unstageAll.",
403
+ inputSchema: {
404
+ type: "object",
405
+ properties: {
406
+ action: {
407
+ type: "string",
408
+ enum: ["init", "stage", "unstage", "discard", "commit", "stageAll", "unstageAll"]
409
+ },
410
+ path: { type: "string", description: "Repo-relative path for stage/unstage/discard." },
411
+ paths: {
412
+ type: "array",
413
+ items: { type: "string" },
414
+ description: "Multiple paths for stage/unstage/discard."
415
+ },
416
+ message: { type: "string", description: "Commit message (required for commit)." },
417
+ rootId: { type: "string", description: "Filesystem root id (default workspace)." }
418
+ },
419
+ required: ["action"]
420
+ }
421
+ }, {
422
+ operationKind: "mutate",
423
+ requiresExecutionEvidence: true,
424
+ rawDomain: "git"
425
+ })
426
+ ];
427
+
257
428
  // src/mcp/seastudio/tools/shell.ts
258
429
  var shellActionParam = {
259
430
  type: "string",
@@ -397,8 +568,14 @@ function joinWorkspacePath(dir, name) {
397
568
  function callFilesystemRead(action, args = {}) {
398
569
  return callTool("seastudio-filesystem_read", { action, ...args });
399
570
  }
400
- function callFilesystemMutate(op, args = {}) {
401
- return callTool("seastudio-filesystem_mutate", { operations: [{ op, ...args }] });
571
+ function callFilesystemMutate(op, args = {}, options) {
572
+ return callTool("seastudio-filesystem_mutate", {
573
+ operations: [{
574
+ op,
575
+ ...args,
576
+ ...options?.reviewMode ? { reviewMode: options.reviewMode } : {}
577
+ }]
578
+ });
402
579
  }
403
580
  function callFilesystemTransfer(action, args = {}) {
404
581
  return callTool("seastudio-filesystem_transfer", { action, ...args });
@@ -409,6 +586,12 @@ function callShellSessionRead(action, args = {}) {
409
586
  function callShellSessionControl(action, args = {}) {
410
587
  return callTool("seastudio-shell_session_control", { action, ...args });
411
588
  }
589
+ function callGitRead(action, args = {}) {
590
+ return callTool("seastudio-git_read", { action, ...args });
591
+ }
592
+ function callGitMutate(action, args = {}) {
593
+ return callTool("seastudio-git_mutate", { action, ...args });
594
+ }
412
595
  var seastudio = {
413
596
  roots: {
414
597
  list: () => request("roots/list")
@@ -426,7 +609,11 @@ var seastudio = {
426
609
  ...typeof options?.offset === "number" ? { offset: options.offset } : {},
427
610
  ...typeof options?.limit === "number" ? { limit: options.limit } : {}
428
611
  }),
429
- write: (path, content, options) => callFilesystemMutate("write", { rootId: options?.rootId ?? "workspace", path, content }),
612
+ write: (path, content, options) => callFilesystemMutate(
613
+ "write",
614
+ { rootId: options?.rootId ?? "workspace", path, content },
615
+ { reviewMode: options?.reviewMode }
616
+ ),
430
617
  list: (path = "", options) => callFilesystemRead("list", {
431
618
  rootId: options?.rootId ?? "workspace",
432
619
  path
@@ -525,6 +712,32 @@ var seastudio = {
525
712
  writeBinary: (path, base64, options) => callFilesystemMutate("writeBinary", { rootId: options?.rootId ?? "workspace", path, base64 }),
526
713
  readBinary: (path, options) => callFilesystemRead("readBinary", { rootId: options?.rootId ?? "workspace", path })
527
714
  },
715
+ git: {
716
+ probe: () => callGitRead("probe"),
717
+ status: (options) => callGitRead("status", { rootId: options?.rootId ?? "workspace" }),
718
+ diff: (path, options) => callGitRead("diff", {
719
+ path,
720
+ rootId: options?.rootId ?? "workspace",
721
+ ...options?.scope ? { scope: options.scope } : {}
722
+ }),
723
+ show: (path, options) => callGitRead("show", {
724
+ path,
725
+ rootId: options?.rootId ?? "workspace",
726
+ ...options?.ref ? { ref: options.ref } : {}
727
+ }),
728
+ lineChanges: (path, options) => callGitRead("lineChanges", { path, rootId: options?.rootId ?? "workspace" }),
729
+ init: (options) => callGitMutate("init", { rootId: options?.rootId ?? "workspace" }),
730
+ stage: (path, options) => callGitMutate("stage", { path, rootId: options?.rootId ?? "workspace" }),
731
+ stageAll: (options) => callGitMutate("stageAll", { rootId: options?.rootId ?? "workspace" }),
732
+ unstage: (path, options) => callGitMutate("unstage", { path, rootId: options?.rootId ?? "workspace" }),
733
+ unstageAll: (options) => callGitMutate("unstageAll", { rootId: options?.rootId ?? "workspace" }),
734
+ discard: (path, options) => callGitMutate("discard", { path, rootId: options?.rootId ?? "workspace" }),
735
+ commit: (message, options) => callGitMutate("commit", { message, rootId: options?.rootId ?? "workspace" })
736
+ },
737
+ editor: {
738
+ propose: (options) => callTool("seastudio-editor_propose", options),
739
+ proposal: (options) => callTool("seastudio-editor_proposal", options)
740
+ },
528
741
  shell: {
529
742
  session: {
530
743
  open: (options = {}) => callShellSessionControl("open", { ...options }),
@@ -885,11 +1098,23 @@ var SeastudioRequests = {
885
1098
  /** 请求标记文件已保存 -> 主程序发布 FILE_SAVED */
886
1099
  FILE_SAVED: "request:file_saved",
887
1100
  /** 请求发送文本给 Agent -> 主程序发布 TEXT_SEND_REQUESTED */
888
- TEXT_SEND: "request:text_send"
1101
+ TEXT_SEND: "request:text_send",
1102
+ /** 请求在 Code Editor 中打开 Git diff 视图 */
1103
+ GIT_OPEN_DIFF: "request:git_open_diff",
1104
+ /** 请求提交代码变更提案 -> 主程序发布 PROPOSAL_REQUESTED */
1105
+ PROPOSAL_SUBMIT: "request:proposal_submit"
889
1106
  };
890
1107
  var SeastudioNotifications = {
891
1108
  /** 文件系统变化通知(fs.watch 触发) */
892
1109
  FILES_CHANGED: "files:changed",
1110
+ /** Git 仓库状态变化(mutate 或 files:changed 后刷新) */
1111
+ GIT_CHANGED: "git:changed",
1112
+ /** Git diff 打开请求(主程序转发到 Code Editor) */
1113
+ GIT_OPEN_DIFF_REQUESTED: "seastudio:git-open_diff_requested",
1114
+ /** 代码变更提案请求(主程序转发到 Code Editor) */
1115
+ PROPOSAL_REQUESTED: "seastudio:proposal-requested",
1116
+ /** 代码变更提案状态变化 */
1117
+ PROPOSAL_CHANGED: "seastudio:proposal-changed",
893
1118
  /** 文件或目录被重命名/移动 */
894
1119
  FILE_RENAMED: "file:renamed",
895
1120
  /** 文件或目录被删除/移入回收站 */
@@ -959,6 +1184,8 @@ var SeastudioNotifications = {
959
1184
  // src/mcp/seastudio/index.ts
960
1185
  var allTools = [
961
1186
  ...fileTools,
1187
+ ...editorTools,
1188
+ ...gitTools,
962
1189
  ...shellTools,
963
1190
  ...seaCloudTools,
964
1191
  ...pluginManagementTools,
@@ -982,9 +1209,11 @@ exports.browserRuntimeTools = browserRuntimeTools;
982
1209
  exports.callTool = callTool;
983
1210
  exports.callToolText = callToolText;
984
1211
  exports.dualPathEvidenceOutputSchema = dualPathEvidenceOutputSchema;
1212
+ exports.editorTools = editorTools;
985
1213
  exports.fileDownloadEvidenceOutputSchema = fileDownloadEvidenceOutputSchema;
986
1214
  exports.fileTools = fileTools;
987
1215
  exports.fileUrlEvidenceOutputSchema = fileUrlEvidenceOutputSchema;
1216
+ exports.gitTools = gitTools;
988
1217
  exports.pluginManagementTools = pluginManagementTools;
989
1218
  exports.pluginTabTools = pluginTabTools;
990
1219
  exports.projectTools = projectTools;