@fses/workbench-app 0.2.18 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WORKBENCH-CLOSURE.json +14 -14
- package/dist/WorkbenchCardCenterDrawer-CWBuBD04.js +421 -0
- package/dist/WorkbenchDiagnosticsFooter-BxpwRNMe.js +22 -0
- package/dist/WorkbenchDiagnosticsPage-D0mWFNWS.js +72 -0
- package/dist/Workspace-DwnUU7_7.js +22678 -0
- package/dist/adapters/defaultAgentTransportAdapter.d.ts +6 -0
- package/dist/adapters/defaultBrowserAdapters.d.ts +22 -0
- package/dist/adapters/defaultPlatformRequestAdapter.d.ts +6 -0
- package/dist/adapters/defaultRealtimeAdapter.d.ts +6 -0
- package/dist/adapters/endpointResolver.d.ts +16 -0
- package/dist/adapters/index.d.ts +7 -1
- package/dist/adapters/servicePorts.d.ts +20 -0
- package/dist/adapters/types.d.ts +27 -1
- package/dist/canvas/api/index.js +1 -1
- package/dist/canvas/bridge/workbenchCanvasBus.d.ts +13 -1
- package/dist/canvas/persistence/canvasSnapshotStorage.d.ts +3 -2
- package/dist/{canvasFacade-B8jYm_aO.js → canvasFacade-ZFqB_i7z.js} +1 -1
- package/dist/{cardFactory-DmEBcCf4.js → cardFactory-D5dyYSC3.js} +197 -161
- package/dist/components/WorkbenchAppHost.vue.d.ts +5 -5
- package/dist/components/WorkbenchApplication.vue.d.ts +2 -2
- package/dist/components/WorkbenchCardCenterDrawer.vue.d.ts +2 -0
- package/dist/components/WorkbenchDiagnosticsFooter.vue.d.ts +2 -0
- package/dist/components/WorkbenchDiagnosticsPage.vue.d.ts +2 -0
- package/dist/components/WorkbenchDrawerOutlet.vue.d.ts +6 -0
- package/dist/components/WorkbenchFeatureOutlet.vue.d.ts +2 -0
- package/dist/components/WorkbenchSlotOutlet.vue.d.ts +5 -0
- package/dist/config/workbenchAppConfig.d.ts +4 -0
- package/dist/customCardCatalog-DcoxF7gK.js +512 -0
- package/dist/extensions/index.d.ts +3 -54
- package/dist/extensions/index.js +7 -5
- package/dist/extensions/manifest.d.ts +27 -0
- package/dist/extensions/normalizeWorkbenchExtensions.d.ts +19 -0
- package/dist/extensions/types.d.ts +62 -0
- package/dist/fses-workbench-app.js +106 -89
- package/dist/index-CytMrt6f.js +1771 -0
- package/dist/index-DkGYPLLJ.js +34 -0
- package/dist/index.d.ts +10 -1
- package/dist/internal/personal-workbench/components/workbench/WorkbenchCanvas.vue.d.ts +4 -4
- package/dist/internal/personal-workbench/components/workbench/WorkbenchCanvasSettingsMenu.vue.d.ts +4 -4
- package/dist/internal/personal-workbench/components/workbench/WorkbenchFdeImageComposeDrawer.vue.d.ts +19 -0
- package/dist/internal/personal-workbench/components/workbench/WorkbenchFdeToolbar.vue.d.ts +36 -0
- package/dist/internal/personal-workbench/components/workbench/WorkbenchStudio.vue.d.ts +2 -2
- package/dist/internal/personal-workbench/components/workbench/controllers/canvasConfigController.d.ts +23 -0
- package/dist/internal/personal-workbench/components/workbench/controllers/canvasLayoutController.d.ts +12 -0
- package/dist/internal/personal-workbench/components/workbench/controllers/canvasRefreshController.d.ts +11 -0
- package/dist/internal/personal-workbench/components/workbench/controllers/canvasSelectionController.d.ts +11 -0
- package/dist/internal/personal-workbench/components/workbench/showcase/WorkbenchShowcase.vue.d.ts +4 -4
- package/dist/internal/personal-workbench/controllers/workbenchBuiltinPluginBridge.d.ts +32 -0
- package/dist/internal/personal-workbench/controllers/workbenchChartConfigModel.d.ts +68 -0
- package/dist/internal/personal-workbench/controllers/workbenchChartDataSourceController.d.ts +100 -0
- package/dist/internal/personal-workbench/controllers/workbenchChartDrilldownController.d.ts +96 -0
- package/dist/internal/personal-workbench/controllers/workbenchChartDrilldownTable.d.ts +34 -0
- package/dist/internal/personal-workbench/controllers/workbenchFdeVersionController.d.ts +107 -0
- package/dist/internal/personal-workbench/controllers/workbenchRecommendationConfigModel.d.ts +82 -0
- package/dist/internal/personal-workbench/lib/deepAgentApi.d.ts +13 -9
- package/dist/internal/personal-workbench/lib/deepAgentQueueState.d.ts +3 -1
- package/dist/internal/personal-workbench/lib/fdeWorkbenchConfigClient.d.ts +6 -5
- package/dist/internal/personal-workbench/lib/runtimeIdentity.d.ts +5 -0
- package/dist/internal/personal-workbench/lib/runtimePrimitiveRegistry.d.ts +1 -1
- package/dist/internal/personal-workbench/lib/vueRuntimeAdapters.d.ts +4 -4
- package/dist/internal/personal-workbench/lib/workbenchApi.d.ts +61 -47
- package/dist/internal/personal-workbench/lib/workbenchMetricDetailApi.d.ts +2 -1
- package/dist/internal/personal-workbench/lib/workbenchRemoteClient.d.ts +3 -1
- package/dist/internal/personal-workbench/lib/workbenchRequestTransport.d.ts +24 -0
- package/dist/internal/personal-workbench/lib/workbenchStorage.d.ts +8 -7
- package/dist/internal/personal-workbench/pages/Workspace.vue.d.ts +2 -2
- package/dist/internal/personal-workbench/stores/domains/actionsRuntime.d.ts +35 -0
- package/dist/internal/personal-workbench/stores/domains/canvasRuntime.d.ts +44 -0
- package/dist/internal/personal-workbench/stores/domains/conversationRuntime.d.ts +29 -0
- package/dist/internal/personal-workbench/stores/domains/dataBindingRuntime.d.ts +27 -0
- package/dist/internal/personal-workbench/stores/domains/fdeRuntime.d.ts +38 -0
- package/dist/internal/personal-workbench/stores/domains/memoryRuntime.d.ts +53 -0
- package/dist/internal/personal-workbench/stores/workbenchRuntime.d.ts +28 -1
- package/dist/kernel/command/createCommandRegistry.d.ts +19 -0
- package/dist/kernel/createWorkbenchHostContext.d.ts +43 -0
- package/dist/kernel/createWorkbenchKernel.d.ts +7 -0
- package/dist/kernel/diagnostics/createWorkbenchDiagnostics.d.ts +35 -0
- package/dist/kernel/event/createEventBus.d.ts +16 -0
- package/dist/kernel/plugin/createPluginManager.d.ts +7 -0
- package/dist/kernel/plugin/registrationScope.d.ts +15 -0
- package/dist/kernel/plugin/types.d.ts +30 -0
- package/dist/kernel/registry/createRegistry.d.ts +42 -0
- package/dist/kernel/registry/resolveSlotContributions.d.ts +14 -0
- package/dist/kernel/types.d.ts +52 -0
- package/dist/kernel/workbenchHostContext.d.ts +14 -0
- package/dist/normalizeWorkbenchExtensions-Ccv3n3fC.js +425 -0
- package/dist/plugin/index.d.ts +7 -0
- package/dist/plugin/index.js +8 -0
- package/dist/plugin/types.d.ts +106 -0
- package/dist/plugins/defaultWorkbenchPlugins.d.ts +11 -0
- package/dist/plugins/workbenchCardCenterPlugin.d.ts +13 -0
- package/dist/plugins/workbenchDiagnosticsPlugin.d.ts +15 -0
- package/dist/plugins/workbenchDrawerCommands.d.ts +16 -0
- package/dist/plugins/workbenchSettingsPlugin.d.ts +19 -0
- package/dist/plugins/workbenchThemePlugin.d.ts +15 -0
- package/dist/routing/createWorkbenchFeatureRoute.d.ts +11 -0
- package/dist/routing/resolveWorkbenchFeatureRoute.d.ts +23 -0
- package/dist/runtime/index.d.ts +6 -1
- package/dist/runtime/index.js +6 -3
- package/dist/runtime/scope/createWorkbenchRuntimeScope.d.ts +10 -0
- package/dist/runtime/store/workbenchRuntimeContext.d.ts +12 -0
- package/dist/runtime/store/workbenchRuntimeFacade.d.ts +3 -0
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/useWorkbenchRuntime-CJLqEtgU.js +24062 -0
- package/dist/version.d.ts +1 -1
- package/node_modules/@fses/ai-chat/dist/fses-ai-chat.js +28256 -7528
- package/node_modules/@fses/ai-chat/dist/fses-ai-chat.umd.cjs +17 -17
- package/node_modules/@fses/ai-chat/dist/style.css +1 -1
- package/node_modules/@fses/ai-chat/package.json +3 -3
- package/node_modules/@fses/workbench-card/dist/fses-workbench-card-renderers.js +5 -5
- package/node_modules/@fses/workbench-card/dist/fses-workbench-card.js +5 -5
- package/node_modules/@fses/workbench-card/dist/fses-workbench-card.umd.cjs +1 -1
- package/node_modules/@fses/workbench-card/dist/types/block.d.ts +4 -1
- package/node_modules/@fses/workbench-card/package.json +1 -1
- package/node_modules/@fses/workbench-card/src/registry/cardRegistry.ts +4 -4
- package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.generated.js +1 -1
- package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.generated.ts +1 -1
- package/node_modules/@fses/workbench-card/src/types/block.ts +4 -12
- package/package.json +7 -3
- package/dist/Workspace-JvnSC-w9.js +0 -23186
- package/dist/index-D-WW3bXH.js +0 -829
- package/dist/useWorkbenchRuntime-D_AtkXIX.js +0 -23865
- package/dist/workbenchCustomComponentRegistry-CWUPjCnJ.js +0 -267
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type MemoryRuntimeState } from './memoryRuntime';
|
|
2
|
+
import type { WorkbenchStorageAdapter } from '../../../../adapters/types';
|
|
3
|
+
export interface FdeCoreThreadSession {
|
|
4
|
+
eventsOpened: boolean;
|
|
5
|
+
eventsOpening?: Promise<void>;
|
|
6
|
+
eventsUrl?: string;
|
|
7
|
+
lastEventId?: string;
|
|
8
|
+
localConversationIds: Set<string>;
|
|
9
|
+
scopeKey: string;
|
|
10
|
+
threadId: string;
|
|
11
|
+
}
|
|
12
|
+
export interface FdeCoreSessionResources {
|
|
13
|
+
conversationAliasesByScope: Map<string, Map<string, string>>;
|
|
14
|
+
currentThreadSession: FdeCoreThreadSession | null;
|
|
15
|
+
pageThreadConversationIdsByScope: Map<string, Set<string>>;
|
|
16
|
+
}
|
|
17
|
+
export interface FdeRuntimeIdentityState extends MemoryRuntimeState {
|
|
18
|
+
}
|
|
19
|
+
/** 构建 FDE thread scope key。 */
|
|
20
|
+
export declare function fdeThreadConversationScopeKey(state: Pick<FdeRuntimeIdentityState, 'appId' | 'tenantId' | 'userId' | 'workspaceId'>): string;
|
|
21
|
+
/** 读取或创建当前 scope alias map。 */
|
|
22
|
+
export declare function fdeCoreConversationAliasMap(resources: FdeCoreSessionResources, scopeKey: string): Map<string, string>;
|
|
23
|
+
/** 记录本地 conversationId 对真实 threadId 的 alias。 */
|
|
24
|
+
export declare function rememberFdeCoreConversationAlias(resources: FdeCoreSessionResources, scopeKey: string, localConversationId: string, threadId: string): void;
|
|
25
|
+
/** 将本地 conversationId 解析为真实 FDE threadId。 */
|
|
26
|
+
export declare function resolveFdeCoreConversationAlias(resources: FdeCoreSessionResources, scopeKey: string, conversationId: string): string;
|
|
27
|
+
/** 创建或复用当前页面 FDE Core thread session。 */
|
|
28
|
+
export declare function setCurrentFdeCoreThreadSession(resources: FdeCoreSessionResources, scopeKey: string, threadId: string): FdeCoreThreadSession;
|
|
29
|
+
/** 清理当前页面 FDE Core thread session。 */
|
|
30
|
+
export declare function clearCurrentFdeCoreThreadSession(resources: FdeCoreSessionResources, scopeKey?: string): void;
|
|
31
|
+
/** 读取当前 scope 下已确认的 FDE thread IDs。 */
|
|
32
|
+
export declare function readFdeThreadConversationIdsForScope(resources: FdeCoreSessionResources, scopeKey: string, userId: string | undefined, storage?: WorkbenchStorageAdapter): Set<string>;
|
|
33
|
+
/** 判断 conversation 是否为当前 scope 已确认 thread。 */
|
|
34
|
+
export declare function hasDeepAgentThreadConversationIdForCurrentScope(resources: FdeCoreSessionResources, state: Pick<FdeRuntimeIdentityState, 'appId' | 'tenantId' | 'userId' | 'workspaceId'>, conversationId: string, storage?: WorkbenchStorageAdapter): boolean;
|
|
35
|
+
/** 分类 transcript 恢复错误。 */
|
|
36
|
+
export declare function classifyConversationRestoreError(error: unknown): 'forbidden' | 'missing' | 'failed';
|
|
37
|
+
/** 写入当前 scope 已确认的 FDE threadId。 */
|
|
38
|
+
export declare function markFdeThreadConversationIdForStateScope(resources: FdeCoreSessionResources, state: FdeRuntimeIdentityState, conversationId: string, storage?: WorkbenchStorageAdapter): Record<string, string[]> | undefined;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 工作台记忆 runtime domain - 管理记忆类型、capture scope 和 UI memory patch。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-09-01
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkbenchContext } from '../../lib/workbenchApi';
|
|
7
|
+
import type { AgentMemoryScope, AgentMemoryType } from '../../lib/agentMemoryClient';
|
|
8
|
+
import { type WorkbenchUiMemory } from '../../lib/workbenchStorage';
|
|
9
|
+
import type { WorkbenchStorageAdapter } from '../../../../adapters/types';
|
|
10
|
+
export interface MemoryRuntimeState {
|
|
11
|
+
appId: string;
|
|
12
|
+
currentConversationId: string;
|
|
13
|
+
fdeMode: boolean;
|
|
14
|
+
roleId: NonNullable<WorkbenchUiMemory['roleId']>;
|
|
15
|
+
tenantId: string;
|
|
16
|
+
userId: string;
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
}
|
|
19
|
+
/** 判断字符串是否为记忆类型。 */
|
|
20
|
+
export declare function isAgentMemoryType(value: string): value is AgentMemoryType;
|
|
21
|
+
/**
|
|
22
|
+
* 归一化 trace 中的记忆类型。
|
|
23
|
+
* @param value - 候选类型。
|
|
24
|
+
* @returns API 接受的记忆类型。
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeAgentMemoryType(value?: string): AgentMemoryType;
|
|
27
|
+
/**
|
|
28
|
+
* 构建候选记忆保存作用域。
|
|
29
|
+
* @param scopeLevel - 候选作用域层级。
|
|
30
|
+
* @param context - 当前工作台上下文。
|
|
31
|
+
* @param conversationId - 当前对话 ID。
|
|
32
|
+
* @returns 记忆作用域。
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildMemoryCaptureScope(scopeLevel: string | undefined, context: WorkbenchContext, conversationId?: string): AgentMemoryScope;
|
|
35
|
+
/**
|
|
36
|
+
* 移除已经由独立 canvas settings 存储管理的字段。
|
|
37
|
+
* @param memory - UI memory。
|
|
38
|
+
* @returns 不含画布设置的 memory。
|
|
39
|
+
*/
|
|
40
|
+
export declare function stripCanvasSettingsMemory(memory: Partial<WorkbenchUiMemory> | null | undefined): Partial<WorkbenchUiMemory>;
|
|
41
|
+
/**
|
|
42
|
+
* 构建当前 runtime conversation scope key。
|
|
43
|
+
* @param state - 最小运行态身份。
|
|
44
|
+
* @returns tenant/user/app/workspace/role/chatMode scope key。
|
|
45
|
+
*/
|
|
46
|
+
export declare function currentConversationScopeKeyFromState(state: Pick<MemoryRuntimeState, 'appId' | 'fdeMode' | 'roleId' | 'tenantId' | 'userId' | 'workspaceId'>): string;
|
|
47
|
+
/**
|
|
48
|
+
* 合并 UI memory patch,并补当前作用域与会话。
|
|
49
|
+
* @param state - 当前运行态。
|
|
50
|
+
* @param patch - 待保存 patch。
|
|
51
|
+
* @returns 可整体写入的 UI memory。
|
|
52
|
+
*/
|
|
53
|
+
export declare function makeMemoryPatch(state: MemoryRuntimeState, patch?: Partial<WorkbenchUiMemory>, storage?: WorkbenchStorageAdapter): WorkbenchUiMemory;
|
|
@@ -8,6 +8,9 @@ import type { BusinessGroupContext } from '@fses/workbench-app/types';
|
|
|
8
8
|
import { type CreateDeepAgentRunPayload, type DeepAgentAttachmentPayload } from '@workbench-internal/lib/deepAgentApi';
|
|
9
9
|
import { type WorkbenchActionPayload, type WorkbenchChatRequestRefs } from '@workbench-internal/lib/workbenchApi';
|
|
10
10
|
import type { SystemCardWorkbenchPromptParams } from '@workbench-internal/lib/workbenchSystemCardPrompt';
|
|
11
|
+
import type { WorkbenchAgentTransportAdapter, WorkbenchEndpointResolver, WorkbenchPlatformRequestAdapter, WorkbenchRealtimeAdapter, WorkbenchStorageAdapter, WorkbenchTransportMode } from '../../../adapters';
|
|
12
|
+
import { type WorkbenchCanvasBus } from '../../../canvas/bridge/workbenchCanvasBus';
|
|
13
|
+
import { createWorkbenchSocketClient } from '@workbench-internal/lib/workbenchSocketClient';
|
|
11
14
|
import { type FdeWorkbenchAssetPackage } from '@workbench-internal/lib/fdeWorkbenchAssetPackage';
|
|
12
15
|
import type { AssistantPersonaKey, ConversationTurn, LayoutConfig, PlanResponse, RoleId, WorkbenchSnapshot, WorkbenchTemplate } from '@fses/workbench-app/types';
|
|
13
16
|
import type { WorkbenchV2Document } from '@workbench-internal/types/workbenchV2';
|
|
@@ -100,6 +103,7 @@ interface PendingDeepAgentRequiredAction {
|
|
|
100
103
|
export interface BuildWorkbenchDeepAgentRunPayloadInput {
|
|
101
104
|
workbenches: WorkbenchTemplate[];
|
|
102
105
|
resourceId?: string;
|
|
106
|
+
snapshotVersion?: number;
|
|
103
107
|
workspaceId: string;
|
|
104
108
|
appId?: string;
|
|
105
109
|
businessGroup?: BusinessGroupContext;
|
|
@@ -161,5 +165,28 @@ export declare function buildWorkbenchResourceIdPayload(workbenches: WorkbenchTe
|
|
|
161
165
|
* @returns 可直接传给 createDeepAgentRun/createDeepAgentThreadRun 的 payload。
|
|
162
166
|
*/
|
|
163
167
|
export declare function buildWorkbenchDeepAgentRunPayload(input: BuildWorkbenchDeepAgentRunPayloadInput): CreateDeepAgentRunPayload;
|
|
164
|
-
export
|
|
168
|
+
export interface CreateWorkbenchRuntimeStoreDefinitionOptions {
|
|
169
|
+
agentTransportAdapter?: WorkbenchAgentTransportAdapter;
|
|
170
|
+
canvasBus?: WorkbenchCanvasBus;
|
|
171
|
+
endpointResolver?: WorkbenchEndpointResolver;
|
|
172
|
+
platformRequestAdapter?: WorkbenchPlatformRequestAdapter;
|
|
173
|
+
realtimeAdapter?: WorkbenchRealtimeAdapter;
|
|
174
|
+
socketClientFactory?: typeof createWorkbenchSocketClient;
|
|
175
|
+
storageAdapter?: WorkbenchStorageAdapter;
|
|
176
|
+
transportMode?: WorkbenchTransportMode;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 创建可独立挂载到 Pinia 的工作台 runtime store 定义。
|
|
180
|
+
* @param storeId - 当前实例稳定 store ID。
|
|
181
|
+
* @param options - 实例专属 Canvas bus 和 Socket client 工厂。
|
|
182
|
+
* @returns 保持现有 state/actions 合同的 Pinia store definition。
|
|
183
|
+
*/
|
|
184
|
+
export declare function createWorkbenchRuntimeStoreDefinition<TStoreId extends string>(storeId: TStoreId, options?: CreateWorkbenchRuntimeStoreDefinitionOptions): StoreDefinition<TStoreId, WorkbenchRuntimeState, any, any>;
|
|
185
|
+
declare const useDefaultWorkbenchRuntimeStore: StoreDefinition<"personal-workbench-runtime", WorkbenchRuntimeState, any, any>;
|
|
186
|
+
/**
|
|
187
|
+
* 读取当前组件树注入的 runtime store;脱离工作台宿主时回退到 legacy 默认 store。
|
|
188
|
+
* @param args - Pinia store 可选参数。
|
|
189
|
+
* @returns 当前实例 runtime store。
|
|
190
|
+
*/
|
|
191
|
+
export declare function useWorkbenchRuntimeStore(...args: Parameters<typeof useDefaultWorkbenchRuntimeStore>): ReturnType<typeof useDefaultWorkbenchRuntimeStore>;
|
|
165
192
|
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 工作台命令注册表 - 统一插件命令注册、查询和类型化执行入口。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkbenchCommandContribution, WorkbenchCommandExecutionContext, WorkbenchRegistrationHandle } from '../../plugin/types';
|
|
7
|
+
import { type WorkbenchRegistry } from '../registry/createRegistry';
|
|
8
|
+
export interface WorkbenchCommandRegistry {
|
|
9
|
+
execute<TResult = unknown>(id: string, payload?: unknown): Promise<TResult>;
|
|
10
|
+
has(id: string): boolean;
|
|
11
|
+
register(ownerId: string, contribution: WorkbenchCommandContribution): WorkbenchRegistrationHandle;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 创建实例级工作台命令注册表。
|
|
15
|
+
* @param executionContext - 命令执行时可读取的稳定宿主上下文。
|
|
16
|
+
* @param registry - 可选底层贡献注册表。
|
|
17
|
+
* @returns 命令注册与执行接口。
|
|
18
|
+
*/
|
|
19
|
+
export declare function createWorkbenchCommandRegistry(executionContext: WorkbenchCommandExecutionContext, registry?: WorkbenchRegistry<WorkbenchCommandContribution>): WorkbenchCommandRegistry;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 工作台宿主上下文工厂 - 为应用或 Feature Outlet 创建隔离微内核实例。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkbenchAppAdapters } from '../adapters/types';
|
|
7
|
+
import type { WorkbenchServicePorts } from '../adapters/servicePorts';
|
|
8
|
+
import type { WorkbenchAppConfig } from '../config/workbenchAppConfig';
|
|
9
|
+
import type { WorkbenchExtensionInput, WorkbenchExtensionManifestV1 } from '../extensions/manifest';
|
|
10
|
+
import type { WorkbenchPlugin } from '../plugin/types';
|
|
11
|
+
import type { WorkbenchKernel } from './types';
|
|
12
|
+
import type { WorkbenchRuntimeScope } from '../runtime/scope/createWorkbenchRuntimeScope';
|
|
13
|
+
export interface WorkbenchHostDefinition {
|
|
14
|
+
adapters: Partial<WorkbenchAppAdapters>;
|
|
15
|
+
config: WorkbenchAppConfig;
|
|
16
|
+
extensions: WorkbenchExtensionInput;
|
|
17
|
+
}
|
|
18
|
+
export interface WorkbenchHostContext {
|
|
19
|
+
config: Readonly<WorkbenchAppConfig>;
|
|
20
|
+
dispose(): Promise<void>;
|
|
21
|
+
extensions: WorkbenchExtensionManifestV1;
|
|
22
|
+
instanceId: string;
|
|
23
|
+
kernel: WorkbenchKernel;
|
|
24
|
+
ready: Promise<void>;
|
|
25
|
+
runtime: WorkbenchRuntimeScope;
|
|
26
|
+
services: Readonly<WorkbenchServicePorts>;
|
|
27
|
+
}
|
|
28
|
+
export interface CreateWorkbenchHostContextOptions {
|
|
29
|
+
builtInPlugins?: ReadonlyArray<{
|
|
30
|
+
criticality: 'core' | 'optional';
|
|
31
|
+
plugin: WorkbenchPlugin;
|
|
32
|
+
}>;
|
|
33
|
+
disabledPluginIds?: readonly string[];
|
|
34
|
+
instanceId?: string;
|
|
35
|
+
strictRegistrations?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 创建一个工作台组合根的实例级宿主上下文。
|
|
39
|
+
* @param host - 冻结宿主提供的 adapters、config 和 extensions。
|
|
40
|
+
* @param options - 内置插件、实例 ID、远程禁用项和注册严格度。
|
|
41
|
+
* @returns 可等待初始化并在卸载时统一销毁的宿主上下文。
|
|
42
|
+
*/
|
|
43
|
+
export declare function createWorkbenchHostContext(host: WorkbenchHostDefinition, options?: CreateWorkbenchHostContextOptions): WorkbenchHostContext;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CreateWorkbenchKernelOptions, WorkbenchKernel } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 创建一个实例级工作台微内核。
|
|
4
|
+
* @param options - 当前宿主配置、服务和注册严格度。
|
|
5
|
+
* @returns 插件管理器及全部稳定贡献注册表。
|
|
6
|
+
*/
|
|
7
|
+
export declare function createWorkbenchKernel(options?: CreateWorkbenchKernelOptions): WorkbenchKernel;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 工作台内核诊断 - 记录插件状态、贡献冲突和无敏感数据的告警摘要。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
export type WorkbenchPluginDiagnosticStatus = 'registered' | 'active' | 'disabled' | 'failed';
|
|
7
|
+
export interface WorkbenchPluginDiagnostic {
|
|
8
|
+
id: string;
|
|
9
|
+
reason?: string;
|
|
10
|
+
status: WorkbenchPluginDiagnosticStatus;
|
|
11
|
+
version: string;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkbenchContributionDiagnostic {
|
|
14
|
+
id: string;
|
|
15
|
+
ownerId: string;
|
|
16
|
+
reason?: string;
|
|
17
|
+
status: 'active' | 'conflict' | 'disabled';
|
|
18
|
+
type: string;
|
|
19
|
+
}
|
|
20
|
+
export interface WorkbenchKernelDiagnosticsSnapshot {
|
|
21
|
+
contributions: WorkbenchContributionDiagnostic[];
|
|
22
|
+
plugins: WorkbenchPluginDiagnostic[];
|
|
23
|
+
warnings: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface WorkbenchDiagnostics {
|
|
26
|
+
recordContribution(diagnostic: WorkbenchContributionDiagnostic): void;
|
|
27
|
+
recordPlugin(diagnostic: WorkbenchPluginDiagnostic): void;
|
|
28
|
+
snapshot(): WorkbenchKernelDiagnosticsSnapshot;
|
|
29
|
+
warn(message: string): void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 创建实例级内核诊断容器。
|
|
33
|
+
* @returns 只保存结构化摘要的诊断接口。
|
|
34
|
+
*/
|
|
35
|
+
export declare function createWorkbenchDiagnostics(): WorkbenchDiagnostics;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 工作台实例事件总线 - 隔离插件事件并提供可清理订阅。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkbenchRegistrationHandle } from '../../plugin/types';
|
|
7
|
+
export interface WorkbenchEventBus {
|
|
8
|
+
emit(eventName: string, payload?: unknown): Promise<void>;
|
|
9
|
+
on(eventName: string, listener: (payload: unknown) => void | Promise<void>): WorkbenchRegistrationHandle;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 创建一个工作台实例专属事件总线。
|
|
13
|
+
* @param onListenerError - 监听器异常摘要回调。
|
|
14
|
+
* @returns 支持异步监听和取消订阅的事件总线。
|
|
15
|
+
*/
|
|
16
|
+
export declare function createWorkbenchEventBus(onListenerError?: (eventName: string, error: unknown) => void): WorkbenchEventBus;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkbenchPluginManager, WorkbenchPluginManagerOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 创建实例级插件管理器。
|
|
4
|
+
* @param options - 插件上下文工厂和诊断容器。
|
|
5
|
+
* @returns 插件注册、初始化和销毁接口。
|
|
6
|
+
*/
|
|
7
|
+
export declare function createWorkbenchPluginManager(options: WorkbenchPluginManagerOptions): WorkbenchPluginManager;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 插件事务注册作用域 - 统一追踪 setup 期间创建的可清理资源。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkbenchRegistrationHandle } from '../../plugin/types';
|
|
7
|
+
export interface WorkbenchRegistrationScope {
|
|
8
|
+
dispose(): void;
|
|
9
|
+
track(registration: WorkbenchRegistrationHandle): WorkbenchRegistrationHandle;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 创建插件事务注册作用域。
|
|
13
|
+
* @returns 可按逆序撤销所有注册句柄的作用域。
|
|
14
|
+
*/
|
|
15
|
+
export declare function createWorkbenchRegistrationScope(): WorkbenchRegistrationScope;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 插件管理器内部类型 - 区分可信注册来源和核心级别。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkbenchPlugin, WorkbenchPluginContext } from '../../plugin/types';
|
|
7
|
+
import type { WorkbenchDiagnostics } from '../diagnostics/createWorkbenchDiagnostics';
|
|
8
|
+
import type { WorkbenchRegistrationScope } from './registrationScope';
|
|
9
|
+
export type WorkbenchPluginCriticality = 'core' | 'optional';
|
|
10
|
+
export type WorkbenchPluginSource = 'built-in' | 'host';
|
|
11
|
+
export interface WorkbenchPluginRegistration {
|
|
12
|
+
criticality: WorkbenchPluginCriticality;
|
|
13
|
+
plugin: WorkbenchPlugin;
|
|
14
|
+
source: WorkbenchPluginSource;
|
|
15
|
+
}
|
|
16
|
+
export interface WorkbenchPluginInitializeOptions {
|
|
17
|
+
disabledPluginIds?: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
export interface WorkbenchPluginManagerOptions {
|
|
20
|
+
createContext(pluginId: string, scope: WorkbenchRegistrationScope): WorkbenchPluginContext;
|
|
21
|
+
diagnostics: WorkbenchDiagnostics;
|
|
22
|
+
}
|
|
23
|
+
export interface WorkbenchPluginManager {
|
|
24
|
+
dispose(): Promise<void>;
|
|
25
|
+
initialize(options?: WorkbenchPluginInitializeOptions): Promise<void>;
|
|
26
|
+
registerBuiltIn(plugin: WorkbenchPlugin, options: {
|
|
27
|
+
criticality: WorkbenchPluginCriticality;
|
|
28
|
+
}): void;
|
|
29
|
+
registerHost(plugin: WorkbenchPlugin): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 工作台通用贡献注册表 - 提供确定排序、冲突策略和可回滚注册句柄。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
export interface WorkbenchContributionBase {
|
|
7
|
+
id: string;
|
|
8
|
+
order?: number;
|
|
9
|
+
overridable?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface WorkbenchRegistryEntry<TContribution extends WorkbenchContributionBase> {
|
|
12
|
+
contribution: TContribution;
|
|
13
|
+
ownerId: string;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkbenchRegistryConflict<TContribution extends WorkbenchContributionBase> {
|
|
16
|
+
id: string;
|
|
17
|
+
existingOwnerId: string;
|
|
18
|
+
existingContribution: TContribution;
|
|
19
|
+
incomingOwnerId: string;
|
|
20
|
+
incomingContribution: TContribution;
|
|
21
|
+
}
|
|
22
|
+
export interface WorkbenchRegistryRegistration {
|
|
23
|
+
active: boolean;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
}
|
|
26
|
+
export interface WorkbenchRegistry<TContribution extends WorkbenchContributionBase> {
|
|
27
|
+
clear(): void;
|
|
28
|
+
get(id: string): WorkbenchRegistryEntry<TContribution> | undefined;
|
|
29
|
+
has(id: string): boolean;
|
|
30
|
+
list(): Array<WorkbenchRegistryEntry<TContribution>>;
|
|
31
|
+
register(ownerId: string, contribution: TContribution): WorkbenchRegistryRegistration;
|
|
32
|
+
}
|
|
33
|
+
export interface WorkbenchRegistryOptions<TContribution extends WorkbenchContributionBase> {
|
|
34
|
+
duplicatePolicy?: 'preserve-first' | 'throw';
|
|
35
|
+
onConflict?: (conflict: WorkbenchRegistryConflict<TContribution>) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 创建一个实例级贡献注册表。
|
|
39
|
+
* @param options - 重复 ID 策略和冲突回调。
|
|
40
|
+
* @returns 支持确定排序和回滚的贡献注册表。
|
|
41
|
+
*/
|
|
42
|
+
export declare function createWorkbenchRegistry<TContribution extends WorkbenchContributionBase>(options?: WorkbenchRegistryOptions<TContribution>): WorkbenchRegistry<TContribution>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 工作台 slot 贡献解析 - 逐项隔离条件错误并保留其他可见贡献。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkbenchSlotContribution } from '../../plugin/types';
|
|
7
|
+
/**
|
|
8
|
+
* 解析一个语义 slot 当前可见的贡献列表。
|
|
9
|
+
* @param contributions - 已按 registry 规则排序的全部 slot 贡献。
|
|
10
|
+
* @param slotName - 当前语义 slot 名称。
|
|
11
|
+
* @param onConditionError - 单项 when 条件异常回调。
|
|
12
|
+
* @returns 当前 slot 可安全渲染的贡献。
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveWorkbenchSlotContributions(contributions: readonly WorkbenchSlotContribution[], slotName: string, onConditionError?: (contributionId: string, error: unknown) => void): WorkbenchSlotContribution[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 工作台微内核类型 - 汇总实例级注册表、命令、事件和插件生命周期。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkbenchAppAdapters } from '../adapters/types';
|
|
7
|
+
import type { WorkbenchServicePorts } from '../adapters/servicePorts';
|
|
8
|
+
import type { WorkbenchAppConfig } from '../config/workbenchAppConfig';
|
|
9
|
+
import type { WorkbenchCapabilityContribution, WorkbenchCardContribution, WorkbenchDrawerContribution, WorkbenchPlugin, WorkbenchRouteContribution, WorkbenchSlotContribution } from '../plugin/types';
|
|
10
|
+
import type { WorkbenchCommandRegistry } from './command/createCommandRegistry';
|
|
11
|
+
import type { WorkbenchDiagnostics } from './diagnostics/createWorkbenchDiagnostics';
|
|
12
|
+
import type { WorkbenchEventBus } from './event/createEventBus';
|
|
13
|
+
import type { WorkbenchRuntimeScope } from '../runtime/scope/createWorkbenchRuntimeScope';
|
|
14
|
+
import type { WorkbenchPluginCriticality, WorkbenchPluginInitializeOptions } from './plugin/types';
|
|
15
|
+
import type { WorkbenchRegistry, WorkbenchRegistryRegistration } from './registry/createRegistry';
|
|
16
|
+
export interface WorkbenchOwnedRegistry<TContribution extends {
|
|
17
|
+
id: string;
|
|
18
|
+
order?: number;
|
|
19
|
+
overridable?: boolean;
|
|
20
|
+
}> {
|
|
21
|
+
get(id: string): ReturnType<WorkbenchRegistry<TContribution>['get']>;
|
|
22
|
+
has(id: string): boolean;
|
|
23
|
+
list(): ReturnType<WorkbenchRegistry<TContribution>['list']>;
|
|
24
|
+
register(ownerId: string, contribution: TContribution): WorkbenchRegistryRegistration;
|
|
25
|
+
}
|
|
26
|
+
export interface WorkbenchCapabilityRegistry extends WorkbenchOwnedRegistry<WorkbenchCapabilityContribution> {
|
|
27
|
+
isEnabled(id: string): boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface WorkbenchKernel {
|
|
30
|
+
capabilities: WorkbenchCapabilityRegistry;
|
|
31
|
+
cards: WorkbenchOwnedRegistry<WorkbenchCardContribution>;
|
|
32
|
+
commands: WorkbenchCommandRegistry;
|
|
33
|
+
diagnostics: WorkbenchDiagnostics;
|
|
34
|
+
dispose(): Promise<void>;
|
|
35
|
+
drawers: WorkbenchOwnedRegistry<WorkbenchDrawerContribution>;
|
|
36
|
+
events: WorkbenchEventBus;
|
|
37
|
+
initialize(options?: WorkbenchPluginInitializeOptions): Promise<void>;
|
|
38
|
+
registerBuiltInPlugin(plugin: WorkbenchPlugin, options: {
|
|
39
|
+
criticality: WorkbenchPluginCriticality;
|
|
40
|
+
}): void;
|
|
41
|
+
registerHostPlugin(plugin: WorkbenchPlugin): void;
|
|
42
|
+
routes: WorkbenchOwnedRegistry<WorkbenchRouteContribution>;
|
|
43
|
+
runtime: WorkbenchRuntimeScope;
|
|
44
|
+
services: WorkbenchServicePorts;
|
|
45
|
+
slots: WorkbenchOwnedRegistry<WorkbenchSlotContribution>;
|
|
46
|
+
}
|
|
47
|
+
export interface CreateWorkbenchKernelOptions {
|
|
48
|
+
config?: WorkbenchAppConfig;
|
|
49
|
+
instanceId?: string;
|
|
50
|
+
services?: WorkbenchServicePorts | Partial<WorkbenchAppAdapters>;
|
|
51
|
+
strictRegistrations?: boolean;
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 工作台宿主上下文注入 - 让包内组件读取最近的实例级微内核。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-08-31
|
|
5
|
+
*/
|
|
6
|
+
import { type InjectionKey } from 'vue';
|
|
7
|
+
import type { WorkbenchHostContext } from './createWorkbenchHostContext';
|
|
8
|
+
export declare const WORKBENCH_HOST_CONTEXT_KEY: InjectionKey<WorkbenchHostContext>;
|
|
9
|
+
/**
|
|
10
|
+
* 读取最近工作台组合根提供的实例级宿主上下文。
|
|
11
|
+
* @returns 当前 WorkbenchApplication 或 Feature Outlet 的宿主上下文。
|
|
12
|
+
* @throws 当组件未位于工作台组合根下时抛出错误。
|
|
13
|
+
*/
|
|
14
|
+
export declare function useWorkbenchHostContext(): WorkbenchHostContext;
|