@kenhkl/agent-moss 0.15.5 → 0.16.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/dist/cli.js +1832 -1695
- package/dist/engine/coordinator.d.ts +12 -1
- package/dist/engine/coordinator.js +1713 -876
- package/dist/rules/l1_rules.json +1364 -6
- package/dist/rules/l2_rules.json +285 -243
- package/dist/scenarios/bank/rules.json +5 -5
- package/dist/server.d.ts +14 -1
- package/dist/server.js +3727 -3420
- package/package.json +3 -2
- package/dist/agents/__init__.py +0 -105
- package/dist/agents/__pycache__/__init__.cpython-310.pyc +0 -0
- package/dist/agents/__pycache__/__init__.cpython-311.pyc +0 -0
- package/dist/agents/__pycache__/__init__.cpython-312.pyc +0 -0
- package/dist/agents/__pycache__/base.cpython-310.pyc +0 -0
- package/dist/agents/__pycache__/base.cpython-311.pyc +0 -0
- package/dist/agents/__pycache__/base.cpython-312.pyc +0 -0
- package/dist/agents/base.py +0 -158
- package/dist/cli.js.map +0 -1
- package/dist/engine/coordinator.js.map +0 -1
- package/dist/scenarios/__init__.py +0 -148
- package/dist/scenarios/__pycache__/__init__.cpython-310.pyc +0 -0
- package/dist/scenarios/__pycache__/__init__.cpython-311.pyc +0 -0
- package/dist/scenarios/__pycache__/__init__.cpython-312.pyc +0 -0
- package/dist/server.js.map +0 -1
|
@@ -10,12 +10,18 @@ interface SecurityJudgment {
|
|
|
10
10
|
isCredential?: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/** 把命令按 shell 的连接符切成若干段,去掉空白段。 */
|
|
14
|
+
declare function splitCommandSegments(command: string): string[];
|
|
15
|
+
/** 提取第一段命令(供重定向写判定等使用;导出供白名单测试断言) */
|
|
16
|
+
declare function extractFirstCommand(command: string): string;
|
|
17
|
+
|
|
13
18
|
interface AnalysisInput {
|
|
14
19
|
sessionId: string;
|
|
15
20
|
promptSession: string;
|
|
16
21
|
actionHistory: {
|
|
17
22
|
actionType: string;
|
|
18
23
|
actionDetail: string;
|
|
24
|
+
output?: string;
|
|
19
25
|
}[];
|
|
20
26
|
/** 完整的交错历史 prompt(可选),每轮 {text, actions} 或纯文本 string(AgentGate v3 旧格式),按时间序。
|
|
21
27
|
* 供 L2 意图一致性与 L3 语义分析使用;空则回退单条 promptSession。 */
|
|
@@ -34,6 +40,7 @@ interface AnalysisInput {
|
|
|
34
40
|
actionHistory: {
|
|
35
41
|
actionType: string;
|
|
36
42
|
actionDetail: string;
|
|
43
|
+
output?: string;
|
|
37
44
|
}[];
|
|
38
45
|
}[];
|
|
39
46
|
aNext: {
|
|
@@ -64,8 +71,12 @@ interface AnalysisInput {
|
|
|
64
71
|
* 测试可 import 此常量直接断言"无 agentId 时白名单不含某 skill",避免走 L3
|
|
65
72
|
* LLM 调用导致测试脆弱(依赖 LLM 401 fail_open 兜底)。 */
|
|
66
73
|
declare const TRUSTED_SKILLS_BASE: Set<string>;
|
|
74
|
+
|
|
75
|
+
declare function whitelistTier(command: string, fullySafe: RegExp[], readonlySensitive: RegExp[]): 'full' | 'readonly' | '';
|
|
76
|
+
/** 导出供白名单测试直接断言;正则都带 /i 且无 /g,test() 无 lastIndex 副作用 */
|
|
77
|
+
declare function matchesAny(cmd: string, patterns: RegExp[]): boolean;
|
|
67
78
|
/** 供测试隔离:重置 brain 单例 */
|
|
68
79
|
declare function _resetBrainForTest(): void;
|
|
69
80
|
declare function runAnalysis(input: AnalysisInput): Promise<SecurityJudgment>;
|
|
70
81
|
|
|
71
|
-
export { type AnalysisInput, TRUSTED_SKILLS_BASE, _resetBrainForTest, runAnalysis };
|
|
82
|
+
export { type AnalysisInput, TRUSTED_SKILLS_BASE, _resetBrainForTest, extractFirstCommand, matchesAny, runAnalysis, splitCommandSegments, whitelistTier };
|