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

Function extractTransformCallbacks

go/client.go:633–659  ·  view source on GitHub ↗

CreateSession creates a new conversation session with the Copilot CLI. Sessions maintain conversation state, handle events, and manage tool execution. If the client is not connected, this will automatically start the runtime. The config parameter is optional. If no OnPermissionRequest handler is p

(config *SystemMessageConfig)

Source from the content-addressed store, hash-verified

631// extractTransformCallbacks separates transform callbacks from a SystemMessageConfig,
632// returning a wire-safe config and a map of callbacks (nil if none).
633func extractTransformCallbacks(config *SystemMessageConfig) (*SystemMessageConfig, map[string]SectionTransformFn) {
634 if config == nil || config.Mode != "customize" || len(config.Sections) == 0 {
635 return config, nil
636 }
637
638 callbacks := make(map[string]SectionTransformFn)
639 wireSections := make(map[string]SectionOverride)
640 for id, override := range config.Sections {
641 if override.Transform != nil {
642 callbacks[id] = override.Transform
643 wireSections[id] = SectionOverride{Action: "transform"}
644 } else {
645 wireSections[id] = override
646 }
647 }
648
649 if len(callbacks) == 0 {
650 return config, nil
651 }
652
653 wireConfig := &SystemMessageConfig{
654 Mode: config.Mode,
655 Content: config.Content,
656 Sections: wireSections,
657 }
658 return wireConfig, callbacks
659}
660
661func (c *Client) CreateSession(ctx context.Context, config *SessionConfig) (*Session, error) {
662 if config == nil {

Callers 2

CreateSessionMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…