ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / test / simulation / workbench / components / nesExternalModeToolbar.tsx 339 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
import { Button , Checkbox , Input , Select , Text , Tooltip } from '@fluentui/react-components' ;
import { Play16Regular , Stop16Regular } from '@fluentui/react-icons' ;
import * as mobx from 'mobx' ;
import * as mobxlite from 'mobx-react-lite' ;
import * as React from 'react' ;
grep
showFailedOnly
showWithCacheMissesOnly
showOnlyRanTests
filterParams
debounceMs
params
filter
isMounted
latestFilterParams filterParams
isFilteringRef
hasPendingFilterRef
isFiltering setIsFiltering
latestFilterParams filterParams
filterParams
isMounted
applyFilter
isMounted
isFilteringRef
hasPendingFilterRef
isFilteringRef
params latestFilterParams
newFilter params
isMounted
newFilter
isFilteringRef
hasPendingFilterRef
hasPendingFilterRef
error
error
isMounted
isFilteringRef
hasPendingFilterRef
hasPendingFilterRef
createFilter onFilterChange
debounceTimer applyFilter debounceMs
debounceTimer
filterParams applyFilter debounceMs
isFiltering
value
runner
runnerOptions
nesExternalOptions
simulationRunsProvider
filter
mobxlite
runner
runnerOptions
nesExternalOptions
simulationRunsProvider
onFiltererChange
showFailedOnly setShowFailedOnly
showOnlyRanTests setShowOnlyRanTests
showWithCacheMissesOnly setShowWithCacheMissesOnly
filterParams
grep runnerOptions
showFailedOnly
showWithCacheMissesOnly
showOnlyRanTests
runnerOptions
showFailedOnly
showWithCacheMissesOnly
showOnlyRanTests
createFilter params
predicates
predicates params
params
predicates
params
predicates
params
predicates
predicates
handleFilterChange filter
filter
onFiltererChange
isFiltering filterParams createFilter handleFilterChange
isSimulationRunning runner
handleRunStopButtonClick
mobx
isSimulationRunning
runner
runner
grep runnerOptions
cacheMode runnerOptions
n runnerOptions
noFetch runnerOptions
additionalArgs runnerOptions
nesExternalScenariosPath nesExternalOptions
isSimulationRunning runner runnerOptions nesExternalOptions
handleScenariosPathChange e
mobx
nesExternalOptions e
nesExternalOptions
handleGrepChange e
mobx
runnerOptions e
runnerOptions
handleNRunsChange e
runnerOptions e
runnerOptions
handleNoFetchChange
mobx
runnerOptions runnerOptions
runnerOptions
handleExtraArgsChange e
mobx
runnerOptions e
runnerOptions
handleRunFromDiskChange selected
name selected
runner name
runner
handleCacheModeChange _e option
runnerOptions option
runnerOptions
hasValidScenariosPath nesExternalOptions
isSimulationRunning isFiltering import
{ useCallback, useEffect, useMemo, useRef, useState }
from
'react'
;
import
{ NesExternalOptions }
from
'../stores/nesExternalOptions'
;
import
{ CacheMode , RunnerOptions }
from
'../stores/runnerOptions'
;
import
{ SimulationRunsProvider }
from
'../stores/simulationBaseline'
;
import
{ SimulationRunner , StateKind }
from
'../stores/simulationRunner'
;
import
{ useLocalStorageState }
from
'../stores/storage'
;
import
{ CompareAgainstRunPicker }
from
'./compareAgainstRunPicker'
;
import
{ CurrentRunPicker }
from
'./currentRunPicker'
;
import
{
createCacheMissesFilter,
createFailuresFilter,
createFilterer,
createGrepFilter,
createRanTestsFilter,
}
from
'./filterUtils'
;
import
{ TestFilterer }
from
'./testFilterer'
;
interface
FilterParams
{
:
string
;
:
boolean
;
:
boolean
;
:
boolean
;
}
const
useAsyncFilter
=
(
:
FilterParams
,
:
number
,
createFilter
:
(
:
FilterParams
)
=>
TestFilterer
,
onFilterChange
:
(
:
TestFilterer
|
undefined
)
=>
void
)
=>
{
const
=
useRef
(
true
)
;
const
=
useRef
(
)
;
const
=
useRef
(
false
)
;
const
=
useRef
(
false
)
;
const
[
,
]
=
useState
(
false
)
;
useEffect
(
(
)
=>
{
.
current
=
;
}
,
[
]
)
;
useEffect
(
(
)
=>
{
return
(
)
=>
{
.
current
=
false
;
}
;
}
,
[
]
)
;
const
=
useCallback
(
(
)
=>
{
if
(
!
.
current
)
{
return
;
}
if
(
.
current
)
{
.
current
=
true
;
return
;
}
.
current
=
true
;
setIsFiltering
(
true
)
;
setTimeout
(
(
)
=>
{
const
=
.
current
;
requestAnimationFrame
(
(
)
=>
{
try
{
const
=
createFilter
(
)
;
requestAnimationFrame
(
(
)
=>
{
if
(
.
current
)
{
onFilterChange
(
)
;
.
current
=
false
;
setIsFiltering
(
false
)
;
if
(
.
current
)
{
.
current
=
false
;
applyFilter
(
)
;
}
}
}
)
;
}
catch
(
)
{
console
.
error
(
'Error applying filter:'
,
)
;
if
(
.
current
)
{
.
current
=
false
;
setIsFiltering
(
false
)
;
if
(
.
current
)
{
.
current
=
false
;
applyFilter
(
)
;
}
}
}
}
)
;
}
,
0
)
;
}
,
[
,
]
)
;
useEffect
(
(
)
=>
{
const
=
setTimeout
(
,
)
;
return
(
)
=>
clearTimeout
(
)
;
}
,
[
,
,
]
)
;
return
{
}
;
}
;
type
SelectOptionEvent
=
{
:
string
}
;
type
Props
=
{
:
SimulationRunner
;
:
RunnerOptions
;
:
NesExternalOptions
;
:
SimulationRunsProvider
;
onFiltererChange
:
(
:
TestFilterer
|
undefined
)
=>
void
;
}
;
export
const
NesExternalModeToolbar
=
.
observer
(
(
{
,
,
,
,
,
}
:
Props
)
=>
{
const
[
,
]
=
useLocalStorageState
(
'nesShowFailedOnly'
,
undefined
,
false
)
;
const
[
,
]
=
useLocalStorageState
(
'nesShowOnlyRanTests'
,
undefined
,
false
)
;
const
[
,
]
=
useState
(
false
)
;
const
=
useMemo
(
(
)
=>
(
{
:
.
grep
.
value
,
,
,
,
}
)
,
[
.
grep
.
value
,
,
,
,
]
)
;
const
=
useCallback
(
(
:
FilterParams
)
:
TestFilterer
=>
{
const
=
[
]
;
.
push
(
createGrepFilter
(
.
grep
)
)
;
if
(
.
showFailedOnly
)
{
.
push
(
createFailuresFilter
(
)
)
;
}
if
(
.
showWithCacheMissesOnly
)
{
.
push
(
createCacheMissesFilter
(
)
)
;
}
if
(
.
showOnlyRanTests
)
{
.
push
(
createRanTestsFilter
(
)
)
;
}
return
createFilterer
(
)
;
}
,
[
]
)
;
const
=
useCallback
(
(
:
TestFilterer
|
undefined
)
=>
{
onFiltererChange
(
)
;
}
,
[
]
)
;
const
{
}
=
useAsyncFilter
(
,
500
,
,
)
;
const
=
.
state
.
kind
===
StateKind
.
Running
;
const
=
useCallback
(
(
)
=>
{
.
runInAction
(
(
)
=>
{
if
(
)
{
.
stopRunning
(
)
;
}
else
{
.
startRunning
(
{
:
.
grep
.
value
,
:
.
cacheMode
.
value
,
:
parseInt
(
.
n
.
value
)
,
:
.
noFetch
.
value
,
:
.
additionalArgs
.
value
,
:
.
externalScenariosPath
.
value
,
}
)
;
}
}
)
;
}
,
[
,
,
,
]
)
;
const
=
useCallback
(
(
:
React
.
FormEvent
<
HTMLInputElement
>
)
=>
{
.
runInAction
(
(
)
=>
{
.
externalScenariosPath
.
value
=
(
.
target
as
HTMLInputElement
)
.
value
;
}
)
;
}
,
[
]
)
;
const
=
useCallback
(
(
:
React
.
FormEvent
<
HTMLInputElement
>
)
=>
{
.
runInAction
(
(
)
=>
{
.
grep
.
value
=
(
.
target
as
HTMLInputElement
)
.
value
;
}
)
;
}
,
[
.
grep
]
)
;
const
=
useCallback
(
(
:
React
.
FormEvent
<
HTMLInputElement
>
)
=>
{
.
n
.
value
=
(
.
target
as
HTMLInputElement
)
.
value
;
}
,
[
.
n
]
)
;
const
=
useCallback
(
(
)
=>
{
.
runInAction
(
(
)
=>
{
.
noFetch
.
value
=
!
.
noFetch
.
value
;
}
)
;
}
,
[
.
noFetch
]
)
;
const
=
useCallback
(
(
:
React
.
FormEvent
<
HTMLInputElement
>
)
=>
{
.
runInAction
(
(
)
=>
{
.
additionalArgs
.
value
=
(
.
target
as
HTMLInputElement
)
.
value
;
}
)
;
}
,
[
.
additionalArgs
]
)
;
const
=
useCallback
(
(
:
string
|
undefined
)
=>
{
const
=
??
''
;
.
setSelectedRunFromDisk
(
)
;
}
,
[
]
)
;
const
=
useCallback
(
(
:
React
.
FormEvent
<
HTMLSelectElement
>
,
:
SelectOptionEvent
)
=>
{
.
cacheMode
.
value
=
.
value
as
CacheMode
;
}
,
[
.
cacheMode
]
)
;
const
=
.
externalScenariosPath
.
value
.
length
>
0
;
return
(
< div
className = ' toolbar'
style = { {
display: 'flex' ,
flexDirection: 'column' ,
justifyContent: 'space-between' ,
} }
>
< div style = { { display: 'flex' , justifyContent: 'space-between' } } >
< div style = { { display: 'flex' , alignItems: 'center' } } >
< CurrentRunPicker
simulationRunsProvider = { simulationRunsProvider}
disabled = { isSimulationRunning}
onChange = { handleRunFromDiskChange}
outputFolderName = { runner. selectedRun }
/>
< CompareAgainstRunPicker
simulationRunsProvider = { simulationRunsProvider}
/>
</ div>
</ div>
< div style = { { height: '8px' } } />
< div>
< div>
NES External Scenarios
</ div>
< div style = { { display: 'flex' , gap: '10px' , alignItems: 'center' } } >
< Input
id = ' nesExternalScenariosPath'
size = ' small'
placeholder = ' Path to external scenarios, e.g., ../eval/simulation/nes'
title = ' Path to directory containing NES external scenario recordings'
value = { nesExternalOptions. externalScenariosPath . value }
onChange = { handleScenariosPathChange}
style = { { width: '400px' , maxWidth: '30vw' } }
/>
</ div>
</ div>
< div style = { { height: '8px' } } />
< div>
< div>
Configure new run</div>
< div style = { { display: 'flex' , gap: '10px' } } >
< Input
id = ' grep'
size = ' small'
placeholder = ' grep'
title = ' Filter by test name'
value = { runnerOptions. grep . value }
onChange = { handleGrepChange}
style = { { width: '300px' , maxWidth: '25vw' } }
/>
< Input
id = ' nRuns'
size = ' small'
style = { { width: '40px' } }
placeholder = ' N'
title = ' Specify number of runs per each test'
value = { runnerOptions. n . value }
onChange = { handleNRunsChange}
/>
< Select onChange = { handleCacheModeChange} defaultValue = { runnerOptions. cacheMode . value } >
< option value = { CacheMode . Default } title = ' Use cache if available' >
Use Cache
</ option>
< option value = { CacheMode . Disable } title = ' Do not use cache' >
No Cache
</ option>
< option value = { CacheMode . Require } title = ' Use cache, fail if not available' >
Require Cache
</ option>
</ Select >
< Tooltip relationship = ' label' content = { 'Do not send requests to the model endpoint (uses cache but doesn\'t write to it)' } >
< Checkbox
label = ' No fetch'
defaultChecked = { runnerOptions. noFetch . value }
onChange = { handleNoFetchChange}
/>
</ Tooltip >
< Input
id = ' extraArgs'
size = ' small'
style = { { width: '300px' } }
placeholder = ' Extra args, e.g., --parallelism=10 --require-cache'
value = { runnerOptions. additionalArgs . value }
onInput = { handleExtraArgsChange}
/>
< Tooltip relationship = ' label' content = { ! hasValidScenariosPath ? 'Set the external scenarios path first' : '' } >
< Button
size = ' small' appearance = { isSimulationRunning ? 'secondary' : 'primary' }
icon = { isSimulationRunning ? < Stop16Regular /> : < Play16Regular /> }
iconPosition = ' before'
onClick = { handleRunStopButtonClick}
disabled = { ! hasValidScenariosPath && ! isSimulationRunning}
style = { { width: '69px' } }
>
{
?
'Stop'
:
'Run'
}
</ Button >
</ Tooltip >
</ div>
</ div>
< div style = { { height: '8px' } } />
< div>
< Tooltip content = { 'Only modify tests displayed. Tests will be run even if not in list below' } relationship = { 'label' } >
< Text >
View Filters
{
&&
'(Filtering...)'
}
</ Text >
</ Tooltip >
< div style = { { display: 'flex' , alignItems: 'center' } } >
< Checkbox
className = ' showFailedOnly'
label = ' Show with failures only'
checked = { showFailedOnly}
onChange = { ( ) => setShowFailedOnly ( ! showFailedOnly) }
/>
< Checkbox
label = ' Show with cache misses only'
checked = { showWithCacheMissesOnly}
onChange = { ( ) => setShowWithCacheMissesOnly ( ! showWithCacheMissesOnly) }
/>
< Checkbox
label = ' Show ran tests only'
checked = { showOnlyRanTests}
onChange = { ( ) => setShowOnlyRanTests ( ! showOnlyRanTests) }
/>
</ div>
</ div>
</ div>
);
}
);