ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / scripts / chat-simulation / common / perf-scenarios.js 801 строк · изменён 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
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
const path = require ( 'path' ) ;
const { ScenarioBuilder , registerScenario } = require ( './mock-llm-server.ts' ) ;
const FIXTURES_DIR = path. join ( __dirname, '..' , 'fixtures' ) ;
words
i i i words
words
b
b words
b
b
b
i i i
b
b
lines
j j j
lines
lines
lines
lines
b lines
b
b
b
sentences
b
b
para para para
b
paraSentences
s s s paraSentences sentences s sentences
b paraSentences
b
b
b
b
b
section section section
b
item item item
b
b
b
b
b
b
b
i i i
b
b
b
b
words
i i i words
b words
b
files
b
b
i i files i
line
b
b
i i i
depth i
area i
name i
file
b
b
b
filesToRead
filesToRead
path f
filesToRead
path f
readFiles
readFiles
path f
path
path
path
path
path
topics
turns
firstTopic topics
turns
i i topics i
topic topics i
turns topic
b
b
sentences topic
b sentences s s s
b
i
b
j j j
b
b
i
b
j j j
b
b
b
b
b
b
b
turns
b
turns
content id
content content
tool id
tool tool
multi id
multi multi
id def
id def
id def
id def
id def
id def
module registerPerfScenarios getScenarioDescription
)
.
[
]
,
*
}
}
ContentScenarioDef
@typedef
{ {
* description: string,
* scenario: import ( './mock-llm-server' ) . MultiTurnScenario,
* } }
MultiTurnScenarioDef
const
CONTENT_SCENARIOS
=
{
'text-only'
:
{
description
:
'Plain text, 4 paragraphs'
,
chunks
:
new
ScenarioBuilder
(
)
.
stream
(
[
'Here is an explanation of the code you selected:\n\n'
,
'The function `processItems` iterates over the input array and applies a transformation to each element. '
,
'It uses a `Map` to track previously seen values, which allows it to deduplicate results efficiently in O(n) time.\n\n'
,
'The algorithm works in a single pass: for every element, it computes the transformed value, '
,
'checks membership in the set, and conditionally appends to the output array. '
,
'This is a common pattern in data processing pipelines where uniqueness constraints must be maintained.\n\n'
,
'Edge cases to consider include empty arrays, duplicate transformations that produce the same key, '
,
'and items where the transform function itself is expensive.\n\n'
,
'The time complexity is **O(n)** and the space complexity is **O(n)** in the worst case when all items are unique.\n'
,
]
,
20
)
.
build
(
)
,
}
,
'large-codeblock'
:
{
description
:
'Single large TypeScript code block'
,
chunks
:
new
ScenarioBuilder
(
)
.
stream
(
[
'Here is the refactored implementation:\n\n'
,
'```typescript\n'
,
'import { EventEmitter } from "events";\n\n'
,
'interface CacheEntry<T> {\n value: T;\n expiresAt: number;\n accessCount: number;\n}\n\n'
,
'export class LRUCache<K, V> {\n'
,
' private readonly _map = new Map<K, CacheEntry<V>>();\n'
,
' private readonly _emitter = new EventEmitter();\n\n'
,
' constructor(\n private readonly _maxSize: number,\n private readonly _ttlMs: number = 60_000,\n ) {}\n\n'
,
' get(key: K): V | undefined {\n const entry = this._map.get(key);\n if (!entry) { return undefined; }\n'
,
' if (Date.now() > entry.expiresAt) {\n this._map.delete(key);\n this._emitter.emit("evict", key);\n return undefined;\n }\n'
,
' entry.accessCount++;\n this._map.delete(key);\n this._map.set(key, entry);\n return entry.value;\n }\n\n'
,
' set(key: K, value: V): void {\n if (this._map.size >= this._maxSize) {\n'
,
' const oldest = this._map.keys().next().value;\n if (oldest !== undefined) {\n this._map.delete(oldest);\n this._emitter.emit("evict", oldest);\n }\n }\n'
,
' this._map.set(key, { value, expiresAt: Date.now() + this._ttlMs, accessCount: 0 });\n }\n\n'
,
' clear(): void { this._map.clear(); this._emitter.emit("clear"); }\n'
,
' get size(): number { return this._map.size; }\n'
,
' onEvict(listener: (key: K) => void): void { this._emitter.on("evict", listener); }\n}\n'
,
'```\n\n'
,
'The key changes:\n- Added TTL-based expiry with configurable timeout\n- LRU eviction uses Map insertion order\n- EventEmitter notifies on evictions for cache observability\n'
,
]
,
20
)
.
build
(
)
,
}
,
'many-small-chunks'
:
{
description
:
'200 word-level chunks at 5ms'
,
chunks
:
(
(
)
=>
{
const
=
[
'Generating detailed analysis:\n\n'
]
;
for
(
let
=
0
;
<
200
;
++
)
{
.
push
(
` Word ${ i} `
)
;
}
.
push
(
'\n\nAnalysis complete.\n'
)
;
const
=
new
ScenarioBuilder
(
)
;
.
stream
(
,
5
)
;
return
.
build
(
)
;
}
)
(
)
,
}
,
'mixed-content'
:
{
description
:
'Markdown + code block + fix suggestion'
,
chunks
:
new
ScenarioBuilder
(
)
.
stream
(
[
'## Issue Found\n\n'
,
'The `DisposableStore` is not being disposed in the `deactivate` path, '
,
'which can lead to memory leaks.\n\n'
,
'### Current Code\n\n'
,
'```typescript\nclass MyService {\n private store = new DisposableStore();\n // missing dispose!\n}\n```\n\n'
,
'### Suggested Fix\n\n'
,
'```typescript\nclass MyService extends Disposable {\n'
,
' private readonly store = this._register(new DisposableStore());\n\n'
,
' override dispose(): void {\n this.store.dispose();\n super.dispose();\n }\n}\n```\n\n'
,
'This ensures the store is cleaned up when the service is disposed via the workbench lifecycle.\n'
,
]
,
20
)
.
build
(
)
,
}
,
'many-codeblocks'
:
{
description
:
'10 code blocks, 60 lines each'
,
chunks
:
(
(
)
=>
{
const
=
new
ScenarioBuilder
(
)
;
.
emit
(
'Here are the implementations for each module:\n\n'
)
;
for
(
let
=
0
;
<
10
;
++
)
{
.
wait
(
10
,
` ### Module ${ i + 1 } : \`handler ${ i} .ts\`\n\n `
)
;
.
emit
(
'```typescript\n'
)
;
const
=
[
]
;
for
(
let
=
0
;
<
15
;
++
)
{
.
push
(
` export function handle ${ i} _ ${ j} (input: string): string {\n `
)
;
.
push
(
` const result = input.trim().split('').reverse().join('');\n `
)
;
.
push
(
` return \`[\${result}] processed by handler ${ i} _ ${ j} \`;\n `
)
;
.
push
(
'}\n\n'
)
;
}
.
stream
(
,
5
)
;
.
emit
(
'```\n\n'
)
;
}
.
emit
(
'All modules implement the same pattern with unique handler IDs.\n'
)
;
return
.
build
(
)
;
}
)
(
)
,
}
,
'long-prose'
:
{
description
:
'15 sections, ~3000 words of prose'
,
chunks
:
(
(
)
=>
{
const
=
[
'The architecture follows a layered dependency injection pattern where each service declares its dependencies through constructor parameters. '
,
'This approach ensures that circular dependencies are detected at compile time rather than at runtime, which significantly reduces debugging overhead. '
,
'When a service is instantiated, the instantiation service resolves all of its dependencies recursively, creating a directed acyclic graph of service instances. '
,
'Each service is a singleton within its scope, meaning that multiple consumers of the same service interface receive the same instance. '
,
'The workbench lifecycle manages the creation and disposal of these services through well-defined phases: creation, restoration, and eventual shutdown. '
,
'During the restoration phase, services that persist state across sessions reload their data from storage, which may involve asynchronous operations. '
,
'Contributors register their functionality through extension points, which are processed during the appropriate lifecycle phase. '
,
'This contribution model allows features to be added without modifying the core workbench code, maintaining a clean separation of concerns. '
,
]
;
const
=
new
ScenarioBuilder
(
)
;
.
emit
(
'# Detailed Architecture Analysis\n\n'
)
;
for
(
let
=
0
;
<
15
;
++
)
{
.
wait
(
15
,
` ## Section ${ para + 1 } : ${ [ 'Overview' , 'Design Patterns' , 'Service Layer' , 'Event System' , 'State Management' , 'Error Handling' , 'Performance' , 'Testing' , 'Deployment' , 'Monitoring' , 'Security' , 'Extensibility' , 'Compatibility' , 'Migration' , 'Future Work' ] [ para] } \n\n `
)
;
const
=
[
]
;
for
(
let
=
0
;
<
25
;
++
)
{
.
push
(
[
%
.
length
]
)
;
}
.
stream
(
,
8
)
;
.
emit
(
'\n\n'
)
;
}
return
.
build
(
)
;
}
)
(
)
,
}
,
'rich-markdown'
:
{
description
:
'6 sections × 5 items, bold/links/code spans'
,
chunks
:
(
(
)
=>
{
const
=
new
ScenarioBuilder
(
)
;
.
emit
(
'# Comprehensive Code Review Report\n\n'
)
;
.
wait
(
15
,
'> **Summary**: Found 12 issues across 4 severity levels.\n\n'
)
;
for
(
let
=
0
;
<
6
;
++
)
{
.
wait
(
10
,
` ## ${ section + 1 } . ${ [ 'Critical Issues' , 'Performance Concerns' , 'Code Style' , 'Documentation Gaps' , 'Test Coverage' , 'Security Review' ] [ section] } \n\n `
)
;
for
(
let
=
0
;
<
5
;
++
)
{
.
stream
(
[
` ${ item + 1 } . **Issue ${ section * 5 + item + 1 } **: \` ${ [ 'useState' , 'useEffect' , 'useMemo' , 'useCallback' , 'useRef' ] [ item] } \` in \`src/components/Widget ${ item} .tsx\`\n `
,
` - Severity: ${ [ '[Critical]' , '[Warning]' , '[Info]' , '[Suggestion]' , '[Note]' ] [ item] } \n `
,
` - The current implementation uses *unnecessary re-renders* due to missing dependency arrays.\n `
,
` - See [React docs](https://react.dev/reference) and the [\`useMemo\` guide](https://react.dev/reference/react/useMemo).\n `
,
` - Fix: wrap in \`useCallback\` or extract to a ***separate memoized component***.\n\n `
,
]
,
10
)
;
}
.
emit
(
'---\n\n'
)
;
}
.
emit
(
'> *Report generated automatically. Please review all suggestions before applying.*\n'
)
;
return
.
build
(
)
;
}
)
(
)
,
}
,
'giant-codeblock'
:
{
description
:
'40 classes in one fenced code block'
,
chunks
:
(
(
)
=>
{
const
=
new
ScenarioBuilder
(
)
;
.
emit
(
'Here is the complete implementation:\n\n```typescript\n'
)
;
.
stream
(
[
'import { Disposable, DisposableStore } from "vs/base/common/lifecycle";\n'
,
'import { Emitter, Event } from "vs/base/common/event";\n'
,
'import { URI } from "vs/base/common/uri";\n\n'
,
]
,
10
)
;
for
(
let
=
0
;
<
40
;
++
)
{
.
stream
(
[
` export class Service ${ i} extends Disposable {\n `
,
` private readonly _onDidChange = this._register(new Emitter<void>());\n `
,
` readonly onDidChange: Event<void> = this._onDidChange.event;\n\n `
,
` private _value: string = '';\n `
,
` get value(): string { return this._value; }\n\n `
,
` async update(uri: URI): Promise<void> {\n `
,
` this._value = uri.toString();\n `
,
` this._onDidChange.fire();\n `
,
` }\n `
,
'}\n\n'
,
]
,
5
)
;
}
.
emit
(
'```\n\nThis defines 40 service classes following the standard VS Code pattern.\n'
)
;
return
.
build
(
)
;
}
)
(
)
,
}
,
'rapid-stream'
:
{
description
:
'1000 tokens at 2ms (streaming stress test)'
,
chunks
:
(
(
)
=>
{
const
=
new
ScenarioBuilder
(
)
;
const
=
[
]
;
for
(
let
=
0
;
<
1000
;
++
)
{
.
push
(
` w ${ i} `
)
;
}
.
stream
(
,
2
)
;
return
.
build
(
)
;
}
)
(
)
,
}
,
'file-links'
:
{
description
:
'32 file references with line links'
,
chunks
:
(
(
)
=>
{
const
=
[
'src/vs/workbench/contrib/chat/browser/chatListRenderer.ts'
,
'src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts'
,
'src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts'
,
'src/vs/workbench/contrib/chat/common/chatPerf.ts'
,
'src/vs/base/common/lifecycle.ts'
,
'src/vs/base/common/event.ts'
,
'src/vs/platform/instantiation/common/instantiation.ts'
,
'src/vs/workbench/services/extensions/common/abstractExtensionService.ts'
,
'src/vs/workbench/api/common/extHostLanguageModels.ts'
,
'src/vs/workbench/contrib/chat/common/languageModels.ts'
,
'src/vs/editor/browser/widget/codeEditor/editor.ts'
,
'src/vs/workbench/browser/parts/editor/editorGroupView.ts'
,
]
;
const
=
new
ScenarioBuilder
(
)
;
.
emit
(
'I found references to the disposable pattern across the following files:\n\n'
)
;
for
(
let
=
0
;
<
.
length
;
++
)
{
const
=
Math
.
floor
(
Math
.
random
(
)
*
500
)
+
1
;
.
stream
(
[
` ${ i + 1 } . [ ${ files[ i] } ]( ${ files[ i] } #L ${ line} ) -- `
,
` Line ${ line} : uses \`DisposableStore\` with ${ Math . floor ( Math . random ( ) * 10 ) + 1 } registrations\n `
,
]
,
15
)
;
}
.
wait
(
10
,
'\nAdditionally, the following files import from `vs/base/common/lifecycle`:\n\n'
)
;
for
(
let
=
0
;
<
20
;
++
)
{
const
=
[
'base'
,
'platform'
,
'editor'
,
'workbench'
]
[
%
4
]
;
const
=
[
'common'
,
'browser'
,
'node'
,
'electron-browser'
]
[
%
4
]
;
const
=
[
'service'
,
'provider'
,
'contribution'
,
'handler'
,
'manager'
]
[
%
5
]
;
const
=
` src/vs/ ${ depth} / ${ area} / ${ name} ${ i} .ts `
;
.
stream
(
[
` - [ ${ file} ]( ${ file} #L ${ i * 10 + 5 } ) `
,
` -- imports \`Disposable\`, \`DisposableStore\`\n `
,
]
,
12
)
;
}
.
emit
(
'\nTotal: 32 files reference the disposable pattern.\n'
)
;
return
.
build
(
)
;
}
)
(
)
,
}
,
}
;
const
TOOL_CALL_SCENARIOS
=
{
'tool-read-file'
:
{
description
:
'Read 8 files across 2 tool-call rounds'
,
scenario
:
(
(
(
)
=>
{
const
=
[
'_chatperf_lifecycle.ts'
,
'_chatperf_event.ts'
,
'_chatperf_uri.ts'
,
'_chatperf_errors.ts'
,
'_chatperf_async.ts'
,
'_chatperf_strings.ts'
,
'_chatperf_arrays.ts'
,
'_chatperf_types.ts'
,
]
;
return
{
type
:
'multi-turn'
,
turns
:
[
{
kind
:
'tool-calls'
,
toolCalls
:
.
slice
(
0
,
4
)
.
map
(
f
=>
(
{
toolNamePattern
:
/ read. ? file / i
,
arguments
:
{
filePath
:
.
join
(
FIXTURES_DIR
,
)
,
startLine
:
1
,
endLine
:
50
}
,
}
)
)
,
}
,
{
kind
:
'tool-calls'
,
toolCalls
:
.
slice
(
4
)
.
map
(
f
=>
(
{
toolNamePattern
:
/ read. ? file / i
,
arguments
:
{
filePath
:
.
join
(
FIXTURES_DIR
,
)
,
startLine
:
1
,
endLine
:
50
}
,
}
)
)
,
}
,
{
kind
:
'content'
,
chunks
:
new
ScenarioBuilder
(
)
.
wait
(
20
,
'## Analysis of VS Code Base Utilities\n\n'
)
.
stream
(
[
'I read 8 core utility files from `src/vs/base/common/`. Here is a summary:\n\n'
,
'### lifecycle.ts\n'
,
'The `Disposable` base class provides the standard lifecycle pattern. Components register cleanup '
,
'handlers via `this._register()` which are automatically disposed when the parent is disposed.\n\n'
,
'### event.ts\n'
,
'The `Emitter` class implements the observer pattern. `Event.once()`, `Event.map()`, and `Event.filter()` '
,
'provide functional combinators for composing event streams.\n\n'
,
'### uri.ts\n'
,
'`URI` is an immutable representation of a resource identifier with scheme, authority, path, query, and fragment.\n\n'
,
'### errors.ts\n'
,
'Central error handling with `onUnexpectedError()` and `isCancellationError()` for distinguishing user cancellation.\n\n'
,
'### async.ts\n'
,
'`Throttler`, `Delayer`, `RunOnceScheduler`, and `Queue` manage async operation scheduling and deduplication.\n\n'
,
'### strings.ts\n'
,
'String utilities including `format()`, `escape()`, `startsWith()`, and `endsWith()` for common string operations.\n\n'
,
'### arrays.ts\n'
,
'Array helpers like `coalesce()`, `groupBy()`, `distinct()`, and binary search implementations.\n\n'
,
'### types.ts\n'
,
'Type guards and assertion helpers: `isString()`, `isNumber()`, `assertType()`, `assertIsDefined()`.\n'
,
]
,
15
)
.
build
(
)
,
}
,
]
,
}
;
}
)
(
)
)
,
}
,
'tool-edit-file'
:
{
description
:
'Read 3 files, edit 2 (read + write rounds)'
,
scenario
:
(
(
(
)
=>
{
const
=
[
'_chatperf_lifecycle.ts'
,
'_chatperf_event.ts'
,
'_chatperf_errors.ts'
,
]
;
return
{
type
:
'multi-turn'
,
turns
:
[
{
kind
:
'tool-calls'
,
toolCalls
:
.
map
(
f
=>
(
{
toolNamePattern
:
/ read. ? file / i
,
arguments
:
{
filePath
:
.
join
(
FIXTURES_DIR
,
)
,
startLine
:
1
,
endLine
:
40
}
,
}
)
)
,
}
,
{
kind
:
'tool-calls'
,
toolCalls
:
[
{
toolNamePattern
:
/ insert. ? edit| replace. ? string| apply. ? patch / i
,
arguments
:
{
filePath
:
.
join
(
FIXTURES_DIR
,
'_chatperf_lifecycle.ts'
)
,
explanation
:
'Update the benchmark marker comment in lifecycle.ts'
,
code
:
'// perf-benchmark-marker (updated)'
,
}
,
}
,
{
toolNamePattern
:
/ insert. ? edit| replace. ? string| apply. ? patch / i
,
arguments
:
{
filePath
:
.
join
(
FIXTURES_DIR
,
'_chatperf_event.ts'
)
,
explanation
:
'Update the benchmark marker comment in event.ts'
,
code
:
'// perf-benchmark-marker (updated)'
,
}
,
}
,
]
,
}
,
{
kind
:
'content'
,
chunks
:
new
ScenarioBuilder
(
)
.
wait
(
20
,
'## Edits Applied\n\n'
)
.
stream
(
[
'I read 3 files and applied edits to 2 of them:\n\n'
,
'### Files read:\n'
,
'1. `src/vs/base/common/lifecycle.ts` — Disposable pattern and lifecycle management\n'
,
'2. `src/vs/base/common/event.ts` — Event emitter and observer pattern\n'
,
'3. `src/vs/base/common/errors.ts` — Error handling utilities\n\n'
,
'### Edits applied:\n'
,
'1. **lifecycle.ts** — Updated the benchmark marker comment\n'
,
'2. **event.ts** — Updated the benchmark marker comment\n\n'
,
'Both files follow the standard VS Code pattern of using `Disposable` as a base class '
,
'with `_register()` for lifecycle management. The edits were minimal and localized.\n'
,
]
,
20
)
.
build
(
)
,
}
,
]
,
}
;
}
)
(
)
)
,
}
,
'tool-terminal'
:
{
description
:
'Run commands, read output, fix + rerun'
,
scenario
:
(
{
type
:
'multi-turn'
,
turns
:
[
{
kind
:
'tool-calls'
,
toolCalls
:
[
{
toolNamePattern
:
/ run. ? in. ? terminal| execute. ? command / i
,
arguments
:
{
command
:
'echo "Installing dependencies..." && echo "added 1631 packages in 6m"'
,
explanation
:
'Install project dependencies'
,
goal
:
'Install dependencies'
,
mode
:
'sync'
,
timeout
:
30000
,
}
,
}
,
]
,
}
,
{
kind
:
'tool-calls'
,
toolCalls
:
[
{
toolNamePattern
:
/ run. ? in. ? terminal| execute. ? command / i
,
arguments
:
{
command
:
'echo "Running unit tests..." && echo " 42 passing (3s)" && echo " 2 failing" && echo "" && echo " 1) ChatService should dispose listeners" && echo " AssertionError: expected 0 to equal 1" && echo " 2) ChatModel should clear on new session" && echo " TypeError: Cannot read property dispose of undefined"'
,
explanation
:
'Run the unit test suite to check for failures'
,
goal
:
'Run tests'
,
mode
:
'sync'
,
timeout
:
60000
,
}
,
}
,
]
,
}
,
{
kind
:
'tool-calls'
,
toolCalls
:
[
{
toolNamePattern
:
/ read. ? file / i
,
arguments
:
{
filePath
:
.
join
(
FIXTURES_DIR
,
'_chatperf_lifecycle.ts'
)
,
startLine
:
1
,
endLine
:
50
}
,
}
,
]
,
}
,
{
kind
:
'tool-calls'
,
toolCalls
:
[
{
toolNamePattern
:
/ insert. ? edit| replace. ? string| apply. ? patch / i
,
arguments
:
{
filePath
:
.
join
(
FIXTURES_DIR
,
'_chatperf_lifecycle.ts'
)
,
explanation
:
'Fix the dispose call in the test'
,
code
:
'// perf-benchmark-marker (fixed)'
,
}
,
}
,
]
,
}
,
{
kind
:
'tool-calls'
,
toolCalls
:
[
{
toolNamePattern
:
/ run. ? in. ? terminal| execute. ? command / i
,
arguments
:
{
command
:
'echo "Running unit tests..." && echo " 44 passing (3s)" && echo " 0 failing"'
,
explanation
:
'Re-run tests to verify the fix'
,
goal
:
'Verify fix'
,
mode
:
'sync'
,
timeout
:
60000
,
}
,
}
,
]
,
}
,
{
kind
:
'content'
,
chunks
:
new
ScenarioBuilder
(
)
.
wait
(
20
,
'## Test Failures Fixed\n\n'
)
.
stream
(
[
'I found and fixed 2 test failures:\n\n'
,
'### Root Cause\n'
,
'The `ChatService` was not properly disposing event listeners when a session was cleared. '
,
'The `dispose()` method was missing a call to `this._store.dispose()`.\n\n'
,
'### Changes Made\n'
,
'Updated `lifecycle.ts` to properly chain disposal:\n\n'
,
'```typescript\n'
,
'override dispose(): void {\n'
,
' this._store.dispose();\n'
,
' super.dispose();\n'
,
'}\n'
,
'```\n\n'
,
'### Test Results\n'
,
'- **Before**: 42 passing, 2 failing\n'
,
'- **After**: 44 passing, 0 failing\n\n'
,
'All tests pass now. The fix ensures listeners are cleaned up during session transitions.\n'
,
]
,
15
)
.
build
(
)
,
}
,
]
,
}
)
,
}
,
}
;
const
MULTI_TURN_SCENARIOS
=
{
'thinking-response'
:
{
description
:
'Thinking block before content response'
,
scenario
:
(
{
type
:
'multi-turn'
,
turns
:
[
{
kind
:
'thinking'
,
thinkingChunks
:
new
ScenarioBuilder
(
)
.
stream
(
[
'Let me analyze this code carefully. '
,
'The user is asking about the lifecycle pattern in VS Code. '
,
'I should look at the Disposable base class and how it manages cleanup. '
,
'The key methods are _register(), dispose(), and the DisposableStore pattern. '
,
'I need to read the file first to give an accurate explanation.'
,
]
,
15
)
.
build
(
)
,
chunks
:
new
ScenarioBuilder
(
)
.
wait
(
20
,
'I\'ll start by reading the file to understand its structure.\n\n'
)
.
stream
(
[
'The `Disposable` base class in `lifecycle.ts` provides a standard pattern '
,
'for managing resources. It uses a `DisposableStore` internally to track '
,
'all registered disposables and clean them up on `dispose()`.\n'
,
]
,
20
)
.
build
(
)
,
}
,
]
,
}
)
,
}
,
'multi-turn-user'
:
{
description
:
'2 user follow-ups with thinking + code'
,
scenario
:
(
{
type
:
'multi-turn'
,
turns
:
[
{
kind
:
'tool-calls'
,
toolCalls
:
[
{
toolNamePattern
:
/ read. ? file / i
,
arguments
:
{
filePath
:
.
join
(
FIXTURES_DIR
,
'_chatperf_lifecycle.ts'
)
,
offset
:
1
,
limit
:
50
,
}
,
}
,
]
,
}
,
{
kind
:
'content'
,
chunks
:
new
ScenarioBuilder
(
)
.
wait
(
20
,
'I\'ve read the file. Here\'s what I found:\n\n'
)
.
stream
(
[
'The `Disposable` class is the base for lifecycle management. '
,
'It internally holds a `DisposableStore` via `this._store`. '
,
'Subclasses call `this._register()` to track their own disposables.\n\n'
,
'Would you like me to explain any specific part in more detail?\n'
,
]
,
20
)
.
build
(
)
,
}
,
{
kind
:
'user'
,
message
:
'Yes, explain the MutableDisposable pattern'
,
}
,
{
kind
:
'thinking'
,
thinkingChunks
:
new
ScenarioBuilder
(
)
.
stream
(
[
'The user wants to understand MutableDisposable specifically. '
,
'Let me recall the key aspects: it holds a single disposable that can be swapped. '
,
'When a new value is set, the old one is automatically disposed. '
,
'This is useful for things like event listener subscriptions that need to be replaced.'
,
]
,
10
)
.
build
(
)
,
chunks
:
new
ScenarioBuilder
(
)
.
wait
(
15
,
'## MutableDisposable\n\n'
)
.
stream
(
[
'`MutableDisposable<T>` holds a **single disposable** that can be swapped at any time. '
,
'When you set a new value via `.value = newDisposable`, the previous value is automatically disposed.\n\n'
,
'This is perfect for:\n'
,
'- **Event listeners** that need to be re-subscribed when configuration changes\n'
,
'- **Editor decorations** that are replaced when content updates\n'
,
'- **Watchers** that switch targets dynamically\n\n'
,
'```typescript\n'
,
'class MyService extends Disposable {\n'
,
' private readonly _listener = this._register(new MutableDisposable());\n\n'
,
' updateTarget(editor: ICodeEditor): void {\n'
,
' // Old listener is automatically disposed\n'
,
' this._listener.value = editor.onDidChangeModel(() => {\n'
,
' this._handleModelChange();\n'
,
' });\n'
,
' }\n'
,
'}\n'
,
'```\n\n'
,
'The key benefit is that you never forget to dispose the old subscription.\n'
,
]
,
15
)
.
build
(
)
,
}
,
{
kind
:
'user'
,
message
:
'Can you also show me DisposableMap?'
,
}
,
{
kind
:
'content'
,
chunks
:
new
ScenarioBuilder
(
)
.
wait
(
20
,
'## DisposableMap\n\n'
)
.
stream
(
[
'`DisposableMap<K, V>` extends `Map` with automatic disposal semantics:\n\n'
,
'- When a key is **overwritten**, the old value is disposed\n'
,
'- When a key is **deleted**, the value is disposed\n'
,
'- When the map itself is **disposed**, all values are disposed\n\n'
,
'```typescript\n'
,
'class ToolManager extends Disposable {\n'
,
' private readonly _tools = this._register(new DisposableMap<string, IDisposable>());\n\n'
,
' registerTool(id: string, tool: IDisposable): void {\n'
,
' this._tools.set(id, tool); // auto-disposes previous tool with same id\n'
,
' }\n'
,
'}\n'
,
'```\n\n'
,
'This is commonly used for managing collections of disposable resources keyed by ID.\n'
,
]
,
15
)
.
build
(
)
,
}
,
]
,
}
)
,
}
,
'long-conversation'
:
{
description
:
'10 user turns, mixed content types'
,
scenario
:
(
(
(
)
=>
{
const
=
[
{
question
:
'How does the Disposable pattern work?'
,
heading
:
'Disposable Pattern'
,
content
:
'The `Disposable` base class provides lifecycle management. Subclasses call `this._register()` to track child disposables that are cleaned up automatically when `dispose()` is called.'
}
,
{
question
:
'What about DisposableStore?'
,
heading
:
'DisposableStore'
,
content
:
'`DisposableStore` aggregates multiple `IDisposable` instances and disposes them all at once. It tracks whether it has already been disposed and throws if you try to add after disposal.'
}
,
{
question
:
'How does the Event system work?'
,
heading
:
'Event System'
,
content
:
'The `Emitter<T>` class implements the observer pattern. `Event.once()`, `Event.map()`, `Event.filter()`, and `Event.debounce()` provide functional combinators for composing event streams.'
}
,
{
question
:
'Explain dependency injection'
,
heading
:
'Dependency Injection'
,
content
:
'Services are injected through constructor parameters decorated with service identifiers. The `IInstantiationService` resolves dependencies recursively, creating singletons within each scope.'
}
,
{
question
:
'What is the contribution model?'
,
heading
:
'Contribution Model'
,
content
:
'Features register functionality through extension points like `Registry.as<IWorkbenchContributionsRegistry>()`. Contributions are instantiated during specific lifecycle phases.'
}
,
{
question
:
'How does the editor handle text models?'
,
heading
:
'Text Models'
,
content
:
'The `TextModel` class manages document content with line-based storage. It supports undo/redo stacks, bracket matching, tokenization, and change tracking via edit operations.'
}
,
{
question
:
'Explain the extension host architecture'
,
heading
:
'Extension Host'
,
content
:
'Extensions run in a separate process (or worker) called the extension host. Communication happens via an RPC protocol over `IPC`. The main process proxies API calls back to the workbench.'
}
,
{
question
:
'How does file watching work?'
,
heading
:
'File Watching'
,
content
:
'The `IFileService` supports correlated and shared file watchers. Correlated watchers are preferred as they track specific resources. The underlying implementation uses `chokidar` or `parcel/watcher`.'
}
,
{
question
:
'What about the tree widget?'
,
heading
:
'Tree Widget'
,
content
:
'The `AsyncDataTree` and `ObjectTree` provide virtualized tree rendering. They support filtering, sorting, keyboard navigation, and accessibility. The `ITreeRenderer` interface handles element rendering.'
}
,
{
question
:
'How does the settings editor work?'
,
heading
:
'Settings Editor'
,
content
:
'Settings are declared in `package.json` contribution points. The settings editor reads the configuration registry, groups settings by category, and renders appropriate input controls for each type.'
}
,
]
;
const
=
[
]
;
const
=
[
0
]
;
.
push
(
{
kind
:
'content'
,
chunks
:
new
ScenarioBuilder
(
)
.
wait
(
20
,
` ## ${ firstTopic. heading } \n\n `
)
.
stream
(
[
` ${ firstTopic. content } \n\n `
,
'Here is a typical example:\n\n'
,
'```typescript\n'
,
'class MyService extends Disposable {\n'
,
' private readonly _onDidChange = this._register(new Emitter<void>());\n'
,
' readonly onDidChange: Event<void> = this._onDidChange.event;\n\n'
,
' constructor(@IFileService private readonly fileService: IFileService) {\n'
,
' super();\n'
,
' this._register(fileService.onDidFilesChange(e => this._handleChange(e)));\n'
,
' }\n'
,
'}\n'
,
'```\n\n'
,
'Would you like to know more about any specific aspect?\n'
,
]
,
15
)
.
build
(
)
,
}
)
;
for
(
let
=
1
;
<
.
length
;
++
)
{
const
=
[
]
;
.
push
(
{
kind
:
'user'
,
message
:
.
question
}
)
;
const
=
new
ScenarioBuilder
(
)
;
.
wait
(
20
,
` ## ${ topic. heading } \n\n `
)
;
const
=
.
content
.
split
(
'. '
)
;
.
stream
(
.
map
(
s
=>
.
endsWith
(
'.'
)
?
+
' '
:
+
'. '
)
,
12
)
;
.
emit
(
'\n\n'
)
;
if
(
%
3
===
0
)
{
.
emit
(
'```typescript\n'
)
;
for
(
let
=
0
;
<
8
;
++
)
{
.
stream
(
[
` export class ${ topic. heading . replace ( / \s / g , '' ) } Part ${ j} extends Disposable {\n `
,
` private readonly _state = new Map<string, unknown>();\n\n `
,
` process(input: string): string {\n `
,
` const cached = this._state.get(input);\n `
,
` if (cached) { return String(cached); }\n `
,
` const result = input.split('').reverse().join('');\n `
,
` this._state.set(input, result);\n `
,
` return result;\n `
,
` }\n `
,
'}\n\n'
,
]
,
5
)
;
}
.
emit
(
'```\n\n'
)
;
}
else
if
(
%
3
===
1
)
{
.
emit
(
'Key points to remember:\n\n'
)
;
for
(
let
=
0
;
<
6
;
++
)
{
.
stream
(
[
` ${ j + 1 } . **Point ${ j + 1 } **: The \` ${ topic. heading . replace ( / \s / g , '' ) } ${ j} \` `
,
` component uses the standard pattern with \`_register()\` for lifecycle. `
,
` It handles edge cases like ${ [ 'empty input' , 'null references' , 'concurrent access' , 'circular deps' , 'timeout expiry' , 'disposal races' ] [ j] } .\n `
,
]
,
10
)
;
}
.
emit
(
'\n'
)
;
}
else
{
.
stream
(
[
'This pattern is used extensively throughout the codebase. '
,
'The key insight is that resources are always tracked from creation, '
,
'ensuring no leaks even in error paths. '
,
'The ownership chain is explicit and follows the component hierarchy.\n\n'
,
]
,
12
)
;
.
emit
(
'Quick example:\n\n```typescript\n'
)
;
.
stream
(
[
` const store = new DisposableStore();\n `
,
` store.add(event.on(() => { /* handler */ }));\n `
,
` store.add(watcher.watch(uri));\n `
,
` // Later: store.dispose(); // cleans up everything\n `
,
]
,
8
)
;
.
emit
(
'```\n\n'
)
;
}
.
stream
(
[
` That covers the essentials of ** ${ topic. heading } **. `
,
'Let me know if you want to dive deeper into any of these concepts.\n'
,
]
,
15
)
;
.
push
(
{
kind
:
'content'
,
chunks
:
.
build
(
)
,
}
)
;
}
return
{
type
:
'multi-turn'
,
}
;
}
)
(
)
)
,
}
,
}
;
function
getScenarioDescription
(
id
)
{
const
=
CONTENT_SCENARIOS
[
]
;
if
(
)
{
return
.
description
;
}
const
=
TOOL_CALL_SCENARIOS
[
]
;
if
(
)
{
return
.
description
;
}
const
=
MULTI_TURN_SCENARIOS
[
]
;
if
(
)
{
return
.
description
;
}
return
''
;
}
function
registerPerfScenarios
(
)
{
for
(
const
[
,
]
of
Object
.
entries
(
CONTENT_SCENARIOS
)
)
{
registerScenario
(
,
.
chunks
)
;
}
for
(
const
[
,
]
of
Object
.
entries
(
TOOL_CALL_SCENARIOS
)
)
{
registerScenario
(
,
.
scenario
)
;
}
for
(
const
[
,
]
of
Object
.
entries
(
MULTI_TURN_SCENARIOS
)
)
{
registerScenario
(
,
.
scenario
)
;
}
}
.
exports
=
{
,
,
CONTENT_SCENARIOS
,
TOOL_CALL_SCENARIOS
,
MULTI_TURN_SCENARIOS
}
;