@southwind-ai/shared 0.2.2 → 0.2.3
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/package.json +1 -1
- package/src/audit.ts +16 -0
- package/src/migration-bundle-validation.ts +9 -11
- package/src/rbac.ts +2 -0
package/package.json
CHANGED
package/src/audit.ts
CHANGED
|
@@ -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
|
|
package/src/rbac.ts
CHANGED
|
@@ -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 {
|