rl-rockcli 0.0.8 → 0.0.10
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/commands/attach/basic-repl.js +212 -0
- package/commands/attach/cleanup-history.js +189 -0
- package/commands/attach/cleanup-manager.js +163 -0
- package/commands/attach/copy-ui/copyRepl.js +195 -0
- package/commands/attach/copy-ui/index.js +7 -0
- package/commands/attach/copy-ui/render/outputBlock.js +25 -0
- package/commands/attach/copy-ui/viewport/viewport.js +23 -0
- package/commands/attach/copy-ui/viewport/wheel.js +14 -0
- package/commands/attach/history-manager.js +507 -0
- package/commands/attach/history-session.js +48 -0
- package/commands/attach/ink-repl/InkREPL.js +1507 -0
- package/commands/attach/ink-repl/builtinCommands.js +1253 -0
- package/commands/attach/ink-repl/components/ConnectingScreen.js +76 -0
- package/commands/attach/ink-repl/components/Console.js +191 -0
- package/commands/attach/ink-repl/components/DetailView.js +148 -0
- package/commands/attach/ink-repl/components/DropdownMenu.js +86 -0
- package/commands/attach/ink-repl/components/InputArea.js +125 -0
- package/commands/attach/ink-repl/components/InputLine.js +18 -0
- package/commands/attach/ink-repl/components/OutputArea.js +22 -0
- package/commands/attach/ink-repl/components/OutputItem.js +96 -0
- package/commands/attach/ink-repl/components/ShellLayout.js +61 -0
- package/commands/attach/ink-repl/components/Spinner.js +79 -0
- package/commands/attach/ink-repl/components/StatusBar.js +106 -0
- package/commands/attach/ink-repl/components/WelcomeBanner.js +48 -0
- package/commands/attach/ink-repl/contexts/LayoutContext.js +12 -0
- package/commands/attach/ink-repl/contexts/ThemeContext.js +43 -0
- package/commands/attach/ink-repl/hooks/useFunctionKeys.js +70 -0
- package/commands/attach/ink-repl/hooks/useMouse.js +162 -0
- package/commands/attach/ink-repl/hooks/useResources.js +132 -0
- package/commands/attach/ink-repl/hooks/useSpinner.js +49 -0
- package/commands/attach/ink-repl/index.js +112 -0
- package/commands/attach/ink-repl/package.json +3 -0
- package/commands/attach/ink-repl/replState.js +947 -0
- package/commands/attach/ink-repl/shortcuts/defaultKeybindings.js +138 -0
- package/commands/attach/ink-repl/shortcuts/index.js +332 -0
- package/commands/attach/ink-repl/themes/defaultDark.js +18 -0
- package/commands/attach/ink-repl/themes/defaultLight.js +18 -0
- package/commands/attach/ink-repl/themes/index.js +4 -0
- package/commands/attach/ink-repl/themes/themeManager.js +45 -0
- package/commands/attach/ink-repl/themes/themeTokens.js +15 -0
- package/commands/attach/ink-repl/utils/atCompletion.js +346 -0
- package/commands/attach/ink-repl/utils/clipboard.js +50 -0
- package/commands/attach/ink-repl/utils/consoleLogger.js +81 -0
- package/commands/attach/ink-repl/utils/exitCodeHandler.js +49 -0
- package/commands/attach/ink-repl/utils/exitCodeTips.js +56 -0
- package/commands/attach/ink-repl/utils/formatTime.js +12 -0
- package/commands/attach/ink-repl/utils/outputSelection.js +120 -0
- package/commands/attach/ink-repl/utils/outputViewport.js +77 -0
- package/commands/attach/ink-repl/utils/paginatedFileLoading.js +76 -0
- package/commands/attach/ink-repl/utils/paramHint.js +60 -0
- package/commands/attach/ink-repl/utils/parseError.js +174 -0
- package/commands/attach/ink-repl/utils/pathCompletion.js +167 -0
- package/commands/attach/ink-repl/utils/remotePathSafety.js +56 -0
- package/commands/attach/ink-repl/utils/replSelection.js +205 -0
- package/commands/attach/ink-repl/utils/responseFormatter.js +127 -0
- package/commands/attach/ink-repl/utils/textWrap.js +117 -0
- package/commands/attach/ink-repl/utils/truncate.js +115 -0
- package/commands/attach/opentui-repl/App.tsx +891 -0
- package/commands/attach/opentui-repl/builtinCommands.ts +80 -0
- package/commands/attach/opentui-repl/components/ConfirmDialog.tsx +116 -0
- package/commands/attach/opentui-repl/components/ConnectingScreen.tsx +131 -0
- package/commands/attach/opentui-repl/components/Console.tsx +73 -0
- package/commands/attach/opentui-repl/components/DetailView.tsx +45 -0
- package/commands/attach/opentui-repl/components/DropdownMenu.tsx +130 -0
- package/commands/attach/opentui-repl/components/ExecutionStatus.tsx +66 -0
- package/commands/attach/opentui-repl/components/Header.tsx +24 -0
- package/commands/attach/opentui-repl/components/OutputArea.tsx +25 -0
- package/commands/attach/opentui-repl/components/OutputBlock.tsx +108 -0
- package/commands/attach/opentui-repl/components/PromptInput.tsx +109 -0
- package/commands/attach/opentui-repl/components/StatusBar.tsx +63 -0
- package/commands/attach/opentui-repl/components/Toast.tsx +65 -0
- package/commands/attach/opentui-repl/components/WelcomeBanner.tsx +41 -0
- package/commands/attach/opentui-repl/contexts/ReplContext.tsx +137 -0
- package/commands/attach/opentui-repl/contexts/SessionContext.tsx +32 -0
- package/commands/attach/opentui-repl/contexts/ThemeContext.tsx +70 -0
- package/commands/attach/opentui-repl/contexts/ToastContext.tsx +69 -0
- package/commands/attach/opentui-repl/contexts/toast-logic.js +71 -0
- package/commands/attach/opentui-repl/hooks/useResources.ts +102 -0
- package/commands/attach/opentui-repl/hooks/useSpinner.ts +46 -0
- package/commands/attach/opentui-repl/index.js +99 -0
- package/commands/attach/opentui-repl/keybindings.ts +39 -0
- package/commands/attach/opentui-repl/package.json +3 -0
- package/commands/attach/opentui-repl/render.tsx +72 -0
- package/commands/attach/opentui-repl/tsconfig.json +12 -0
- package/commands/attach/repl.js +791 -0
- package/commands/attach/sandbox-id-resolver.js +56 -0
- package/commands/attach/session-manager.js +307 -0
- package/commands/attach/ui-mode.js +146 -0
- package/commands/log/core/constants.js +237 -0
- package/commands/log/core/display.js +370 -0
- package/commands/log/core/search.js +330 -0
- package/commands/log/core/tail.js +216 -0
- package/commands/log/core/utils.js +424 -0
- package/commands/log.js +298 -0
- package/commands/sandbox/core/log-bridge.js +119 -0
- package/commands/sandbox/core/replay/analyzer.js +311 -0
- package/commands/sandbox/core/replay/batch-orchestrator.js +536 -0
- package/commands/sandbox/core/replay/batch-task.js +369 -0
- package/commands/sandbox/core/replay/concurrent-display.js +70 -0
- package/commands/sandbox/core/replay/concurrent-orchestrator.js +170 -0
- package/commands/sandbox/core/replay/data-source.js +86 -0
- package/commands/sandbox/core/replay/display.js +231 -0
- package/commands/sandbox/core/replay/executor.js +634 -0
- package/commands/sandbox/core/replay/history-fetcher.js +124 -0
- package/commands/sandbox/core/replay/index.js +338 -0
- package/commands/sandbox/core/replay/loghouse-data-source.js +177 -0
- package/commands/sandbox/core/replay/pid-mapping.js +26 -0
- package/commands/sandbox/core/replay/request.js +109 -0
- package/commands/sandbox/core/replay/worker.js +166 -0
- package/commands/sandbox/core/session.js +346 -0
- package/commands/sandbox/log-bridge.js +2 -0
- package/commands/sandbox/ray.js +2 -0
- package/commands/sandbox/replay/analyzer.js +311 -0
- package/commands/sandbox/replay/batch-orchestrator.js +536 -0
- package/commands/sandbox/replay/batch-task.js +369 -0
- package/commands/sandbox/replay/concurrent-display.js +70 -0
- package/commands/sandbox/replay/concurrent-orchestrator.js +170 -0
- package/commands/sandbox/replay/display.js +231 -0
- package/commands/sandbox/replay/executor.js +634 -0
- package/commands/sandbox/replay/history-fetcher.js +118 -0
- package/commands/sandbox/replay/index.js +338 -0
- package/commands/sandbox/replay/pid-mapping.js +26 -0
- package/commands/sandbox/replay/request.js +109 -0
- package/commands/sandbox/replay/worker.js +166 -0
- package/commands/sandbox/replay.js +2 -0
- package/commands/sandbox/session.js +2 -0
- package/commands/sandbox-original.js +1393 -0
- package/commands/sandbox.js +499 -0
- package/help/help.json +1071 -0
- package/help/middleware.js +71 -0
- package/help/renderer.js +800 -0
- package/index.js +5 -15
- package/lib/plugin-context.js +40 -0
- package/package.json +2 -2
- package/sdks/sandbox/core/client.js +845 -0
- package/sdks/sandbox/core/config.js +70 -0
- package/sdks/sandbox/core/types.js +74 -0
- package/sdks/sandbox/httpLogger.js +251 -0
- package/sdks/sandbox/index.js +9 -0
- package/utils/asciiArt.js +138 -0
- package/utils/bun-compat.js +59 -0
- package/utils/ciPipelines.js +138 -0
- package/utils/cli.js +17 -0
- package/utils/command-router.js +79 -0
- package/utils/configManager.js +503 -0
- package/utils/dependency-resolver.js +135 -0
- package/utils/eagleeye_traceid.js +151 -0
- package/utils/envDetector.js +78 -0
- package/utils/execution_logger.js +415 -0
- package/utils/featureManager.js +68 -0
- package/utils/firstTimeTip.js +44 -0
- package/utils/hook-manager.js +125 -0
- package/utils/http-logger.js +264 -0
- package/utils/i18n.js +139 -0
- package/utils/image-progress.js +159 -0
- package/utils/logger.js +154 -0
- package/utils/plugin-loader.js +124 -0
- package/utils/plugin-manager.js +348 -0
- package/utils/ray_cli_wrapper.js +746 -0
- package/utils/sandbox-client.js +419 -0
- package/utils/terminal.js +32 -0
- package/utils/tips.js +106 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
const {
|
|
2
|
+
RequestCategory,
|
|
3
|
+
RequestAction,
|
|
4
|
+
ReplayRequest,
|
|
5
|
+
ReplayPlan
|
|
6
|
+
} = require('./request');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 请求分析器
|
|
10
|
+
* 负责对请求进行分类和优化
|
|
11
|
+
*/
|
|
12
|
+
class RequestAnalyzer {
|
|
13
|
+
/**
|
|
14
|
+
* @param {Object} options
|
|
15
|
+
* @param {string} options.mode - 回放模式: 'full' | 'smart' | 'minimal'
|
|
16
|
+
* @param {string[]} options.filters - 自定义过滤规则
|
|
17
|
+
* @param {boolean} options.executeStop - 是否执行 stop 请求
|
|
18
|
+
*/
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this.mode = options.mode || 'smart';
|
|
21
|
+
this.filters = options.filters || [];
|
|
22
|
+
this.executeStop = options.executeStop || false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 分析请求列表,生成回放计划
|
|
27
|
+
* @param {Object[]} rawRequests - 原始请求列表
|
|
28
|
+
* @returns {ReplayPlan}
|
|
29
|
+
*/
|
|
30
|
+
analyze(rawRequests) {
|
|
31
|
+
const plan = new ReplayPlan();
|
|
32
|
+
plan.originalCount = rawRequests.length;
|
|
33
|
+
|
|
34
|
+
if (rawRequests.length === 0) {
|
|
35
|
+
return plan;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 第一遍:分类
|
|
39
|
+
const classified = rawRequests.map((raw, index) => this.classify(raw, index));
|
|
40
|
+
|
|
41
|
+
// 第二遍:根据模式决定动作
|
|
42
|
+
const actioned = this.assignActions(classified);
|
|
43
|
+
|
|
44
|
+
// 第三遍:应用自定义过滤器和 stop 处理
|
|
45
|
+
const filtered = this.applyFilters(actioned);
|
|
46
|
+
|
|
47
|
+
// 分配到计划中
|
|
48
|
+
for (const req of filtered) {
|
|
49
|
+
this.updateStats(plan.stats, req);
|
|
50
|
+
|
|
51
|
+
if (req.action === RequestAction.SKIP) {
|
|
52
|
+
plan.skippedRequests.push(req);
|
|
53
|
+
} else if (req.action === RequestAction.MERGE) {
|
|
54
|
+
plan.mergedRequests.push(req);
|
|
55
|
+
} else {
|
|
56
|
+
plan.requests.push(req);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return plan;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 分类单个请求
|
|
65
|
+
* @param {Object} raw - 原始请求对象
|
|
66
|
+
* @param {number} index - 请求索引
|
|
67
|
+
* @returns {ReplayRequest}
|
|
68
|
+
*/
|
|
69
|
+
classify(raw, index) {
|
|
70
|
+
const req = new ReplayRequest(raw, index);
|
|
71
|
+
const uri = req.uri || '';
|
|
72
|
+
const command = req.getCommand();
|
|
73
|
+
|
|
74
|
+
// 按 URI 分类
|
|
75
|
+
if (uri.includes('start_async')) {
|
|
76
|
+
req.category = RequestCategory.STARTUP;
|
|
77
|
+
} else if (uri.includes('get_status')) {
|
|
78
|
+
req.category = RequestCategory.STARTUP_POLLING;
|
|
79
|
+
} else if (uri.includes('create_session') || uri.includes('close_session')) {
|
|
80
|
+
req.category = RequestCategory.SESSION;
|
|
81
|
+
} else if (uri.includes('upload')) {
|
|
82
|
+
req.category = RequestCategory.UPLOAD;
|
|
83
|
+
} else if (uri.includes('/stop')) {
|
|
84
|
+
req.category = RequestCategory.STOP;
|
|
85
|
+
} else if (uri.includes('run_in_session')) {
|
|
86
|
+
// 按命令内容进一步分类
|
|
87
|
+
if (this.isNohupCommand(command)) {
|
|
88
|
+
req.category = RequestCategory.NOHUP_COMMAND;
|
|
89
|
+
} else if (this.isProcessCheck(command)) {
|
|
90
|
+
req.category = RequestCategory.PROCESS_CHECK;
|
|
91
|
+
} else if (this.isLogQuery(command)) {
|
|
92
|
+
req.category = RequestCategory.LOG_QUERY;
|
|
93
|
+
} else {
|
|
94
|
+
req.category = RequestCategory.OTHER;
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
req.category = RequestCategory.OTHER;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return req;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 根据模式分配动作
|
|
105
|
+
* @param {ReplayRequest[]} requests
|
|
106
|
+
* @returns {ReplayRequest[]}
|
|
107
|
+
*/
|
|
108
|
+
assignActions(requests) {
|
|
109
|
+
switch (this.mode) {
|
|
110
|
+
case 'full':
|
|
111
|
+
return this.assignFullModeActions(requests);
|
|
112
|
+
case 'smart':
|
|
113
|
+
return this.assignSmartModeActions(requests);
|
|
114
|
+
case 'minimal':
|
|
115
|
+
return this.assignMinimalModeActions(requests);
|
|
116
|
+
default:
|
|
117
|
+
return this.assignSmartModeActions(requests);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Full 模式:保留所有请求,跳过进程检测
|
|
123
|
+
* @param {ReplayRequest[]} requests
|
|
124
|
+
* @returns {ReplayRequest[]}
|
|
125
|
+
*/
|
|
126
|
+
assignFullModeActions(requests) {
|
|
127
|
+
return requests.map(req => {
|
|
128
|
+
switch (req.category) {
|
|
129
|
+
case RequestCategory.NOHUP_COMMAND:
|
|
130
|
+
req.action = RequestAction.EXECUTE_WITH_PROCESS_WAIT;
|
|
131
|
+
break;
|
|
132
|
+
case RequestCategory.PROCESS_CHECK:
|
|
133
|
+
// 跳过所有 kill -0,由 nohup 执行后自动等待进程结束
|
|
134
|
+
req.action = RequestAction.SKIP;
|
|
135
|
+
req.skipReason = 'Process check (handled by automatic process wait)';
|
|
136
|
+
break;
|
|
137
|
+
default:
|
|
138
|
+
req.action = RequestAction.EXECUTE;
|
|
139
|
+
}
|
|
140
|
+
return req;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Smart 模式:跳过启动轮询,跳过进程检测(由 nohup 自动等待)
|
|
146
|
+
* @param {ReplayRequest[]} requests
|
|
147
|
+
* @returns {ReplayRequest[]}
|
|
148
|
+
*/
|
|
149
|
+
assignSmartModeActions(requests) {
|
|
150
|
+
let afterStartup = false;
|
|
151
|
+
|
|
152
|
+
for (const req of requests) {
|
|
153
|
+
switch (req.category) {
|
|
154
|
+
case RequestCategory.STARTUP:
|
|
155
|
+
afterStartup = true;
|
|
156
|
+
req.action = RequestAction.EXECUTE;
|
|
157
|
+
break;
|
|
158
|
+
|
|
159
|
+
case RequestCategory.STARTUP_POLLING:
|
|
160
|
+
if (afterStartup) {
|
|
161
|
+
req.action = RequestAction.SKIP;
|
|
162
|
+
req.skipReason = 'Startup polling (replaced by built-in wait)';
|
|
163
|
+
} else {
|
|
164
|
+
req.action = RequestAction.EXECUTE;
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
|
|
168
|
+
case RequestCategory.SESSION:
|
|
169
|
+
afterStartup = false;
|
|
170
|
+
req.action = RequestAction.EXECUTE;
|
|
171
|
+
break;
|
|
172
|
+
|
|
173
|
+
case RequestCategory.NOHUP_COMMAND:
|
|
174
|
+
req.action = RequestAction.EXECUTE_WITH_PROCESS_WAIT;
|
|
175
|
+
break;
|
|
176
|
+
|
|
177
|
+
case RequestCategory.PROCESS_CHECK:
|
|
178
|
+
// 跳过所有 kill -0,由 nohup 执行后自动等待进程结束
|
|
179
|
+
req.action = RequestAction.SKIP;
|
|
180
|
+
req.skipReason = 'Process check (handled by automatic process wait)';
|
|
181
|
+
break;
|
|
182
|
+
|
|
183
|
+
case RequestCategory.LOG_QUERY:
|
|
184
|
+
req.action = RequestAction.EXECUTE;
|
|
185
|
+
break;
|
|
186
|
+
|
|
187
|
+
case RequestCategory.OTHER:
|
|
188
|
+
req.action = RequestAction.EXECUTE;
|
|
189
|
+
break;
|
|
190
|
+
|
|
191
|
+
default:
|
|
192
|
+
req.action = RequestAction.EXECUTE;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return requests;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Minimal 模式:只保留关键操作
|
|
201
|
+
* @param {ReplayRequest[]} requests
|
|
202
|
+
* @returns {ReplayRequest[]}
|
|
203
|
+
*/
|
|
204
|
+
assignMinimalModeActions(requests) {
|
|
205
|
+
return requests.map(req => {
|
|
206
|
+
switch (req.category) {
|
|
207
|
+
case RequestCategory.STARTUP:
|
|
208
|
+
req.action = RequestAction.EXECUTE;
|
|
209
|
+
break;
|
|
210
|
+
|
|
211
|
+
case RequestCategory.SESSION:
|
|
212
|
+
req.action = RequestAction.EXECUTE;
|
|
213
|
+
break;
|
|
214
|
+
|
|
215
|
+
case RequestCategory.NOHUP_COMMAND:
|
|
216
|
+
req.action = RequestAction.EXECUTE_WITH_PROCESS_WAIT;
|
|
217
|
+
break;
|
|
218
|
+
|
|
219
|
+
case RequestCategory.UPLOAD:
|
|
220
|
+
req.action = RequestAction.EXECUTE;
|
|
221
|
+
break;
|
|
222
|
+
|
|
223
|
+
case RequestCategory.STARTUP_POLLING:
|
|
224
|
+
req.action = RequestAction.SKIP;
|
|
225
|
+
req.skipReason = 'Startup polling (minimal mode)';
|
|
226
|
+
break;
|
|
227
|
+
|
|
228
|
+
case RequestCategory.PROCESS_CHECK:
|
|
229
|
+
req.action = RequestAction.SKIP;
|
|
230
|
+
req.skipReason = 'Process check (minimal mode)';
|
|
231
|
+
break;
|
|
232
|
+
|
|
233
|
+
case RequestCategory.LOG_QUERY:
|
|
234
|
+
req.action = RequestAction.SKIP;
|
|
235
|
+
req.skipReason = 'Log query (minimal mode)';
|
|
236
|
+
break;
|
|
237
|
+
|
|
238
|
+
case RequestCategory.OTHER:
|
|
239
|
+
// 保留非轮询类命令
|
|
240
|
+
req.action = RequestAction.EXECUTE;
|
|
241
|
+
break;
|
|
242
|
+
|
|
243
|
+
default:
|
|
244
|
+
req.action = RequestAction.EXECUTE;
|
|
245
|
+
}
|
|
246
|
+
return req;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* 应用自定义过滤器和 stop 处理
|
|
252
|
+
* @param {ReplayRequest[]} requests
|
|
253
|
+
* @returns {ReplayRequest[]}
|
|
254
|
+
*/
|
|
255
|
+
applyFilters(requests) {
|
|
256
|
+
return requests.map(req => {
|
|
257
|
+
// 处理 stop 请求
|
|
258
|
+
if (req.category === RequestCategory.STOP) {
|
|
259
|
+
if (!this.executeStop) {
|
|
260
|
+
req.action = RequestAction.SKIP;
|
|
261
|
+
req.skipReason = 'Stop request (use --stop to execute)';
|
|
262
|
+
}
|
|
263
|
+
return req;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 应用自定义过滤器
|
|
267
|
+
if (this.filters.length > 0 && req.action !== RequestAction.SKIP) {
|
|
268
|
+
for (const filter of this.filters) {
|
|
269
|
+
if (req.uri.includes(filter) ||
|
|
270
|
+
req.getCommand().includes(filter)) {
|
|
271
|
+
req.action = RequestAction.SKIP;
|
|
272
|
+
req.skipReason = `Custom filter: "${filter}"`;
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return req;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// 辅助方法
|
|
283
|
+
isNohupCommand(command) {
|
|
284
|
+
return /^nohup\s+/.test(command) && /&/.test(command);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
isProcessCheck(command) {
|
|
288
|
+
return /^kill\s+-0\s+\d+$/.test(command);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
isLogQuery(command) {
|
|
292
|
+
return /^head\s+-c\s+\d+\s+/.test(command) ||
|
|
293
|
+
/^tail\s+/.test(command);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
updateStats(stats, req) {
|
|
297
|
+
switch (req.category) {
|
|
298
|
+
case RequestCategory.STARTUP: stats.startup++; break;
|
|
299
|
+
case RequestCategory.STARTUP_POLLING: stats.startupPolling++; break;
|
|
300
|
+
case RequestCategory.SESSION: stats.session++; break;
|
|
301
|
+
case RequestCategory.NOHUP_COMMAND: stats.nohupCommand++; break;
|
|
302
|
+
case RequestCategory.PROCESS_CHECK: stats.processCheck++; break;
|
|
303
|
+
case RequestCategory.LOG_QUERY: stats.logQuery++; break;
|
|
304
|
+
case RequestCategory.UPLOAD: stats.upload++; break;
|
|
305
|
+
case RequestCategory.STOP: stats.stop++; break;
|
|
306
|
+
case RequestCategory.OTHER: stats.other++; break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
module.exports = { RequestAnalyzer };
|