create-windy 0.6.20 → 0.7.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/cli.js +16 -4
- package/package.json +1 -1
- package/template/.windy-template.json +2 -2
- package/template/apps/server/src/agent/remote-runtime.test.ts +36 -0
- package/template/apps/server/src/agent/remote-runtime.ts +15 -7
- package/template/apps/server/src/audit/policy.ts +6 -1
- package/template/apps/server/src/auth/bootstrap-admin.ts +10 -1
- package/template/apps/server/src/auth/composition.ts +5 -0
- package/template/apps/server/src/auth/credential-authorization.test.ts +257 -0
- package/template/apps/server/src/auth/credential-routes.test.ts +1 -0
- package/template/apps/server/src/auth/credential-service.ts +47 -12
- package/template/apps/server/src/auth/drizzle-repository.ts +13 -5
- package/template/apps/server/src/auth/drizzle-session-operations.ts +1 -0
- package/template/apps/server/src/auth/repository.ts +9 -6
- package/template/apps/server/src/auth/routes.test-support.ts +1 -0
- package/template/apps/server/src/auth/runtime.ts +4 -0
- package/template/apps/server/src/auth/service-options.ts +2 -0
- package/template/apps/server/src/auth/service.ts +2 -0
- package/template/apps/server/src/auth/user-credential-access.ts +37 -0
- package/template/apps/server/src/foundation-activation.test.ts +24 -1
- package/template/apps/server/src/foundation.ts +0 -2
- package/template/apps/server/src/index.ts +1 -0
- package/template/apps/server/src/runtime-development.ts +2 -0
- package/template/apps/server/src/runtime.test.ts +13 -4
- package/template/apps/server/src/system/department-organization.ts +58 -59
- package/template/apps/server/src/system/department-read-routes.ts +54 -0
- package/template/apps/server/src/system/department-routes.test.ts +27 -19
- package/template/apps/server/src/system/department-routes.ts +95 -33
- package/template/apps/server/src/system/department-transition-safety.test.ts +148 -0
- package/template/apps/server/src/system/department-validation.ts +79 -0
- package/template/apps/server/src/system/drizzle-repository.ts +14 -0
- package/template/apps/server/src/system/drizzle-system-configs.ts +2 -0
- package/template/apps/server/src/system/identity-read-model.ts +105 -0
- package/template/apps/server/src/system/identity-role-assignment.test.ts +199 -0
- package/template/apps/server/src/system/identity-role-assignment.ts +148 -0
- package/template/apps/server/src/system/identity-route-config.ts +29 -7
- package/template/apps/server/src/system/identity-write-security.test.ts +127 -0
- package/template/apps/server/src/system/identity-write-validation.ts +170 -0
- package/template/apps/server/src/system/organization-read-security.test.ts +221 -0
- package/template/apps/server/src/system/redis-health.test.ts +1 -1
- package/template/apps/server/src/system/repository.ts +29 -2
- package/template/apps/server/src/system/resource-routes.ts +116 -72
- package/template/apps/server/src/system/route-audit.test.ts +117 -0
- package/template/apps/server/src/system/route-helpers.ts +14 -0
- package/template/apps/server/src/system/route-types.ts +11 -2
- package/template/apps/server/src/system/routes.test.ts +0 -68
- package/template/apps/server/src/system/routes.ts +29 -2
- package/template/apps/server/src/system/user-account-policy.test.ts +3 -1
- package/template/apps/server/src/system/user-account-policy.ts +26 -9
- package/template/apps/web/src/pages/system/SystemResourceRoutePage.vue +27 -13
- package/template/apps/web/src/pages/system/SystemResourceRoutePage.webtest.ts +68 -0
- package/template/apps/web/src/pages/system/components/PagedSelectionList.vue +131 -0
- package/template/apps/web/src/pages/system/components/PagedSelectionList.webtest.ts +32 -0
- package/template/apps/web/src/pages/system/components/SystemRecordDetailDialog.vue +67 -0
- package/template/apps/web/src/pages/system/components/SystemResourceEditor.vue +114 -38
- package/template/apps/web/src/pages/system/components/SystemResourceEditor.webtest.ts +180 -0
- package/template/apps/web/src/pages/system/components/SystemResourceFilters.vue +8 -0
- package/template/apps/web/src/pages/system/components/SystemResourceForm.vue +8 -2
- package/template/apps/web/src/pages/system/components/SystemResourcePage.department.webtest.ts +89 -0
- package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +42 -46
- package/template/apps/web/src/pages/system/components/SystemResourcePage.webtest.ts +12 -55
- package/template/apps/web/src/pages/system/components/SystemResourceTable.vue +14 -2
- package/template/apps/web/src/pages/system/components/department/DepartmentOrganizationForm.vue +121 -85
- package/template/apps/web/src/pages/system/components/department/DepartmentOrganizationForm.webtest.ts +57 -0
- package/template/apps/web/src/pages/system/components/department/DepartmentOrganizationTable.vue +227 -0
- package/template/apps/web/src/pages/system/components/department/DepartmentOrganizationTable.webtest.ts +62 -0
- package/template/apps/web/src/pages/system/components/department/DepartmentTransitionDialog.vue +72 -52
- package/template/apps/web/src/pages/system/components/role-policy/RolePermissionTree.vue +150 -79
- package/template/apps/web/src/pages/system/components/role-policy/RolePolicyForm.vue +98 -8
- package/template/apps/web/src/pages/system/components/role-policy/RolePolicyForm.webtest.ts +108 -0
- package/template/apps/web/src/pages/system/components/selection-options.ts +71 -0
- package/template/apps/web/src/pages/system/components/selection-options.webtest.ts +49 -0
- package/template/apps/web/src/pages/system/components/user-account/CreateDepartmentDialog.vue +19 -27
- package/template/apps/web/src/pages/system/components/user-account/CreateDepartmentDialog.webtest.ts +2 -6
- package/template/apps/web/src/pages/system/components/user-account/CreateRoleDialog.vue +128 -0
- package/template/apps/web/src/pages/system/components/user-account/CreateRoleDialog.webtest.ts +76 -0
- package/template/apps/web/src/pages/system/components/user-account/RolePermissionSummary.vue +61 -3
- package/template/apps/web/src/pages/system/components/user-account/UserAccountForm.vue +144 -90
- package/template/apps/web/src/pages/system/components/user-account/UserAccountForm.webtest.ts +95 -0
- package/template/apps/web/src/pages/system/components/user-account/UserListFilters.vue +168 -0
- package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.vue +33 -57
- package/template/apps/web/src/pages/system/components/user-account/UserRoleSelector.webtest.ts +4 -4
- package/template/apps/web/src/pages/system/components/user-account/save-user-account.ts +4 -1
- package/template/apps/web/src/pages/system/components/user-account/user-account-draft.ts +81 -0
- package/template/apps/web/src/pages/system/composables/useDepartmentTransitions.ts +6 -10
- package/template/apps/web/src/pages/system/composables/useResourceEditor.ts +72 -0
- package/template/apps/web/src/pages/system/composables/useResourceEditor.webtest.ts +110 -0
- package/template/apps/web/src/pages/system/composables/useSystemResource.ts +27 -1
- package/template/apps/web/src/pages/system/resource-config.ts +2 -0
- package/template/apps/web/src/services/system-api.ts +25 -0
- package/template/docs/architecture/foundation-infrastructure.md +12 -25
- package/template/docs/development/crud-generator.md +1 -1
- package/template/docs/operations/legacy-data-migration.md +73 -0
- package/template/docs/platform/bulk-data-jobs.md +1 -1
- package/template/docs/platform/module-configuration.md +2 -2
- package/template/docs/platform/organization-membership.md +37 -6
- package/template/docs/platform/scheduled-task-executor.md +1 -1
- package/template/package.json +2 -1
- package/template/packages/config/index.test.ts +1 -5
- package/template/packages/config/package.json +2 -2
- package/template/packages/config/src/platform-boundary.test.ts +39 -0
- package/template/packages/config/src/platform.ts +0 -28
- package/template/packages/database/drizzle/0063_license_project_lifecycle.sql +28 -0
- package/template/packages/database/drizzle/meta/0063_snapshot.json +15053 -0
- package/template/packages/database/drizzle/meta/_journal.json +7 -0
- package/template/packages/database/package.json +2 -2
- package/template/packages/database/src/agent-runtime-schema.test.ts +5 -1
- package/template/packages/database/src/schema/index.ts +1 -0
- package/template/packages/database/src/schema/license-issuance-requests.ts +59 -0
- package/template/packages/database/src/schema/license-v1.ts +5 -0
- package/template/packages/jobs/package.json +2 -2
- package/template/packages/modules/package.json +1 -1
- package/template/packages/modules/src/system-api-permissions.ts +14 -0
- package/template/packages/modules/src/system-features.ts +0 -11
- package/template/packages/modules/src/system-module-catalog.test.ts +4 -0
- package/template/packages/modules/src/system-module-catalog.ts +0 -1
- package/template/packages/server-sdk/index.ts +1 -49
- package/template/packages/server-sdk/package.json +3 -2
- package/template/packages/server-sdk/src/ai-runtime-readiness-exports.ts +49 -0
- package/template/packages/shared/index.ts +2 -1
- package/template/packages/shared/package.json +1 -1
- package/template/packages/shared/src/license-console-capabilities.ts +163 -0
- package/template/packages/shared/src/license-console.ts +94 -0
- package/template/packages/shared/src/license.ts +5 -0
- package/template/docs/adapters/ruoyi-vue-compatibility.md +0 -93
- package/template/packages/shared/src/ruoyi.ts +0 -98
|
@@ -442,6 +442,13 @@
|
|
|
442
442
|
"when": 1787904000000,
|
|
443
443
|
"tag": "0062_client_agent_workflow_artifact",
|
|
444
444
|
"breakpoints": true
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"idx": 63,
|
|
448
|
+
"version": "7",
|
|
449
|
+
"when": 1789011354550,
|
|
450
|
+
"tag": "0063_license_project_lifecycle",
|
|
451
|
+
"breakpoints": true
|
|
445
452
|
}
|
|
446
453
|
]
|
|
447
454
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@southwind-ai/database",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit --project tsconfig.json"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@southwind-ai/shared": "workspace:^0.
|
|
18
|
+
"@southwind-ai/shared": "workspace:^0.3.0",
|
|
19
19
|
"drizzle-orm": "^0.45.2"
|
|
20
20
|
},
|
|
21
21
|
"exports": {
|
|
@@ -312,7 +312,11 @@ test("Agent Run 固定不可变 Release 并持久化恢复租约", async () => {
|
|
|
312
312
|
breakpoints: boolean;
|
|
313
313
|
}[];
|
|
314
314
|
};
|
|
315
|
-
expect(
|
|
315
|
+
expect(
|
|
316
|
+
migrationJournal.entries.find(
|
|
317
|
+
(entry) => entry.tag === "0062_client_agent_workflow_artifact",
|
|
318
|
+
),
|
|
319
|
+
).toMatchObject({
|
|
316
320
|
idx: 62,
|
|
317
321
|
version: "7",
|
|
318
322
|
tag: "0062_client_agent_workflow_artifact",
|
|
@@ -17,6 +17,7 @@ export * from "./identity.js";
|
|
|
17
17
|
// @windy-module system.license begin
|
|
18
18
|
export * from "./license-legacy.js";
|
|
19
19
|
export * from "./license-v1.js";
|
|
20
|
+
export * from "./license-issuance-requests.js";
|
|
20
21
|
// @windy-module system.license end
|
|
21
22
|
export * from "./migration-history.js";
|
|
22
23
|
// @windy-module system.notification begin
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { sql } from "drizzle-orm";
|
|
2
|
+
import {
|
|
3
|
+
check,
|
|
4
|
+
index,
|
|
5
|
+
integer,
|
|
6
|
+
pgTable,
|
|
7
|
+
text,
|
|
8
|
+
timestamp,
|
|
9
|
+
uniqueIndex,
|
|
10
|
+
varchar,
|
|
11
|
+
} from "drizzle-orm/pg-core";
|
|
12
|
+
import { licenseProjects, licenses } from "./license-v1.js";
|
|
13
|
+
|
|
14
|
+
export const licenseIssuanceRequests = pgTable(
|
|
15
|
+
"license_issuance_requests",
|
|
16
|
+
{
|
|
17
|
+
id: varchar("id", { length: 64 }).primaryKey(),
|
|
18
|
+
actorId: varchar("actor_id", { length: 64 }).notNull(),
|
|
19
|
+
idempotencyKey: varchar("idempotency_key", { length: 160 }).notNull(),
|
|
20
|
+
projectId: varchar("project_id", { length: 64 })
|
|
21
|
+
.notNull()
|
|
22
|
+
.references(() => licenseProjects.id, { onDelete: "restrict" }),
|
|
23
|
+
requestDigest: varchar("request_digest", { length: 64 }).notNull(),
|
|
24
|
+
reviewDigest: varchar("review_digest", { length: 64 }).notNull(),
|
|
25
|
+
licenseId: varchar("license_id", { length: 64 }).notNull(),
|
|
26
|
+
resultLicenseId: varchar("result_license_id", { length: 64 }).references(
|
|
27
|
+
() => licenses.id,
|
|
28
|
+
{ onDelete: "restrict" },
|
|
29
|
+
),
|
|
30
|
+
issuedAt: timestamp("issued_at", { withTimezone: true }).notNull(),
|
|
31
|
+
status: varchar("status", { length: 20 }).notNull().default("processing"),
|
|
32
|
+
fence: integer("fence").notNull().default(1),
|
|
33
|
+
leaseUntil: timestamp("lease_until", { withTimezone: true }).notNull(),
|
|
34
|
+
errorCode: varchar("error_code", { length: 80 }),
|
|
35
|
+
errorReason: text("error_reason"),
|
|
36
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
37
|
+
.notNull()
|
|
38
|
+
.defaultNow(),
|
|
39
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
40
|
+
.notNull()
|
|
41
|
+
.defaultNow(),
|
|
42
|
+
},
|
|
43
|
+
(table) => [
|
|
44
|
+
uniqueIndex("uk_license_issuance_actor_key").on(
|
|
45
|
+
table.actorId,
|
|
46
|
+
table.idempotencyKey,
|
|
47
|
+
),
|
|
48
|
+
uniqueIndex("uk_license_issuance_license").on(table.licenseId),
|
|
49
|
+
index("idx_license_issuance_project").on(table.projectId, table.createdAt),
|
|
50
|
+
check(
|
|
51
|
+
"ck_license_issuance_status",
|
|
52
|
+
sql`${table.status} in ('processing', 'failed', 'completed')`,
|
|
53
|
+
),
|
|
54
|
+
check(
|
|
55
|
+
"ck_license_issuance_result",
|
|
56
|
+
sql`(${table.status} = 'completed') = (${table.resultLicenseId} is not null)`,
|
|
57
|
+
),
|
|
58
|
+
],
|
|
59
|
+
);
|
|
@@ -2,6 +2,7 @@ import type { LicenseV1Claims, LicenseVersionKey } from "@southwind-ai/shared";
|
|
|
2
2
|
import { sql } from "drizzle-orm";
|
|
3
3
|
import {
|
|
4
4
|
check,
|
|
5
|
+
type AnyPgColumn,
|
|
5
6
|
index,
|
|
6
7
|
integer,
|
|
7
8
|
jsonb,
|
|
@@ -91,6 +92,10 @@ export const licenseContractVersions = pgTable(
|
|
|
91
92
|
projectId: varchar("project_id", { length: 64 })
|
|
92
93
|
.notNull()
|
|
93
94
|
.references(() => licenseProjects.id, { onDelete: "restrict" }),
|
|
95
|
+
predecessorId: varchar("predecessor_id", { length: 64 }).references(
|
|
96
|
+
(): AnyPgColumn => licenseContractVersions.id,
|
|
97
|
+
{ onDelete: "restrict" },
|
|
98
|
+
),
|
|
94
99
|
contractNumber: varchar("contract_number", { length: 120 }).notNull(),
|
|
95
100
|
version: varchar("version", { length: 40 }).notNull(),
|
|
96
101
|
licenseVersionId: varchar("license_version_id", { length: 64 })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@southwind-ai/jobs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"typecheck": "tsc --noEmit --project tsconfig.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@southwind-ai/shared": "workspace:^0.
|
|
19
|
+
"@southwind-ai/shared": "workspace:^0.3.0",
|
|
20
20
|
"@southwind-ai/storage": "workspace:^"
|
|
21
21
|
},
|
|
22
22
|
"exports": {
|
|
@@ -95,6 +95,20 @@ export function systemApiPermissionBindings(): ApiPermissionBinding[] {
|
|
|
95
95
|
permissionResource: "department",
|
|
96
96
|
featureKey: "system.department",
|
|
97
97
|
}),
|
|
98
|
+
binding(
|
|
99
|
+
"GET",
|
|
100
|
+
"/api/system/departments/organization",
|
|
101
|
+
"system.department.read",
|
|
102
|
+
"system.department",
|
|
103
|
+
"data.read",
|
|
104
|
+
),
|
|
105
|
+
binding(
|
|
106
|
+
"GET",
|
|
107
|
+
"/api/system/departments/:id/transition-preview",
|
|
108
|
+
"system.department.manage",
|
|
109
|
+
"system.department",
|
|
110
|
+
"data.read",
|
|
111
|
+
),
|
|
98
112
|
binding(
|
|
99
113
|
"POST",
|
|
100
114
|
"/api/system/departments/quick",
|
|
@@ -170,17 +170,6 @@ export const systemFeatures: ModuleManifest["features"] = [
|
|
|
170
170
|
allowedLicenseVersions: advancedOnly,
|
|
171
171
|
},
|
|
172
172
|
// @windy-module system.bulk-data end
|
|
173
|
-
{
|
|
174
|
-
...feature(
|
|
175
|
-
"system.ruoyi-compat",
|
|
176
|
-
"RuoYi-Vue 兼容层",
|
|
177
|
-
"可选适配旧 RuoYi-Vue 数据与接口,不影响平台标准模型。",
|
|
178
|
-
),
|
|
179
|
-
visible: "hidden",
|
|
180
|
-
enabled: false,
|
|
181
|
-
stage: "internal",
|
|
182
|
-
allowedLicenseVersions: advancedOnly,
|
|
183
|
-
},
|
|
184
173
|
];
|
|
185
174
|
|
|
186
175
|
function feature(
|
|
@@ -71,6 +71,10 @@ describe("系统能力模块目录", () => {
|
|
|
71
71
|
const aggregate = systemFoundationModule();
|
|
72
72
|
const modules = systemModuleManifests();
|
|
73
73
|
|
|
74
|
+
expect(aggregate.features.map(({ key }) => key)).not.toContain(
|
|
75
|
+
"system.ruoyi-compat",
|
|
76
|
+
);
|
|
77
|
+
|
|
74
78
|
expect(JSON.parse(JSON.stringify(composeModuleMenus(modules)))).toEqual(
|
|
75
79
|
aggregate.menus.filter(
|
|
76
80
|
(menu) => menu.type !== "catalog" || Boolean(menu.children?.length),
|
|
@@ -65,55 +65,7 @@ export type {
|
|
|
65
65
|
ModuleEmbeddingItem,
|
|
66
66
|
} from "./src/ai-operation-port.js";
|
|
67
67
|
export { ModuleAiOperationError } from "./src/ai-operation-port.js";
|
|
68
|
-
export
|
|
69
|
-
AI_OPERATION_MAX_REQUIRED_CAPABILITIES_V1,
|
|
70
|
-
AI_READINESS_REASON_CODES_V1,
|
|
71
|
-
AI_RUNTIME_KINDS_V1,
|
|
72
|
-
AI_RUNTIME_MAX_CAPABILITIES_PER_OFFER_V1,
|
|
73
|
-
AI_RUNTIME_MAX_OFFERS_V1,
|
|
74
|
-
AI_RUNTIME_MODALITIES_V1,
|
|
75
|
-
AI_RUNTIME_MAX_PROBE_TTL_SECONDS,
|
|
76
|
-
AI_RUNTIME_MAX_UNAVAILABLE_REASONS_V1,
|
|
77
|
-
AI_RUNTIME_PROBE_FAILURE_CODES_V1,
|
|
78
|
-
AI_RUNTIME_READINESS_SCHEMA_VERSION,
|
|
79
|
-
type AiOperationReadinessRequirementV1,
|
|
80
|
-
type AiOperationRequiredLimitsV1,
|
|
81
|
-
type AiOperationRequiredResourcesV1,
|
|
82
|
-
type AiReadinessReasonCodeV1,
|
|
83
|
-
type AiReadinessReasonV1,
|
|
84
|
-
type AiRuntimeDeploymentV1,
|
|
85
|
-
type AiRuntimeDownstreamProbeV1,
|
|
86
|
-
type AiRuntimeKindV1,
|
|
87
|
-
type AiRuntimeModalityV1,
|
|
88
|
-
type AiRuntimeOfferLimitsV1,
|
|
89
|
-
type AiRuntimeOfferV1,
|
|
90
|
-
type AiRuntimeOffersDigestV1,
|
|
91
|
-
type AiRuntimeProbeFailureCodeV1,
|
|
92
|
-
type AiRuntimeReadinessV1,
|
|
93
|
-
type AiRuntimeReadyV1,
|
|
94
|
-
type AiRuntimeReleaseDigestV1,
|
|
95
|
-
type AiRuntimeUnavailableV1,
|
|
96
|
-
type ModuleAiOperationReadinessPortV1,
|
|
97
|
-
type ModuleAiOperationReadinessV1,
|
|
98
|
-
type ModuleAiOperationReadyV1,
|
|
99
|
-
type ModuleAiOperationUnavailableV1,
|
|
100
|
-
} from "./src/ai-runtime-readiness.js";
|
|
101
|
-
export { computeAiRuntimeOffersDigestV1 } from "./src/ai-runtime-readiness-digest.js";
|
|
102
|
-
export {
|
|
103
|
-
AI_RUNTIME_DEPLOYMENT_IDENTITY_PREFIX_V1,
|
|
104
|
-
parseAiRuntimeDeploymentIdentityV1,
|
|
105
|
-
type AiRuntimeDeploymentIdentityV1,
|
|
106
|
-
} from "./src/ai-runtime-readiness-identity.js";
|
|
107
|
-
export {
|
|
108
|
-
parseAiRuntimeReadinessV1,
|
|
109
|
-
type AiRuntimeReadinessParseResult,
|
|
110
|
-
} from "./src/ai-runtime-readiness-validation.js";
|
|
111
|
-
export {
|
|
112
|
-
projectAiOperationReadinessV1,
|
|
113
|
-
type ProjectAiOperationReadinessOptionsV1,
|
|
114
|
-
} from "./src/ai-runtime-readiness-projection.js";
|
|
115
|
-
export type { AiRuntimeTrustedFullAttestationV1 } from "./src/ai-runtime-readiness-trust.js";
|
|
116
|
-
export { validAiOperationReadinessRequirementV1 } from "@southwind-ai/shared";
|
|
68
|
+
export * from "./src/ai-runtime-readiness-exports.js";
|
|
117
69
|
export type {
|
|
118
70
|
ModuleBackgroundAiErrorCode,
|
|
119
71
|
ModuleBackgroundAiOperationInput,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@southwind-ai/server-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"src/ai-runtime-readiness.ts",
|
|
17
17
|
"src/ai-runtime-readiness-capture.ts",
|
|
18
18
|
"src/ai-runtime-readiness-digest.ts",
|
|
19
|
+
"src/ai-runtime-readiness-exports.ts",
|
|
19
20
|
"src/ai-runtime-readiness-identity.ts",
|
|
20
21
|
"src/ai-runtime-readiness-keys.ts",
|
|
21
22
|
"src/ai-runtime-readiness-limits.ts",
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
"dependencies": {
|
|
68
69
|
"@southwind-ai/jobs": "workspace:^",
|
|
69
70
|
"@southwind-ai/modules": "workspace:^",
|
|
70
|
-
"@southwind-ai/shared": "workspace:^0.
|
|
71
|
+
"@southwind-ai/shared": "workspace:^0.3.0",
|
|
71
72
|
"@southwind-ai/storage": "workspace:^"
|
|
72
73
|
},
|
|
73
74
|
"exports": {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export {
|
|
2
|
+
AI_OPERATION_MAX_REQUIRED_CAPABILITIES_V1,
|
|
3
|
+
AI_READINESS_REASON_CODES_V1,
|
|
4
|
+
AI_RUNTIME_KINDS_V1,
|
|
5
|
+
AI_RUNTIME_MAX_CAPABILITIES_PER_OFFER_V1,
|
|
6
|
+
AI_RUNTIME_MAX_OFFERS_V1,
|
|
7
|
+
AI_RUNTIME_MODALITIES_V1,
|
|
8
|
+
AI_RUNTIME_MAX_PROBE_TTL_SECONDS,
|
|
9
|
+
AI_RUNTIME_MAX_UNAVAILABLE_REASONS_V1,
|
|
10
|
+
AI_RUNTIME_PROBE_FAILURE_CODES_V1,
|
|
11
|
+
AI_RUNTIME_READINESS_SCHEMA_VERSION,
|
|
12
|
+
type AiOperationReadinessRequirementV1,
|
|
13
|
+
type AiOperationRequiredLimitsV1,
|
|
14
|
+
type AiOperationRequiredResourcesV1,
|
|
15
|
+
type AiReadinessReasonCodeV1,
|
|
16
|
+
type AiReadinessReasonV1,
|
|
17
|
+
type AiRuntimeDeploymentV1,
|
|
18
|
+
type AiRuntimeDownstreamProbeV1,
|
|
19
|
+
type AiRuntimeKindV1,
|
|
20
|
+
type AiRuntimeModalityV1,
|
|
21
|
+
type AiRuntimeOfferLimitsV1,
|
|
22
|
+
type AiRuntimeOfferV1,
|
|
23
|
+
type AiRuntimeOffersDigestV1,
|
|
24
|
+
type AiRuntimeProbeFailureCodeV1,
|
|
25
|
+
type AiRuntimeReadinessV1,
|
|
26
|
+
type AiRuntimeReadyV1,
|
|
27
|
+
type AiRuntimeReleaseDigestV1,
|
|
28
|
+
type AiRuntimeUnavailableV1,
|
|
29
|
+
type ModuleAiOperationReadinessPortV1,
|
|
30
|
+
type ModuleAiOperationReadinessV1,
|
|
31
|
+
type ModuleAiOperationReadyV1,
|
|
32
|
+
type ModuleAiOperationUnavailableV1,
|
|
33
|
+
} from "./ai-runtime-readiness.js";
|
|
34
|
+
export { computeAiRuntimeOffersDigestV1 } from "./ai-runtime-readiness-digest.js";
|
|
35
|
+
export {
|
|
36
|
+
AI_RUNTIME_DEPLOYMENT_IDENTITY_PREFIX_V1,
|
|
37
|
+
parseAiRuntimeDeploymentIdentityV1,
|
|
38
|
+
type AiRuntimeDeploymentIdentityV1,
|
|
39
|
+
} from "./ai-runtime-readiness-identity.js";
|
|
40
|
+
export {
|
|
41
|
+
parseAiRuntimeReadinessV1,
|
|
42
|
+
type AiRuntimeReadinessParseResult,
|
|
43
|
+
} from "./ai-runtime-readiness-validation.js";
|
|
44
|
+
export {
|
|
45
|
+
projectAiOperationReadinessV1,
|
|
46
|
+
type ProjectAiOperationReadinessOptionsV1,
|
|
47
|
+
} from "./ai-runtime-readiness-projection.js";
|
|
48
|
+
export type { AiRuntimeTrustedFullAttestationV1 } from "./ai-runtime-readiness-trust.js";
|
|
49
|
+
export { validAiOperationReadinessRequirementV1 } from "@southwind-ai/shared";
|
|
@@ -23,7 +23,6 @@ export * from "./src/platform-settings.js";
|
|
|
23
23
|
export * from "./src/profile.js";
|
|
24
24
|
export * from "./src/primitives.js";
|
|
25
25
|
export * from "./src/rbac.js";
|
|
26
|
-
export * from "./src/ruoyi.js";
|
|
27
26
|
export * from "./src/scheduler.js";
|
|
28
27
|
export * from "./src/search-provider.js";
|
|
29
28
|
// @windy-module system.agent begin
|
|
@@ -31,3 +30,5 @@ export * from "./src/screenshot-context-digest.js";
|
|
|
31
30
|
// @windy-module system.agent end
|
|
32
31
|
export * from "./src/stable-key.js";
|
|
33
32
|
export * from "./src/workflow.js";
|
|
33
|
+
|
|
34
|
+
export * from "./src/license-console-capabilities.js";
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { LicenseOperatorPermission } from "./license.js";
|
|
2
|
+
|
|
3
|
+
/** 厂商签发中心独立认证域;不装配到客户 system.license。 */
|
|
4
|
+
export const LICENSE_CONSOLE_CAPABILITIES = {
|
|
5
|
+
records: {
|
|
6
|
+
feature: "license.record",
|
|
7
|
+
permission: "license.record.read",
|
|
8
|
+
entry: "records",
|
|
9
|
+
apis: [
|
|
10
|
+
"GET /api/licenses",
|
|
11
|
+
"GET /api/licenses/:id",
|
|
12
|
+
"GET /api/licenses/:id/download",
|
|
13
|
+
"GET /api/licenses/:id/activation-code",
|
|
14
|
+
"GET /api/licenses/:id/events",
|
|
15
|
+
"GET /api/events",
|
|
16
|
+
"GET /api/customers",
|
|
17
|
+
"GET /api/customers/:id",
|
|
18
|
+
"GET /api/projects",
|
|
19
|
+
"GET /api/projects/:id",
|
|
20
|
+
"GET /api/contracts",
|
|
21
|
+
"GET /api/contracts/:id",
|
|
22
|
+
"GET /api/license-versions",
|
|
23
|
+
"GET /api/license-versions/:id",
|
|
24
|
+
"GET /api/nodes",
|
|
25
|
+
"GET /api/nodes/:id",
|
|
26
|
+
"GET /api/keys/active",
|
|
27
|
+
"GET /api/projects/:projectId/contracts",
|
|
28
|
+
"GET /api/projects/:projectId/nodes",
|
|
29
|
+
"GET /api/projects/:projectId/license-versions",
|
|
30
|
+
"GET /api/projects/:projectId/licenses",
|
|
31
|
+
"GET /api/keys",
|
|
32
|
+
"GET /api/signing/diagnostics",
|
|
33
|
+
],
|
|
34
|
+
auditActions: ["license.downloaded"],
|
|
35
|
+
},
|
|
36
|
+
projects: {
|
|
37
|
+
feature: "license.project",
|
|
38
|
+
permission: "license.project.manage",
|
|
39
|
+
entry: "maintenance",
|
|
40
|
+
apis: [
|
|
41
|
+
"POST /api/customers",
|
|
42
|
+
"POST /api/projects",
|
|
43
|
+
"POST /api/contracts",
|
|
44
|
+
"POST /api/license-versions",
|
|
45
|
+
"POST /api/nodes",
|
|
46
|
+
"PATCH /api/customers/:id",
|
|
47
|
+
"PATCH /api/projects/:id",
|
|
48
|
+
"PATCH /api/contracts/:id",
|
|
49
|
+
"PATCH /api/license-versions/:id",
|
|
50
|
+
"PATCH /api/nodes/:id",
|
|
51
|
+
"PATCH /api/customers/:id/archive",
|
|
52
|
+
"PATCH /api/projects/:id/archive",
|
|
53
|
+
"PATCH /api/contracts/:id/archive",
|
|
54
|
+
"PATCH /api/license-versions/:id/archive",
|
|
55
|
+
"PATCH /api/nodes/:id/archive",
|
|
56
|
+
],
|
|
57
|
+
auditActions: ["crud.create", "crud.update"],
|
|
58
|
+
},
|
|
59
|
+
issuance: {
|
|
60
|
+
feature: "license.issue",
|
|
61
|
+
permission: "license.issue",
|
|
62
|
+
entry: "project-issuance",
|
|
63
|
+
apis: [
|
|
64
|
+
"POST /api/projects/:projectId/licenses",
|
|
65
|
+
"POST /api/projects/:projectId/license-review",
|
|
66
|
+
"GET /api/projects/:projectId/issuance-requests/:key",
|
|
67
|
+
"POST /api/licenses",
|
|
68
|
+
"POST /api/licenses/:id/revocation-marks",
|
|
69
|
+
"POST /api/licenses/:id/note-corrections",
|
|
70
|
+
],
|
|
71
|
+
auditActions: [
|
|
72
|
+
"license.issued",
|
|
73
|
+
"license.replaced",
|
|
74
|
+
"license.superseded",
|
|
75
|
+
"license.revocation-marked",
|
|
76
|
+
"license.note-corrected",
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
keys: {
|
|
80
|
+
feature: "license.key",
|
|
81
|
+
permission: "license.key.rotate",
|
|
82
|
+
entry: "operations",
|
|
83
|
+
apis: ["POST /api/keys/rotate", "POST /api/keys/:keyId/compatibility"],
|
|
84
|
+
auditActions: ["license.key.rotated", "license.key.compatibility-declared"],
|
|
85
|
+
},
|
|
86
|
+
operators: {
|
|
87
|
+
feature: "license.operator",
|
|
88
|
+
permission: "license.operator.manage",
|
|
89
|
+
entry: "administration",
|
|
90
|
+
apis: [
|
|
91
|
+
"GET /api/operators",
|
|
92
|
+
"POST /api/operators",
|
|
93
|
+
"PATCH /api/operators/:id",
|
|
94
|
+
],
|
|
95
|
+
auditActions: ["license.operator.created", "license.operator.updated"],
|
|
96
|
+
},
|
|
97
|
+
sessions: {
|
|
98
|
+
feature: "license.session",
|
|
99
|
+
permission: "license.session.revoke",
|
|
100
|
+
entry: "administration",
|
|
101
|
+
apis: ["POST /api/auth/sessions/:id/revoke"],
|
|
102
|
+
auditActions: ["auth.session.revoke"],
|
|
103
|
+
},
|
|
104
|
+
audit: {
|
|
105
|
+
feature: "license.audit",
|
|
106
|
+
permission: "license.audit.read",
|
|
107
|
+
entry: "administration",
|
|
108
|
+
apis: ["GET /api/audit-logs"],
|
|
109
|
+
auditActions: [],
|
|
110
|
+
},
|
|
111
|
+
} as const satisfies Record<
|
|
112
|
+
string,
|
|
113
|
+
{
|
|
114
|
+
feature: string;
|
|
115
|
+
permission: LicenseOperatorPermission;
|
|
116
|
+
entry: string;
|
|
117
|
+
apis: readonly string[];
|
|
118
|
+
auditActions: readonly string[];
|
|
119
|
+
}
|
|
120
|
+
>;
|
|
121
|
+
|
|
122
|
+
export interface LicenseConsoleCapability {
|
|
123
|
+
feature: string;
|
|
124
|
+
permission: LicenseOperatorPermission;
|
|
125
|
+
entry: string;
|
|
126
|
+
apis: readonly string[];
|
|
127
|
+
auditActions: readonly string[];
|
|
128
|
+
}
|
|
129
|
+
export function validateLicenseConsoleCapabilities(
|
|
130
|
+
items: readonly LicenseConsoleCapability[] = Object.values(
|
|
131
|
+
LICENSE_CONSOLE_CAPABILITIES,
|
|
132
|
+
),
|
|
133
|
+
): void {
|
|
134
|
+
const features = new Set<string>();
|
|
135
|
+
const permissions = new Set<string>();
|
|
136
|
+
const apis = new Set<string>();
|
|
137
|
+
for (const item of items) {
|
|
138
|
+
if (features.has(item.feature) || permissions.has(item.permission))
|
|
139
|
+
throw new Error("签发中心能力声明重复");
|
|
140
|
+
if (
|
|
141
|
+
item.permission !== item.feature &&
|
|
142
|
+
!item.permission.startsWith(`${item.feature}.`)
|
|
143
|
+
)
|
|
144
|
+
throw new Error("签发中心权限基础 Key 不匹配");
|
|
145
|
+
features.add(item.feature);
|
|
146
|
+
permissions.add(item.permission);
|
|
147
|
+
for (const api of item.apis) {
|
|
148
|
+
if (apis.has(api)) throw new Error("签发中心 API 声明重复");
|
|
149
|
+
apis.add(api);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function hasLicenseConsolePermission(
|
|
155
|
+
permissions: readonly string[],
|
|
156
|
+
permission: string,
|
|
157
|
+
): boolean {
|
|
158
|
+
return (
|
|
159
|
+
Object.values(LICENSE_CONSOLE_CAPABILITIES).some(
|
|
160
|
+
(item) => item.permission === permission,
|
|
161
|
+
) && permissions.includes(permission)
|
|
162
|
+
);
|
|
163
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
LicenseContractVersion,
|
|
3
|
+
LicenseCustomer,
|
|
4
|
+
LicenseIssueRecord,
|
|
5
|
+
LicenseNode,
|
|
6
|
+
LicenseProject,
|
|
7
|
+
LicenseReplacement,
|
|
8
|
+
LicenseV1Claims,
|
|
9
|
+
LicenseVersion,
|
|
10
|
+
} from "./license.js";
|
|
11
|
+
|
|
12
|
+
export interface LicenseIssueSummary {
|
|
13
|
+
id: string;
|
|
14
|
+
customerId: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
contractVersionId: string;
|
|
17
|
+
nodeId: string;
|
|
18
|
+
operatorId: string;
|
|
19
|
+
claims: LicenseV1Claims;
|
|
20
|
+
targetSoftwareVersion?: string;
|
|
21
|
+
predecessor?: LicenseReplacement;
|
|
22
|
+
successor?: LicenseReplacement;
|
|
23
|
+
revocationMarked: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface LicenseConsoleCollections {
|
|
26
|
+
customers: LicenseCustomer;
|
|
27
|
+
projects: LicenseProject;
|
|
28
|
+
contracts: LicenseContractVersion;
|
|
29
|
+
nodes: LicenseNode;
|
|
30
|
+
"license-versions": LicenseVersion;
|
|
31
|
+
licenses: LicenseIssueSummary;
|
|
32
|
+
}
|
|
33
|
+
export interface LicenseListQuery {
|
|
34
|
+
page: number;
|
|
35
|
+
pageSize: number;
|
|
36
|
+
q?: string;
|
|
37
|
+
customerId?: string;
|
|
38
|
+
projectId?: string;
|
|
39
|
+
status?: string;
|
|
40
|
+
contractVersionId?: string;
|
|
41
|
+
nodeId?: string;
|
|
42
|
+
machineCode?: string;
|
|
43
|
+
licenseVersionKey?: string;
|
|
44
|
+
issuedFrom?: string;
|
|
45
|
+
issuedTo?: string;
|
|
46
|
+
expiresFrom?: string;
|
|
47
|
+
expiresTo?: string;
|
|
48
|
+
expiresWithinDays?: 7 | 30 | 60;
|
|
49
|
+
}
|
|
50
|
+
export interface LicensePage<T> {
|
|
51
|
+
items: T[];
|
|
52
|
+
total: number;
|
|
53
|
+
page: number;
|
|
54
|
+
pageSize: number;
|
|
55
|
+
}
|
|
56
|
+
export interface LicenseNewNode {
|
|
57
|
+
code: string;
|
|
58
|
+
name: string;
|
|
59
|
+
purpose?: string;
|
|
60
|
+
machineCode: string;
|
|
61
|
+
}
|
|
62
|
+
export interface LicenseReviewCommand {
|
|
63
|
+
contractVersionId: string;
|
|
64
|
+
nodeId?: string;
|
|
65
|
+
newNode?: LicenseNewNode;
|
|
66
|
+
expiresAt: string;
|
|
67
|
+
softwareVersion: string;
|
|
68
|
+
replacementOfLicenseId?: string;
|
|
69
|
+
replacementReason?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface LicenseReviewConfirmation {
|
|
72
|
+
customer: LicenseCustomer;
|
|
73
|
+
project: LicenseProject;
|
|
74
|
+
contract: LicenseContractVersion;
|
|
75
|
+
licenseVersion: LicenseVersion;
|
|
76
|
+
node: LicenseNewNode;
|
|
77
|
+
keyId: string;
|
|
78
|
+
expiresAt: string;
|
|
79
|
+
softwareVersion: string;
|
|
80
|
+
replacementOfLicenseId?: string;
|
|
81
|
+
replacementReason?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface LicenseReviewResult {
|
|
84
|
+
reviewDigest: string;
|
|
85
|
+
confirmation: LicenseReviewConfirmation;
|
|
86
|
+
blockingReasons: string[];
|
|
87
|
+
}
|
|
88
|
+
export interface LicenseRequestStatus {
|
|
89
|
+
status: "processing" | "failed" | "completed";
|
|
90
|
+
licenseId: string;
|
|
91
|
+
result?: LicenseIssueRecord;
|
|
92
|
+
error?: { code: string; reason: string };
|
|
93
|
+
retryAfterSeconds?: number;
|
|
94
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EntityId, ISODateTime } from "./primitives.js";
|
|
2
2
|
|
|
3
3
|
export * from "./license-legacy.js";
|
|
4
|
+
export * from "./license-console.js";
|
|
4
5
|
|
|
5
6
|
declare const entitlementKeyBrand: unique symbol;
|
|
6
7
|
declare const licenseVersionKeyBrand: unique symbol;
|
|
@@ -132,6 +133,8 @@ export interface LicenseProject {
|
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
export interface LicenseContractVersion {
|
|
136
|
+
predecessorId?: EntityId;
|
|
137
|
+
issuedCount?: number;
|
|
135
138
|
id: EntityId;
|
|
136
139
|
projectId: EntityId;
|
|
137
140
|
contractNumber: string;
|
|
@@ -147,6 +150,7 @@ export interface LicenseContractVersion {
|
|
|
147
150
|
}
|
|
148
151
|
|
|
149
152
|
export interface LicenseNode {
|
|
153
|
+
issuedCount?: number;
|
|
150
154
|
id: EntityId;
|
|
151
155
|
projectId: EntityId;
|
|
152
156
|
code: string;
|
|
@@ -200,6 +204,7 @@ export type LicenseOperatorRole =
|
|
|
200
204
|
|
|
201
205
|
export type LicenseOperatorPermission =
|
|
202
206
|
| "license.record.read"
|
|
207
|
+
| "license.audit.read"
|
|
203
208
|
| "license.issue"
|
|
204
209
|
| "license.project.manage"
|
|
205
210
|
| "license.key.rotate"
|