@seastudio/sdk 4.0.3 → 4.0.5

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,4 +1,4 @@
1
- import { allTools } from './chunk-QZTAT5OG.js';
1
+ import { allTools } from './chunk-QA7XGPJX.js';
2
2
  import { normalizeMCPTool, normalizeMCPToolObjectSchema, getDefaultClient } from './chunk-TJ3CGHWJ.js';
3
3
 
4
4
  // src/mcp/index.ts
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNPAVHBYU_cjs = require('./chunk-NPAVHBYU.cjs');
3
+ var chunkY4QEHVYJ_cjs = require('./chunk-Y4QEHVYJ.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: chunkY4QEHVYJ_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 [...chunkY4QEHVYJ_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
+ chunkY4QEHVYJ_cjs.allTools.map((tool) => [tool.name, "seastudio"])
66
66
  );
67
67
  function getMCPToolPackageIndex() {
68
68
  return new Map(MCP_TOOL_PACKAGE_INDEX);
@@ -21,7 +21,9 @@ var rootedWriteEvidenceOutputSchema = {
21
21
  properties: {
22
22
  rootId: { type: "string" },
23
23
  path: { type: "string" },
24
- written: { type: "boolean" }
24
+ written: { type: "boolean" },
25
+ reviewed: { type: "boolean" },
26
+ proposalId: { type: "string" }
25
27
  },
26
28
  required: ["rootId", "path", "written"]
27
29
  };
@@ -178,7 +180,7 @@ var fileTools = [
178
180
  }),
