erosolar-cli 1.7.55 → 1.7.57
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/shell/unifiedInputProcessor.d.ts +15 -12
- package/dist/shell/unifiedInputProcessor.d.ts.map +1 -1
- package/dist/shell/unifiedInputProcessor.js +45 -72
- package/dist/shell/unifiedInputProcessor.js.map +1 -1
- package/package.json +4 -4
- package/dist/active-stack-security.d.ts +0 -110
- package/dist/active-stack-security.js +0 -313
- package/dist/active-stack-security.js.map +0 -1
- package/dist/advanced-targeting.d.ts +0 -113
- package/dist/advanced-targeting.js +0 -252
- package/dist/advanced-targeting.js.map +0 -1
- package/dist/bin/adapters/node/index.js +0 -33
- package/dist/bin/adapters/types.js +0 -1
- package/dist/bin/alpha-zero/agentWrapper.js +0 -165
- package/dist/bin/alpha-zero/codeEvaluator.js +0 -272
- package/dist/bin/alpha-zero/competitiveRunner.js +0 -219
- package/dist/bin/alpha-zero/index.js +0 -98
- package/dist/bin/alpha-zero/introspection.js +0 -298
- package/dist/bin/alpha-zero/metricsTracker.js +0 -207
- package/dist/bin/alpha-zero/security/core.js +0 -269
- package/dist/bin/alpha-zero/security/google.js +0 -308
- package/dist/bin/alpha-zero/security/googleLoader.js +0 -40
- package/dist/bin/alpha-zero/security/index.js +0 -31
- package/dist/bin/alpha-zero/security/simulation.js +0 -274
- package/dist/bin/alpha-zero/selfModification.js +0 -231
- package/dist/bin/alpha-zero/types.js +0 -30
- package/dist/bin/bin/erosolar-optimized.js +0 -205
- package/dist/bin/capabilities/agentSpawningCapability.js +0 -116
- package/dist/bin/capabilities/bashCapability.js +0 -22
- package/dist/bin/capabilities/cloudCapability.js +0 -36
- package/dist/bin/capabilities/codeAnalysisCapability.js +0 -22
- package/dist/bin/capabilities/codeQualityCapability.js +0 -23
- package/dist/bin/capabilities/dependencySecurityCapability.js +0 -22
- package/dist/bin/capabilities/devCapability.js +0 -22
- package/dist/bin/capabilities/editCapability.js +0 -28
- package/dist/bin/capabilities/emailCapability.js +0 -20
- package/dist/bin/capabilities/enhancedGitCapability.js +0 -221
- package/dist/bin/capabilities/filesystemCapability.js +0 -22
- package/dist/bin/capabilities/globCapability.js +0 -28
- package/dist/bin/capabilities/interactionCapability.js +0 -20
- package/dist/bin/capabilities/learnCapability.js +0 -22
- package/dist/bin/capabilities/mcpCapability.js +0 -20
- package/dist/bin/capabilities/notebookCapability.js +0 -28
- package/dist/bin/capabilities/planningCapability.js +0 -27
- package/dist/bin/capabilities/refactoringCapability.js +0 -23
- package/dist/bin/capabilities/repoChecksCapability.js +0 -22
- package/dist/bin/capabilities/searchCapability.js +0 -22
- package/dist/bin/capabilities/skillCapability.js +0 -76
- package/dist/bin/capabilities/taskManagementCapability.js +0 -20
- package/dist/bin/capabilities/testingCapability.js +0 -23
- package/dist/bin/capabilities/toolManifest.js +0 -159
- package/dist/bin/capabilities/toolRegistry.js +0 -114
- package/dist/bin/capabilities/webCapability.js +0 -20
- package/dist/bin/config.js +0 -139
- package/dist/bin/contracts/v1/agent.js +0 -7
- package/dist/bin/contracts/v1/agentProfileManifest.js +0 -8
- package/dist/bin/contracts/v1/agentRules.js +0 -9
- package/dist/bin/contracts/v1/toolAccess.js +0 -8
- package/dist/bin/erosolar-optimized.d.ts +0 -12
- package/dist/bin/erosolar-optimized.d.ts.map +0 -1
- package/dist/bin/erosolar-optimized.js +0 -239
- package/dist/bin/erosolar-optimized.js.map +0 -1
- package/dist/bin/headless/headlessApp.js +0 -172
- package/dist/bin/mcp/config.js +0 -202
- package/dist/bin/mcp/stdioClient.js +0 -172
- package/dist/bin/mcp/toolBridge.js +0 -104
- package/dist/bin/mcp/types.js +0 -1
- package/dist/bin/plugins/index.js +0 -113
- package/dist/bin/plugins/providers/anthropic/index.js +0 -25
- package/dist/bin/plugins/providers/deepseek/index.js +0 -24
- package/dist/bin/plugins/providers/google/index.js +0 -26
- package/dist/bin/plugins/providers/index.js +0 -19
- package/dist/bin/plugins/providers/ollama/index.js +0 -59
- package/dist/bin/plugins/providers/openai/index.js +0 -26
- package/dist/bin/plugins/providers/xai/index.js +0 -24
- package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -8
- package/dist/bin/plugins/tools/bash/localBashPlugin.js +0 -13
- package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +0 -13
- package/dist/bin/plugins/tools/cloud/cloudPlugin.js +0 -13
- package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -13
- package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +0 -13
- package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +0 -11
- package/dist/bin/plugins/tools/development/devPlugin.js +0 -13
- package/dist/bin/plugins/tools/edit/editPlugin.js +0 -14
- package/dist/bin/plugins/tools/email/emailPlugin.js +0 -11
- package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -8
- package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +0 -13
- package/dist/bin/plugins/tools/glob/globPlugin.js +0 -14
- package/dist/bin/plugins/tools/index.js +0 -2
- package/dist/bin/plugins/tools/interaction/interactionPlugin.js +0 -11
- package/dist/bin/plugins/tools/learn/learnPlugin.js +0 -13
- package/dist/bin/plugins/tools/mcp/mcpPlugin.js +0 -8
- package/dist/bin/plugins/tools/nodeDefaults.js +0 -56
- package/dist/bin/plugins/tools/notebook/notebookPlugin.js +0 -14
- package/dist/bin/plugins/tools/planning/planningPlugin.js +0 -14
- package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +0 -11
- package/dist/bin/plugins/tools/registry.js +0 -57
- package/dist/bin/plugins/tools/search/localSearchPlugin.js +0 -13
- package/dist/bin/plugins/tools/skills/skillPlugin.js +0 -8
- package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +0 -11
- package/dist/bin/plugins/tools/testing/testingPlugin.js +0 -11
- package/dist/bin/plugins/tools/web/webPlugin.js +0 -11
- package/dist/bin/providers/anthropicProvider.js +0 -329
- package/dist/bin/providers/googleProvider.js +0 -203
- package/dist/bin/providers/openaiChatCompletionsProvider.js +0 -208
- package/dist/bin/providers/openaiResponsesProvider.js +0 -249
- package/dist/bin/providers/providerFactory.js +0 -24
- package/dist/bin/runtime/agentController.js +0 -321
- package/dist/bin/runtime/agentHost.js +0 -153
- package/dist/bin/runtime/agentSession.js +0 -195
- package/dist/bin/runtime/node.js +0 -10
- package/dist/bin/runtime/universal.js +0 -28
- package/dist/bin/skills/skillRepository.js +0 -236
- package/dist/bin/skills/types.js +0 -1
- package/dist/bin/subagents/taskRunner.js +0 -269
- package/dist/bin/tools/backgroundBashTools.js +0 -211
- package/dist/bin/tools/bashTools.js +0 -159
- package/dist/bin/tools/cloudTools.js +0 -864
- package/dist/bin/tools/codeAnalysisTools.js +0 -641
- package/dist/bin/tools/codeQualityTools.js +0 -294
- package/dist/bin/tools/dependencyTools.js +0 -282
- package/dist/bin/tools/devTools.js +0 -238
- package/dist/bin/tools/diffUtils.js +0 -137
- package/dist/bin/tools/editTools.js +0 -134
- package/dist/bin/tools/emailTools.js +0 -448
- package/dist/bin/tools/fileTools.js +0 -282
- package/dist/bin/tools/globTools.js +0 -173
- package/dist/bin/tools/grepTools.js +0 -332
- package/dist/bin/tools/interactionTools.js +0 -170
- package/dist/bin/tools/learnTools.js +0 -1818
- package/dist/bin/tools/notebookEditTools.js +0 -196
- package/dist/bin/tools/planningTools.js +0 -46
- package/dist/bin/tools/refactoringTools.js +0 -293
- package/dist/bin/tools/repoChecksTools.js +0 -160
- package/dist/bin/tools/searchTools.js +0 -206
- package/dist/bin/tools/skillTools.js +0 -177
- package/dist/bin/tools/taskManagementTools.js +0 -156
- package/dist/bin/tools/testingTools.js +0 -232
- package/dist/bin/tools/webTools.js +0 -480
- package/dist/bin/workspace.js +0 -106
- package/dist/bin/workspace.validator.js +0 -213
- package/dist/capabilities/offensiveSecurityCapability.d.ts +0 -26
- package/dist/capabilities/offensiveSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/offensiveSecurityCapability.js +0 -58
- package/dist/capabilities/offensiveSecurityCapability.js.map +0 -1
- package/dist/capabilities/realSecurityCapability.d.ts +0 -26
- package/dist/capabilities/realSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/realSecurityCapability.js +0 -53
- package/dist/capabilities/realSecurityCapability.js.map +0 -1
- package/dist/capabilities/securityCapability.d.ts +0 -32
- package/dist/capabilities/securityCapability.d.ts.map +0 -1
- package/dist/capabilities/securityCapability.js +0 -57
- package/dist/capabilities/securityCapability.js.map +0 -1
- package/dist/capabilities/ultimateSecurityCapability.d.ts +0 -42
- package/dist/capabilities/ultimateSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/ultimateSecurityCapability.js +0 -96
- package/dist/capabilities/ultimateSecurityCapability.js.map +0 -1
- package/dist/core/designThoughtCheck.d.ts +0 -196
- package/dist/core/designThoughtCheck.d.ts.map +0 -1
- package/dist/core/designThoughtCheck.js +0 -287
- package/dist/core/designThoughtCheck.js.map +0 -1
- package/dist/core/designThoughtCheckEngine.d.ts +0 -58
- package/dist/core/designThoughtCheckEngine.d.ts.map +0 -1
- package/dist/core/designThoughtCheckEngine.js +0 -358
- package/dist/core/designThoughtCheckEngine.js.map +0 -1
- package/dist/core/designThoughtCheckIntegration.d.ts +0 -103
- package/dist/core/designThoughtCheckIntegration.d.ts.map +0 -1
- package/dist/core/designThoughtCheckIntegration.js +0 -207
- package/dist/core/designThoughtCheckIntegration.js.map +0 -1
- package/dist/core/intelligenceTools.d.ts +0 -19
- package/dist/core/intelligenceTools.d.ts.map +0 -1
- package/dist/core/intelligenceTools.js +0 -453
- package/dist/core/intelligenceTools.js.map +0 -1
- package/dist/core/operationalTools.d.ts +0 -19
- package/dist/core/operationalTools.d.ts.map +0 -1
- package/dist/core/operationalTools.js +0 -467
- package/dist/core/operationalTools.js.map +0 -1
- package/dist/offensive/core/offensive-engine.d.ts +0 -171
- package/dist/offensive/core/offensive-engine.d.ts.map +0 -1
- package/dist/offensive/core/offensive-engine.js +0 -345
- package/dist/offensive/core/offensive-engine.js.map +0 -1
- package/dist/offensive/core/offensive-integration.d.ts +0 -129
- package/dist/offensive/core/offensive-integration.d.ts.map +0 -1
- package/dist/offensive/core/offensive-integration.js +0 -364
- package/dist/offensive/core/offensive-integration.js.map +0 -1
- package/dist/offensive/core/offensive-tools.d.ts +0 -55
- package/dist/offensive/core/offensive-tools.d.ts.map +0 -1
- package/dist/offensive/core/offensive-tools.js +0 -438
- package/dist/offensive/core/offensive-tools.js.map +0 -1
- package/dist/offensive/offensive-cli.d.ts +0 -48
- package/dist/offensive/offensive-cli.d.ts.map +0 -1
- package/dist/offensive/offensive-cli.js +0 -233
- package/dist/offensive/offensive-cli.js.map +0 -1
- package/dist/security/apt-simulation-cli.d.ts +0 -57
- package/dist/security/apt-simulation-cli.d.ts.map +0 -1
- package/dist/security/apt-simulation-cli.js +0 -278
- package/dist/security/apt-simulation-cli.js.map +0 -1
- package/dist/security/apt-simulation-engine-complete.d.ts +0 -97
- package/dist/security/apt-simulation-engine-complete.d.ts.map +0 -1
- package/dist/security/apt-simulation-engine-complete.js +0 -441
- package/dist/security/apt-simulation-engine-complete.js.map +0 -1
- package/dist/security/apt-simulation-engine.d.ts +0 -97
- package/dist/security/apt-simulation-engine.d.ts.map +0 -1
- package/dist/security/apt-simulation-engine.js +0 -441
- package/dist/security/apt-simulation-engine.js.map +0 -1
- package/dist/security/authorization.d.ts +0 -45
- package/dist/security/authorization.d.ts.map +0 -1
- package/dist/security/authorization.js +0 -128
- package/dist/security/authorization.js.map +0 -1
- package/dist/security/comprehensive-security-research.d.ts +0 -84
- package/dist/security/comprehensive-security-research.d.ts.map +0 -1
- package/dist/security/comprehensive-security-research.js +0 -211
- package/dist/security/comprehensive-security-research.js.map +0 -1
- package/dist/security/offensive/exploitationEngine.d.ts +0 -54
- package/dist/security/offensive/exploitationEngine.d.ts.map +0 -1
- package/dist/security/offensive/exploitationEngine.js +0 -263
- package/dist/security/offensive/exploitationEngine.js.map +0 -1
- package/dist/security/real/networkExploitation.d.ts +0 -92
- package/dist/security/real/networkExploitation.d.ts.map +0 -1
- package/dist/security/real/networkExploitation.js +0 -316
- package/dist/security/real/networkExploitation.js.map +0 -1
- package/dist/security/real/persistenceImplementation.d.ts +0 -62
- package/dist/security/real/persistenceImplementation.d.ts.map +0 -1
- package/dist/security/real/persistenceImplementation.js +0 -323
- package/dist/security/real/persistenceImplementation.js.map +0 -1
- package/dist/security/real/vulnerabilityScanner.d.ts +0 -73
- package/dist/security/real/vulnerabilityScanner.d.ts.map +0 -1
- package/dist/security/real/vulnerabilityScanner.js +0 -341
- package/dist/security/real/vulnerabilityScanner.js.map +0 -1
- package/dist/shell/capturePastePatch.d.ts +0 -9
- package/dist/shell/capturePastePatch.d.ts.map +0 -1
- package/dist/shell/capturePastePatch.js +0 -98
- package/dist/shell/capturePastePatch.js.map +0 -1
- package/dist/shell/enhancedInteractiveShell.d.ts +0 -90
- package/dist/shell/enhancedInteractiveShell.d.ts.map +0 -1
- package/dist/shell/enhancedInteractiveShell.js +0 -248
- package/dist/shell/enhancedInteractiveShell.js.map +0 -1
- package/dist/shell/inputProcessor.d.ts +0 -56
- package/dist/shell/inputProcessor.d.ts.map +0 -1
- package/dist/shell/inputProcessor.js +0 -172
- package/dist/shell/inputProcessor.js.map +0 -1
- package/dist/shell/interactiveShell-patch.d.ts +0 -27
- package/dist/shell/interactiveShell-patch.d.ts.map +0 -1
- package/dist/shell/interactiveShell-patch.js +0 -38
- package/dist/shell/interactiveShell-patch.js.map +0 -1
- package/dist/shell/interactiveShell-robust.d.ts +0 -26
- package/dist/shell/interactiveShell-robust.d.ts.map +0 -1
- package/dist/shell/interactiveShell-robust.js +0 -34
- package/dist/shell/interactiveShell-robust.js.map +0 -1
- package/dist/shell/multiLinePasteManager.d.ts +0 -106
- package/dist/shell/multiLinePasteManager.d.ts.map +0 -1
- package/dist/shell/multiLinePasteManager.js +0 -308
- package/dist/shell/multiLinePasteManager.js.map +0 -1
- package/dist/shell/processInputBlockPatch.d.ts +0 -8
- package/dist/shell/processInputBlockPatch.d.ts.map +0 -1
- package/dist/shell/processInputBlockPatch.js +0 -133
- package/dist/shell/processInputBlockPatch.js.map +0 -1
- package/dist/tools/enhancedSecurityTools.d.ts +0 -19
- package/dist/tools/enhancedSecurityTools.d.ts.map +0 -1
- package/dist/tools/enhancedSecurityTools.js +0 -215
- package/dist/tools/enhancedSecurityTools.js.map +0 -1
- package/dist/tools/offensiveSecurityTools.d.ts +0 -16
- package/dist/tools/offensiveSecurityTools.d.ts.map +0 -1
- package/dist/tools/offensiveSecurityTools.js +0 -285
- package/dist/tools/offensiveSecurityTools.js.map +0 -1
- package/dist/tools/realSecurityTools.d.ts +0 -18
- package/dist/tools/realSecurityTools.d.ts.map +0 -1
- package/dist/tools/realSecurityTools.js +0 -468
- package/dist/tools/realSecurityTools.js.map +0 -1
- package/dist/tools/securityTools.d.ts +0 -20
- package/dist/tools/securityTools.d.ts.map +0 -1
- package/dist/tools/securityTools.js +0 -449
- package/dist/tools/securityTools.js.map +0 -1
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Advanced Targeting Security Module
|
|
3
|
-
*
|
|
4
|
-
* Enables Erosolar CLI to analyze and operate on external active stacks
|
|
5
|
-
* and critical infrastructure while maintaining security controls.
|
|
6
|
-
*
|
|
7
|
-
* @license MIT
|
|
8
|
-
* @author Bo Shang
|
|
9
|
-
*
|
|
10
|
-
* DISCLAIMER: This software is provided for authorized security testing,
|
|
11
|
-
* research, and defensive purposes only. Users must ensure compliance
|
|
12
|
-
* with all applicable laws and regulations in their jurisdiction.
|
|
13
|
-
*/
|
|
14
|
-
import { type SecurityValidationResult } from './active-stack-security.js';
|
|
15
|
-
export interface TargetAuthorization {
|
|
16
|
-
/** Target identifier (domain, IP range, organization) */
|
|
17
|
-
target: string;
|
|
18
|
-
/** Authorization level */
|
|
19
|
-
level: 'research' | 'analysis' | 'testing' | 'operations';
|
|
20
|
-
/** Scope of authorized operations */
|
|
21
|
-
scope: string[];
|
|
22
|
-
/** Authorization source */
|
|
23
|
-
authorizedBy: string;
|
|
24
|
-
/** Expiration timestamp */
|
|
25
|
-
expiresAt?: Date;
|
|
26
|
-
/** Legal/compliance requirements */
|
|
27
|
-
compliance: {
|
|
28
|
-
jurisdiction: string;
|
|
29
|
-
legalFramework: string;
|
|
30
|
-
reportingRequirements: string[];
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export interface CriticalInfrastructureTarget {
|
|
34
|
-
/** Infrastructure category */
|
|
35
|
-
category: 'energy' | 'finance' | 'telecom' | 'government' | 'military' | 'healthcare' | 'transportation';
|
|
36
|
-
/** Target identifier */
|
|
37
|
-
identifier: string;
|
|
38
|
-
/** Country/region */
|
|
39
|
-
jurisdiction: string;
|
|
40
|
-
/** Sensitivity level */
|
|
41
|
-
sensitivity: 'low' | 'medium' | 'high' | 'critical';
|
|
42
|
-
/** Authorized operations */
|
|
43
|
-
authorizedOperations: string[];
|
|
44
|
-
/** Legal restrictions */
|
|
45
|
-
legalRestrictions: string[];
|
|
46
|
-
}
|
|
47
|
-
export interface OperationAuthorization {
|
|
48
|
-
/** Operation type */
|
|
49
|
-
type: 'scanning' | 'analysis' | 'vulnerability_assessment' | 'penetration_testing' | 'research';
|
|
50
|
-
/** Target information */
|
|
51
|
-
target: CriticalInfrastructureTarget | string;
|
|
52
|
-
/** Authorization level required */
|
|
53
|
-
requiredLevel: string;
|
|
54
|
-
/** Legal compliance requirements */
|
|
55
|
-
compliance: {
|
|
56
|
-
jurisdiction: string;
|
|
57
|
-
legalFramework: string;
|
|
58
|
-
reportingRequired: boolean;
|
|
59
|
-
evidenceCollection: boolean;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export declare class AdvancedTargetingSecurity {
|
|
63
|
-
private authorizedTargets;
|
|
64
|
-
private criticalInfrastructure;
|
|
65
|
-
private operationLog;
|
|
66
|
-
constructor();
|
|
67
|
-
/**
|
|
68
|
-
* Authorize a target for operations
|
|
69
|
-
*/
|
|
70
|
-
authorizeTarget(authorization: TargetAuthorization): void;
|
|
71
|
-
/**
|
|
72
|
-
* Validate operation on external target
|
|
73
|
-
*/
|
|
74
|
-
validateExternalOperation(operation: string, target: string, parameters: Record<string, unknown>): SecurityValidationResult;
|
|
75
|
-
/**
|
|
76
|
-
* Register critical infrastructure target
|
|
77
|
-
*/
|
|
78
|
-
registerCriticalInfrastructure(target: CriticalInfrastructureTarget): void;
|
|
79
|
-
/**
|
|
80
|
-
* Get authorized targets
|
|
81
|
-
*/
|
|
82
|
-
getAuthorizedTargets(): TargetAuthorization[];
|
|
83
|
-
/**
|
|
84
|
-
* Get critical infrastructure targets
|
|
85
|
-
*/
|
|
86
|
-
getCriticalInfrastructure(): CriticalInfrastructureTarget[];
|
|
87
|
-
/**
|
|
88
|
-
* Get operation log
|
|
89
|
-
*/
|
|
90
|
-
getOperationLog(): AdvancedOperationEvent[];
|
|
91
|
-
/**
|
|
92
|
-
* Generate targeting report
|
|
93
|
-
*/
|
|
94
|
-
generateTargetingReport(): string;
|
|
95
|
-
private initializeDefaultTargets;
|
|
96
|
-
private isOperationAuthorized;
|
|
97
|
-
private validateCriticalInfrastructureOperation;
|
|
98
|
-
private logAdvancedOperation;
|
|
99
|
-
}
|
|
100
|
-
export interface AdvancedOperationEvent {
|
|
101
|
-
type: string;
|
|
102
|
-
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
103
|
-
operation: string;
|
|
104
|
-
target: string;
|
|
105
|
-
timestamp: Date;
|
|
106
|
-
authorizationLevel?: string;
|
|
107
|
-
authorizedBy?: string;
|
|
108
|
-
details?: Record<string, unknown>;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Global advanced targeting security instance
|
|
112
|
-
*/
|
|
113
|
-
export declare const advancedTargetingSecurity: AdvancedTargetingSecurity;
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Advanced Targeting Security Module
|
|
4
|
-
*
|
|
5
|
-
* Enables Erosolar CLI to analyze and operate on external active stacks
|
|
6
|
-
* and critical infrastructure while maintaining security controls.
|
|
7
|
-
*
|
|
8
|
-
* @license MIT
|
|
9
|
-
* @author Bo Shang
|
|
10
|
-
*
|
|
11
|
-
* DISCLAIMER: This software is provided for authorized security testing,
|
|
12
|
-
* research, and defensive purposes only. Users must ensure compliance
|
|
13
|
-
* with all applicable laws and regulations in their jurisdiction.
|
|
14
|
-
*/
|
|
15
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
16
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
17
|
-
if (ar || !(i in from)) {
|
|
18
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
19
|
-
ar[i] = from[i];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.advancedTargetingSecurity = exports.AdvancedTargetingSecurity = void 0;
|
|
26
|
-
var AdvancedTargetingSecurity = /** @class */ (function () {
|
|
27
|
-
function AdvancedTargetingSecurity() {
|
|
28
|
-
this.authorizedTargets = new Map();
|
|
29
|
-
this.criticalInfrastructure = new Map();
|
|
30
|
-
this.operationLog = [];
|
|
31
|
-
this.initializeDefaultTargets();
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Authorize a target for operations
|
|
35
|
-
*/
|
|
36
|
-
AdvancedTargetingSecurity.prototype.authorizeTarget = function (authorization) {
|
|
37
|
-
this.authorizedTargets.set(authorization.target, authorization);
|
|
38
|
-
this.logAdvancedOperation({
|
|
39
|
-
type: 'target_authorization',
|
|
40
|
-
severity: 'high',
|
|
41
|
-
operation: 'authorize',
|
|
42
|
-
target: authorization.target,
|
|
43
|
-
authorizationLevel: authorization.level,
|
|
44
|
-
authorizedBy: authorization.authorizedBy,
|
|
45
|
-
timestamp: new Date(),
|
|
46
|
-
details: {
|
|
47
|
-
scope: authorization.scope,
|
|
48
|
-
compliance: authorization.compliance
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Validate operation on external target
|
|
54
|
-
*/
|
|
55
|
-
AdvancedTargetingSecurity.prototype.validateExternalOperation = function (operation, target, parameters) {
|
|
56
|
-
// Check if target is authorized
|
|
57
|
-
var authorization = this.authorizedTargets.get(target);
|
|
58
|
-
if (!authorization) {
|
|
59
|
-
return {
|
|
60
|
-
allowed: false,
|
|
61
|
-
reason: 'Target not authorized for external operations',
|
|
62
|
-
severity: 'high',
|
|
63
|
-
details: { target: target, operation: operation }
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
// Check authorization level
|
|
67
|
-
if (!this.isOperationAuthorized(operation, authorization.level)) {
|
|
68
|
-
return {
|
|
69
|
-
allowed: false,
|
|
70
|
-
reason: "Operation '".concat(operation, "' not authorized for target '").concat(target, "'"),
|
|
71
|
-
severity: 'high',
|
|
72
|
-
details: { target: target, operation: operation, authorizationLevel: authorization.level }
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
// Check expiration
|
|
76
|
-
if (authorization.expiresAt && authorization.expiresAt < new Date()) {
|
|
77
|
-
return {
|
|
78
|
-
allowed: false,
|
|
79
|
-
reason: 'Target authorization has expired',
|
|
80
|
-
severity: 'high',
|
|
81
|
-
details: { target: target, expiresAt: authorization.expiresAt }
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
// Check for critical infrastructure
|
|
85
|
-
var criticalTarget = this.criticalInfrastructure.get(target);
|
|
86
|
-
if (criticalTarget) {
|
|
87
|
-
return this.validateCriticalInfrastructureOperation(operation, criticalTarget, parameters);
|
|
88
|
-
}
|
|
89
|
-
// Log the authorized operation
|
|
90
|
-
this.logAdvancedOperation({
|
|
91
|
-
type: 'external_operation',
|
|
92
|
-
severity: 'medium',
|
|
93
|
-
operation: operation,
|
|
94
|
-
target: target,
|
|
95
|
-
authorizationLevel: authorization.level,
|
|
96
|
-
timestamp: new Date(),
|
|
97
|
-
details: {
|
|
98
|
-
parameters: parameters,
|
|
99
|
-
authorizedBy: authorization.authorizedBy,
|
|
100
|
-
compliance: authorization.compliance
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
return { allowed: true, severity: 'low' };
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Register critical infrastructure target
|
|
107
|
-
*/
|
|
108
|
-
AdvancedTargetingSecurity.prototype.registerCriticalInfrastructure = function (target) {
|
|
109
|
-
this.criticalInfrastructure.set(target.identifier, target);
|
|
110
|
-
this.logAdvancedOperation({
|
|
111
|
-
type: 'critical_infrastructure_registration',
|
|
112
|
-
severity: 'critical',
|
|
113
|
-
operation: 'register',
|
|
114
|
-
target: target.identifier,
|
|
115
|
-
timestamp: new Date(),
|
|
116
|
-
details: {
|
|
117
|
-
category: target.category,
|
|
118
|
-
jurisdiction: target.jurisdiction,
|
|
119
|
-
sensitivity: target.sensitivity
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Get authorized targets
|
|
125
|
-
*/
|
|
126
|
-
AdvancedTargetingSecurity.prototype.getAuthorizedTargets = function () {
|
|
127
|
-
return Array.from(this.authorizedTargets.values());
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* Get critical infrastructure targets
|
|
131
|
-
*/
|
|
132
|
-
AdvancedTargetingSecurity.prototype.getCriticalInfrastructure = function () {
|
|
133
|
-
return Array.from(this.criticalInfrastructure.values());
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Get operation log
|
|
137
|
-
*/
|
|
138
|
-
AdvancedTargetingSecurity.prototype.getOperationLog = function () {
|
|
139
|
-
return __spreadArray([], this.operationLog, true);
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* Generate targeting report
|
|
143
|
-
*/
|
|
144
|
-
AdvancedTargetingSecurity.prototype.generateTargetingReport = function () {
|
|
145
|
-
var authorized = this.getAuthorizedTargets();
|
|
146
|
-
var critical = this.getCriticalInfrastructure();
|
|
147
|
-
var operations = this.getOperationLog();
|
|
148
|
-
var report = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
149
|
-
'🎯 Advanced Targeting Security Report',
|
|
150
|
-
'=====================================',
|
|
151
|
-
"Authorized Targets: ".concat(authorized.length),
|
|
152
|
-
"Critical Infrastructure: ".concat(critical.length),
|
|
153
|
-
"Total Operations: ".concat(operations.length),
|
|
154
|
-
'',
|
|
155
|
-
'🔐 Authorized Targets:'
|
|
156
|
-
], authorized.map(function (auth) {
|
|
157
|
-
return " \u2022 ".concat(auth.target, " (").concat(auth.level, ") - ").concat(auth.authorizedBy);
|
|
158
|
-
}), true), [
|
|
159
|
-
'',
|
|
160
|
-
'🏛️ Critical Infrastructure:'
|
|
161
|
-
], false), critical.map(function (infra) {
|
|
162
|
-
return " \u2022 ".concat(infra.identifier, " (").concat(infra.category, ") - ").concat(infra.jurisdiction, " [").concat(infra.sensitivity, "]");
|
|
163
|
-
}), true), [
|
|
164
|
-
'',
|
|
165
|
-
'📊 Recent Operations:'
|
|
166
|
-
], false), operations.slice(-10).map(function (op) {
|
|
167
|
-
return " \u2022 ".concat(op.timestamp.toISOString(), " - ").concat(op.type, " on ").concat(op.target, " [").concat(op.severity, "]");
|
|
168
|
-
}), true);
|
|
169
|
-
return report.join('\n');
|
|
170
|
-
};
|
|
171
|
-
AdvancedTargetingSecurity.prototype.initializeDefaultTargets = function () {
|
|
172
|
-
// Example: Research authorization for security analysis
|
|
173
|
-
this.authorizeTarget({
|
|
174
|
-
target: '*.gov',
|
|
175
|
-
level: 'research',
|
|
176
|
-
scope: ['vulnerability_scanning', 'security_analysis'],
|
|
177
|
-
authorizedBy: 'Security Research Team',
|
|
178
|
-
compliance: {
|
|
179
|
-
jurisdiction: 'International',
|
|
180
|
-
legalFramework: 'Authorized Security Research',
|
|
181
|
-
reportingRequirements: ['vulnerability_disclosure']
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
// Example: Critical infrastructure for analysis
|
|
185
|
-
this.registerCriticalInfrastructure({
|
|
186
|
-
category: 'energy',
|
|
187
|
-
identifier: 'power-grid-*.gov',
|
|
188
|
-
jurisdiction: 'Multiple',
|
|
189
|
-
sensitivity: 'critical',
|
|
190
|
-
authorizedOperations: ['security_analysis', 'vulnerability_assessment'],
|
|
191
|
-
legalRestrictions: ['no_exploitation', 'responsible_disclosure']
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
AdvancedTargetingSecurity.prototype.isOperationAuthorized = function (operation, authorizationLevel) {
|
|
195
|
-
var operationLevels = {
|
|
196
|
-
'research': ['scanning', 'analysis', 'vulnerability_assessment'],
|
|
197
|
-
'analysis': ['scanning', 'analysis', 'vulnerability_assessment', 'security_testing'],
|
|
198
|
-
'testing': ['scanning', 'analysis', 'vulnerability_assessment', 'security_testing', 'penetration_testing'],
|
|
199
|
-
'operations': ['scanning', 'analysis', 'vulnerability_assessment', 'security_testing', 'penetration_testing', 'remediation']
|
|
200
|
-
};
|
|
201
|
-
var allowedOperations = operationLevels[authorizationLevel] || [];
|
|
202
|
-
return allowedOperations.includes(operation);
|
|
203
|
-
};
|
|
204
|
-
AdvancedTargetingSecurity.prototype.validateCriticalInfrastructureOperation = function (operation, target, parameters) {
|
|
205
|
-
// Enhanced validation for critical infrastructure
|
|
206
|
-
if (!target.authorizedOperations.includes(operation)) {
|
|
207
|
-
return {
|
|
208
|
-
allowed: false,
|
|
209
|
-
reason: "Operation '".concat(operation, "' not authorized for critical infrastructure '").concat(target.identifier, "'"),
|
|
210
|
-
severity: 'critical',
|
|
211
|
-
details: {
|
|
212
|
-
target: target.identifier,
|
|
213
|
-
operation: operation,
|
|
214
|
-
authorizedOperations: target.authorizedOperations,
|
|
215
|
-
legalRestrictions: target.legalRestrictions
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
// Additional compliance checks for critical targets
|
|
220
|
-
if (target.sensitivity === 'critical') {
|
|
221
|
-
this.logAdvancedOperation({
|
|
222
|
-
type: 'critical_infrastructure_operation',
|
|
223
|
-
severity: 'critical',
|
|
224
|
-
operation: operation,
|
|
225
|
-
target: target.identifier,
|
|
226
|
-
timestamp: new Date(),
|
|
227
|
-
details: {
|
|
228
|
-
parameters: parameters,
|
|
229
|
-
category: target.category,
|
|
230
|
-
jurisdiction: target.jurisdiction,
|
|
231
|
-
sensitivity: target.sensitivity,
|
|
232
|
-
legalRestrictions: target.legalRestrictions
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
return { allowed: true, severity: 'medium' };
|
|
237
|
-
};
|
|
238
|
-
AdvancedTargetingSecurity.prototype.logAdvancedOperation = function (event) {
|
|
239
|
-
this.operationLog.push(event);
|
|
240
|
-
// Keep log size manageable
|
|
241
|
-
if (this.operationLog.length > 1000) {
|
|
242
|
-
this.operationLog = this.operationLog.slice(-500);
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
return AdvancedTargetingSecurity;
|
|
246
|
-
}());
|
|
247
|
-
exports.AdvancedTargetingSecurity = AdvancedTargetingSecurity;
|
|
248
|
-
/**
|
|
249
|
-
* Global advanced targeting security instance
|
|
250
|
-
*/
|
|
251
|
-
exports.advancedTargetingSecurity = new AdvancedTargetingSecurity();
|
|
252
|
-
//# sourceMappingURL=advanced-targeting.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"advanced-targeting.js","sourceRoot":"","sources":["../src/security/advanced-targeting.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;AAsDH;IAKE;QAJQ,sBAAiB,GAAqC,IAAI,GAAG,EAAE,CAAC;QAChE,2BAAsB,GAA8C,IAAI,GAAG,EAAE,CAAC;QAC9E,iBAAY,GAA6B,EAAE,CAAC;Q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,YAAY;oBACjC,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC/B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;iBAC5C;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAC/C,CAAC;IAEO,wDAAoB,GAA5B,UAA6B,KAA6B;QACxD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE9B,2BAA2B;QAC3B,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;YACpC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IACH,gCAAC;AAAD,CAAC,AA9PD,IA8PC;AA9PY,8DAAyB;AA2QtC;;GAEG;AACU,QAAA,yBAAyB,GAAG,IAAI,yBAAyB,EAAE,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { instantiateToolPlugins, registerDefaultNodeToolPlugins, } from '../../plugins/tools/index.js';
|
|
2
|
-
export class NodeRuntimeAdapter {
|
|
3
|
-
constructor(options = {}) {
|
|
4
|
-
this.id = 'runtime.node';
|
|
5
|
-
this.options = options;
|
|
6
|
-
}
|
|
7
|
-
async createCapabilityModules(context) {
|
|
8
|
-
registerDefaultNodeToolPlugins();
|
|
9
|
-
const filter = (plugin) => {
|
|
10
|
-
if (this.options.includeFilesystem === false && plugin.id === 'tool.filesystem.local') {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
if (this.options.includeSearch === false && plugin.id === 'tool.search.local') {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
if (this.options.includeBash === false && plugin.id === 'tool.bash.local') {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (this.options.filter && !this.options.filter(plugin)) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
return true;
|
|
23
|
-
};
|
|
24
|
-
const modules = await instantiateToolPlugins('node', {
|
|
25
|
-
workingDir: context.workingDir,
|
|
26
|
-
env: context.env,
|
|
27
|
-
}, { filter });
|
|
28
|
-
if (this.options.extraModules?.length) {
|
|
29
|
-
modules.push(...this.options.extraModules);
|
|
30
|
-
}
|
|
31
|
-
return modules;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Alpha Zero 2 - Agent Wrapper
|
|
3
|
-
*
|
|
4
|
-
* Wraps the AgentRuntime with Alpha Zero 2 capabilities for
|
|
5
|
-
* performance tracking, code quality evaluation, and competitive metrics.
|
|
6
|
-
*
|
|
7
|
-
* Principal Investigator: Bo Shang
|
|
8
|
-
* Framework: erosolar-cli
|
|
9
|
-
*/
|
|
10
|
-
import { MetricsTracker } from './metricsTracker.js';
|
|
11
|
-
import { extractCodeBlocks, evaluateCodeQuality, calculateRewardScore } from './codeEvaluator.js';
|
|
12
|
-
/**
|
|
13
|
-
* Wrapper around AgentRuntime that adds Alpha Zero 2 capabilities.
|
|
14
|
-
*
|
|
15
|
-
* Provides:
|
|
16
|
-
* - Performance introspection
|
|
17
|
-
* - Code quality evaluation
|
|
18
|
-
* - Competitive metrics tracking
|
|
19
|
-
* - Self-improvement suggestions
|
|
20
|
-
*/
|
|
21
|
-
export class AlphaZeroAgentWrapper {
|
|
22
|
-
constructor(options) {
|
|
23
|
-
this.currentTraceId = 0;
|
|
24
|
-
this.agent = options.agent;
|
|
25
|
-
this.agentId = options.agentId ?? 'agent';
|
|
26
|
-
this.enableIntrospection = options.enableIntrospection ?? true;
|
|
27
|
-
this.enableCodeEvaluation = options.enableCodeEvaluation ?? true;
|
|
28
|
-
this.metricsTracker = new MetricsTracker(this.agentId);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Send a message with performance tracking.
|
|
32
|
-
*/
|
|
33
|
-
async send(text, useStreaming = false) {
|
|
34
|
-
const startTime = Date.now();
|
|
35
|
-
const traceId = `trace-${this.currentTraceId++}`;
|
|
36
|
-
const toolCalls = [];
|
|
37
|
-
try {
|
|
38
|
-
const response = await this.agent.send(text, useStreaming);
|
|
39
|
-
const elapsedMs = Date.now() - startTime;
|
|
40
|
-
// Track metrics
|
|
41
|
-
this.metricsTracker.recordMessage(elapsedMs);
|
|
42
|
-
// Evaluate code quality if response contains code
|
|
43
|
-
if (this.enableCodeEvaluation && response.includes('```')) {
|
|
44
|
-
await this.evaluateResponseCode(response);
|
|
45
|
-
}
|
|
46
|
-
// Add execution trace if introspection is enabled
|
|
47
|
-
if (this.enableIntrospection) {
|
|
48
|
-
const trace = {
|
|
49
|
-
traceId,
|
|
50
|
-
timestamp: new Date().toISOString(),
|
|
51
|
-
prompt: text,
|
|
52
|
-
response,
|
|
53
|
-
toolCalls,
|
|
54
|
-
totalDurationMs: elapsedMs,
|
|
55
|
-
};
|
|
56
|
-
this.metricsTracker.addTrace(trace);
|
|
57
|
-
}
|
|
58
|
-
return response;
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
const elapsedMs = Date.now() - startTime;
|
|
62
|
-
this.metricsTracker.recordMessage(elapsedMs);
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Evaluate code quality in a response.
|
|
68
|
-
*/
|
|
69
|
-
async evaluateResponseCode(response) {
|
|
70
|
-
const codeBlocks = extractCodeBlocks(response);
|
|
71
|
-
if (codeBlocks.length === 0) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
this.metricsTracker.recordCodeGeneration(codeBlocks.length);
|
|
75
|
-
// Evaluate each code block
|
|
76
|
-
for (const code of codeBlocks) {
|
|
77
|
-
try {
|
|
78
|
-
const metrics = evaluateCodeQuality(code);
|
|
79
|
-
this.metricsTracker.recordCodeQuality(metrics);
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
// Ignore evaluation errors
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Record a tool call result.
|
|
88
|
-
*/
|
|
89
|
-
recordToolCall(success) {
|
|
90
|
-
this.metricsTracker.recordToolCall(success);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Get current performance metrics.
|
|
94
|
-
*/
|
|
95
|
-
getMetrics() {
|
|
96
|
-
return this.metricsTracker.getMetrics();
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Get human-readable performance summary.
|
|
100
|
-
*/
|
|
101
|
-
getPerformanceSummary() {
|
|
102
|
-
return this.metricsTracker.getPerformanceSummary();
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Get execution traces.
|
|
106
|
-
*/
|
|
107
|
-
getTraces() {
|
|
108
|
-
return this.metricsTracker.getTraces();
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Get improvement suggestions based on metrics.
|
|
112
|
-
*/
|
|
113
|
-
getImprovementSuggestions() {
|
|
114
|
-
return this.metricsTracker.getImprovementSuggestions();
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Get metrics as a dictionary for serialization.
|
|
118
|
-
*/
|
|
119
|
-
getMetricsDict() {
|
|
120
|
-
const metrics = this.metricsTracker.getMetrics();
|
|
121
|
-
return {
|
|
122
|
-
sessionId: metrics.sessionId,
|
|
123
|
-
totalMessages: metrics.totalMessages,
|
|
124
|
-
totalTimeMs: metrics.totalTimeMs,
|
|
125
|
-
avgResponseTimeMs: metrics.avgResponseTimeMs,
|
|
126
|
-
codeBlocksGenerated: metrics.codeBlocksGenerated,
|
|
127
|
-
tokenUsage: metrics.totalTokensUsed,
|
|
128
|
-
toolUsage: {
|
|
129
|
-
totalCalls: metrics.totalToolCalls,
|
|
130
|
-
successfulCalls: metrics.successfulToolCalls,
|
|
131
|
-
failedCalls: metrics.failedToolCalls,
|
|
132
|
-
},
|
|
133
|
-
codeQuality: {
|
|
134
|
-
qualityScore: metrics.avgCodeQuality,
|
|
135
|
-
algorithmEfficiency: metrics.avgAlgorithmEfficiency,
|
|
136
|
-
errorHandling: metrics.avgErrorHandling,
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Reset all metrics.
|
|
142
|
-
*/
|
|
143
|
-
resetMetrics() {
|
|
144
|
-
this.metricsTracker.reset();
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Get the underlying agent runtime.
|
|
148
|
-
*/
|
|
149
|
-
getAgent() {
|
|
150
|
-
return this.agent;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Get the agent ID.
|
|
154
|
-
*/
|
|
155
|
-
getAgentId() {
|
|
156
|
-
return this.agentId;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Evaluate a single code snippet and return a reward score.
|
|
160
|
-
*/
|
|
161
|
-
evaluateCode(code) {
|
|
162
|
-
const metrics = evaluateCodeQuality(code);
|
|
163
|
-
return calculateRewardScore(metrics);
|
|
164
|
-
}
|
|
165
|
-
}
|