MCPcopy Create free account
hub / github.com/github/copilot-sdk / start

Method start

go/copilot_request_handler.go:731–763  ·  view source on GitHub ↗
(status int, statusTxt string, headers http.Header)

Source from the content-addressed store, hash-verified

729}
730
731func (s *responseSink) start(status int, statusTxt string, headers http.Header) error {
732 s.exchange.mu.Lock()
733 if s.exchange.started {
734 s.exchange.mu.Unlock()
735 return fmt.Errorf("CopilotRequestHandler response sink Start() called twice")
736 }
737 if s.exchange.finished {
738 s.exchange.mu.Unlock()
739 return fmt.Errorf("CopilotRequestHandler response sink already finished")
740 }
741 s.exchange.started = true
742 s.exchange.mu.Unlock()
743
744 api, err := s.rpcAPI()
745 if err != nil {
746 return err
747 }
748 var st *string
749 if statusTxt != "" {
750 st = &statusTxt
751 }
752 h := map[string][]string(headers)
753 if h == nil {
754 h = map[string][]string{}
755 }
756 _, err = api.HttpResponseStart(context.Background(), &rpc.LlmInferenceHTTPResponseStartRequest{
757 RequestID: s.requestID,
758 Status: int64(status),
759 StatusText: st,
760 Headers: h,
761 })
762 return err
763}
764
765func (s *responseSink) writeText(data []byte) error {
766 return s.writeRaw(string(data), false)

Callers 4

streamResponseToSinkFunction · 0.45
startMethod · 0.45
failViaSinkMethod · 0.45
finishCancelledMethod · 0.45

Calls 2

rpcAPIMethod · 0.95
HttpResponseStartMethod · 0.80

Tested by

no test coverage detected