create-windy 0.2.34 → 0.3.1

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.
Files changed (261) hide show
  1. package/README.md +26 -3
  2. package/dist/cli.js +8121 -3746
  3. package/package.json +3 -3
  4. package/template/.windy-template.json +2 -2
  5. package/template/AGENTS.md +5 -0
  6. package/template/README.md +28 -4
  7. package/template/_gitignore +4 -0
  8. package/template/apps/agent-server/Dockerfile +1 -0
  9. package/template/apps/agent-server/README.md +18 -5
  10. package/template/apps/agent-server/adk_web_agents/__init__.py +1 -0
  11. package/template/apps/agent-server/adk_web_agents/safe_debug/__init__.py +3 -0
  12. package/template/apps/agent-server/adk_web_agents/safe_debug/agent.py +40 -0
  13. package/template/apps/agent-server/pyproject.toml +1 -1
  14. package/template/apps/agent-server/src/southwind_agent_server/adk_adapter.py +191 -16
  15. package/template/apps/agent-server/src/southwind_agent_server/adk_failure.py +13 -0
  16. package/template/apps/agent-server/src/southwind_agent_server/adk_model.py +225 -0
  17. package/template/apps/agent-server/src/southwind_agent_server/adk_tools.py +76 -0
  18. package/template/apps/agent-server/src/southwind_agent_server/app.py +1 -2
  19. package/template/apps/agent-server/tests/__init__.py +1 -0
  20. package/template/apps/agent-server/tests/openai_provider_test_support.py +131 -0
  21. package/template/apps/agent-server/tests/test_adk_adapter.py +305 -0
  22. package/template/apps/agent-server/tests/test_adk_web_agent.py +12 -0
  23. package/template/apps/agent-server/tests/test_openai_provider.py +7 -123
  24. package/template/apps/server/package.json +4 -1
  25. package/template/apps/server/src/agent/run-facade.ts +2 -7
  26. package/template/apps/server/src/agent/tool-registry.ts +2 -6
  27. package/template/apps/server/src/application-services.ts +50 -0
  28. package/template/apps/server/src/audit/drizzle-log-store.ts +25 -0
  29. package/template/apps/server/src/audit/search-summary.ts +2 -6
  30. package/template/apps/server/src/auth/credential-restriction.ts +1 -0
  31. package/template/apps/server/src/auth/password.ts +30 -21
  32. package/template/apps/server/src/auth/routes.test-support.ts +94 -0
  33. package/template/apps/server/src/auth/routes.test.ts +51 -78
  34. package/template/apps/server/src/auth/routes.ts +6 -1
  35. package/template/apps/server/src/auth/runtime.ts +4 -1
  36. package/template/apps/server/src/auth/service.ts +25 -7
  37. package/template/apps/server/src/configuration/bootstrap.ts +20 -1
  38. package/template/apps/server/src/configuration/definition.test.ts +71 -0
  39. package/template/apps/server/src/configuration/definition.ts +242 -12
  40. package/template/apps/server/src/configuration/drizzle-repository.ts +36 -2
  41. package/template/apps/server/src/configuration/repository.ts +27 -2
  42. package/template/apps/server/src/configuration/routes.ts +4 -1
  43. package/template/apps/server/src/configuration/service.test.ts +100 -0
  44. package/template/apps/server/src/configuration/service.ts +50 -10
  45. package/template/apps/server/src/data-access/scoped-repository.integration.test.ts +3 -2
  46. package/template/apps/server/src/data-governance/export/service.ts +2 -6
  47. package/template/apps/server/src/example-modules.ts +4 -1
  48. package/template/apps/server/src/guards.ts +18 -5
  49. package/template/apps/server/src/http/request-source.test.ts +85 -0
  50. package/template/apps/server/src/http/request-source.ts +90 -0
  51. package/template/apps/server/src/index.ts +40 -40
  52. package/template/apps/server/src/license/routes.ts +2 -0
  53. package/template/apps/server/src/license/runtime-service.ts +10 -11
  54. package/template/apps/server/src/mcp/adapter.test.ts +3 -2
  55. package/template/apps/server/src/mcp/adapter.ts +9 -9
  56. package/template/apps/server/src/mcp/routes.ts +4 -3
  57. package/template/apps/server/src/module-bootstrap.ts +2 -2
  58. package/template/apps/server/src/module-host/request-context.ts +6 -6
  59. package/template/apps/server/src/module-host/storage-scope.ts +2 -9
  60. package/template/apps/server/src/module-host/user-directory-port.ts +2 -6
  61. package/template/apps/server/src/notification/channel-adapter.ts +46 -0
  62. package/template/apps/server/src/notification/delivery-policy.test.ts +59 -0
  63. package/template/apps/server/src/notification/delivery-policy.ts +37 -0
  64. package/template/apps/server/src/notification/delivery-repository.ts +198 -0
  65. package/template/apps/server/src/notification/delivery-worker.test.ts +87 -0
  66. package/template/apps/server/src/notification/delivery-worker.ts +88 -0
  67. package/template/apps/server/src/notification/drizzle-management.ts +180 -0
  68. package/template/apps/server/src/notification/drizzle-query.ts +160 -0
  69. package/template/apps/server/src/notification/drizzle-repository.integration.test.ts +301 -0
  70. package/template/apps/server/src/notification/drizzle-repository.ts +156 -90
  71. package/template/apps/server/src/notification/extension-routes.test.ts +119 -0
  72. package/template/apps/server/src/notification/extension-routes.ts +111 -0
  73. package/template/apps/server/src/notification/memory-delivery-repository.ts +137 -0
  74. package/template/apps/server/src/notification/memory-support.ts +72 -0
  75. package/template/apps/server/src/notification/preference-repository.ts +95 -0
  76. package/template/apps/server/src/notification/recipient-directory.ts +104 -0
  77. package/template/apps/server/src/notification/repository.test.ts +171 -0
  78. package/template/apps/server/src/notification/repository.ts +179 -32
  79. package/template/apps/server/src/notification/revision-routes.test.ts +186 -0
  80. package/template/apps/server/src/notification/route-support.ts +225 -0
  81. package/template/apps/server/src/notification/routes.test.ts +182 -0
  82. package/template/apps/server/src/notification/routes.ts +225 -132
  83. package/template/apps/server/src/notification/service.test.ts +104 -0
  84. package/template/apps/server/src/notification/service.ts +140 -0
  85. package/template/apps/server/src/notification/smtp-adapter.test.ts +65 -0
  86. package/template/apps/server/src/notification/smtp-adapter.ts +68 -0
  87. package/template/apps/server/src/persistence.integration.test.ts +41 -2
  88. package/template/apps/server/src/platform-http-runtime.ts +87 -0
  89. package/template/apps/server/src/route-guards.ts +1 -0
  90. package/template/apps/server/src/runtime-audit-list.test.ts +39 -0
  91. package/template/apps/server/src/runtime-development.ts +1 -0
  92. package/template/apps/server/src/runtime.test.ts +23 -9
  93. package/template/apps/server/src/runtime.ts +39 -2
  94. package/template/apps/server/src/scheduler/audit.ts +2 -11
  95. package/template/apps/server/src/scheduler/definitions.test.ts +6 -0
  96. package/template/apps/server/src/scheduler/definitions.ts +7 -0
  97. package/template/apps/server/src/scheduler/recovery-service.ts +2 -11
  98. package/template/apps/server/src/scheduler/routes.ts +2 -7
  99. package/template/apps/server/src/search/opensearch-client.test.ts +45 -0
  100. package/template/apps/server/src/search/opensearch-client.ts +145 -0
  101. package/template/apps/server/src/search/service.ts +2 -6
  102. package/template/apps/server/src/settings/routes.ts +15 -3
  103. package/template/apps/server/src/settings/runtime.ts +10 -1
  104. package/template/apps/server/src/storage/runtime.ts +13 -0
  105. package/template/apps/server/src/system/audit-query.ts +33 -4
  106. package/template/apps/server/src/system/audit-routes.test.ts +58 -4
  107. package/template/apps/server/src/system/audit-routes.ts +6 -5
  108. package/template/apps/server/src/system/department-organization.ts +320 -0
  109. package/template/apps/server/src/system/department-routes.test.ts +207 -48
  110. package/template/apps/server/src/system/department-routes.ts +114 -33
  111. package/template/apps/server/src/system/drizzle-repository.ts +15 -7
  112. package/template/apps/server/src/system/drizzle-scoped-repository.ts +5 -3
  113. package/template/apps/server/src/system/drizzle-system-configs.ts +319 -0
  114. package/template/apps/server/src/system/drizzle-system.ts +59 -311
  115. package/template/apps/server/src/system/drizzle-transaction-context.ts +14 -0
  116. package/template/apps/server/src/system/identity-route-config.ts +7 -2
  117. package/template/apps/server/src/system/mutation-runner.ts +23 -0
  118. package/template/apps/server/src/system/organization-postgres.integration.test.ts +176 -0
  119. package/template/apps/server/src/system/resource-access-response.ts +12 -6
  120. package/template/apps/server/src/system/resource-routes.ts +270 -0
  121. package/template/apps/server/src/system/role-department-scope-policy.ts +55 -0
  122. package/template/apps/server/src/system/route-helpers.ts +2 -5
  123. package/template/apps/server/src/system/route-types.ts +12 -3
  124. package/template/apps/server/src/system/routes-validation.test.ts +26 -0
  125. package/template/apps/server/src/system/routes.test.ts +10 -2
  126. package/template/apps/server/src/system/routes.ts +35 -267
  127. package/template/apps/server/src/system/seed.ts +7 -0
  128. package/template/apps/server/src/work-order/data-scope.integration.test.ts +9 -2
  129. package/template/apps/server/src/work-order/opensearch-index.test.ts +97 -0
  130. package/template/apps/server/src/work-order/opensearch-index.ts +313 -0
  131. package/template/apps/server/src/work-order/search-provider.ts +60 -1
  132. package/template/apps/server/src/work-order/service.ts +42 -10
  133. package/template/apps/web/src/app/error-pages.ts +9 -0
  134. package/template/apps/web/src/components/auth/PasswordChangeForm.vue +16 -11
  135. package/template/apps/web/src/components/auth/PasswordChangeForm.webtest.ts +14 -0
  136. package/template/apps/web/src/components/common/FormDialog.vue +16 -2
  137. package/template/apps/web/src/components/common/ModalLayout.webtest.ts +20 -1
  138. package/template/apps/web/src/composables/useGlobalSearch.ts +68 -0
  139. package/template/apps/web/src/composables/usePlatformSettings.ts +8 -7
  140. package/template/apps/web/src/layout/GlobalSearchResults.vue +58 -0
  141. package/template/apps/web/src/layout/NavigationSearchDialog.vue +42 -6
  142. package/template/apps/web/src/layout/NavigationSearchDialog.webtest.ts +71 -0
  143. package/template/apps/web/src/layout/NotificationMenu.vue +73 -31
  144. package/template/apps/web/src/layout/NotificationMenu.webtest.ts +44 -1
  145. package/template/apps/web/src/layout/NotificationMenuItem.vue +61 -0
  146. package/template/apps/web/src/layout/NotificationPreferencesDialog.vue +181 -0
  147. package/template/apps/web/src/layout/NotificationPreferencesDialog.webtest.ts +80 -0
  148. package/template/apps/web/src/lib/date-time.ts +22 -10
  149. package/template/apps/web/src/lib/date-time.webtest.ts +9 -1
  150. package/template/apps/web/src/main.ts +14 -1
  151. package/template/apps/web/src/pages/auth/ChangePasswordPage.vue +16 -1
  152. package/template/apps/web/src/pages/configuration/components/ModuleConfigVersionList.vue +1 -0
  153. package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.vue +10 -0
  154. package/template/apps/web/src/pages/configuration/components/ModuleConfigurationWorkbench.vue +37 -6
  155. package/template/apps/web/src/pages/errors/PlatformErrorPage.vue +115 -0
  156. package/template/apps/web/src/pages/errors/PlatformErrorPage.webtest.ts +44 -0
  157. package/template/apps/web/src/pages/errors/error-page-extension.ts +26 -0
  158. package/template/apps/web/src/pages/system/SystemNotificationsPage.vue +136 -68
  159. package/template/apps/web/src/pages/system/SystemNotificationsPage.webtest.ts +224 -12
  160. package/template/apps/web/src/pages/system/audit-log-presenter.ts +86 -0
  161. package/template/apps/web/src/pages/system/audit-time-range.ts +28 -0
  162. package/template/apps/web/src/pages/system/components/AuditActionCell.vue +10 -69
  163. package/template/apps/web/src/pages/system/components/AuditActionCell.webtest.ts +20 -27
  164. package/template/apps/web/src/pages/system/components/AuditLogDetailDialog.vue +134 -0
  165. package/template/apps/web/src/pages/system/components/AuditLogDetailDialog.webtest.ts +76 -0
  166. package/template/apps/web/src/pages/system/components/AuditLogFilters.vue +116 -52
  167. package/template/apps/web/src/pages/system/components/AuditLogFilters.webtest.ts +52 -15
  168. package/template/apps/web/src/pages/system/components/NotificationHistoryDialog.vue +129 -0
  169. package/template/apps/web/src/pages/system/components/NotificationManagementCard.vue +91 -0
  170. package/template/apps/web/src/pages/system/components/NotificationPublishDialog.vue +121 -0
  171. package/template/apps/web/src/pages/system/components/NotificationPublishForm.vue +162 -1
  172. package/template/apps/web/src/pages/system/components/SystemResourceActions.vue +68 -0
  173. package/template/apps/web/src/pages/system/components/SystemResourceEditor.vue +74 -0
  174. package/template/apps/web/src/pages/system/components/SystemResourceFilters.vue +3 -4
  175. package/template/apps/web/src/pages/system/components/SystemResourceLoadError.vue +21 -0
  176. package/template/apps/web/src/pages/system/components/SystemResourceLoadError.webtest.ts +17 -0
  177. package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +96 -108
  178. package/template/apps/web/src/pages/system/components/SystemResourcePage.webtest.ts +68 -0
  179. package/template/apps/web/src/pages/system/components/SystemResourceTable.vue +20 -1
  180. package/template/apps/web/src/pages/system/components/SystemResourceTable.webtest.ts +28 -7
  181. package/template/apps/web/src/pages/system/components/department/DepartmentOrganizationForm.vue +210 -0
  182. package/template/apps/web/src/pages/system/components/department/DepartmentTransitionDialog.vue +112 -0
  183. package/template/apps/web/src/pages/system/components/user-account/UserAccountForm.vue +17 -4
  184. package/template/apps/web/src/pages/system/composables/useDepartmentTransitions.ts +79 -0
  185. package/template/apps/web/src/pages/system/composables/useNotificationPermissions.ts +14 -0
  186. package/template/apps/web/src/pages/system/composables/useSystemResource.ts +2 -0
  187. package/template/apps/web/src/pages/system/composables/useSystemResource.webtest.ts +15 -2
  188. package/template/apps/web/src/pages/system/resource-config.ts +12 -4
  189. package/template/apps/web/src/router/error-navigation.ts +50 -0
  190. package/template/apps/web/src/router/error-navigation.webtest.ts +106 -0
  191. package/template/apps/web/src/router/index.ts +71 -0
  192. package/template/apps/web/src/router/index.webtest.ts +29 -0
  193. package/template/apps/web/src/router/manifest-routes.webtest.ts +4 -0
  194. package/template/apps/web/src/router/shared-scaffold-neutrality.webtest.ts +12 -0
  195. package/template/apps/web/src/services/auth-api.ts +5 -0
  196. package/template/apps/web/src/services/http.ts +43 -6
  197. package/template/apps/web/src/services/http.webtest.ts +70 -0
  198. package/template/apps/web/src/services/notification-api.ts +85 -2
  199. package/template/apps/web/src/services/notification-api.webtest.ts +110 -0
  200. package/template/apps/web/src/services/search-api.ts +39 -0
  201. package/template/apps/web/src/services/system-api.ts +18 -0
  202. package/template/apps/web/vitest.config.ts +1 -0
  203. package/template/docker-compose.yml +66 -0
  204. package/template/docs/architecture/ai-runtime.md +14 -5
  205. package/template/docs/architecture/mcp-business-capabilities.md +107 -0
  206. package/template/docs/architecture/search-provider-protocol.md +38 -2
  207. package/template/docs/development/custom-error-pages.md +78 -0
  208. package/template/docs/development/custom-login-page.md +3 -3
  209. package/template/docs/platform/agent-runtime.md +32 -6
  210. package/template/docs/platform/agent-tools.md +4 -0
  211. package/template/docs/platform/audit-reliability.md +46 -2
  212. package/template/docs/platform/module-configuration.md +13 -4
  213. package/template/docs/platform/notifications.md +67 -11
  214. package/template/docs/platform/organization-membership.md +17 -3
  215. package/template/docs/platform/system-crud-api.md +16 -0
  216. package/template/docs/platform/web-system-crud.md +6 -2
  217. package/template/package.json +4 -0
  218. package/template/packages/config/index.test.ts +45 -0
  219. package/template/packages/config/package.json +1 -1
  220. package/template/packages/config/src/platform.ts +169 -48
  221. package/template/packages/database/drizzle/0035_material_nightshade.sql +10 -0
  222. package/template/packages/database/drizzle/0036_hesitant_speed.sql +35 -0
  223. package/template/packages/database/drizzle/0037_absent_nick_fury.sql +2 -0
  224. package/template/packages/database/drizzle/0038_uneven_wasp.sql +38 -0
  225. package/template/packages/database/drizzle/meta/0035_snapshot.json +7331 -0
  226. package/template/packages/database/drizzle/meta/0036_snapshot.json +7436 -0
  227. package/template/packages/database/drizzle/meta/0037_snapshot.json +7457 -0
  228. package/template/packages/database/drizzle/meta/0038_snapshot.json +7749 -0
  229. package/template/packages/database/drizzle/meta/_journal.json +28 -0
  230. package/template/packages/database/package.json +1 -1
  231. package/template/packages/database/src/schema/identity.ts +7 -0
  232. package/template/packages/database/src/schema/notifications.ts +135 -0
  233. package/template/packages/database/src/schema-notification-delivery.test.ts +54 -0
  234. package/template/packages/database/src/schema-workflow-notification.test.ts +40 -1
  235. package/template/packages/modules/package.json +1 -1
  236. package/template/packages/modules/src/composition-fixtures.test-support.ts +164 -0
  237. package/template/packages/modules/src/composition.test.ts +5 -158
  238. package/template/packages/modules/src/system-api-operational.ts +234 -0
  239. package/template/packages/modules/src/system-api-permissions.ts +14 -181
  240. package/template/packages/modules/src/system-audit-actions.ts +10 -0
  241. package/template/packages/modules/src/system-features.ts +1 -1
  242. package/template/packages/modules/src/system-module-catalog.ts +2 -1
  243. package/template/packages/modules/src/system-module-tasks.ts +86 -0
  244. package/template/packages/modules/src/system-modules-access.test.ts +60 -0
  245. package/template/packages/modules/src/system-modules.test.ts +13 -54
  246. package/template/packages/modules/src/system-modules.ts +2 -72
  247. package/template/packages/modules/src/system-permissions.ts +9 -5
  248. package/template/packages/server-sdk/package.json +1 -1
  249. package/template/packages/shared/index.ts +1 -0
  250. package/template/packages/shared/package.json +1 -1
  251. package/template/packages/shared/src/audit.ts +25 -0
  252. package/template/packages/shared/src/mcp.test.ts +12 -0
  253. package/template/packages/shared/src/mcp.ts +7 -0
  254. package/template/packages/shared/src/module-configuration.ts +5 -0
  255. package/template/packages/shared/src/notification.ts +92 -1
  256. package/template/packages/shared/src/password.ts +7 -2
  257. package/template/packages/shared/src/platform-settings.ts +2 -0
  258. package/template/packages/storage/package.json +1 -1
  259. package/template/packages/storage/src/upload-service.test.ts +16 -0
  260. package/template/packages/storage/src/upload-service.ts +5 -1
  261. package/template/scripts/notification-postgres-regression.ts +27 -0
