create-windy 0.2.33 → 0.3.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 +173 -17
- package/package.json +1 -1
- package/template/.agents/skills/windy-business-module/SKILL.md +10 -1
- package/template/.windy-template.json +2 -2
- package/template/AGENTS.md +9 -0
- package/template/README.md +3 -1
- package/template/apps/agent-server/Dockerfile +1 -0
- package/template/apps/agent-server/README.md +28 -5
- package/template/apps/agent-server/adk_web_agents/__init__.py +1 -0
- package/template/apps/agent-server/adk_web_agents/safe_debug/__init__.py +3 -0
- package/template/apps/agent-server/adk_web_agents/safe_debug/agent.py +40 -0
- package/template/apps/agent-server/pyproject.toml +1 -1
- package/template/apps/agent-server/src/southwind_agent_server/adk_adapter.py +191 -16
- package/template/apps/agent-server/src/southwind_agent_server/adk_failure.py +13 -0
- package/template/apps/agent-server/src/southwind_agent_server/adk_model.py +225 -0
- package/template/apps/agent-server/src/southwind_agent_server/adk_tools.py +76 -0
- package/template/apps/agent-server/src/southwind_agent_server/app.py +63 -3
- package/template/apps/agent-server/src/southwind_agent_server/contracts.py +35 -0
- package/template/apps/agent-server/src/southwind_agent_server/engine.py +2 -0
- package/template/apps/agent-server/src/southwind_agent_server/openai_engine.py +31 -3
- package/template/apps/agent-server/src/southwind_agent_server/openai_provider.py +22 -9
- package/template/apps/agent-server/src/southwind_agent_server/provider_audit.py +144 -0
- package/template/apps/agent-server/src/southwind_agent_server/provider_governance.py +227 -0
- package/template/apps/agent-server/src/southwind_agent_server/service.py +1 -0
- package/template/apps/agent-server/tests/test_adk_adapter.py +305 -0
- package/template/apps/agent-server/tests/test_adk_web_agent.py +12 -0
- package/template/apps/agent-server/tests/test_api.py +16 -1
- package/template/apps/agent-server/tests/test_openai_provider.py +79 -0
- package/template/apps/agent-server/tests/test_provider_governance.py +215 -0
- package/template/apps/server/package.json +4 -1
- package/template/apps/server/src/agent/provider-input-governance.test.ts +82 -0
- package/template/apps/server/src/agent/provider-input-governance.ts +140 -0
- package/template/apps/server/src/agent/remote-runtime.test.ts +22 -0
- package/template/apps/server/src/agent/remote-runtime.ts +1 -0
- package/template/apps/server/src/agent/run-contracts.ts +2 -0
- package/template/apps/server/src/agent/run-facade.test.ts +52 -2
- package/template/apps/server/src/agent/run-facade.ts +38 -9
- package/template/apps/server/src/agent/tool-registry.ts +2 -6
- package/template/apps/server/src/application-services.ts +50 -0
- package/template/apps/server/src/audit/drizzle-log-store.ts +25 -0
- package/template/apps/server/src/audit/search-summary.ts +2 -6
- package/template/apps/server/src/auth/credential-restriction.ts +1 -0
- package/template/apps/server/src/auth/password.ts +30 -21
- package/template/apps/server/src/auth/routes.test.ts +44 -3
- package/template/apps/server/src/auth/routes.ts +6 -1
- package/template/apps/server/src/auth/runtime.ts +4 -1
- package/template/apps/server/src/auth/service.ts +25 -7
- package/template/apps/server/src/configuration/bootstrap.ts +20 -1
- package/template/apps/server/src/configuration/definition.test.ts +71 -0
- package/template/apps/server/src/configuration/definition.ts +242 -12
- package/template/apps/server/src/configuration/drizzle-repository.ts +36 -2
- package/template/apps/server/src/configuration/repository.ts +27 -2
- package/template/apps/server/src/configuration/routes.ts +4 -1
- package/template/apps/server/src/configuration/service.test.ts +100 -0
- package/template/apps/server/src/configuration/service.ts +50 -10
- package/template/apps/server/src/data-access/scoped-repository.integration.test.ts +3 -2
- package/template/apps/server/src/data-governance/export/service.ts +2 -6
- package/template/apps/server/src/example-modules.ts +4 -1
- package/template/apps/server/src/guards.ts +18 -5
- package/template/apps/server/src/http/request-source.test.ts +85 -0
- package/template/apps/server/src/http/request-source.ts +90 -0
- package/template/apps/server/src/index.ts +45 -45
- package/template/apps/server/src/license/routes.ts +2 -0
- package/template/apps/server/src/license/runtime-service.ts +10 -11
- package/template/apps/server/src/module-bootstrap.ts +2 -2
- package/template/apps/server/src/module-host/initialize-contracts.ts +6 -0
- package/template/apps/server/src/module-host/initialize.ts +30 -44
- package/template/apps/server/src/module-host/request-context.ts +29 -23
- package/template/apps/server/src/module-host/resource-file-policies.test.ts +197 -0
- package/template/apps/server/src/module-host/resource-file-policies.ts +108 -0
- package/template/apps/server/src/module-host/route-declaration.ts +45 -0
- package/template/apps/server/src/module-host/route-installer.ts +27 -3
- package/template/apps/server/src/module-host/storage-port.test.ts +170 -1
- package/template/apps/server/src/module-host/storage-port.ts +134 -1
- package/template/apps/server/src/module-host/storage-scope.ts +89 -0
- package/template/apps/server/src/module-host/tool-handlers.test.ts +305 -0
- package/template/apps/server/src/module-host/tool-handlers.ts +38 -4
- package/template/apps/server/src/module-host/user-directory-composition.test.ts +126 -0
- package/template/apps/server/src/module-host/user-directory-port.test.ts +238 -0
- package/template/apps/server/src/module-host/user-directory-port.ts +139 -0
- package/template/apps/server/src/module-host.ts +4 -0
- package/template/apps/server/src/notification/channel-adapter.ts +46 -0
- package/template/apps/server/src/notification/delivery-policy.test.ts +59 -0
- package/template/apps/server/src/notification/delivery-policy.ts +37 -0
- package/template/apps/server/src/notification/delivery-repository.ts +198 -0
- package/template/apps/server/src/notification/delivery-worker.test.ts +87 -0
- package/template/apps/server/src/notification/delivery-worker.ts +88 -0
- package/template/apps/server/src/notification/drizzle-management.ts +180 -0
- package/template/apps/server/src/notification/drizzle-query.ts +160 -0
- package/template/apps/server/src/notification/drizzle-repository.integration.test.ts +301 -0
- package/template/apps/server/src/notification/drizzle-repository.ts +156 -90
- package/template/apps/server/src/notification/extension-routes.test.ts +119 -0
- package/template/apps/server/src/notification/extension-routes.ts +111 -0
- package/template/apps/server/src/notification/memory-delivery-repository.ts +137 -0
- package/template/apps/server/src/notification/memory-support.ts +72 -0
- package/template/apps/server/src/notification/preference-repository.ts +95 -0
- package/template/apps/server/src/notification/recipient-directory.ts +104 -0
- package/template/apps/server/src/notification/repository.test.ts +171 -0
- package/template/apps/server/src/notification/repository.ts +179 -32
- package/template/apps/server/src/notification/revision-routes.test.ts +186 -0
- package/template/apps/server/src/notification/route-support.ts +225 -0
- package/template/apps/server/src/notification/routes.test.ts +182 -0
- package/template/apps/server/src/notification/routes.ts +225 -132
- package/template/apps/server/src/notification/service.test.ts +104 -0
- package/template/apps/server/src/notification/service.ts +140 -0
- package/template/apps/server/src/notification/smtp-adapter.test.ts +65 -0
- package/template/apps/server/src/notification/smtp-adapter.ts +68 -0
- package/template/apps/server/src/persistence.integration.test.ts +41 -2
- package/template/apps/server/src/route-guards.ts +1 -0
- package/template/apps/server/src/runtime-audit-list.test.ts +39 -0
- package/template/apps/server/src/runtime-development.ts +2 -0
- package/template/apps/server/src/runtime.test.ts +23 -9
- package/template/apps/server/src/runtime.ts +39 -2
- package/template/apps/server/src/scheduler/audit.ts +2 -11
- package/template/apps/server/src/scheduler/definitions.test.ts +6 -0
- package/template/apps/server/src/scheduler/definitions.ts +7 -0
- package/template/apps/server/src/scheduler/recovery-service.ts +2 -11
- package/template/apps/server/src/scheduler/routes.ts +2 -7
- package/template/apps/server/src/search/opensearch-client.test.ts +45 -0
- package/template/apps/server/src/search/opensearch-client.ts +145 -0
- package/template/apps/server/src/search/service.ts +2 -6
- package/template/apps/server/src/settings/routes.ts +15 -3
- package/template/apps/server/src/settings/runtime.ts +10 -1
- package/template/apps/server/src/storage/runtime.ts +13 -0
- package/template/apps/server/src/system/audit-query.ts +33 -4
- package/template/apps/server/src/system/audit-routes.test.ts +58 -4
- package/template/apps/server/src/system/audit-routes.ts +6 -5
- package/template/apps/server/src/system/built-in-roles.ts +1 -0
- package/template/apps/server/src/system/department-organization.ts +320 -0
- package/template/apps/server/src/system/department-routes.test.ts +207 -48
- package/template/apps/server/src/system/department-routes.ts +114 -33
- package/template/apps/server/src/system/drizzle-repository.ts +15 -7
- package/template/apps/server/src/system/drizzle-scoped-repository.ts +5 -3
- package/template/apps/server/src/system/drizzle-system.ts +37 -9
- package/template/apps/server/src/system/drizzle-transaction-context.ts +14 -0
- package/template/apps/server/src/system/identity-route-config.ts +7 -2
- package/template/apps/server/src/system/mutation-runner.ts +23 -0
- package/template/apps/server/src/system/organization-postgres.integration.test.ts +176 -0
- package/template/apps/server/src/system/resource-access-response.ts +12 -6
- package/template/apps/server/src/system/role-department-scope-policy.ts +55 -0
- package/template/apps/server/src/system/route-helpers.ts +2 -5
- package/template/apps/server/src/system/route-types.ts +12 -3
- package/template/apps/server/src/system/routes-validation.test.ts +26 -0
- package/template/apps/server/src/system/routes.test.ts +10 -2
- package/template/apps/server/src/system/routes.ts +70 -36
- package/template/apps/server/src/system/seed.ts +7 -0
- package/template/apps/server/src/work-order/data-scope.integration.test.ts +9 -2
- package/template/apps/server/src/work-order/opensearch-index.test.ts +97 -0
- package/template/apps/server/src/work-order/opensearch-index.ts +313 -0
- package/template/apps/server/src/work-order/search-provider.ts +60 -1
- package/template/apps/server/src/work-order/service.ts +42 -10
- package/template/apps/web/src/app/error-pages.ts +9 -0
- package/template/apps/web/src/components/auth/PasswordChangeForm.vue +16 -11
- package/template/apps/web/src/components/auth/PasswordChangeForm.webtest.ts +14 -0
- package/template/apps/web/src/components/common/FormDialog.vue +16 -2
- package/template/apps/web/src/components/common/ModalLayout.webtest.ts +20 -1
- package/template/apps/web/src/composables/useGlobalSearch.ts +68 -0
- package/template/apps/web/src/composables/usePlatformSettings.ts +8 -7
- package/template/apps/web/src/layout/GlobalSearchResults.vue +58 -0
- package/template/apps/web/src/layout/NavigationSearchDialog.vue +42 -6
- package/template/apps/web/src/layout/NavigationSearchDialog.webtest.ts +71 -0
- package/template/apps/web/src/layout/NotificationMenu.vue +73 -31
- package/template/apps/web/src/layout/NotificationMenu.webtest.ts +44 -1
- package/template/apps/web/src/layout/NotificationMenuItem.vue +61 -0
- package/template/apps/web/src/layout/NotificationPreferencesDialog.vue +181 -0
- package/template/apps/web/src/layout/NotificationPreferencesDialog.webtest.ts +80 -0
- package/template/apps/web/src/lib/date-time.ts +22 -10
- package/template/apps/web/src/lib/date-time.webtest.ts +9 -1
- package/template/apps/web/src/main.ts +14 -1
- package/template/apps/web/src/pages/auth/ChangePasswordPage.vue +16 -1
- package/template/apps/web/src/pages/configuration/components/ModuleConfigVersionList.vue +1 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationEditor.vue +10 -0
- package/template/apps/web/src/pages/configuration/components/ModuleConfigurationWorkbench.vue +37 -6
- package/template/apps/web/src/pages/errors/PlatformErrorPage.vue +115 -0
- package/template/apps/web/src/pages/errors/PlatformErrorPage.webtest.ts +44 -0
- package/template/apps/web/src/pages/errors/error-page-extension.ts +26 -0
- package/template/apps/web/src/pages/system/SystemNotificationsPage.vue +136 -68
- package/template/apps/web/src/pages/system/SystemNotificationsPage.webtest.ts +224 -12
- package/template/apps/web/src/pages/system/audit-log-presenter.ts +86 -0
- package/template/apps/web/src/pages/system/audit-time-range.ts +28 -0
- package/template/apps/web/src/pages/system/components/AuditActionCell.vue +10 -69
- package/template/apps/web/src/pages/system/components/AuditActionCell.webtest.ts +20 -27
- package/template/apps/web/src/pages/system/components/AuditLogDetailDialog.vue +134 -0
- package/template/apps/web/src/pages/system/components/AuditLogDetailDialog.webtest.ts +76 -0
- package/template/apps/web/src/pages/system/components/AuditLogFilters.vue +116 -52
- package/template/apps/web/src/pages/system/components/AuditLogFilters.webtest.ts +52 -15
- package/template/apps/web/src/pages/system/components/NotificationHistoryDialog.vue +129 -0
- package/template/apps/web/src/pages/system/components/NotificationManagementCard.vue +91 -0
- package/template/apps/web/src/pages/system/components/NotificationPublishDialog.vue +121 -0
- package/template/apps/web/src/pages/system/components/NotificationPublishForm.vue +162 -1
- package/template/apps/web/src/pages/system/components/SystemResourceActions.vue +68 -0
- package/template/apps/web/src/pages/system/components/SystemResourceEditor.vue +74 -0
- package/template/apps/web/src/pages/system/components/SystemResourceFilters.vue +3 -4
- package/template/apps/web/src/pages/system/components/SystemResourcePage.vue +91 -98
- package/template/apps/web/src/pages/system/components/SystemResourcePage.webtest.ts +68 -0
- package/template/apps/web/src/pages/system/components/SystemResourceTable.vue +20 -1
- package/template/apps/web/src/pages/system/components/SystemResourceTable.webtest.ts +28 -7
- package/template/apps/web/src/pages/system/components/department/DepartmentOrganizationForm.vue +210 -0
- package/template/apps/web/src/pages/system/components/department/DepartmentTransitionDialog.vue +112 -0
- package/template/apps/web/src/pages/system/components/user-account/UserAccountForm.vue +17 -4
- package/template/apps/web/src/pages/system/composables/useDepartmentTransitions.ts +79 -0
- package/template/apps/web/src/pages/system/composables/useNotificationPermissions.ts +14 -0
- package/template/apps/web/src/pages/system/composables/useSystemResource.ts +2 -0
- package/template/apps/web/src/pages/system/composables/useSystemResource.webtest.ts +15 -2
- package/template/apps/web/src/pages/system/resource-config.ts +12 -4
- package/template/apps/web/src/router/error-navigation.ts +50 -0
- package/template/apps/web/src/router/error-navigation.webtest.ts +106 -0
- package/template/apps/web/src/router/index.ts +71 -0
- package/template/apps/web/src/router/index.webtest.ts +29 -0
- package/template/apps/web/src/router/manifest-routes.webtest.ts +4 -0
- package/template/apps/web/src/router/shared-scaffold-neutrality.webtest.ts +12 -0
- package/template/apps/web/src/services/auth-api.ts +5 -0
- package/template/apps/web/src/services/http.ts +43 -6
- package/template/apps/web/src/services/http.webtest.ts +70 -0
- package/template/apps/web/src/services/notification-api.ts +85 -2
- package/template/apps/web/src/services/notification-api.webtest.ts +110 -0
- package/template/apps/web/src/services/search-api.ts +39 -0
- package/template/apps/web/src/services/system-api.ts +18 -0
- package/template/apps/web/vitest.config.ts +1 -0
- package/template/docker-compose.yml +68 -0
- package/template/docs/architecture/ai-egress.md +49 -7
- package/template/docs/architecture/ai-runtime.md +34 -6
- package/template/docs/architecture/data-scope-query-enforcement.md +4 -0
- package/template/docs/architecture/object-storage.md +22 -2
- package/template/docs/architecture/search-provider-protocol.md +38 -2
- package/template/docs/development/custom-error-pages.md +78 -0
- package/template/docs/development/custom-login-page.md +3 -3
- package/template/docs/platform/agent-runtime.md +76 -7
- package/template/docs/platform/audit-reliability.md +46 -2
- package/template/docs/platform/business-user-directory.md +82 -0
- package/template/docs/platform/module-configuration.md +13 -4
- package/template/docs/platform/notifications.md +67 -11
- package/template/docs/platform/organization-membership.md +17 -3
- package/template/docs/platform/system-crud-api.md +16 -0
- package/template/docs/platform/web-system-crud.md +6 -2
- package/template/package.json +4 -0
- package/template/packages/config/index.test.ts +45 -0
- package/template/packages/config/package.json +1 -1
- package/template/packages/config/src/platform.ts +169 -48
- package/template/packages/database/drizzle/0035_material_nightshade.sql +10 -0
- package/template/packages/database/drizzle/0036_hesitant_speed.sql +35 -0
- package/template/packages/database/drizzle/0037_absent_nick_fury.sql +2 -0
- package/template/packages/database/drizzle/0038_uneven_wasp.sql +38 -0
- package/template/packages/database/drizzle/meta/0035_snapshot.json +7331 -0
- package/template/packages/database/drizzle/meta/0036_snapshot.json +7436 -0
- package/template/packages/database/drizzle/meta/0037_snapshot.json +7457 -0
- package/template/packages/database/drizzle/meta/0038_snapshot.json +7749 -0
- package/template/packages/database/drizzle/meta/_journal.json +28 -0
- package/template/packages/database/package.json +1 -1
- package/template/packages/database/src/schema/identity.ts +7 -0
- package/template/packages/database/src/schema/notifications.ts +135 -0
- package/template/packages/database/src/schema-notification-delivery.test.ts +54 -0
- package/template/packages/database/src/schema-workflow-notification.test.ts +40 -1
- package/template/packages/modules/package.json +1 -1
- package/template/packages/modules/src/ai-operation-composition.test.ts +68 -0
- package/template/packages/modules/src/ai-operation-composition.ts +115 -0
- package/template/packages/modules/src/manifest.ts +26 -0
- package/template/packages/modules/src/provider-data-policy-composition.test.ts +74 -0
- package/template/packages/modules/src/system-api-permissions.ts +54 -0
- package/template/packages/modules/src/system-audit-actions.ts +15 -0
- package/template/packages/modules/src/system-features.ts +6 -1
- package/template/packages/modules/src/system-module-catalog.test.ts +16 -0
- package/template/packages/modules/src/system-module-catalog.ts +28 -4
- package/template/packages/modules/src/system-modules.test.ts +13 -1
- package/template/packages/modules/src/system-modules.ts +12 -0
- package/template/packages/modules/src/system-permissions.ts +11 -5
- package/template/packages/server-sdk/index.ts +11 -0
- package/template/packages/server-sdk/package.json +3 -2
- package/template/packages/server-sdk/src/ai-operation-registration.ts +2 -1
- package/template/packages/server-sdk/src/module-host.ts +8 -0
- package/template/packages/server-sdk/src/request-context.ts +2 -0
- package/template/packages/server-sdk/src/storage-port.ts +66 -0
- package/template/packages/server-sdk/src/tool-registration.ts +6 -0
- package/template/packages/server-sdk/src/user-directory-port.ts +42 -0
- package/template/packages/shared/package.json +1 -1
- package/template/packages/shared/src/audit.ts +25 -0
- package/template/packages/shared/src/module-configuration.ts +5 -0
- package/template/packages/shared/src/notification.ts +92 -1
- package/template/packages/shared/src/password.ts +7 -2
- package/template/packages/shared/src/platform-settings.ts +2 -0
- package/template/packages/storage/package.json +1 -1
- package/template/packages/storage/src/upload-service.test.ts +16 -0
- package/template/packages/storage/src/upload-service.ts +5 -1
- package/template/scripts/notification-postgres-regression.ts +27 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { validateProviderDataPolicy } from "./ai-operation-composition.js";
|
|
3
|
+
import type { ModuleAiOperationDefinition } from "./manifest.js";
|
|
4
|
+
|
|
5
|
+
describe("Provider 输入字段 Schema", () => {
|
|
6
|
+
test.each(["/bad~2escape", "/__proto__/polluted", "/constructor/value"])(
|
|
7
|
+
"拒绝危险或非法 JSON Pointer:%s",
|
|
8
|
+
(jsonPointer) => {
|
|
9
|
+
expect(() =>
|
|
10
|
+
validateProviderDataPolicy(operation([jsonPointer])),
|
|
11
|
+
).toThrow("JSON Pointer 无效");
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
test("拒绝父子重叠路径,避免规则顺序改变结果", () => {
|
|
16
|
+
expect(() =>
|
|
17
|
+
validateProviderDataPolicy(operation(["/case", "/case/name"])),
|
|
18
|
+
).toThrow("不能父子重叠");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("使用 Tool 时要求声明定义、上一轮输出和 Tool 结果", () => {
|
|
22
|
+
expect(() =>
|
|
23
|
+
validateProviderDataPolicy(operation(["/question"], ["business.query"])),
|
|
24
|
+
).toThrow("使用 Tool 时");
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
function operation(
|
|
29
|
+
inputPointers: readonly string[],
|
|
30
|
+
allowedToolKeys: readonly string[] = [],
|
|
31
|
+
): ModuleAiOperationDefinition {
|
|
32
|
+
return {
|
|
33
|
+
key: "business.answer",
|
|
34
|
+
kind: "agent",
|
|
35
|
+
featureKey: "business.ai",
|
|
36
|
+
permissionKey: "business.ai.execute",
|
|
37
|
+
auditAction: "business.ai.execute",
|
|
38
|
+
inputSchemaKey: "business.input.v1",
|
|
39
|
+
outputSchemaKey: "business.output.v1",
|
|
40
|
+
requiredCapabilities: ["text-generation"],
|
|
41
|
+
allowedToolKeys,
|
|
42
|
+
dataClassification: "internal",
|
|
43
|
+
execution: "streaming",
|
|
44
|
+
providerEgress: {
|
|
45
|
+
mode: "configured-endpoint",
|
|
46
|
+
deploymentKey: "ai.openai-compatible",
|
|
47
|
+
},
|
|
48
|
+
providerDataPolicy: {
|
|
49
|
+
inputFields: inputPointers.map((jsonPointer) => ({
|
|
50
|
+
jsonPointer,
|
|
51
|
+
classification: "internal",
|
|
52
|
+
dlpAction: "redact",
|
|
53
|
+
})),
|
|
54
|
+
envelopeFields: [
|
|
55
|
+
{
|
|
56
|
+
field: "instructions",
|
|
57
|
+
classification: "internal",
|
|
58
|
+
dlpAction: "reject",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
field: "user-prompt",
|
|
62
|
+
classification: "internal",
|
|
63
|
+
dlpAction: "redact",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
toolNetworkPolicy: { mode: "forbidden" },
|
|
68
|
+
limits: {
|
|
69
|
+
maxDurationSeconds: 60,
|
|
70
|
+
maxInputBytes: 4096,
|
|
71
|
+
maxOutputBytes: 4096,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -61,6 +61,12 @@ export function systemApiPermissionBindings(): ApiPermissionBinding[] {
|
|
|
61
61
|
"system.department.create",
|
|
62
62
|
"system.rbac",
|
|
63
63
|
),
|
|
64
|
+
binding(
|
|
65
|
+
"POST",
|
|
66
|
+
"/api/system/departments/:id/transition",
|
|
67
|
+
"system.department.manage",
|
|
68
|
+
"system.rbac",
|
|
69
|
+
),
|
|
64
70
|
binding("GET", "/api/system/menus", "system.menu.read", "system.rbac"),
|
|
65
71
|
binding(
|
|
66
72
|
"GET",
|
|
@@ -226,12 +232,48 @@ export function systemApiPermissionBindings(): ApiPermissionBinding[] {
|
|
|
226
232
|
"system.notification.read",
|
|
227
233
|
"system.notification",
|
|
228
234
|
),
|
|
235
|
+
binding(
|
|
236
|
+
"GET",
|
|
237
|
+
"/api/notifications/preferences",
|
|
238
|
+
"system.notification.read",
|
|
239
|
+
"system.notification",
|
|
240
|
+
),
|
|
241
|
+
binding(
|
|
242
|
+
"PUT",
|
|
243
|
+
"/api/notifications/preferences",
|
|
244
|
+
"system.notification.read",
|
|
245
|
+
"system.notification",
|
|
246
|
+
),
|
|
229
247
|
binding(
|
|
230
248
|
"POST",
|
|
231
249
|
"/api/notifications/:id/read",
|
|
232
250
|
"system.notification.read",
|
|
233
251
|
"system.notification",
|
|
234
252
|
),
|
|
253
|
+
binding(
|
|
254
|
+
"PUT",
|
|
255
|
+
"/api/notifications/:id/favorite",
|
|
256
|
+
"system.notification.read",
|
|
257
|
+
"system.notification",
|
|
258
|
+
),
|
|
259
|
+
binding(
|
|
260
|
+
"DELETE",
|
|
261
|
+
"/api/notifications/:id/favorite",
|
|
262
|
+
"system.notification.read",
|
|
263
|
+
"system.notification",
|
|
264
|
+
),
|
|
265
|
+
binding(
|
|
266
|
+
"GET",
|
|
267
|
+
"/api/system/notifications/audience-options",
|
|
268
|
+
"system.notification.manage",
|
|
269
|
+
"system.notification",
|
|
270
|
+
),
|
|
271
|
+
binding(
|
|
272
|
+
"GET",
|
|
273
|
+
"/api/system/notifications/:id/deliveries",
|
|
274
|
+
"system.notification.manage",
|
|
275
|
+
"system.notification",
|
|
276
|
+
),
|
|
235
277
|
binding(
|
|
236
278
|
"GET",
|
|
237
279
|
"/api/system/notifications",
|
|
@@ -244,6 +286,18 @@ export function systemApiPermissionBindings(): ApiPermissionBinding[] {
|
|
|
244
286
|
"system.notification.manage",
|
|
245
287
|
"system.notification",
|
|
246
288
|
),
|
|
289
|
+
binding(
|
|
290
|
+
"PUT",
|
|
291
|
+
"/api/system/notifications/:id",
|
|
292
|
+
"system.notification.update",
|
|
293
|
+
"system.notification",
|
|
294
|
+
),
|
|
295
|
+
binding(
|
|
296
|
+
"GET",
|
|
297
|
+
"/api/system/notifications/:id/revisions",
|
|
298
|
+
"system.notification.manage",
|
|
299
|
+
"system.notification",
|
|
300
|
+
),
|
|
247
301
|
binding(
|
|
248
302
|
"DELETE",
|
|
249
303
|
"/api/system/notifications/:id",
|
|
@@ -8,6 +8,11 @@ export const systemAuditActions: ModuleManifest["auditActions"] = [
|
|
|
8
8
|
"crud.create",
|
|
9
9
|
"crud.update",
|
|
10
10
|
"crud.delete",
|
|
11
|
+
{
|
|
12
|
+
key: "system.user-directory.query",
|
|
13
|
+
label: "查询业务用户目录",
|
|
14
|
+
description: "业务模块在平台授权与数据范围内查询启用用户最小投影。",
|
|
15
|
+
},
|
|
11
16
|
// @windy-module system.configuration begin
|
|
12
17
|
"config.update",
|
|
13
18
|
"config.rollback",
|
|
@@ -17,9 +22,19 @@ export const systemAuditActions: ModuleManifest["auditActions"] = [
|
|
|
17
22
|
// @windy-module system.license end
|
|
18
23
|
"feature.update",
|
|
19
24
|
"menu.structure.update",
|
|
25
|
+
{
|
|
26
|
+
key: "organization.department.transition",
|
|
27
|
+
label: "处置部门组织",
|
|
28
|
+
description: "迁移部门关联后停用或删除部门。",
|
|
29
|
+
},
|
|
20
30
|
// @windy-module system.notification begin
|
|
21
31
|
"notification.publish",
|
|
32
|
+
"notification.schedule",
|
|
33
|
+
"notification.preference.update",
|
|
34
|
+
"notification.update",
|
|
22
35
|
"notification.read",
|
|
36
|
+
"notification.favorite",
|
|
37
|
+
"notification.unfavorite",
|
|
23
38
|
"notification.archive",
|
|
24
39
|
// @windy-module system.notification end
|
|
25
40
|
// @windy-module system.workflow begin
|
|
@@ -17,6 +17,11 @@ export const systemFeatures: ModuleManifest["features"] = [
|
|
|
17
17
|
"RBAC 权限链路",
|
|
18
18
|
"用户、角色、权限点与数据范围的统一访问控制链路。",
|
|
19
19
|
),
|
|
20
|
+
feature(
|
|
21
|
+
"system.user-directory",
|
|
22
|
+
"业务用户目录",
|
|
23
|
+
"向获授权业务模块提供受数据范围约束的启用用户最小只读投影。",
|
|
24
|
+
),
|
|
20
25
|
feature(
|
|
21
26
|
"system.profile",
|
|
22
27
|
"个人设置",
|
|
@@ -85,7 +90,7 @@ export const systemFeatures: ModuleManifest["features"] = [
|
|
|
85
90
|
feature(
|
|
86
91
|
"system.notification",
|
|
87
92
|
"站内通知",
|
|
88
|
-
"
|
|
93
|
+
"站内通知发布、修改历史、阅读、收藏和已读状态闭环。",
|
|
89
94
|
),
|
|
90
95
|
// @windy-module system.notification end
|
|
91
96
|
// @windy-module system.workflow begin
|
|
@@ -116,6 +116,22 @@ describe("系统能力模块目录", () => {
|
|
|
116
116
|
"system.workflow.timeout-dispatch",
|
|
117
117
|
]);
|
|
118
118
|
expect(identity.dataPolicies).toEqual([]);
|
|
119
|
+
expect(identity.features.map(({ key }) => key)).toContain(
|
|
120
|
+
"system.user-directory",
|
|
121
|
+
);
|
|
122
|
+
expect(identity.permissions.map(({ key }) => key)).toContain(
|
|
123
|
+
"system.user-directory.read",
|
|
124
|
+
);
|
|
125
|
+
expect(
|
|
126
|
+
identity.auditActions.map((action) =>
|
|
127
|
+
typeof action === "string" ? action : action.key,
|
|
128
|
+
),
|
|
129
|
+
).toContain("system.user-directory.query");
|
|
130
|
+
expect(
|
|
131
|
+
systemFoundationModule().auditActions.map((action) =>
|
|
132
|
+
typeof action === "string" ? action : action.key,
|
|
133
|
+
),
|
|
134
|
+
).toContain("system.user-directory.query");
|
|
119
135
|
expect(
|
|
120
136
|
systemModuleManifest("system.data-governance").dataPolicies?.map(
|
|
121
137
|
({ key }) => key,
|
|
@@ -27,9 +27,17 @@ export const systemModuleDefinitions = [
|
|
|
27
27
|
version: "0.1.0",
|
|
28
28
|
label: "身份与权限",
|
|
29
29
|
description: "用户、角色、部门、菜单、字典、个人资料和数据范围。",
|
|
30
|
-
resources: [
|
|
30
|
+
resources: [
|
|
31
|
+
"user",
|
|
32
|
+
"user-directory",
|
|
33
|
+
"role",
|
|
34
|
+
"department",
|
|
35
|
+
"menu",
|
|
36
|
+
"dict",
|
|
37
|
+
"profile",
|
|
38
|
+
],
|
|
31
39
|
excludedPermissionKeys: ["system.user.reveal", "system.user.export"],
|
|
32
|
-
featureKeys: ["system.rbac", "system.profile"],
|
|
40
|
+
featureKeys: ["system.rbac", "system.user-directory", "system.profile"],
|
|
33
41
|
},
|
|
34
42
|
// @windy-module system.settings begin
|
|
35
43
|
{
|
|
@@ -116,7 +124,8 @@ export const systemModuleDefinitions = [
|
|
|
116
124
|
name: "system.notification",
|
|
117
125
|
version: "0.1.0",
|
|
118
126
|
label: "站内通知",
|
|
119
|
-
description:
|
|
127
|
+
description:
|
|
128
|
+
"通知定向与定时发布、用户偏好、外部渠道投递、修改历史、阅读、收藏和归档。",
|
|
120
129
|
resources: ["notification"],
|
|
121
130
|
featureKeys: ["system.notification"],
|
|
122
131
|
},
|
|
@@ -226,11 +235,26 @@ function createSystemCapabilityModule(
|
|
|
226
235
|
definition.name === "system.data-governance"
|
|
227
236
|
? aggregate.dataPolicies
|
|
228
237
|
: [],
|
|
229
|
-
auditActions: isCore
|
|
238
|
+
auditActions: isCore
|
|
239
|
+
? aggregate.auditActions.filter(
|
|
240
|
+
(action) => auditActionKey(action) !== "system.user-directory.query",
|
|
241
|
+
)
|
|
242
|
+
: definition.name === "system.identity"
|
|
243
|
+
? aggregate.auditActions.filter(
|
|
244
|
+
(action) =>
|
|
245
|
+
auditActionKey(action) === "system.user-directory.query",
|
|
246
|
+
)
|
|
247
|
+
: [],
|
|
230
248
|
metadata: { kind: "platform-capability" },
|
|
231
249
|
};
|
|
232
250
|
}
|
|
233
251
|
|
|
252
|
+
function auditActionKey(
|
|
253
|
+
action: ModuleManifest["auditActions"][number],
|
|
254
|
+
): string {
|
|
255
|
+
return typeof action === "string" ? action : action.key;
|
|
256
|
+
}
|
|
257
|
+
|
|
234
258
|
function permissionResource(permissionKey: string): string {
|
|
235
259
|
const parts = permissionKey.split(".");
|
|
236
260
|
return parts.length >= 3 ? parts.slice(1, -1).join(".") : "";
|
|
@@ -220,7 +220,7 @@ describe("系统模块能力注册", () => {
|
|
|
220
220
|
expect(catalogs).toEqual(["组织与权限", "平台配置", "安全与合规", "运维"]);
|
|
221
221
|
});
|
|
222
222
|
|
|
223
|
-
test("
|
|
223
|
+
test("部门创建与迁移处置绑定独立权限、Feature 和审计动作", () => {
|
|
224
224
|
const manifest = systemFoundationModule();
|
|
225
225
|
expect(
|
|
226
226
|
manifest.permissions.some(
|
|
@@ -234,6 +234,18 @@ describe("系统模块能力注册", () => {
|
|
|
234
234
|
featureKey: "system.rbac",
|
|
235
235
|
anonymous: undefined,
|
|
236
236
|
});
|
|
237
|
+
expect(manifest.apiPermissions).toContainEqual({
|
|
238
|
+
method: "POST",
|
|
239
|
+
path: "/api/system/departments/:id/transition",
|
|
240
|
+
permissionKey: "system.department.manage",
|
|
241
|
+
featureKey: "system.rbac",
|
|
242
|
+
anonymous: undefined,
|
|
243
|
+
});
|
|
244
|
+
expect(manifest.auditActions).toContainEqual(
|
|
245
|
+
expect.objectContaining({
|
|
246
|
+
key: "organization.department.transition",
|
|
247
|
+
}),
|
|
248
|
+
);
|
|
237
249
|
});
|
|
238
250
|
|
|
239
251
|
test("所有权限都由 Manifest 提供稳定中文分组元数据", () => {
|
|
@@ -270,6 +270,18 @@ export function systemFoundationModule(): ModuleManifest {
|
|
|
270
270
|
retryDelaySeconds: 30,
|
|
271
271
|
},
|
|
272
272
|
// @windy-module system.scheduler end
|
|
273
|
+
// @windy-module system.notification begin
|
|
274
|
+
{
|
|
275
|
+
key: "system.notification.dispatch",
|
|
276
|
+
label: "通知发布与外部投递",
|
|
277
|
+
description: "发布到期通知并领取持久投递队列,执行渠道重试。",
|
|
278
|
+
permissionKey: "system.notification.manage",
|
|
279
|
+
featureKey: "system.notification",
|
|
280
|
+
intervalSeconds: 5,
|
|
281
|
+
maxAttempts: 3,
|
|
282
|
+
retryDelaySeconds: 30,
|
|
283
|
+
},
|
|
284
|
+
// @windy-module system.notification end
|
|
273
285
|
// @windy-module system.bulk-data begin
|
|
274
286
|
{
|
|
275
287
|
key: "system.bulk-data.dispatch",
|
|
@@ -3,6 +3,7 @@ import type { ModuleManifest } from "./manifest.js";
|
|
|
3
3
|
const systemResourceLabels = {
|
|
4
4
|
admin: "管理面准入",
|
|
5
5
|
user: "用户管理",
|
|
6
|
+
"user-directory": "业务用户目录",
|
|
6
7
|
role: "角色与权限",
|
|
7
8
|
department: "部门组织",
|
|
8
9
|
menu: "菜单管理",
|
|
@@ -32,6 +33,7 @@ type SystemAction =
|
|
|
32
33
|
| "approve"
|
|
33
34
|
| "export"
|
|
34
35
|
| "reveal"
|
|
36
|
+
| "update"
|
|
35
37
|
| "manage";
|
|
36
38
|
|
|
37
39
|
function permission(
|
|
@@ -53,11 +55,13 @@ function permission(
|
|
|
53
55
|
? "新建"
|
|
54
56
|
: action === "approve"
|
|
55
57
|
? "处理"
|
|
56
|
-
: action === "
|
|
57
|
-
? "
|
|
58
|
-
: action === "
|
|
59
|
-
? "
|
|
60
|
-
: "
|
|
58
|
+
: action === "update"
|
|
59
|
+
? "修改"
|
|
60
|
+
: action === "reveal"
|
|
61
|
+
? "查看明文"
|
|
62
|
+
: action === "export"
|
|
63
|
+
? "治理导出"
|
|
64
|
+
: "管理",
|
|
61
65
|
module: "system",
|
|
62
66
|
moduleLabel: "系统基础设施",
|
|
63
67
|
resource,
|
|
@@ -75,6 +79,7 @@ export const systemPermissions: ModuleManifest["permissions"] = [
|
|
|
75
79
|
permission("user", "export", "governed-export"),
|
|
76
80
|
// @windy-module system.data-governance end
|
|
77
81
|
permission("user", "manage"),
|
|
82
|
+
permission("user-directory", "read"),
|
|
78
83
|
permission("role", "read"),
|
|
79
84
|
permission("role", "manage"),
|
|
80
85
|
permission("department", "read"),
|
|
@@ -123,6 +128,7 @@ export const systemPermissions: ModuleManifest["permissions"] = [
|
|
|
123
128
|
// @windy-module system.scheduler end
|
|
124
129
|
// @windy-module system.notification begin
|
|
125
130
|
permission("notification", "read"),
|
|
131
|
+
permission("notification", "update"),
|
|
126
132
|
permission("notification", "manage"),
|
|
127
133
|
// @windy-module system.notification end
|
|
128
134
|
// @windy-module system.bulk-data begin
|
|
@@ -32,9 +32,20 @@ export type {
|
|
|
32
32
|
ModuleSearchQuery,
|
|
33
33
|
} from "./src/search-provider-port.js";
|
|
34
34
|
export type {
|
|
35
|
+
ModuleOpenedResourceFile,
|
|
36
|
+
ModuleResourceFileAccessContext,
|
|
37
|
+
ModuleResourceFileAccessPolicy,
|
|
38
|
+
ModuleResourceFileRequest,
|
|
35
39
|
ModuleStoragePort,
|
|
36
40
|
ModuleUploadSessionInput,
|
|
37
41
|
} from "./src/storage-port.js";
|
|
42
|
+
export type {
|
|
43
|
+
ModuleUserDirectoryEntry,
|
|
44
|
+
ModuleUserDirectoryPage,
|
|
45
|
+
ModuleUserDirectoryPort,
|
|
46
|
+
ModuleUserDirectoryQuery,
|
|
47
|
+
} from "./src/user-directory-port.js";
|
|
48
|
+
export { ModuleUserDirectoryError } from "./src/user-directory-port.js";
|
|
38
49
|
export type {
|
|
39
50
|
ModuleTaskHandler,
|
|
40
51
|
ModuleTaskHandlerRegistration,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@southwind-ai/server-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"src/storage-port.ts",
|
|
22
22
|
"src/task-registration.ts",
|
|
23
23
|
"src/tool-registration.ts",
|
|
24
|
-
"src/tool-host-port.ts"
|
|
24
|
+
"src/tool-host-port.ts",
|
|
25
|
+
"src/user-directory-port.ts"
|
|
25
26
|
],
|
|
26
27
|
"scripts": {
|
|
27
28
|
"test": "bun test",
|
|
@@ -9,7 +9,8 @@ export interface ModuleAiOperationContext {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* 业务模块只接收 Manifest `providerDataPolicy.inputFields` allowlist 选出并完成
|
|
13
|
+
* DLP 的最小输入,再将其收敛为模型无关的指令和用户消息。
|
|
13
14
|
* Provider、Deployment、Secret、Execution Grant 与 Tool 授权均由宿主持有。
|
|
14
15
|
*/
|
|
15
16
|
export interface ModuleAiOperationPlan {
|
|
@@ -3,6 +3,7 @@ import type { ModuleAiOperationHandlerRegistration } from "./ai-operation-regist
|
|
|
3
3
|
import type { ModuleRolePreset } from "./role-preset.js";
|
|
4
4
|
import type { ModuleRouteDefinition } from "./route-definition.js";
|
|
5
5
|
import type { ModuleSearchProvider } from "./search-provider-port.js";
|
|
6
|
+
import type { ModuleResourceFileAccessPolicy } from "./storage-port.js";
|
|
6
7
|
import type { ModuleTaskHandlerRegistration } from "./task-registration.js";
|
|
7
8
|
import type { ModuleToolHandlerRegistration } from "./tool-registration.js";
|
|
8
9
|
|
|
@@ -25,6 +26,13 @@ export interface ModuleUploadPolicy {
|
|
|
25
26
|
export interface ModuleHost {
|
|
26
27
|
readonly moduleName: string;
|
|
27
28
|
registerUploadPolicy(policy: ModuleUploadPolicy): void;
|
|
29
|
+
/**
|
|
30
|
+
* 注册跨上传者资源文件读取策略;purpose 必须由本模块或 Manifest 显式依赖模块的
|
|
31
|
+
* Upload Policy 声明,Feature、Permission 与 Audit Action 必须来自当前 Manifest。
|
|
32
|
+
*/
|
|
33
|
+
registerResourceFileAccessPolicies(
|
|
34
|
+
policies: readonly ModuleResourceFileAccessPolicy[],
|
|
35
|
+
): void;
|
|
28
36
|
registerDurableHandler<T>(definition: DurableHandlerDefinition<T>): void;
|
|
29
37
|
/** 注册 Guarded API 路由;须与 Manifest `apiPermissions` 声明一致。 */
|
|
30
38
|
registerRoutes(routes: readonly ModuleRouteDefinition[]): void;
|
|
@@ -2,6 +2,7 @@ import type { ModuleActor } from "./actor.js";
|
|
|
2
2
|
import type { ModuleAuditEmitter } from "./audit-port.js";
|
|
3
3
|
import type { ModuleJobSubmitter } from "./jobs-port.js";
|
|
4
4
|
import type { ModuleStoragePort } from "./storage-port.js";
|
|
5
|
+
import type { ModuleUserDirectoryPort } from "./user-directory-port.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* 模块路由 Handler 的受限请求上下文。
|
|
@@ -18,4 +19,5 @@ export interface ModuleRequestContext {
|
|
|
18
19
|
readonly audit: ModuleAuditEmitter;
|
|
19
20
|
readonly jobs: ModuleJobSubmitter;
|
|
20
21
|
readonly storage: ModuleStoragePort;
|
|
22
|
+
readonly userDirectory: ModuleUserDirectoryPort;
|
|
21
23
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { OpenedFile, UploadSession } from "@southwind-ai/storage";
|
|
2
|
+
import type { ModuleActor } from "./actor.js";
|
|
2
3
|
|
|
3
4
|
export interface ModuleUploadSessionInput {
|
|
4
5
|
readonly purpose: string;
|
|
@@ -9,6 +10,62 @@ export interface ModuleUploadSessionInput {
|
|
|
9
10
|
readonly fileExpiresAt?: Date;
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
export interface ModuleResourceFileRequest {
|
|
14
|
+
/** 平台文件元数据 ID;不能是 ArtifactRef、对象存储 Key 或主机路径。 */
|
|
15
|
+
readonly fileId: string;
|
|
16
|
+
/**
|
|
17
|
+
* 必须与本模块或 Manifest 显式依赖模块注册的 Upload Policy,以及当前模块的
|
|
18
|
+
* 资源文件访问策略完全一致。
|
|
19
|
+
*/
|
|
20
|
+
readonly purpose: string;
|
|
21
|
+
/** 本模块命名空间内的稳定业务资源类型,例如 `evidence.file`。 */
|
|
22
|
+
readonly resourceType: string;
|
|
23
|
+
/** 由授权策略回查业务 Repository 的稳定资源 ID。 */
|
|
24
|
+
readonly resourceId: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** 资源授权读取仅返回业务所需的最小元数据与受限文件流。 */
|
|
28
|
+
export interface ModuleOpenedResourceFile {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly purpose: string;
|
|
31
|
+
readonly filename: string;
|
|
32
|
+
readonly mimeType: string;
|
|
33
|
+
readonly byteSize: number;
|
|
34
|
+
readonly sha256: string;
|
|
35
|
+
readonly body: ReadableStream<Uint8Array>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ModuleResourceFileAccessContext {
|
|
39
|
+
readonly actor: ModuleActor;
|
|
40
|
+
readonly requestId: string;
|
|
41
|
+
readonly signal: AbortSignal;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 业务模块注册的资源到平台文件关联授权策略。
|
|
46
|
+
*
|
|
47
|
+
* `authorize` 必须从 project-owned Repository 回查 resourceId,确认当前 Actor
|
|
48
|
+
* 可访问该业务资源且该资源实际绑定 fileId;客户端或 Tool 输入不是授权证据。
|
|
49
|
+
*/
|
|
50
|
+
export interface ModuleResourceFileAccessPolicy {
|
|
51
|
+
/**
|
|
52
|
+
* 本模块或 Manifest 显式依赖模块拥有的 Upload Policy purpose;
|
|
53
|
+
* 平台基础 purpose 与未声明跨模块 purpose 均不可引用。
|
|
54
|
+
*/
|
|
55
|
+
readonly purpose: string;
|
|
56
|
+
readonly resourceType: string;
|
|
57
|
+
readonly featureKey: string;
|
|
58
|
+
readonly permissionKey: string;
|
|
59
|
+
readonly auditAction: string;
|
|
60
|
+
authorize(
|
|
61
|
+
input: Readonly<{
|
|
62
|
+
fileId: string;
|
|
63
|
+
resourceId: string;
|
|
64
|
+
}>,
|
|
65
|
+
context: ModuleResourceFileAccessContext,
|
|
66
|
+
): Promise<boolean> | boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
12
69
|
/**
|
|
13
70
|
* 模块受限 Upload / BlobRead Port。
|
|
14
71
|
*
|
|
@@ -22,4 +79,13 @@ export interface ModuleStoragePort {
|
|
|
22
79
|
createUploadSession(input: ModuleUploadSessionInput): Promise<UploadSession>;
|
|
23
80
|
openFile(fileId: string): Promise<OpenedFile>;
|
|
24
81
|
openPublicFile(fileId: string, purpose: string): Promise<OpenedFile>;
|
|
82
|
+
/**
|
|
83
|
+
* 经 Host Feature / Permission 与业务资源策略双重授权后读取文件。
|
|
84
|
+
*
|
|
85
|
+
* 允许同一业务范围内跨上传者读取,但不授予任意 manage、Repository、BlobStore
|
|
86
|
+
* 或 ArtifactRef 能力。
|
|
87
|
+
*/
|
|
88
|
+
openResourceFile(
|
|
89
|
+
input: ModuleResourceFileRequest,
|
|
90
|
+
): Promise<ModuleOpenedResourceFile>;
|
|
25
91
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { ModuleActor } from "./actor.js";
|
|
2
2
|
import type { ModuleAiJsonValue } from "./ai-operation-registration.js";
|
|
3
|
+
import type { ModuleStoragePort } from "./storage-port.js";
|
|
3
4
|
|
|
4
5
|
export interface ModuleToolContext {
|
|
5
6
|
readonly actor: ModuleActor;
|
|
6
7
|
readonly requestId: string;
|
|
7
8
|
readonly signal: AbortSignal;
|
|
9
|
+
/**
|
|
10
|
+
* 与当前 Tool Actor、请求范围和模块命名空间绑定的受限存储 Port。
|
|
11
|
+
* Host 未安装 Storage 时为 fail-closed 实现。
|
|
12
|
+
*/
|
|
13
|
+
readonly storage: ModuleStoragePort;
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
export type ModuleToolInput = Readonly<Record<string, ModuleAiJsonValue>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface ModuleUserDirectoryQuery {
|
|
2
|
+
readonly page?: number;
|
|
3
|
+
readonly pageSize?: number;
|
|
4
|
+
readonly q?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ModuleUserDirectoryEntry {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly displayName: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ModuleUserDirectoryPage {
|
|
13
|
+
readonly items: readonly ModuleUserDirectoryEntry[];
|
|
14
|
+
readonly total: number;
|
|
15
|
+
readonly page: number;
|
|
16
|
+
readonly pageSize: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type ModuleUserDirectoryErrorCode =
|
|
20
|
+
| "USER_DIRECTORY_FORBIDDEN"
|
|
21
|
+
| "USER_DIRECTORY_UNAVAILABLE"
|
|
22
|
+
| "USER_DIRECTORY_INVALID_QUERY";
|
|
23
|
+
|
|
24
|
+
export class ModuleUserDirectoryError extends Error {
|
|
25
|
+
constructor(
|
|
26
|
+
readonly code: ModuleUserDirectoryErrorCode,
|
|
27
|
+
message: string,
|
|
28
|
+
) {
|
|
29
|
+
super(message);
|
|
30
|
+
this.name = "ModuleUserDirectoryError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 业务模块使用的只读启用用户目录。
|
|
36
|
+
*
|
|
37
|
+
* Actor、租户、部门与 Data Scope 全部由宿主绑定;调用方只能提交分页和搜索条件。
|
|
38
|
+
* 宿主会执行 Feature、Permission、数据范围与审计,失败时不会降级为全量用户查询。
|
|
39
|
+
*/
|
|
40
|
+
export interface ModuleUserDirectoryPort {
|
|
41
|
+
list(query?: ModuleUserDirectoryQuery): Promise<ModuleUserDirectoryPage>;
|
|
42
|
+
}
|
|
@@ -145,11 +145,36 @@ export const AUDIT_ACTION_DEFINITIONS = [
|
|
|
145
145
|
label: "通知发布",
|
|
146
146
|
description: "发布站内通知。",
|
|
147
147
|
},
|
|
148
|
+
{
|
|
149
|
+
key: "notification.schedule",
|
|
150
|
+
label: "通知定时发布",
|
|
151
|
+
description: "创建等待调度器发布的通知。",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
key: "notification.preference.update",
|
|
155
|
+
label: "通知偏好更新",
|
|
156
|
+
description: "用户更新外部通知渠道和分类偏好。",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
key: "notification.update",
|
|
160
|
+
label: "通知修改",
|
|
161
|
+
description: "修改已发布通知并保留版本历史。",
|
|
162
|
+
},
|
|
148
163
|
{
|
|
149
164
|
key: "notification.read",
|
|
150
165
|
label: "通知已读",
|
|
151
166
|
description: "用户阅读站内通知。",
|
|
152
167
|
},
|
|
168
|
+
{
|
|
169
|
+
key: "notification.favorite",
|
|
170
|
+
label: "收藏通知",
|
|
171
|
+
description: "用户收藏可见的站内通知。",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
key: "notification.unfavorite",
|
|
175
|
+
label: "取消收藏通知",
|
|
176
|
+
description: "用户取消收藏可见的站内通知。",
|
|
177
|
+
},
|
|
153
178
|
{
|
|
154
179
|
key: "notification.archive",
|
|
155
180
|
label: "通知归档",
|