@seastudio/sdk 4.0.18 → 5.1.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.
@@ -1,4 +1,4 @@
1
- import { g as MCPTool, h as MCPToolAnnotations, j as MCPToolInputSchema, k as MCPToolResult } from '../../types-D7xY0bt6.cjs';
1
+ import { g as MCPTool, h as MCPToolAnnotations, j as MCPToolInputSchema, k as MCPToolResult } from '../../types-S2uWCEaN.cjs';
2
2
 
3
3
  /**
4
4
  * Git 共享类型契约
@@ -336,50 +336,54 @@ interface SeastudioShellOneShotResult {
336
336
  durationMs: number;
337
337
  timedOut: boolean;
338
338
  }
339
- type SeastudioBrowserStatus = 'idle' | 'loading' | 'ready' | 'error';
340
- interface SeastudioBrowserCertificateError {
339
+ type SeastudioWebviewRuntimeStatus = 'idle' | 'loading' | 'ready' | 'error';
340
+ interface SeastudioWebviewRuntimeCertificateError {
341
341
  requestId: string;
342
342
  url: string;
343
343
  error: string;
344
344
  }
345
- interface SeastudioBrowserTab {
345
+ interface SeastudioWebviewRuntimeTab {
346
346
  id: string;
347
347
  title: string;
348
348
  url: string | null;
349
- status: SeastudioBrowserStatus;
349
+ status: SeastudioWebviewRuntimeStatus;
350
350
  errorMessage: string | null;
351
351
  canGoBack: boolean;
352
352
  canGoForward: boolean;
353
- certificateError?: SeastudioBrowserCertificateError | null;
353
+ certificateError?: SeastudioWebviewRuntimeCertificateError | null;
354
354
  ownerInstanceId?: string;
355
355
  }
356
- interface SeastudioBrowserState {
357
- browserSessionId: string;
356
+ interface SeastudioWebviewRuntimeState {
357
+ webviewRuntimeId: string;
358
358
  label?: string;
359
- partitionKey: string;
359
+ storagePartitionKey: string;
360
360
  homepage: string;
361
- tabs: SeastudioBrowserTab[];
361
+ tabs: SeastudioWebviewRuntimeTab[];
362
362
  activeTabId: string | null;
363
363
  }
364
- interface SeastudioBrowserSession extends SeastudioBrowserState {
364
+ interface SeastudioWebviewRuntime extends SeastudioWebviewRuntimeState {
365
365
  createdAt: number;
366
366
  updatedAt: number;
367
367
  }
368
- interface SeastudioBrowserSessionOpenOptions {
368
+ interface SeastudioWebviewRuntimeOpenOptions {
369
369
  label?: string;
370
- partitionKey?: string;
370
+ storagePartitionKey?: string;
371
371
  homepage?: string;
372
372
  }
373
- interface SeastudioBrowserRect {
373
+ interface SeastudioWebviewViewportRect {
374
374
  x: number;
375
375
  y: number;
376
376
  width: number;
377
377
  height: number;
378
378
  }
379
- interface SeastudioBrowserViewportBinding {
380
- browserSessionId: string;
379
+ interface SeastudioWebviewRuntimeViewportBinding {
380
+ webviewRuntimeId: string;
381
+ ownerInstanceId?: string;
382
+ rect: SeastudioWebviewViewportRect;
383
+ }
384
+ interface SeastudioWebviewRuntimeViewportBindOptions {
385
+ webviewRuntimeId?: string;
381
386
  ownerInstanceId?: string;
382
- rect: SeastudioBrowserRect;
383
387
  }
384
388
  declare function callTool(name: string, args?: Record<string, unknown>): Promise<MCPToolResult>;
385
389
  declare function request<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;
@@ -481,73 +485,71 @@ declare const seastudio: {
481
485
  close: (sessionId: string, force?: boolean) => Promise<MCPToolResult>;
482
486
  };
483
487
  };
484
- browser: {
485
- session: {
486
- open: (options?: SeastudioBrowserSessionOpenOptions) => Promise<SeastudioBrowserSession>;
488
+ webview: {
489
+ runtime: {
490
+ open: (options?: SeastudioWebviewRuntimeOpenOptions) => Promise<SeastudioWebviewRuntime>;
487
491
  list: () => Promise<{
488
- sessions: SeastudioBrowserSession[];
492
+ runtimes: SeastudioWebviewRuntime[];
489
493
  }>;
490
- get: (browserSessionId?: string) => Promise<SeastudioBrowserSession>;
491
- close: (browserSessionId?: string) => Promise<{
492
- browserSessionId: string;
494
+ get: (webviewRuntimeId?: string) => Promise<SeastudioWebviewRuntime>;
495
+ close: (webviewRuntimeId?: string) => Promise<{
496
+ webviewRuntimeId: string;
493
497
  closed: boolean;
494
498
  }>;
499
+ show: (url: string) => Promise<{
500
+ url: string;
501
+ webviewRuntimeId: string;
502
+ instanceId?: string;
503
+ tab?: SeastudioWebviewRuntimeTab;
504
+ }>;
505
+ evaluate: <T = unknown>(webviewRuntimeId: string, tabId: string, script: string, timeoutMs?: number) => Promise<{
506
+ result: T;
507
+ }>;
495
508
  };
496
- show: (url: string) => Promise<{
497
- url: string;
498
- browserSessionId: string;
499
- instanceId?: string;
500
- tab?: SeastudioBrowserTab;
501
- }>;
502
509
  tab: {
503
- create: (browserSessionId?: string, url?: string, ownerInstanceId?: string) => Promise<{
504
- browserSessionId: string;
505
- tab: SeastudioBrowserTab;
510
+ create: (webviewRuntimeId?: string, url?: string, ownerInstanceId?: string) => Promise<{
511
+ webviewRuntimeId: string;
512
+ tab: SeastudioWebviewRuntimeTab;
506
513
  activeTabId: string;
507
514
  }>;
508
- close: (browserSessionId: string, tabId: string) => Promise<{
509
- browserSessionId: string;
515
+ close: (webviewRuntimeId: string, tabId: string) => Promise<{
516
+ webviewRuntimeId: string;
510
517
  closedTabId: string;
511
518
  activeTabId: string | null;
512
519
  }>;
513
- activate: (browserSessionId: string, tabId: string) => Promise<{
514
- browserSessionId: string;
520
+ activate: (webviewRuntimeId: string, tabId: string) => Promise<{
521
+ webviewRuntimeId: string;
515
522
  activeTabId: string;
516
523
  }>;
517
- navigate: (browserSessionId: string, tabId: string, url: string) => Promise<{
518
- browserSessionId: string;
524
+ navigate: (webviewRuntimeId: string, tabId: string, url: string) => Promise<{
525
+ webviewRuntimeId: string;
519
526
  tabId: string;
520
527
  url: string;
521
528
  }>;
522
- goBack: (browserSessionId: string, tabId: string) => Promise<{
529
+ goBack: (webviewRuntimeId: string, tabId: string) => Promise<{
523
530
  ok: boolean;
524
531
  }>;
525
- goForward: (browserSessionId: string, tabId: string) => Promise<{
532
+ goForward: (webviewRuntimeId: string, tabId: string) => Promise<{
526
533
  ok: boolean;
527
534
  }>;
528
- reload: (browserSessionId: string, tabId: string) => Promise<{
535
+ reload: (webviewRuntimeId: string, tabId: string) => Promise<{
529
536
  ok: boolean;
530
537
  }>;
531
- stop: (browserSessionId: string, tabId: string) => Promise<{
538
+ stop: (webviewRuntimeId: string, tabId: string) => Promise<{
532
539
  ok: boolean;
533
540
  }>;
534
541
  getOrCreateForInstance: (ownerInstanceId: string, url?: string) => Promise<{
535
- browserSessionId: string;
536
- tab: SeastudioBrowserTab;
542
+ webviewRuntimeId: string;
543
+ tab: SeastudioWebviewRuntimeTab;
537
544
  activeTabId: string;
538
545
  created: boolean;
539
546
  }>;
540
547
  };
541
548
  viewport: {
542
- bind: (browserSessionId: string | undefined, rect: SeastudioBrowserRect, ownerInstanceId?: string) => Promise<SeastudioBrowserViewportBinding>;
543
- };
544
- runtime: {
545
- evaluate: <T = unknown>(browserSessionId: string, tabId: string, script: string, timeoutMs?: number) => Promise<{
546
- result: T;
547
- }>;
549
+ bind: (rect: SeastudioWebviewViewportRect, options?: SeastudioWebviewRuntimeViewportBindOptions) => Promise<SeastudioWebviewRuntimeViewportBinding>;
548
550
  };
549
551
  certificate: {
550
- respond: (browserSessionId: string, requestId: string, allow: boolean) => Promise<{
552
+ respond: (webviewRuntimeId: string, requestId: string, allow: boolean) => Promise<{
551
553
  ok: boolean;
552
554
  }>;
553
555
  };
@@ -596,8 +598,8 @@ declare const projectTools: MCPTool[];
596
598
 
597
599
  declare const skillTools: MCPTool[];
598
600
 
599
- declare const SINGLETON_BROWSER_SESSION_ID = "browser-session-default";
600
- declare const browserRuntimeTools: MCPTool[];
601
+ declare const SINGLETON_WEBVIEW_RUNTIME_ID = "webview-runtime-default";
602
+ declare const webviewRuntimeTools: MCPTool[];
601
603
 
602
604
  /**
603
605
  * 插件发送给主程序的请求主题
@@ -681,14 +683,14 @@ declare const SeastudioNotifications: {
681
683
  readonly PROPOSAL_FEEDBACK: "seastudio:proposal-feedback";
682
684
  /** 插件实例请求更新宿主 plugin tab 标题 */