@@ -0,0 +1,234 @@
1
+ import type { ApiPermissionBinding } from "@southwind-ai/shared";
2
+ // oxlint-disable-next-line no-unused-vars -- 可选模块全部裁剪后该导入仍需保留类型稳定的生成源码。
3
+ import { binding } from "./system-api-binding.js";
4
+
5
+ export function systemOperationalApiPermissionBindings(): ApiPermissionBinding[] {
6
+ return [
7
+ // @windy-module system.storage begin
8
+ binding(
9
+ "POST",
10
+ "/api/system/storage/uploads",
11
+ "system.storage.create",
12
+ "system.storage",
13
+ ),
14
+ binding(
15
+ "GET",
16
+ "/api/system/storage/uploads/:id",
17
+ "system.storage.create",
18
+ "system.storage",
19
+ ),
20
+ binding(
21
+ "PUT",
22
+ "/api/system/storage/uploads/:id/parts/:partNumber",
23
+ "system.storage.create",
24
+ "system.storage",
25
+ ),
26
+ binding(
27
+ "POST",
28
+ "/api/system/storage/uploads/:id/complete",
29
+ "system.storage.create",
30
+ "system.storage",
31
+ ),
32
+ binding(
33
+ "DELETE",
34
+ "/api/system/storage/uploads/:id",
35
+ "system.storage.create",
36
+ "system.storage",
37
+ ),
38
+ binding(
39
+ "GET",
40
+ "/api/system/storage/files/:id",
41
+ "system.storage.read",
42
+ "system.storage",
43
+ ),
44
+ binding(
45
+ "GET",
46
+ "/api/platform/files/:id",
47
+ "system.settings.read",
48
+ "system.settings",
49
+ true,
50
+ ),
51
+ // @windy-module system.storage end
52
+ // @windy-module system.operations begin
53
+ binding("GET", "/api/system/operations", "system.ops.read", "system.ops"),
54
+ // @windy-module system.operations end
55
+ // @windy-module system.notification begin
56
+ binding(
57
+ "GET",
58
+ "/api/notifications",
59
+ "system.notification.read",
60
+ "system.notification",
61
+ ),
62
+ binding(
63
+ "GET",
64
+ "/api/notifications/preferences",
65
+ "system.notification.read",
66
+ "system.notification",
67
+ ),
68
+ binding(
69
+ "PUT",
70
+ "/api/notifications/preferences",
71
+ "system.notification.read",
72
+ "system.notification",
73
+ ),
74
+ binding(
75
+ "POST",
76
+ "/api/notifications/:id/read",
77
+ "system.notification.read",
78
+ "system.notification",
79
+ ),
80
+ binding(
81
+ "PUT",
82
+ "/api/notifications/:id/favorite",
83
+ "system.notification.read",
84
+ "system.notification",
85
+ ),
86
+ binding(
87
+ "DELETE",
88
+ "/api/notifications/:id/favorite",
89
+ "system.notification.read",
90
+ "system.notification",
91
+ ),
92
+ binding(
93
+ "GET",
94
+ "/api/system/notifications/audience-options",
95
+ "system.notification.manage",
96
+ "system.notification",
97
+ ),
98
+ binding(
99
+ "GET",
100
+ "/api/system/notifications/:id/deliveries",
101
+ "system.notification.manage",
102
+ "system.notification",
103
+ ),
104
+ binding(
105
+ "GET",
106
+ "/api/system/notifications",
107
+ "system.notification.manage",
108
+ "system.notification",
109
+ ),
110
+ binding(
111
+ "POST",
112
+ "/api/system/notifications",
113
+ "system.notification.manage",
114
+ "system.notification",
115
+ ),
116
+ binding(
117
+ "PUT",
118
+ "/api/system/notifications/:id",
119
+ "system.notification.update",
120
+ "system.notification",
121
+ ),
122
+ binding(
123
+ "GET",
124
+ "/api/system/notifications/:id/revisions",
125
+ "system.notification.manage",
126
+ "system.notification",
127
+ ),
128
+ binding(
129
+ "DELETE",
130
+ "/api/system/notifications/:id",
131
+ "system.notification.manage",
132
+ "system.notification",
133
+ ),
134
+ // @windy-module system.notification end
135
+ // @windy-module system.workflow begin
136
+ binding(
137
+ "GET",
138
+ "/api/workflow/work-items",
139
+ "system.workflow.read",
140
+ "system.workflow",
141
+ ),
142
+ binding(
143
+ "GET",
144
+ "/api/workflow/work-items/:id",
145
+ "system.workflow.read",
146
+ "system.workflow",
147
+ ),
148
+ binding(
149
+ "GET",
150
+ "/api/workflow/work-items/:id/history",
151
+ "system.workflow.read",
152
+ "system.workflow",
153
+ ),
154
+ binding(
155
+ "POST",
156
+ "/api/workflow/work-items",
157
+ "system.workflow.create",
158
+ "system.workflow",
159
+ ),
160
+ ...["claim", "transfer", "approve", "reject", "cancel"].map((command) =>
161
+ binding(
162
+ "POST",
163
+ `/api/workflow/work-items/:id/${command}`,
164
+ "system.workflow.approve",
165
+ "system.workflow",
166
+ ),
167
+ ),
168
+ // @windy-module system.workflow end
169
+ // @windy-module system.scheduler begin
170
+ binding(
171
+ "GET",
172
+ "/api/system/scheduled-tasks",
173
+ "system.scheduler.read",
174
+ "system.scheduler",
175
+ ),
176
+ binding(
177
+ "GET",
178
+ "/api/system/scheduled-task-runs",
179
+ "system.scheduler.read",
180
+ "system.scheduler",
181
+ ),
182
+ binding(
183
+ "GET",
184
+ "/api/system/operations/scheduler",
185
+ "system.scheduler.read",
186
+ "system.scheduler",
187
+ ),
188
+ binding(
189
+ "POST",
190
+ "/api/system/scheduled-tasks/:id/trigger",
191
+ "system.scheduler.manage",
192
+ "system.scheduler",
193
+ ),
194
+ binding(
195
+ "POST",
196
+ "/api/system/scheduled-tasks/:id/runs/:runId/recover",
197
+ "system.scheduler.manage",
198
+ "system.scheduler",
199
+ ),
200
+ // @windy-module system.scheduler end
201
+ // @windy-module system.bulk-data begin
202
+ binding(
203
+ "GET",
204
+ "/api/system/bulk-data/jobs",
205
+ "system.dict.read",
206
+ "system.bulk-data",
207
+ ),
208
+ binding(
209
+ "GET",
210
+ "/api/system/bulk-data/jobs/:id",
211
+ "system.dict.read",
212
+ "system.bulk-data",
213
+ ),
214
+ binding(
215
+ "GET",
216
+ "/api/system/bulk-data/jobs/:id/artifacts/:kind",
217
+ "system.dict.read",
218
+ "system.bulk-data",
219
+ ),
220
+ binding(
221
+ "POST",
222
+ "/api/system/bulk-data/dictionaries/import",
223
+ "system.dict.manage",
224
+ "system.bulk-data",
225
+ ),
226
+ binding(
227
+ "POST",
228
+ "/api/system/bulk-data/dictionaries/export",
229
+ "system.dict.read",
230
+ "system.bulk-data",
231
+ ),
232
+ // @windy-module system.bulk-data end
233
+ ];
234
+ }
@@ -1,4 +1,7 @@
1
1
  import type { ApiPermissionBinding } from "@southwind-ai/shared";
