Device code auth support#291
Conversation
| responder.respond_with_result(agent.authenticate(request).await) | ||
| responder.respond_with_result( | ||
| agent.authenticate(request, auth_cx, request_id).await, | ||
| ) |
There was a problem hiding this comment.
cx is passed in here to allow the handler to spawn a complete_device_code_login() task. We could perhaps pass a narrower spawner trait instead, or maybe even return a Future from the handler.
| - Custom Prompts | ||
| - Client MCP servers | ||
| - Auth Methods: | ||
| - ChatGPT subscription (requires paid subscription and doesn't work in remote projects) |
There was a problem hiding this comment.
Paid subscriptions aren't required.. maybe they were at some point in the past?
| let agent = agent.clone(); | ||
| let auth_cx = cx.clone(); | ||
| let request_id = request_id_from_json(responder.id()) | ||
| .expect("request id must be a string or number"); |
There was a problem hiding this comment.
This could be avoided if responder exposed a Responder::request_id() -> RequestId or similar.
|
This PR adds support for #149. CI failures are due to the dependency on agentclientprotocol/rust-sdk#163. |
faac66f to
9594756
Compare
|
Thanks for this. Will this change the detail in the readme
? |
9594756 to
ea80074
Compare
ea80074 to
93e8aef
Compare
Yes, for clients that support URL-mode elicitations. And it doesn't require a paid subscription either. In any case, I've updated the README to remove that text. |
|
@benbrandt thanks for your help adding elicitation support to the SDK, that unblocks this PR. I realise this project isn't a major focus at the moment, but this is a good example of ACP elicitation in action, has quite a few votes in #149, and would make my life a whole lot easier if it can be upstreamed! Many thanks |
This PR adds device code auth support for ChatGPT login when no browser is available.
It's an alternative implementation to #281. Instead of using a custom error data, the agent sends a URL-mode elicitation to initiate a device code auth flow:
An
elicitation/completeisn't required, due to theAuthenticateResponsesent when authentication is complete (or an error if it failed).The Rust SDK doesn't currently include elicitation schema in its
unstablefeature. I've added this in agentclientprotocol/rust-sdk#163, which this PR depends on.