683
685
  readonly PLUGIN_TAB_TITLE_CHANGED: "plugin:tab-title_changed";
684
- /** Browser Session 状态变化 */
685
- readonly BROWSER_SESSION_CHANGED: "browser:session_changed";
686
- /** Browser Session 关闭 */
687
- readonly BROWSER_SESSION_CLOSED: "browser:session_closed";
688
- /** Browser Session 证书错误,需要客户端 UI 决策 */
689
- readonly BROWSER_CERTIFICATE_ERROR: "browser:certificate_error";
690
- /** Browser Session 收到网页新标签请求 */
691
- readonly BROWSER_NEW_TAB_REQUESTED: "browser:new_tab_requested";
686
+ /** WebviewRuntime 状态变化 */
687
+ readonly WEBVIEW_RUNTIME_STATE_CHANGED: "webview-runtime:state_changed";
688
+ /** WebviewRuntime 关闭 */
689
+ readonly WEBVIEW_RUNTIME_CLOSED: "webview-runtime:closed";
690
+ /** WebviewRuntime 证书错误,需要客户端 UI 决策 */
691
+ readonly WEBVIEW_RUNTIME_CERTIFICATE_ERROR: "webview-runtime:certificate_error";
692
+ /** WebviewRuntime 收到网页新标签请求 */
693
+ readonly WEBVIEW_RUNTIME_NEW_TAB_REQUESTED: "webview-runtime:new_tab_requested";
692
694
  /**
693
695
  * Agent 对话 session:新建。消息历史仍由 Agent 前端持有,宿主仅同步列表用于侧栏。
694
696
  * 通常由 Agent 通过 notifications/publish 发出;其他订阅者(含 host-ui)可据此更新 UI。
@@ -737,6 +739,10 @@ declare const SeastudioNotifications: {
737
739
  readonly HOST_APP_VISIBILITY: "host:app_visibility";
738
740
  /** Host MCP tools/list 发生变化(例如 Seaflow bridge 动态注册工具) */
739
741
  readonly RUNTIME_TOOLS_CHANGED: "mcp:runtime_tools_changed";
742
+ /** Host 精确路由到插件实例的工具调用请求 */
743
+ readonly PLUGIN_TOOL_CALL: "plugin:tool_call";
744
+ /** 插件实例返回给 Host 的工具调用结果 */
745
+ readonly PLUGIN_TOOL_RESULT: "plugin:tool_result";
740
746
  /** 主程序用户登录态变化;不包含访问令牌 */
741
747
  readonly AUTH_SESSION_CHANGED: "auth:session_changed";
742
748
  };
@@ -810,6 +816,39 @@ interface AuthSessionChangedParams {
810
816
  user: AuthSessionUser | null;
811
817
  };
812
818
  }
