ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / src / extension / trajectory / vscode-node / test / debugLogEntryConverters.spec.ts 234 строк · изменён 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
import { describe, expect, it } from 'vitest' ;
import type { IDebugLogEntry } from '../../../../platform/chat/common/chatDebugFileLoggerService' ;
import { debugLogEntryToDebugEvent, entryDedupKey } from '../otelSpanToChatDebugEvent' ;
function makeEntry ( overrides: Partial< IDebugLogEntry> & { type: IDebugLogEntry[ 'type' ] } ) : IDebugLogEntry {
return {
ts: overrides. ts ?? 1000 ,
dur: overrides. dur
sid overrides sid
type overrides type
name overrides name
spanId overrides spanId
parentSpanId overrides parentSpanId
status overrides status
attrs overrides attrs
type
type
type
entry
type
name
attrs label
entry
type
attrs label
type
attrs label
type
entry type name attrs args result
entry
entry type name attrs model
entry
entry type attrs content
entry
entry type attrs response
entry
entry type parentSpanId attrs agentName
entry
entry type attrs resultKind
entry
entry type attrs category
entry
entry type attrs details
entry
a type spanId ts
b type spanId ts
a not b
a type spanId ts
b type spanId ts
a not b
a type spanId ts
b type spanId ts
a b
key type spanId ts
key
key
key
userMsg type spanId ts
llmReq type spanId ts
userMsg not llmReq
before type spanId ts
after type spanId ts
before not after
entry
type
name
attrs category source details
entry
entry
entry
type
name
attrs category source details
entry
entry
type
name
attrs category source
entry
entry
type
name
attrs category source
entry
entry
type
name
attrs details
entry
entry
entry
type
name
spanId
parentSpanId
attrs label childSessionId childLogFile
entry
entry
type
name
spanId
attrs label childSessionId
entry
entry
type
attrs label
entry
entry
entry
type
attrs label
entry
entry
??
500
,
:
.
??
'session-1'
,
:
.
,
:
.
??
'test'
,
:
.
??
'span-1'
,
:
.
,
:
.
??
'ok'
,
:
.
??
{
}
,
}
;
}
describe
(
'debugLogEntryToDebugEvent'
,
(
)
=>
{
it
(
'returns undefined for session_start entries'
,
(
)
=>
{
expect
(
debugLogEntryToDebugEvent
(
makeEntry
(
{
:
'session_start'
}
)
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'returns undefined for turn_start entries'
,
(
)
=>
{
expect
(
debugLogEntryToDebugEvent
(
makeEntry
(
{
:
'turn_start'
}
)
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'returns undefined for turn_end entries'
,
(
)
=>
{
expect
(
debugLogEntryToDebugEvent
(
makeEntry
(
{
:
'turn_end'
}
)
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'converts child_session_ref entries to generic events'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'child_session_ref'
,
:
'runSubagent-default'
,
:
{
:
'runSubagent-default'
}
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
it
(
'filters out categorization child_session_ref entries'
,
(
)
=>
{
expect
(
debugLogEntryToDebugEvent
(
makeEntry
(
{
:
'child_session_ref'
,
:
{
:
'categorization'
}
}
)
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'filters out title child_session_ref entries'
,
(
)
=>
{
expect
(
debugLogEntryToDebugEvent
(
makeEntry
(
{
:
'child_session_ref'
,
:
{
:
'title'
}
}
)
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'returns undefined for error entries'
,
(
)
=>
{
expect
(
debugLogEntryToDebugEvent
(
makeEntry
(
{
:
'error'
}
)
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'attempts to convert tool_call entry (enters conversion path)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'tool_call'
,
:
'run_in_terminal'
,
:
{
:
'{}'
,
:
'ok'
}
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
it
(
'attempts to convert llm_request entry (enters conversion path)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'llm_request'
,
:
'chat:gpt-4o'
,
:
{
:
'gpt-4o'
}
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
it
(
'attempts to convert user_message entry (enters conversion path)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'user_message'
,
:
{
:
'hello'
}
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
it
(
'attempts to convert agent_response entry (enters conversion path)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'agent_response'
,
:
{
:
'Done.'
}
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
it
(
'attempts to convert subagent entry (enters conversion path)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'subagent'
,
:
'p1'
,
:
{
:
'Explore'
}
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
it
(
'attempts to convert hook entry (enters conversion path)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'hook'
,
:
{
:
'success'
}
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
it
(
'skips discovery entries by default (core handles them)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'discovery'
,
:
{
:
'discovery'
}
}
)
;
expect
(
debugLogEntryToDebugEvent
(
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'attempts to convert generic entry (enters conversion path)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'generic'
,
:
{
:
'info'
}
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
}
)
;
describe
(
'entryDedupKey'
,
(
)
=>
{
it
(
'generates unique keys across different types with same spanId'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'user_message'
,
:
'0000000000000001'
,
:
1000
}
)
;
const
=
makeEntry
(
{
:
'llm_request'
,
:
'0000000000000001'
,
:
1000
}
)
;
expect
(
entryDedupKey
(
)
)
.
.
toBe
(
entryDedupKey
(
)
)
;
}
)
;
it
(
'generates unique keys for same type with different timestamps (restart)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'hook'
,
:
'0000000000000001'
,
:
1000
}
)
;
const
=
makeEntry
(
{
:
'hook'
,
:
'0000000000000001'
,
:
2000
}
)
;
expect
(
entryDedupKey
(
)
)
.
.
toBe
(
entryDedupKey
(
)
)
;
}
)
;
it
(
'generates same key for identical entries'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'tool_call'
,
:
'span-1'
,
:
5000
}
)
;
const
=
makeEntry
(
{
:
'tool_call'
,
:
'span-1'
,
:
5000
}
)
;
expect
(
entryDedupKey
(
)
)
.
toBe
(
entryDedupKey
(
)
)
;
}
)
;
it
(
'includes type, spanId, and timestamp in key'
,
(
)
=>
{
const
=
entryDedupKey
(
makeEntry
(
{
:
'hook'
,
:
'x'
,
:
100
}
)
)
;
expect
(
)
.
toContain
(
'hook'
)
;
expect
(
)
.
toContain
(
'x'
)
;
expect
(
)
.
toContain
(
'100'
)
;
}
)
;
it
(
'keys differ between user_message and llm_request sharing spanId'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'user_message'
,
:
'000000000000000d'
,
:
1000
}
)
;
const
=
makeEntry
(
{
:
'llm_request'
,
:
'000000000000000d'
,
:
1500
}
)
;
expect
(
entryDedupKey
(
)
)
.
.
toBe
(
entryDedupKey
(
)
)
;
}
)
;
it
(
'keys differ for same-type entries after restart (same spanId, different ts)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'hook'
,
:
'0000000000000009'
,
:
1000
}
)
;
const
=
makeEntry
(
{
:
'hook'
,
:
'0000000000000009'
,
:
9000
}
)
;
expect
(
entryDedupKey
(
)
)
.
.
toBe
(
entryDedupKey
(
)
)
;
}
)
;
}
)
;
describe
(
'debugLogEntryToDebugEvent skipCoreEvents'
,
(
)
=>
{
it
(
'skips discovery entries when skipCoreEvents is true (default)'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'discovery'
,
:
'Load Agents'
,
:
{
:
'discovery'
,
:
'core'
,
:
'Resolved 5 agents'
}
,
}
)
;
expect
(
debugLogEntryToDebugEvent
(
)
)
.
toBeUndefined
(
)
;
expect
(
debugLogEntryToDebugEvent
(
,
true
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'converts discovery entries when skipCoreEvents is false'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'discovery'
,
:
'Load Agents'
,
:
{
:
'discovery'
,
:
'core'
,
:
'Resolved 5 agents'
}
,
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
,
false
)
)
.
toThrow
(
)
;
}
)
;
it
(
'skips core-sourced generic entries when skipCoreEvents is true'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'generic'
,
:
'Resolve Customizations'
,
:
{
:
'customization'
,
:
'core'
}
,
}
)
;
expect
(
debugLogEntryToDebugEvent
(
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'converts core-sourced generic entries when skipCoreEvents is false'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'generic'
,
:
'Resolve Customizations'
,
:
{
:
'customization'
,
:
'core'
}
,
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
,
false
)
)
.
toThrow
(
)
;
}
)
;
it
(
'converts non-core generic entries regardless of skipCoreEvents'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'generic'
,
:
'Custom Event'
,
:
{
:
'something'
}
,
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
,
true
)
)
.
toThrow
(
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
,
false
)
)
.
toThrow
(
)
;
}
)
;
}
)
;
describe
(
'child_session_ref conversion'
,
(
)
=>
{
it
(
'sets parentEventId from parentSpanId on child_session_ref'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'child_session_ref'
,
:
'runSubagent-Explore'
,
:
'child-ref-abc'
,
:
'tool-span-42'
,
:
{
:
'runSubagent-Explore'
,
:
'abc'
,
:
'runSubagent-Explore-abc.jsonl'
}
,
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
it
(
'child_session_ref without parentSpanId has undefined parentEventId'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'child_session_ref'
,
:
'runSubagent-default'
,
:
'child-ref-def'
,
:
{
:
'runSubagent-default'
,
:
'def'
}
,
}
)
;
expect
(
(
)
=>
debugLogEntryToDebugEvent
(
)
)
.
toThrow
(
)
;
}
)
;
it
(
'filters categorization child_session_ref regardless of skipCoreEvents'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'child_session_ref'
,
:
{
:
'categorization'
}
,
}
)
;
expect
(
debugLogEntryToDebugEvent
(
,
true
)
)
.
toBeUndefined
(
)
;
expect
(
debugLogEntryToDebugEvent
(
,
false
)
)
.
toBeUndefined
(
)
;
}
)
;
it
(
'filters title child_session_ref regardless of skipCoreEvents'
,
(
)
=>
{
const
=
makeEntry
(
{
:
'child_session_ref'
,
:
{
:
'title'
}
,
}
)
;
expect
(
debugLogEntryToDebugEvent
(
,
true
)
)
.
toBeUndefined
(
)
;
expect
(
debugLogEntryToDebugEvent
(
,
false
)
)
.
toBeUndefined
(
)
;
}
)
;
}
)
;