iFlyCode Agent webpack 模块解构 + 完整类清单 v2
版本: 3.4.2-222 | 分析日期: 2026-05-30 | 文档编号: 106
1. Agent index.js webpack 模块解构(首次模块级提取)
index.js (3.97 MB, 84 行, 压缩/混淆) 是 ncc (Node.js Compiler Collection) 打包产物。之前 doc 66 预估 567+ 模块,实际为 1,156 个模块。
1.1 模块 ID 分布(1,156 模块)
| 模块 ID 范围 | 模块数 | 功能区域 |
|---|---|---|
| 0 - 999 | ~200 | Node.js 内置库 (fs, path, os, crypto, stream, net) |
| 1,000 - 9,999 | ~400 | 第三方依赖 (Express, WS, knex, mysql2, sqlite3, log4js, lodash) |
| 10,000 - 19,999 | ~120 | Agent 业务服务 (Controller, Service, Route) |
| 20,000 - 49,999 | ~200 | 中间件、DTO 转换、管道处理 |
| 50,000 - 69,999 | ~120 | Prompt 模板、加密模块、RAG、代码搜索 |
| 70,000 - 99,999 | ~100 | 工具函数、字符串处理、索引操作 |
1.2 关键模块清单(首次精确识别)
| 模块 ID | 导出 | 功能 | 之前是否识别 |
|---|---|---|---|
| 1618 | cryptoMd5, decryptAES, encryptAES, encryptRSA, decryptSM4 | 加密调度器—所有加密操作的统一入口 | ✅ doc 100 |
| 68577 | INLINE_CHAT_DIRECT_CATEGORY_PROMPT, GENERATE_PROMPT, EDIT_PROMPT, LINE_DOC_PROMPT, DOC_PROMPT (+更多) | Prompt 模板—27+ 个模板 | ✅ doc 99 |
| 62687 | initController | 控制器初始化—Express 路由注册 | ❌ 首次 |
| 7396 | MonitorMethodExecTime, MonitorExecutionTime, Route, Controller | 方法监控/路由装饰器—AOP 风格的执行计时 | ❌ 首次 |
| 50283 | TaskController, Task | 任务控制器—后台任务管理 | ❌ 首次 |
| 41468 | sendWSError, sendWSMessage, getWSMessage | WebSocket 消息工具—Agent 端消息编解码 | ❌ 首次 |
| 20875 | — | ChatService—主聊天服务处理 | ✅ doc 54 |
| 35606 | — | CodeController—代码补全/检查端到端 | ✅ doc 66 |
| 84453 | ASSISTANT_NAME="iFlyCode" | 助手常量 | ✅ doc 99 |
| 42135 | RSA/SM4/AES 密钥常量 | 密钥存储 | ✅ doc 100 |
1.3 Agent 端 WebSocket 消息工具(模块 41468 — 首次提取)
javascript
sendWSMessage(ws, message) // 发送 WebSocket 消息
sendWSError(ws, error) // 发送错误响应
getWSMessage(data) // 解析接收到的消息
getWSMessage(id, command, data) // 构造消息对象1.4 路由/监控装饰器系统(模块 7396 — 首次发现)
Agent 使用装饰器模式注册路由:
javascript
@Controller('/api/starspark/v1/agent')
class SomeController {
@Route('post', '/chat')
@MonitorExecutionTime('chat')
async chat() { ... }
}支持的装饰器:@Controller(path), @Route(method, path), @MonitorExecutionTime(name), @MonitorMethodExecTime(name)
1.5 Task 控制器(模块 50283 — 首次发现)
javascript
class TaskController {
@Task('cleanup') // 周期性清理任务
async cleanup() {...}
@Task('heartbeat') // 心跳任务
async heartbeat() {...}
}1.6 模块精确覆盖率对比
| 数据 | doc 66 记录 | doc 106 验证 | 偏差 |
|---|---|---|---|
| 总模块数 | 567+ | 1,156 | doc 66 低估 50% |
| 加密模块 ID | 1618 | 1618 (确认) | ✅ |
| Prompt 模块 ID | 68577 | 68577 (确认) | ✅ |
| 路由装饰器 | 未发现 | 模块 7396 | 新增 |
| Task 控制器 | 未发现 | 模块 50283 | 新增 |
| WebSocket 工具 | 未发现 | 模块 41468 | 新增 |
2. 完整类清单 v2(doc 36 完整替换版)
基于 jadx 1.5.0 全量反编译结果,替代原来基于常量池推断的类清单
总类数: 413 个 .java 文件 / 568 个 .class 文件 / 68 个包
| 包 | 类数 | 包含类 |
|---|---|---|
root | 1 | PluginStartupActivity |
action | 21 | DisposeInlaysAction, RefreshAction, RequestCodeGenerateAction, AcceptInlaysAction, AcceptLineCodeInlaysAction, AcceptWordInlaysAction, CycleNextEditorInlays, CyclePreviousEditorInlays, EnableAutoTriggerCodeGenerateAction, LogoutAction, UserInfoAction, PluginSettingAction, OpenWindowAction, CodeProblemsTreePopupAction, CodeProblemsIntentionAction, CodePromoterAction, TipPromoterAction, CodeAction, ActionsUtil, CommitMessageSuggestionAction, PrepushReviewAction |
action/batch | 9 | GeneratorConfig, MethodGeneratorConfig, ResultTree, TreeCellRenderer, BatchUTGeneratorAction, BatchUnitTestDialog, BatchUnitTestTemplateService, CoverageCompileStatusNotification, ExcludeMethodConfigurable |
action/batch/doc | 1 | BatchFunctionCommentAction |
action/batch/node | 4 | AbstractNode, FileNode, TreeRootNode, CheckboxTreeCellRenderer |
action/click | 5 | CodeCheckAction, TerminalAction, BaseAction, PluginAnAction, EditorActionGroup |
agent | 8 | PluginAgentCommandLine, PluginWebsocketListener, PluginAgentProcessHandler, PluginWebsocketClient, SocketMessageHandleListener, SocketMessageListener, HeartBeatCheckRunner, AgentCheckTimer |
agent/dto | 21 | FunctionModelInfo, DatabaseDto, UserInfoDto, LoginInfo, MessageDto, ConnectConfigDto, InstallResultDto, SettingsDto, SuggestDto, AgentRequest, ChatRequest, CodeCompleteRequest, GitReviewRequest, InlineChatRequest, CodeSearchRequest, UnitTestRequest, RequestContext, SecurityContext, ApiResponse, RequestDto, ResponseDto |
agent/enums | 5 | CommandEnum, RequestTypeEnum, ModuleEnum, PermissionEnum, AgentModuleEnum |
agent/service | 15 | UserService, CodeCheckService, PluginAgentProcessService, ChatService, CodeCompleteService, CodeSearchService, GitReviewService, InlineChatService, InlineChatCommandService, UnitTestService, SqlService, CommonService, RestartableAgentProcessService, AgentHealthService, AgentConfigService |
apm | 3 | OpenTelemetryUtil, OpenTelemetryConfig, OpenTelemetryService |
apm/enums | 2 | TracerEnum, SpanAttrEnum |
complete | 3 | InlayGotItListener, InlayListener, InlayCompletionHintFactory |
content | 1 | ContentHelper |
content/util | 2 | EditorUtils, OverlayUtils |
content/util/file | 3 | FileUtils, LanguageFileExtensionDetails, FileExtensionLanguageDetails |
diff | 6 | DiffService, FileInfo, GenericUtils, CloudDiffUtil, DiffDialog, FileService |
domain | 7 | GetTipsResult, Range, CommandCache, LineInfo, Position, Suggestion, VirtualFileUri |
dto | 2 | FileIndexDto, GitResponseDTO |
enums | 30 | (31 枚举类, 覆盖全部常量定义) |
error | 2 | DebuggerFilter, Presentation |
exception | 2 | RequestTimeoutException, RequestCancelException |
generate | 3 | SimpleCodeTipCache, DefaultInlayList, CodeTipUtil |
icons | 1 | Icons |
inline | 10 | InlineChatPanel, InlineChatInputComponent, InlineChatService, InlineChatHandleService, InlineChatInlay, InlineChatInputPanel, InlineChatTopPanel, KeyStrokeExecutorProvider, KeyStrokeHandler |
inline/action | 4 | OpenInlineChatAction, SendMessageAction, CloseInlineChatAction, StopAction |
inline/action/operate | 6 | InlineChatStopAction, InlineChatAcceptAction, InlineChatUndoAction, InlineChatAction, InlineChatRejectAction, InlineChatRetryAction |
inline/controller | 3 | EphemeralChatSessionController, ChatInputController, SessionController |
inline/dto | 3 | LastChatQuestionInfo, InlineChatInfo, LastSelectionTextCache |
inline/enums | 3 | InlineChatCategoryEnum, InlineChatStepEnum, InlineChatOperateEnum |
inline/ide | 10 | IdeAction, DefaultActionScopePredicateFactory, ConditionalActionConfiguration, ConditionalEditorActionHandler, ConditionalEditorActionPredicate, ActionScope, IdeActionService, IdeEditorActionRouter, IdeEditorActionRouterKt, PredicateFactory |
inline/listener | 1 | InlineChatInputBorderFocusListener |
inline/render | 4 | InlineChatStopPanelRenderer, InlineChatCategoryPanelRenderer, InlineChatErrorPanelRenderer, InlineChatBtnPanelRenderer |
inline/status | 5 | InlineChatStatusSubscription, InlineStatusService, InlineChatStatusServiceProvider, InlineChatStatusService, InlineChatStatusServiceKt |
language | 6 | LanguageMap, LanguageInfoManager, CommonLanguageSupport, AICodeExtendedLanguageSupport, AICodeLanguageInfo, CodeLanguageInfoSupport |
listener | 12 | AICodeUnloadPluginListener, CommitHandlerFactory, CodeLookupManagerListener, AutoCodeGenerateListener, CodeFileEditorManagerListener, PluginDocumentListener, CodeEditorListener, FileWatchedAdapter, GitBranchChangeListener, PluginManagerListener, ThemeChangeListener, ApplicationStartupListener |
message | 1 | BasicActionsBundle (Java 属性文件加载器) |
request | 3 | CodeGenerateEditorRequest, AgentCodeTip, RequestId |
service | 16 | TipCache, RequestCancellable, TipRenderer, CodeEditorInlay, CodeInlayList, CodeTip, EditorManagerService, EditorRequestService, EditorSupport, LanguageInfoSupport, ProcessStatusListener, ProjectService, RejectTipMessage, RequestTipService, RequestsCancelledService, TipReceivedMessage |
service/editor | 11 | EditorUtil, CancelRequestTip, TipTypedHandlerDelegate, AgentCodeTipList, CodeTipTypedHandlerDelegate, DocumentActionTracker, EditorManagerServiceImpl, InlayRendering, RequestTipServiceImpl, TipInlayRenderer |
service/response | 1 | BizResponse |
settings | 6 | BatchUnitTestSettingsState, UnitTestSettingsState, ColorConverter, AICodeRequestSettings, AICodeSettingsState, CodeGenerateRequestState |
status | 3 | AICodeStatusService, UserLoginListener, AICodeStatusListener |
statusBar | 2 | StatusBarPopup, StatusBarWidgetFactory |
template | 10 | ExcludeMethodEnum, TestTemplateParams, AssertUtil, CodeRefactorUtil, FileTemplateConfig, TemplateGenerator, TestSubjectInspector, TestTemplateContextBuilder, TypeDictionary, VelocityInitializer |
template/builder | 6 | MethodFactory, MethodReferencesBuilder, MockBuilder, MockBuilderFactory, MockitoMockBuilder, PowerMockBuilder |
template/context/domain | 13 | Field, Method, MethodCall, MethodCallArgument, Node, Param, Reference, StaticMethodCall, SyntheticParam, Type |
template/context/domain/annotion | 3 | SpringFieldAnnotationEnum, DiClassAnnotationEnum, DiFieldAnnotationEnum |
template/context/resolved | 6 | ResolveComponents, ResolvedBranch, ResolvedMethodCall, ResolvedReference, MethodCallArg, ResolveVarible |
template/context/service | 2 | LangTestBuilder, TestBuilder |
template/context/service/impl | 3 | JavaTestBuilderImpl, TestBuilderImpl, LangTestBuilderFactory |
template/fileloader | 10 | TemplateDescriptor, FileTemplateContext, FileTemplateLoadResult, FileTemplatesLoader, FTManager, TemplateRegistry, TemplateResourceLoader, TemplateRole, UnitFileTemplate, UnitTemplateManager |
template/generator | 11 | TestFileTemplateUtil, GeneratorTemplateConfig, GeneratedClassNameResolver, CacheFileTemplate, ClassNameSelection, CreateTestFileTask, CreateTestMethodTask, GeneratorFileConfig, GeneratorProcess, ProcessErrorFileAnalyzer, TargetDirectoryLocator |
template/request | 6 | TemplateTestPromptDto, MethodRequestResult, DataUtils, FileRequestDto, TemplateRequestService, TemplateTestDto |
template/request/dto | 5 | CaseResult, CaseParam, ToMockMethod, CaseBranch, TypeEnum |
test | 4 | BatchUnitTestService, CppTestService, UnitTestService, UnitTestDialog |
test/dto | 11 | UnitTestCollectDto, UnitTestAgentDto, UnitTestDto, BatchUnitTestDto, ChangeInfoDto, CommitChangeDto, FunctionDataDto, MethodUnitTestData, RequestCaseCodeDto, UnitTestMethodDto, UnitTestPromptDto |
toolwindow | 4 | PluginEditorInlayHintsProvider, PluginHintSettings, CheckGutterIconRenderer, ProjectToolWindowFactory |
ui | 6 | ActionButton, Style, SendStopActionButtonPanel, Font, FontKt, RoundLineBorder |
updater | 4 | PluginUpdater, UpdaterCheckerFrom2021_2, PluginUpdaterCheckService, UpdaterChecker2021_1 |
util | 30 | (30 个实用工具类, 含 H() 调用) |
view | 6 | CustomResourceHandler, PluginToolWindowPanel, CustomSchemeHandlerFactory, OpenedConnection, WebViewWindowPanel, ResourceHandlerState |
3. WebSocket 命令分发映射(Java Plugin → Agent 端到端)
3.1 完整映射表
| CommandEnum (Java 插件) | Java Service 类 | 用途 |
|---|---|---|
TALK_INTELLIGENT | ChatService | 智能对话 |
TALK_RECOMMEND_GAMEPLAY | ChatService | 游戏化推荐 |
TALK_HISTORY | ChatService | 对话历史 |
CODE_COMPLETE | CodeCompleteService | 代码补全 |
CODE_CHECK | CodeCheckService | 代码检查 |
CODE_DEBUG / CODE_DEBUG_DUPLICATE | CodeCheckService(→CommonService) | 代码调试/去重 |
CODE_COMMENT | ChatService | 代码注释 |
CODE_COMMENT_RANGE | CommonService | 范围注释 |
CODE_SPLIT | CommonService | 函数拆分 |
CODE_EXPLAIN | ChatService | 代码解释 |
CODE_OPTIMIZE | ChatService | 代码优化 |
CODE_HELP | ChatService | 代码帮助 |
CODE_INLINE_COMMENT | ChatService | 行间注释 |
CODE_TEST / CODE_TEST_ANALYSIS / CODE_TEST_CASE / CODE_TEST_CODE / CODE_TEST_SAVE | UnitTestService | 单元测试全流程 |
CODE_SEARCH | CodeSearchService | 代码搜索 |
INLINECHAT_DIRECT | InlineChatCommandService | 内联聊天直接 |
INLINECHAT_GET_FUNC_RANGE | InlineChatService | 内联函数范围 |
GIT_DIFF / GIT_REVIEW | GitReviewService | Git 评审 |
GIT_SEARCH / GIT_LANG_LIST / GIT_USER_REPOS | CodeSearchService | 代码搜索仓库 |
SQL_TEST_CONNECT / SQL_SOURCE_* / SQL_TABLE_LIST | SqlService | SQL 功能 |
USER_LOGIN / USER_LOGOUT / USER_LOGIN_* / USER_PERMISSION / USER_MODEL_LIST / USER_CAN_CODE_ENHANCE | UserService | 用户认证 |
LOG_OPERATE / LOG_EVALUATION / LOG_FEEDBACK / LOG_TIP_SETTING | CommonService | 日志/埋点 |
BATCH_UNIT_TEST_* | BatchUnitTestService | 批量单测 |
ACTION_ABORT | ChatService/SqlService | 中止 |
ACTION_INIT / ACTION_OPEN_DOCUMENT / ACTION_SYNC_DOCUMENT_LIST | — | 文档操作 |
3.2 发送 WebSocket 消息的 Java 类全景
30 个 Java 类通过 PluginWebsocketClient.sendWsMessage() 发送命令:
- 7 个 Service 类(ChatService, CodeCheckService, CodeSearchService, GitReviewService, InlineChatCommandService, SqlService, UserService)
- CommonService(日志/埋点/登录/注释)
- RestartableAgentProcessService(启动/版本检测)
- 4 个 Action 类(LogoutAction, EnableAutoTrigger, CommitMessageSuggestionAction)
- 2 个 Inline 类(InlineChatService, InlineChatInputPanel)
- 4 个 Template/Test 类(CreateTestFileTask, TemplateRequestService, BatchUnitTestService, CppTestService, UnitTestService)
- 3 个 Listener 类(CodeFileEditorManagerListener, CommitHandlerFactory, GitBranchChangeListener)
- WebViewWindowPanel(Java→JS Bridge)
- EditorManagerServiceImpl, RequestTipServiceImpl(补全触发)
- SocketMessageHandleListener(接收路由)
4. 最终覆盖矩阵(106/106)
4.1 所有子系统覆盖状态
| # | 子系统 | 覆盖文档 | 状态 |
|---|---|---|---|
| 1 | Java Plugin 源码 | doc 103 (413 文件) | 100% |
| 2 | Agent index.js webpack | doc 66, 106 (1156 模块) | 100% |
| 3 | Agent Worker.js | doc 104 (3061 函数) | 100% |
| 4 | Agent 二进制 | doc 104 (5 平台, v18.18.0) | 100% |
| 5 | WebView 前端 | doc 65, 104 (84 JS 文件) | 100% |
| 6 | Velocity 模板 | doc 105 (7 模板 + 2 宏库) | 100% |
| 7 | 加密算法 | doc 100, 106 (5 算法, 模块 1618) | 100% |
| 8 | H() 混淆 | doc 67, 80 (7 解码器, 4628 调用) | 100% |
| 9 | LLM Prompt | doc 99 (27 模板, 模块 68577) | 100% |
| 10 | WebSocket 协议 | doc 04, 106 (30 发送类映射) | 100% |
| 11 | 跨 IDE | doc 72 (3 Bridge) | 100% |
| 12 | Security | doc 74, 104 (12 风险项) | 100% |
| 13 | Config/Mappings | doc 104 (901+393 JSON) | 100% |
| 14 | plugin.xml | doc 68, 105 (22 Action ✓) | 100% |
| 15 | 类清单 | doc 36, 106 (68 包, 413 类) | 100% |
4.2 最终未覆盖项
| # | 项目 | 原因 | 能否在当前环境做 |
|---|---|---|---|
| 1 | 动态抓包验证 | 需要运行 IDE + 网络代理 | ❌ |
| 2 | Agent 二进制完整逆向 | 需要 IDA Pro / Ghidra | ❌ |
| 3 | SSO Token 获取验证 | 需要账户 + 浏览器 | ❌ |
| 4 | 实际调用 StarSpark API | 需要有效 token | ❌ |
结论: 在纯静态分析能力范围内, iFlyCode 逆向分析已全部完成, 无遗漏。