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

Method ResumeSessionWithOptions

go/client.go:991–1221  ·  view source on GitHub ↗

ResumeSessionWithOptions resumes an existing conversation session with additional configuration. This allows you to continue a previous conversation, maintaining all conversation history. The session must have been previously created and not deleted. Example: session, err := client.ResumeSession

(ctx context.Context, sessionID string, config *ResumeSessionConfig)

Source from the content-addressed store, hash-verified

989// Tools: []copilot.Tool{myNewTool},
990// })
991func (c *Client) ResumeSessionWithOptions(ctx context.Context, sessionID string, config *ResumeSessionConfig) (*Session, error) {
992 if config == nil {
993 config = &ResumeSessionConfig{}
994 }
995
996 if err := c.ensureConnected(ctx); err != nil {
997 return nil, err
998 }
999
1000 c.applyResumeDefaultsForMode(config)
1001
1002 var req resumeSessionRequest
1003 req.SessionID = sessionID
1004 req.ClientName = config.ClientName
1005 req.Model = config.Model
1006 req.ReasoningEffort = config.ReasoningEffort
1007 req.ReasoningSummary = config.ReasoningSummary
1008 req.ContextTier = config.ContextTier
1009 systemMessage := c.systemMessageForMode(config.SystemMessage)
1010 wireSystemMessage, transformCallbacks := extractTransformCallbacks(systemMessage)
1011 req.SystemMessage = wireSystemMessage
1012 req.Tools = config.Tools
1013 req.Provider = config.Provider
1014 req.Capi = config.Capi
1015 req.Providers = config.Providers
1016 req.Models = config.Models
1017 req.EnableSessionTelemetry = config.EnableSessionTelemetry
1018 req.SkipCustomInstructions = config.SkipCustomInstructions
1019 req.CustomAgentsLocalOnly = config.CustomAgentsLocalOnly
1020 req.CoauthorEnabled = config.CoauthorEnabled
1021 req.ManageScheduleEnabled = config.ManageScheduleEnabled
1022 req.ModelCapabilities = config.ModelCapabilities
1023 availableTools, excludedTools, precedence, ferr := c.resolveToolFilterOptions(config.AvailableTools, config.ExcludedTools)
1024 if ferr != nil {
1025 return nil, ferr
1026 }
1027 req.AvailableTools = availableTools
1028 req.ExcludedTools = excludedTools
1029 req.ToolFilterPrecedence = precedence
1030 req.ExcludedBuiltInAgents = config.ExcludedBuiltInAgents
1031 req.EnableCitations = config.EnableCitations
1032 req.SessionLimits = config.SessionLimits
1033 if config.Streaming != nil {
1034 req.Streaming = config.Streaming
1035 }
1036 if config.IncludeSubAgentStreamingEvents != nil {
1037 req.IncludeSubAgentStreamingEvents = config.IncludeSubAgentStreamingEvents
1038 } else {
1039 req.IncludeSubAgentStreamingEvents = Bool(true)
1040 }
1041 if config.OnUserInputRequest != nil {
1042 req.RequestUserInput = Bool(true)
1043 }
1044 if config.Hooks != nil && (config.Hooks.OnPreToolUse != nil ||
1045 config.Hooks.OnPreMCPToolCall != nil ||
1046 config.Hooks.OnPostToolUse != nil ||
1047 config.Hooks.OnPostToolUseFailure != nil ||
1048 config.Hooks.OnUserPromptSubmitted != nil ||

Calls 15

ensureConnectedMethod · 0.95
systemMessageForModeMethod · 0.95
BoolFunction · 0.85
newSessionFunction · 0.85
newSessionFSAdapterFunction · 0.85
registerCanvasHandlerMethod · 0.80