ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / sessions / contrib / chat / test / browser / sessionTurnChanges.test.ts 606 строк · изменён 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
import assert from 'assert' ;
import { autorun, constObservable, IObservable, observableValue, transaction } from '../../../../../base/common/observable.js' ;
import { URI } from '../../../../../base/common/uri.js' ;
import { mock, upcastPartial } from '../../../../../base/test/common/mock.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js' ;
import { isIChatSessionFileChange2 } from '../../../../../workbench/contrib/chat/common/chatSessionsService.js' ;
import { IEditorService } from
IAgentWorkbenchLayoutService
ISessionsService
IChat ISessionChangeset ISessionFileChange ISessionFolder ISessionTurnFileChange ISessionWorkspace
IActiveSession ISessionsManagementService
ISessionChangesEditorOptions ISessionChangesService
IChangesViewService
SessionsChatResponseFileChangesService
disposables
IChangesViewService
override activeSessionResourceObs
override activeSessionChangesetsObs
chatResource
lastTurnChanges
uri
originalUri
modifiedUri
insertions
deletions
isOutsideWorkspace
chat
resource chatResource
updatedAt
lastTurnChanges
session
resource
providerId
chats chat
mainChat chat
calls object
selectedChanges IObservable ISessionFileChange
sessionsManagementService
override
session chat
sessionsService
override activeSession
override sessionResource options preserveFocus
calls showSession sessionResource preserveFocus options preserveFocus
sessionChangesService
override sessionResource options ISessionChangesEditorOptions
selection options changesetSelection
calls
openChangesEditor sessionResource
changesetId selection kind selection changeset id selection id
selectedChanges selection kind selection changeset changes
layoutService
override
calls revealEditorPartExplicitly
service disposables
sessionsManagementService
sessionsService
sessionChangesService
layoutService
service chatResource isLastTurn
lastTurnChanges
uri
modifiedUri
insertions
deletions
isOutsideWorkspace
assert
calls
selectedChanges selectedChanges change change change uri
calls
showSession session resource preserveFocus
revealEditorPartExplicitly
openChangesEditor session resource changesetId
selectedChanges
workspaceFolder
session
resource
workspace
folders
root workspaceFolder
workingDirectory workspaceFolder
chatResource
calls object
sessionsManagementService
override
session chat resource chatResource
sessionsService
override activeSession session
sessionChangesService
override sessionResource options ISessionChangesEditorOptions
selection options changesetSelection
selection kind
calls
sessionResource sessionResource
changeset
id selection changeset id
label selection changeset label
changes selection changeset changes change
uri change change uri
originalUri change originalUri
modifiedUri change modifiedUri
insertions change insertions
deletions change deletions
operations selection changeset operations
layoutService
override
calls revealEditorPartExplicitly
service disposables
sessionsManagementService
sessionsService
sessionChangesService
layoutService
disposables service
originalURI
modifiedURI
modifiedSnapshotURI
added
removed
quitEarly
identical
isFinal
isBusy
originalURI
modifiedURI
isDeleted
added
removed
quitEarly
identical
isFinal
isBusy
originalURI
modifiedURI
added
removed
quitEarly
identical
isFinal
isBusy
service chatResource isLastTurn
assert calls
revealEditorPartExplicitly
sessionResource
changeset
id
label
changes
uri
originalUri
modifiedUri
insertions
deletions
uri
originalUri
modifiedUri
insertions
deletions
operations
chatResource
chat
resource chatResource
updatedAt
session
resource
chats chat
mainChat chat
selections
sessionsManagementService
override
session chat
sessionsService
override activeSession session
sessionChangesService
override _sessionResource options ISessionChangesEditorOptions
selection options changesetSelection
selection
selections selection kind selection changeset id selection id
layoutService
override
service disposables
sessionsManagementService
sessionsService
sessionChangesService
layoutService
disposables service
service chatResource isLastTurn
service chatResource isLastTurn
assert selections
chatResource
chat
resource chatResource
updatedAt
lastTurnChanges
uri
originalUri
modifiedUri
insertions
deletions
isOutsideWorkspace
newerChat
resource
updatedAt
workspaceFolder
session
resource
providerId
workspace
folders
root workspaceFolder
workingDirectory workspaceFolder
chats chat newerChat
mainChat chat
selections object
service disposables
override
session chat
override activeSession session
override _sessionResource options ISessionChangesEditorOptions
selection options changesetSelection
selection
selections
id selection kind selection changeset id selection id
label selection kind selection changeset label
uris selection kind
selection changeset changes change change change uri
override
disposables service
originalURI
modifiedURI
added
removed
quitEarly
identical
isFinal
isBusy
service chatResource isLastTurn
service chatResource isLastTurn
assert selections
id
label
uris
id
label
uris
openCount
editorService
override
openCount
service disposables
editorService
override
disposables service
originalURI
modifiedURI
added
removed
quitEarly
identical
isFinal
isBusy
service isLastTurn
assert openCount
chatResource
chat
resource chatResource
updatedAt
session
resource
chats chat
mainChat chat
changes
uri
modifiedUri
insertions
deletions
changeset
id
isEnabled
isLoadingChanges
changes
changesViewService
override activeSessionResourceObs session resource
override activeSessionChangesetsObs changeset
service disposables
override
session chat
changesViewService
stats service chatResource isLastTurn
notificationCount
disposables reader
stats reader
notificationCount
before stats
changes
uri
modifiedUri
insertions
deletions
afterEquivalentUpdate notificationCount
changes
changes
uri
modifiedUri
insertions
deletions
assert before afterEquivalentUpdate afterChangedUpdate notificationCount after stats
before files insertions deletions
afterEquivalentUpdate
afterChangedUpdate
after files insertions deletions
chatResource
chatUpdatedAt
newerChatUpdatedAt
chat
resource chatResource
updatedAt chatUpdatedAt
newerChat
resource
updatedAt newerChatUpdatedAt
session
resource
chats chat newerChat
mainChat chat
changeset
id
isEnabled
isLoadingChanges
changes
uri
modifiedUri
insertions
deletions
service disposables
override
session chat
override activeSessionResourceObs session resource
override activeSessionChangesetsObs changeset
disposables service
originalURI
modifiedURI
added
removed
quitEarly
identical
isFinal
isBusy
stats service chatResource isLastTurn
states stats
newerChatUpdatedAt
states stats
chatUpdatedAt
states stats
assert states
files insertions deletions
files insertions deletions
files insertions deletions
chatResource
chat
resource chatResource
updatedAt
session
resource
chats chat
mainChat chat
loading
changes
uri
modifiedUri
insertions
deletions
changeset
id
isEnabled
isLoadingChanges loading
changes
service disposables
override
session chat
override activeSessionResourceObs session resource
override activeSessionChangesetsObs changeset
stats service chatResource isLastTurn
states stats
tx
loading tx
changes tx
states stats
loading
states stats
assert states
files insertions deletions
files insertions deletions
files insertions deletions
'../../../../../workbench/services/editor/common/editorService.js'
;
import
{
}
from
'../../../../browser/workbench.js'
;
import
{
}
from
'../../../../services/sessions/browser/sessionsService.js'
;
import
{
,
,
,
,
,
,
TURN_CHANGES_CHANGESET_ID
}
from
'../../../../services/sessions/common/session.js'
;
import
{
,
}
from
'../../../../services/sessions/common/sessionsManagement.js'
;
import
{
,
}
from
'../../../changes/browser/sessionChangesService.js'
;
import
{
}
from
'../../../changes/common/changesViewService.js'
;
import
{
}
from
'../../browser/sessionTurnChanges.js'
;
suite
(
'SessionTurnChanges'
,
(
)
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
function
createChangesViewService
(
)
:
{
return
new
class
extends
mock< IChangesViewService>
(
)
{
readonly
=
constObservable < URI | undefined >
(
undefined
)
;
readonly
=
constObservable < readonly ISessionChangeset[ ] | undefined >
(
undefined
)
;
}
(
)
;
}
test
(
'activates the session and selects Last Turn Changes from the live input pill'
,
(
)
=>
{
const
=
URI
.
parse
(
'chat:session'
)
;
const
=
observableValue < readonly ISessionTurnFileChange[ ] >
(
'lastTurnChanges'
,
[
{
:
URI
.
file
(
'/workspace/first.ts'
)
,
:
URI
.
parse
(
'agenthost:/snapshots/first-before'
)
,
:
URI
.
file
(
'/workspace/first.ts'
)
,
:
1
,
:
0
,
:
false
,
}
]
)
;
const
=
upcastPartial < IChat>
(
{
:
,
:
constObservable
(
new
Date
(
'2026-08-13T10:00:00Z'
)
)
,
,
}
)
;
const
=
upcastPartial < IActiveSession>
(
{
:
URI
.
parse
(
'agent-host:session'
)
,
:
'local-agent-host'
,
:
constObservable
(
[
]
)
,
:
constObservable
(
)
,
}
)
;
const
:
[
]
=
[
]
;
let
:
<
readonly
[
]
>
|
undefined
;
const
=
new
class
extends
mock< ISessionsManagementService>
(
)
{
getSessionForChatResource
(
)
{
return
{
,
}
;
}
}
(
)
;
const
=
new
class
extends
mock< ISessionsService>
(
)
{
readonly
=
constObservable < IActiveSession | undefined >
(
undefined
)
;
showSession
(
:
URI
,
?
:
{
?
:
boolean
}
)
:
void
{
.
push
(
{
:
.
toString
(
)
,
:
?.
}
)
;
}
}
(
)
;
const
=
new
class
extends
mock< ISessionChangesService>
(
)
{
async
openChangesEditor
(
:
URI
,
?
:
)
:
Promise
<
undefined
>
{
const
=
?.
;
.
push
(
{
:
.
toString
(
)
,
:
?.
===
'transient'
?
.
.
:
?.
,
}
)
;
=
?.
===
'transient'
?
.
.
:
undefined
;
return
undefined
;
}
}
(
)
;
const
=
new
class
extends
mock< IAgentWorkbenchLayoutService>
(
)
{
revealEditorPartExplicitly
(
)
:
void
{
.
push
(
{
:
true
}
)
;
}
}
(
)
;
const
=
.
add
(
new
SessionsChatResponseFileChangesService
(
new
class
extends
mock< IEditorService>
(
)
{
}
(
)
,
,
,
,
,
createChangesViewService
(
)
,
)
)
;
.
openChangesForRequest
(
,
undefined
,
{
:
true
}
)
;
.
set
(
[
{
:
URI
.
file
(
'/workspace/second.ts'
)
,
:
URI
.
file
(
'/workspace/second.ts'
)
,
:
2
,
:
1
,
:
false
,
}
]
,
undefined
)
;
.
deepStrictEqual
(
{
,
:
?.
get
(
)
.
map
(
=>
isIChatSessionFileChange2
(
)
?
.
.
toString
(
)
:
undefined
)
,
}
,
{
:
[
{
:
.
.
toString
(
)
,
:
true
}
,
{
:
true
}
,
{
:
.
.
toString
(
)
,
:
TURN_CHANGES_CHANGESET_ID
}
,
]
,
:
undefined
,
}
)
;
}
)
;
test
(
'opens exact historical request changes as a transient changeset'
,
(
)
=>
{
const
=
URI
.
file
(
'/workspace'
)
;
const
=
upcastPartial < IActiveSession>
(
{
:
URI
.
parse
(
'agent-host:session'
)
,
:
constObservable
(
upcastPartial < ISessionWorkspace>
(
{
:
[
upcastPartial < ISessionFolder>
(
{
:
,
:
,
}
)
]
,
}
)
)
,
}
)
;
const
=
URI
.
parse
(
'chat:session'
)
;
const
:
[
]
=
[
]
;
const
=
new
class
extends
mock< ISessionsManagementService>
(
)
{
getSessionForChatResource
(
)
{
return
{
,
:
upcastPartial < IChat>
(
{
:
}
)
}
;
}
}
(
)
;
const
=
new
class
extends
mock< ISessionsService>
(
)
{
readonly
=
constObservable < IActiveSession | undefined >
(
)
;
}
(
)
;
const
=
new
class
extends
mock< ISessionChangesService>
(
)
{
async
openChangesEditor
(
:
URI
,
?
:
)
:
Promise
<
undefined
>
{
const
=
?.
;
if
(
?.
===
'transient'
)
{
.
push
(
{
:
.
toString
(
)
,
:
{
:
.
.
,
:
.
.
,
:
.
.
.
get
(
)
.
map
(
=>
(
{
:
isIChatSessionFileChange2
(
)
?
.
.
toString
(
)
:
undefined
,
:
.
?.
toString
(
)
,
:
.
?.
toString
(
)
,
:
.
,
:
.
,
}
)
)
,
:
.
.
.
get
(
)
,
}
,
}
)
;
}
return
undefined
;
}
}
(
)
;
const
=
new
class
extends
mock< IAgentWorkbenchLayoutService>
(
)
{
revealEditorPartExplicitly
(
)
:
void
{
.
push
(
{
:
true
}
)
;
}
}
(
)
;
const
=
.
add
(
new
SessionsChatResponseFileChangesService
(
new
class
extends
mock< IEditorService>
(
)
{
}
(
)
,
,
,
,
,
createChangesViewService
(
)
,
)
)
;
.
add
(
.
registerProvider
(
'chat'
,
{
getChangesForRequest
:
(
)
=>
constObservable
(
[
{
:
URI
.
parse
(
'agenthost:/snapshots/before'
)
,
:
URI
.
file
(
'/workspace/file.ts'
)
,
:
URI
.
parse
(
'agenthost:/snapshots/after'
)
,
:
4
,
:
2
,
:
false
,
:
false
,
:
true
,
:
false
,
}
,
{
:
URI
.
parse
(
'agenthost:/snapshots/deleted-before'
)
,
:
URI
.
file
(
'/workspace/deleted.ts'
)
,
:
true
,
:
0
,
:
3
,
:
false
,
:
false
,
:
true
,
:
false
,
}
,
{
:
URI
.
parse
(
'agenthost:/snapshots/outside-before'
)
,
:
URI
.
file
(
'/outside/ignored.ts'
)
,
:
1
,
:
1
,
:
false
,
:
false
,
:
true
,
:
false
,
}
]
)
,
}
)
)
;
.
openChangesForRequest
(
,
'request'
,
{
:
false
}
)
;
.
deepStrictEqual
(
,
[
{
:
true
}
,
{
:
'agent-host:session'
,
:
{
:
'turn:request'
,
:
'Turn Changes'
,
:
[
{
:
'file:///workspace/file.ts'
,
:
'agenthost:/snapshots/before'
,
:
'agenthost:/snapshots/after'
,
:
4
,
:
2
,
}
,
{
:
'file:///workspace/deleted.ts'
,
:
'agenthost:/snapshots/deleted-before'
,
:
undefined
,
:
0
,
:
3
,
}
]
,
:
[
]
,
}
,
}
,
]
)
;
}
)
;
test
(
'routes latest and historical response changes to their respective selections'
,
(
)
=>
{
const
=
URI
.
parse
(
'chat:session'
)
;
const
=
upcastPartial < IChat>
(
{
:
,
:
constObservable
(
new
Date
(
'2026-08-13T10:00:00Z'
)
)
,
}
)
;
const
=
upcastPartial < IActiveSession>
(
{
:
URI
.
parse
(
'agent-host:session'
)
,
:
constObservable
(
[
]
)
,
:
constObservable
(
)
,
}
)
;
const
:
string
[
]
=
[
]
;
const
=
new
class
extends
mock< ISessionsManagementService>
(
)
{
getSessionForChatResource
(
)
{
return
{
,
}
;
}
}
(
)
;
const
=
new
class
extends
mock< ISessionsService>
(
)
{
readonly
=
constObservable < IActiveSession | undefined >
(
)
;
}
(
)
;
const
=
new
class
extends
mock< ISessionChangesService>
(
)
{
async
openChangesEditor
(
:
URI
,
?
:
)
:
Promise
<
undefined
>
{
const
=
?.
;
if
(
)
{
.
push
(
.
===
'transient'
?
.
.
:
.
??
''
)
;
}
return
undefined
;
}
}
(
)
;
const
=
new
class
extends
mock< IAgentWorkbenchLayoutService>
(
)
{
revealEditorPartExplicitly
(
)
:
void
{
}
}
(
)
;
const
=
.
add
(
new
SessionsChatResponseFileChangesService
(
new
class
extends
mock< IEditorService>
(
)
{
}
(
)
,
,
,
,
,
createChangesViewService
(
)
,
)
)
;
.
add
(
.
registerProvider
(
'chat'
,
{
getChangesForRequest
:
(
)
=>
constObservable
(
[
]
)
,
}
)
)
;
.
openChangesForRequest
(
,
'historical'
,
{
:
false
}
)
;
.
openChangesForRequest
(
,
'latest'
,
{
:
true
}
)
;
.
deepStrictEqual
(
,
[
'turn:historical'
,
TURN_CHANGES_CHANGESET_ID
]
)
;
}
)
;
test
(
'opens chat-specific last-turn changes when another chat is more recent'
,
(
)
=>
{
const
=
URI
.
parse
(
'chat:older'
)
;
const
=
upcastPartial < IChat>
(
{
:
,
:
constObservable
(
new
Date
(
'2026-08-13T10:00:00Z'
)
)
,
:
constObservable
(
[
{
:
URI
.
file
(
'/workspace/input.ts'
)
,
:
URI
.
parse
(
'agenthost:/snapshots/input-before'
)
,
:
URI
.
file
(
'/workspace/input.ts'
)
,
:
2
,
:
1
,
:
false
,
}
]
)
,
}
)
;
const
=
upcastPartial < IChat>
(
{
:
URI
.
parse
(
'chat:newer'
)
,
:
constObservable
(
new
Date
(
'2026-08-13T11:00:00Z'
)
)
,
}
)
;
const
=
URI
.
file
(
'/workspace'
)
;
const
=
upcastPartial < IActiveSession>
(
{
:
URI
.
parse
(
'agent-host:session'
)
,
:
'local-agent-host'
,
:
constObservable
(
upcastPartial < ISessionWorkspace>
(
{
:
[
upcastPartial < ISessionFolder>
(
{
:
,
:
,
}
)
]
,
}
)
)
,
:
constObservable
(
[
,
]
)
,
:
constObservable
(
)
,
}
)
;
const
:
[
]
=
[
]
;
const
=
.
add
(
new
SessionsChatResponseFileChangesService
(
new
class
extends
mock< IEditorService>
(
)
{
}
(
)
,
new
class
extends
mock< ISessionsManagementService>
(
)
{
getSessionForChatResource
(
)
{
return
{
,
}
;
}
}
(
)
,
new
class
extends
mock< ISessionsService>
(
)
{
readonly
=
constObservable < IActiveSession | undefined >
(
)
;
}
(
)
,
new
class
extends
mock< ISessionChangesService>
(
)
{
async
openChangesEditor
(
:
URI
,
?
:
)
:
Promise
<
undefined
>
{
const
=
?.
;
if
(
)
{
.
push
(
{
:
.
===
'transient'
?
.
.
:
.
,
:
.
===
'transient'
?
.
.
:
undefined
,
:
.
===
'transient'
?
.
.
.
get
(
)
.
map
(
=>
isIChatSessionFileChange2
(
)
?
.
.
toString
(
)
:
undefined
)
:
undefined
,
}
)
;
}
return
undefined
;
}
}
(
)
,
new
class
extends
mock< IAgentWorkbenchLayoutService>
(
)
{
revealEditorPartExplicitly
(
)
:
void
{
}
}
(
)
,
createChangesViewService
(
)
,
)
)
;
.
add
(
.
registerProvider
(
'chat'
,
{
getChangesForRequest
:
(
)
=>
constObservable
(
[
{
:
URI
.
parse
(
'agenthost:/snapshots/response-before'
)
,
:
URI
.
file
(
'/workspace/response.ts'
)
,
:
1
,
:
0
,
:
false
,
:
false
,
:
true
,
:
false
,
}
]
)
,
}
)
)
;
.
openChangesForRequest
(
,
'request'
,
{
:
true
}
)
;
.
openChangesForRequest
(
,
undefined
,
{
:
true
}
)
;
.
deepStrictEqual
(
,
[
{
:
'turn:request'
,
:
'Turn Changes'
,
:
[
'file:///workspace/response.ts'
]
,
}
,
{
:
TURN_CHANGES_CHANGESET_ID
,
:
undefined
,
:
undefined
,
}
]
)
;
}
)
;
test
(
'falls back to a standalone multi-diff for non-Agents sessions'
,
(
)
=>
{
let
=
0
;
const
=
new
class
extends
mock< IEditorService>
(
)
{
async
openEditor
(
)
:
Promise
<
undefined
>
{
++
;
return
undefined
;
}
}
(
)
;
const
=
.
add
(
new
SessionsChatResponseFileChangesService
(
,
new
class
extends
mock< ISessionsManagementService>
(
)
{
getSessionForChatResource
(
)
{
return
undefined
;
}
}
(
)
,
new
class
extends
mock< ISessionsService>
(
)
{
}
(
)
,
new
class
extends
mock< ISessionChangesService>
(
)
{
}
(
)
,
new
class
extends
mock< IAgentWorkbenchLayoutService>
(
)
{
}
(
)
,
createChangesViewService
(
)
,
)
)
;
.
add
(
.
registerProvider
(
'test'
,
{
getChangesForRequest
:
(
)
=>
constObservable
(
[
{
:
URI
.
file
(
'/before.ts'
)
,
:
URI
.
file
(
'/after.ts'
)
,
:
1
,
:
0
,
:
false
,
:
false
,
:
true
,
:
false
,
}
]
)
,
}
)
)
;
.
openChangesForRequest
(
URI
.
parse
(
'test:session'
)
,
'request'
,
{
:
false
}
)
;
.
strictEqual
(
,
1
)
;
}
)
;
test
(
'reads current-turn stats from the Changes view service'
,
(
)
=>
{
const
=
URI
.
parse
(
'chat:session'
)
;
const
=
upcastPartial < IChat>
(
{
:
,
:
constObservable
(
new
Date
(
'2026-08-13T10:00:00Z'
)
)
,
}
)
;
const
=
upcastPartial < IActiveSession>
(
{
:
URI
.
parse
(
'agent-host:session'
)
,
:
constObservable
(
[
]
)
,
:
constObservable
(
)
,
}
)
;
const
=
observableValue < readonly ISessionFileChange[ ] >
(
'turnChanges'
,
[
{
:
URI
.
file
(
'/workspace/first.ts'
)
,
:
URI
.
file
(
'/workspace/first.ts'
)
,
:
4
,
:
2
,
}
]
)
;
const
=
upcastPartial < ISessionChangeset>
(
{
:
TURN_CHANGES_CHANGESET_ID
,
:
constObservable
(
true
)
,
:
constObservable
(
false
)
,
,
}
)
;
const
=
new
class
extends
mock< IChangesViewService>
(
)
{
readonly
=
constObservable < URI | undefined >
(
.
)
;
readonly
=
constObservable < readonly ISessionChangeset[ ] | undefined >
(
[
]
)
;
}
(
)
;
const
=
.
add
(
new
SessionsChatResponseFileChangesService
(
new
class
extends
mock< IEditorService>
(
)
{
}
(
)
,
new
class
extends
mock< ISessionsManagementService>
(
)
{
getSessionForChatResource
(
)
{
return
{
,
}
;
}
}
(
)
,
new
class
extends
mock< ISessionsService>
(
)
{
}
(
)
,
new
class
extends
mock< ISessionChangesService>
(
)
{
}
(
)
,
new
class
extends
mock< IAgentWorkbenchLayoutService>
(
)
{
}
(
)
,
,
)
)
;
const
=
.
getChangeStatsForRequest
(
,
'request'
,
{
:
true
}
)
;
let
=
0
;
.
add
(
autorun
(
=>
{
?.
read
(
)
;
++
;
}
)
)
;
const
=
?.
get
(
)
;
.
set
(
[
{
:
URI
.
file
(
'/workspace/first.ts'
)
,
:
URI
.
file
(
'/workspace/first.ts'
)
,
:
4
,
:
2
,
}
]
,
undefined
)
;
const
=
;
.
set
(
[
...
.
get
(
)
,
{
:
URI
.
file
(
'/workspace/second.ts'
)
,
:
URI
.
file
(
'/workspace/second.ts'
)
,
:
3
,
:
1
,
}
,
]
,
undefined
)
;
.
deepStrictEqual
(
{
,
,
:
,
:
?.
get
(
)
}
,
{
:
{
:
1
,
:
4
,
:
2
}
,
:
1
,
:
2
,
:
{
:
2
,
:
7
,
:
3
}
,
}
)
;
}
)
;
test
(
'falls back to request stats when another chat becomes most recent'
,
(
)
=>
{
const
=
URI
.
parse
(
'chat:session'
)
;
const
=
observableValue
(
'chatUpdatedAt'
,
new
Date
(
'2026-08-13T10:00:00Z'
)
)
;
const
=
observableValue
(
'newerChatUpdatedAt'
,
new
Date
(
'2026-08-13T09:00:00Z'
)
)
;
const
=
upcastPartial < IChat>
(
{
:
,
:
,
}
)
;
const
=
upcastPartial < IChat>
(
{
:
URI
.
parse
(
'chat:newer'
)
,
:
,
}
)
;
const
=
upcastPartial < IActiveSession>
(
{
:
URI
.
parse
(
'agent-host:session'
)
,
:
constObservable
(
[
,
]
)
,
:
constObservable
(
)
,
}
)
;
const
=
upcastPartial < ISessionChangeset>
(
{
:
TURN_CHANGES_CHANGESET_ID
,
:
constObservable
(
true
)
,
:
constObservable
(
false
)
,
:
constObservable
(
[
{
:
URI
.
file
(
'/workspace/current.ts'
)
,
:
URI
.
file
(
'/workspace/current.ts'
)
,
:
4
,
:
2
,
}
]
)
,
}
)
;
const
=
.
add
(
new
SessionsChatResponseFileChangesService
(
new
class
extends
mock< IEditorService>
(
)
{
}
(
)
,
new
class
extends
mock< ISessionsManagementService>
(
)
{
getSessionForChatResource
(
)
{
return
{
,
}
;
}
}
(
)
,
new
class
extends
mock< ISessionsService>
(
)
{
}
(
)
,
new
class
extends
mock< ISessionChangesService>
(
)
{
}
(
)
,
new
class
extends
mock< IAgentWorkbenchLayoutService>
(
)
{
}
(
)
,
new
class
extends
mock< IChangesViewService>
(
)
{
readonly
=
constObservable < URI | undefined >
(
.
)
;
readonly
=
constObservable < readonly ISessionChangeset[ ] | undefined >
(
[
]
)
;
}
(
)
,
)
)
;
.
add
(
.
registerProvider
(
'chat'
,
{
getChangesForRequest
:
(
)
=>
constObservable
(
[
{
:
URI
.
file
(
'/workspace/request.ts.before'
)
,
:
URI
.
file
(
'/workspace/request.ts'
)
,
:
2
,
:
1
,
:
false
,
:
false
,
:
true
,
:
false
,
}
]
)
,
}
)
)
;
const
=
.
getChangeStatsForRequest
(
,
'request'
,
{
:
true
}
)
;
const
=
[
?.
get
(
)
]
;
.
set
(
new
Date
(
'2026-08-13T11:00:00Z'
)
,
undefined
)
;
.
push
(
?.
get
(
)
)
;
.
set
(
new
Date
(
'2026-08-13T12:00:00Z'
)
,
undefined
)
;
.
push
(
?.
get
(
)
)
;
.
deepStrictEqual
(
,
[
{
:
1
,
:
4
,
:
2
}
,
{
:
1
,
:
2
,
:
1
}
,
{
:
1
,
:
4
,
:
2
}
,
]
)
;
}
)
;
test
(
'preserves current-turn stats while the changeset reloads'
,
(
)
=>
{
const
=
URI
.
parse
(
'chat:session'
)
;
const
=
upcastPartial < IChat>
(
{
:
,
:
constObservable
(
new
Date
(
'2026-08-13T10:00:00Z'
)
)
,
}
)
;
const
=
upcastPartial < IActiveSession>
(
{
:
URI
.
parse
(
'agent-host:session'
)
,
:
constObservable
(
[
]
)
,
:
constObservable
(
)
,
}
)
;
const
=
observableValue
(
'turnChangesLoading'
,
false
)
;
const
=
observableValue < readonly ISessionFileChange[ ] >
(
'turnChanges'
,
[
{
:
URI
.
file
(
'/workspace/current.ts'
)
,
:
URI
.
file
(
'/workspace/current.ts'
)
,
:
4
,
:
2
,
}
]
)
;
const
=
upcastPartial < ISessionChangeset>
(
{
:
TURN_CHANGES_CHANGESET_ID
,
:
constObservable
(
true
)
,
:
,
,
}
)
;
const
=
.
add
(
new
SessionsChatResponseFileChangesService
(
new
class
extends
mock< IEditorService>
(
)
{
}
(
)
,
new
class
extends
mock< ISessionsManagementService>
(
)
{
getSessionForChatResource
(
)
{
return
{
,
}
;
}
}
(
)
,
new
class
extends
mock< ISessionsService>
(
)
{
}
(
)
,
new
class
extends
mock< ISessionChangesService>
(
)
{
}
(
)
,
new
class
extends
mock< IAgentWorkbenchLayoutService>
(
)
{
}
(
)
,
new
class
extends
mock< IChangesViewService>
(
)
{
readonly
=
constObservable < URI | undefined >
(
.
)
;
readonly
=
constObservable < readonly ISessionChangeset[ ] | undefined >
(
[
]
)
;
}
(
)
,
)
)
;
const
=
.
getChangeStatsForRequest
(
,
'request'
,
{
:
true
}
)
;
const
=
[
?.
get
(
)
]
;
transaction
(
=>
{
.
set
(
true
,
)
;
.
set
(
[
]
,
)
;
}
)
;
.
push
(
?.
get
(
)
)
;
.
set
(
false
,
undefined
)
;
.
push
(
?.
get
(
)
)
;
.
deepStrictEqual
(
,
[
{
:
1
,
:
4
,
:
2
}
,
{
:
1
,
:
4
,
:
2
}
,
{
:
0
,
:
0
,
:
0
}
,
]
)
;
}
)
;
}
)
;