ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / script / analyzeEdits.ts 726 строк · изменён 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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
import { promises as fs } from 'fs' ;
import * as path from 'path' ;
import * as readline from 'readline' ;
const EDIT_TOOL_NAMES = [ 'insert_edit_into_file' , 'replace_string_in_file' , 'multi_replace_string_in_file' , 'apply_patch' ] ;
const CONTINUATION_TOOL_NAMES = [ 'read_file' ] ;
interface ToolCall {
tool: string ;
input_tokens
cached_input_tokens
output_tokens
response
edits
path
edits
replacements
replaceRange start endExclusive
newText
toolName
timestamp
success
filePath
turnIndex
isRetry
retrySucceeded
conversationPath
edits EditOperation
totalEdits
successfulEdits
failedEdits
successfulEditsWithRetries
totalUniqueEdits
modelName
runId
conversations ConversationAnalysis
totalEdits
successRate
successRateWithRetries
totalUniqueEdits
modelName
amlOutPath
entries fs amlOutPath withFileTypes
runs entries
e e e name
e e name
a b b a
runs
runs
runs run i
runs length
rl readline
input process stdin
output process stdout
resolve
rl answer
rl
choice answer
choice
runs
index choice
index index runs length
runs index
runs
conversationPath ConversationAnalysis
trajectoryPath path conversationPath
toolCalls ToolCall
modelName
content fs trajectoryPath
toolCalls content
error
conversationPath
edits
totalEdits
successfulEdits
failedEdits
successfulEditsWithRetries
totalUniqueEdits
edits EditOperation
turnIndex
i i toolCalls length i
toolCall toolCalls i
toolCall tool
response toolCall response toolCall response toolCall response
success response response
filePath toolCall edits toolCall edits length
toolCall edits path
isRetry
retrySucceeded
success
j i
foundContinuationTool
j toolCalls length j i
toolCalls j tool
foundContinuationTool
foundContinuationTool toolCalls j tool
isRetry
retryResponse toolCalls j response
toolCalls j response
toolCalls j response
retrySucceeded retryResponse retryResponse
toolCalls j tool
j
edits
toolName toolCall tool
timestamp
success
filePath
turnIndex turnIndex
isRetry
retrySucceeded
successfulEdits edits e e success length
editsWithRetries edits e e success e isRetry
retriedSuccesses editsWithRetries e e retrySucceeded length
successfulEditsWithRetries successfulEdits retriedSuccesses
totalUniqueEdits edits length editsWithRetries length editsWithRetries e e retrySucceeded length
conversationPath
edits
totalEdits edits length
successfulEdits
failedEdits edits length successfulEdits
successfulEditsWithRetries
totalUniqueEdits
modelName
runId basePath RunAnalysis
runPath path basePath runId
conversations ConversationAnalysis
entries fs runPath withFileTypes
entry entries
entry
conversationPath path runPath entry name
analysis conversationPath
analysis totalEdits
conversations analysis
error
totalEdits conversations sum c sum c totalEdits
totalSuccessful conversations sum c sum c successfulEdits
totalSuccessfulWithRetries conversations sum c sum c successfulEditsWithRetries
totalUniqueEdits conversations sum c sum c totalUniqueEdits
modelName conversations c c modelName modelName
runId
conversations
totalEdits
successRate totalEdits totalSuccessful totalEdits
successRateWithRetries totalUniqueEdits totalSuccessfulWithRetries totalUniqueEdits
totalUniqueEdits
modelName
analysis RunAnalysis outputPath includeRetries
sankeyNodes
sankeyLinks source target value
nodeMap
getNodeIndex name
nodeMap name
nodeMap name sankeyNodes length
sankeyNodes name
nodeMap name
flows
conv analysis conversations
edit conv edits
toolNode edit toolName
includeRetries edit success edit isRetry edit retrySucceeded
failedNode
readFileNode
retryEditNode
finalResult edit retrySucceeded
flows flows
flows flows
flows flows
flows flows
resultNode edit success
flowKey
flows flowKey flows flowKey
flowKey count flows
source target flowKey
sankeyLinks
source source
target target
value count
tableRows analysis conversations conv
conv edits edit
conversation path conv conversationPath
toolName edit toolName
timestamp edit timestamp
success edit success
turnIndex edit turnIndex
isRetry edit isRetry
retrySucceeded edit retrySucceeded
filePath edit filePath
html
html
args process argv
runIdArg args arg arg
basePath path
runId
runIdArg
runId runIdArg
runs basePath
runs length
basePath
process
runId runs
analysis runId basePath
outputPath path basePath runId
html analysis outputPath
fs outputPath html
error
?
:
number
;
?
:
number
;
?
:
number
;
:
string
|
string
[
]
;
?
:
Array
<
{
:
string
;
:
{
:
Array
<
{
:
{
:
number
;
:
number
}
;
:
string
;
}
>
;
}
;
}
>
;
}
interface
EditOperation
{
:
string
;
:
string
;
:
boolean
;
?
:
string
;
:
number
;
:
boolean
;
?
:
boolean
;
}
interface
ConversationAnalysis
{
:
string
;
:
[
]
;
:
number
;
:
number
;
:
number
;
:
number
;
:
number
;
?
:
string
;
}
interface
RunAnalysis
{
:
string
;
:
[
]
;
:
number
;
:
number
;
:
number
;
:
number
;
?
:
string
;
}
async
function
listRuns
(
:
string
)
:
Promise
<
string
[
]
>
{
const
=
await
.
readdir
(
,
{
:
true
}
)
;
const
=
.
filter
(
=>
.
isDirectory
(
)
&&
/ ^ \d + $ /
.
test
(
.
)
)
.
map
(
=>
.
)
.
sort
(
(
,
)
=>
parseInt
(
)
-
parseInt
(
)
)
;
return
;
}
async
function
promptUserForRun
(
:
string
[
]
)
:
Promise
<
string
>
{
console
.
log
(
'\nAvailable test runs (newest first):'
)
;
.
slice
(
0
,
10
)
.
forEach
(
(
,
)
=>
{
console
.
log
(
` ${ i + 1 } . ${ run} `
)
;
}
)
;
if
(
.
>
10
)
{
console
.
log
(
` ... and ${ runs. length - 10 } more `
)
;
}
const
=
.
createInterface
(
{
:
.
,
:
.
}
)
;
return
new
Promise
(
(
)
=>
{
.
question
(
'\nEnter run number (or press Enter for the most recent): '
,
(
)
=>
{
.
close
(
)
;
const
=
.
trim
(
)
;
if
(
===
''
)
{
resolve
(
[
0
]
)
;
}
else
{
const
=
parseInt
(
)
-
1
;
if
(
>=
0
&&
<
.
)
{
resolve
(
[
]
)
;
}
else
{
console
.
log
(
'Invalid selection, using most recent run.'
)
;
resolve
(
[
0
]
)
;
}
}
}
)
;
}
)
;
}
async
function
analyzeConversation
(
:
string
)
:
Promise
<
>
{
const
=
.
join
(
,
'trajectories'
,
'trajectory.json'
)
;
let
:
[
]
=
[
]
;
let
:
string
|
undefined
;
try
{
const
=
await
.
readFile
(
,
'utf-8'
)
;
=
JSON
.
parse
(
)
;
}
catch
(
)
{
console
.
warn
(
` Could not read trajectory file: ${ trajectoryPath} `
)
;
return
{
,
:
[
]
,
:
0
,
:
0
,
:
0
,
:
0
,
:
0
}
;
}
const
:
[
]
=
[
]
;
let
=
0
;
for
(
let
=
0
;
<
.
;
++
)
{
const
=
[
]
;
if
(
!
EDIT_TOOL_NAMES
.
includes
(
.
)
)
{
continue
;
}
const
=
Array
.
isArray
(
.
)
?
.
[
0
]
:
.
;
const
=
typeof
===
'string'
&&
.
includes
(
'successfully edited'
)
;
const
=
.
&&
.
.
>
0
?
.
[
0
]
.
:
undefined
;
let
=
false
;
let
:
boolean
|
undefined
;
if
(
!
)
{
let
=
+
1
;
let
=
false
;
while
(
<
.
&&
<
+
10
)
{
if
(
CONTINUATION_TOOL_NAMES
.
includes
(
[
]
.
)
)
{
=
true
;
}
else
if
(
&&
EDIT_TOOL_NAMES
.
includes
(
[
]
.
)
)
{
=
true
;
const
=
Array
.
isArray
(
[
]
.
)
?
[
]
.
[
0
]
:
[
]
.
;
=
typeof
===
'string'
&&
.
includes
(
'successfully edited'
)
;
break
;
}
else
if
(
EDIT_TOOL_NAMES
.
includes
(
[
]
.
)
)
{
break
;
}
++
;
}
}
.
push
(
{
:
.
,
:
new
Date
(
)
.
toISOString
(
)
,
,
,
:
++
,
,
}
)
;
}
const
=
.
filter
(
=>
.
)
.
;
const
=
.
filter
(
=>
!
.
&&
.
)
;
const
=
.
filter
(
=>
.
)
.
;
const
=
+
;
const
=
.
-
.
+
.
filter
(
=>
.
!==
undefined
)
.
;
return
{
,
,
:
.
,
,
:
.
-
,
,
,
}
;
}
async
function
analyzeRun
(
:
string
,
:
string
)
:
Promise
<
>
{
const
=
.
join
(
,
)
;
const
:
[
]
=
[
]
;
try
{
const
=
await
.
readdir
(
,
{
:
true
}
)
;
for
(
const
of
)
{
if
(
.
isDirectory
(
)
)
{
const
=
.
join
(
,
.
)
;
const
=
await
analyzeConversation
(
)
;
if
(
.
>
0
)
{
.
push
(
)
;
}
}
}
}
catch
(
)
{
console
.
error
(
` Error reading run directory: ${ error} `
)
;
}
const
=
.
reduce
(
(
,
)
=>
+
.
,
0
)
;
const
=
.
reduce
(
(
,
)
=>
+
.
,
0
)
;
const
=
.
reduce
(
(
,
)
=>
+
.
,
0
)
;
const
=
.
reduce
(
(
,
)
=>
+
.
,
0
)
;
const
=
.
find
(
=>
.
)
?.
;
return
{
,
,
,
:
>
0
?
/
:
0
,
:
>
0
?
/
:
0
,
,
}
;
}
function
generateHTML
(
:
,
:
string
,
:
boolean
=
false
)
:
string
{
const
:
string
[
]
=
[
]
;
const
:
Array
<
{
:
number
;
:
number
;
:
number
}
>
=
[
]
;
const
=
new
Map< string , number >
(
)
;
const
=
(
:
string
)
:
number
=>
{
if
(
!
.
has
(
)
)
{
.
set
(
,
.
)
;
.
push
(
)
;
}
return
.
get
(
)
!
;
}
;
const
=
new
Map< string , number >
(
)
;
for
(
const
of
.
)
{
for
(
const
of
.
)
{
const
=
.
;
if
(
&&
!
.
&&
.
&&
.
!==
undefined
)
{
const
=
'Failed (will retry)'
;
const
=
'read_file'
;
const
=
` ${ toolNode} (retry) `
;
const
=
.
?
'Success'
:
'Failed'
;
.
set
(
` ${ toolNode} -> ${ failedNode} `
,
(
.
get
(
` ${ toolNode} -> ${ failedNode} `
)
||
0
)
+
1
)
;
.
set
(
` ${ failedNode} -> ${ readFileNode} `
,
(
.
get
(
` ${ failedNode} -> ${ readFileNode} `
)
||
0
)
+
1
)
;
.
set
(
` ${ readFileNode} -> ${ retryEditNode} `
,
(
.
get
(
` ${ readFileNode} -> ${ retryEditNode} `
)
||
0
)
+
1
)
;
.
set
(
` ${ retryEditNode} -> ${ finalResult} `
,
(
.
get
(
` ${ retryEditNode} -> ${ finalResult} `
)
||
0
)
+
1
)
;
continue
;
}
const
=
.
?
'Success'
:
'Failed'
;
const
=
` ${ toolNode} -> ${ resultNode} `
;
.
set
(
,
(
.
get
(
)
||
0
)
+
1
)
;
}
}
for
(
const
[
,
]
of
.
entries
(
)
)
{
const
[
,
]
=
.
split
(
'->'
)
;
.
push
(
{
:
getNodeIndex
(
)
,
:
getNodeIndex
(
)
,
:
}
)
;
}
const
=
.
.
flatMap
(
=>
.
.
map
(
=>
(
{
:
.
basename
(
.
)
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
:
.
}
)
)
)
;
const
=
` <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Run ${ analysis. runId} ${ analysis. modelName ? ' - ' + analysis. modelName : '' } </title>
<script src="https://unpkg.com/d3@7/dist/d3.min.js"></script>
<script src="https://unpkg.com/d3-sankey@0.12.3/dist/d3-sankey.min.js"></script>
<style>
* {
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
margin: 0;
padding: 20px;
background: #f5f5f5;
color: #333;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
h1 {
margin: 0 0 10px 0;
color: #1a1a1a;
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin: 20px 0;
}
.stat-card {
background: #f8f9fa;
padding: 15px;
border-radius: 6px;
border-left: 4px solid #0969da;
}
.stat-label {
font-size: 12px;
text-transform: uppercase;
color: #666;
margin-bottom: 5px;
}
.stat-value {
font-size: 24px;
font-weight: 600;
color: #1a1a1a;
}
.controls {
margin: 20px 0;
padding: 15px;
background: #f8f9fa;
border-radius: 6px;
}
.controls label {
display: inline-flex;
align-items: center;
cursor: pointer;
font-size: 14px;
}
.controls input[type="checkbox"] {
margin-right: 8px;
width: 18px;
height: 18px;
cursor: pointer;
}
#sankey-diagram {
margin: 30px 0;
overflow-x: auto;
}
.table-container {
margin-top: 30px;
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
thead {
background: #f8f9fa;
}
th {
text-align: left;
padding: 12px;
font-weight: 600;
color: #1a1a1a;
border-bottom: 2px solid #dee2e6;
}
td {
padding: 10px 12px;
border-bottom: 1px solid #dee2e6;
}
tbody tr:hover {
background: #f8f9fa;
}
.badge {
display: inline-block;
padding: 3px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.badge-success {
background: #d1f4e0;
color: #0f6d31;
}
.badge-failed {
background: #ffd8d8;
color: #d1242f;
}
.sankey-node rect {
cursor: pointer;
fill-opacity: 0.9;
}
.sankey-node rect:hover {
fill-opacity: 1;
}
.sankey-link {
fill: none;
stroke-opacity: 0.3;
}
.sankey-link:hover {
stroke-opacity: 0.5;
}
.sankey-node text {
pointer-events: none;
font-size: 12px;
fill: #1a1a1a;
}
</style>
</head>
<body>
<div class="container">
<h1>🔧 Run ${ analysis. runId} ${ analysis. modelName ? ' - ' + analysis. modelName : '' } </h1>
<p style="color: #666; margin: 5px 0 0 0;">Analysis of edit tool operations and success rates</p>
<div class="stats">
<div class="stat-card">
<div class="stat-label">Total Edits</div>
<div class="stat-value"> ${ analysis. totalEdits} </div>
</div>
<div class="stat-card" style="border-left-color: #2da44e;">
<div class="stat-label">Success Rate</div>
<div class="stat-value" id="success-rate-value"> ${ ( analysis. successRate * 100 ) . toFixed ( 1 ) } %</div>
</div>
<div class="stat-card" style="border-left-color: #8250df;">
<div class="stat-label">Conversations</div>
<div class="stat-value"> ${ analysis. conversations. length} </div>
</div>
</div>
<div class="controls">
<label>
<input type="checkbox" id="includeRetries" ${ includeRetries ? 'checked' : '' } >
Include retries (show re-evaluate → retry flows)
</label>
</div>
<div id="sankey-diagram"></div>
<h2 style="margin-top: 40px;">Edit Operations</h2>
<div class="table-container">
<table>
<thead>
<tr>
<th>Conversation</th>
<th>Tool</th>
<th>Turn</th>
<th>File</th>
<th>Status</th>
<th>Retry</th>
</tr>
</thead>
<tbody>
${ tableRows. map ( row => `
<tr>
<td> ${ row. conversation} </td>
<td><code style="background: #f6f8fa; padding: 2px 6px; border-radius: 3px; font-size: 12px;"> ${ row. toolName} </code></td>
<td> ${ row. turnIndex} </td>
<td style="color: #666; font-size: 12px; max-width: 300px; overflow: hidden; text-overflow: ellipsis;"> ${ row. filePath || '-' } </td>
<td><span class="badge ${ row. success ? 'badge-success' : 'badge-failed' } "> ${ row. success ? '✓ Success' : '✗ Failed' } </span></td>
<td>
</tbody>
</table>
</div>
</div>
<script>
const sankeyData = {
nodes: ${ JSON . stringify ( sankeyNodes. map ( name => ( { name } ) ) ) } ,
links: ${ JSON . stringify ( sankeyLinks) }
};
const analysisData = {
successRate: ${ analysis. successRate} ,
successRateWithRetries: ${ analysis. successRateWithRetries} ,
totalEdits: ${ analysis. totalEdits} ,
totalUniqueEdits: ${ analysis. totalUniqueEdits}
};
function drawSankey(includeRetries) {
// Clear previous diagram
d3.select('#sankey-diagram').html('');
// Rebuild data based on includeRetries flag
const allEdits = ${ JSON . stringify ( tableRows) } ;
const nodes = [];
const links = [];
const nodeMap = new Map();
const getNodeIndex = (name) => {
if (!nodeMap.has(name)) {
nodeMap.set(name, nodes.length);
nodes.push({ name });
}
return nodeMap.get(name);
};
const flows = new Map();
for (const edit of allEdits) {
const toolNode = edit.toolName;
// Check if this is a failed edit with a retry
if (includeRetries && !edit.success && edit.isRetry && edit.retrySucceeded !== undefined) {
// Show full retry flow
const failedNode = 'Failed (will retry)';
const readFileNode = 'read_file';
const retryEditNode = toolNode + ' (retry)';
const finalResult = edit.retrySucceeded ? 'Success' : 'Failed';
flows.set(toolNode + '->' + failedNode, (flows.get(toolNode + '->' + failedNode) || 0) + 1);
flows.set(failedNode + '->' + readFileNode, (flows.get(failedNode + '->' + readFileNode) || 0) + 1);
flows.set(readFileNode + '->' + retryEditNode, (flows.get(readFileNode + '->' + retryEditNode) || 0) + 1);
flows.set(retryEditNode + '->' + finalResult, (flows.get(retryEditNode + '->' + finalResult) || 0) + 1);
continue;
}
const resultNode = edit.success ? 'Success' : 'Failed';
const flowKey = toolNode + '->' + resultNode;
flows.set(flowKey, (flows.get(flowKey) || 0) + 1);
}
for (const [flowKey, count] of flows.entries()) {
const [source, target] = flowKey.split('->');
links.push({
source: getNodeIndex(source),
target: getNodeIndex(target),
value: count
});
}
const width = Math.max(800, document.getElementById('sankey-diagram').offsetWidth);
const height = 500;
const svg = d3.select('#sankey-diagram')
.append('svg')
.attr('width', width)
.attr('height', height);
const sankey = d3.sankey()
.nodeWidth(15)
.nodePadding(10)
.extent([[1, 1], [width - 1, height - 5]]);
const graph = sankey({
nodes: nodes.map(d => Object.assign({}, d)),
links: links.map(d => Object.assign({}, d))
});
const colorScale = d3.scaleOrdinal()
.domain(['replace_string_in_file', 'multi_replace_string_in_file', 'read_file', 'Failed (will retry)', 'Success', 'Failed'])
.range(['#0969da', '#8250df', '#a855f7', '#ff9800', '#2da44e', '#d1242f']);
// Links
svg.append('g')
.attr('class', 'links')
.selectAll('path')
.data(graph.links)
.enter()
.append('path')
.attr('class', 'sankey-link')
.attr('d', d3.sankeyLinkHorizontal())
.attr('stroke', d => colorScale(d.source.name))
.attr('stroke-width', d => Math.max(1, d.width));
// Nodes
const node = svg.append('g')
.attr('class', 'nodes')
.selectAll('g')
.data(graph.nodes)
.enter()
.append('g')
.attr('class', 'sankey-node');
node.append('rect')
.attr('x', d => d.x0)
.attr('y', d => d.y0)
.attr('height', d => d.y1 - d.y0)
.attr('width', d => d.x1 - d.x0)
.attr('fill', d => colorScale(d.name))
.append('title')
.text(d => d.name + '\\n' + d.value + ' edits');
node.append('text')
.attr('x', d => d.x0 < width / 2 ? d.x1 + 6 : d.x0 - 6)
.attr('y', d => (d.y1 + d.y0) / 2)
.attr('dy', '0.35em')
.attr('text-anchor', d => d.x0 < width / 2 ? 'start' : 'end')
.text(d => d.name + ' (' + d.value + ')');
}
// Initial draw
drawSankey( ${ includeRetries} );
// Update success rate display
function updateSuccessRate(includeRetries) {
const rate = includeRetries ? analysisData.successRateWithRetries : analysisData.successRate;
document.getElementById('success-rate-value').textContent = (rate * 100).toFixed(1) + '%';
}
// Handle checkbox change
document.getElementById('includeRetries').addEventListener('change', (e) => {
drawSankey(e.target.checked);
updateSuccessRate(e.target.checked);
});
// Redraw on window resize
let resizeTimer;
window.addEventListener('resize', () => {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(() => {
const includeRetries = document.getElementById('includeRetries').checked;
drawSankey(includeRetries);
}, 250);
});
</script>
</body>
</html> `
;
return
;
}
async
function
main
(
)
{
const
=
.
.
slice
(
2
)
;
const
=
.
find
(
=>
.
startsWith
(
'--runId='
)
)
;
const
=
.
join
(
'/Users/connor/Github/vscode-copilot-evaluation/.msbenchRun'
)
;
let
:
string
;
if
(
)
{
=
.
split
(
'='
)
[
1
]
;
console
.
log
(
` Using run ID: ${ runId} `
)
;
}
else
{
const
=
await
listRuns
(
)
;
if
(
.
===
0
)
{
console
.
error
(
'No test runs found in'
,
)
;
.
exit
(
1
)
;
}
=
await
promptUserForRun
(
)
;
console
.
log
(
` Selected run: ${ runId} `
)
;
}
console
.
log
(
'\nAnalyzing run...'
)
;
const
=
await
analyzeRun
(
,
)
;
console
.
log
(
` \nFound ${ analysis. conversations. length} conversations with edits `
)
;
console
.
log
(
` Total edits: ${ analysis. totalEdits} `
)
;
console
.
log
(
` Success rate: ${ ( analysis. successRate * 100 ) . toFixed ( 1 ) } % `
)
;
const
=
.
join
(
,
,
'edit-analysis.html'
)
;
const
=
generateHTML
(
,
)
;
await
.
writeFile
(
,
,
'utf-8'
)
;
console
.
log
(
` \n✓ Analysis complete! Generated: ${ outputPath} `
)
;
}
main
(
)
.
catch
(
console
.
)
;
${ row. isRetry ? ( row. retrySucceeded === true ? '<span class="badge badge-success">✓ Retry Success</span>' : row. retrySucceeded === false ? '<span class="badge badge-failed">✗ Retry Failed</span>' : '<span class="badge" style="background: #e3e3e3; color: #666;">Retry Pending</span>' ) : '-' }
</td>
</tr>
`
)
.
join
(
''
)
}