ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / platform / agentHost / test / common / remoteAgentHostLocationPreferenceDialog.test.ts 243 строк · изменён 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
import assert from 'assert' ;
import { CancellationTokenSource } from '../../../../base/common/cancellation.js' ;
import { Codicon } from '../../../../base/common/codicons.js' ;
import { Event } from '../../../../base/common/event.js' ;
import { createMarkdownCommandLink, IMarkdownString } from '../../../../base/common/htmlContent.js' ;
import Severity from '../../../../base/common/severity.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js' ;
import { IConfirmation, IConfirmationResult, IDialogService, IInputResult IPrompt IPromptResult IPromptResultWithCancel IPromptWithCustomCancel IPromptWithDefaultCancel
ChangeRemoteAgentHostLocationPreferenceCommandId
orderRemoteAgentHostLocationOptions
promptRemoteAgentHostLocationPreference
_serviceBrand
onWillShowDialog Event None
onDidShowDialog Event None
lastPrompt IPrompt
buttonIndexToInvoke
confirmation IConfirmation IConfirmationResult
prompt IPromptWithCustomCancel IPromptResultWithCancel
prompt IPromptWithDefaultCancel IPromptResult
prompt IPrompt IPromptResult
prompt IPrompt IPromptWithCustomCancel IPromptResult IPromptResultWithCancel
lastPrompt prompt
buttonIndexToInvoke
result
button prompt buttons buttonIndexToInvoke
result button checkboxChecked
IInputResult confirmed values
productName
dialogService
dialogService productName
assert dialogService lastPrompt message
assert ChangeRemoteAgentHostLocationPreferenceCommandId
dialogService
dialogService productName
detail dialogService lastPrompt detail IMarkdownString
changeCommandLabel
expectedLink
text changeCommandLabel
id ChangeRemoteAgentHostLocationPreferenceCommandId
tooltip changeCommandLabel
assert detail
assert detail value
assert detail isTrusted enabledCommands ChangeRemoteAgentHostLocationPreferenceCommandId
dialogService
dialogService productName
prompt dialogService lastPrompt
assert prompt type Severity Info
assert prompt cancelButton
assert prompt buttons length
assert prompt buttons b b label
assert prompt custom buttonDetails custom buttonDetails
assert prompt custom icon custom icon Codicon remote
assert prompt custom alignment custom alignment
dialogService
dialogService
assert
labels dialogService lastPrompt buttons button button label
details dialogService lastPrompt custom buttonDetails custom buttonDetails
labels
details
dedicated
assert dedicated productName
editor
assert editor productName
dialogService
assert dialogService productName
dialogService
cts
dialogService productName cts token
assert dialogService lastPrompt token cts token
cts
dialogService
dialogService productName
assert dialogService lastPrompt token
dialogService
dialogService productName
prompt dialogService lastPrompt
assert prompt buttons b b label
assert prompt custom buttonDetails custom buttonDetails
dialogService
dialogService productName
prompt dialogService lastPrompt
assert prompt custom buttonDetails custom buttonDetails
dialogService
dialogService productName
prompt dialogService lastPrompt
details prompt custom buttonDetails custom buttonDetails
assert details detail detail
productName
options productName
assert options o o preference
options productName
assert options o o preference
options productName
assert options o o preference
current
options productName current
assert options length
assert options o o preference
dedicatedFirst productName
assert dedicatedFirst preference
assert dedicatedFirst detail
assert dedicatedFirst detail
editorFirst productName
assert editorFirst preference
assert editorFirst detail
assert editorFirst detail
options productName
assert options option option detail
,
,
,
,
,
}
from
'../../../dialogs/common/dialogs.js'
;
import
{
,
,
,
}
from
'../../common/remoteAgentHostLocationPreferenceDialog.js'
;
class
CapturingDialogService
implements
IDialogService
{
declare
readonly
:
undefined
;
readonly
=
.
;
readonly
=
.
;
:
<
unknown
>
|
undefined
;
constructor
(
private
readonly
:
number
|
undefined
)
{
}
async
confirm
(
:
)
:
Promise
<
>
{
throw
new
Error
(
'not implemented'
)
;
}
prompt < T >
(
:
<
T
>
)
:
Promise
<
<
T
>>
;
prompt < T >
(
:
<
T
>
)
:
Promise
<
<
T
>>
;
prompt < T >
(
:
<
T
>
)
:
Promise
<
<
T
>>
;
async
prompt < T >
(
:
<
T
>
|
<
T
>
)
:
Promise
<
<
T
>
|
<
T
>>
{
this
.
=
;
if
(
this
.
===
undefined
)
{
return
{
:
undefined
}
;
}
const
=
.
?.
[
this
.
]
;
return
{
:
await
?.
run
(
{
:
false
}
)
}
;
}
async
info
(
)
:
Promise
<
void
>
{
}
async
warn
(
)
:
Promise
<
void
>
{
}
async
error
(
)
:
Promise
<
void
>
{
}
async
input
(
)
:
Promise
<
>
{
return
{
:
true
,
:
[
]
}
;
}
async
about
(
)
:
Promise
<
void
>
{
}
}
suite
(
'promptRemoteAgentHostLocationPreference'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
=
'Test Product'
;
test
(
'presents the localized message with the host label substituted'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
await
promptRemoteAgentHostLocationPreference
(
,
'my-remote-host'
,
)
;
.
strictEqual
(
.
?.
,
'How long should agents keep running on my-remote-host?'
)
;
}
)
;
test
(
'exports the exact command id registered by the sessions-layer "Chat: Change Preferred Remote Agent Location" command'
,
(
)
=>
{
.
strictEqual
(
,
'workbench.action.sessions.changeRemoteAgentHostLocationPreference'
)
;
}
)
;
test
(
'reminder detail is a Markdown string with the exact source command name shown in bold as a command link'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
await
promptRemoteAgentHostLocationPreference
(
,
'my-remote-host'
,
)
;
const
=
.
?.
as
;
const
=
'Chat: Change Preferred Remote Agent Location'
;
const
=
createMarkdownCommandLink
(
{
:
,
:
,
:
,
}
)
;
.
strictEqual
(
typeof
,
'object'
,
'detail should be an IMarkdownString, not a plain string'
)
;
.
strictEqual
(
.
,
` You can change this later with the ** ${ expectedLink} ** command. `
)
;
.
deepStrictEqual
(
.
,
{
:
[
]
}
)
;
}
)
;
test
(
'offers exactly two buttons with the exact localized labels and details, a cancel button, the remote icon, and a vertical layout'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
await
promptRemoteAgentHostLocationPreference
(
,
'my-remote-host'
,
)
;
const
=
.
!
;
.
strictEqual
(
.
,
.
)
;
.
strictEqual
(
.
,
true
)
;
.
strictEqual
(
.
?.
,
2
)
;
.
deepStrictEqual
(
.
!
.
map
(
=>
.
)
,
[
'Keep My Agents Running in a Dedicated Process'
,
'Stop My Agents if I Close Test Product'
,
]
)
;
.
deepStrictEqual
(
(
as
unknown
as
{
:
{
:
string
[
]
}
}
)
.
.
,
[
'Agents continue after you close Test Product and stop when their work finishes.'
,
'Agents are available only while the remote Test Product window is open.'
,
]
)
;
.
strictEqual
(
(
as
unknown
as
{
:
{
:
unknown
}
}
)
.
.
,
.
)
;
.
strictEqual
(
(
as
unknown
as
{
:
{
:
unknown
}
}
)
.
.
,
'vertical'
)
;
}
)
;
test
(
'substitutes the given product name into the option copy, not a literal'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
await
promptRemoteAgentHostLocationPreference
(
,
'my-remote-host'
,
'Other IDE'
)
;
.
deepStrictEqual
(
{
:
.
?.
?.
map
(
=>
.
)
,
:
(
.
as
unknown
as
{
:
{
:
string
[
]
}
}
)
.
.
,
}
,
{
:
[
'Keep My Agents Running in a Dedicated Process'
,
'Stop My Agents if I Close Other IDE'
,
]
,
:
[
'Agents continue after you close Other IDE and stop when their work finishes.'
,
'Agents are available only while the remote Other IDE window is open.'
,
]
,
}
)
;
}
)
;
test
(
'resolves to the chosen preference'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
.
strictEqual
(
await
promptRemoteAgentHostLocationPreference
(
,
'host'
,
)
,
'dedicated'
)
;
const
=
new
CapturingDialogService
(
1
)
;
.
strictEqual
(
await
promptRemoteAgentHostLocationPreference
(
,
'host'
,
)
,
'editor'
)
;
}
)
;
test
(
'resolves to undefined when the user cancels'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
undefined
)
;
.
strictEqual
(
await
promptRemoteAgentHostLocationPreference
(
,
'host'
,
)
,
undefined
)
;
}
)
;
test
(
'forwards the provided cancellation token to the dialog prompt'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
const
=
new
CancellationTokenSource
(
)
;
try
{
await
promptRemoteAgentHostLocationPreference
(
,
'host'
,
,
undefined
,
.
)
;
.
strictEqual
(
.
?.
,
.
)
;
}
finally
{
.
dispose
(
)
;
}
}
)
;
test
(
'omits the token when none is provided'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
await
promptRemoteAgentHostLocationPreference
(
,
'host'
,
)
;
.
strictEqual
(
.
?.
,
undefined
)
;
}
)
;
test
(
'marks the current preference\'s detail with "(Current)", reordered first, when the host currently prefers "editor"'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
await
promptRemoteAgentHostLocationPreference
(
,
'my-remote-host'
,
,
'editor'
)
;
const
=
.
!
;
.
deepStrictEqual
(
.
!
.
map
(
=>
.
)
,
[
'Stop My Agents if I Close Test Product'
,
'Keep My Agents Running in a Dedicated Process'
,
]
,
'the current preference is still reordered first'
)
;
.
deepStrictEqual
(
(
as
unknown
as
{
:
{
:
string
[
]
}
}
)
.
.
,
[
'Agents are available only while the remote Test Product window is open. (Current)'
,
'Agents continue after you close Test Product and stop when their work finishes.'
,
]
)
;
}
)
;
test
(
'marks the current preference\'s detail with "(Current)" when the host currently prefers "dedicated"'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
await
promptRemoteAgentHostLocationPreference
(
,
'my-remote-host'
,
,
'dedicated'
)
;
const
=
.
!
;
.
deepStrictEqual
(
(
as
unknown
as
{
:
{
:
string
[
]
}
}
)
.
.
,
[
'Agents continue after you close Test Product and stop when their work finishes. (Current)'
,
'Agents are available only while the remote Test Product window is open.'
,
]
)
;
}
)
;
test
(
'adds no "(Current)" marker to either option when there is no current preference'
,
async
(
)
=>
{
const
=
new
CapturingDialogService
(
0
)
;
await
promptRemoteAgentHostLocationPreference
(
,
'my-remote-host'
,
,
undefined
)
;
const
=
.
!
;
const
=
(
as
unknown
as
{
:
{
:
string
[
]
}
}
)
.
.
;
.
ok
(
.
every
(
=>
!
.
includes
(
'Current'
)
)
,
'no detail should mention "Current" when there is no saved preference'
)
;
}
)
;
}
)
;
suite
(
'orderRemoteAgentHostLocationOptions'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
=
'Test Product'
;
test
(
'keeps the default order when there is no current preference'
,
(
)
=>
{
const
=
orderRemoteAgentHostLocationOptions
(
,
undefined
)
;
.
deepStrictEqual
(
.
map
(
=>
.
)
,
[
'dedicated'
,
'editor'
]
)
;
}
)
;
test
(
'puts the current preference first when it is "editor"'
,
(
)
=>
{
const
=
orderRemoteAgentHostLocationOptions
(
,
'editor'
)
;
.
deepStrictEqual
(
.
map
(
=>
.
)
,
[
'editor'
,
'dedicated'
]
)
;
}
)
;
test
(
'keeps the default order when the current preference is already first'
,
(
)
=>
{
const
=
orderRemoteAgentHostLocationOptions
(
,
'dedicated'
)
;
.
deepStrictEqual
(
.
map
(
=>
.
)
,
[
'dedicated'
,
'editor'
]
)
;
}
)
;
test
(
'never drops or duplicates an option regardless of current preference'
,
(
)
=>
{
for
(
const
of
[
undefined
,
'dedicated'
,
'editor'
]
as
const
)
{
const
=
orderRemoteAgentHostLocationOptions
(
,
)
;
.
strictEqual
(
.
,
2
)
;
.
deepStrictEqual
(
new
Set
(
.
map
(
=>
.
)
)
,
new
Set
(
[
'dedicated'
,
'editor'
]
)
)
;
}
}
)
;
test
(
'marks the current option\'s detail with "(Current)" after reordering, for both "dedicated" and "editor"'
,
(
)
=>
{
const
=
orderRemoteAgentHostLocationOptions
(
,
'dedicated'
)
;
.
strictEqual
(
[
0
]
.
,
'dedicated'
)
;
.
ok
(
[
0
]
.
.
endsWith
(
'(Current)'
)
)
;
.
ok
(
!
[
1
]
.
.
includes
(
'Current'
)
)
;
const
=
orderRemoteAgentHostLocationOptions
(
,
'editor'
)
;
.
strictEqual
(
[
0
]
.
,
'editor'
)
;
.
ok
(
[
0
]
.
.
endsWith
(
'(Current)'
)
)
;
.
ok
(
!
[
1
]
.
.
includes
(
'Current'
)
)
;
}
)
;
test
(
'adds no "(Current)" marker to any option when there is no current preference'
,
(
)
=>
{
const
=
orderRemoteAgentHostLocationOptions
(
,
undefined
)
;
.
ok
(
.
every
(
=>
!
.
.
includes
(
'Current'
)
)
)
;
}
)
;
}
)
;