create-windy 0.3.19 → 0.4.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/README.md +28 -13
- package/dist/cli.js +783 -280
- package/package.json +1 -1
- package/template/.agents/skills/windy-business-module/SKILL.md +34 -10
- package/template/.windy-template.json +2 -2
- package/template/AGENTS.md +18 -8
- package/template/README.md +32 -22
- package/template/apps/server/Dockerfile +1 -0
- package/template/apps/server/package.json +1 -0
- package/template/apps/server/scripts/validate-module-composition-once.ts +4 -0
- package/template/apps/server/scripts/validate-module-composition.ts +28 -0
- package/template/apps/server/src/agent/data-scope-routes.test.ts +20 -5
- package/template/apps/server/src/agent/routes.test.ts +20 -7
- package/template/apps/server/src/agent/routes.ts +14 -0
- package/template/apps/server/src/agent/runtime-bootstrap.ts +22 -6
- package/template/apps/server/src/agent/sandbox-worker.ts +2 -2
- package/template/apps/server/src/agent/unavailable-routes.ts +33 -0
- package/template/apps/server/src/app/server-composition.ts +56 -0
- package/template/apps/server/src/application-services.ts +2 -0
- package/template/apps/server/src/bulk-data/service.ts +14 -0
- package/template/apps/server/src/data-governance/export/authorization-port.ts +1 -1
- package/template/apps/server/src/data-governance/export/postgres-api-fixture.ts +18 -2
- package/template/apps/server/src/data-governance/export/postgres-recovery.integration.test.ts +10 -9
- package/template/apps/server/src/data-governance/export/routes-test-fixture.ts +6 -8
- package/template/apps/server/src/data-governance/user-plaintext-routes.test.ts +4 -2
- package/template/apps/server/src/feature/routes.authorization.test.ts +26 -1
- package/template/apps/server/src/feature/routes.ts +33 -15
- package/template/apps/server/src/foundation-activation.test.ts +60 -0
- package/template/apps/server/src/foundation.ts +64 -5
- package/template/apps/server/src/guards.test.ts +23 -0
- package/template/apps/server/src/guards.ts +12 -0
- package/template/apps/server/src/index.ts +28 -34
- package/template/apps/server/src/installed-business-modules.ts +13 -24
- package/template/apps/server/src/jobs/legacy-adapter.integration.test.ts +1 -0
- package/template/apps/server/src/jobs/legacy-adapter.test.ts +106 -0
- package/template/apps/server/src/jobs/legacy-service-runtime.ts +40 -0
- package/template/apps/server/src/license/activation.test.ts +30 -0
- package/template/apps/server/src/license/activation.ts +26 -0
- package/template/apps/server/src/license/restriction.test.ts +16 -0
- package/template/apps/server/src/license/routes-offline-code.test.ts +6 -2
- package/template/apps/server/src/license/routes.ts +20 -4
- package/template/apps/server/src/license/runtime-service.test.ts +10 -2
- package/template/apps/server/src/module-bootstrap.ts +14 -23
- package/template/apps/server/src/module-composition.test.ts +43 -2
- package/template/apps/server/src/module-composition.ts +29 -0
- package/template/apps/server/src/module-host/durable-context-guard.test.ts +172 -0
- package/template/apps/server/src/module-host/durable-context-unavailable.test.ts +50 -1
- package/template/apps/server/src/module-host/durable-context.test.ts +42 -25
- package/template/apps/server/src/module-host/durable-context.ts +42 -2
- package/template/apps/server/src/module-host/durable-handler-registration.ts +96 -5
- package/template/apps/server/src/module-host/implementation-completeness.test.ts +185 -0
- package/template/apps/server/src/module-host/implementation-completeness.ts +132 -0
- package/template/apps/server/src/module-host/initialize-contracts.ts +14 -0
- package/template/apps/server/src/module-host/initialize.test.ts +78 -2
- package/template/apps/server/src/module-host/initialize.ts +15 -4
- package/template/apps/server/src/module-host/project-attachments.test.ts +92 -0
- package/template/apps/server/src/module-host/project-attachments.ts +58 -0
- package/template/apps/server/src/module-host/project-composition-package.test.ts +186 -0
- package/template/apps/server/src/module-host/project-composition.test.ts +260 -0
- package/template/apps/server/src/module-host/project-composition.ts +311 -0
- package/template/apps/server/src/module-host/request-context.ts +3 -0
- package/template/apps/server/src/module-host/route-declaration.ts +15 -6
- package/template/apps/server/src/module-host/route-installer.test.ts +15 -2
- package/template/apps/server/src/module-host/route-installer.ts +12 -2
- package/template/apps/server/src/module-host/route-registration.test.ts +13 -4
- package/template/apps/server/src/module-host/runtime-composition-compatibility.test.ts +63 -0
- package/template/apps/server/src/module-host/runtime-composition-compatibility.ts +46 -0
- package/template/apps/server/src/module-host/runtime-composition.ts +34 -0
- package/template/apps/server/src/module-host/search-provider-registration.test.ts +64 -0
- package/template/apps/server/src/module-host/search-provider-registration.ts +35 -0
- package/template/apps/server/src/module-host/static-route-authorization.test.ts +99 -0
- package/template/apps/server/src/module-host/static-route-authorization.ts +90 -0
- package/template/apps/server/src/module-host/task-definitions.ts +1 -0
- package/template/apps/server/src/module-host/user-directory-composition.test.ts +4 -1
- package/template/apps/server/src/module-host.test.ts +2 -0
- package/template/apps/server/src/module-preflight.test.ts +289 -0
- package/template/apps/server/src/module-preflight.ts +96 -0
- package/template/apps/server/src/module-runtime-validation.ts +1 -0
- package/template/apps/server/src/platform-app-bootstrap.ts +50 -0
- package/template/apps/server/src/platform-http-runtime.ts +32 -7
- package/template/apps/server/src/route-guards.test.ts +22 -0
- package/template/apps/server/src/route-guards.ts +10 -3
- package/template/apps/server/src/runtime-audit-query.ts +50 -0
- package/template/apps/server/src/runtime-feature.test.ts +46 -0
- package/template/apps/server/src/runtime-feature.ts +5 -0
- package/template/apps/server/src/runtime.ts +10 -49
- package/template/apps/server/src/scheduler/audit-action.test.ts +49 -0
- package/template/apps/server/src/scheduler/audit.ts +1 -1
- package/template/apps/server/src/scheduler/execution-recorder.ts +10 -5
- package/template/apps/server/src/scheduler/recovery-service.test.ts +4 -3
- package/template/apps/server/src/scheduler/service-idle.test.ts +4 -3
- package/template/apps/server/src/scheduler/service.test.ts +1 -0
- package/template/apps/server/src/scheduler/service.ts +18 -21
- package/template/apps/server/src/scheduler/types.ts +5 -1
- package/template/apps/server/src/startup-composition-validation.test.ts +35 -0
- package/template/apps/server/src/startup-composition-validation.ts +54 -0
- package/template/apps/server/src/startup-preflight.test.ts +36 -0
- package/template/apps/server/src/startup-preflight.ts +37 -0
- package/template/apps/server/src/system/audit-routes.test.ts +9 -3
- package/template/apps/server/src/system/department-routes.test.ts +5 -3
- package/template/apps/server/src/system/feature-routes.test.ts +4 -3
- package/template/apps/server/src/system/interface-catalog.test.ts +5 -3
- package/template/apps/server/src/system/interface-catalog.ts +3 -0
- package/template/apps/server/src/system/menu-routes.test.ts +5 -3
- package/template/apps/server/src/system/route-test-runtime.ts +24 -0
- package/template/apps/server/src/system/routes-validation.test.ts +7 -3
- package/template/apps/server/src/system/routes.test.ts +21 -11
- package/template/apps/server/src/system/routes.ts +11 -2
- package/template/apps/server/src/work-order/foundation-modules.test.ts +6 -4
- package/template/apps/server/src/work-order/routes.test.ts +8 -0
- package/template/apps/server/src/work-order/task.test.ts +6 -1
- package/template/apps/web/Dockerfile +5 -0
- package/template/apps/web/package.json +1 -0
- package/template/apps/web/scripts/validate-admin-ui-composition.ts +106 -0
- package/template/apps/web/src/app/web-composition.ts +24 -0
- package/template/apps/web/src/app/web-composition.webtest.ts +15 -0
- package/template/apps/web/src/layout/AppSidebar.vue +8 -1
- package/template/apps/web/src/layout/NavigationSearchDialog.vue +8 -1
- package/template/apps/web/src/layout/navigation.ts +29 -4
- package/template/apps/web/src/layout/navigation.webtest.ts +51 -0
- package/template/apps/web/src/pages/dashboard/dashboard-presenter.ts +6 -1
- package/template/apps/web/src/pages/work-orders/WorkOrderListPage.vue +202 -0
- package/template/apps/web/src/pages/work-orders/WorkOrderListPage.webtest.ts +51 -0
- package/template/apps/web/src/router/admin-extension-loader.ts +44 -0
- package/template/apps/web/src/router/admin-extension-loader.webtest.ts +49 -0
- package/template/apps/web/src/router/admin-ui-composition-plugin.ts +33 -0
- package/template/apps/web/src/router/admin-ui-composition-plugin.webtest.ts +20 -0
- package/template/apps/web/src/router/admin-ui-composition.ts +313 -0
- package/template/apps/web/src/router/admin-ui-composition.webtest.ts +225 -0
- package/template/apps/web/src/router/admin-ui-module-registry-plugin.ts +55 -0
- package/template/apps/web/src/router/admin-ui-module-registry-plugin.webtest.ts +46 -0
- package/template/apps/web/src/router/business-routes.ts +32 -45
- package/template/apps/web/src/router/business-routes.webtest.ts +40 -44
- package/template/apps/web/src/router/index.ts +64 -54
- package/template/apps/web/src/router/manifest-routes.ts +27 -7
- package/template/apps/web/src/router/manifest-routes.webtest.ts +10 -2
- package/template/apps/web/src/router/platform-admin-route-bindings.ts +58 -0
- package/template/apps/web/src/router/reserved-route-paths.ts +14 -0
- package/template/apps/web/src/router/shared-scaffold-neutrality.webtest.ts +10 -4
- package/template/apps/web/src/router/web-composition-host.ts +20 -0
- package/template/apps/web/src/services/work-order-api.ts +16 -0
- package/template/apps/web/src/services/work-order-api.webtest.ts +21 -0
- package/template/apps/web/src/virtual-admin-ui-modules.d.ts +5 -0
- package/template/apps/web/vite.config.ts +22 -1
- package/template/docs/architecture/migration-bundle.md +10 -7
- package/template/docs/architecture/module-manifest-composition.md +85 -3
- package/template/docs/architecture/search-provider-protocol.md +6 -1
- package/template/docs/architecture/server-module-interface.md +70 -7
- package/template/docs/development/business-web-routes.md +53 -50
- package/template/docs/development/module-lifecycle.md +48 -54
- package/template/docs/platform/navigation-registry.md +5 -4
- package/template/package.json +1 -1
- package/template/packages/config/package.json +1 -1
- package/template/packages/database/package.json +1 -1
- package/template/packages/example-work-order/package.json +6 -0
- package/template/packages/example-work-order/src/admin-page.ts +78 -0
- package/template/packages/example-work-order/src/admin.ts +35 -0
- package/template/packages/example-work-order/src/manifest.test.ts +62 -5
- package/template/packages/example-work-order/src/manifest.ts +54 -7
- package/template/packages/example-work-order/src/migration-bundle.ts +8 -0
- package/template/packages/example-work-order/src/server-module.ts +2 -2
- package/template/packages/jobs/package.json +1 -1
- package/template/packages/modules/index.ts +4 -0
- package/template/packages/modules/package.json +3 -2
- package/template/packages/modules/src/admin-ui-entry.ts +8 -0
- package/template/packages/modules/src/admin-ui-manifest.test.ts +52 -0
- package/template/packages/modules/src/admin-ui-manifest.ts +53 -0
- package/template/packages/modules/src/capability-audit-validation.test.ts +127 -0
- package/template/packages/modules/src/capability-audit-validation.ts +38 -0
- package/template/packages/modules/src/capability-guard-validation.ts +148 -0
- package/template/packages/modules/src/capability-key-validation.test.ts +150 -0
- package/template/packages/modules/src/composition-fixtures.test-support.ts +7 -5
- package/template/packages/modules/src/composition.test.ts +74 -9
- package/template/packages/modules/src/composition.ts +8 -0
- package/template/packages/modules/src/manifest.ts +1 -0
- package/template/packages/modules/src/migration-bundle-validation.test.ts +23 -0
- package/template/packages/modules/src/module-host-range.test.ts +57 -0
- package/template/packages/modules/src/module-host-range.ts +125 -0
- package/template/packages/modules/src/project-module-assembly.test.ts +133 -0
- package/template/packages/modules/src/project-module-assembly.ts +126 -0
- package/template/packages/modules/src/system-admin-routes.ts +6 -5
- package/template/packages/modules/src/system-admin-ui-catalog.ts +72 -0
- package/template/packages/modules/src/system-agent-tools.ts +2 -2
- package/template/packages/modules/src/system-api-binding.ts +43 -9
- package/template/packages/modules/src/system-api-control-plane.ts +202 -0
- package/template/packages/modules/src/system-api-data-governance.ts +4 -2
- package/template/packages/modules/src/system-api-operational.ts +57 -8
- package/template/packages/modules/src/system-api-permissions.ts +115 -21
- package/template/packages/modules/src/system-api-watermark.ts +3 -0
- package/template/packages/modules/src/system-audit-actions.ts +7 -0
- package/template/packages/modules/src/system-data-governance.ts +5 -2
- package/template/packages/modules/src/system-features.ts +31 -0
- package/template/packages/modules/src/system-governed-export-bindings.ts +8 -4
- package/template/packages/modules/src/system-module-catalog.test.ts +39 -4
- package/template/packages/modules/src/system-module-catalog.ts +68 -7
- package/template/packages/modules/src/system-module-tasks.ts +8 -1
- package/template/packages/modules/src/system-modules-access.test.ts +4 -0
- package/template/packages/modules/src/system-modules.test.ts +10 -2
- package/template/packages/modules/src/system-modules.ts +6 -5
- package/template/packages/modules/src/system-permissions.ts +4 -0
- package/template/packages/modules/user/module.ts +19 -2
- package/template/packages/server-sdk/index.ts +8 -0
- package/template/packages/server-sdk/package.json +2 -1
- package/template/packages/server-sdk/src/durable-handler.ts +16 -1
- package/template/packages/server-sdk/src/module-adapter.test.ts +44 -0
- package/template/packages/server-sdk/src/module-adapter.ts +59 -0
- package/template/packages/server-sdk/src/route-definition.ts +3 -2
- package/template/packages/shared/package.json +1 -1
- package/template/packages/shared/src/audit.test.ts +7 -0
- package/template/packages/shared/src/audit.ts +16 -0
- package/template/packages/shared/src/migration-bundle-validation.ts +9 -11
- package/template/packages/shared/src/rbac.ts +2 -0
- package/template/apps/web/src/app/business-routes.ts +0 -22
|
@@ -13,14 +13,15 @@ export type ModuleRouteHandler = (
|
|
|
13
13
|
* (path 含 `/api` 前缀);宿主据此绑定 Guard(权限 / Feature / License),
|
|
14
14
|
* 无需模块手工接线。`permissionKey` 必须与 Manifest 绑定一致并属于本模块命名空间。
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* 宿主从同一 API binding 读取 Audit Action,并在 Handler 成功且实现未自行发出同一
|
|
17
|
+
* 动作时补写审计。实现不需要重复维护动作 Key。
|
|
18
18
|
*/
|
|
19
19
|
export interface ModuleRouteDefinition {
|
|
20
20
|
readonly method: ModuleRouteMethod;
|
|
21
21
|
readonly path: string;
|
|
22
22
|
readonly permissionKey: string;
|
|
23
23
|
readonly featureKey?: string;
|
|
24
|
+
/** @deprecated Audit Action 以 Manifest API binding 为唯一事实源。 */
|
|
24
25
|
readonly auditAction?: string;
|
|
25
26
|
readonly handler: ModuleRouteHandler;
|
|
26
27
|
}
|
|
@@ -10,6 +10,13 @@ describe("审计动作目录", () => {
|
|
|
10
10
|
label: "功能开关更新",
|
|
11
11
|
description: "更新功能开关状态、可见性或 License 适用范围。",
|
|
12
12
|
});
|
|
13
|
+
expect(AUDIT_ACTION_DEFINITIONS.map(({ key }) => key)).toEqual(
|
|
14
|
+
expect.arrayContaining([
|
|
15
|
+
"data.read",
|
|
16
|
+
"file.upload.part.write",
|
|
17
|
+
"agent.mcp.access",
|
|
18
|
+
]),
|
|
19
|
+
);
|
|
13
20
|
expect(new Set(AUDIT_ACTION_DEFINITIONS.map(({ key }) => key)).size).toBe(
|
|
14
21
|
AUDIT_ACTION_DEFINITIONS.length,
|
|
15
22
|
);
|
|
@@ -28,6 +28,7 @@ export const AUDIT_ACTION_DEFINITIONS = [
|
|
|
28
28
|
{ key: "crud.update", label: "数据更新", description: "修改业务记录。" },
|
|
29
29
|
{ key: "crud.delete", label: "数据删除", description: "删除业务记录。" },
|
|
30
30
|
{ key: "crud.restore", label: "数据恢复", description: "恢复已删除记录。" },
|
|
31
|
+
{ key: "data.read", label: "数据读取", description: "读取业务记录或目录。" },
|
|
31
32
|
{ key: "data.import", label: "数据导入", description: "同步导入数据。" },
|
|
32
33
|
{ key: "data.export", label: "数据导出", description: "同步导出数据。" },
|
|
33
34
|
{
|
|
@@ -95,6 +96,11 @@ export const AUDIT_ACTION_DEFINITIONS = [
|
|
|
95
96
|
label: "创建文件上传",
|
|
96
97
|
description: "创建受控文件上传会话。",
|
|
97
98
|
},
|
|
99
|
+
{
|
|
100
|
+
key: "file.upload.part.write",
|
|
101
|
+
label: "写入文件分片",
|
|
102
|
+
description: "向受控上传会话写入文件分片。",
|
|
103
|
+
},
|
|
98
104
|
{
|
|
99
105
|
key: "file.upload.complete",
|
|
100
106
|
label: "完成文件上传",
|
|
@@ -214,11 +220,21 @@ export const AUDIT_ACTION_DEFINITIONS = [
|
|
|
214
220
|
{ key: "task.read", label: "任务查看", description: "查看任务状态或历史。" },
|
|
215
221
|
{ key: "task.execute", label: "任务执行", description: "后台任务实际执行。" },
|
|
216
222
|
{ key: "task.recover", label: "任务恢复", description: "人工恢复异常任务。" },
|
|
223
|
+
{
|
|
224
|
+
key: "agent.mcp.access",
|
|
225
|
+
label: "MCP 接口访问",
|
|
226
|
+
description: "访问平台 MCP Streamable HTTP 协议入口。",
|
|
227
|
+
},
|
|
217
228
|
{
|
|
218
229
|
key: "agent.tool.execute",
|
|
219
230
|
label: "Agent 工具执行",
|
|
220
231
|
description: "Agent 调用受控平台工具。",
|
|
221
232
|
},
|
|
233
|
+
{
|
|
234
|
+
key: "agent.operation.execute",
|
|
235
|
+
label: "AI 操作执行",
|
|
236
|
+
description: "执行 Agent、Document、Speech 或 Embedding 操作。",
|
|
237
|
+
},
|
|
222
238
|
{
|
|
223
239
|
key: "security.denied",
|
|
224
240
|
label: "安全拒绝",
|
|
@@ -23,26 +23,24 @@ export function normalizeManifestBundles(
|
|
|
23
23
|
`Migration Bundle ${bundle.module} 版本 ${bundle.version} 与 Manifest ${manifest.version} 不一致`,
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
assertBundleDependenciesDeclared(manifest, bundle);
|
|
27
27
|
assertSameMigrations(manifest, bundle);
|
|
28
28
|
assertSchemaMigrationReferences(manifest, bundle);
|
|
29
29
|
return bundle;
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function
|
|
33
|
+
function assertBundleDependenciesDeclared(
|
|
34
34
|
manifest: MigrationManifestSource,
|
|
35
35
|
bundle: MigrationBundle,
|
|
36
36
|
): void {
|
|
37
|
-
const declared = manifest.dependencies || [];
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
`Manifest ${manifest.name} 的 dependencies 必须与 Migration Bundle 一致`,
|
|
45
|
-
);
|
|
37
|
+
const declared = new Set(manifest.dependencies || []);
|
|
38
|
+
for (const dependency of bundle.dependencies || []) {
|
|
39
|
+
if (!declared.has(dependency)) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Migration Bundle ${bundle.module} 依赖未在 Manifest 声明:${dependency}`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
EntityId,
|
|
4
4
|
LifecycleStatus,
|
|
5
5
|
} from "./primitives.js";
|
|
6
|
+
import type { AuditActionType } from "./audit.js";
|
|
6
7
|
|
|
7
8
|
export type HttpMethod =
|
|
8
9
|
| "GET"
|
|
@@ -90,6 +91,7 @@ export interface ApiPermissionBinding {
|
|
|
90
91
|
permissionKey: string;
|
|
91
92
|
anonymous?: boolean;
|
|
92
93
|
featureKey?: string;
|
|
94
|
+
auditAction?: AuditActionType;
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
export interface MenuNode {
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Component } from "vue";
|
|
2
|
-
import type { RouteRecordRaw } from "vue-router";
|
|
3
|
-
|
|
4
|
-
export interface BusinessAdminRouteRegistration {
|
|
5
|
-
readonly key: string;
|
|
6
|
-
readonly path: string;
|
|
7
|
-
readonly title: string;
|
|
8
|
-
readonly component: Component;
|
|
9
|
-
readonly featureKey: string;
|
|
10
|
-
readonly permissionKey: string;
|
|
11
|
-
readonly name?: string;
|
|
12
|
-
readonly props?: RouteRecordRaw["props"];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 客户拥有的 Web 业务路由注册表。
|
|
17
|
-
*
|
|
18
|
-
* 导航标题、路径、Feature 和 Permission 必须与业务 Module Manifest 保持一致。
|
|
19
|
-
* 平台 Router 会统一接入访问快照 Guard,业务项目不需要修改 shared-scaffold。
|
|
20
|
-
*/
|
|
21
|
-
export const installedBusinessAdminRoutes =
|
|
22
|
-
[] satisfies readonly BusinessAdminRouteRegistration[];
|