MCPcopy Index your code
hub / github.com/the-open-agent/openagent / parseSSEEvent

Method parseSSEEvent

model/opencode.go:407–424  ·  view source on GitHub ↗
(data string)

Source from the content-addressed store, hash-verified

405}
406
407func (p *OpenCodeProvider) parseSSEEvent(data string) sseEvent {
408 var result sseEvent
409
410 // Try format A: { type, properties }
411 if err := json.Unmarshal([]byte(data), &result); err == nil && result.Type != "" {
412 return result
413 }
414
415 // Try format B: { directory, payload: { type, properties } }
416 var wrapped struct {
417 Payload json.RawMessage `json:"payload"`
418 }
419 if err := json.Unmarshal([]byte(data), &wrapped); err == nil && len(wrapped.Payload) > 0 {
420 json.Unmarshal(wrapped.Payload, &result)
421 }
422
423 return result
424}
425
426func (p *OpenCodeProvider) setAuth(req *http.Request) {
427 if p.apiKey != "" {

Callers 1

readSSEStreamMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected