-
Notifications
You must be signed in to change notification settings - Fork 937
Add get_last_session_id() to Python and Go SDKs
#671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -726,6 +726,40 @@ func (c *Client) DeleteSession(ctx context.Context, sessionID string) error { | |||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // GetLastSessionID returns the ID of the most recently updated session. | ||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||
| // This is useful for resuming the last conversation when the session ID | ||||||||||||||||||||||||||
| // was not stored. Returns nil if no sessions exist. | ||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||
| // Example: | ||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||
| // lastID, err := client.GetLastSessionID(context.Background()) | ||||||||||||||||||||||||||
| // if err != nil { | ||||||||||||||||||||||||||
| // log.Fatal(err) | ||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||
| // if lastID != nil { | ||||||||||||||||||||||||||
| // session, err := client.ResumeSession(context.Background(), *lastID, &copilot.ResumeSessionConfig{ | ||||||||||||||||||||||||||
| // OnPermissionRequest: copilot.PermissionHandler.ApproveAll, | ||||||||||||||||||||||||||
| // }) | ||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||
| func (c *Client) GetLastSessionID(ctx context.Context) (*string, error) { | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| func (c *Client) GetLastSessionID(ctx context.Context) (*string, error) { | |
| func (c *Client) GetLastSessionID(ctx context.Context) (*string, error) { | |
| if ctx == nil { | |
| ctx = context.Background() | |
| } | |
| // Respect caller cancellation/deadlines before attempting to connect. | |
| select { | |
| case <-ctx.Done(): | |
| return nil, ctx.Err() | |
| default: | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| models: | ||
| - claude-sonnet-4.5 | ||
| conversations: | ||
| - messages: | ||
| - role: system | ||
| content: ${system} | ||
| - role: user | ||
| content: Say hello | ||
| - role: assistant | ||
| content: Hello! I'm GitHub Copilot CLI, ready to help with your software engineering tasks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API reference list is inconsistent about whether
context.Contextparameters are shown (e.g.,DeleteSession(sessionID string)omitsctxwhileGetLastSessionID(ctx context.Context)includes it). Please align this new entry with the surrounding documentation style so the list is consistent and not misleading about call signatures.