@aalis/api-webui 0.11.0 → 0.12.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.
- package/dist/frame/frame.css +218 -0
- package/dist/frame/frame.js +100 -0
- package/dist/frame.d.ts +165 -0
- package/dist/frame.d.ts.map +1 -0
- package/dist/frame.js +121 -0
- package/dist/frame.js.map +1 -0
- package/dist/index.d.ts +127 -208
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -15
- package/dist/index.js.map +1 -1
- package/dist/page.d.ts +423 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +28 -0
- package/dist/page.js.map +1 -0
- package/dist/rest.d.ts +585 -0
- package/dist/rest.d.ts.map +1 -0
- package/dist/rest.js +12 -0
- package/dist/rest.js.map +1 -0
- package/dist/theme.d.ts +469 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +280 -0
- package/dist/theme.js.map +1 -0
- package/dist/themes/aalis-dark.json +50 -0
- package/dist/themes/aalis-light.json +50 -0
- package/dist/themes/brand-dark.json +50 -0
- package/dist/themes/brand-light.json +50 -0
- package/dist/themes/calm-dark.json +50 -0
- package/dist/themes/calm-light.json +50 -0
- package/dist/themes/neutral-dark.json +50 -0
- package/dist/themes/neutral-light.json +50 -0
- package/package.json +13 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,203 +1,36 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { UnmetService } from '@aalis/api-doctor';
|
|
2
|
+
import type { LogEntry, LogLevel } from '@aalis/core';
|
|
3
|
+
import type { Notice, NoticeHandle, PageDefinition, PageHandle, PagePlacement } from './page.js';
|
|
4
4
|
/**
|
|
5
5
|
* WebUI 服务 —— Web 管理后台
|
|
6
6
|
*
|
|
7
|
-
* 负责启动 HTTP 服务器,提供 REST API
|
|
8
|
-
*
|
|
7
|
+
* 负责启动 HTTP 服务器,提供 REST API(插件管理、配置、页面等)与 WebSocket(会话协议、管理面推送),
|
|
8
|
+
* 同时托管前端静态文件。
|
|
9
9
|
*
|
|
10
|
-
* 默认由 plugin-webui-server
|
|
10
|
+
* 默认由 plugin-webui-server 提供,第三方可替换整个实现或仅替换前端部分。插件不直接调登记方法,经绑定接口
|
|
11
|
+
* {@link BoundWebui} 的 definePage 与 notify 登记,归属与撤回由门面管。
|
|
11
12
|
*/
|
|
12
13
|
export interface WebUIService {
|
|
13
14
|
/** 获取 HTTP 服务监听端口 */
|
|
14
15
|
getPort(): number;
|
|
15
16
|
/** 获取 HTTP 服务监听地址 */
|
|
16
17
|
getHost(): string;
|
|
17
|
-
/** 注册一个 WebUI 页面;返回 dispose */
|
|
18
|
-
registerPage(page: WebuiPage, contextId: string): () => void;
|
|
19
|
-
/** 列出当前所有已注册的页面(含插件归属) */
|
|
20
|
-
getPages(): Array<WebuiPage & {
|
|
21
|
-
pluginName: string;
|
|
22
|
-
}>;
|
|
23
18
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
19
|
+
* 登记一个页面,归属插件实例 instance;同一实例同一 key 再登记就是替换。按质量门槛校验(见 PageDefinition),
|
|
20
|
+
* 不过就不登记并记一条错误日志。返回撤回,只撤这一次登记
|
|
26
21
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* 页面动作处理函数。caller 是路由层解析出的调用者身份,可用来做业务级检查
|
|
31
|
-
* (如 owner 自检)。
|
|
32
|
-
*/
|
|
33
|
-
export type WebuiActionHandler = (args: Record<string, unknown>, caller?: UserIdentity) => Promise<unknown>;
|
|
34
|
-
/** 统计卡片 */
|
|
35
|
-
export interface WebuiStatComponent {
|
|
36
|
-
type: 'stat';
|
|
37
|
-
label: string;
|
|
38
|
-
source: string;
|
|
39
|
-
icon?: string;
|
|
40
|
-
}
|
|
41
|
-
/** 数据表格 */
|
|
42
|
-
export interface WebuiTableComponent {
|
|
43
|
-
type: 'table';
|
|
44
|
-
label?: string;
|
|
45
|
-
source: string;
|
|
46
|
-
columns: Array<{
|
|
47
|
-
key: string;
|
|
48
|
-
label: string;
|
|
49
|
-
render?: string;
|
|
50
|
-
nowrap?: boolean;
|
|
51
|
-
minWidth?: number;
|
|
52
|
-
maxWidth?: number;
|
|
53
|
-
}>;
|
|
54
|
-
/**
|
|
55
|
-
* 行内操作按钮;method 对应的 action 同 form.save 的失败约定(返回 {ok:false,error} 即失败)。
|
|
56
|
-
* 非 danger/confirm 的 action 返回**不带 ok 字段**的对象会被当详情弹窗展示;
|
|
57
|
-
* 只想刷新表格就返回 undefined 或 {ok:true}。
|
|
58
|
-
*/
|
|
59
|
-
actions?: Array<{
|
|
60
|
-
label: string;
|
|
61
|
-
method: string;
|
|
62
|
-
confirm?: string;
|
|
63
|
-
danger?: boolean;
|
|
64
|
-
}>;
|
|
65
|
-
/** 自动刷新间隔(**秒**,与 graph.refresh 的毫秒相反);0 / undefined = 关闭 */
|
|
66
|
-
refresh?: number;
|
|
67
|
-
/** 启用前端本地文本搜索(空格分隔多关键词,AND 语义,对所有列值做不区分大小写子串匹配) */
|
|
68
|
-
searchable?: boolean;
|
|
69
|
-
/** 搜索框 placeholder(searchable=true 时生效) */
|
|
70
|
-
searchPlaceholder?: string;
|
|
71
|
-
}
|
|
72
|
-
/** 配置表单(复用 ConfigSchema) */
|
|
73
|
-
export interface WebuiFormComponent {
|
|
74
|
-
type: 'form';
|
|
75
|
-
label?: string;
|
|
76
|
-
/** 读取当前值的 action 名;返回表单初值对象 */
|
|
77
|
-
source: string;
|
|
22
|
+
addPage(page: PageDefinition, instance: string): () => void;
|
|
23
|
+
/** 页面数据变了:推给打开着它的界面,按实例、页面、组件与会话合并短时间内的连发 */
|
|
24
|
+
invalidate(instance: string, pageKey: string, componentId?: string, sessionId?: string): void;
|
|
78
25
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* 失败约定:业务失败**返回** `{ ok: false, error: '原因' }`(HTTP 仍是 200——路由只把
|
|
82
|
-
* action 的抛错转成 5xx),前端据此显示原因;抛错同样被前端捕获展示。返回其它任何值
|
|
83
|
-
* (含 undefined)都视为成功。
|
|
26
|
+
* 登记一条提示,归属插件实例 instance;同一实例同一 id 再登记就是替换。open 指向的不是本实例位置为 plugin 或
|
|
27
|
+
* settings 的页面时不登记并记一条错误日志。返回撤回,只撤这一次登记
|
|
84
28
|
*/
|
|
85
|
-
|
|
86
|
-
schema: ConfigSchema;
|
|
87
|
-
}
|
|
88
|
-
/** 操作按钮组 */
|
|
89
|
-
export interface WebuiActionsComponent {
|
|
90
|
-
type: 'actions';
|
|
91
|
-
label?: string;
|
|
92
|
-
/** method 对应的 action 同 form.save 的失败约定(返回 {ok:false,error} 即失败,原因显示在按钮旁) */
|
|
93
|
-
items: Array<{
|
|
94
|
-
label: string;
|
|
95
|
-
method: string;
|
|
96
|
-
confirm?: string;
|
|
97
|
-
danger?: boolean;
|
|
98
|
-
variant?: string;
|
|
99
|
-
}>;
|
|
100
|
-
}
|
|
101
|
-
/** 键值信息面板 */
|
|
102
|
-
export interface WebuiInfoComponent {
|
|
103
|
-
type: 'info';
|
|
104
|
-
label?: string;
|
|
105
|
-
source: string;
|
|
106
|
-
}
|
|
107
|
-
/** Markdown 内容 */
|
|
108
|
-
export interface WebuiMarkdownComponent {
|
|
109
|
-
type: 'markdown';
|
|
110
|
-
label?: string;
|
|
111
|
-
source: string;
|
|
112
|
-
}
|
|
113
|
-
/** 子标签页容器 */
|
|
114
|
-
export interface WebuiTabsComponent {
|
|
115
|
-
type: 'tabs';
|
|
116
|
-
label?: string;
|
|
117
|
-
items: Array<{
|
|
118
|
-
key: string;
|
|
119
|
-
label: string;
|
|
120
|
-
content: WebuiComponent[];
|
|
121
|
-
}>;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* 交互式关系图组件(基于 Cytoscape)。
|
|
125
|
-
*
|
|
126
|
-
* `source` 后端方法签名: `(args: { focusId?: string; maxDepth?: number; maxBreadth?: number; filters?: Record<string, unknown> })`
|
|
127
|
-
* 返回 cytoscape 风格的 elements:
|
|
128
|
-
* ```ts
|
|
129
|
-
* {
|
|
130
|
-
* nodes: Array<{ data: { id: string; label: string; kind: 'person' | 'event' | string; [k: string]: unknown } }>;
|
|
131
|
-
* edges: Array<{ data: { id: string; source: string; target: string; label?: string; relationType?: string; [k: string]: unknown } }>;
|
|
132
|
-
* focusId?: string;
|
|
133
|
-
* stats?: Record<string, number | string>;
|
|
134
|
-
* }
|
|
135
|
-
* ```
|
|
136
|
-
*
|
|
137
|
-
* `detailSource` 可选:节点被点击时调用,签名 `(args: { nodeId: string; kind: string })`,返回任意键值对 → 右侧 Drawer 渲染。
|
|
138
|
-
*/
|
|
139
|
-
export interface WebuiGraphComponent {
|
|
140
|
-
type: 'graph';
|
|
141
|
-
label?: string;
|
|
142
|
-
source: string;
|
|
143
|
-
detailSource?: string;
|
|
144
|
-
/** 节点最大深度/宽度默认值(前端展示初值) */
|
|
145
|
-
defaultMaxDepth?: number;
|
|
146
|
-
defaultMaxBreadth?: number;
|
|
147
|
-
/** 自动刷新(毫秒),0 / undefined = 关闭 */
|
|
148
|
-
refresh?: number;
|
|
149
|
-
/** 顶部右上角额外按钮;本处**不解读** {ok:false} 约定(返回值被丢弃),失败请抛错 */
|
|
150
|
-
actions?: Array<{
|
|
151
|
-
label: string;
|
|
152
|
-
method: string;
|
|
153
|
-
confirm?: string;
|
|
154
|
-
danger?: boolean;
|
|
155
|
-
variant?: string;
|
|
156
|
-
}>;
|
|
157
|
-
/**
|
|
158
|
-
* 自定义节点类别:节点 data.kind → 形状/颜色/图例文本。
|
|
159
|
-
* 声明后组件据此生成样式与底部图例,**不再使用人物关系图的内置三类**
|
|
160
|
-
* (person/event/entity)语义——非关系图场景(如权限图)必须声明,
|
|
161
|
-
* 避免冒用他人图例。
|
|
162
|
-
*/
|
|
163
|
-
nodeKinds?: Array<{
|
|
164
|
-
kind: string;
|
|
165
|
-
label: string;
|
|
166
|
-
shape?: 'circle' | 'round-rect' | 'diamond';
|
|
167
|
-
color?: string;
|
|
168
|
-
}>;
|
|
169
|
-
/** 自定义边类别:边 data.kind → 颜色/虚线/图例文本。 */
|
|
170
|
-
edgeKinds?: Array<{
|
|
171
|
-
kind: string;
|
|
172
|
-
label: string;
|
|
173
|
-
color?: string;
|
|
174
|
-
dashed?: boolean;
|
|
175
|
-
}>;
|
|
176
|
-
}
|
|
177
|
-
/** 所有声明式页面组件的联合类型 */
|
|
178
|
-
export type WebuiComponent = WebuiStatComponent | WebuiTableComponent | WebuiFormComponent | WebuiActionsComponent | WebuiInfoComponent | WebuiMarkdownComponent | WebuiTabsComponent | WebuiGraphComponent;
|
|
179
|
-
/**
|
|
180
|
-
* 插件可声明的 WebUI 页面 —— 完整定义。
|
|
181
|
-
*
|
|
182
|
-
* 由本包直接导出(core 不再持有 WebuiPage 骨架)。
|
|
183
|
-
*/
|
|
184
|
-
export interface WebuiPage {
|
|
185
|
-
/** 页面唯一标识(对应前端路由/标签 key) */
|
|
186
|
-
key: string;
|
|
187
|
-
/** 页面显示名称 */
|
|
188
|
-
label: string;
|
|
189
|
-
/** 图标标识(命名标识或内联 SVG) */
|
|
190
|
-
icon?: string;
|
|
191
|
-
/** 排序权重(越小越靠前,默认 99) */
|
|
192
|
-
order?: number;
|
|
193
|
-
/** 自定义渲染器标识(非声明式 content 场景) */
|
|
194
|
-
renderer?: string;
|
|
195
|
-
/** 声明式页面内容(不提供则使用客户端内置页面) */
|
|
196
|
-
content?: WebuiComponent[];
|
|
29
|
+
addNotice(notice: Notice, instance: string): () => void;
|
|
197
30
|
}
|
|
198
31
|
/**
|
|
199
32
|
* 通过 declaration merging 向插件定义注入展示元数据 extends。
|
|
200
|
-
*
|
|
33
|
+
* 页面与提示不是静态字段:在 apply 里经 webuiServer 的 definePage 与 notify 登记。
|
|
201
34
|
*/
|
|
202
35
|
declare module '@aalis/core' {
|
|
203
36
|
interface PluginMeta {
|
|
@@ -205,20 +38,6 @@ declare module '@aalis/core' {
|
|
|
205
38
|
extends?: ExtendDeclaration;
|
|
206
39
|
}
|
|
207
40
|
}
|
|
208
|
-
declare module '@aalis/schema-config' {
|
|
209
|
-
/**
|
|
210
|
-
* WebUI 表单交互属性 —— 由本包注入(config-api 的 SchemaField 只声明各宿主共需字段)。
|
|
211
|
-
* 这些属性只被 WebUI 配置表单消费;其他宿主可以忽略。
|
|
212
|
-
*/
|
|
213
|
-
interface SchemaField {
|
|
214
|
-
/** 标记为敏感字段,前端显示时自动遮蔽 */
|
|
215
|
-
secret?: boolean;
|
|
216
|
-
/** select / multiselect 动态选项来源:服务名(前端经 webui-server 调该服务的 listModels() 或等价方法获取选项) */
|
|
217
|
-
dynamicOptions?: string;
|
|
218
|
-
/** multiselect 是否允许用户手动输入自定义值(不限于选项列表) */
|
|
219
|
-
allowCustom?: boolean;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
41
|
/**
|
|
223
42
|
* 插件可以声明它对 core 做了哪些扩展,用于前端展示和文档生成。
|
|
224
43
|
*
|
|
@@ -241,10 +60,11 @@ export interface ExtendDeclaration {
|
|
|
241
60
|
* 子系统展示目录条目。
|
|
242
61
|
*
|
|
243
62
|
* **职责边界**:
|
|
244
|
-
* - 这是 **WebUI
|
|
63
|
+
* - 这是 **WebUI 展示层契约**:插件列表(`GET /api/plugins`)给出每个插件声明的 `subsystem`,界面的插件区按它分组,
|
|
64
|
+
* 组名与顺序取本表。
|
|
245
65
|
* - `core` 不解释 subsystem 的取值,插件定义上只有一个透传的字符串字段
|
|
246
66
|
* `subsystem?: string`(不读不解释,纯粹搬运给 WebUI)。
|
|
247
|
-
* - 本表只描述 **展示元数据**(中文 label /
|
|
67
|
+
* - 本表只描述 **展示元数据**(中文 label / 排序),**不写死插件归属**。
|
|
248
68
|
* 归属由每个插件在 `definePlugin({ subsystem: 'llm' })` 中声明。
|
|
249
69
|
*
|
|
250
70
|
* 解耦收益:
|
|
@@ -263,8 +83,8 @@ export interface SubsystemMetadata {
|
|
|
263
83
|
/**
|
|
264
84
|
* 默认子系统元数据。
|
|
265
85
|
*
|
|
266
|
-
* 仅提供常用 id 的中文 label 与排序;插件可任意自定义 subsystem id
|
|
267
|
-
*
|
|
86
|
+
* 仅提供常用 id 的中文 label 与排序;插件可任意自定义 subsystem id,未命中本表的按 id 原样显示、排在表里的之后,
|
|
87
|
+
* 没声明的排在最后。
|
|
268
88
|
*/
|
|
269
89
|
export declare const DEFAULT_SUBSYSTEM_METADATA: readonly SubsystemMetadata[];
|
|
270
90
|
/**
|
|
@@ -279,13 +99,112 @@ export interface WebuiClientProvider {
|
|
|
279
99
|
/** 返回含 index.html 的前端静态目录绝对路径 */
|
|
280
100
|
getClientDir(): string;
|
|
281
101
|
}
|
|
282
|
-
export declare const webuiClient: import("@aalis/core").ServiceDescriptor<WebuiClientProvider,
|
|
283
|
-
/** `webui-server`
|
|
284
|
-
export interface BoundWebui extends
|
|
285
|
-
/**
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
102
|
+
export declare const webuiClient: import("@aalis/core").ServiceDescriptor<WebuiClientProvider, WebuiClientProvider>;
|
|
103
|
+
/** `webui-server` 的业务层:调用转发给选中的那一家,页面与提示的登记归属这次激活,提供者换人自动重挂,停用时同一拍撤回 */
|
|
104
|
+
export interface BoundWebui extends WebUIService {
|
|
105
|
+
/**
|
|
106
|
+
* 登记一个页面:声明式页面的组件、数据源、动作与处理函数一次给出,返回形状按组件种类推出,引用了没声明的动作在编译期
|
|
107
|
+
* 报错;插件前端页面给出框架所在的模块、数据源与动作,输入按声明推出。要在引用它的 notify 之前登记
|
|
108
|
+
*/
|
|
109
|
+
definePage<const P extends PagePlacement = 'plugin', const S extends Record<string, unknown> = Record<never, never>, const R extends Record<string, unknown> = Record<never, never>>(page: PageDefinition<P, S, NoInfer<keyof S & string>, R>): PageHandle;
|
|
110
|
+
/** 发一条提示;同一个 id 再发一次就是替换 */
|
|
111
|
+
notify(notice: Notice): NoticeHandle;
|
|
289
112
|
}
|
|
290
113
|
export declare const webuiServer: import("@aalis/core").ServiceDescriptor<WebUIService, BoundWebui>;
|
|
114
|
+
/**
|
|
115
|
+
* 插件实例没起来的原因,插件列表与「需要处理」共用这一份,由服务端算好,界面照字段画:
|
|
116
|
+
* - `lacking`:pending 时缺的 required 服务。每条从直接提供者沿依赖链追到根(api-doctor 的共享判据):根失败(带它的
|
|
117
|
+
* 失败说明)、停用、在运行却没在提供、没有已装的插件提供、互相等待成环。一个服务有几个已装的提供者都没起来时,
|
|
118
|
+
* 每个提供者各一条;
|
|
119
|
+
* - `waiting`:pending 时在等的服务,根插件在启动,它启动完就有。只在等的插件不算故障;
|
|
120
|
+
* - `unconfigured`:error 时必填却没填的配置项路径(schema-config 的 validateConfig 报的 missing:`''` 算没填,
|
|
121
|
+
* 密钥引用 `{ $secret }` 算填了)。
|
|
122
|
+
*
|
|
123
|
+
* 不是这两种状态时三项都为空。链的根插件待配置与否,看它自己那一行的 `unconfigured`。
|
|
124
|
+
*/
|
|
125
|
+
export interface PluginBlockers {
|
|
126
|
+
lacking: UnmetService[];
|
|
127
|
+
waiting: UnmetService[];
|
|
128
|
+
unconfigured: string[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 「需要处理」的一项,每项计 1:
|
|
132
|
+
* - `approval`:推给了审批面、还没结算的审批(同一会话同一时刻最多一张);`session` 是会话的标题,会话管理不在时没有;
|
|
133
|
+
* - `plugin`:插件实例的故障:失败(`error`,带原因),或缺服务(`pending` 且 `lacking` 不空)。只在等别的插件启动的不在这里;
|
|
134
|
+
* - `notice`:插件的提示,`instance` 是发出它的插件实例。
|
|
135
|
+
*/
|
|
136
|
+
export type AttentionItem = {
|
|
137
|
+
kind: 'approval';
|
|
138
|
+
id: string;
|
|
139
|
+
sessionId: string;
|
|
140
|
+
session?: string;
|
|
141
|
+
tool: string;
|
|
142
|
+
} | ({
|
|
143
|
+
kind: 'plugin';
|
|
144
|
+
instance: string;
|
|
145
|
+
state: 'error' | 'pending';
|
|
146
|
+
error?: string;
|
|
147
|
+
} & PluginBlockers) | ({
|
|
148
|
+
kind: 'notice';
|
|
149
|
+
instance: string;
|
|
150
|
+
} & Notice);
|
|
151
|
+
/**
|
|
152
|
+
* 日志的筛选,历史(`GET /api/logs/tail`、`/api/logs/range` 的同名查询参数)与实时推送(`log.subscribe`)同一份,在服务端筛:
|
|
153
|
+
* - `level`:这一级及以上;
|
|
154
|
+
* - `plugin`:插件实例 id,认这个实例与它分出的子作用域的日志;
|
|
155
|
+
* - `text`:日志正文里含有这段文字,不分大小写。
|
|
156
|
+
*
|
|
157
|
+
* 几项一起给时都要满足,空字符串当没给
|
|
158
|
+
*/
|
|
159
|
+
export interface LogFilter {
|
|
160
|
+
level?: LogLevel;
|
|
161
|
+
plugin?: string;
|
|
162
|
+
text?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* 前端发往 `/admin` 的消息:日志页打开时订阅实时日志(带 `filter` 时只推符合的,再订阅一次换掉筛选),离开时退订。
|
|
166
|
+
* 认不出的消息(含写法不对的筛选)服务端忽略,连接与之前的订阅照常
|
|
167
|
+
*/
|
|
168
|
+
export type WebuiAdminClientMessage = {
|
|
169
|
+
type: 'log.subscribe';
|
|
170
|
+
filter?: LogFilter;
|
|
171
|
+
} | {
|
|
172
|
+
type: 'log.unsubscribe';
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* `/admin` 推给前端的事件:
|
|
176
|
+
* - `log`:一条新日志,只推给订阅了、符合它订阅时的筛选的连接。先订阅、再带同一份筛选取 `GET /api/logs/tail`,两边按 `seq` 去重;
|
|
177
|
+
* - `plugins.changed`:插件状态可能变了,或页面登记表变了,前端重取插件与页面(`GET /api/plugins`、`GET /api/pages`)。
|
|
178
|
+
* 一次启停可能连着推几条,服务端不合并;
|
|
179
|
+
* - `page.invalidate`:插件说这一页的数据变了。带 componentId 时只重取这个组件;带 sessionId 时只有打开着这个会话的面板重取。
|
|
180
|
+
* 服务端按这四项合并短时间内的连发;
|
|
181
|
+
* - `layout.changed`:owner 的布局记录(固定的页面、会话面板的标签)变了,前端重取 `GET /api/layout`;
|
|
182
|
+
* - `attention.changed`:「需要处理」变了(审批推出或结算、插件的故障有变、提示登记或撤回),前端重取 `GET /api/attention`;
|
|
183
|
+
* - `app.restarting`:应用即将重启,连接随后断开;
|
|
184
|
+
* - `client.reload`:前端偏好改了或有前端包被卸载,活跃前端可能换了,前端整页重新加载。
|
|
185
|
+
*/
|
|
186
|
+
export type WebuiAdminEvent = {
|
|
187
|
+
type: 'log';
|
|
188
|
+
entry: LogEntry;
|
|
189
|
+
} | {
|
|
190
|
+
type: 'plugins.changed';
|
|
191
|
+
} | {
|
|
192
|
+
type: 'page.invalidate';
|
|
193
|
+
instance: string;
|
|
194
|
+
pageKey: string;
|
|
195
|
+
componentId?: string;
|
|
196
|
+
sessionId?: string;
|
|
197
|
+
} | {
|
|
198
|
+
type: 'layout.changed';
|
|
199
|
+
} | {
|
|
200
|
+
type: 'attention.changed';
|
|
201
|
+
} | {
|
|
202
|
+
type: 'app.restarting';
|
|
203
|
+
} | {
|
|
204
|
+
type: 'client.reload';
|
|
205
|
+
};
|
|
206
|
+
export * from './frame.js';
|
|
207
|
+
export * from './page.js';
|
|
208
|
+
export * from './rest.js';
|
|
209
|
+
export * from './theme.js';
|
|
291
210
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,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AAG,MAAM,CAAC,CAAC;AAOpD;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAElH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACxG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAK9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
// ----- WebUI
|
|
1
|
+
// ----- WebUI 服务接口 -----
|
|
2
2
|
//
|
|
3
|
-
// WebUI
|
|
4
|
-
//
|
|
5
|
-
import { defineService
|
|
3
|
+
// WebUI 服务契约、页面与提示的登记门面(页面契约见 page.ts,插件前端的消息通道见 frame.ts)、管理面推送(/admin)的
|
|
4
|
+
// 事件类型、管理面 REST(rest.ts)、主题的令牌表与文件格式(theme.ts),以及服务描述符。
|
|
5
|
+
import { defineService } from '@aalis/core';
|
|
6
6
|
/**
|
|
7
7
|
* 默认子系统元数据。
|
|
8
8
|
*
|
|
9
|
-
* 仅提供常用 id 的中文 label 与排序;插件可任意自定义 subsystem id
|
|
10
|
-
*
|
|
9
|
+
* 仅提供常用 id 的中文 label 与排序;插件可任意自定义 subsystem id,未命中本表的按 id 原样显示、排在表里的之后,
|
|
10
|
+
* 没声明的排在最后。
|
|
11
11
|
*/
|
|
12
12
|
export const DEFAULT_SUBSYSTEM_METADATA = Object.freeze([
|
|
13
13
|
{ id: 'system', label: '系统', order: 0 },
|
|
@@ -21,27 +21,45 @@ export const DEFAULT_SUBSYSTEM_METADATA = Object.freeze([
|
|
|
21
21
|
{ id: 'tools', label: '工具', order: 80 },
|
|
22
22
|
{ id: 'storage', label: '存储', order: 85 },
|
|
23
23
|
{ id: 'message', label: '消息', order: 90 },
|
|
24
|
+
{ id: 'media', label: '媒体', order: 95 },
|
|
24
25
|
{ id: 'session', label: '会话', order: 100 },
|
|
25
26
|
{ id: 'skills', label: '技能', order: 110 },
|
|
26
27
|
{ id: 'scheduler', label: '调度', order: 120 },
|
|
28
|
+
{ id: 'workflow', label: '工作流', order: 125 },
|
|
27
29
|
{ id: 'authority', label: '权限', order: 130 },
|
|
28
30
|
{ id: 'user', label: '用户', order: 140 },
|
|
29
31
|
{ id: 'external', label: '外部', order: 160 },
|
|
30
32
|
]);
|
|
31
|
-
// -----
|
|
33
|
+
// ----- 服务描述符(调用型:业务层就是提供者的形状)-----
|
|
32
34
|
export const webuiClient = defineService('webui-client');
|
|
33
35
|
export const webuiServer = defineService('webui-server', port => {
|
|
36
|
+
// 先建页面的账本:提供者换人时按创建次序重挂,提示的 open 要在它指向的页面挂上之后才核得过
|
|
34
37
|
const pages = port.registrar({
|
|
35
38
|
key: page => page.key,
|
|
36
|
-
register: (service, page) => service.
|
|
39
|
+
register: (service, page) => service.addPage(page, port.id),
|
|
37
40
|
});
|
|
38
|
-
const
|
|
39
|
-
key:
|
|
40
|
-
register: (service,
|
|
41
|
-
});
|
|
42
|
-
return serviceRef(port, {
|
|
43
|
-
registerPage: (page) => pages.add(page),
|
|
44
|
-
registerAction: (method, handler) => actions.add({ method, handler }),
|
|
41
|
+
const notices = port.registrar({
|
|
42
|
+
key: notice => notice.id,
|
|
43
|
+
register: (service, notice) => service.addNotice(notice, port.id),
|
|
45
44
|
});
|
|
45
|
+
const facade = {
|
|
46
|
+
definePage(page) {
|
|
47
|
+
pages.add(page);
|
|
48
|
+
return {
|
|
49
|
+
invalidate: (componentId, sessionId) => {
|
|
50
|
+
if (port.present)
|
|
51
|
+
port.provider.invalidate(port.id, page.key, componentId, sessionId);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
notify: notice => ({ clear: notices.add(notice) }),
|
|
56
|
+
};
|
|
57
|
+
return Object.assign(Object.create(port.provider), facade);
|
|
46
58
|
});
|
|
59
|
+
// ----- 页面与提示,见 page.ts;插件前端的消息通道,见 frame.ts;主题的令牌表、文件格式与内置主题,见 theme.ts;
|
|
60
|
+
// 管理面 REST 的路由表与请求、回应的类型,见 rest.ts -----
|
|
61
|
+
export * from './frame.js';
|
|
62
|
+
export * from './page.js';
|
|
63
|
+
export * from './rest.js';
|
|
64
|
+
export * from './theme.js';
|
|
47
65
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,EAAE;AACF,0EAA0E;AAC1E,wDAAwD;AAIxD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAwF5C;;;;;GAKG;AACH,MA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