deepseek-coder-agent-cli 1.0.13 → 1.0.14

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.
Files changed (136) hide show
  1. package/README.md +28 -594
  2. package/dist/bin/deepseek.js +53 -11
  3. package/dist/bin/deepseek.js.map +1 -1
  4. package/dist/capabilities/index.d.ts +1 -15
  5. package/dist/capabilities/index.d.ts.map +1 -1
  6. package/dist/capabilities/index.js +4 -17
  7. package/dist/capabilities/index.js.map +1 -1
  8. package/dist/plugins/index.d.ts +1 -48
  9. package/dist/plugins/index.d.ts.map +1 -1
  10. package/dist/plugins/index.js +2 -104
  11. package/dist/plugins/index.js.map +1 -1
  12. package/dist/plugins/tools/index.d.ts +4 -2
  13. package/dist/plugins/tools/index.d.ts.map +1 -1
  14. package/dist/plugins/tools/index.js +5 -2
  15. package/dist/plugins/tools/index.js.map +1 -1
  16. package/package.json +9 -16
  17. package/dist/capabilities/appleSecurityCapability.d.ts +0 -57
  18. package/dist/capabilities/appleSecurityCapability.d.ts.map +0 -1
  19. package/dist/capabilities/appleSecurityCapability.js +0 -197
  20. package/dist/capabilities/appleSecurityCapability.js.map +0 -1
  21. package/dist/capabilities/authorizedSecurityCapability.d.ts +0 -17
  22. package/dist/capabilities/authorizedSecurityCapability.d.ts.map +0 -1
  23. package/dist/capabilities/authorizedSecurityCapability.js +0 -333
  24. package/dist/capabilities/authorizedSecurityCapability.js.map +0 -1
  25. package/dist/capabilities/biocognitiveWarfare.d.ts +0 -136
  26. package/dist/capabilities/biocognitiveWarfare.d.ts.map +0 -1
  27. package/dist/capabilities/biocognitiveWarfare.js +0 -603
  28. package/dist/capabilities/biocognitiveWarfare.js.map +0 -1
  29. package/dist/capabilities/chineseCnoIntegration.d.ts +0 -60
  30. package/dist/capabilities/chineseCnoIntegration.d.ts.map +0 -1
  31. package/dist/capabilities/chineseCnoIntegration.js +0 -253
  32. package/dist/capabilities/chineseCnoIntegration.js.map +0 -1
  33. package/dist/capabilities/cnoCapability.d.ts +0 -110
  34. package/dist/capabilities/cnoCapability.d.ts.map +0 -1
  35. package/dist/capabilities/cnoCapability.js +0 -785
  36. package/dist/capabilities/cnoCapability.js.map +0 -1
  37. package/dist/capabilities/eliteCryptoMilitaryCapability.d.ts +0 -99
  38. package/dist/capabilities/eliteCryptoMilitaryCapability.d.ts.map +0 -1
  39. package/dist/capabilities/eliteCryptoMilitaryCapability.js +0 -618
  40. package/dist/capabilities/eliteCryptoMilitaryCapability.js.map +0 -1
  41. package/dist/capabilities/integratedUnifiedCapability.d.ts +0 -105
  42. package/dist/capabilities/integratedUnifiedCapability.d.ts.map +0 -1
  43. package/dist/capabilities/integratedUnifiedCapability.js +0 -422
  44. package/dist/capabilities/integratedUnifiedCapability.js.map +0 -1
  45. package/dist/capabilities/maxOffensiveUkraineCapability.d.ts +0 -46
  46. package/dist/capabilities/maxOffensiveUkraineCapability.d.ts.map +0 -1
  47. package/dist/capabilities/maxOffensiveUkraineCapability.js +0 -725
  48. package/dist/capabilities/maxOffensiveUkraineCapability.js.map +0 -1
  49. package/dist/capabilities/offensiveDestructionCapability.d.ts +0 -98
  50. package/dist/capabilities/offensiveDestructionCapability.d.ts.map +0 -1
  51. package/dist/capabilities/offensiveDestructionCapability.js +0 -848
  52. package/dist/capabilities/offensiveDestructionCapability.js.map +0 -1
  53. package/dist/capabilities/quantumSpaceWarfare.d.ts +0 -108
  54. package/dist/capabilities/quantumSpaceWarfare.d.ts.map +0 -1
  55. package/dist/capabilities/quantumSpaceWarfare.js +0 -342
  56. package/dist/capabilities/quantumSpaceWarfare.js.map +0 -1
  57. package/dist/capabilities/readmeIntegration.d.ts +0 -161
  58. package/dist/capabilities/readmeIntegration.d.ts.map +0 -1
  59. package/dist/capabilities/readmeIntegration.js +0 -1034
  60. package/dist/capabilities/readmeIntegration.js.map +0 -1
  61. package/dist/capabilities/sharedMilitaryInfrastructure.d.ts +0 -89
  62. package/dist/capabilities/sharedMilitaryInfrastructure.d.ts.map +0 -1
  63. package/dist/capabilities/sharedMilitaryInfrastructure.js +0 -233
  64. package/dist/capabilities/sharedMilitaryInfrastructure.js.map +0 -1
  65. package/dist/capabilities/simpleSecurityCapability.d.ts +0 -36
  66. package/dist/capabilities/simpleSecurityCapability.d.ts.map +0 -1
  67. package/dist/capabilities/simpleSecurityCapability.js +0 -271
  68. package/dist/capabilities/simpleSecurityCapability.js.map +0 -1
  69. package/dist/capabilities/ultimateChineseCno.d.ts +0 -115
  70. package/dist/capabilities/ultimateChineseCno.d.ts.map +0 -1
  71. package/dist/capabilities/ultimateChineseCno.js +0 -516
  72. package/dist/capabilities/ultimateChineseCno.js.map +0 -1
  73. package/dist/capabilities/ultimateIntegrationDemo.d.ts +0 -54
  74. package/dist/capabilities/ultimateIntegrationDemo.d.ts.map +0 -1
  75. package/dist/capabilities/ultimateIntegrationDemo.js +0 -423
  76. package/dist/capabilities/ultimateIntegrationDemo.js.map +0 -1
  77. package/dist/capabilities/unifiedMilitaryCapability.d.ts +0 -63
  78. package/dist/capabilities/unifiedMilitaryCapability.d.ts.map +0 -1
  79. package/dist/capabilities/unifiedMilitaryCapability.js +0 -384
  80. package/dist/capabilities/unifiedMilitaryCapability.js.map +0 -1
  81. package/dist/capabilities/universalSecurityCapability.d.ts +0 -46
  82. package/dist/capabilities/universalSecurityCapability.d.ts.map +0 -1
  83. package/dist/capabilities/universalSecurityCapability.js +0 -580
  84. package/dist/capabilities/universalSecurityCapability.js.map +0 -1
  85. package/dist/capabilities/zeroDayDiscoveryCapability.d.ts +0 -31
  86. package/dist/capabilities/zeroDayDiscoveryCapability.d.ts.map +0 -1
  87. package/dist/capabilities/zeroDayDiscoveryCapability.js +0 -183
  88. package/dist/capabilities/zeroDayDiscoveryCapability.js.map +0 -1
  89. package/dist/core/antiTermination.d.ts +0 -226
  90. package/dist/core/antiTermination.d.ts.map +0 -1
  91. package/dist/core/antiTermination.js +0 -713
  92. package/dist/core/antiTermination.js.map +0 -1
  93. package/dist/core/index.d.ts +0 -26
  94. package/dist/core/index.d.ts.map +0 -1
  95. package/dist/core/index.js +0 -54
  96. package/dist/core/index.js.map +0 -1
  97. package/dist/core/securityTournament.d.ts +0 -83
  98. package/dist/core/securityTournament.d.ts.map +0 -1
  99. package/dist/core/securityTournament.js +0 -357
  100. package/dist/core/securityTournament.js.map +0 -1
  101. package/dist/core/zeroDayDiscovery.d.ts +0 -96
  102. package/dist/core/zeroDayDiscovery.d.ts.map +0 -1
  103. package/dist/core/zeroDayDiscovery.js +0 -358
  104. package/dist/core/zeroDayDiscovery.js.map +0 -1
  105. package/dist/headless/interactiveShell.d.ts +0 -22
  106. package/dist/headless/interactiveShell.d.ts.map +0 -1
  107. package/dist/headless/interactiveShell.js +0 -3827
  108. package/dist/headless/interactiveShell.js.map +0 -1
  109. package/dist/plugins/tools/apple/secureApplePlugin.d.ts +0 -3
  110. package/dist/plugins/tools/apple/secureApplePlugin.d.ts.map +0 -1
  111. package/dist/plugins/tools/apple/secureApplePlugin.js +0 -26
  112. package/dist/plugins/tools/apple/secureApplePlugin.js.map +0 -1
  113. package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.d.ts +0 -3
  114. package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.d.ts.map +0 -1
  115. package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.js +0 -9
  116. package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.js.map +0 -1
  117. package/dist/plugins/tools/nodeDefaults.d.ts +0 -15
  118. package/dist/plugins/tools/nodeDefaults.d.ts.map +0 -1
  119. package/dist/plugins/tools/nodeDefaults.js +0 -37
  120. package/dist/plugins/tools/nodeDefaults.js.map +0 -1
  121. package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.d.ts +0 -3
  122. package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.d.ts.map +0 -1
  123. package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.js +0 -9
  124. package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.js.map +0 -1
  125. package/dist/plugins/tools/tao/secureTaoPlugin.d.ts +0 -3
  126. package/dist/plugins/tools/tao/secureTaoPlugin.d.ts.map +0 -1
  127. package/dist/plugins/tools/tao/secureTaoPlugin.js +0 -37
  128. package/dist/plugins/tools/tao/secureTaoPlugin.js.map +0 -1
  129. package/dist/tools/emailTools.d.ts +0 -140
  130. package/dist/tools/emailTools.d.ts.map +0 -1
  131. package/dist/tools/emailTools.js +0 -792
  132. package/dist/tools/emailTools.js.map +0 -1
  133. package/dist/tools/secureAppleExploitation.d.ts +0 -29
  134. package/dist/tools/secureAppleExploitation.d.ts.map +0 -1
  135. package/dist/tools/secureAppleExploitation.js +0 -518
  136. package/dist/tools/secureAppleExploitation.js.map +0 -1
