Repository navigation
feat(gui): native Kiro device login and auto-selection chips in the dashboard #6016
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
de640c3
feat(gui): native Kiro device login and auto-selection chips in the d…
lidge-jun dff10fc
test(gui): build the userinfo spoof URL from fragments so privacy:sca…
lidge-jun ab10748
fix(gui): satisfy react-doctor on the Kiro device-login hook and test…
lidge-jun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
244 changes: 244 additions & 0 deletions
244
devlog/_plan/260926_kiro_lb_parity2/100_gui_device_login_and_skip_reason.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import { useId, type RefObject } from "react"; | ||
| import { useT } from "../i18n/shared"; | ||
| import { useModalDialog } from "../pages/dashboard-shared"; | ||
| import { kiroVerificationLink } from "../kiro-device-login-helpers"; | ||
| import { useCopyFeedback } from "./use-copy-feedback"; | ||
| import { useKiroDeviceLogin } from "./use-kiro-device-login"; | ||
| import KiroLoginChooser from "./KiroLoginChooser"; | ||
| import type { KiroFinalOutcome } from "../kiro-device-login-finalizer"; | ||
| import "../styles/kiro-device-login.css"; | ||
|
|
||
| export default function KiroDeviceLoginDialog({ apiBase, triggerRef, addAccount, busy, onCli, onClose, onSettled, | ||
| pollDelay }: { | ||
| apiBase: string; | ||
| triggerRef: RefObject<HTMLButtonElement | null>; | ||
| addAccount: boolean; | ||
| busy: boolean; | ||
| onCli: (addAccount: boolean) => void; | ||
| onClose: () => void; | ||
| onSettled?: (provider: string, outcome: KiroFinalOutcome) => void; | ||
| pollDelay?: (ms: number) => Promise<void>; | ||
| }) { | ||
| const t = useT(); | ||
| const titleId = useId(); | ||
| const dialogRef = useModalDialog(true, triggerRef); | ||
| const login = useKiroDeviceLogin(apiBase, onSettled, pollDelay); | ||
| const copy = useCopyFeedback<string>(); | ||
| const { state } = login; | ||
| const view = state.view; | ||
| const destination = view?.verificationUriComplete ?? view?.verificationUri; | ||
| const safeLink = kiroVerificationLink(destination); | ||
| const cancel = () => { void login.close(); onClose(); }; | ||
| return ( | ||
| <dialog ref={dialogRef} className="kiro-device-dialog" aria-modal="true" aria-labelledby={titleId} | ||
| onCancel={event => { event.preventDefault(); cancel(); }}> | ||
| <h2 id={titleId}>{t("kiroLogin.title")}</h2> | ||
| {state.phase === "idle" && ( | ||
| <> | ||
| <p className="muted">{t(addAccount ? "kiroLogin.addDescription" : "kiroLogin.loginDescription")}</p> | ||
| <KiroLoginChooser disabled={busy} onCli={() => { onClose(); onCli(addAccount); }} onMethod={method => { void login.start(method); }} /> | ||
| </> | ||
| )} | ||
| {state.phase === "starting" && <p role="status" aria-live="polite">{t("kiroLogin.starting")}</p>} | ||
| {view && (state.phase === "pending" || state.phase === "done" || state.phase === "failed" || state.phase === "expired" || state.phase === "ended") && ( | ||
| <> | ||
| {view.userCode && ( | ||
| <div className="kiro-device-code"> | ||
| <span className="kiro-device-code-value">{view.userCode}</span> | ||
| <button type="button" className="btn btn-ghost btn-sm" onClick={() => copy.copy(view.userCode!, view.flowId)}> | ||
| {copy.outcomeFor(view.flowId) === "copied" ? t("kiroLogin.copied") : copy.outcomeFor(view.flowId) === "unavailable" ? t("kiroLogin.copyUnavailable") : t("kiroLogin.copyCode")} | ||
| </button> | ||
| </div> | ||
| )} | ||
| {destination && (safeLink | ||
| ? <a href={safeLink} target="_blank" rel="noopener noreferrer">{t("kiroLogin.openVerification")}</a> | ||
| : <><p className="kiro-device-destination">{destination}</p><p className="notice-warn">{t("kiroLogin.unexpectedHost")}</p></>)} | ||
| {view.warning === "duplicate_profile_arn" && <p className="notice-warn">{t("kiroLogin.duplicate")}</p>} | ||
| {view.warning === "manual_review_required" && <p className="notice-warn">{t("kiroLogin.manualReview")}</p>} | ||
| </> | ||
| )} | ||
| <p role="status" aria-live="polite"> | ||
| {state.phase === "pending" && t("kiroLogin.pending")} | ||
| {state.phase === "done" && t("kiroLogin.done")} | ||
| {state.phase === "expired" && t("kiroLogin.expired")} | ||
| {state.phase === "ended" && t("kiroLogin.ended")} | ||
| {state.phase === "failed" && t(state.error === "start" ? "kiroLogin.startFailed" : "kiroLogin.failed")} | ||
| </p> | ||
| <div className="kiro-device-actions"> | ||
| {(state.phase === "failed" || state.phase === "expired" || state.phase === "ended") && ( | ||
| <button type="button" className="btn btn-ghost btn-sm" onClick={login.reset}>{t("kiroLogin.tryAgain")}</button> | ||
| )} | ||
| <button type="button" className="btn btn-ghost btn-sm" onClick={cancel}>{t("common.cancel")}</button> | ||
| </div> | ||
| </dialog> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { useT } from "../i18n/shared"; | ||
| import type { KiroDeviceMethod } from "../kiro-device-login-helpers"; | ||
|
|
||
| export default function KiroLoginChooser({ disabled, onCli, onMethod }: { | ||
| disabled: boolean; | ||
| onCli: () => void; | ||
| onMethod: (method: KiroDeviceMethod) => void; | ||
| }) { | ||
| const t = useT(); | ||
| return ( | ||
| <div className="kiro-login-choices" role="group" aria-label={t("kiroLogin.chooseMethod")}> | ||
| <button type="button" className="btn btn-ghost" disabled={disabled} onClick={onCli}>{t("kiroLogin.cli")}</button> | ||
| <button type="button" className="btn btn-ghost" disabled={disabled} onClick={() => onMethod("builder-id")}>{t("kiroLogin.builderId")}</button> | ||
| <button type="button" className="btn btn-ghost" disabled={disabled} onClick={() => onMethod("google")}>{t("kiroLogin.google")}</button> | ||
| <button type="button" className="btn btn-ghost" disabled={disabled} onClick={() => onMethod("github")}>{t("kiroLogin.github")}</button> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This interception covers only the workspace
ProviderAuthPanel. In the Add provider modal's Accounts tab,CatalogAccountRow.tsxstill sends Kiro's Login/Add account buttons throughProviders.onAccountLogin, which callsrequestLoginOAuthdirectly. Those dashboard buttons therefore bypass the new chooser and immediately launch the legacy Kiro CLI flow; Add account can even sign the CLI out temporarily. Route the modal's Kiro actions through the same chooser.Useful? React with 👍 / 👎.