minovative-mind-cli 2.11.4 → 2.12.0
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/README.md +21 -7
- package/dist/commands/eval.d.ts +22 -0
- package/dist/commands/eval.js +141 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/services/agent/toolLoop.d.ts +4 -0
- package/dist/services/agent/toolLoop.js +61 -10
- package/dist/services/agent-tools.d.ts +5 -5
- package/dist/services/agent-tools.js +147 -9
- package/dist/services/ai.d.ts +1 -1
- package/dist/services/ai.js +40 -7
- package/dist/services/contextAgent.d.ts +1 -0
- package/dist/services/contextAgent.js +29 -6
- package/dist/services/investigationComplexity.d.ts +39 -13
- package/dist/services/investigationComplexity.js +325 -46
- package/dist/services/metrics.d.ts +10 -0
- package/dist/services/metrics.js +24 -0
- package/dist/services/orchestration/scopedTools.d.ts +27 -50
- package/dist/services/orchestration/scopedTools.js +60 -18
- package/dist/services/swebench/gitDiffExtractor.d.ts +57 -0
- package/dist/services/swebench/gitDiffExtractor.js +209 -0
- package/dist/services/swebench/index.d.ts +4 -0
- package/dist/services/swebench/index.js +4 -0
- package/dist/services/swebench/instanceLoader.d.ts +21 -0
- package/dist/services/swebench/instanceLoader.js +171 -0
- package/dist/services/swebench/sweBenchRunnerService.d.ts +38 -0
- package/dist/services/swebench/sweBenchRunnerService.js +618 -0
- package/dist/services/swebench/types.d.ts +167 -0
- package/dist/services/swebench/types.js +7 -0
- package/dist/services/verificationService.js +3 -0
- package/dist/services/workspaceRegistry.d.ts +81 -8
- package/dist/services/workspaceRegistry.js +222 -34
- package/dist/utils/analysisRunner.js +2 -1
- package/dist/utils/pathSecurity.d.ts +56 -14
- package/dist/utils/pathSecurity.js +120 -39
- package/dist/utils/systemPrompts.d.ts +6 -6
- package/dist/utils/systemPrompts.js +46 -25
- package/oclif.manifest.json +137 -1
- package/package.json +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWE-bench Evaluation Types and Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Defines data contracts for SWE-bench Lite instances, predictions,
|
|
5
|
+
* configuration options, execution progress, and evaluation results.
|
|
6
|
+
*/
|
|
7
|
+
export interface SWEBenchInstance {
|
|
8
|
+
instance_id: string;
|
|
9
|
+
repo: string;
|
|
10
|
+
base_commit: string;
|
|
11
|
+
problem_statement: string;
|
|
12
|
+
hints_text?: string;
|
|
13
|
+
created_at?: string;
|
|
14
|
+
test_patch?: string;
|
|
15
|
+
version?: string;
|
|
16
|
+
environment_setup_commit?: string;
|
|
17
|
+
FAIL_TO_PASS?: string[] | string;
|
|
18
|
+
PASS_TO_PASS?: string[] | string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface SWEBenchPrediction {
|
|
22
|
+
instance_id: string;
|
|
23
|
+
model_patch: string;
|
|
24
|
+
model_name_or_path: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SWEBenchProgress {
|
|
27
|
+
completed: number;
|
|
28
|
+
total: number;
|
|
29
|
+
currentInstanceId: string;
|
|
30
|
+
status: 'running' | 'success' | 'error' | 'skipped';
|
|
31
|
+
elapsedMs: number;
|
|
32
|
+
error?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SWEBenchInstanceTokens {
|
|
35
|
+
inputTokens: number;
|
|
36
|
+
outputTokens: number;
|
|
37
|
+
cachedTokens: number;
|
|
38
|
+
totalTokens: number;
|
|
39
|
+
}
|
|
40
|
+
export interface SWEBenchRepoMetrics {
|
|
41
|
+
total: number;
|
|
42
|
+
succeeded: number;
|
|
43
|
+
failed: number;
|
|
44
|
+
passRatePercent: number;
|
|
45
|
+
averageDurationMs: number;
|
|
46
|
+
}
|
|
47
|
+
export interface SWEBenchInstanceRecoveryMetrics {
|
|
48
|
+
circuitBreakerTrips: number;
|
|
49
|
+
prunedLines: number;
|
|
50
|
+
prunedChars: number;
|
|
51
|
+
}
|
|
52
|
+
export interface SWEBenchEvaluationRecoveryMetrics {
|
|
53
|
+
totalCircuitBreakerTrips: number;
|
|
54
|
+
totalPrunedLines: number;
|
|
55
|
+
totalPrunedChars: number;
|
|
56
|
+
}
|
|
57
|
+
export interface SWEBenchEvaluationMetrics {
|
|
58
|
+
totalTokens: number;
|
|
59
|
+
totalInputTokens: number;
|
|
60
|
+
totalOutputTokens: number;
|
|
61
|
+
totalCachedTokens: number;
|
|
62
|
+
cacheHitRatePercent: number;
|
|
63
|
+
averageDurationMs: number;
|
|
64
|
+
minDurationMs: number;
|
|
65
|
+
maxDurationMs: number;
|
|
66
|
+
totalDiffCharacters: number;
|
|
67
|
+
averageDiffCharacters: number;
|
|
68
|
+
recoveryMetrics?: SWEBenchEvaluationRecoveryMetrics;
|
|
69
|
+
repoBreakdown: Record<string, SWEBenchRepoMetrics>;
|
|
70
|
+
environment: {
|
|
71
|
+
platform: string;
|
|
72
|
+
architecture: string;
|
|
73
|
+
nodeVersion: string;
|
|
74
|
+
modelName: string;
|
|
75
|
+
timestamp: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface SWEBenchInstanceResult {
|
|
79
|
+
instance_id: string;
|
|
80
|
+
repo: string;
|
|
81
|
+
base_commit: string;
|
|
82
|
+
prediction: SWEBenchPrediction;
|
|
83
|
+
success: boolean;
|
|
84
|
+
executionTimeMs: number;
|
|
85
|
+
diffSizeChars: number;
|
|
86
|
+
turnCount?: number;
|
|
87
|
+
tokens?: SWEBenchInstanceTokens;
|
|
88
|
+
recoveryMetrics?: SWEBenchInstanceRecoveryMetrics;
|
|
89
|
+
error?: string;
|
|
90
|
+
logs?: string[];
|
|
91
|
+
}
|
|
92
|
+
export interface SWEBenchEvaluationSummary {
|
|
93
|
+
total: number;
|
|
94
|
+
succeeded: number;
|
|
95
|
+
failed: number;
|
|
96
|
+
skipped: number;
|
|
97
|
+
durationMs: number;
|
|
98
|
+
predictionsFilePath?: string;
|
|
99
|
+
reportFilePath?: string;
|
|
100
|
+
metrics?: SWEBenchEvaluationMetrics;
|
|
101
|
+
results: SWEBenchInstanceResult[];
|
|
102
|
+
}
|
|
103
|
+
export interface InstanceFilterOptions {
|
|
104
|
+
instanceIds?: string[];
|
|
105
|
+
repo?: string;
|
|
106
|
+
limit?: number;
|
|
107
|
+
offset?: number;
|
|
108
|
+
shuffle?: boolean;
|
|
109
|
+
seed?: number;
|
|
110
|
+
}
|
|
111
|
+
export interface AgentExecutorResult {
|
|
112
|
+
tokens?: SWEBenchInstanceTokens;
|
|
113
|
+
recoveryMetrics?: SWEBenchInstanceRecoveryMetrics;
|
|
114
|
+
}
|
|
115
|
+
export interface AgentExecutorParams {
|
|
116
|
+
instance: SWEBenchInstance;
|
|
117
|
+
workspaceDir: string;
|
|
118
|
+
prompt: string;
|
|
119
|
+
abortSignal?: AbortSignal;
|
|
120
|
+
onLog?: (message: string) => void;
|
|
121
|
+
}
|
|
122
|
+
export interface RunInstanceOptions {
|
|
123
|
+
workspaceDir?: string;
|
|
124
|
+
modelName?: string;
|
|
125
|
+
maxTurns?: number;
|
|
126
|
+
timeoutMs?: number;
|
|
127
|
+
resetWorkspace?: boolean;
|
|
128
|
+
autoCommitUntracked?: boolean;
|
|
129
|
+
autoCloneRepos?: boolean;
|
|
130
|
+
dryRun?: boolean;
|
|
131
|
+
verbose?: boolean;
|
|
132
|
+
customSystemPrompt?: string;
|
|
133
|
+
agentExecutor?: (params: AgentExecutorParams) => Promise<void | AgentExecutorResult>;
|
|
134
|
+
onLog?: (message: string) => void;
|
|
135
|
+
abortSignal?: AbortSignal;
|
|
136
|
+
}
|
|
137
|
+
export interface SWEBenchEvaluationOptions {
|
|
138
|
+
instances?: SWEBenchInstance[];
|
|
139
|
+
instancesPath?: string;
|
|
140
|
+
instanceIds?: string[];
|
|
141
|
+
repo?: string;
|
|
142
|
+
limit?: number;
|
|
143
|
+
offset?: number;
|
|
144
|
+
shuffle?: boolean;
|
|
145
|
+
seed?: number;
|
|
146
|
+
workspacesBaseDir?: string;
|
|
147
|
+
workspaceDirMap?: Record<string, string>;
|
|
148
|
+
outputPredictionsPath?: string;
|
|
149
|
+
reportPath?: string;
|
|
150
|
+
modelName?: string;
|
|
151
|
+
maxTurns?: number;
|
|
152
|
+
timeoutMsPerInstance?: number;
|
|
153
|
+
concurrency?: number;
|
|
154
|
+
resetWorkspaceBeforeRun?: boolean;
|
|
155
|
+
autoCloneRepos?: boolean;
|
|
156
|
+
dryRun?: boolean;
|
|
157
|
+
verbose?: boolean;
|
|
158
|
+
agentExecutor?: (params: AgentExecutorParams) => Promise<void | AgentExecutorResult>;
|
|
159
|
+
onProgress?: (progress: SWEBenchProgress) => void;
|
|
160
|
+
onInstanceComplete?: (result: SWEBenchInstanceResult) => void;
|
|
161
|
+
logger?: {
|
|
162
|
+
info?: (msg: string) => void;
|
|
163
|
+
warn?: (msg: string) => void;
|
|
164
|
+
error?: (msg: string) => void;
|
|
165
|
+
debug?: (msg: string) => void;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -236,6 +236,9 @@ Please fix these errors using the modify_file tool.`;
|
|
|
236
236
|
}
|
|
237
237
|
import { auditFilePerformance, formatAuditForModel, formatAuditForTerminal, isAuditableFile, } from '../utils/performanceAuditor.js';
|
|
238
238
|
export async function verifyChangedFiles(workspaceRoot, filePaths, abortSignal) {
|
|
239
|
+
if (process.env.MMCLI_SKIP_VERIFICATION === 'true' || process.env.SKIP_VERIFICATION === '1') {
|
|
240
|
+
return { errors: null, warnings: null };
|
|
241
|
+
}
|
|
239
242
|
const errors = [];
|
|
240
243
|
const perfAudits = [];
|
|
241
244
|
// Determine the effective verification root
|
|
@@ -24,15 +24,27 @@ export interface Profile {
|
|
|
24
24
|
* Result of resolving an `@alias/relative/path` string against the workspace registry.
|
|
25
25
|
*/
|
|
26
26
|
export interface ResolvedWorkspacePath {
|
|
27
|
-
/** The alias that was matched (e.g., "backend"). */
|
|
28
|
-
alias: string;
|
|
29
|
-
/** The absolute root directory of the matched registered workspace. */
|
|
27
|
+
/** The alias that was matched (e.g., "backend"), or null for primary workspace. */
|
|
28
|
+
alias: string | null;
|
|
29
|
+
/** The absolute root directory of the matched registered workspace or primary workspace. */
|
|
30
30
|
workspaceRoot: string;
|
|
31
31
|
/** The relative path within that workspace (e.g., "src/routes.ts"). */
|
|
32
32
|
relativePath: string;
|
|
33
33
|
/** The fully resolved absolute path to the target file or directory. */
|
|
34
34
|
absolutePath: string;
|
|
35
|
+
/** Whether the path was resolved via primary sub-path auto-focusing. */
|
|
36
|
+
isAutoFocused?: boolean;
|
|
35
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the global configuration directory for Minovative Mind CLI.
|
|
40
|
+
* During automated tests, returns an isolated temporary directory to prevent test runs
|
|
41
|
+
* from modifying the developer's live workspace configurations.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getGlobalConfigDir(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the active path to the workspace registry JSON file.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getRegistryFile(): string;
|
|
36
48
|
/**
|
|
37
49
|
* Service that manages a global registry of external workspace roots.
|
|
38
50
|
*
|
|
@@ -54,11 +66,16 @@ declare class WorkspaceRegistry {
|
|
|
54
66
|
private profiles;
|
|
55
67
|
/** Whether the registry has been loaded from disk. */
|
|
56
68
|
private initialized;
|
|
69
|
+
private primarySubPath;
|
|
57
70
|
/**
|
|
58
71
|
* Initializes the registry by loading persisted workspace entries from disk.
|
|
59
72
|
* Safe to call multiple times — subsequent calls are no-ops.
|
|
60
73
|
*/
|
|
61
74
|
init(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Internal guard to guarantee the registry is loaded before any read or write operation.
|
|
77
|
+
*/
|
|
78
|
+
private ensureInitialized;
|
|
62
79
|
/**
|
|
63
80
|
* Registers a new external workspace root with the given alias under a profile.
|
|
64
81
|
*
|
|
@@ -124,15 +141,71 @@ declare class WorkspaceRegistry {
|
|
|
124
141
|
root: string;
|
|
125
142
|
}>;
|
|
126
143
|
/**
|
|
127
|
-
*
|
|
144
|
+
* Sets the active primary sub-path for auto-focusing relative file queries.
|
|
145
|
+
*
|
|
146
|
+
* @param subPath - The relative directory path within the primary workspace (e.g., "src/services"), or null to clear.
|
|
147
|
+
*/
|
|
148
|
+
setPrimarySubPath(subPath: string | null): void;
|
|
149
|
+
/**
|
|
150
|
+
* Returns the currently active primary sub-path, or null if none is set.
|
|
151
|
+
*/
|
|
152
|
+
getPrimarySubPath(): string | null;
|
|
153
|
+
/**
|
|
154
|
+
* Returns whether a primary sub-path is currently active.
|
|
155
|
+
*/
|
|
156
|
+
hasPrimarySubPath(): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Clears the active primary sub-path.
|
|
159
|
+
*/
|
|
160
|
+
clearPrimarySubPath(): void;
|
|
161
|
+
/**
|
|
162
|
+
* Gets the focused root directory for the given primary workspace root.
|
|
163
|
+
* If a primary sub-path is active, returns the resolved sub-path directory;
|
|
164
|
+
* otherwise returns the primary root.
|
|
165
|
+
*
|
|
166
|
+
* @param primaryRoot - The base primary workspace root directory.
|
|
167
|
+
*/
|
|
168
|
+
getFocusedRoot(primaryRoot: string): string;
|
|
169
|
+
/**
|
|
170
|
+
* Checks whether a target path is securely contained within a given boundary root.
|
|
171
|
+
*
|
|
172
|
+
* @param targetPath - The absolute or relative target path.
|
|
173
|
+
* @param boundaryRoot - The boundary root directory.
|
|
174
|
+
*/
|
|
175
|
+
isPathWithinBoundary(targetPath: string, boundaryRoot: string): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Finds a registered workspace that contains the given file or directory path.
|
|
178
|
+
*
|
|
179
|
+
* @param targetPath - The file or directory path to check.
|
|
180
|
+
* @returns The matching `RegisteredWorkspace` or null if not found.
|
|
181
|
+
*/
|
|
182
|
+
findWorkspaceForPath(targetPath: string): RegisteredWorkspace | null;
|
|
183
|
+
/**
|
|
184
|
+
* Checks whether a path resides inside the primary workspace or any registered workspace.
|
|
185
|
+
*
|
|
186
|
+
* @param targetPath - The file or directory path to inspect.
|
|
187
|
+
* @param primaryRoot - Optional primary workspace root.
|
|
188
|
+
*/
|
|
189
|
+
isInsideRegisteredWorkspace(targetPath: string, primaryRoot?: string): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Resolves an `@alias/relative/path` string or primary workspace path into constituent parts.
|
|
128
192
|
*
|
|
129
193
|
* @param filePath - A file path that may or may not start with `@alias/`.
|
|
130
|
-
* @
|
|
131
|
-
*
|
|
132
|
-
* workspace-relative path (no `@` prefix or unrecognized alias).
|
|
194
|
+
* @param options - Optional resolution options including primaryRoot and autoFocusSubPath.
|
|
195
|
+
* @returns A `ResolvedWorkspacePath` if resolved, or `null` if the path cannot be resolved.
|
|
133
196
|
* @throws Error if the path has an `@` prefix but the alias is not registered.
|
|
134
197
|
*/
|
|
135
|
-
resolve(filePath: string
|
|
198
|
+
resolve(filePath: string, options?: {
|
|
199
|
+
primaryRoot?: string;
|
|
200
|
+
autoFocusSubPath?: boolean;
|
|
201
|
+
}): ResolvedWorkspacePath | null;
|
|
202
|
+
/**
|
|
203
|
+
* Resolves a relative path against the primary root with automatic sub-path focusing.
|
|
204
|
+
*
|
|
205
|
+
* @param primaryRoot - The base primary workspace root directory.
|
|
206
|
+
* @param relativePath - The target relative path to resolve.
|
|
207
|
+
*/
|
|
208
|
+
resolveWithAutoFocus(primaryRoot: string, relativePath: string): ResolvedWorkspacePath;
|
|
136
209
|
/**
|
|
137
210
|
* Checks if a given file path uses the `@alias/` prefix syntax.
|
|
138
211
|
*
|