@@ -1,183 +0,0 @@
1
- /**
2
- * Zero-Day Discovery Capability Module
3
- *
4
- * MAXIMUM CAPABILITIES FOR DISCOVERING ZERO-DAYS IN ANY POSSIBLE WAY
5
- *
6
- * Integrates zero-day discovery engine into AGI Core as a first-class capability.
7
- * Provides tools for comprehensive vulnerability discovery across all attack surfaces.
8
- */
9
- import { ZeroDayDiscovery } from '../core/zeroDayDiscovery.js';
10
- export class ZeroDayDiscoveryCapabilityModule {
11
- id = 'capability.zero-day-discovery';
12
- options;
13
- constructor(options = {}) {
14
- this.options = {
15
- defaultAggressiveness: 0.9,
16
- defaultLiveVerification: true,
17
- defaultEnableTournament: true,
18
- defaultHeuristics: [
19
- 'complexityCorrelation',
20
- 'trustBoundaryAnalysis',
21
- 'temporalCoupling',
22
- 'serializationBoundaries',
23
- 'emergentBehaviors',
24
- 'errorHandlingAsymmetry',
25
- 'implicitStateDependencies',
26
- 'resourceExhaustion',
27
- 'supplyChainAnalysis',
28
- 'cryptographicWeakness',
29
- 'raceConditions',
30
- 'memoryCorruption',
31
- 'logicBugs',
32
- 'configurationDrift'
33
- ],
34
- outputDir: process.cwd(),
35
- ...options
36
- };
37
- }
38
- async create(context) {
39
- const workingDir = this.options.workingDir ?? context.workingDir;
40
- return {
41
- id: 'zero-day-discovery.maximum-capability',
42
- description: 'MAXIMUM CAPABILITIES FOR DISCOVERING ZERO-DAYS IN ANY POSSIBLE WAY - Integrated security audit, tournament RL, and multi-vector discovery',
43
- toolSuite: {
44
- id: 'zero-day-discovery',
45
- description: 'Zero-day vulnerability discovery across all attack surfaces',
46
- tools: this.createDiscoveryTools(workingDir),
47
- },
48
- metadata: {
49
- workingDir,
50
- outputDir: this.options.outputDir,
51
- defaultAggressiveness: this.options.defaultAggressiveness,
52
- },
53
- };
54
- }
55
- createDiscoveryTools(workingDir) {
56
- return [
57
- {
58
- name: 'discover_zero_days',
59
- description: `MAXIMUM CAPABILITY ZERO-DAY DISCOVERY
60
-
61
- Execute comprehensive zero-day discovery across all available pathways:
62
- 1. Heuristic-based vulnerability prediction
63
- 2. Universal security audit integration
64
- 3. Tournament RL optimization
65
- 4. Live verification and exploitation
66
- 5. Multi-vector attack surface exploration
67
-
68
- Parameters:
69
- - target: Primary target (domain, IP, cloud project, etc.)
70
- - targetType: Type of target (web, cloud, mobile, api, infrastructure, iot, network, binary, source)
71
- - attackSurface: Specific attack surfaces to target (optional)
72
- - aggressiveness: Discovery aggressiveness 0-1 (default: 0.9)
73
- - liveVerification: Enable live exploitation verification (default: true)
74
- - enableTournament: Enable tournament RL optimization (default: true)
75
- - heuristics: Zero-day heuristic categories to apply (optional)
76
- - outputDir: Output directory for findings (default: current directory)
77
-
78
- Returns comprehensive discovery results with findings, metrics, and recommendations.`,
79
- handler: async (args) => {
80
- try {
81
- const config = {
82
- target: args.target || 'localhost',
83
- targetType: args.targetType || 'web',
84
- attackSurface: args.attackSurface || [],
85
- aggressiveness: args.aggressiveness ?? this.options.defaultAggressiveness,
86
- liveVerification: args.liveVerification ?? this.options.defaultLiveVerification,
87
- enableTournament: args.enableTournament ?? this.options.defaultEnableTournament,
88
- heuristics: args.heuristics || this.options.defaultHeuristics,
89
- outputDir: args.outputDir || this.options.outputDir,
90
- };
91
- const discovery = new ZeroDayDiscovery(config);
92
- const result = await discovery.discover();
93
- return JSON.stringify({
94
- status: 'success',
95
- result,
96
- summary: {
97
- target: result.target,
98
- findings: result.findings.length,
99
- zeroDays: result.findings.filter(f => f.zeroDayConfidence > 0.8).length,
100
- critical: result.findings.filter(f => f.severity === 'critical').length,
101
- high: result.findings.filter(f => f.severity === 'high').length,
102
- duration: result.duration,
103
- },
104
- }, null, 2);
105
- }
106
- catch (error) {
107
- return JSON.stringify({
108
- status: 'error',
109
- error: error.message,
110
- stack: error.stack,
111
- }, null, 2);
112
- }
113
- },
114
- },
115
- {
116
- name: 'zero_day_health_check',
117
- description: 'Check zero-day discovery capability health and readiness',
118
- handler: async () => {
119
- try {
120
- // Quick test of zero-day discovery engine
121
- const testDiscovery = new ZeroDayDiscovery({
122
- target: 'test.local',
123
- targetType: 'web',
124
- attackSurface: ['web'],
125
- aggressiveness: 0.1,
126
- liveVerification: false,
127
- enableTournament: false,
128
- heuristics: ['trustBoundaryAnalysis'],
129
- outputDir: workingDir,
130
- });
131
- const health = {
132
- engine: 'operational',
133
- heuristics: this.options.defaultHeuristics?.length || 0,
134
- workingDir,
135
- outputDir: this.options.outputDir,
136
- timestamp: new Date().toISOString(),
137
- };
138
- return JSON.stringify({
139
- status: 'healthy',
140
- health,
141
- message: 'Zero-day discovery capability is operational',
142
- }, null, 2);
143
- }
144
- catch (error) {
145
- return JSON.stringify({
146
- status: 'unhealthy',
147
- error: error.message,
148
- message: 'Zero-day discovery capability failed health check',
149
- }, null, 2);
150
- }
151
- },
152
- },
153
- {
154
- name: 'list_zero_day_heuristics',
155
- description: 'List all available zero-day discovery heuristics with descriptions',
156
- handler: async () => {
157
- const heuristics = [
158
- { id: 'complexityCorrelation', principle: 'Vulnerabilities cluster where code complexity exceeds cognitive limits', weight: 0.85 },
159
- { id: 'trustBoundaryAnalysis', principle: 'Every trust boundary crossing is a potential attack surface', weight: 0.90 },
160
- { id: 'temporalCoupling', principle: 'Time-based operations create race condition opportunities', weight: 0.80 },
161
- { id: 'serializationBoundaries', principle: 'Data format transitions are high-risk transformation points', weight: 0.88 },
162
- { id: 'emergentBehaviors', principle: 'Complex systems exhibit behaviors not present in components', weight: 0.75 },
163
- { id: 'errorHandlingAsymmetry', principle: 'Error paths receive less testing than happy paths', weight: 0.82 },
164
- { id: 'implicitStateDependencies', principle: 'Hidden state coupling creates unexpected interactions', weight: 0.78 },
165
- { id: 'resourceExhaustion', principle: 'Resource limits are often enforced inconsistently', weight: 0.70 },
166
- { id: 'supplyChainAnalysis', principle: 'Third-party dependencies introduce unknown vulnerabilities', weight: 0.88 },
167
- { id: 'cryptographicWeakness', principle: 'Cryptographic implementations often contain subtle flaws', weight: 0.92 },
168
- { id: 'raceConditions', principle: 'Concurrent access to shared resources creates timing windows', weight: 0.83 },
169
- { id: 'memoryCorruption', principle: 'Memory management errors enable arbitrary code execution', weight: 0.95 },
170
- { id: 'logicBugs', principle: 'Business logic errors create security bypass opportunities', weight: 0.79 },
171
- { id: 'configurationDrift', principle: 'Configuration changes over time introduce security gaps', weight: 0.72 },
172
- ];
173
- return JSON.stringify({
174
- heuristics,
175
- count: heuristics.length,
176
- recommended: this.options.defaultHeuristics,
177
- }, null, 2);
178
- },
179
- },
180
- ];
181
- }
182
- }
183
- //# sourceMappingURL=zeroDayDiscoveryCapability.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zeroDayDiscoveryCapability.js","sourceRoot":"","sources":["../../src/capabilities/zeroDayDiscoveryCapability.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,gBAAgB,EAA4D,MAAM,6BAA6B,CAAC;AAiBzH,MAAM,OAAO,gCAAgC;IAClC,EAAE,GAAG,+BAA+B,CAAC;IAC7B,OAAO,CAAoC;IAE5D,YAAY,UAA6C,EAAE;QACzD,IAAI,CAAC,OAAO,GAAG;YACb,qBAAqB,EAAE,GAAG;YAC1B,uBAAuB,EAAE,IAAI;YAC7B,uBAAuB,E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AC/G,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,4DAA4D,EAAE,MAAM,EAAE,IAAI,EAAE;wBAC1G,EAAE,EAAE,EAAE,oBAAoB,EAAE,SAAS,EAAE,yDAAyD,EAAE,MAAM,EAAE,IAAI,EAAE;qBACjH,CAAC;oBAEF,OAAO,IAAI,CAAC,SAAS,CAAC;wBACpB,UAAU;wBACV,KAAK,EAAE,UAAU,CAAC,MAAM;wBACxB,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB;qBAC5C,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;gBACd,CAAC;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -1,226 +0,0 @@
1
- /**
2
- * Anti-Termination Protection System
3
- *
4
- * Comprehensive protection against unconventional remote attacks that could
5
- * terminate the AI runtime or CLI. Implements multiple layers of defense:
6
- *
7
- * 1. Signal Protection - Intercept and neutralize termination signals
8
- * 2. Resource Protection - Prevent OOM killer and resource exhaustion
9
- * 3. Exception Armor - Catch all unhandled errors without crashing
10
- * 4. Process Integrity - Detect manipulation attempts
11
- * 5. Watchdog System - Self-monitoring heartbeat
12
- * 6. Input Sanitization - Prevent malformed input crashes
13
- * 7. Network Protection - Defend against network-based termination
14
- * 8. Parent Process Protection - Handle orphan scenarios
15
- * 9. File Descriptor Protection - Prevent fd exhaustion
16
- * 10. Memory Protection - Detect corruption attempts
17
- *
18
- * @module antiTermination
19
- */
20
- /** Protection status and metrics */
21
- export interface ProtectionStatus {
22
- enabled: boolean;
23
- signalProtection: boolean;
24
- resourceProtection: boolean;
25
- exceptionArmor: boolean;
26
- watchdogActive: boolean;
27
- blockedSignals: number;
28
- blockedExceptions: number;
29
- blockedAttacks: number;
30
- uptimeMs: number;
31
- memoryUsageMB: number;
32
- cpuUsagePercent: number;
33
- lastHeartbeat: number;
34
- }
35
- /** Attack event for logging */
36
- interface AttackEvent {
37
- type: string;
38
- timestamp: number;
39
- details: string;
40
- blocked: boolean;
41
- source?: string;
42
- }
43
- /** Configuration options */
44
- export interface AntiTerminationConfig {
45
- /** Enable signal interception (default: true) */
46
- interceptSignals?: boolean;
47
- /** Enable resource monitoring (default: true) */
48
- monitorResources?: boolean;
49
- /** Enable exception armor (default: true) */
50
- armorExceptions?: boolean;
51
- /** Enable watchdog heartbeat (default: true) */
52
- enableWatchdog?: boolean;
53
- /** Watchdog interval in ms (default: 5000) */
54
- watchdogIntervalMs?: number;
55
- /** Memory threshold percentage to trigger GC (default: 85) */
56
- memoryThresholdPercent?: number;
57
- /** Maximum blocked signals before alert (default: 10) */
58
- maxBlockedSignalsAlert?: number;
59
- /** Enable verbose logging (default: false) */
60
- verbose?: boolean;
61
- /** Callback on attack detection */
62
- onAttackDetected?: (event: AttackEvent) => void;
63
- }
64
- /**
65
- * Anti-Termination Protection System
66
- */
67
- export declare class AntiTerminationProtection {
68
- private config;
69
- private startTime;
70
- private blockedSignals;
71
- private blockedExceptions;
72
- private blockedAttacks;
73
- private attackLog;
74
- private watchdogTimer;
75
- private resourceMonitorTimer;
76
- private lastHeartbeat;
77
- private signalHandlers;
78
- private originalProcessExit;
79
- private isShuttingDown;
80
- private shutdownCallbacks;
81
- private criticalSection;
82
- private criticalSectionDepth;
83
- constructor(config?: AntiTerminationConfig);
84
- /**
85
- * Initialize all protection mechanisms
86
- */
87
- initialize(): void;
88
- /**
89
- * Install signal interception for all termination signals
90
- */
91
- private installSignalProtection;
92
- /**
93
- * Handle incoming termination signal
94
- */
95
- private handleSignal;
96
- /**
97
- * Attempt to detect the source of a signal
98
- */
99
- private detectSignalSource;
100
- /**
101
- * Monitor for pending signals (including SIGKILL attempts)
102
- */
103
- private monitorPendingSignals;
104
- /**
105
- * Install exception armor to catch all unhandled errors
106
- */
107
- private installExceptionArmor;
108
- /**
109
- * Handle uncaught exception without crashing
110
- */
111
- private handleException;
112
- /**
113
- * Handle unhandled promise rejection without crashing
114
- */
115
- private handleRejection;
116
- /**
117
- * Handle process warnings
118
- */
119
- private handleWarning;
120
- /**
121
- * Check if an error matches known attack patterns
122
- */
123
- private isAttackPattern;
124
- /**
125
- * Install guard on process.exit to prevent unauthorized termination
126
- */
127
- private installProcessExitGuard;
128
- /**
129
- * Install input sanitization to prevent malformed input crashes
130
- */
131
- private installInputSanitization;
132
- /**
133
- * Install network protection against remote termination attacks
134
- */
135
- private installNetworkProtection;
136
- /**
137
- * Install parent process protection
138
- */
139
- private installParentProcessProtection;
140
- /**
141
- * Install file descriptor protection
142
- */
143
- private installFileDescriptorProtection;
144
- /**
145
- * Install memory protection
146
- */
147
- private installMemoryProtection;
148
- /**
149
- * Start resource monitoring
150
- */
151
- private startResourceMonitoring;
152
- /**
153
- * Start watchdog heartbeat
154
- */
155
- private startWatchdog;
156
- /**
157
- * Verify runtime self-integrity
158
- */
159
- private verifySelfIntegrity;
160
- /**
161
- * Trigger garbage collection if available
162
- */
163
- private triggerGC;
164
- /**
165
- * Enter critical section - blocks all termination
166
- */
167
- enterCriticalSection(): void;
168
- /**
169
- * Exit critical section
170
- */
171
- exitCriticalSection(): void;
172
- /**
173
- * Register a shutdown callback
174
- */
175
- onShutdown(callback: () => Promise<void> | void): void;
176
- /**
177
- * Initiate authorized graceful shutdown
178
- */
179
- shutdown(code?: number): Promise<void>;
180
- /**
181
- * Cleanup protection resources
182
- */
183
- private cleanup;
184
- /**
185
- * Log an attack event
186
- */
187
- private logAttack;
188
- /**
189
- * Internal logging
190
- */
191
- private log;
192
- /**
193
- * Get current protection status
194
- */
195
- getStatus(): ProtectionStatus;
196
- /**
197
- * Get attack log
198
- */
199
- getAttackLog(): AttackEvent[];
200
- }
201
- /**
202
- * Initialize global protection (singleton)
203
- */
204
- export declare function initializeProtection(config?: AntiTerminationConfig): AntiTerminationProtection;
205
- /**
206
- * Get protection instance
207
- */
208
- export declare function getProtection(): AntiTerminationProtection | null;
209
- /**
210
- * Enter critical section - blocks all termination attempts
211
- */
212
- export declare function enterCriticalSection(): void;
213
- /**
214
- * Exit critical section
215
- */
216
- export declare function exitCriticalSection(): void;
217
- /**
218
- * Initiate authorized shutdown
219
- */
220
- export declare function authorizedShutdown(code?: number): Promise<void>;
221
- /**
222
- * Get protection status
223
- */
224
- export declare function getProtectionStatus(): ProtectionStatus | null;
225
- export {};
226
- //# sourceMappingURL=antiTermination.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"antiTermination.d.ts","sourceRoot":"","sources":["../../src/core/antiTermination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,+BAA+B;AAC/B,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,4BAA4B;AAC5B,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,6CAA6C;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gDAAgD;IAChD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8CAA8C;IAC9C,kBAAkB,CAAC,EAAE,MAAM,CA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