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 / node / copilotNonPtyShellTerminals.test.ts 268 строк · изменён 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
import { deepStrictEqual, ok, strictEqual } from 'assert' ;
import { URI } from '../../../../base/common/uri.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js' ;
import { NonPtyShellTerminalStreams } from '../../node/copilot/copilotNonPtyShellTerminals.js' ;
import { buildDefaultChatUri } from '../../common/state/sessionState.js' ;
import { TestAgentHostTerminalManager } from './testAgentHostTerminalManager.js' ;
suite ( 'NonPtyShellTerminalStreams' , ( )
store
sessionUri
manager TestAgentHostTerminalManager
streams NonPtyShellTerminalStreams
manager store
streams store sessionUri sessionUri manager
manager outputTerminalData d d data
streams
streams
streams
streams
manager outputTerminalResets
streams
streams
streams
completion streams
shellId
result exitCode preview truncated
completion
manager outputTerminalResets
manager outputTerminalsFinalized uri completion uri exitCode
streams
streams
streams
streams
streams
streams
streams
resets manager outputTerminalResets
content
resets
content
streams
streams
streams
streams
resets manager outputTerminalResets
content
resets
content
streams
streams
streams
streams
resets manager outputTerminalResets
content
resets
content
streams
streams
streams
streams
shellId
result exitCode preview truncated
streams
streams
shellId
result exitCode preview truncated
streams
appended streams
appended
streams
shellId
result exitCode preview truncated
resets manager outputTerminalResets
data manager outputTerminalData
resets appended uri
data
uri appended uri data
uri appended uri data
streams
appended streams
appended
streams
shellId
result exitCode preview truncated
resets manager outputTerminalResets
data manager outputTerminalData
resets appended uri
data uri appended uri data
streams
appended streams
appended
streams
shellId
result exitCode preview truncated
resets manager outputTerminalResets
data manager outputTerminalData
resets
data
uri appended uri data
uri appended uri data
streams
streams
streams
manager outputTerminalResets length
manager outputTerminalData d d data
streams
completion streams
streams
streams
completion
content
finalized manager outputTerminalsFinalized
completion
uri
result exitCode preview
shouldRetire
content
finalized uri exitCode
streams
streams
streams
streams
appended streams
appended
streams
uri appended uri
shouldRetire
streams
appended streams
appended
streams
streams
manager disposedTerminals appended uri
streams
streams
streams
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
=
URI
.
parse
(
'agenthost-session://test/session-1'
)
;
let
:
;
let
:
;
setup
(
(
)
=>
{
=
.
add
(
new
TestAgentHostTerminalManager
(
)
)
;
=
.
add
(
new
NonPtyShellTerminalStreams
(
,
URI
.
parse
(
buildDefaultChatUri
(
)
)
,
)
)
;
}
)
;
function
channelContent
(
)
:
string
{
return
.
.
map
(
=>
.
)
.
join
(
''
)
;
}
suite
(
'rolling-tail snapshot stitching'
,
(
)
=>
{
test
(
'appends only the unseen suffix when the snapshot is a rolling tail, without resetting'
,
(
)
=>
{
.
track
(
'call-1'
,
'shell'
)
;
.
append
(
'call-1'
,
'line 1\r\nline 2\r\nline 3\r\n'
)
;
.
append
(
'call-1'
,
'line 2\r\nline 3\r\nline 4\r\n'
)
;
.
append
(
'call-1'
,
'line 4\r\nline 5\r\nline 6\r\n'
)
;
deepStrictEqual
(
.
,
[
]
,
'rolling tails must not reset the channel'
)
;
strictEqual
(
channelContent
(
)
,
'line 1\r\nline 2\r\nline 3\r\nline 4\r\nline 5\r\nline 6\r\n'
)
;
}
)
;
test
(
'truncated completion preview does not discard the streamed transcript'
,
(
)
=>
{
.
track
(
'call-2'
,
'shell'
)
;
.
append
(
'call-2'
,
'line 1\r\nline 2\r\nline 3\r\n'
)
;
.
append
(
'call-2'
,
'line 3\r\nline 4\r\nline 5\r\n'
)
;
const
=
.
completeToolCall
(
'call-2'
,
undefined
,
{
:
'shell-1'
,
:
{
:
0
,
:
'line 4\r\nline 5\r\n'
,
:
true
}
}
)
;
ok
(
)
;
deepStrictEqual
(
.
,
[
]
)
;
strictEqual
(
channelContent
(
)
,
'line 1\r\nline 2\r\nline 3\r\nline 4\r\nline 5\r\n'
)
;
deepStrictEqual
(
.
,
[
{
:
.
,
:
0
}
]
)
;
}
)
;
test
(
'preserves the transcript across truncation marker rewrites and disjoint rolling tails'
,
(
)
=>
{
.
track
(
'call-3'
,
'shell'
)
;
.
append
(
'call-3'
,
'line 1\r\nline 498\r\nline 499\r\n'
)
;
.
append
(
'call-3'
,
'line 1\r\nline 498\r\nline 499\r\n<output too long - dropped 42 lines from the end>\n'
)
;
.
append
(
'call-3'
,
'line 1\r\nline 498\r\nline 499\r\n<output too long - dropped 99 lines from the end>\n'
)
;
.
append
(
'call-3'
,
'line 498\r\nline 499\r\nline 500\r\n'
)
;
.
append
(
'call-3'
,
'line 499\r\nline 500\r\nline 501\r\n'
)
;
.
append
(
'call-3'
,
'line 700\r\nline 701\r\nline 702\r\n'
)
;
deepStrictEqual
(
{
:
.
,
:
channelContent
(
)
,
}
,
{
:
[
]
,
:
[
'line 1\r\nline 498\r\nline 499\r\n<output too long - dropped 42 lines from the end>\n'
,
'line 500\r\n'
,
'line 501\r\n'
,
'line 700\r\nline 701\r\nline 702\r\n'
,
]
.
join
(
''
)
,
}
)
;
}
)
;
test
(
'recognizes the single-line character truncation marker'
,
(
)
=>
{
.
track
(
'call-4'
,
'shell'
)
;
.
append
(
'call-4'
,
'abcdefghij'
)
;
.
append
(
'call-4'
,
'abcdefghij<output too long - dropped 5 characters from the end>'
)
;
.
append
(
'call-4'
,
'abcdefghij<output too long - dropped 8 characters from the end>'
)
;
deepStrictEqual
(
{
:
.
,
:
channelContent
(
)
,
}
,
{
:
[
]
,
:
'abcdefghij<output too long - dropped 5 characters from the end>'
,
}
)
;
}
)
;
test
(
'preserves a direct transition to disjoint shorter tails'
,
(
)
=>
{
.
track
(
'call-5'
,
'shell'
)
;
.
append
(
'call-5'
,
'alpha beta gamma\r\n'
)
;
.
append
(
'call-5'
,
'tail one\r\n'
)
;
.
append
(
'call-5'
,
'tail two\r\n'
)
;
deepStrictEqual
(
{
:
.
,
:
channelContent
(
)
,
}
,
{
:
[
]
,
:
'alpha beta gamma\r\ntail one\r\ntail two\r\n'
,
}
)
;
}
)
;
test
(
'does not append a truncated completion preview after streamed output'
,
(
)
=>
{
.
track
(
'call-6'
,
'shell'
)
;
.
append
(
'call-6'
,
'line 1\r\nline 2\r\n<output too long - dropped 42 lines from the end>\n'
)
;
.
append
(
'call-6'
,
'line 498\r\nline 499\r\nline 500\r\n'
)
;
.
completeToolCall
(
'call-6'
,
undefined
,
{
:
'shell-1'
,
:
{
:
0
,
:
'line 1\r\nline 2\r\n'
,
:
true
}
}
)
;
strictEqual
(
channelContent
(
)
,
[
'line 1\r\nline 2\r\n<output too long - dropped 42 lines from the end>\n'
,
'line 498\r\nline 499\r\nline 500\r\n'
,
]
.
join
(
''
)
)
;
}
)
;
test
(
'seeds a zero-partial terminal from its truncated completion preview'
,
(
)
=>
{
.
track
(
'call-7'
,
'shell'
)
;
.
completeToolCall
(
'call-7'
,
undefined
,
{
:
'shell-1'
,
:
{
:
0
,
:
'line 1\r\nline 2\r\n'
,
:
true
}
}
)
;
strictEqual
(
channelContent
(
)
,
'line 1\r\nline 2\r\n'
)
;
}
)
;
test
(
'replaces a truncated stream with an authoritative non-truncated completion preview'
,
(
)
=>
{
.
track
(
'call-8'
,
'shell'
)
;
const
=
.
append
(
'call-8'
,
'head\r\n<output too long - dropped 42 lines from the end>\n'
)
;
ok
(
)
;
.
completeToolCall
(
'call-8'
,
undefined
,
{
:
'shell-1'
,
:
{
:
0
,
:
'complete output\r\n'
,
:
false
}
}
)
;
deepStrictEqual
(
{
:
.
,
:
.
,
}
,
{
:
[
.
]
,
:
[
{
:
.
,
:
'head\r\n<output too long - dropped 42 lines from the end>\n'
}
,
{
:
.
,
:
'complete output\r\n'
}
,
]
,
}
)
;
}
)
;
test
(
'clears stale streamed output when the authoritative completion preview is empty'
,
(
)
=>
{
.
track
(
'call-9'
,
'shell'
)
;
const
=
.
append
(
'call-9'
,
'stale output\r\n'
)
;
ok
(
)
;
.
completeToolCall
(
'call-9'
,
undefined
,
{
:
'shell-1'
,
:
{
:
0
,
:
''
,
:
false
}
}
)
;
deepStrictEqual
(
{
:
.
,
:
.
,
}
,
{
:
[
.
]
,
:
[
{
:
.
,
:
'stale output\r\n'
}
]
,
}
)
;
}
)
;
test
(
'appends a prefix-stable authoritative completion preview'
,
(
)
=>
{
.
track
(
'call-10'
,
'shell'
)
;
const
=
.
append
(
'call-10'
,
'line 1\r\n'
)
;
ok
(
)
;
.
completeToolCall
(
'call-10'
,
undefined
,
{
:
'shell-1'
,
:
{
:
0
,
:
'line 1\r\nline 2\r\n'
,
:
false
}
}
)
;
deepStrictEqual
(
{
:
.
,
:
.
,
}
,
{
:
[
]
,
:
[
{
:
.
,
:
'line 1\r\n'
}
,
{
:
.
,
:
'line 2\r\n'
}
,
]
,
}
)
;
}
)
;
test
(
'an unrelated rewrite still resets the channel'
,
(
)
=>
{
.
track
(
'call-11'
,
'shell'
)
;
.
append
(
'call-11'
,
'alpha beta gamma\r\n'
)
;
.
append
(
'call-11'
,
'completely different content\r\n'
)
;
strictEqual
(
.
.
,
1
)
;
deepStrictEqual
(
.
.
map
(
=>
.
)
,
[
'alpha beta gamma\r\n'
,
'completely different content\r\n'
]
)
;
}
)
;
}
)
;
suite
(
'completion and lifecycle'
,
(
)
=>
{
test
(
'parses fallback completion, finalizes once, and ignores later output'
,
(
)
=>
{
.
track
(
'call-12'
,
'shell'
)
;
const
=
.
completeToolCall
(
'call-12'
,
'fallback output\r\n<shellId: shell-1 completed with exit code -1>'
,
undefined
)
;
.
completeToolCall
(
'call-12'
,
'different output\r\n<shellId: shell-1 completed with exit code -1>'
,
undefined
)
;
.
append
(
'call-12'
,
'late output\r\n'
)
;
deepStrictEqual
(
{
,
:
channelContent
(
)
,
:
.
,
}
,
{
:
{
:
'agenthost-terminal://shell/session-1/call-12'
,
:
{
:
-
1
,
:
'fallback output\r\n'
}
,
:
true
,
}
,
:
'fallback output\r\n'
,
:
[
{
:
'agenthost-terminal://shell/session-1/call-12'
,
:
-
1
}
]
,
}
)
;
}
)
;
test
(
'drops an unstarted stream without completion data'
,
(
)
=>
{
.
track
(
'call-13'
,
'shell'
)
;
strictEqual
(
.
completeToolCall
(
'call-13'
,
undefined
,
undefined
)
,
undefined
)
;
strictEqual
(
.
append
(
'call-13'
,
'late output'
)
,
undefined
)
;
}
)
;
test
(
'keeps a started stream alive without completion data'
,
(
)
=>
{
.
track
(
'call-14'
,
'shell'
)
;
const
=
.
append
(
'call-14'
,
'partial output'
)
;
ok
(
)
;
deepStrictEqual
(
.
completeToolCall
(
'call-14'
,
undefined
,
undefined
)
,
{
:
.
,
:
false
,
}
)
;
}
)
;
test
(
'retires a stream exactly once'
,
(
)
=>
{
.
track
(
'call-15'
,
'shell'
)
;
const
=
.
append
(
'call-15'
,
'partial output'
)
;
ok
(
)
;
.
retire
(
'call-15'
)
;
.
retire
(
'call-15'
)
;
deepStrictEqual
(
.
,
[
.
]
)
;
strictEqual
(
.
append
(
'call-15'
,
'late output'
)
,
undefined
)
;
}
)
;
test
(
'ignores append and completion for an untracked tool call'
,
(
)
=>
{
strictEqual
(
.
append
(
'missing'
,
'output'
)
,
undefined
)
;
strictEqual
(
.
completeToolCall
(
'missing'
,
undefined
,
undefined
)
,
undefined
)
;
}
)
;
}
)
;
}
)
;