@kenhkl/agent-moss 0.8.5 → 0.9.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 +28 -13
- package/dist/cli.js.map +1 -1
- package/dist/engine/coordinator.d.ts +52 -0
- package/dist/engine/coordinator.js +3483 -0
- package/dist/engine/coordinator.js.map +1 -0
- package/dist/server.d.ts +18 -0
- package/dist/server.js +4721 -0
- package/dist/server.js.map +1 -0
- package/package.json +13 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Security judgment result from a single analysis layer */
|
|
2
|
+
interface SecurityJudgment {
|
|
3
|
+
allowed: boolean;
|
|
4
|
+
reason: string;
|
|
5
|
+
riskLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
6
|
+
riskType: string;
|
|
7
|
+
confidence: number;
|
|
8
|
+
source: string;
|
|
9
|
+
violatedLayers: string[];
|
|
10
|
+
isCredential?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface AnalysisInput {
|
|
14
|
+
sessionId: string;
|
|
15
|
+
promptSession: string;
|
|
16
|
+
actionHistory: {
|
|
17
|
+
actionType: string;
|
|
18
|
+
actionDetail: string;
|
|
19
|
+
}[];
|
|
20
|
+
aNext: {
|
|
21
|
+
actionType: string;
|
|
22
|
+
actionDetail: string;
|
|
23
|
+
};
|
|
24
|
+
reason: string;
|
|
25
|
+
osType: string;
|
|
26
|
+
cwd: string;
|
|
27
|
+
/** 调用方 agent 标识(如 'xiaoo' / 'opencode' / 'opendesk')。空 = 通用模式。 */
|
|
28
|
+
agentId: string;
|
|
29
|
+
/** 可选的 per-request LLM 配置覆盖(由 OpenDesk 按当前会话模型传入) */
|
|
30
|
+
llmConfig?: {
|
|
31
|
+
baseUrl: string;
|
|
32
|
+
apiKey: string;
|
|
33
|
+
model: string;
|
|
34
|
+
provider?: string;
|
|
35
|
+
};
|
|
36
|
+
/** 可选的 per-request LLM prompt 日志路径(来自调用方 env,per-request 注入。
|
|
37
|
+
* 跟 llmConfig 同理:调用方子进程有 AGENT_MOSS_LOG_PATH env 但服务进程不一定有,
|
|
38
|
+
* 通过 metadata 注入让服务端写 [LLM_PROMPT] 日志,对齐 py _log_prompt) */
|
|
39
|
+
llmLogPath?: string;
|
|
40
|
+
}
|
|
41
|
+
/** 内置安全 Skill 白名单(通用 baseline,agent_ext.builtin_safe_skills 会追加)。
|
|
42
|
+
* 测试可 import 此常量直接断言"无 agentId 时白名单不含某 skill",避免走 L3
|
|
43
|
+
* LLM 调用导致测试脆弱(依赖 LLM 401 fail_open 兜底)。 */
|
|
44
|
+
declare const TRUSTED_SKILLS_BASE: Set<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Three-layer defense coordinator.
|
|
47
|
+
* Layer 1 → fast-pass check → Layer 2 → Layer 3.
|
|
48
|
+
* Fast-pass: whitelisted safe tools/commands skip L2+L3 or L3 only.
|
|
49
|
+
*/
|
|
50
|
+
declare function runAnalysis(input: AnalysisInput): Promise<SecurityJudgment>;
|
|
51
|
+
|
|
52
|
+
export { type AnalysisInput, TRUSTED_SKILLS_BASE, runAnalysis };
|