819
+ interface PluginToolCallCaller {
820
+ type: 'agent' | 'plugin' | 'host';
821
+ agentInstanceId?: string;
822
+ pluginId?: string;
823
+ pluginInstanceId?: string;
824
+ projectId?: string;
825
+ threadId?: string;
826
+ }
827
+ interface PluginToolCallTarget {
828
+ providerId: string;
829
+ pluginId: string;
830
+ pluginInstanceId: string;
831
+ contractHash: string;
832
+ }
833
+ interface PluginToolCallEnvelope {
834
+ callId: string;
835
+ caller: PluginToolCallCaller;
836
+ target: PluginToolCallTarget;
837
+ toolName: string;
838
+ arguments: Record<string, unknown>;
839
+ timeoutMs: number;
840
+ }
841
+ interface PluginToolCallError {
842
+ name?: string;
843
+ message: string;
844
+ code?: string;
845
+ details?: unknown;
846
+ }
847
+ interface PluginToolResultEnvelope {
848
+ callId: string;
849
+ result?: unknown;
850
+ error?: PluginToolCallError;
851
+ }
813
852
  interface SeastudioDragFileData {
814
853
  sourcePath: string;
815
854
  sourceRootId?: SeastudioDragRootId;
@@ -1098,4 +1137,4 @@ interface HostAppVisibilityParams {
1098
1137
  declare const allTools: MCPTool[];
1099
1138
  declare const tools: MCPTool[];
1100
1139
 
1101
- export { type AgentInstanceSessionSnapshot, type AuthSessionChangedParams, type AuthSessionStatus, type AuthSessionUser, type FileDeletedParams, type FileKeepRequestedParams, type FileModifiedParams, type FileOpenRequestedParams, type FileRenamedParams, type FileSavedParams, type FileSelectedParams, type FileSendRequestedParams, type FileTransferRequestedParams, type FilesChangedParams, type GitBranchInfo, type GitBranchesResult, type GitChangeKind, type GitChangedParams, type GitCommitRef, type GitCommitRefType, type GitFileChange, type GitLineChange, type GitLineChangeKind, type GitLogCommit, type GitLogResult, type GitOpenDiffRequestedParams, type GitStatusResult, type GitSummary, type HostAppVisibilityParams, type PluginTabTitleChangedParams, type ProposalChangedParams, type ProposalFeedbackFileSummary, type ProposalFeedbackHunk, type ProposalFeedbackOrigin, type ProposalFeedbackParams, type ProposalRecord, type ProposalRequestedFile, type ProposalRequestedHunk, type ProposalRequestedParams, type ProposalStatus, type RootsChangedParams, SINGLETON_BROWSER_SESSION_ID, type SeastudioBatchFlattenCopyOptions, type SeastudioBatchFlattenPreviewOptions, type SeastudioBrowserCertificateError, type SeastudioBrowserRect, type SeastudioBrowserSession, type SeastudioBrowserSessionOpenOptions, type SeastudioBrowserState, type SeastudioBrowserStatus, type SeastudioBrowserTab, type SeastudioBrowserViewportBinding, type SeastudioDragDropParams, type SeastudioDragEnterParams, type SeastudioDragFileData, type SeastudioDragRootId, type SeastudioDragStartParams, type SeastudioEditorProposalAction, type SeastudioEditorProposalOptions, type SeastudioEditorProposeOptions, type SeastudioFileDownloadOptions, type SeastudioFileInfo, type SeastudioFileInfoOptions, type SeastudioFileListOptions, type SeastudioFileReadOptions, type SeastudioFileSaveAsOptions, type SeastudioFileSearchMatch, type SeastudioFileSearchOptions, type SeastudioFileTransferOptions, type SeastudioFileTreeOptions, type SeastudioFileWriteOptions, type SeastudioFilesystemRoot, type SeastudioFilesystemRootId, SeastudioNotifications, type SeastudioProjectInfo, type SeastudioProposalFile, type SeastudioProposalHunk, SeastudioRequests, type SeastudioRootId, type SeastudioShellCloseResult, type SeastudioShellEntry, type SeastudioShellEntryLevel, type SeastudioShellGetEntriesOptions, type SeastudioShellGetEntriesResult, type SeastudioShellKind, type SeastudioShellOneShotResult, type SeastudioShellOpenOptions, type SeastudioShellRunOptions, type SeastudioShellRunResult, type SeastudioShellSession, type SeastudioShellSignalResult, type SeastudioShellWaitResult, type SeastudioSinglePathOptions, type SeastudioWorkspacePathMode, type SeastudioWriteReviewMode, type SessionArchiveRequestedParams, type SessionCreatedParams, type SessionDeleteRequestedParams, type SessionNewRequestedParams, type SessionNotificationBase, type SessionRemovedParams, type SessionRenameRequestedParams, type SessionSelectedParams, type SessionSelectedReason, type SessionSnapshotItem, type SessionStateSnapshotParams, type SessionStatus, type SessionStatusParams, type SessionSummaryParams, type TextSendRequestedParams, type TextSendRequestedSelectionRange, type TextSendRequestedSource, agentManagementTools, agentTabTools, allTools, annotateTool, batchFlattenCopyEvidenceOutputSchema, browserRuntimeTools, callTool, callToolText, dualPathEvidenceOutputSchema, editorTools, fileDownloadEvidenceOutputSchema, fileSaveAsEvidenceOutputSchema, fileTools, fileUrlEvidenceOutputSchema, gitTools, pluginManagementTools, pluginTabTools, projectTools, request, rootedPathEvidenceOutputSchema, rootedWriteEvidenceOutputSchema, runOneShotShellCommand, seastudio, shellSessionCloseEvidenceOutputSchema, shellSessionOpenEvidenceOutputSchema, shellSessionRunEvidenceOutputSchema, shellSessionSignalEvidenceOutputSchema, shellSessionSnapshotEvidenceOutputSchema, shellTools, skillTools, tools };
1140
+ export { type AgentInstanceSessionSnapshot, type AuthSessionChangedParams, type AuthSessionStatus, type AuthSessionUser, type FileDeletedParams, type FileKeepRequestedParams, type FileModifiedParams, type FileOpenRequestedParams, type FileRenamedParams, type FileSavedParams, type FileSelectedParams, type FileSendRequestedParams, type FileTransferRequestedParams, type FilesChangedParams, type GitBranchInfo, type GitBranchesResult, type GitChangeKind, type GitChangedParams, type GitCommitRef, type GitCommitRefType, type GitFileChange, type GitLineChange, type GitLineChangeKind, type GitLogCommit, type GitLogResult, type GitOpenDiffRequestedParams, type GitStatusResult, type GitSummary, type HostAppVisibilityParams, type PluginTabTitleChangedParams, type PluginToolCallCaller, type PluginToolCallEnvelope, type PluginToolCallError, type PluginToolCallTarget, type PluginToolResultEnvelope, type ProposalChangedParams, type ProposalFeedbackFileSummary, type ProposalFeedbackHunk, type ProposalFeedbackOrigin, type ProposalFeedbackParams, type ProposalRecord, type ProposalRequestedFile, type ProposalRequestedHunk, type ProposalRequestedParams, type ProposalStatus, type RootsChangedParams, SINGLETON_WEBVIEW_RUNTIME_ID, type SeastudioBatchFlattenCopyOptions, type SeastudioBatchFlattenPreviewOptions, type SeastudioDragDropParams, type SeastudioDragEnterParams, type SeastudioDragFileData, type SeastudioDragRootId, type SeastudioDragStartParams, type SeastudioEditorProposalAction, type SeastudioEditorProposalOptions, type SeastudioEditorProposeOptions, type SeastudioFileDownloadOptions, type SeastudioFileInfo, type SeastudioFileInfoOptions, type SeastudioFileListOptions, type SeastudioFileReadOptions, type SeastudioFileSaveAsOptions, type SeastudioFileSearchMatch, type SeastudioFileSearchOptions, type SeastudioFileTransferOptions, type SeastudioFileTreeOptions, type SeastudioFileWriteOptions, type SeastudioFilesystemRoot, type SeastudioFilesystemRootId, SeastudioNotifications, type SeastudioProjectInfo, type SeastudioProposalFile, type SeastudioProposalHunk, SeastudioRequests, type SeastudioRootId, type SeastudioShellCloseResult, type SeastudioShellEntry, type SeastudioShellEntryLevel, type SeastudioShellGetEntriesOptions, type SeastudioShellGetEntriesResult, type SeastudioShellKind, type SeastudioShellOneShotResult, type SeastudioShellOpenOptions, type SeastudioShellRunOptions, type SeastudioShellRunResult, type SeastudioShellSession, type SeastudioShellSignalResult, type SeastudioShellWaitResult, type SeastudioSinglePathOptions, type SeastudioWebviewRuntime, type SeastudioWebviewRuntimeCertificateError, type SeastudioWebviewRuntimeOpenOptions, type SeastudioWebviewRuntimeState, type SeastudioWebviewRuntimeStatus, type SeastudioWebviewRuntimeTab, type SeastudioWebviewRuntimeViewportBindOptions, type SeastudioWebviewRuntimeViewportBinding, type SeastudioWebviewViewportRect, type SeastudioWorkspacePathMode, type SeastudioWriteReviewMode, type SessionArchiveRequestedParams, type SessionCreatedParams, type SessionDeleteRequestedParams, type SessionNewRequestedParams, type SessionNotificationBase, type SessionRemovedParams, type SessionRenameRequestedParams, type SessionSelectedParams, type SessionSelectedReason, type SessionSnapshotItem, type SessionStateSnapshotParams, type SessionStatus, type SessionStatusParams, type SessionSummaryParams, type TextSendRequestedParams, type TextSendRequestedSelectionRange, type TextSendRequestedSource, agentManagementTools, agentTabTools, allTools, annotateTool, batchFlattenCopyEvidenceOutputSchema, callTool, callToolText, dualPathEvidenceOutputSchema, editorTools, fileDownloadEvidenceOutputSchema, fileSaveAsEvidenceOutputSchema, fileTools, fileUrlEvidenceOutputSchema, gitTools, pluginManagementTools, pluginTabTools, projectTools, request, rootedPathEvidenceOutputSchema, rootedWriteEvidenceOutputSchema, runOneShotShellCommand, seastudio, shellSessionCloseEvidenceOutputSchema, shellSessionOpenEvidenceOutputSchema, shellSessionRunEvidenceOutputSchema, shellSessionSignalEvidenceOutputSchema, shellSessionSnapshotEvidenceOutputSchema, shellTools, skillTools, tools, webviewRuntimeTools };
@@ -1,4 +1,4 @@
1
- import { g as MCPTool, h as MCPToolAnnotations, j as MCPToolInputSchema, k as MCPToolResult } from '../../types-D7xY0bt6.js';
1
+ import { g as MCPTool, h as MCPToolAnnotations, j as MCPToolInputSchema, k as MCPToolResult } from '../../types-S2uWCEaN.js';
2
2
 
3
3
  /**
4
4
  * Git 共享类型契约
@@ -336,50 +336,54 @@ interface SeastudioShellOneShotResult {
336
336
  durationMs: number;
337
337
  timedOut: boolean;
338
338
  }
339
- type SeastudioBrowserStatus = 'idle' | 'loading' | 'ready' | 'error';
340
- interface SeastudioBrowserCertificateError {
339
+ type SeastudioWebviewRuntimeStatus = 'idle' | 'loading' | 'ready' | 'error';
340
+ interface SeastudioWebviewRuntimeCertificateError {
341
341
  requestId: string;
342
342
  url: string;
343
343
  error: string;
344
344
  }
345
- interface SeastudioBrowserTab {
345
+ interface SeastudioWebviewRuntimeTab {
346
346
  id: string;
347
347
  title: string;
348
348
  url: string | null;
349
- status: SeastudioBrowserStatus;
349
+ status: SeastudioWebviewRuntimeStatus;
350
350
  errorMessage: string | null;
351
351
  canGoBack: boolean;
352
352
  canGoForward: boolean;
353
- certificateError?: SeastudioBrowserCertificateError | null;
353
+ certificateError?: SeastudioWebviewRuntimeCertificateError | null;
354
354
  ownerInstanceId?: string;
355
355
  }
356
- interface SeastudioBrowserState {
357
- browserSessionId: string;
356
+ interface SeastudioWebviewRuntimeState {
357
+ webviewRuntimeId: string;
358
358
  label?: string;
359
- partitionKey: string;
359
+ storagePartitionKey: string;
360
360
  homepage: string;
361
- tabs: SeastudioBrowserTab[];
361
+ tabs: SeastudioWebviewRuntimeTab[];
362
362
  activeTabId: string | null;
363
363
  }
364
- interface SeastudioBrowserSession extends SeastudioBrowserState {
364
+ interface SeastudioWebviewRuntime extends SeastudioWebviewRuntimeState {
365
365
  createdAt: number;
366
366
  updatedAt: number;
367
367
  }
368
- interface SeastudioBrowserSessionOpenOptions {
368
+ interface SeastudioWebviewRuntimeOpenOptions {
369
369
  label?: string;
370
- partitionKey?: string;
370
+ storagePartitionKey?: string;
371
371
  homepage?: string;
372
372
  }
373
- interface SeastudioBrowserRect {
373
+ interface SeastudioWebviewViewportRect {
374
374
  x: number;
375
375
  y: number;
376
376
  width: number;
377
377
  height: number;
378
378
  }
379
- interface SeastudioBrowserViewportBinding {
380
- browserSessionId: string;
379
+ interface SeastudioWebviewRuntimeViewportBinding {
380
+ webviewRuntimeId: string;
381
+ ownerInstanceId?: string;
382
+ rect: SeastudioWebviewViewportRect;
383
+ }
384
+ interface SeastudioWebviewRuntimeViewportBindOptions {
385
+ webviewRuntimeId?: string;
381
386
  ownerInstanceId?: string;
382
- rect: SeastudioBrowserRect;
383
387
  }
384
388
  declare function callTool(name: string, args?: Record<string, unknown>): Promise<MCPToolResult>;
385
389
  declare function request<T = unknown>(method: string, params?: Record<string, unknown>): Promise<T>;
@@ -481,73 +485,71 @@ declare const seastudio: {
481
485
  close: (sessionId: string, force?: boolean) => Promise<MCPToolResult>;
482
486
  };
483
487
  };
484
- browser: {
485
- session: {
486
- open: (options?: SeastudioBrowserSessionOpenOptions) => Promise<SeastudioBrowserSession>;
488
+ webview: {
489
+ runtime: {
490
+ open: (options?: SeastudioWebviewRuntimeOpenOptions) => Promise<SeastudioWebviewRuntime>;
487
491
  list: () => Promise<{
488
- sessions: SeastudioBrowserSession[];
492
+ runtimes: SeastudioWebviewRuntime[];
489
493
  }>;
490
- get: (browserSessionId?: string) => Promise<SeastudioBrowserSession>;
491
- close: (browserSessionId?: string) => Promise<{
492
- browserSessionId: string;
494
+ get: (webviewRuntimeId?: string) => Promise<SeastudioWebviewRuntime>;
495
+ close: (webviewRuntimeId?: string) => Promise<{
496
+ webviewRuntimeId: string;
493
497
  closed: boolean;
494
498
  }>;
499
+ show: (url: string) => Promise<{
500
+ url: string;
501
+ webviewRuntimeId: string;
502
+ instanceId?: string;
503
+ tab?: SeastudioWebviewRuntimeTab;
504
+ }>;
505
+ evaluate: <T = unknown>(webviewRuntimeId: string, tabId: string, script: string, timeoutMs?: number) => Promise<{
506
+ result: T;
507
+ }>;
495
508
  };
496
- show: (url: string) => Promise<{
497
- url: string;
498
- browserSessionId: string;
499
- instanceId?: string;
500
- tab?: SeastudioBrowserTab;
501
- }>;
502
509
  tab: {
503
- create: (browserSessionId?: string, url?: string, ownerInstanceId?: string) => Promise<{
504
- browserSessionId: string;
505
- tab: SeastudioBrowserTab;
510
+ create: (webviewRuntimeId?: string, url?: string, ownerInstanceId?: string) => Promise<{
511
+ webviewRuntimeId: string;
512
+ tab: SeastudioWebviewRuntimeTab;
506
513
  activeTabId: string;
507
514
  }>;
508
- close: (browserSessionId: string, tabId: string) => Promise<{
509
- browserSessionId: string;
515
+ close: (webviewRuntimeId: string, tabId: string) => Promise<{
516
+ webviewRuntimeId: string;
510
517
  closedTabId: string;
511
518
  activeTabId: string | null;
512
519
  }>;
513
- activate: (browserSessionId: string, tabId: string) => Promise<{
514
- browserSessionId: string;
520
+ activate: (webviewRuntimeId: string, tabId: string) => Promise<{
521
+ webviewRuntimeId: string;
515
522
  activeTabId: string;
516
523
  }>;
517
- navigate: (browserSessionId: string, tabId: string, url: string) => Promise<{
518
- browserSessionId: string;
524
+ navigate: (webviewRuntimeId: string, tabId: string, url: string) => Promise<{
525
+ webviewRuntimeId: string;
519
526
  tabId: string;
520
527
  url: string;
521
528
  }>;
522
- goBack: (browserSessionId: string, tabId: string) => Promise<{
529
+ goBack: (webviewRuntimeId: string, tabId: string) => Promise<{
523
530
  ok: boolean;
524
531
  }>;
525
- goForward: (browserSessionId: string, tabId: string) => Promise<{
532
+ goForward: (webviewRuntimeId: string, tabId: string) => Promise<{
526
533
  ok: boolean;
527
534
  }>;
528
- reload: (browserSessionId: string, tabId: string) => Promise<{
535
+ reload: (webviewRuntimeId: string, tabId: string) => Promise<{
529
536
  ok: boolean;
530
537
  }>;
531
- stop: (browserSessionId: string, tabId: string) => Promise<{
538
+ stop: (webviewRuntimeId: string, tabId: string) => Promise<{
532
539
  ok: boolean;
533
540
  }>;
534
541
  getOrCreateForInstance: (ownerInstanceId: string, url?: string) => Promise<{
535
- browserSessionId: string;
536
- tab: SeastudioBrowserTab;
542
+ webviewRuntimeId: string;
543
+ tab: SeastudioWebviewRuntimeTab;
537
544
  activeTabId: string;
538
545
  created: boolean;
539
546
  }>;
540
547
  };
541
548
  viewport: {
542
- bind: (browserSessionId: string | undefined, rect: SeastudioBrowserRect, ownerInstanceId?: string) => Promise<SeastudioBrowserViewportBinding>;
543
- };
544
- runtime: {
545
- evaluate: <T = unknown>(browserSessionId: string, tabId: string, script: string, timeoutMs?: number) => Promise<{
546
- result: T;
547
- }>;
549
+ bind: (rect: SeastudioWebviewViewportRect, options?: SeastudioWebviewRuntimeViewportBindOptions) => Promise<SeastudioWebviewRuntimeViewportBinding>;
548
550
  };
549
551
  certificate: {
550
- respond: (browserSessionId: string, requestId: string, allow: boolean) => Promise<{
552
+ respond: (webviewRuntimeId: string, requestId: string, allow: boolean) => Promise<{
551
553
  ok: boolean;
552
554
  }>;
553
555
  };
@@ -596,8 +598,8 @@ declare const projectTools: MCPTool[];
596
598
 
597
599
  declare const skillTools: MCPTool[];
598
600
 
599
- declare const SINGLETON_BROWSER_SESSION_ID = "browser-session-default";
600
- declare const browserRuntimeTools: MCPTool[];
601
+ declare const SINGLETON_WEBVIEW_RUNTIME_ID = "webview-runtime-default";
602
+ declare const webviewRuntimeTools: MCPTool[];
601
603
 
602
604
  /**
603
605
  * 插件发送给主程序的请求主题
@@ -681,14 +683,14 @@ declare const SeastudioNotifications: {
681
683
  readonly PROPOSAL_FEEDBACK: "seastudio:proposal-feedback";
682
684
  /** 插件实例请求更新宿主 plugin tab 标题 */
683
685
  readonly PLUGIN_TAB_TITLE_CHANGED: "plugin:tab-title_changed";
684
- /** Browser Session 状态变化 */
685
- readonly BROWSER_SESSION_CHANGED: "browser:session_changed";
686
- /** Browser Session 关闭 */
687
- readonly BROWSER_SESSION_CLOSED: "browser:session_closed";
688
- /** Browser Session 证书错误,需要客户端 UI 决策 */
689
- readonly BROWSER_CERTIFICATE_ERROR: "browser:certificate_error";
690
- /** Browser Session 收到网页新标签请求 */
691
- readonly BROWSER_NEW_TAB_REQUESTED: "browser:new_tab_requested";
686
+ /** WebviewRuntime 状态变化 */
687
+ readonly WEBVIEW_RUNTIME_STATE_CHANGED: "webview-runtime:state_changed";
688
+ /** WebviewRuntime 关闭 */
689
+ readonly WEBVIEW_RUNTIME_CLOSED: "webview-runtime:closed";
690
+ /** WebviewRuntime 证书错误,需要客户端 UI 决策 */
691
+ readonly WEBVIEW_RUNTIME_CERTIFICATE_ERROR: "webview-runtime:certificate_error";
692
+ /** WebviewRuntime 收到网页新标签请求 */
693
+ readonly WEBVIEW_RUNTIME_NEW_TAB_REQUESTED: "webview-runtime:new_tab_requested";
692
694
  /**
693
695
  * Agent 对话 session:新建。消息历史仍由 Agent 前端持有,宿主仅同步列表用于侧栏。
694
696
  * 通常由 Agent 通过 notifications/publish 发出;其他订阅者(含 host-ui)可据此更新 UI。
@@ -737,6 +739,10 @@ declare const SeastudioNotifications: {
737
739
  readonly HOST_APP_VISIBILITY: "host:app_visibility";
738
740
  /** Host MCP tools/list 发生变化(例如 Seaflow bridge 动态注册工具) */
739
741
  readonly RUNTIME_TOOLS_CHANGED: "mcp:runtime_tools_changed";
742
+ /** Host 精确路由到插件实例的工具调用请求 */
743
+ readonly PLUGIN_TOOL_CALL: "plugin:tool_call";
744
+ /** 插件实例返回给 Host 的工具调用结果 */
745
+ readonly PLUGIN_TOOL_RESULT: "plugin:tool_result";
740
746
  /** 主程序用户登录态变化;不包含访问令牌 */
741
747
  readonly AUTH_SESSION_CHANGED: "auth:session_changed";
742
748
  };
@@ -810,6 +816,39 @@ interface AuthSessionChangedParams {
810
816
  user: AuthSessionUser | null;
811
817
  };
812
818
  }
