-
Notifications
You must be signed in to change notification settings - Fork 923
Expand file tree
/
Copy pathgenerated_session_events.go
More file actions
620 lines (555 loc) · 24 KB
/
generated_session_events.go
File metadata and controls
620 lines (555 loc) · 24 KB
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
// AUTO-GENERATED FILE - DO NOT EDIT
// Generated from: session-events.schema.json
// Code generated from JSON Schema using quicktype. DO NOT EDIT.
// To parse and unparse this JSON data, add this code to your project and do:
//
// sessionEvent, err := UnmarshalSessionEvent(bytes)
// bytes, err = sessionEvent.Marshal()
package copilot
import "bytes"
import "errors"
import "time"
import "encoding/json"
func UnmarshalSessionEvent(data []byte) (SessionEvent, error) {
var r SessionEvent
err := json.Unmarshal(data, &r)
return r, err
}
func (r *SessionEvent) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type SessionEvent struct {
Data Data `json:"data"`
Ephemeral *bool `json:"ephemeral,omitempty"`
ID string `json:"id"`
ParentID *string `json:"parentId"`
Timestamp time.Time `json:"timestamp"`
Type SessionEventType `json:"type"`
}
type Data struct {
Context *ContextUnion `json:"context"`
CopilotVersion *string `json:"copilotVersion,omitempty"`
Producer *string `json:"producer,omitempty"`
SelectedModel *string `json:"selectedModel,omitempty"`
SessionID *string `json:"sessionId,omitempty"`
StartTime *time.Time `json:"startTime,omitempty"`
Version *float64 `json:"version,omitempty"`
EventCount *float64 `json:"eventCount,omitempty"`
ResumeTime *time.Time `json:"resumeTime,omitempty"`
ErrorType *string `json:"errorType,omitempty"`
Message *string `json:"message,omitempty"`
ProviderCallID *string `json:"providerCallId,omitempty"`
Stack *string `json:"stack,omitempty"`
StatusCode *int64 `json:"statusCode,omitempty"`
Title *string `json:"title,omitempty"`
InfoType *string `json:"infoType,omitempty"`
WarningType *string `json:"warningType,omitempty"`
NewModel *string `json:"newModel,omitempty"`
PreviousModel *string `json:"previousModel,omitempty"`
NewMode *string `json:"newMode,omitempty"`
PreviousMode *string `json:"previousMode,omitempty"`
Operation *Operation `json:"operation,omitempty"`
// Relative path within the workspace files directory
Path *string `json:"path,omitempty"`
HandoffTime *time.Time `json:"handoffTime,omitempty"`
RemoteSessionID *string `json:"remoteSessionId,omitempty"`
Repository *RepositoryUnion `json:"repository"`
SourceType *SourceType `json:"sourceType,omitempty"`
Summary *string `json:"summary,omitempty"`
MessagesRemovedDuringTruncation *float64 `json:"messagesRemovedDuringTruncation,omitempty"`
PerformedBy *string `json:"performedBy,omitempty"`
PostTruncationMessagesLength *float64 `json:"postTruncationMessagesLength,omitempty"`
PostTruncationTokensInMessages *float64 `json:"postTruncationTokensInMessages,omitempty"`
PreTruncationMessagesLength *float64 `json:"preTruncationMessagesLength,omitempty"`
PreTruncationTokensInMessages *float64 `json:"preTruncationTokensInMessages,omitempty"`
TokenLimit *float64 `json:"tokenLimit,omitempty"`
TokensRemovedDuringTruncation *float64 `json:"tokensRemovedDuringTruncation,omitempty"`
EventsRemoved *float64 `json:"eventsRemoved,omitempty"`
UpToEventID *string `json:"upToEventId,omitempty"`
CodeChanges *CodeChanges `json:"codeChanges,omitempty"`
CurrentModel *string `json:"currentModel,omitempty"`
ErrorReason *string `json:"errorReason,omitempty"`
ModelMetrics map[string]ModelMetric `json:"modelMetrics,omitempty"`
SessionStartTime *float64 `json:"sessionStartTime,omitempty"`
ShutdownType *ShutdownType `json:"shutdownType,omitempty"`
TotalAPIDurationMS *float64 `json:"totalApiDurationMs,omitempty"`
TotalPremiumRequests *float64 `json:"totalPremiumRequests,omitempty"`
Branch *string `json:"branch,omitempty"`
Cwd *string `json:"cwd,omitempty"`
GitRoot *string `json:"gitRoot,omitempty"`
CurrentTokens *float64 `json:"currentTokens,omitempty"`
MessagesLength *float64 `json:"messagesLength,omitempty"`
CheckpointNumber *float64 `json:"checkpointNumber,omitempty"`
CheckpointPath *string `json:"checkpointPath,omitempty"`
CompactionTokensUsed *CompactionTokensUsed `json:"compactionTokensUsed,omitempty"`
Error *ErrorUnion `json:"error"`
MessagesRemoved *float64 `json:"messagesRemoved,omitempty"`
PostCompactionTokens *float64 `json:"postCompactionTokens,omitempty"`
PreCompactionMessagesLength *float64 `json:"preCompactionMessagesLength,omitempty"`
PreCompactionTokens *float64 `json:"preCompactionTokens,omitempty"`
RequestID *string `json:"requestId,omitempty"`
Success *bool `json:"success,omitempty"`
SummaryContent *string `json:"summaryContent,omitempty"`
TokensRemoved *float64 `json:"tokensRemoved,omitempty"`
AgentMode *AgentMode `json:"agentMode,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
Content *string `json:"content,omitempty"`
InteractionID *string `json:"interactionId,omitempty"`
Source *string `json:"source,omitempty"`
TransformedContent *string `json:"transformedContent,omitempty"`
TurnID *string `json:"turnId,omitempty"`
Intent *string `json:"intent,omitempty"`
ReasoningID *string `json:"reasoningId,omitempty"`
DeltaContent *string `json:"deltaContent,omitempty"`
TotalResponseSizeBytes *float64 `json:"totalResponseSizeBytes,omitempty"`
EncryptedContent *string `json:"encryptedContent,omitempty"`
MessageID *string `json:"messageId,omitempty"`
ParentToolCallID *string `json:"parentToolCallId,omitempty"`
Phase *string `json:"phase,omitempty"`
ReasoningOpaque *string `json:"reasoningOpaque,omitempty"`
ReasoningText *string `json:"reasoningText,omitempty"`
ToolRequests []ToolRequest `json:"toolRequests,omitempty"`
APICallID *string `json:"apiCallId,omitempty"`
CacheReadTokens *float64 `json:"cacheReadTokens,omitempty"`
CacheWriteTokens *float64 `json:"cacheWriteTokens,omitempty"`
CopilotUsage *CopilotUsage `json:"copilotUsage,omitempty"`
Cost *float64 `json:"cost,omitempty"`
Duration *float64 `json:"duration,omitempty"`
Initiator *string `json:"initiator,omitempty"`
InputTokens *float64 `json:"inputTokens,omitempty"`
Model *string `json:"model,omitempty"`
OutputTokens *float64 `json:"outputTokens,omitempty"`
QuotaSnapshots map[string]QuotaSnapshot `json:"quotaSnapshots,omitempty"`
Reason *string `json:"reason,omitempty"`
Arguments interface{} `json:"arguments"`
ToolCallID *string `json:"toolCallId,omitempty"`
ToolName *string `json:"toolName,omitempty"`
MCPServerName *string `json:"mcpServerName,omitempty"`
MCPToolName *string `json:"mcpToolName,omitempty"`
PartialOutput *string `json:"partialOutput,omitempty"`
ProgressMessage *string `json:"progressMessage,omitempty"`
IsUserRequested *bool `json:"isUserRequested,omitempty"`
Result *Result `json:"result,omitempty"`
ToolTelemetry map[string]interface{} `json:"toolTelemetry,omitempty"`
AllowedTools []string `json:"allowedTools,omitempty"`
Name *string `json:"name,omitempty"`
PluginName *string `json:"pluginName,omitempty"`
PluginVersion *string `json:"pluginVersion,omitempty"`
AgentDescription *string `json:"agentDescription,omitempty"`
AgentDisplayName *string `json:"agentDisplayName,omitempty"`
AgentName *string `json:"agentName,omitempty"`
Tools []string `json:"tools"`
HookInvocationID *string `json:"hookInvocationId,omitempty"`
HookType *string `json:"hookType,omitempty"`
Input interface{} `json:"input"`
Output interface{} `json:"output"`
Metadata *Metadata `json:"metadata,omitempty"`
Role *Role `json:"role,omitempty"`
}
type Attachment struct {
DisplayName *string `json:"displayName,omitempty"`
LineRange *LineRange `json:"lineRange,omitempty"`
Path *string `json:"path,omitempty"`
Type AttachmentType `json:"type"`
FilePath *string `json:"filePath,omitempty"`
Selection *SelectionClass `json:"selection,omitempty"`
Text *string `json:"text,omitempty"`
Number *float64 `json:"number,omitempty"`
ReferenceType *ReferenceType `json:"referenceType,omitempty"`
State *string `json:"state,omitempty"`
Title *string `json:"title,omitempty"`
URL *string `json:"url,omitempty"`
}
type LineRange struct {
End float64 `json:"end"`
Start float64 `json:"start"`
}
type SelectionClass struct {
End End `json:"end"`
Start Start `json:"start"`
}
type End struct {
Character float64 `json:"character"`
Line float64 `json:"line"`
}
type Start struct {
Character float64 `json:"character"`
Line float64 `json:"line"`
}
type CodeChanges struct {
FilesModified []string `json:"filesModified"`
LinesAdded float64 `json:"linesAdded"`
LinesRemoved float64 `json:"linesRemoved"`
}
type CompactionTokensUsed struct {
CachedInput float64 `json:"cachedInput"`
Input float64 `json:"input"`
Output float64 `json:"output"`
}
type ContextClass struct {
Branch *string `json:"branch,omitempty"`
Cwd string `json:"cwd"`
GitRoot *string `json:"gitRoot,omitempty"`
Repository *string `json:"repository,omitempty"`
}
type CopilotUsage struct {
TokenDetails []TokenDetail `json:"tokenDetails"`
TotalNanoAiu float64 `json:"totalNanoAiu"`
}
type TokenDetail struct {
BatchSize float64 `json:"batchSize"`
CostPerBatch float64 `json:"costPerBatch"`
TokenCount float64 `json:"tokenCount"`
TokenType string `json:"tokenType"`
}
type ErrorClass struct {
Code *string `json:"code,omitempty"`
Message string `json:"message"`
Stack *string `json:"stack,omitempty"`
}
type Metadata struct {
PromptVersion *string `json:"promptVersion,omitempty"`
Variables map[string]interface{} `json:"variables,omitempty"`
}
type ModelMetric struct {
Requests Requests `json:"requests"`
Usage Usage `json:"usage"`
}
type Requests struct {
Cost float64 `json:"cost"`
Count float64 `json:"count"`
}
type Usage struct {
CacheReadTokens float64 `json:"cacheReadTokens"`
CacheWriteTokens float64 `json:"cacheWriteTokens"`
InputTokens float64 `json:"inputTokens"`
OutputTokens float64 `json:"outputTokens"`
}
type QuotaSnapshot struct {
EntitlementRequests float64 `json:"entitlementRequests"`
IsUnlimitedEntitlement bool `json:"isUnlimitedEntitlement"`
Overage float64 `json:"overage"`
OverageAllowedWithExhaustedQuota bool `json:"overageAllowedWithExhaustedQuota"`
RemainingPercentage float64 `json:"remainingPercentage"`
ResetDate *time.Time `json:"resetDate,omitempty"`
UsageAllowedWithExhaustedQuota bool `json:"usageAllowedWithExhaustedQuota"`
UsedRequests float64 `json:"usedRequests"`
}
type RepositoryClass struct {
Branch *string `json:"branch,omitempty"`
Name string `json:"name"`
Owner string `json:"owner"`
}
type Result struct {
Content string `json:"content"`
Contents []Content `json:"contents,omitempty"`
DetailedContent *string `json:"detailedContent,omitempty"`
}
type Content struct {
Text *string `json:"text,omitempty"`
Type ContentType `json:"type"`
Cwd *string `json:"cwd,omitempty"`
ExitCode *float64 `json:"exitCode,omitempty"`
Data *string `json:"data,omitempty"`
MIMEType *string `json:"mimeType,omitempty"`
Description *string `json:"description,omitempty"`
Icons []Icon `json:"icons,omitempty"`
Name *string `json:"name,omitempty"`
Size *float64 `json:"size,omitempty"`
Title *string `json:"title,omitempty"`
URI *string `json:"uri,omitempty"`
Resource *ResourceClass `json:"resource,omitempty"`
}
type Icon struct {
MIMEType *string `json:"mimeType,omitempty"`
Sizes []string `json:"sizes,omitempty"`
Src string `json:"src"`
Theme *Theme `json:"theme,omitempty"`
}
type ResourceClass struct {
MIMEType *string `json:"mimeType,omitempty"`
Text *string `json:"text,omitempty"`
URI string `json:"uri"`
Blob *string `json:"blob,omitempty"`
}
type ToolRequest struct {
Arguments interface{} `json:"arguments"`
Name string `json:"name"`
ToolCallID string `json:"toolCallId"`
Type *ToolRequestType `json:"type,omitempty"`
}
type AgentMode string
const (
Autopilot AgentMode = "autopilot"
Interactive AgentMode = "interactive"
Plan AgentMode = "plan"
Shell AgentMode = "shell"
)
type ReferenceType string
const (
Discussion ReferenceType = "discussion"
Issue ReferenceType = "issue"
PR ReferenceType = "pr"
)
type AttachmentType string
const (
Directory AttachmentType = "directory"
File AttachmentType = "file"
GithubReference AttachmentType = "github_reference"
Selection AttachmentType = "selection"
)
type Operation string
const (
Create Operation = "create"
Delete Operation = "delete"
Update Operation = "update"
)
type Theme string
const (
Dark Theme = "dark"
Light Theme = "light"
)
type ContentType string
const (
Audio ContentType = "audio"
Image ContentType = "image"
Resource ContentType = "resource"
ResourceLink ContentType = "resource_link"
Terminal ContentType = "terminal"
Text ContentType = "text"
)
type Role string
const (
Developer Role = "developer"
System Role = "system"
)
type ShutdownType string
const (
Error ShutdownType = "error"
Routine ShutdownType = "routine"
)
type SourceType string
const (
Local SourceType = "local"
Remote SourceType = "remote"
)
type ToolRequestType string
const (
Custom ToolRequestType = "custom"
Function ToolRequestType = "function"
)
type SessionEventType string
const (
Abort SessionEventType = "abort"
AssistantIntent SessionEventType = "assistant.intent"
AssistantMessage SessionEventType = "assistant.message"
AssistantMessageDelta SessionEventType = "assistant.message_delta"
AssistantReasoning SessionEventType = "assistant.reasoning"
AssistantReasoningDelta SessionEventType = "assistant.reasoning_delta"
AssistantStreamingDelta SessionEventType = "assistant.streaming_delta"
AssistantTurnEnd SessionEventType = "assistant.turn_end"
AssistantTurnStart SessionEventType = "assistant.turn_start"
AssistantUsage SessionEventType = "assistant.usage"
HookEnd SessionEventType = "hook.end"
HookStart SessionEventType = "hook.start"
PendingMessagesModified SessionEventType = "pending_messages.modified"
SessionCompactionComplete SessionEventType = "session.compaction_complete"
SessionCompactionStart SessionEventType = "session.compaction_start"
SessionContextChanged SessionEventType = "session.context_changed"
SessionError SessionEventType = "session.error"
SessionHandoff SessionEventType = "session.handoff"
SessionIdle SessionEventType = "session.idle"
SessionInfo SessionEventType = "session.info"
SessionModeChanged SessionEventType = "session.mode_changed"
SessionModelChange SessionEventType = "session.model_change"
SessionPlanChanged SessionEventType = "session.plan_changed"
SessionResume SessionEventType = "session.resume"
SessionShutdown SessionEventType = "session.shutdown"
SessionSnapshotRewind SessionEventType = "session.snapshot_rewind"
SessionStart SessionEventType = "session.start"
SessionTaskComplete SessionEventType = "session.task_complete"
SessionTitleChanged SessionEventType = "session.title_changed"
SessionTruncation SessionEventType = "session.truncation"
SessionUsageInfo SessionEventType = "session.usage_info"
SessionWarning SessionEventType = "session.warning"
SessionWorkspaceFileChanged SessionEventType = "session.workspace_file_changed"
SkillInvoked SessionEventType = "skill.invoked"
SubagentCompleted SessionEventType = "subagent.completed"
SubagentDeselected SessionEventType = "subagent.deselected"
SubagentFailed SessionEventType = "subagent.failed"
SubagentSelected SessionEventType = "subagent.selected"
SubagentStarted SessionEventType = "subagent.started"
SystemMessage SessionEventType = "system.message"
ToolExecutionComplete SessionEventType = "tool.execution_complete"
ToolExecutionPartialResult SessionEventType = "tool.execution_partial_result"
ToolExecutionProgress SessionEventType = "tool.execution_progress"
ToolExecutionStart SessionEventType = "tool.execution_start"
ToolUserRequested SessionEventType = "tool.user_requested"
UserMessage SessionEventType = "user.message"
)
type ContextUnion struct {
ContextClass *ContextClass
String *string
}
func (x *ContextUnion) UnmarshalJSON(data []byte) error {
x.ContextClass = nil
var c ContextClass
object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false)
if err != nil {
return err
}
if object {
x.ContextClass = &c
}
return nil
}
func (x *ContextUnion) MarshalJSON() ([]byte, error) {
return marshalUnion(nil, nil, nil, x.String, false, nil, x.ContextClass != nil, x.ContextClass, false, nil, false, nil, false)
}
type ErrorUnion struct {
ErrorClass *ErrorClass
String *string
}
func (x *ErrorUnion) UnmarshalJSON(data []byte) error {
x.ErrorClass = nil
var c ErrorClass
object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false)
if err != nil {
return err
}
if object {
x.ErrorClass = &c
}
return nil
}
func (x *ErrorUnion) MarshalJSON() ([]byte, error) {
return marshalUnion(nil, nil, nil, x.String, false, nil, x.ErrorClass != nil, x.ErrorClass, false, nil, false, nil, false)
}
type RepositoryUnion struct {
RepositoryClass *RepositoryClass
String *string
}
func (x *RepositoryUnion) UnmarshalJSON(data []byte) error {
x.RepositoryClass = nil
var c RepositoryClass
object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false)
if err != nil {
return err
}
if object {
x.RepositoryClass = &c
}
return nil
}
func (x *RepositoryUnion) MarshalJSON() ([]byte, error) {
return marshalUnion(nil, nil, nil, x.String, false, nil, x.RepositoryClass != nil, x.RepositoryClass, false, nil, false, nil, false)
}
func unmarshalUnion(data []byte, pi **int64, pf **float64, pb **bool, ps **string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) (bool, error) {
if pi != nil {
*pi = nil
}
if pf != nil {
*pf = nil
}
if pb != nil {
*pb = nil
}
if ps != nil {
*ps = nil
}
dec := json.NewDecoder(bytes.NewReader(data))
dec.UseNumber()
tok, err := dec.Token()
if err != nil {
return false, err
}
switch v := tok.(type) {
case json.Number:
if pi != nil {
i, err := v.Int64()
if err == nil {
*pi = &i
return false, nil
}
}
if pf != nil {
f, err := v.Float64()
if err == nil {
*pf = &f
return false, nil
}
return false, errors.New("Unparsable number")
}
return false, errors.New("Union does not contain number")
case float64:
return false, errors.New("Decoder should not return float64")
case bool:
if pb != nil {
*pb = &v
return false, nil
}
return false, errors.New("Union does not contain bool")
case string:
if haveEnum {
return false, json.Unmarshal(data, pe)
}
if ps != nil {
*ps = &v
return false, nil
}
return false, errors.New("Union does not contain string")
case nil:
if nullable {
return false, nil
}
return false, errors.New("Union does not contain null")
case json.Delim:
if v == '{' {
if haveObject {
return true, json.Unmarshal(data, pc)
}
if haveMap {
return false, json.Unmarshal(data, pm)
}
return false, errors.New("Union does not contain object")
}
if v == '[' {
if haveArray {
return false, json.Unmarshal(data, pa)
}
return false, errors.New("Union does not contain array")
}
return false, errors.New("Cannot handle delimiter")
}
return false, errors.New("Cannot unmarshal union")
}
func marshalUnion(pi *int64, pf *float64, pb *bool, ps *string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) ([]byte, error) {
if pi != nil {
return json.Marshal(*pi)
}
if pf != nil {
return json.Marshal(*pf)
}
if pb != nil {
return json.Marshal(*pb)
}
if ps != nil {
return json.Marshal(*ps)
}
if haveArray {
return json.Marshal(pa)
}
if haveObject {
return json.Marshal(pc)
}
if haveMap {
return json.Marshal(pm)
}
if haveEnum {
return json.Marshal(pe)
}
if nullable {
return json.Marshal(nil)
}
return nil, errors.New("Union must not be null")
}