@southwind-ai/modules 0.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.
- package/index.ts +8 -0
- package/package.json +23 -0
- package/src/catalog-validation.ts +123 -0
- package/src/composition.ts +344 -0
- package/src/manifest.ts +92 -0
- package/src/menu-composition.ts +54 -0
- package/src/registry.ts +53 -0
- package/src/system-admin-routes.ts +136 -0
- package/src/system-agent-tools.ts +28 -0
- package/src/system-api-binding.ts +37 -0
- package/src/system-api-data-governance.ts +21 -0
- package/src/system-api-permissions.ts +344 -0
- package/src/system-audit-actions.ts +70 -0
- package/src/system-data-governance.ts +30 -0
- package/src/system-features.ts +145 -0
- package/src/system-governed-export-bindings.ts +31 -0
- package/src/system-module-catalog.ts +250 -0
- package/src/system-modules.ts +335 -0
- package/src/system-permissions.ts +142 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import type { ModuleManifest } from "./manifest.js";
|
|
2
|
+
// @windy-module system.agent begin
|
|
3
|
+
import { systemAgentTools } from "./system-agent-tools.js";
|
|
4
|
+
// @windy-module system.agent end
|
|
5
|
+
import { systemAdminRoutes } from "./system-admin-routes.js";
|
|
6
|
+
import { systemApiPermissionBindings } from "./system-api-permissions.js";
|
|
7
|
+
import { systemAuditActions } from "./system-audit-actions.js";
|
|
8
|
+
// @windy-module system.data-governance begin
|
|
9
|
+
import { systemDataPolicies } from "./system-data-governance.js";
|
|
10
|
+
// @windy-module system.data-governance end
|
|
11
|
+
import { systemFeatures } from "./system-features.js";
|
|
12
|
+
import { systemPermissions } from "./system-permissions.js";
|
|
13
|
+
|
|
14
|
+
export function systemFoundationModule(): ModuleManifest {
|
|
15
|
+
return {
|
|
16
|
+
name: "system",
|
|
17
|
+
version: "0.1.0",
|
|
18
|
+
label: "系统基础设施",
|
|
19
|
+
description: "用户、角色、菜单、功能开关与平台治理基础能力。",
|
|
20
|
+
menus: [
|
|
21
|
+
{
|
|
22
|
+
key: "system.identity",
|
|
23
|
+
title: "组织与权限",
|
|
24
|
+
type: "catalog",
|
|
25
|
+
order: 10,
|
|
26
|
+
visible: true,
|
|
27
|
+
icon: "users",
|
|
28
|
+
children: [
|
|
29
|
+
{
|
|
30
|
+
key: "system.profile",
|
|
31
|
+
title: "个人设置",
|
|
32
|
+
type: "button",
|
|
33
|
+
order: 5,
|
|
34
|
+
visible: true,
|
|
35
|
+
path: "/admin/profile",
|
|
36
|
+
icon: "user-round-cog",
|
|
37
|
+
permissionKey: "system.profile.read",
|
|
38
|
+
featureKey: "system.profile",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "system.user",
|
|
42
|
+
title: "用户管理",
|
|
43
|
+
type: "menu",
|
|
44
|
+
order: 10,
|
|
45
|
+
visible: true,
|
|
46
|
+
path: "/admin/system/users",
|
|
47
|
+
icon: "users",
|
|
48
|
+
permissionKey: "system.user.read",
|
|
49
|
+
featureKey: "system.rbac",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "system.role",
|
|
53
|
+
title: "角色权限",
|
|
54
|
+
type: "menu",
|
|
55
|
+
order: 20,
|
|
56
|
+
visible: true,
|
|
57
|
+
path: "/admin/system/roles",
|
|
58
|
+
icon: "shield-check",
|
|
59
|
+
permissionKey: "system.role.read",
|
|
60
|
+
featureKey: "system.rbac",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: "system.department",
|
|
64
|
+
title: "部门组织",
|
|
65
|
+
type: "menu",
|
|
66
|
+
order: 25,
|
|
67
|
+
visible: true,
|
|
68
|
+
path: "/admin/system/departments",
|
|
69
|
+
icon: "building-2",
|
|
70
|
+
permissionKey: "system.department.read",
|
|
71
|
+
featureKey: "system.rbac",
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "system.configuration",
|
|
77
|
+
title: "平台配置",
|
|
78
|
+
type: "catalog",
|
|
79
|
+
order: 20,
|
|
80
|
+
visible: true,
|
|
81
|
+
icon: "settings",
|
|
82
|
+
children: [
|
|
83
|
+
// @windy-module system.settings begin
|
|
84
|
+
{
|
|
85
|
+
key: "system.settings",
|
|
86
|
+
title: "全局设置",
|
|
87
|
+
type: "menu",
|
|
88
|
+
order: 10,
|
|
89
|
+
visible: true,
|
|
90
|
+
path: "/admin/settings",
|
|
91
|
+
icon: "settings",
|
|
92
|
+
permissionKey: "system.settings.read",
|
|
93
|
+
featureKey: "system.settings",
|
|
94
|
+
},
|
|
95
|
+
// @windy-module system.settings end
|
|
96
|
+
// @windy-module system.storage begin
|
|
97
|
+
{
|
|
98
|
+
key: "system.storage",
|
|
99
|
+
title: "文件存储",
|
|
100
|
+
type: "button",
|
|
101
|
+
order: 15,
|
|
102
|
+
visible: true,
|
|
103
|
+
path: "/admin/settings",
|
|
104
|
+
icon: "file-up",
|
|
105
|
+
permissionKey: "system.storage.read",
|
|
106
|
+
featureKey: "system.storage",
|
|
107
|
+
},
|
|
108
|
+
// @windy-module system.storage end
|
|
109
|
+
{
|
|
110
|
+
key: "system.menu",
|
|
111
|
+
title: "菜单管理",
|
|
112
|
+
type: "menu",
|
|
113
|
+
order: 20,
|
|
114
|
+
visible: true,
|
|
115
|
+
path: "/admin/system/menus",
|
|
116
|
+
icon: "panel-left",
|
|
117
|
+
permissionKey: "system.menu.read",
|
|
118
|
+
featureKey: "system.rbac",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
key: "system.dictionary",
|
|
122
|
+
title: "字典管理",
|
|
123
|
+
type: "menu",
|
|
124
|
+
order: 30,
|
|
125
|
+
visible: true,
|
|
126
|
+
path: "/admin/system/dictionaries",
|
|
127
|
+
icon: "book-open",
|
|
128
|
+
permissionKey: "system.dict.read",
|
|
129
|
+
featureKey: "system.rbac",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
key: "system.feature",
|
|
133
|
+
title: "功能开关",
|
|
134
|
+
type: "menu",
|
|
135
|
+
order: 40,
|
|
136
|
+
visible: true,
|
|
137
|
+
path: "/admin/system/features",
|
|
138
|
+
icon: "flag",
|
|
139
|
+
permissionKey: "system.feature.read",
|
|
140
|
+
},
|
|
141
|
+
// @windy-module system.notification begin
|
|
142
|
+
{
|
|
143
|
+
key: "system.notification",
|
|
144
|
+
title: "通知管理",
|
|
145
|
+
type: "menu",
|
|
146
|
+
order: 50,
|
|
147
|
+
visible: true,
|
|
148
|
+
path: "/admin/system/notifications",
|
|
149
|
+
icon: "bell",
|
|
150
|
+
permissionKey: "system.notification.manage",
|
|
151
|
+
featureKey: "system.notification",
|
|
152
|
+
},
|
|
153
|
+
// @windy-module system.notification end
|
|
154
|
+
// @windy-module system.configuration begin
|
|
155
|
+
{
|
|
156
|
+
key: "system.config",
|
|
157
|
+
title: "配置版本",
|
|
158
|
+
type: "menu",
|
|
159
|
+
order: 60,
|
|
160
|
+
visible: true,
|
|
161
|
+
path: "/admin/system/configurations",
|
|
162
|
+
icon: "settings",
|
|
163
|
+
permissionKey: "system.config.read",
|
|
164
|
+
featureKey: "system.config",
|
|
165
|
+
},
|
|
166
|
+
// @windy-module system.configuration end
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
key: "system.compliance",
|
|
171
|
+
title: "安全与合规",
|
|
172
|
+
type: "catalog",
|
|
173
|
+
order: 30,
|
|
174
|
+
visible: true,
|
|
175
|
+
icon: "shield-check",
|
|
176
|
+
children: [
|
|
177
|
+
// @windy-module system.license begin
|
|
178
|
+
{
|
|
179
|
+
key: "system.license",
|
|
180
|
+
title: "License",
|
|
181
|
+
type: "menu",
|
|
182
|
+
order: 10,
|
|
183
|
+
visible: true,
|
|
184
|
+
path: "/admin/system/license",
|
|
185
|
+
icon: "key-round",
|
|
186
|
+
permissionKey: "system.license.read",
|
|
187
|
+
featureKey: "system.license",
|
|
188
|
+
},
|
|
189
|
+
// @windy-module system.license end
|
|
190
|
+
// @windy-module system.audit begin
|
|
191
|
+
{
|
|
192
|
+
key: "system.audit",
|
|
193
|
+
title: "审计日志",
|
|
194
|
+
type: "menu",
|
|
195
|
+
order: 20,
|
|
196
|
+
visible: true,
|
|
197
|
+
path: "/admin/system/audit",
|
|
198
|
+
icon: "clipboard-list",
|
|
199
|
+
permissionKey: "system.audit.read",
|
|
200
|
+
featureKey: "system.audit",
|
|
201
|
+
},
|
|
202
|
+
// @windy-module system.audit end
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
key: "system.operations",
|
|
207
|
+
title: "运维",
|
|
208
|
+
type: "catalog",
|
|
209
|
+
order: 40,
|
|
210
|
+
visible: true,
|
|
211
|
+
icon: "activity",
|
|
212
|
+
children: [
|
|
213
|
+
// @windy-module system.operations begin
|
|
214
|
+
{
|
|
215
|
+
key: "system.ops",
|
|
216
|
+
title: "运维总览",
|
|
217
|
+
type: "menu",
|
|
218
|
+
order: 10,
|
|
219
|
+
visible: true,
|
|
220
|
+
path: "/admin/system/operations",
|
|
221
|
+
icon: "activity",
|
|
222
|
+
permissionKey: "system.ops.read",
|
|
223
|
+
featureKey: "system.ops",
|
|
224
|
+
},
|
|
225
|
+
// @windy-module system.operations end
|
|
226
|
+
// @windy-module system.workflow begin
|
|
227
|
+
{
|
|
228
|
+
key: "system.workflow",
|
|
229
|
+
title: "审批任务",
|
|
230
|
+
type: "button",
|
|
231
|
+
order: 20,
|
|
232
|
+
visible: false,
|
|
233
|
+
permissionKey: "system.workflow.read",
|
|
234
|
+
featureKey: "system.workflow",
|
|
235
|
+
},
|
|
236
|
+
// @windy-module system.workflow end
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
adminRoutes: systemAdminRoutes,
|
|
241
|
+
permissions: systemPermissions,
|
|
242
|
+
apiPermissions: systemApiPermissionBindings(),
|
|
243
|
+
features: systemFeatures,
|
|
244
|
+
migrations: [],
|
|
245
|
+
schemaExports: [
|
|
246
|
+
{
|
|
247
|
+
key: "system.database.schema",
|
|
248
|
+
exportName: "systemSchema",
|
|
249
|
+
migrationIds: ["0000..0028"],
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
tasks: [
|
|
253
|
+
// @windy-module system.scheduler begin
|
|
254
|
+
{
|
|
255
|
+
key: "system.scheduler.health-snapshot",
|
|
256
|
+
label: "调度器健康快照",
|
|
257
|
+
description: "周期验证调度、Guard、执行历史和重试链路可用。",
|
|
258
|
+
permissionKey: "system.scheduler.manage",
|
|
259
|
+
featureKey: "system.scheduler",
|
|
260
|
+
intervalSeconds: 300,
|
|
261
|
+
maxAttempts: 3,
|
|
262
|
+
retryDelaySeconds: 30,
|
|
263
|
+
},
|
|
264
|
+
// @windy-module system.scheduler end
|
|
265
|
+
// @windy-module system.bulk-data begin
|
|
266
|
+
{
|
|
267
|
+
key: "system.bulk-data.dispatch",
|
|
268
|
+
label: "批量数据任务派发",
|
|
269
|
+
description: "领取一个已排队或到期重试的批量导入导出任务。",
|
|
270
|
+
permissionKey: "system.bulk-data.manage",
|
|
271
|
+
featureKey: "system.bulk-data",
|
|
272
|
+
intervalSeconds: 5,
|
|
273
|
+
maxAttempts: 3,
|
|
274
|
+
retryDelaySeconds: 30,
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
key: "system.bulk-data.cleanup",
|
|
278
|
+
label: "批量数据文件清理",
|
|
279
|
+
description: "清理超过留存期限的源文件、结果和失败明细。",
|
|
280
|
+
permissionKey: "system.bulk-data.manage",
|
|
281
|
+
featureKey: "system.bulk-data",
|
|
282
|
+
intervalSeconds: 3_600,
|
|
283
|
+
maxAttempts: 3,
|
|
284
|
+
retryDelaySeconds: 60,
|
|
285
|
+
},
|
|
286
|
+
// @windy-module system.bulk-data end
|
|
287
|
+
// @windy-module system.storage begin
|
|
288
|
+
{
|
|
289
|
+
key: "system.storage.cleanup",
|
|
290
|
+
label: "文件存储清理",
|
|
291
|
+
description: "清理过期上传、文件、临时分片和超过宽限期的孤儿对象。",
|
|
292
|
+
permissionKey: "system.storage.manage",
|
|
293
|
+
featureKey: "system.storage",
|
|
294
|
+
intervalSeconds: 3_600,
|
|
295
|
+
maxAttempts: 3,
|
|
296
|
+
retryDelaySeconds: 60,
|
|
297
|
+
},
|
|
298
|
+
// @windy-module system.storage end
|
|
299
|
+
// @windy-module system.workflow begin
|
|
300
|
+
{
|
|
301
|
+
key: "system.workflow.timeout-dispatch",
|
|
302
|
+
label: "审批超时派发",
|
|
303
|
+
description: "补偿登记并执行一个到期审批任务,进程重启后继续处理。",
|
|
304
|
+
permissionKey: "system.workflow.manage",
|
|
305
|
+
featureKey: "system.workflow",
|
|
306
|
+
intervalSeconds: 5,
|
|
307
|
+
maxAttempts: 3,
|
|
308
|
+
retryDelaySeconds: 30,
|
|
309
|
+
},
|
|
310
|
+
// @windy-module system.workflow end
|
|
311
|
+
// @windy-module system.data-governance begin
|
|
312
|
+
{
|
|
313
|
+
key: "system.governed-export.dispatch",
|
|
314
|
+
label: "受治理导出派发",
|
|
315
|
+
description: "领取并执行一个已批准的敏感数据导出任务。",
|
|
316
|
+
permissionKey: "system.user.export",
|
|
317
|
+
featureKey: "system.rbac",
|
|
318
|
+
intervalSeconds: 5,
|
|
319
|
+
maxAttempts: 3,
|
|
320
|
+
retryDelaySeconds: 30,
|
|
321
|
+
},
|
|
322
|
+
// @windy-module system.data-governance end
|
|
323
|
+
],
|
|
324
|
+
tools: [
|
|
325
|
+
// @windy-module system.agent begin
|
|
326
|
+
...systemAgentTools,
|
|
327
|
+
// @windy-module system.agent end
|
|
328
|
+
],
|
|
329
|
+
providers: [],
|
|
330
|
+
// @windy-module system.data-governance begin
|
|
331
|
+
dataPolicies: systemDataPolicies,
|
|
332
|
+
// @windy-module system.data-governance end
|
|
333
|
+
auditActions: systemAuditActions,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { ModuleManifest } from "./manifest.js";
|
|
2
|
+
|
|
3
|
+
const systemResourceLabels = {
|
|
4
|
+
admin: "管理面准入",
|
|
5
|
+
user: "用户管理",
|
|
6
|
+
role: "角色与权限",
|
|
7
|
+
department: "部门组织",
|
|
8
|
+
menu: "菜单管理",
|
|
9
|
+
dict: "字典管理",
|
|
10
|
+
feature: "功能开关",
|
|
11
|
+
search: "全局搜索",
|
|
12
|
+
settings: "全局设置",
|
|
13
|
+
config: "配置版本",
|
|
14
|
+
watermark: "水印设置",
|
|
15
|
+
profile: "个人设置",
|
|
16
|
+
license: "许可证管理",
|
|
17
|
+
audit: "审计日志",
|
|
18
|
+
agent: "智能代理",
|
|
19
|
+
ops: "运维总览",
|
|
20
|
+
scheduler: "定时任务",
|
|
21
|
+
notification: "通知管理",
|
|
22
|
+
"bulk-data": "批量数据",
|
|
23
|
+
storage: "文件存储",
|
|
24
|
+
workflow: "审批任务",
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
type SystemResource = keyof typeof systemResourceLabels;
|
|
28
|
+
type SystemAction =
|
|
29
|
+
| "access"
|
|
30
|
+
| "read"
|
|
31
|
+
| "create"
|
|
32
|
+
| "approve"
|
|
33
|
+
| "export"
|
|
34
|
+
| "reveal"
|
|
35
|
+
| "manage";
|
|
36
|
+
|
|
37
|
+
function permission(
|
|
38
|
+
resource: SystemResource,
|
|
39
|
+
action: SystemAction,
|
|
40
|
+
accessRisk:
|
|
41
|
+
| "sensitive-disclosure"
|
|
42
|
+
| "governed-export"
|
|
43
|
+
| undefined = undefined,
|
|
44
|
+
) {
|
|
45
|
+
return {
|
|
46
|
+
key: `system.${resource}.${action}`,
|
|
47
|
+
label:
|
|
48
|
+
action === "access"
|
|
49
|
+
? "进入"
|
|
50
|
+
: action === "read"
|
|
51
|
+
? "查看"
|
|
52
|
+
: action === "create"
|
|
53
|
+
? "新建"
|
|
54
|
+
: action === "approve"
|
|
55
|
+
? "处理"
|
|
56
|
+
: action === "reveal"
|
|
57
|
+
? "查看明文"
|
|
58
|
+
: action === "export"
|
|
59
|
+
? "治理导出"
|
|
60
|
+
: "管理",
|
|
61
|
+
module: "system",
|
|
62
|
+
moduleLabel: "系统基础设施",
|
|
63
|
+
resource,
|
|
64
|
+
resourceLabel: systemResourceLabels[resource],
|
|
65
|
+
action,
|
|
66
|
+
accessRisk,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const systemPermissions: ModuleManifest["permissions"] = [
|
|
71
|
+
permission("admin", "access"),
|
|
72
|
+
permission("user", "read"),
|
|
73
|
+
// @windy-module system.data-governance begin
|
|
74
|
+
permission("user", "reveal", "sensitive-disclosure"),
|
|
75
|
+
permission("user", "export", "governed-export"),
|
|
76
|
+
// @windy-module system.data-governance end
|
|
77
|
+
permission("user", "manage"),
|
|
78
|
+
permission("role", "read"),
|
|
79
|
+
permission("role", "manage"),
|
|
80
|
+
permission("department", "read"),
|
|
81
|
+
permission("department", "create"),
|
|
82
|
+
permission("department", "manage"),
|
|
83
|
+
permission("menu", "read"),
|
|
84
|
+
permission("menu", "manage"),
|
|
85
|
+
permission("dict", "read"),
|
|
86
|
+
permission("dict", "manage"),
|
|
87
|
+
permission("feature", "read"),
|
|
88
|
+
permission("feature", "manage"),
|
|
89
|
+
// @windy-module system.search begin
|
|
90
|
+
permission("search", "read"),
|
|
91
|
+
permission("search", "manage"),
|
|
92
|
+
// @windy-module system.search end
|
|
93
|
+
// @windy-module system.settings begin
|
|
94
|
+
permission("settings", "read"),
|
|
95
|
+
permission("settings", "manage"),
|
|
96
|
+
// @windy-module system.settings end
|
|
97
|
+
// @windy-module system.configuration begin
|
|
98
|
+
permission("config", "read"),
|
|
99
|
+
permission("config", "manage"),
|
|
100
|
+
// @windy-module system.configuration end
|
|
101
|
+
// @windy-module system.settings begin
|
|
102
|
+
permission("watermark", "read"),
|
|
103
|
+
permission("watermark", "manage"),
|
|
104
|
+
// @windy-module system.settings end
|
|
105
|
+
permission("profile", "read"),
|
|
106
|
+
permission("profile", "manage"),
|
|
107
|
+
// @windy-module system.license begin
|
|
108
|
+
permission("license", "read"),
|
|
109
|
+
permission("license", "manage"),
|
|
110
|
+
// @windy-module system.license end
|
|
111
|
+
// @windy-module system.audit begin
|
|
112
|
+
permission("audit", "read"),
|
|
113
|
+
// @windy-module system.audit end
|
|
114
|
+
// @windy-module system.agent begin
|
|
115
|
+
permission("agent", "read"),
|
|
116
|
+
// @windy-module system.agent end
|
|
117
|
+
// @windy-module system.operations begin
|
|
118
|
+
permission("ops", "read"),
|
|
119
|
+
// @windy-module system.operations end
|
|
120
|
+
// @windy-module system.scheduler begin
|
|
121
|
+
permission("scheduler", "read"),
|
|
122
|
+
permission("scheduler", "manage"),
|
|
123
|
+
// @windy-module system.scheduler end
|
|
124
|
+
// @windy-module system.notification begin
|
|
125
|
+
permission("notification", "read"),
|
|
126
|
+
permission("notification", "manage"),
|
|
127
|
+
// @windy-module system.notification end
|
|
128
|
+
// @windy-module system.bulk-data begin
|
|
129
|
+
permission("bulk-data", "manage"),
|
|
130
|
+
// @windy-module system.bulk-data end
|
|
131
|
+
// @windy-module system.storage begin
|
|
132
|
+
permission("storage", "read"),
|
|
133
|
+
permission("storage", "create"),
|
|
134
|
+
permission("storage", "manage"),
|
|
135
|
+
// @windy-module system.storage end
|
|
136
|
+
// @windy-module system.workflow begin
|
|
137
|
+
permission("workflow", "read"),
|
|
138
|
+
permission("workflow", "create"),
|
|
139
|
+
permission("workflow", "approve"),
|
|
140
|
+
permission("workflow", "manage"),
|
|
141
|
+
// @windy-module system.workflow end
|
|
142
|
+
];
|