179
181
  annotateTool({
180
182
  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",
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\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",
182
184
  inputSchema: {
183
185
  type: "object",
184
186
  properties: {
@@ -196,6 +198,11 @@ var fileTools = [
196
198
  rootId: rootIdParam,
197
199
  path: pathParam,
198
200
  content: { type: "string", description: "write \u7684\u6587\u672C\u5185\u5BB9\u3002" },
201
+ reviewMode: {
202
+ type: "string",
203
+ enum: ["auto", "direct", "proposal"],
204
+ 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"
205
+ },
199
206
  base64: { type: "string", description: "writeBinary \u7684 base64 \u5185\u5BB9\u3002" },
200
207
  newName: { type: "string", description: "rename \u7684\u65B0\u540D\u79F0\u3002" },
201
208
  sourceRootId: rootIdParam,
@@ -252,6 +259,170 @@ var fileTools = [
252
259
  })
253
260
  ];
254
261
 
262
+ // src/mcp/seastudio/tools/editor.ts
263
+ var editorTools = [
264
+ annotateTool({
265
+ name: "seastudio-editor_propose",
266
+ 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",
267
+ inputSchema: {
268
+ type: "object",
269
+ properties: {
270
+ proposalId: { type: "string", description: "\u63D0\u6848 ID\uFF0C\u53EF\u9009\uFF1B\u7F3A\u7701\u7531\u4E3B\u7A0B\u5E8F\u751F\u6210\u3002" },
271
+ title: { type: "string", description: "\u63D0\u6848\u6807\u9898\u3002" },
272
+ targetPluginId: { type: "string", description: "\u76EE\u6807\u63D2\u4EF6 ID\uFF0C\u9ED8\u8BA4 seastudio.codeEditor\u3002" },
273
+ targetInstanceId: { type: "string", description: "\u76EE\u6807 Code Editor \u5B9E\u4F8B ID\u3002" },
274
+ openFile: { type: "boolean", description: "\u662F\u5426\u8981\u6C42\u7F16\u8F91\u5668\u6253\u5F00/\u805A\u7126\u63D0\u6848\u6587\u4EF6\uFF0C\u9ED8\u8BA4 true\u3002" },
275
+ origin: {
276
+ type: "object",
277
+ additionalProperties: true,
278
+ description: "\u63D0\u6848\u6765\u6E90\u4FE1\u606F\uFF0C\u5982 agentInstanceId\u3001threadId\u3001projectId\u3002"
279
+ },
280
+ files: {
281
+ type: "array",
282
+ description: "\u63D0\u6848\u6D89\u53CA\u7684\u6587\u4EF6\u5217\u8868\u3002",
283
+ items: {
284
+ type: "object",
285
+ properties: {
286
+ path: { type: "string" },
287
+ rootId: { type: "string" },
288
+ originalContent: { type: "string" },
289
+ proposedContent: { type: "string" },
290
+ hunks: {
291
+ type: "array",
292
+ items: {
293
+ type: "object",
294
+ properties: {
295
+ id: { type: "string" },
296
+ filePath: { type: "string" },
297
+ rootId: { type: "string" },
298
+ startLine: { type: "number" },
299
+ endLine: { type: "number" },
300
+ originalContent: { type: "string" },
301
+ proposedContent: { type: "string" }
302
+ },
303
+ required: ["id", "startLine", "endLine", "originalContent", "proposedContent"]
304
+ }
305
+ }
306
+ },
307
+ required: ["path", "originalContent", "proposedContent"]
308
+ }
309
+ }
310
+ },
311
+ required: ["title", "files"]
312
+ }
313
+ }, {
314
+ operationKind: "mutate",
315
+ requiresExecutionEvidence: true,
316
+ rawDomain: "editor"
317
+ }, {
318
+ type: "object",
319
+ properties: {
320
+ proposalId: { type: "string" },
321
+ delivered: { type: "boolean" },
322
+ targetPluginId: { type: "string" },
323
+ targetInstanceId: { type: "string" }
324
+ },
325
+ required: ["proposalId", "delivered"]
326
+ }),
327
+ annotateTool({
328
+ name: "seastudio-editor_proposal",
329
+ 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",
330
+ inputSchema: {
331
+ type: "object",
332
+ properties: {
333
+ action: {
334
+ type: "string",
335
+ enum: ["list", "get", "getForFile", "keepAll", "undoAll", "resolve"],
336
+ description: "proposal \u7BA1\u7406\u52A8\u4F5C\u3002"
337
+ },
338
+ proposalId: { type: "string", description: "\u76EE\u6807\u63D0\u6848 ID\u3002" },
339
+ rootId: { type: "string", description: "\u9879\u76EE\u6839 ID\u3002" },
340
+ path: { type: "string", description: "\u76F8\u5BF9 rootId \u7684\u6587\u4EF6\u8DEF\u5F84\u3002" },
341
+ decision: {
342
+ type: "string",
343
+ enum: ["keep", "undo"],
344
+ description: "resolve \u52A8\u4F5C\u7684\u51B3\u7B56\u3002"
345
+ }
346
+ },
347
+ required: ["action"]
348
+ }
349
+ }, {
350
+ operationKind: "mutate",
351
+ requiresExecutionEvidence: true,
352
+ rawDomain: "editor"
353
+ }, {
354
+ type: "object",
355
+ properties: {
356
+ proposalId: { type: "string" },
357
+ proposals: { type: "array", items: { type: "object", additionalProperties: true } },
358
+ proposal: { type: "object", additionalProperties: true },
359
+ resolved: { type: "boolean" },
360
+ decision: { type: "string" }
361
+ }
362
+ })
363
+ ];
364
+
365
+ // src/mcp/seastudio/tools/git.ts
366
+ var gitTools = [
367
+ annotateTool({
368
+ name: "seastudio-git_read",
369
+ description: "Read git repository state for the current project. Actions: status, diff, show, lineChanges, probe.",
370
+ inputSchema: {
371
+ type: "object",
372
+ properties: {
373
+ action: {
374
+ type: "string",
375
+ enum: ["status", "diff", "show", "lineChanges", "probe"],
376
+ description: "status: porcelain file list; diff: unified diff text; show: file at ref; lineChanges: editor gutter ranges; probe: runtime availability."
377
+ },
378
+ path: { type: "string", description: "Repo-relative file path (required for diff/show/lineChanges)." },
379
+ scope: {
380
+ type: "string",
381
+ enum: ["staged", "unstaged", "all"],
382
+ description: "diff scope (default all)."
383
+ },
384
+ ref: {
385
+ type: "string",
386
+ enum: ["HEAD", "INDEX"],
387
+ description: "show ref (default HEAD)."
388
+ },
389
+ rootId: { type: "string", description: "Filesystem root id (default workspace)." }
390
+ },
391
+ required: ["action"]
392
+ }
393
+ }, {
394
+ operationKind: "read",
395
+ requiresExecutionEvidence: false,
396
+ rawDomain: "git"
397
+ }),
398
+ annotateTool({
399
+ name: "seastudio-git_mutate",
400
+ description: "Mutate git state: init, stage, unstage, discard, commit, stageAll, unstageAll, discardAll.",
401
+ inputSchema: {
402
+ type: "object",
403
+ properties: {
404
+ action: {
405
+ type: "string",
406
+ enum: ["init", "stage", "unstage", "discard", "commit", "stageAll", "unstageAll", "discardAll"]
407
+ },
408
+ path: { type: "string", description: "Repo-relative path for stage/unstage/discard." },
409
+ paths: {
410
+ type: "array",
411
+ items: { type: "string" },
412
+ description: "Multiple paths for stage/unstage/discard."
413
+ },
414
+ message: { type: "string", description: "Commit message (required for commit)." },
415
+ rootId: { type: "string", description: "Filesystem root id (default workspace)." }
416
+ },
417
+ required: ["action"]
418
+ }
419
+ }, {
420
+ operationKind: "mutate",
421
+ requiresExecutionEvidence: true,
422
+ rawDomain: "git"
423
+ })
424
+ ];
425
+
255
426
  // src/mcp/seastudio/tools/shell.ts
256
427
  var shellActionParam = {
257
428
  type: "string",
@@ -395,8 +566,14 @@ function joinWorkspacePath(dir, name) {
395
566
  function callFilesystemRead(action, args = {}) {
396
567
  return callTool("seastudio-filesystem_read", { action, ...args });
397
568
  }
398
- function callFilesystemMutate(op, args = {}) {
399
- return callTool("seastudio-filesystem_mutate", { operations: [{ op, ...args }] });
569
+ function callFilesystemMutate(op, args = {}, options) {
570
+ return callTool("seastudio-filesystem_mutate", {
571
+ operations: [{
572
+ op,
573
+ ...args,
574
+ ...options?.reviewMode ? { reviewMode: options.reviewMode } : {}
575
+ }]
576
+ });
400
577
  }
401
578
  function callFilesystemTransfer(action, args = {}) {
402
579
  return callTool("seastudio-filesystem_transfer", { action, ...args });
@@ -407,6 +584,12 @@ function callShellSessionRead(action, args = {}) {
407
584
  function callShellSessionControl(action, args = {}) {
408
585
  return callTool("seastudio-shell_session_control", { action, ...args });
409
586
  }
587
+ function callGitRead(action, args = {}) {
588
+ return callTool("seastudio-git_read", { action, ...args });
589
+ }
590
+ function callGitMutate(action, args = {}) {
591
+ return callTool("seastudio-git_mutate", { action, ...args });
592
+ }
410
593
  var seastudio = {
411
594
  roots: {
412
595
  list: () => request("roots/list")
@@ -424,7 +607,11 @@ var seastudio = {
424
607
  ...typeof options?.offset === "number" ? { offset: options.offset } : {},
425
608
  ...typeof options?.limit === "number" ? { limit: options.limit } : {}
426
609
  }),
427
- write: (path, content, options) => callFilesystemMutate("write", { rootId: options?.rootId ?? "workspace", path, content }),
610
+ write: (path, content, options) => callFilesystemMutate(
611
+ "write",
612
+ { rootId: options?.rootId ?? "workspace", path, content },
613
+ { reviewMode: options?.reviewMode }
614
+ ),
428
615
  list: (path = "", options) => callFilesystemRead("list", {
429
616
  rootId: options?.rootId ?? "workspace",
430
617
  path
@@ -523,6 +710,32 @@ var seastudio = {
523
710
  writeBinary: (path, base64, options) => callFilesystemMutate("writeBinary", { rootId: options?.rootId ?? "workspace", path, base64 }),
524
711
  readBinary: (path, options) => callFilesystemRead("readBinary", { rootId: options?.rootId ?? "workspace", path })
525
712
  },
713
+ git: {
714
+ probe: () => callGitRead("probe"),
715
+ status: (options) => callGitRead("status", { rootId: options?.rootId ?? "workspace" }),
716
+ diff: (path, options) => callGitRead("diff", {
717
+ path,
718
+ rootId: options?.rootId ?? "workspace",
719
+ ...options?.scope ? { scope: options.scope } : {}
720
+ }),
721
+ show: (path, options) => callGitRead("show", {
722
+ path,
723
+ rootId: options?.rootId ?? "workspace",
724
+ ...options?.ref ? { ref: options.ref } : {}
725
+ }),
726
+ lineChanges: (path, options) => callGitRead("lineChanges", { path, rootId: options?.rootId ?? "workspace" }),
727
+ init: (options) => callGitMutate("init", { rootId: options?.rootId ?? "workspace" }),
728
+ stage: (path, options) => callGitMutate("stage", { path, rootId: options?.rootId ?? "workspace" }),
729
+ stageAll: (options) => callGitMutate("stageAll", { rootId: options?.rootId ?? "workspace" }),
730
+ unstage: (path, options) => callGitMutate("unstage", { path, rootId: options?.rootId ?? "workspace" }),
731
+ unstageAll: (options) => callGitMutate("unstageAll", { rootId: options?.rootId ?? "workspace" }),
732
+ discard: (path, options) => callGitMutate("discard", { path, rootId: options?.rootId ?? "workspace" }),
733
+ commit: (message, options) => callGitMutate("commit", { message, rootId: options?.rootId ?? "workspace" })
734
+ },
735
+ editor: {
736
+ propose: (options) => callTool("seastudio-editor_propose", options),
737
+ proposal: (options) => callTool("seastudio-editor_proposal", options)
738
+ },
526
739
  shell: {
527
740
  session: {
528
741
  open: (options = {}) => callShellSessionControl("open", { ...options }),
@@ -883,11 +1096,23 @@ var SeastudioRequests = {
883
1096
  /** 请求标记文件已保存 -> 主程序发布 FILE_SAVED */
884
1097
  FILE_SAVED: "request:file_saved",
885
1098
  /** 请求发送文本给 Agent -> 主程序发布 TEXT_SEND_REQUESTED */
886
- TEXT_SEND: "request:text_send"
1099
+ TEXT_SEND: "request:text_send",
1100
+ /** 请求在 Code Editor 中打开 Git diff 视图 */
1101
+ GIT_OPEN_DIFF: "request:git_open_diff",
1102
+ /** 请求提交代码变更提案 -> 主程序发布 PROPOSAL_REQUESTED */
1103
+ PROPOSAL_SUBMIT: "request:proposal_submit"
887
1104
  };
888
1105
  var SeastudioNotifications = {
889
1106
  /** 文件系统变化通知(fs.watch 触发) */
890
1107
  FILES_CHANGED: "files:changed",
1108
+ /** Git 仓库状态变化(mutate 或 files:changed 后刷新) */
1109
+ GIT_CHANGED: "git:changed",
1110
+ /** Git diff 打开请求(主程序转发到 Code Editor) */
1111
+ GIT_OPEN_DIFF_REQUESTED: "seastudio:git-open_diff_requested",
1112
+ /** 代码变更提案请求(主程序转发到 Code Editor) */
1113
+ PROPOSAL_REQUESTED: "seastudio:proposal-requested",
1114
+ /** 代码变更提案状态变化 */
1115
+ PROPOSAL_CHANGED: "seastudio:proposal-changed",
891
1116
  /** 文件或目录被重命名/移动 */
892
1117
  FILE_RENAMED: "file:renamed",
893
1118
  /** 文件或目录被删除/移入回收站 */
@@ -957,6 +1182,8 @@ var SeastudioNotifications = {
957
1182
  // src/mcp/seastudio/index.ts
958
1183
  var allTools = [
959
1184
  ...fileTools,
1185
+ ...editorTools,
1186
+ ...gitTools,
960
1187
  ...shellTools,
961
1188
  ...seaCloudTools,
962
1189
  ...pluginManagementTools,
@@ -969,4 +1196,4 @@ var allTools = [
969
1196
  ];
970
1197
  var tools = allTools;
971
1198
 
972
- 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 };
1199
+ export { SeastudioNotifications, SeastudioRequests, agentManagementTools, agentTabTools, allTools, annotateTool, batchFlattenCopyEvidenceOutputSchema, browserRuntimeTools, callTool, callToolText, dualPathEvidenceOutputSchema, editorTools, fileDownloadEvidenceOutputSchema, fileTools, fileUrlEvidenceOutputSchema, gitTools, pluginManagementTools, pluginTabTools, projectTools, request, rootedPathEvidenceOutputSchema, rootedWriteEvidenceOutputSchema, runOneShotShellCommand, seaCloudTools, seastudio, shellSessionCloseEvidenceOutputSchema, shellSessionOpenEvidenceOutputSchema, shellSessionRunEvidenceOutputSchema, shellSessionSignalEvidenceOutputSchema, shellSessionSnapshotEvidenceOutputSchema, shellTools, skillTools, tools };