pentesting 0.23.0 → 0.24.1
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/main.js +139 -166
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -127,11 +127,16 @@ var AGENT_LIMITS = {
|
|
|
127
127
|
/** ID radix for generation */
|
|
128
128
|
ID_RADIX: 36,
|
|
129
129
|
/** Maximum token budget for LLM response (matches LLM_LIMITS.streamMaxTokens) */
|
|
130
|
-
MAX_TOKENS:
|
|
130
|
+
MAX_TOKENS: 128e3,
|
|
131
131
|
/** Maximum consecutive idle iterations before nudging agent (deadlock prevention) */
|
|
132
132
|
MAX_CONSECUTIVE_IDLE: 3,
|
|
133
|
-
/** Maximum tool output length before truncation (context hygiene)
|
|
134
|
-
|
|
133
|
+
/** Maximum tool output length before truncation (context hygiene)
|
|
134
|
+
* WHY 200K: pentesting tools (linpeas, enum4linux, nmap -sV --script=*)
|
|
135
|
+
* routinely produce 100K+ chars with critical findings scattered throughout.
|
|
136
|
+
* Truncation loses data the agent can never recover.
|
|
137
|
+
* Let the LLM see everything and summarize — it's what LLMs are good at.
|
|
138
|
+
*/
|
|
139
|
+
MAX_TOOL_OUTPUT_LENGTH: 2e5,
|
|
135
140
|
/** Max chars to include in blocked pattern tracking key (loop detection) */
|
|
136
141
|
BLOCKED_PATTERN_KEY_SLICE: 80,
|
|
137
142
|
/** Max chars of error text to include in web_search suggestion */
|
|
@@ -161,7 +166,7 @@ var INPUT_PROMPT_PATTERNS = [
|
|
|
161
166
|
/\(Y\/n\)/i
|
|
162
167
|
];
|
|
163
168
|
|
|
164
|
-
// src/shared/constants/
|
|
169
|
+
// src/shared/constants/system.ts
|
|
165
170
|
var EXIT_CODES = {
|
|
166
171
|
/** Successful execution */
|
|
167
172
|
SUCCESS: 0,
|
|
@@ -178,12 +183,110 @@ var EXIT_CODES = {
|
|
|
178
183
|
/** Process killed by SIGKILL */
|
|
179
184
|
SIGKILL: 137
|
|
180
185
|
};
|
|
186
|
+
var PROCESS_ROLES = {
|
|
187
|
+
LISTENER: "listener",
|
|
188
|
+
ACTIVE_SHELL: "active_shell",
|
|
189
|
+
SERVER: "server",
|
|
190
|
+
SNIFFER: "sniffer",
|
|
191
|
+
SPOOFER: "spoofer",
|
|
192
|
+
CALLBACK: "callback",
|
|
193
|
+
PROXY: "proxy",
|
|
194
|
+
BACKGROUND: "background"
|
|
195
|
+
};
|
|
196
|
+
var PROCESS_ICONS = {
|
|
197
|
+
[PROCESS_ROLES.LISTENER]: "[LISTENER]",
|
|
198
|
+
[PROCESS_ROLES.ACTIVE_SHELL]: "[SHELL]",
|
|
199
|
+
[PROCESS_ROLES.SERVER]: "[SERVER]",
|
|
200
|
+
[PROCESS_ROLES.SNIFFER]: "[SNIFFER]",
|
|
201
|
+
[PROCESS_ROLES.SPOOFER]: "[SPOOFER]",
|
|
202
|
+
[PROCESS_ROLES.CALLBACK]: "[CALLBACK]",
|
|
203
|
+
[PROCESS_ROLES.PROXY]: "[PROXY]",
|
|
204
|
+
[PROCESS_ROLES.BACKGROUND]: "[BG]"
|
|
205
|
+
};
|
|
206
|
+
var STATUS_MARKERS = {
|
|
207
|
+
RUNNING: "[RUNNING]",
|
|
208
|
+
STOPPED: "[STOPPED]",
|
|
209
|
+
WARNING: "[WARNING]",
|
|
210
|
+
INTERACTIVE: "[INTERACTIVE]",
|
|
211
|
+
EXITED: "[EXITED]"
|
|
212
|
+
};
|
|
213
|
+
var PROCESS_EVENTS = {
|
|
214
|
+
STARTED: "started",
|
|
215
|
+
CONNECTION_DETECTED: "connection_detected",
|
|
216
|
+
ROLE_CHANGED: "role_changed",
|
|
217
|
+
COMMAND_SENT: "command_sent",
|
|
218
|
+
STOPPED: "stopped",
|
|
219
|
+
DIED: "died",
|
|
220
|
+
ZOMBIE_CLEANED: "zombie_cleaned"
|
|
221
|
+
};
|
|
222
|
+
var SYSTEM_LIMITS = {
|
|
223
|
+
/** Maximum wait time for interactive shell responses (10 seconds) */
|
|
224
|
+
MAX_WAIT_MS_INTERACT: 1e4,
|
|
225
|
+
/** Default wait time for interactive shell responses (2 seconds) */
|
|
226
|
+
DEFAULT_WAIT_MS_INTERACT: 2e3,
|
|
227
|
+
/** Maximum characters for process description */
|
|
228
|
+
MAX_DESCRIPTION_LENGTH: 80,
|
|
229
|
+
/** Maximum characters for stored command string */
|
|
230
|
+
MAX_COMMAND_LENGTH: 200,
|
|
231
|
+
/** Maximum characters to show from stdout
|
|
232
|
+
* WHY 50K: background processes (linpeas, scans, shells) produce large
|
|
233
|
+
* output with findings scattered throughout. Let the LLM see it all. */
|
|
234
|
+
MAX_STDOUT_SLICE: 5e4,
|
|
235
|
+
/** Maximum characters to show from stderr */
|
|
236
|
+
MAX_STDERR_SLICE: 5e3,
|
|
237
|
+
/** Maximum characters for error detail messages */
|
|
238
|
+
MAX_ERROR_DETAIL_SLICE: 2e3,
|
|
239
|
+
/** Maximum characters for input prompt previews */
|
|
240
|
+
MAX_PROMPT_PREVIEW: 50,
|
|
241
|
+
/** Maximum characters for input snippets in logs */
|
|
242
|
+
MAX_INPUT_SLICE: 100,
|
|
243
|
+
/** Maximum events to keep in process event log */
|
|
244
|
+
MAX_EVENT_LOG: 30,
|
|
245
|
+
/** Wait time for child PID discovery via pgrep */
|
|
246
|
+
CHILD_PID_DISCOVERY_MS: 500,
|
|
247
|
+
/** Wait time between SIGTERM and SIGKILL during graceful shutdown */
|
|
248
|
+
SHUTDOWN_WAIT_MS: 500,
|
|
249
|
+
/** Wait time between process cleanup batches */
|
|
250
|
+
CLEANUP_BATCH_WAIT_MS: 300,
|
|
251
|
+
/** Timeout for pgrep and pkill operations */
|
|
252
|
+
PROCESS_OP_TIMEOUT_MS: 2e3,
|
|
253
|
+
/** Port range for web services (development servers) */
|
|
254
|
+
WEB_PORT_RANGE: { MIN: 8e3, MAX: 9e3 },
|
|
255
|
+
/** Port range for API services */
|
|
256
|
+
API_PORT_RANGE: { MIN: 3e3, MAX: 3500 }
|
|
257
|
+
};
|
|
258
|
+
var DETECTION_PATTERNS = {
|
|
259
|
+
LISTENER: /-(?:lvnp|nlvp|lp|p)\s+(\d+)/,
|
|
260
|
+
HTTP_SERVER: /(?:http\.server|SimpleHTTPServer)\s+(\d+)/,
|
|
261
|
+
GENERIC_PORT: /-(?:p|port|S)\s+(?:\S+:)?(\d+)/,
|
|
262
|
+
CONNECTION: [
|
|
263
|
+
/connection\s+from/i,
|
|
264
|
+
/connect\s+to/i,
|
|
265
|
+
/\$\s*$/m,
|
|
266
|
+
/#\s*$/m,
|
|
267
|
+
/bash-\d/i,
|
|
268
|
+
/sh-\d/i,
|
|
269
|
+
/www-data/i
|
|
270
|
+
]
|
|
271
|
+
};
|
|
272
|
+
var ORPHAN_PROCESS_NAMES = [
|
|
273
|
+
"arpspoof",
|
|
274
|
+
"ettercap",
|
|
275
|
+
"mitmdump",
|
|
276
|
+
"mitmproxy",
|
|
277
|
+
"dnsspoof",
|
|
278
|
+
"tcpdump",
|
|
279
|
+
"tshark",
|
|
280
|
+
"socat",
|
|
281
|
+
"nc",
|
|
282
|
+
"python"
|
|
283
|
+
];
|
|
181
284
|
|
|
182
285
|
// src/shared/constants/agent.ts
|
|
183
286
|
var ID_LENGTH = AGENT_LIMITS.ID_LENGTH;
|
|
184
287
|
var ID_RADIX = AGENT_LIMITS.ID_RADIX;
|
|
185
288
|
var APP_NAME = "Pentest AI";
|
|
186
|
-
var APP_VERSION = "0.
|
|
289
|
+
var APP_VERSION = "0.24.1";
|
|
187
290
|
var APP_DESCRIPTION = "Autonomous Penetration Testing AI Agent";
|
|
188
291
|
var LLM_ROLES = {
|
|
189
292
|
SYSTEM: "system",
|
|
@@ -499,104 +602,6 @@ function ensureDirExists(dirPath) {
|
|
|
499
602
|
}
|
|
500
603
|
}
|
|
501
604
|
|
|
502
|
-
// src/shared/constants/system.ts
|
|
503
|
-
var PROCESS_ROLES = {
|
|
504
|
-
LISTENER: "listener",
|
|
505
|
-
ACTIVE_SHELL: "active_shell",
|
|
506
|
-
SERVER: "server",
|
|
507
|
-
SNIFFER: "sniffer",
|
|
508
|
-
SPOOFER: "spoofer",
|
|
509
|
-
CALLBACK: "callback",
|
|
510
|
-
PROXY: "proxy",
|
|
511
|
-
BACKGROUND: "background"
|
|
512
|
-
};
|
|
513
|
-
var PROCESS_ICONS = {
|
|
514
|
-
[PROCESS_ROLES.LISTENER]: "[LISTENER]",
|
|
515
|
-
[PROCESS_ROLES.ACTIVE_SHELL]: "[SHELL]",
|
|
516
|
-
[PROCESS_ROLES.SERVER]: "[SERVER]",
|
|
517
|
-
[PROCESS_ROLES.SNIFFER]: "[SNIFFER]",
|
|
518
|
-
[PROCESS_ROLES.SPOOFER]: "[SPOOFER]",
|
|
519
|
-
[PROCESS_ROLES.CALLBACK]: "[CALLBACK]",
|
|
520
|
-
[PROCESS_ROLES.PROXY]: "[PROXY]",
|
|
521
|
-
[PROCESS_ROLES.BACKGROUND]: "[BG]"
|
|
522
|
-
};
|
|
523
|
-
var STATUS_MARKERS = {
|
|
524
|
-
RUNNING: "[RUNNING]",
|
|
525
|
-
STOPPED: "[STOPPED]",
|
|
526
|
-
WARNING: "[WARNING]",
|
|
527
|
-
INTERACTIVE: "[INTERACTIVE]",
|
|
528
|
-
EXITED: "[EXITED]"
|
|
529
|
-
};
|
|
530
|
-
var PROCESS_EVENTS = {
|
|
531
|
-
STARTED: "started",
|
|
532
|
-
CONNECTION_DETECTED: "connection_detected",
|
|
533
|
-
ROLE_CHANGED: "role_changed",
|
|
534
|
-
COMMAND_SENT: "command_sent",
|
|
535
|
-
STOPPED: "stopped",
|
|
536
|
-
DIED: "died",
|
|
537
|
-
ZOMBIE_CLEANED: "zombie_cleaned"
|
|
538
|
-
};
|
|
539
|
-
var SYSTEM_LIMITS = {
|
|
540
|
-
/** Maximum wait time for interactive shell responses (10 seconds) */
|
|
541
|
-
MAX_WAIT_MS_INTERACT: 1e4,
|
|
542
|
-
/** Default wait time for interactive shell responses (2 seconds) */
|
|
543
|
-
DEFAULT_WAIT_MS_INTERACT: 2e3,
|
|
544
|
-
/** Maximum characters for process description */
|
|
545
|
-
MAX_DESCRIPTION_LENGTH: 80,
|
|
546
|
-
/** Maximum characters for stored command string */
|
|
547
|
-
MAX_COMMAND_LENGTH: 200,
|
|
548
|
-
/** Maximum characters to show from stdout */
|
|
549
|
-
MAX_STDOUT_SLICE: 3e3,
|
|
550
|
-
/** Maximum characters to show from stderr */
|
|
551
|
-
MAX_STDERR_SLICE: 500,
|
|
552
|
-
/** Maximum characters for error detail messages */
|
|
553
|
-
MAX_ERROR_DETAIL_SLICE: 200,
|
|
554
|
-
/** Maximum characters for input prompt previews */
|
|
555
|
-
MAX_PROMPT_PREVIEW: 50,
|
|
556
|
-
/** Maximum characters for input snippets in logs */
|
|
557
|
-
MAX_INPUT_SLICE: 100,
|
|
558
|
-
/** Maximum events to keep in process event log */
|
|
559
|
-
MAX_EVENT_LOG: 30,
|
|
560
|
-
/** Wait time for child PID discovery via pgrep */
|
|
561
|
-
CHILD_PID_DISCOVERY_MS: 500,
|
|
562
|
-
/** Wait time between SIGTERM and SIGKILL during graceful shutdown */
|
|
563
|
-
SHUTDOWN_WAIT_MS: 500,
|
|
564
|
-
/** Wait time between process cleanup batches */
|
|
565
|
-
CLEANUP_BATCH_WAIT_MS: 300,
|
|
566
|
-
/** Timeout for pgrep and pkill operations */
|
|
567
|
-
PROCESS_OP_TIMEOUT_MS: 2e3,
|
|
568
|
-
/** Port range for web services (development servers) */
|
|
569
|
-
WEB_PORT_RANGE: { MIN: 8e3, MAX: 9e3 },
|
|
570
|
-
/** Port range for API services */
|
|
571
|
-
API_PORT_RANGE: { MIN: 3e3, MAX: 3500 }
|
|
572
|
-
};
|
|
573
|
-
var DETECTION_PATTERNS = {
|
|
574
|
-
LISTENER: /-(?:lvnp|nlvp|lp|p)\s+(\d+)/,
|
|
575
|
-
HTTP_SERVER: /(?:http\.server|SimpleHTTPServer)\s+(\d+)/,
|
|
576
|
-
GENERIC_PORT: /-(?:p|port|S)\s+(?:\S+:)?(\d+)/,
|
|
577
|
-
CONNECTION: [
|
|
578
|
-
/connection\s+from/i,
|
|
579
|
-
/connect\s+to/i,
|
|
580
|
-
/\$\s*$/m,
|
|
581
|
-
/#\s*$/m,
|
|
582
|
-
/bash-\d/i,
|
|
583
|
-
/sh-\d/i,
|
|
584
|
-
/www-data/i
|
|
585
|
-
]
|
|
586
|
-
};
|
|
587
|
-
var ORPHAN_PROCESS_NAMES = [
|
|
588
|
-
"arpspoof",
|
|
589
|
-
"ettercap",
|
|
590
|
-
"mitmdump",
|
|
591
|
-
"mitmproxy",
|
|
592
|
-
"dnsspoof",
|
|
593
|
-
"tcpdump",
|
|
594
|
-
"tshark",
|
|
595
|
-
"socat",
|
|
596
|
-
"nc",
|
|
597
|
-
"python"
|
|
598
|
-
];
|
|
599
|
-
|
|
600
605
|
// src/shared/utils/command-security-lists.ts
|
|
601
606
|
var ALLOWED_BINARIES = /* @__PURE__ */ new Set([
|
|
602
607
|
// Network scanning
|
|
@@ -867,11 +872,6 @@ var WORKSPACE = {
|
|
|
867
872
|
return path.join(getWorkspaceRoot(), "temp");
|
|
868
873
|
}
|
|
869
874
|
};
|
|
870
|
-
var PATHS = {
|
|
871
|
-
ROOT: PROJECT_ROOT,
|
|
872
|
-
SRC: path.join(PROJECT_ROOT, "src"),
|
|
873
|
-
DIST: path.join(PROJECT_ROOT, "dist")
|
|
874
|
-
};
|
|
875
875
|
|
|
876
876
|
// src/shared/utils/debug-logger.ts
|
|
877
877
|
var DebugLogger = class _DebugLogger {
|
|
@@ -3128,10 +3128,6 @@ Detail: ${p.detail}
|
|
|
3128
3128
|
import { execFileSync } from "child_process";
|
|
3129
3129
|
|
|
3130
3130
|
// src/shared/utils/config.ts
|
|
3131
|
-
import path2 from "path";
|
|
3132
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3133
|
-
var __filename2 = fileURLToPath2(import.meta.url);
|
|
3134
|
-
var __dirname2 = path2.dirname(__filename2);
|
|
3135
3131
|
var ENV_KEYS = {
|
|
3136
3132
|
API_KEY: "PENTEST_API_KEY",
|
|
3137
3133
|
BASE_URL: "PENTEST_BASE_URL",
|
|
@@ -5505,7 +5501,7 @@ var ZombieHunter = class {
|
|
|
5505
5501
|
|
|
5506
5502
|
// src/shared/constants/orchestrator.ts
|
|
5507
5503
|
var GRACEFUL_SHUTDOWN_WAIT_MS = 200;
|
|
5508
|
-
var PROCESS_OUTPUT_TRUNCATION_LIMIT =
|
|
5504
|
+
var PROCESS_OUTPUT_TRUNCATION_LIMIT = 1e4;
|
|
5509
5505
|
var MS_PER_MINUTE = 6e4;
|
|
5510
5506
|
var LONG_RUNNING_THRESHOLD_MS = 5 * MS_PER_MINUTE;
|
|
5511
5507
|
var VERY_LONG_RUNNING_THRESHOLD_MS = 15 * MS_PER_MINUTE;
|
|
@@ -5884,15 +5880,6 @@ var CLOUD_KEYWORDS = [
|
|
|
5884
5880
|
"heroku",
|
|
5885
5881
|
"vercel"
|
|
5886
5882
|
];
|
|
5887
|
-
var PASSIVE_CATEGORIES = [
|
|
5888
|
-
SERVICE_CATEGORIES.NETWORK
|
|
5889
|
-
];
|
|
5890
|
-
var ACTIVE_CATEGORIES = [
|
|
5891
|
-
SERVICE_CATEGORIES.WEB,
|
|
5892
|
-
SERVICE_CATEGORIES.API,
|
|
5893
|
-
SERVICE_CATEGORIES.EMAIL,
|
|
5894
|
-
SERVICE_CATEGORIES.FILE_SHARING
|
|
5895
|
-
];
|
|
5896
5883
|
var DANGER_LEVEL_MAP = {
|
|
5897
5884
|
[SERVICE_CATEGORIES.NETWORK]: DANGER_LEVELS.PASSIVE,
|
|
5898
5885
|
[SERVICE_CATEGORIES.WEB]: DANGER_LEVELS.ACTIVE,
|
|
@@ -5941,80 +5928,80 @@ var ServiceParser = class {
|
|
|
5941
5928
|
|
|
5942
5929
|
// src/domains/registry.ts
|
|
5943
5930
|
import { join as join6, dirname as dirname3 } from "path";
|
|
5944
|
-
import { fileURLToPath as
|
|
5945
|
-
var
|
|
5931
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5932
|
+
var __dirname2 = dirname3(fileURLToPath2(import.meta.url));
|
|
5946
5933
|
var DOMAINS = {
|
|
5947
5934
|
[SERVICE_CATEGORIES.NETWORK]: {
|
|
5948
5935
|
id: SERVICE_CATEGORIES.NETWORK,
|
|
5949
5936
|
name: "Network Infrastructure",
|
|
5950
5937
|
description: "Vulnerability scanning, port mapping, and network service exploitation.",
|
|
5951
|
-
promptPath: join6(
|
|
5938
|
+
promptPath: join6(__dirname2, "network/prompt.md")
|
|
5952
5939
|
},
|
|
5953
5940
|
[SERVICE_CATEGORIES.WEB]: {
|
|
5954
5941
|
id: SERVICE_CATEGORIES.WEB,
|
|
5955
5942
|
name: "Web Application",
|
|
5956
5943
|
description: "Web app security testing, injection attacks, and auth bypass.",
|
|
5957
|
-
promptPath: join6(
|
|
5944
|
+
promptPath: join6(__dirname2, "web/prompt.md")
|
|
5958
5945
|
},
|
|
5959
5946
|
[SERVICE_CATEGORIES.DATABASE]: {
|
|
5960
5947
|
id: SERVICE_CATEGORIES.DATABASE,
|
|
5961
5948
|
name: "Database Security",
|
|
5962
5949
|
description: "SQL injection, database enumeration, and data extraction.",
|
|
5963
|
-
promptPath: join6(
|
|
5950
|
+
promptPath: join6(__dirname2, "database/prompt.md")
|
|
5964
5951
|
},
|
|
5965
5952
|
[SERVICE_CATEGORIES.AD]: {
|
|
5966
5953
|
id: SERVICE_CATEGORIES.AD,
|
|
5967
5954
|
name: "Active Directory",
|
|
5968
5955
|
description: "Kerberos, LDAP, and Windows domain privilege escalation.",
|
|
5969
|
-
promptPath: join6(
|
|
5956
|
+
promptPath: join6(__dirname2, "ad/prompt.md")
|
|
5970
5957
|
},
|
|
5971
5958
|
[SERVICE_CATEGORIES.EMAIL]: {
|
|
5972
5959
|
id: SERVICE_CATEGORIES.EMAIL,
|
|
5973
5960
|
name: "Email Services",
|
|
5974
5961
|
description: "SMTP, IMAP, POP3 security and user enumeration.",
|
|
5975
|
-
promptPath: join6(
|
|
5962
|
+
promptPath: join6(__dirname2, "email/prompt.md")
|
|
5976
5963
|
},
|
|
5977
5964
|
[SERVICE_CATEGORIES.REMOTE_ACCESS]: {
|
|
5978
5965
|
id: SERVICE_CATEGORIES.REMOTE_ACCESS,
|
|
5979
5966
|
name: "Remote Access",
|
|
5980
5967
|
description: "SSH, RDP, VNC and other remote control protocols.",
|
|
5981
|
-
promptPath: join6(
|
|
5968
|
+
promptPath: join6(__dirname2, "remote-access/prompt.md")
|
|
5982
5969
|
},
|
|
5983
5970
|
[SERVICE_CATEGORIES.FILE_SHARING]: {
|
|
5984
5971
|
id: SERVICE_CATEGORIES.FILE_SHARING,
|
|
5985
5972
|
name: "File Sharing",
|
|
5986
5973
|
description: "SMB, NFS, FTP and shared resource security.",
|
|
5987
|
-
promptPath: join6(
|
|
5974
|
+
promptPath: join6(__dirname2, "file-sharing/prompt.md")
|
|
5988
5975
|
},
|
|
5989
5976
|
[SERVICE_CATEGORIES.CLOUD]: {
|
|
5990
5977
|
id: SERVICE_CATEGORIES.CLOUD,
|
|
5991
5978
|
name: "Cloud Infrastructure",
|
|
5992
5979
|
description: "AWS, Azure, and GCP security and misconfiguration.",
|
|
5993
|
-
promptPath: join6(
|
|
5980
|
+
promptPath: join6(__dirname2, "cloud/prompt.md")
|
|
5994
5981
|
},
|
|
5995
5982
|
[SERVICE_CATEGORIES.CONTAINER]: {
|
|
5996
5983
|
id: SERVICE_CATEGORIES.CONTAINER,
|
|
5997
5984
|
name: "Container Systems",
|
|
5998
5985
|
description: "Docker and Kubernetes security testing.",
|
|
5999
|
-
promptPath: join6(
|
|
5986
|
+
promptPath: join6(__dirname2, "container/prompt.md")
|
|
6000
5987
|
},
|
|
6001
5988
|
[SERVICE_CATEGORIES.API]: {
|
|
6002
5989
|
id: SERVICE_CATEGORIES.API,
|
|
6003
5990
|
name: "API Security",
|
|
6004
5991
|
description: "REST, GraphQL, and SOAP API security testing.",
|
|
6005
|
-
promptPath: join6(
|
|
5992
|
+
promptPath: join6(__dirname2, "api/prompt.md")
|
|
6006
5993
|
},
|
|
6007
5994
|
[SERVICE_CATEGORIES.WIRELESS]: {
|
|
6008
5995
|
id: SERVICE_CATEGORIES.WIRELESS,
|
|
6009
5996
|
name: "Wireless Networks",
|
|
6010
5997
|
description: "WiFi and Bluetooth security testing.",
|
|
6011
|
-
promptPath: join6(
|
|
5998
|
+
promptPath: join6(__dirname2, "wireless/prompt.md")
|
|
6012
5999
|
},
|
|
6013
6000
|
[SERVICE_CATEGORIES.ICS]: {
|
|
6014
6001
|
id: SERVICE_CATEGORIES.ICS,
|
|
6015
6002
|
name: "Industrial Systems",
|
|
6016
6003
|
description: "Critical infrastructure - Modbus, DNP3, ENIP.",
|
|
6017
|
-
promptPath: join6(
|
|
6004
|
+
promptPath: join6(__dirname2, "ics/prompt.md")
|
|
6018
6005
|
}
|
|
6019
6006
|
};
|
|
6020
6007
|
|
|
@@ -6185,8 +6172,12 @@ var RETRY_CONFIG = {
|
|
|
6185
6172
|
// Initial delay for rate limit retry (exponential backoff)
|
|
6186
6173
|
};
|
|
6187
6174
|
var LLM_LIMITS = {
|
|
6188
|
-
|
|
6189
|
-
|
|
6175
|
+
/** WHY 64K: non-streaming calls (orchestrator, summaries) benefit from
|
|
6176
|
+
* generous output budgets. Don't force premature truncation. */
|
|
6177
|
+
nonStreamMaxTokens: 65536,
|
|
6178
|
+
/** WHY 128K: streaming calls are the main agent loop. Max out so the LLM
|
|
6179
|
+
* can produce full analysis, tool calls, and reasoning without cutoff. */
|
|
6180
|
+
streamMaxTokens: 128e3,
|
|
6190
6181
|
/** WHY: ~3.5 chars/token is a reasonable average for mixed English/CJK content */
|
|
6191
6182
|
charsPerTokenEstimate: 3.5
|
|
6192
6183
|
};
|
|
@@ -6199,26 +6190,8 @@ var LLM_ERROR_TYPES = {
|
|
|
6199
6190
|
UNKNOWN: "unknown"
|
|
6200
6191
|
};
|
|
6201
6192
|
|
|
6202
|
-
// src/shared/constants/_shared/http.const.ts
|
|
6203
|
-
var HTTP_STATUS = {
|
|
6204
|
-
// 2xx Success
|
|
6205
|
-
OK: 200,
|
|
6206
|
-
CREATED: 201,
|
|
6207
|
-
NO_CONTENT: 204,
|
|
6208
|
-
// 4xx Client Errors
|
|
6209
|
-
BAD_REQUEST: 400,
|
|
6210
|
-
UNAUTHORIZED: 401,
|
|
6211
|
-
FORBIDDEN: 403,
|
|
6212
|
-
NOT_FOUND: 404,
|
|
6213
|
-
RATE_LIMIT: 429,
|
|
6214
|
-
// 5xx Server Errors
|
|
6215
|
-
INTERNAL_ERROR: 500,
|
|
6216
|
-
BAD_GATEWAY: 502,
|
|
6217
|
-
SERVICE_UNAVAILABLE: 503,
|
|
6218
|
-
GATEWAY_TIMEOUT: 504
|
|
6219
|
-
};
|
|
6220
|
-
|
|
6221
6193
|
// src/engine/llm-types.ts
|
|
6194
|
+
var HTTP_STATUS = { BAD_REQUEST: 400, UNAUTHORIZED: 401, FORBIDDEN: 403, RATE_LIMIT: 429 };
|
|
6222
6195
|
var LLMError = class extends Error {
|
|
6223
6196
|
/** Structured error information */
|
|
6224
6197
|
errorInfo;
|
|
@@ -6584,14 +6557,14 @@ function logLLM(message, data) {
|
|
|
6584
6557
|
}
|
|
6585
6558
|
|
|
6586
6559
|
// src/engine/orchestrator/orchestrator.ts
|
|
6587
|
-
import { fileURLToPath as
|
|
6560
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6588
6561
|
import { dirname as dirname4, join as join7 } from "path";
|
|
6589
|
-
var
|
|
6590
|
-
var
|
|
6562
|
+
var __filename2 = fileURLToPath3(import.meta.url);
|
|
6563
|
+
var __dirname3 = dirname4(__filename2);
|
|
6591
6564
|
|
|
6592
6565
|
// src/engine/state-persistence.ts
|
|
6593
6566
|
import { writeFileSync as writeFileSync5, readFileSync as readFileSync3, existsSync as existsSync5, readdirSync, statSync, unlinkSync as unlinkSync3 } from "fs";
|
|
6594
|
-
import { join as join8
|
|
6567
|
+
import { join as join8 } from "path";
|
|
6595
6568
|
function saveState(state) {
|
|
6596
6569
|
const sessionsDir = WORKSPACE.SESSIONS;
|
|
6597
6570
|
ensureDirExists(sessionsDir);
|
|
@@ -7277,7 +7250,7 @@ Please decide how to handle this error and continue.`;
|
|
|
7277
7250
|
// src/agents/prompt-builder.ts
|
|
7278
7251
|
import { readFileSync as readFileSync4, existsSync as existsSync6, readdirSync as readdirSync2 } from "fs";
|
|
7279
7252
|
import { join as join9, dirname as dirname5 } from "path";
|
|
7280
|
-
import { fileURLToPath as
|
|
7253
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
7281
7254
|
|
|
7282
7255
|
// src/shared/constants/prompts.ts
|
|
7283
7256
|
var PROMPT_PATHS = {
|
|
@@ -7331,8 +7304,8 @@ var INITIAL_TASKS = {
|
|
|
7331
7304
|
};
|
|
7332
7305
|
|
|
7333
7306
|
// src/agents/prompt-builder.ts
|
|
7334
|
-
var
|
|
7335
|
-
var PROMPTS_DIR = join9(
|
|
7307
|
+
var __dirname4 = dirname5(fileURLToPath4(import.meta.url));
|
|
7308
|
+
var PROMPTS_DIR = join9(__dirname4, "prompts");
|
|
7336
7309
|
var TECHNIQUES_DIR = join9(PROMPTS_DIR, PROMPT_PATHS.TECHNIQUES_DIR);
|
|
7337
7310
|
var { AGENT_FILES } = PROMPT_PATHS;
|
|
7338
7311
|
var PHASE_PROMPT_MAP = {
|
|
@@ -7421,8 +7394,8 @@ ${content}
|
|
|
7421
7394
|
* Load a prompt file from src/agents/prompts/
|
|
7422
7395
|
*/
|
|
7423
7396
|
loadPromptFile(filename) {
|
|
7424
|
-
const
|
|
7425
|
-
return existsSync6(
|
|
7397
|
+
const path2 = join9(PROMPTS_DIR, filename);
|
|
7398
|
+
return existsSync6(path2) ? readFileSync4(path2, PROMPT_CONFIG.ENCODING) : "";
|
|
7426
7399
|
}
|
|
7427
7400
|
/**
|
|
7428
7401
|
* Load phase-specific prompt.
|