819
+ interface PluginToolCallCaller {
820
+ type: 'agent' | 'plugin' | 'host';
821
+ agentInstanceId?: string;
822
+ pluginId?: string;
823
+ pluginInstanceId?: string;
824
+ projectId?: string;
825
+ threadId?: string;
826
+ }
827
+ interface PluginToolCallTarget {
828
+ providerId: string;
829
+ pluginId: string;
830
+ pluginInstanceId: string;
831
+ contractHash: string;
832
+ }
833
+ interface PluginToolCallEnvelope {
834
+ callId: string;
835
+ caller: PluginToolCallCaller;
836
+ target: PluginToolCallTarget;
837
+ toolName: string;
838
+ arguments: Record<string, unknown>;
839
+ timeoutMs: number;
840
+ }
841
+ interface PluginToolCallError {
842
+ name?: string;
843
+ message: string;
844
+ code?: string;
845
+ details?: unknown;
846
+ }
847
+ interface PluginToolResultEnvelope {
848
+ callId: string;
849
+ result?: unknown;
850
+ error?: PluginToolCallError;
851
+ }
813
852
  interface SeastudioDragFileData {
814
853
  sourcePath: string;
815
854
  sourceRootId?: SeastudioDragRootId;
@@ -1098,4 +1137,4 @@ interface HostAppVisibilityParams {
1098
1137
  declare const allTools: MCPTool[];
1099
1138
  declare const tools: MCPTool[];
1100
1139
 
1101
- export { type AgentInstanceSessionSnapshot, type AuthSessionChangedParams, type AuthSessionStatus, type AuthSessionUser, type FileDeletedParams, type FileKeepRequestedParams, type FileModifiedParams, type FileOpenRequestedParams, type FileRenamedParams, type FileSavedParams, type FileSelectedParams, type FileSendRequestedParams, type FileTransferRequestedParams, type FilesChangedParams, type GitBranchInfo, type GitBranchesResult, type GitChangeKind, type GitChangedParams, type GitCommitRef, type GitCommitRefType, type GitFileChange, type GitLineChange, type GitLineChangeKind, type GitLogCommit, type GitLogResult, type GitOpenDiffRequestedParams, type GitStatusResult, type GitSummary, type HostAppVisibilityParams, type PluginTabTitleChangedParams, type ProposalChangedParams, type ProposalFeedbackFileSummary, type ProposalFeedbackHunk, type ProposalFeedbackOrigin, type ProposalFeedbackParams, type ProposalRecord, type ProposalRequestedFile, type ProposalRequestedHunk, type ProposalRequestedParams, type ProposalStatus, type RootsChangedParams, SINGLETON_BROWSER_SESSION_ID, type SeastudioBatchFlattenCopyOptions, type SeastudioBatchFlattenPreviewOptions, type SeastudioBrowserCertificateError, type SeastudioBrowserRect, type SeastudioBrowserSession, type SeastudioBrowserSessionOpenOptions, type SeastudioBrowserState, type SeastudioBrowserStatus, type SeastudioBrowserTab, type SeastudioBrowserViewportBinding, type SeastudioDragDropParams, type SeastudioDragEnterParams, type SeastudioDragFileData, type SeastudioDragRootId, type SeastudioDragStartParams, type SeastudioEditorProposalAction, type SeastudioEditorProposalOptions, type SeastudioEditorProposeOptions, type SeastudioFileDownloadOptions, type SeastudioFileInfo, type SeastudioFileInfoOptions, type SeastudioFileListOptions, type SeastudioFileReadOptions, type SeastudioFileSaveAsOptions, type SeastudioFileSearchMatch, type SeastudioFileSearchOptions, type SeastudioFileTransferOptions, type SeastudioFileTreeOptions, type SeastudioFileWriteOptions, type SeastudioFilesystemRoot, type SeastudioFilesystemRootId, SeastudioNotifications, type SeastudioProjectInfo, type SeastudioProposalFile, type SeastudioProposalHunk, SeastudioRequests, type SeastudioRootId, type SeastudioShellCloseResult, type SeastudioShellEntry, type SeastudioShellEntryLevel, type SeastudioShellGetEntriesOptions, type SeastudioShellGetEntriesResult, type SeastudioShellKind, type SeastudioShellOneShotResult, type SeastudioShellOpenOptions, type SeastudioShellRunOptions, type SeastudioShellRunResult, type SeastudioShellSession, type SeastudioShellSignalResult, type SeastudioShellWaitResult, type SeastudioSinglePathOptions, type SeastudioWorkspacePathMode, type SeastudioWriteReviewMode, type SessionArchiveRequestedParams, type SessionCreatedParams, type SessionDeleteRequestedParams, type SessionNewRequestedParams, type SessionNotificationBase, type SessionRemovedParams, type SessionRenameRequestedParams, type SessionSelectedParams, type SessionSelectedReason, type SessionSnapshotItem, type SessionStateSnapshotParams, type SessionStatus, type SessionStatusParams, type SessionSummaryParams, type TextSendRequestedParams, type TextSendRequestedSelectionRange, type TextSendRequestedSource, agentManagementTools, agentTabTools, allTools, annotateTool, batchFlattenCopyEvidenceOutputSchema, browserRuntimeTools, callTool, callToolText, dualPathEvidenceOutputSchema, editorTools, fileDownloadEvidenceOutputSchema, fileSaveAsEvidenceOutputSchema, fileTools, fileUrlEvidenceOutputSchema, gitTools, pluginManagementTools, pluginTabTools, projectTools, request, rootedPathEvidenceOutputSchema, rootedWriteEvidenceOutputSchema, runOneShotShellCommand, seastudio, shellSessionCloseEvidenceOutputSchema, shellSessionOpenEvidenceOutputSchema, shellSessionRunEvidenceOutputSchema, shellSessionSignalEvidenceOutputSchema, shellSessionSnapshotEvidenceOutputSchema, shellTools, skillTools, tools };
1140
+ export { type AgentInstanceSessionSnapshot, type AuthSessionChangedParams, type AuthSessionStatus, type AuthSessionUser, type FileDeletedParams, type FileKeepRequestedParams, type FileModifiedParams, type FileOpenRequestedParams, type FileRenamedParams, type FileSavedParams, type FileSelectedParams, type FileSendRequestedParams, type FileTransferRequestedParams, type FilesChangedParams, type GitBranchInfo, type GitBranchesResult, type GitChangeKind, type GitChangedParams, type GitCommitRef, type GitCommitRefType, type GitFileChange, type GitLineChange, type GitLineChangeKind, type GitLogCommit, type GitLogResult, type GitOpenDiffRequestedParams, type GitStatusResult, type GitSummary, type HostAppVisibilityParams, type PluginTabTitleChangedParams, type PluginToolCallCaller, type PluginToolCallEnvelope, type PluginToolCallError, type PluginToolCallTarget, type PluginToolResultEnvelope, type ProposalChangedParams, type ProposalFeedbackFileSummary, type ProposalFeedbackHunk, type ProposalFeedbackOrigin, type ProposalFeedbackParams, type ProposalRecord, type ProposalRequestedFile, type ProposalRequestedHunk, type ProposalRequestedParams, type ProposalStatus, type RootsChangedParams, SINGLETON_WEBVIEW_RUNTIME_ID, type SeastudioBatchFlattenCopyOptions, type SeastudioBatchFlattenPreviewOptions, type SeastudioDragDropParams, type SeastudioDragEnterParams, type SeastudioDragFileData, type SeastudioDragRootId, type SeastudioDragStartParams, type SeastudioEditorProposalAction, type SeastudioEditorProposalOptions, type SeastudioEditorProposeOptions, type SeastudioFileDownloadOptions, type SeastudioFileInfo, type SeastudioFileInfoOptions, type SeastudioFileListOptions, type SeastudioFileReadOptions, type SeastudioFileSaveAsOptions, type SeastudioFileSearchMatch, type SeastudioFileSearchOptions, type SeastudioFileTransferOptions, type SeastudioFileTreeOptions, type SeastudioFileWriteOptions, type SeastudioFilesystemRoot, type SeastudioFilesystemRootId, SeastudioNotifications, type SeastudioProjectInfo, type SeastudioProposalFile, type SeastudioProposalHunk, SeastudioRequests, type SeastudioRootId, type SeastudioShellCloseResult, type SeastudioShellEntry, type SeastudioShellEntryLevel, type SeastudioShellGetEntriesOptions, type SeastudioShellGetEntriesResult, type SeastudioShellKind, type SeastudioShellOneShotResult, type SeastudioShellOpenOptions, type SeastudioShellRunOptions, type SeastudioShellRunResult, type SeastudioShellSession, type SeastudioShellSignalResult, type SeastudioShellWaitResult, type SeastudioSinglePathOptions, type SeastudioWebviewRuntime, type SeastudioWebviewRuntimeCertificateError, type SeastudioWebviewRuntimeOpenOptions, type SeastudioWebviewRuntimeState, type SeastudioWebviewRuntimeStatus, type SeastudioWebviewRuntimeTab, type SeastudioWebviewRuntimeViewportBindOptions, type SeastudioWebviewRuntimeViewportBinding, type SeastudioWebviewViewportRect, type SeastudioWorkspacePathMode, type SeastudioWriteReviewMode, type SessionArchiveRequestedParams, type SessionCreatedParams, type SessionDeleteRequestedParams, type SessionNewRequestedParams, type SessionNotificationBase, type SessionRemovedParams, type SessionRenameRequestedParams, type SessionSelectedParams, type SessionSelectedReason, type SessionSnapshotItem, type SessionStateSnapshotParams, type SessionStatus, type SessionStatusParams, type SessionSummaryParams, type TextSendRequestedParams, type TextSendRequestedSelectionRange, type TextSendRequestedSource, agentManagementTools, agentTabTools, allTools, annotateTool, batchFlattenCopyEvidenceOutputSchema, callTool, callToolText, dualPathEvidenceOutputSchema, editorTools, fileDownloadEvidenceOutputSchema, fileSaveAsEvidenceOutputSchema, fileTools, fileUrlEvidenceOutputSchema, gitTools, pluginManagementTools, pluginTabTools, projectTools, request, rootedPathEvidenceOutputSchema, rootedWriteEvidenceOutputSchema, runOneShotShellCommand, seastudio, shellSessionCloseEvidenceOutputSchema, shellSessionOpenEvidenceOutputSchema, shellSessionRunEvidenceOutputSchema, shellSessionSignalEvidenceOutputSchema, shellSessionSnapshotEvidenceOutputSchema, shellTools, skillTools, tools, webviewRuntimeTools };
@@ -1,2 +1,2 @@
1
- export { SINGLETON_BROWSER_SESSION_ID, SeastudioNotifications, SeastudioRequests, agentManagementTools, agentTabTools, allTools, annotateTool, batchFlattenCopyEvidenceOutputSchema, browserRuntimeTools, callTool, callToolText, dualPathEvidenceOutputSchema, editorTools, fileDownloadEvidenceOutputSchema, fileSaveAsEvidenceOutputSchema, fileTools, fileUrlEvidenceOutputSchema, gitTools, pluginManagementTools, pluginTabTools, projectTools, request, rootedPathEvidenceOutputSchema, rootedWriteEvidenceOutputSchema, runOneShotShellCommand, seastudio, shellSessionCloseEvidenceOutputSchema, shellSessionOpenEvidenceOutputSchema, shellSessionRunEvidenceOutputSchema, shellSessionSignalEvidenceOutputSchema, shellSessionSnapshotEvidenceOutputSchema, shellTools, skillTools, tools } from '../../chunk-IAAA5JF6.js';
2
- import '../../chunk-TJ3CGHWJ.js';
1
+ export { SINGLETON_WEBVIEW_RUNTIME_ID, SeastudioNotifications, SeastudioRequests, agentManagementTools, agentTabTools, allTools, annotateTool, batchFlattenCopyEvidenceOutputSchema, callTool, callToolText, dualPathEvidenceOutputSchema, editorTools, fileDownloadEvidenceOutputSchema, fileSaveAsEvidenceOutputSchema, fileTools, fileUrlEvidenceOutputSchema, gitTools, pluginManagementTools, pluginTabTools, projectTools, request, rootedPathEvidenceOutputSchema, rootedWriteEvidenceOutputSchema, runOneShotShellCommand, seastudio, shellSessionCloseEvidenceOutputSchema, shellSessionOpenEvidenceOutputSchema, shellSessionRunEvidenceOutputSchema, shellSessionSignalEvidenceOutputSchema, shellSessionSnapshotEvidenceOutputSchema, shellTools, skillTools, tools, webviewRuntimeTools } from '../../chunk-PN3WUVKZ.js';
2
+ import '../../chunk-6XG5DRQW.js';
@@ -43,7 +43,7 @@ interface MCPToolInputSchema {
43
43
  interface MCPToolAnnotations {
44
44
  operationKind?: 'read' | 'mutate' | 'system' | 'workflow';
45
45
  requiresExecutionEvidence?: boolean;
46
- rawDomain?: 'workspace' | 'filesystem' | 'editor' | 'seaflow' | 'asset' | 'git' | 'preview' | 'shell' | 'browser' | 'excel' | 'word' | 'skill' | `plugin-${string}`;
46
+ rawDomain?: 'workspace' | 'filesystem' | 'editor' | 'seaflow' | 'asset' | 'git' | 'preview' | 'shell' | 'browser' | 'webview' | 'excel' | 'word' | 'skill' | `plugin-${string}`;
47
47
  hostForwarding?: {
48
48
  timeoutMs?: number;
49
49
  };
@@ -43,7 +43,7 @@ interface MCPToolInputSchema {
43
43
  interface MCPToolAnnotations {
44
44
  operationKind?: 'read' | 'mutate' | 'system' | 'workflow';
45
45
  requiresExecutionEvidence?: boolean;
46
- rawDomain?: 'workspace' | 'filesystem' | 'editor' | 'seaflow' | 'asset' | 'git' | 'preview' | 'shell' | 'browser' | 'excel' | 'word' | 'skill' | `plugin-${string}`;
46
+ rawDomain?: 'workspace' | 'filesystem' | 'editor' | 'seaflow' | 'asset' | 'git' | 'preview' | 'shell' | 'browser' | 'webview' | 'excel' | 'word' | 'skill' | `plugin-${string}`;
47
47
  hostForwarding?: {
48
48
  timeoutMs?: number;
49
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seastudio/sdk",
3
- "version": "4.0.18",
3
+ "version": "5.1.0",
4
4
  "description": "SeaStudio SDK - UI 组件 + MCP 信息交换中心",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",