feat: support polling straight from auth login#78
Conversation
|
|
||
| ```bash | ||
| link-cli auth login --client-name "<your-agent-name>" | ||
| link-cli auth login --client-name "<your-agent-name>" --interval 5 --timeout 300 |
There was a problem hiding this comment.
I don't think we should make this the default behavior. Agents seem good with the _next output?
| const deadline = Date.now() + c.options.timeout * 1000; | ||
| let attempts = 0; | ||
|
|
||
| while (true) { |
There was a problem hiding this comment.
is this code repeated in the other auth polling command?
|
|
||
| // Inline polling: emit code to stderr (visible immediately even while | ||
| // stdout is buffered), then yield it as structured output for MCP streaming. | ||
| process.stderr.write( |
There was a problem hiding this comment.
should be json output/respect the output format
dfcbadf to
734e30c
Compare
| if (c.format === 'json') { | ||
| process.stderr.write( | ||
| `${JSON.stringify({ verification_url: authRequest.verification_url_complete, phrase: authRequest.user_code })}\n`, | ||
| ); | ||
| } else { | ||
| process.stderr.write( | ||
| `\nVerification URL: ${authRequest.verification_url_complete}\nPhrase: ${authRequest.user_code}\n\nOpen the URL, log in to Link, and enter the phrase to approve.\nPolling for approval...\n\n`, | ||
| ); |
There was a problem hiding this comment.
I don't think you need this? incur should handle the output format for you, you just need to return the object
There was a problem hiding this comment.
or yield the object
danhill-stripe
left a comment
There was a problem hiding this comment.
I also think we need the sanitizeDeep on the output too
…ss the auth login polling and the auth status polling
734e30c to
589b444
Compare
| timeout: number; | ||
| } | ||
|
|
||
| async function* pollAuthStatus( |
There was a problem hiding this comment.
this is the same code that was used for auth status as well, just abstracting it into a shared function so the login polling can do the same
We received feedback (from an agent using
link-cli!) that theauth status --interval N --max-attempts Mis a long-running blocking command that blocked the agent's I/O, and so they weren't able to relay the code to the human until they stopped polling.To fix this, we instead allow starting the polling straight from the
auth logincommandTest Plan:
Old behavior - no changes

Old behavior - no format -> interactive mode

New Behavior - outputs as JSON when formatted