2
+ // @windy-module system.agent begin
3
+ import { MCP_API_PATH } from "@southwind-ai/shared";
4
+ // @windy-module system.agent end
2
5
  import { binding, resourceBindings } from "./system-api-binding.js";
3
6
  // @windy-module system.settings begin
4
7
  import { watermarkApiPermissionBindings } from "./system-api-watermark.js";
@@ -6,6 +9,7 @@ import { watermarkApiPermissionBindings } from "./system-api-watermark.js";
6
9
  // @windy-module system.data-governance begin
7
10
  import { dataGovernanceApiPermissionBindings } from "./system-api-data-governance.js";
8
11
  // @windy-module system.data-governance end
12
+ import { systemOperationalApiPermissionBindings } from "./system-api-operational.js";
9
13
 
10
14
  export function systemApiPermissionBindings(): ApiPermissionBinding[] {
11
15
  return [
@@ -26,9 +30,9 @@ export function systemApiPermissionBindings(): ApiPermissionBinding[] {
26
30
  binding("POST", "/api/search", "system.search.read", "system.search"),
27
31
  // @windy-module system.search end
28
32
  // @windy-module system.agent begin
29
- binding("GET", "/api/mcp", "system.agent.read", "system.agent"),
30
- binding("POST", "/api/mcp", "system.agent.read", "system.agent"),
31
- binding("DELETE", "/api/mcp", "system.agent.read", "system.agent"),
33
+ binding("GET", MCP_API_PATH, "system.agent.read", "system.agent"),
34
+ binding("POST", MCP_API_PATH, "system.agent.read", "system.agent"),
35
+ binding("DELETE", MCP_API_PATH, "system.agent.read", "system.agent"),
32
36
  // @windy-module system.agent end
33
37
  ...resourceBindings({
34
38
  path: "users",
@@ -61,6 +65,12 @@ export function systemApiPermissionBindings(): ApiPermissionBinding[] {
61
65
  "system.department.create",
62
66
  "system.rbac",
63
67
  ),
68
+ binding(
69
+ "POST",
70
+ "/api/system/departments/:id/transition",
71
+ "system.department.manage",
72
+ "system.rbac",
73
+ ),
64
74
  binding("GET", "/api/system/menus", "system.menu.read", "system.rbac"),
65
75
  binding(
66
76
  "GET",
@@ -171,183 +181,6 @@ export function systemApiPermissionBindings(): ApiPermissionBinding[] {
171
181
  "system.audit",
172
182
  ),
173
183
  // @windy-module system.audit end
174
- // @windy-module system.storage begin
175
- binding(
176
- "POST",
177
- "/api/system/storage/uploads",
178
- "system.storage.create",
179
- "system.storage",
180
- ),
181
- binding(
182
- "GET",
183
- "/api/system/storage/uploads/:id",
184
- "system.storage.create",
185
- "system.storage",
186
- ),
187
- binding(
188
- "PUT",
189
- "/api/system/storage/uploads/:id/parts/:partNumber",
190
- "system.storage.create",
191
- "system.storage",
192
- ),
193
- binding(
194
- "POST",
195
- "/api/system/storage/uploads/:id/complete",
196
- "system.storage.create",
197
- "system.storage",
198
- ),
199
- binding(
200
- "DELETE",
201
- "/api/system/storage/uploads/:id",
202
- "system.storage.create",
203
- "system.storage",
204
- ),
205
- binding(
206
- "GET",
207
- "/api/system/storage/files/:id",
208
- "system.storage.read",
209
- "system.storage",
210
- ),
211
- binding(
212
- "GET",
213
- "/api/platform/files/:id",
214
- "system.settings.read",
215
- "system.settings",
216
- true,
217
- ),
218
- // @windy-module system.storage end
219
- // @windy-module system.operations begin
220
- binding("GET", "/api/system/operations", "system.ops.read", "system.ops"),
221
- // @windy-module system.operations end
222
- // @windy-module system.notification begin
223
- binding(
224
- "GET",
225
- "/api/notifications",
226
- "system.notification.read",
227
- "system.notification",
228
- ),
229
- binding(
230
- "POST",
231
- "/api/notifications/:id/read",
232
- "system.notification.read",
233
- "system.notification",
234
- ),
235
- binding(
236
- "GET",
237
- "/api/system/notifications",
238
- "system.notification.manage",
239
- "system.notification",
240
- ),
241
- binding(
242
- "POST",
243
- "/api/system/notifications",
244
- "system.notification.manage",
245
- "system.notification",
246
- ),
247
- binding(
248
- "DELETE",
249
- "/api/system/notifications/:id",
250
- "system.notification.manage",
251
- "system.notification",
252
- ),
253
- // @windy-module system.notification end
254
- // @windy-module system.workflow begin
255
- binding(
256
- "GET",
257
- "/api/workflow/work-items",
258
- "system.workflow.read",
259
- "system.workflow",
260
- ),
261
- binding(
262
- "GET",
263
- "/api/workflow/work-items/:id",
264
- "system.workflow.read",
265
- "system.workflow",
266
- ),
267
- binding(
268
- "GET",
269
- "/api/workflow/work-items/:id/history",
270
- "system.workflow.read",
271
- "system.workflow",
272
- ),
273
- binding(
274
- "POST",
275
- "/api/workflow/work-items",
276
- "system.workflow.create",
277
- "system.workflow",
278
- ),
279
- ...["claim", "transfer", "approve", "reject", "cancel"].map((command) =>
280
- binding(
281
- "POST",
282
- `/api/workflow/work-items/:id/${command}`,
283
- "system.workflow.approve",
284
- "system.workflow",
285
- ),
286
- ),
287
- // @windy-module system.workflow end
288
- // @windy-module system.scheduler begin
289
- binding(
290
- "GET",
291
- "/api/system/scheduled-tasks",
292
- "system.scheduler.read",
293
- "system.scheduler",
294
- ),
295
- binding(
296
- "GET",
297
- "/api/system/scheduled-task-runs",
298
- "system.scheduler.read",
299
- "system.scheduler",
300
- ),
301
- binding(
302
- "GET",
303
- "/api/system/operations/scheduler",
304
- "system.scheduler.read",
305
- "system.scheduler",
306
- ),
307
- binding(
308
- "POST",
309
- "/api/system/scheduled-tasks/:id/trigger",
310
- "system.scheduler.manage",
311
- "system.scheduler",
312
- ),
313
- binding(
314
- "POST",
315
- "/api/system/scheduled-tasks/:id/runs/:runId/recover",
316
- "system.scheduler.manage",
317
- "system.scheduler",
318
- ),
319
- // @windy-module system.scheduler end
320
- // @windy-module system.bulk-data begin
321
- binding(
322
- "GET",
323
- "/api/system/bulk-data/jobs",
324
- "system.dict.read",
325
- "system.bulk-data",
326
- ),
327
- binding(
328
- "GET",
329
- "/api/system/bulk-data/jobs/:id",
330
- "system.dict.read",
331
- "system.bulk-data",
332
- ),
333
- binding(
334
- "GET",
335
- "/api/system/bulk-data/jobs/:id/artifacts/:kind",
336
- "system.dict.read",
337
- "system.bulk-data",
338
- ),
339
- binding(
340
- "POST",
341
- "/api/system/bulk-data/dictionaries/import",
342
- "system.dict.manage",
343
- "system.bulk-data",
344
- ),
345
- binding(
346
- "POST",
347
- "/api/system/bulk-data/dictionaries/export",
348
- "system.dict.read",
349
- "system.bulk-data",
350
- ),
351
- // @windy-module system.bulk-data end
184
+ ...systemOperationalApiPermissionBindings(),
352
185
  ];
353
186
  }
@@ -22,9 +22,19 @@ export const systemAuditActions: ModuleManifest["auditActions"] = [
22
22
  // @windy-module system.license end
23
23
  "feature.update",
24
24
  "menu.structure.update",
25
+ {
26
+ key: "organization.department.transition",
27
+ label: "处置部门组织",
28
+ description: "迁移部门关联后停用或删除部门。",
29
+ },
25
30
  // @windy-module system.notification begin
26
31
  "notification.publish",
32
+ "notification.schedule",
33
+ "notification.preference.update",
34
+ "notification.update",
27
35
  "notification.read",
36
+ "notification.favorite",
37
+ "notification.unfavorite",
28
38
  "notification.archive",
29
39
  // @windy-module system.notification end
30
40
  // @windy-module system.workflow begin
@@ -90,7 +90,7 @@ export const systemFeatures: ModuleManifest["features"] = [
90
90
  feature(
91
91
  "system.notification",
92
92
  "站内通知",
93
- "站内通知发布、管理、阅读和已读状态闭环。",
93
+ "站内通知发布、修改历史、阅读、收藏和已读状态闭环。",
94
94
  ),
95
95
  // @windy-module system.notification end
96
96
  // @windy-module system.workflow begin
@@ -124,7 +124,8 @@ export const systemModuleDefinitions = [
124
124
  name: "system.notification",
125
125
  version: "0.1.0",
126
126
  label: "站内通知",
127
- description: "通知发布、阅读、归档与状态管理。",
127
+ description:
128
+ "通知定向与定时发布、用户偏好、外部渠道投递、修改历史、阅读、收藏和归档。",
128
129
  resources: ["notification"],
129
130
  featureKeys: ["system.notification"],
130
131
  },
@@ -0,0 +1,86 @@
1
+ import type { ModuleManifest } from "./manifest.js";
2
+
3
+ export const systemModuleTasks: ModuleManifest["tasks"] = [
4
+ // @windy-module system.scheduler begin
5
+ {
6
+ key: "system.scheduler.health-snapshot",
7
+ label: "调度器健康快照",
8
+ description: "周期验证调度、Guard、执行历史和重试链路可用。",
9
+ permissionKey: "system.scheduler.manage",
10
+ featureKey: "system.scheduler",
11
+ intervalSeconds: 300,
12
+ maxAttempts: 3,
13
+ retryDelaySeconds: 30,
14
+ },
15
+ // @windy-module system.scheduler end
16
+ // @windy-module system.notification begin
17
+ {
18
+ key: "system.notification.dispatch",
19
+ label: "通知发布与外部投递",
20
+ description: "发布到期通知并领取持久投递队列,执行渠道重试。",
21
+ permissionKey: "system.notification.manage",
22
+ featureKey: "system.notification",
23
+ intervalSeconds: 5,
24
+ maxAttempts: 3,
25
+ retryDelaySeconds: 30,
26
+ },
27
+ // @windy-module system.notification end
28
+ // @windy-module system.bulk-data begin
29
+ {
30
+ key: "system.bulk-data.dispatch",
31
+ label: "批量数据任务派发",
32
+ description: "领取一个已排队或到期重试的批量导入导出任务。",
33
+ permissionKey: "system.bulk-data.manage",
34
+ featureKey: "system.bulk-data",
35
+ intervalSeconds: 5,
36
+ maxAttempts: 3,
37
+ retryDelaySeconds: 30,
38
+ },
39
+ {
40
+ key: "system.bulk-data.cleanup",
41
+ label: "批量数据文件清理",
42
+ description: "清理超过留存期限的源文件、结果和失败明细。",
43
+ permissionKey: "system.bulk-data.manage",
44
+ featureKey: "system.bulk-data",
45
+ intervalSeconds: 3_600,
46
+ maxAttempts: 3,
47
+ retryDelaySeconds: 60,
48
+ },
49
+ // @windy-module system.bulk-data end
50
+ // @windy-module system.storage begin
51
+ {
52
+ key: "system.storage.cleanup",
53
+ label: "文件存储清理",
54
+ description: "清理过期上传、文件、临时分片和超过宽限期的孤儿对象。",
55
+ permissionKey: "system.storage.manage",
56
+ featureKey: "system.storage",
57
+ intervalSeconds: 3_600,
58
+ maxAttempts: 3,
59
+ retryDelaySeconds: 60,
60
+ },
61
+ // @windy-module system.storage end
62
+ // @windy-module system.workflow begin
63
+ {
64
+ key: "system.workflow.timeout-dispatch",
65
+ label: "审批超时派发",
66
+ description: "补偿登记并执行一个到期审批任务,进程重启后继续处理。",
67
+ permissionKey: "system.workflow.manage",
68
+ featureKey: "system.workflow",
69
+ intervalSeconds: 5,
70
+ maxAttempts: 3,
71
+ retryDelaySeconds: 30,
72
+ },
73
+ // @windy-module system.workflow end
74
+ // @windy-module system.data-governance begin
75
+ {
76
+ key: "system.governed-export.dispatch",
77
+ label: "受治理导出派发",
78
+ description: "领取并执行一个已批准的敏感数据导出任务。",
79
+ permissionKey: "system.user.export",
80
+ featureKey: "system.rbac",
81
+ intervalSeconds: 5,
82
+ maxAttempts: 3,
83
+ retryDelaySeconds: 30,
84
+ },
85
+ // @windy-module system.data-governance end
86
+ ];
@@ -0,0 +1,60 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ // @windy-module system.agent begin
3
+ import { MCP_API_PATH } from "@southwind-ai/shared";
4
+ // @windy-module system.agent end
5
+ import { systemFoundationModule } from "./system-modules.js";
6
+
7
+ describe("系统模块管理面与 MCP 注册", () => {
8
+ test("管理面准入使用独立 Feature 与 access 权限", () => {
9
+ const manifest = systemFoundationModule();
10
+
11
+ expect(manifest.features).toContainEqual(
12
+ expect.objectContaining({ key: "system.admin", enabled: true }),
13
+ );
14
+ expect(manifest.permissions).toContainEqual(
15
+ expect.objectContaining({
16
+ key: "system.admin.access",
17
+ action: "access",
18
+ }),
19
+ );
20
+ expect(manifest.apiPermissions).toContainEqual({
21
+ method: "GET",
22
+ path: "/api/admin/bootstrap",
23
+ permissionKey: "system.admin.access",
24
+ featureKey: "system.admin",
25
+ anonymous: undefined,
26
+ });
27
+ });
28
+
29
+ // @windy-module system.agent begin
30
+ test("MCP Streamable HTTP 入口统一绑定 Agent Feature 与读取权限", () => {
31
+ const bindings = systemFoundationModule().apiPermissions.filter(
32
+ ({ path }) => path === MCP_API_PATH,
33
+ );
34
+
35
+ expect(bindings).toEqual([
36
+ {
37
+ method: "GET",
38
+ path: MCP_API_PATH,
39
+ permissionKey: "system.agent.read",
40
+ featureKey: "system.agent",
41
+ anonymous: undefined,
42
+ },
43
+ {
44
+ method: "POST",
45
+ path: MCP_API_PATH,
46
+ permissionKey: "system.agent.read",
47
+ featureKey: "system.agent",
48
+ anonymous: undefined,
49
+ },
50
+ {
51
+ method: "DELETE",
52
+ path: MCP_API_PATH,
53
+ permissionKey: "system.agent.read",
54
+ featureKey: "system.agent",
55
+ anonymous: undefined,
56
+ },
57
+ ]);
58
+ });
59
+ // @windy-module system.agent end
60
+ });