ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / workbench / services / accounts / test / browser / managedSettings.test.ts 307 строк · изменён 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
import assert from 'assert' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js' ;
import { adaptManagedSettings, appendManagedSettingsClientIdentity, IManagedSettingsResponse, parseManagedSettingsCompatibilityError } from '../../browser/managedSettings.js' ;
suite ( 'adaptManagedSettings' , ( ) => {
ensureNoDisposablesAreLeakedInTestSuite ( ) ;
test ( 'empty response yields an empty managed settings bag' , ( ) => {
assert. deepStrictEqual ( adaptManagedSettings ( {
managedSettings
assert
withRuntime
version
copilotVersions runtime sdk
withoutRuntime version
preservesExistingQuery version
dropsStaleRuntimeVersion version
unparseableUrl version
withRuntime
withoutRuntime
preservesExistingQuery
dropsStaleRuntimeVersion
unparseableUrl
assert
permissions disableBypassPermissionsMode
managedSettings
assert
error_code
client_id
client_version
minimum_client_version
errorCode
clientVersion
minimumClientVersion
assert error_code
response IManagedSettingsResponse
enabledPlugins
assert response
managedSettings
enabledPlugins
assert
strictKnownMarketplaces source repo
managedSettings
strictKnownMarketplaces
assert strictKnownMarketplaces
managedSettings strictKnownMarketplaces
assert
allowedMcpServers
serverName
serverUrl
serverCommand
managedSettings
allowedMcpServers
assert allowedMcpServers
managedSettings allowedMcpServers
assert
deniedMcpServers
serverName
serverUrl
managedSettings
deniedMcpServers
assert
strictPluginOnlyCustomization
allowManagedMcpServersOnly
allowManagedHooksOnly
forceRemoteSettingsRefresh
managedSettings
strictPluginOnlyCustomization
allowManagedMcpServersOnly
allowManagedHooksOnly
forceRemoteSettingsRefresh
assert
telemetry
enabled
serviceName
resourceAttributes
headers
managedSettings
assert
extraKnownMarketplaces
source source repo
source source repo ref
managedSettings
extraKnownMarketplaces
assert
extraKnownMarketplaces
source source url
source source url ref
managedSettings
extraKnownMarketplaces
assert
extraKnownMarketplaces
source source repo
source source url
managedSettings
extraKnownMarketplaces
assert
enabledPlugins
extraKnownMarketplaces
source source repo ref
strictKnownMarketplaces source repo
managedSettings
strictKnownMarketplaces
enabledPlugins
extraKnownMarketplaces
assert
enabledPlugins
strictKnownMarketplaces
joshsFakeSetting
IManagedSettingsResponse
managedSettings
strictKnownMarketplaces
joshsFakeSetting
enabledPlugins
response IManagedSettingsResponse
assert response
managedSettings
response IManagedSettingsResponse
assert response
managedSettings
warnings
result
extraKnownMarketplaces
source source repo
IManagedSettingsResponse
source source url IManagedSettingsResponse
IManagedSettingsResponse msg warnings msg
assert result
managedSettings
extraKnownMarketplaces
assert warnings length
warnings
result
extraKnownMarketplaces
source source IManagedSettingsResponse
IManagedSettingsResponse msg warnings msg
assert
result warned warnings length mentionsRepo warnings w w
result managedSettings warned mentionsRepo
assert
extraKnownMarketplaces IManagedSettingsResponse
IManagedSettingsResponse
managedSettings
response IManagedSettingsResponse
assert response
managedSettings
assert Record polluted
}
)
,
{
:
{
}
,
}
)
;
}
)
;
test
(
'appends client identity to the request url'
,
(
)
=>
{
.
deepStrictEqual
(
{
:
appendManagedSettingsClientIdentity
(
'https://api.github.com/copilot_internal/managed_settings'
,
{
:
'1.132.0'
,
:
{
:
'0.0.344'
,
:
'0.1.0'
}
,
}
)
,
:
appendManagedSettingsClientIdentity
(
'https://api.github.com/copilot_internal/managed_settings'
,
{
:
'1.132.0'
}
)
,
:
appendManagedSettingsClientIdentity
(
'https://api.github.com/copilot_internal/managed_settings?foo=bar'
,
{
:
'1.132.0'
}
)
,
:
appendManagedSettingsClientIdentity
(
'https://api.github.com/copilot_internal/managed_settings?copilot_runtime_version=0.0.1'
,
{
:
'1.132.0'
}
)
,
:
appendManagedSettingsClientIdentity
(
'not a url'
,
{
:
'1.132.0'
}
)
,
}
,
{
:
'https://api.github.com/copilot_internal/managed_settings?client_id=vscode&client_version=1.132.0&copilot_runtime_version=0.0.344'
,
:
'https://api.github.com/copilot_internal/managed_settings?client_id=vscode&client_version=1.132.0'
,
:
'https://api.github.com/copilot_internal/managed_settings?foo=bar&client_id=vscode&client_version=1.132.0'
,
:
'https://api.github.com/copilot_internal/managed_settings?client_id=vscode&client_version=1.132.0'
,
:
'not a url'
,
}
)
;
}
)
;
test
(
'normalizes permissions into a dot-path managed setting'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
{
:
'disable'
}
,
}
)
,
{
:
{
'permissions.disableBypassPermissionsMode'
:
'disable'
,
}
,
}
)
;
}
)
;
test
(
'parses the stable compatibility error and optional versions'
,
(
)
=>
{
.
deepStrictEqual
(
parseManagedSettingsCompatibilityError
(
{
:
'client_update_required'
,
:
'vscode'
,
:
'1.132.0'
,
:
'1.133.0'
,
}
)
,
{
:
'client_update_required'
,
:
'1.132.0'
,
:
'1.133.0'
,
}
)
;
}
)
;
test
(
'rejects an unrecognized compatibility error shape'
,
(
)
=>
{
.
strictEqual
(
parseManagedSettingsCompatibilityError
(
{
:
'unexpected'
}
)
,
undefined
)
;
}
)
;
test
(
'carries enabledPlugins as a canonical JSON string under a single key'
,
(
)
=>
{
const
:
=
{
:
{
'assign-issue-to-copilot@agent-skills'
:
true
,
'my-plugin@acme'
:
false
,
}
,
}
;
.
deepStrictEqual
(
adaptManagedSettings
(
)
,
{
:
{
:
'{"assign-issue-to-copilot@agent-skills":true,"my-plugin@acme":false}'
,
}
,
}
)
;
}
)
;
test
(
'carries strictKnownMarketplaces as a canonical JSON string under a single key'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
[
{
:
'github'
,
:
'rwoll/markdown-review'
}
]
,
}
)
,
{
:
{
:
'[{"source":"github","repo":"rwoll/markdown-review"}]'
,
}
,
}
)
;
}
)
;
test
(
'carries an empty strictKnownMarketplaces array (lockdown) as a JSON string'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
[
]
}
)
,
{
:
{
:
'[]'
}
,
}
)
;
}
)
;
test
(
'carries allowedMcpServers as a canonical JSON string under a single key'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
[
{
:
'github'
}
,
{
:
'https://mcp.example.com/*'
}
,
{
:
[
'npx'
,
'-y'
,
'server'
]
}
,
]
,
}
)
,
{
:
{
:
'[{"serverName":"github"},{"serverUrl":"https://mcp.example.com/*"},{"serverCommand":["npx","-y","server"]}]'
,
}
,
}
)
;
}
)
;
test
(
'carries an empty allowedMcpServers array as a JSON string'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
[
]
}
)
,
{
:
{
:
'[]'
}
,
}
)
;
}
)
;
test
(
'carries deniedMcpServers as a canonical JSON string under a single key'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
[
{
:
'blocked'
}
,
{
:
'https://*.untrusted.example.com/*'
}
,
]
,
}
)
,
{
:
{
:
'[{"serverName":"blocked"},{"serverUrl":"https://*.untrusted.example.com/*"}]'
,
}
,
}
)
;
}
)
;
test
(
'carries customization lockdown controls'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
true
,
:
true
,
:
true
,
:
true
,
}
)
,
{
:
{
:
true
,
:
true
,
:
true
,
:
true
,
}
,
}
)
;
}
)
;
test
(
'flattens scalar telemetry leaves and carries resourceAttributes and headers as single JSON keys'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
{
:
true
,
:
'acme-copilot'
,
:
{
'deployment.environment'
:
'prod'
,
'service.namespace'
:
'acme'
}
,
:
{
'x-api-key'
:
'secret'
}
,
}
,
}
)
,
{
:
{
'telemetry.enabled'
:
true
,
'telemetry.serviceName'
:
'acme-copilot'
,
'telemetry.resourceAttributes'
:
'{"deployment.environment":"prod","service.namespace":"acme"}'
,
'telemetry.headers'
:
'{"x-api-key":"secret"}'
,
}
,
}
)
;
}
)
;
test
(
'encodes github marketplaces as a { name: shorthand } JSON dict'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
{
'a'
:
{
:
{
:
'github'
,
:
'github/agent-skills'
}
}
,
'b'
:
{
:
{
:
'github'
,
:
'acme/things'
,
:
'main'
}
}
,
}
,
}
)
,
{
:
{
:
'{"a":"github/agent-skills","b":"acme/things#main"}'
,
}
,
}
)
;
}
)
;
test
(
'encodes git marketplaces as a { name: url } JSON dict'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
{
'a'
:
{
:
{
:
'git'
,
:
'https://example.com/repo.git'
}
}
,
'b'
:
{
:
{
:
'git'
,
:
'ssh://git@host/path.git'
,
:
'v1'
}
}
,
}
,
}
)
,
{
:
{
:
'{"a":"https://example.com/repo.git","b":"ssh://git@host/path.git#v1"}'
,
}
,
}
)
;
}
)
;
test
(
'encodes mixed github + git marketplaces, dedups by name'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
{
'a'
:
{
:
{
:
'github'
,
:
'a/b'
}
}
,
'b'
:
{
:
{
:
'git'
,
:
'https://example.com/r.git'
}
}
,
}
,
}
)
,
{
:
{
:
'{"a":"a/b","b":"https://example.com/r.git"}'
,
}
,
}
)
;
}
)
;
test
(
'handles a full populated response (all three structured settings together)'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
{
'p@m'
:
true
}
,
:
{
'a'
:
{
:
{
:
'github'
,
:
'a/b'
,
:
'r'
}
}
,
}
,
:
[
{
:
'github'
,
:
'a/b'
}
]
,
}
)
,
{
:
{
:
'[{"source":"github","repo":"a/b"}]'
,
:
'{"p@m":true}'
,
:
'{"a":"a/b#r"}'
,
}
,
}
)
;
}
)
;
test
(
'resilience: unknown scalar keys flatten into the bag alongside structured keys'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
{
'p@m'
:
true
}
,
:
[
]
,
:
true
,
}
as
)
,
{
:
{
:
'[]'
,
:
true
,
:
'{"p@m":true}'
,
}
,
}
)
;
}
)
;
test
(
'resilience: a server-sent own `__proto__` key is carried like any scalar, never applied to the prototype'
,
(
)
=>
{
const
=
JSON
.
parse
(
'{"permissions":{"x":1},"__proto__":{"polluted":true}}'
)
as
;
.
deepStrictEqual
(
adaptManagedSettings
(
)
,
{
:
{
'permissions.x'
:
1
,
'__proto__.polluted'
:
true
,
}
,
}
)
;
}
)
;
test
(
'resilience: a primitive own `__proto__` scalar is dropped, never pollutes the result'
,
(
)
=>
{
const
=
JSON
.
parse
(
'{"permissions":{"x":1},"__proto__":true}'
)
as
;
.
deepStrictEqual
(
adaptManagedSettings
(
)
,
{
:
{
'permissions.x'
:
1
,
}
,
}
)
;
}
)
;
test
(
'resilience: malformed marketplace entries are skipped, valid entries still processed'
,
(
)
=>
{
const
:
string
[
]
=
[
]
;
const
=
adaptManagedSettings
(
{
:
{
'good'
:
{
:
{
:
'github'
,
:
'a/b'
}
}
,
'bad-no-source'
:
{
}
as
[
'extraKnownMarketplaces'
]
extends
Record< string , infer V >
?
V
:
never
,
'bad-unknown-type'
:
{
:
{
:
'ftp'
,
:
'ftp://x'
}
}
as
[
'extraKnownMarketplaces'
]
extends
Record< string , infer V >
?
V
:
never
,
}
,
}
as
,
=>
.
push
(
)
)
;
.
deepStrictEqual
(
,
{
:
{
:
'{"good":"a/b"}'
,
}
,
}
)
;
.
strictEqual
(
.
,
2
)
;
}
)
;
test
(
'resilience: extraKnownMarketplaces github entry missing "repo" is skipped with a warning'
,
(
)
=>
{
const
:
string
[
]
=
[
]
;
const
=
adaptManagedSettings
(
{
:
{
'example-key'
:
{
:
{
:
'github'
}
}
as
[
'extraKnownMarketplaces'
]
extends
Record< string , infer V >
?
V
:
never
,
}
,
}
as
,
=>
.
push
(
)
)
;
.
deepStrictEqual
(
{
,
:
.
,
:
.
some
(
=>
.
includes
(
'requires "repo"'
)
)
}
,
{
:
{
:
{
}
}
,
:
1
,
:
true
}
)
;
}
)
;
test
(
'resilience: a marketplace string array (wrong format) is treated as missing, no throw'
,
(
)
=>
{
.
deepStrictEqual
(
adaptManagedSettings
(
{
:
[
'https://plugins.acme.com'
]
as
unknown
as
[
'extraKnownMarketplaces'
]
,
}
as
)
,
{
:
{
}
,
}
)
;
}
)
;
test
(
'resilience: telemetry map keys that could pollute the prototype are dropped'
,
(
)
=>
{
const
=
JSON
.
parse
(
'{"telemetry":{"resourceAttributes":{"__proto__":"polluted","constructor":"x","service.namespace":"acme"}}}'
)
as
;
.
deepStrictEqual
(
adaptManagedSettings
(
)
,
{
:
{
'telemetry.resourceAttributes'
:
'{"service.namespace":"acme"}'
,
}
,
}
)
;
.
strictEqual
(
(
{
}
as
<
string
,
unknown
>
)
.
,
undefined
)
;
}
)
;
}
)
;