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 / providers / agentHost / test / browser / agentHostSessionChangesets.test.ts 226 строк · изменён 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
import assert from 'assert' ;
import { Codicon } from '../../../../../../base/common/codicons.js' ;
import { constObservable } from '../../../../../../base/common/observable.js' ;
import { isLinux } from '../../../../../../base/common/platform.js' ;
import { URI } from '../../../../../../base/common/uri.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../../base/test/common/utils.js' ;
import { ChangesetKind } from '../../../../../../platform/agentHost/common/changesetUri.js' ;
import { IDialogService }
TestInstantiationService
IChatSessionFileChange2
ISessionFileChange
createChangesets filterChangesToPrimaryWorkingDirectory IAgentHostChangeset
IAgentHostAdapterOptions
disposables
uri modifiedUri uri ISessionFileChange
uri uri
modifiedUri modifiedUri modifiedUri
originalUri
insertions
deletions
satisfies IChatSessionFileChange2
uri ISessionFileChange
uri uri
modifiedUri
originalUri uri
insertions
deletions
satisfies IChatSessionFileChange2
changes ISessionFileChange
changes change change IChatSessionFileChange2 uri
changes
result changes
assert result
changes
assert changes changes
changes
assert changes changes
changes
assert changes changes
changes
result changes
assert result
changes
assert changes IChatSessionFileChange2 modifiedUri
result changes
assert result
changes
result changes
assert result
isLinux
changes
result changes
assert result
sessionUri
Record
turn
changeKind IAgentHostChangeset
label changeKind
changeKind
uriTemplate changeKind
changeKinds defaultChangesetKind IAgentHostAdapterOptions
instantiationService disposables
instantiationService IDialogService confirmed
options IAgentHostAdapterOptions
icon Codicon copilot
loading
instantiationService
agentCapabilities
resource resource
defaultChangesetKind
sessionUri options changeKinds entry
changeset
gitBackedCatalogue
assert
gitBackedCatalogue ChangesetKind Session
assert
gitBackedCatalogue
assert
assert
ChangesetKind Uncommitted
assert
ChangesetKind Session
assert
ChangesetKind Session
from
'../../../../../../platform/dialogs/common/dialogs.js'
;
import
{
}
from
'../../../../../../platform/instantiation/test/common/instantiationServiceMock.js'
;
import
{
}
from
'../../../../../../workbench/contrib/chat/common/chatSessionsService.js'
;
import
{
}
from
'../../../../../services/sessions/common/session.js'
;
import
{
,
,
}
from
'../../browser/agentHostSessionChangesets.js'
;
import
{
}
from
'../../browser/baseAgentHostSessionsProvider.js'
;
suite
(
'AgentHostSessionChangesets'
,
(
)
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
function
makeChange
(
:
string
,
:
string
|
undefined
=
)
:
{
return
{
:
URI
.
parse
(
)
,
:
===
undefined
?
undefined
:
URI
.
parse
(
)
,
:
undefined
,
:
1
,
:
0
,
}
;
}
function
makeDeletion
(
:
string
)
:
{
return
{
:
URI
.
parse
(
)
,
:
undefined
,
:
URI
.
parse
(
)
,
:
0
,
:
1
,
}
;
}
function
uris
(
:
readonly
[
]
)
:
string
[
]
{
return
.
map
(
=>
(
as
)
.
.
toString
(
)
)
;
}
suite
(
'filterChangesToPrimaryWorkingDirectory'
,
(
)
=>
{
test
(
'(a) multi-root: keeps only changes under the primary working directory'
,
(
)
=>
{
const
=
[
makeChange
(
'file:///repo/primary/src/a.ts'
)
,
makeChange
(
'file:///repo/primary/deep/nested/b.ts'
)
,
makeChange
(
'file:///repo/other/c.ts'
)
,
]
;
const
=
filterChangesToPrimaryWorkingDirectory
(
,
[
'file:///repo/primary'
,
'file:///repo/other'
]
)
;
.
deepStrictEqual
(
uris
(
)
,
[
'file:///repo/primary/src/a.ts'
,
'file:///repo/primary/deep/nested/b.ts'
,
]
)
;
}
)
;
test
(
'(b) single-root: returns the input list unchanged (same reference)'
,
(
)
=>
{
const
=
[
makeChange
(
'file:///repo/primary/a.ts'
)
,
makeChange
(
'file:///repo/other/b.ts'
)
,
]
;
.
strictEqual
(
filterChangesToPrimaryWorkingDirectory
(
,
[
'file:///repo/primary'
]
)
,
)
;
}
)
;
test
(
'(b) undefined working directories: returns the input list unchanged'
,
(
)
=>
{
const
=
[
makeChange
(
'file:///repo/primary/a.ts'
)
]
;
.
strictEqual
(
filterChangesToPrimaryWorkingDirectory
(
,
undefined
)
,
)
;
}
)
;
test
(
'(b) empty working directories: returns the input list unchanged'
,
(
)
=>
{
const
=
[
makeChange
(
'file:///repo/primary/a.ts'
)
]
;
.
strictEqual
(
filterChangesToPrimaryWorkingDirectory
(
,
[
]
)
,
)
;
}
)
;
test
(
'(c) boundary: a change exactly at the primary directory is kept; a sibling with a shared prefix is excluded'
,
(
)
=>
{
const
=
[
makeChange
(
'file:///repo/primary'
)
,
makeChange
(
'file:///repo/primary/x.ts'
)
,
makeChange
(
'file:///repo/primary-sibling/y.ts'
)
,
]
;
const
=
filterChangesToPrimaryWorkingDirectory
(
,
[
'file:///repo/primary'
,
'file:///repo/second'
]
)
;
.
deepStrictEqual
(
uris
(
)
,
[
'file:///repo/primary'
,
'file:///repo/primary/x.ts'
,
]
)
;
}
)
;
test
(
'deletions (no modifiedUri) are classified by their file uri'
,
(
)
=>
{
const
=
[
makeDeletion
(
'file:///repo/primary/gone.ts'
)
,
makeDeletion
(
'file:///repo/other/gone.ts'
)
,
]
;
.
strictEqual
(
(
[
0
]
as
)
.
,
undefined
)
;
const
=
filterChangesToPrimaryWorkingDirectory
(
,
[
'file:///repo/primary'
,
'file:///repo/other'
]
)
;
.
deepStrictEqual
(
uris
(
)
,
[
'file:///repo/primary/gone.ts'
]
)
;
}
)
;
test
(
'compares mapped (agent-host) changes by their preserved file path'
,
(
)
=>
{
const
=
[
makeChange
(
'agent-host://server/repo/primary/a.ts'
)
,
makeChange
(
'agent-host://server/repo/other/b.ts'
)
,
]
;
const
=
filterChangesToPrimaryWorkingDirectory
(
,
[
'file:///repo/primary'
,
'file:///repo/other'
]
)
;
.
deepStrictEqual
(
uris
(
)
,
[
'agent-host://server/repo/primary/a.ts'
]
)
;
}
)
;
test
(
'case-differing sibling roots are not conflated (file-path case semantics)'
,
(
)
=>
{
if
(
)
{
const
=
[
makeChange
(
'agent-host://server/repo/app/x.ts'
)
]
;
const
=
filterChangesToPrimaryWorkingDirectory
(
,
[
'file:///repo/App'
,
'file:///repo/other'
]
)
;
.
deepStrictEqual
(
uris
(
)
,
[
]
)
;
}
}
)
;
}
)
;
suite
(
'createChangesets default selection'
,
(
)
=>
{
const
=
URI
.
parse
(
'ahp-session:/session-1'
)
;
const
TEMPLATED_KINDS
:
<
string
,
string
>
=
{
:
'changeset/turn/{turnId}'
,
'compare-turns'
:
'changeset/compare-turns/{originalTurnId}/{modifiedTurnId}'
,
}
;
function
entry
(
:
string
)
:
{
return
{
:
,
,
:
TEMPLATED_KINDS
[
]
??
` changeset/ ${ changeKind} `
,
}
;
}
function
selectDefault
(
:
readonly
string
[
]
,
?
:
[
'defaultChangesetKind'
]
)
:
string
[
]
{
const
=
.
add
(
new
TestInstantiationService
(
)
)
;
.
stub
(
,
{
confirm
:
async
(
)
=>
(
{
:
true
}
)
}
)
;
const
:
=
{
:
.
,
:
constObservable
(
false
)
,
buildWorkspace
:
(
)
=>
undefined
,
,
getConnection
:
(
)
=>
undefined
,
:
constObservable
(
undefined
)
,
mapBackendSessionResource
:
=>
,
,
}
;
return
createChangesets
(
,
,
constObservable
(
false
)
,
.
map
(
)
)
.
map
(
=>
` ${ changeset. id} ${ changeset. isDefault. get ( ) ? '*' : '' } `
)
;
}
const
=
[
'session'
,
'branch'
,
'uncommitted'
,
'all'
,
'turn'
,
'compare-turns'
]
;
test
(
'a host that asks for `session` gets it, over the `branch` it also advertises'
,
(
)
=>
{
.
deepStrictEqual
(
selectDefault
(
,
.
)
,
[
'session*'
,
'branch'
,
'uncommitted'
,
'turn'
]
)
;
}
)
;
test
(
'the same catalogue without a declared preference keeps the `branch` default'
,
(
)
=>
{
.
deepStrictEqual
(
selectDefault
(
)
,
[
'session'
,
'branch*'
,
'uncommitted'
,
'turn'
]
)
;
}
)
;
test
(
'a git catalogue from a host with no preference defaults to `branch`'
,
(
)
=>
{
.
deepStrictEqual
(
selectDefault
(
[
'branch'
,
'uncommitted'
,
'session'
,
'turn'
,
'compare-turns'
]
)
,
[
'branch*'
,
'uncommitted'
,
'session'
,
'turn'
]
)
;
}
)
;
test
(
'a declared preference the catalogue does not advertise falls back to the first entry'
,
(
)
=>
{
.
deepStrictEqual
(
selectDefault
(
[
'session'
,
'branch'
,
'turn'
]
,
.
)
,
[
'session*'
,
'branch'
,
'turn'
]
)
;
}
)
;
test
(
'a non-git catalogue defaults to `session` with or without a preference'
,
(
)
=>
{
.
deepStrictEqual
(
[
selectDefault
(
[
'session'
,
'turn'
]
)
,
selectDefault
(
[
'session'
,
'turn'
]
,
.
)
]
,
[
[
'session*'
,
'turn'
]
,
[
'session*'
,
'turn'
]
]
)
;
}
)
;
test
(
'a session still being created defaults to its only entry'
,
(
)
=>
{
.
deepStrictEqual
(
selectDefault
(
[
'uncommitted'
]
,
.
)
,
[
'uncommitted*'
]
)
;
}
)
;
}
)
;
}
)
;