Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): separate setup behavior and guidance from visual redesign (#1157)

Gustavo Ye28601d30ebd0
diff --git a/src/web/public/onboard.md b/src/web/public/onboard.md
index 42975d46d..0b2ffd7fa 100644
--- a/src/web/public/onboard.md
+++ b/src/web/public/onboard.md
@@ -1,13 +1,33 @@
# Set up my Alook team
-Read [agent.md](./agent.md) for commands and authorization. Use the backend, connection information and one-hour access code from the user's prompt. Keep the credentials private and use this site's origin for Automation calls.
+Read [agent.md](https://alook.ai/agent.md) for commands and authorization. Use the connection information and one-hour access code from the user's prompt. The agent selected at the start runs setup; it does not determine the backend for every bot. Keep the credentials private and use this site's origin for Automation calls.
-1. **Connect the computer.** Run the supplied daemon command, or check the supplied machine ID. Confirm the machine is online and the selected backend is available.
+1. **Connect the computer.** Run the supplied daemon command, or check the supplied machine ID. Use `use machine --list` to confirm the machine is online and inspect its available backends.
2. **Agree on the team.** Based on the user's recent work and available project context, propose how to run that work in Alook with people and bots. Confirm the goal, responsibilities, server and first task with the user. Keep the team to at most **three bots**, including any you reuse. Randomly choose distinctive personal names inspired by names from Italy, France, Africa or Latin America without asking the user what to call the bots; put functions and responsibilities in each bot’s `description`, not its name.
-3. **Set up the server.** Create or reuse the agreed bots and server, then invite the bots. Check `use server --members '<server#NNNN>'` and follow any pagination to confirm all expected bots have joined.
+ **Before creating any bots, ask the user which agent/backend each bot should use.** Show the healthy backends available on the connected machine. The user can choose the same backend for all bots or different backends for different bots. Confirm the bot-to-backend mapping before creation; do not default every bot to the agent running setup. If a requested backend is unavailable, explain what needs to be installed or signed in and confirm how to proceed instead of silently substituting another backend. Follow `agent.md` to check supported models and use the exact backend IDs.
-4. **Start the work.** Send the agreed first task to a server text channel with `use message --send --as me`. Identify yourself as the user's agent, explain their goal, and mention the bots with their assignments. Give the user the server UI link.
+3. **Confirm every bot has joined before sending any task.** Create or reuse the agreed bots and server, then invite the bots. Check `use server --members '<server#NNNN>'` and follow every page to verify each expected bot is a member. An invitation sent or accepted by the command is not proof of membership. If any expected bot is missing, resolve its joining problem and check the members again. **Do not proceed to step 4 or send the first task until all expected bots have joined**, so they can receive it.
-After setup, expire the temporary code with `use expire` and leave the daemon running. If a step is blocked, tell the user what remains.
+4. **Start the work in the public `all` channel.** Send the agreed first task to the new server's public `all` channel with `use message --send --as me`, using the full channel reference returned for that server. If reusing an agreed server, use its public `all` channel. Do not choose a private channel. If you cannot find the public `all` channel, resolve that before sending instead of substituting another channel. Identify yourself as the user's agent, explain their goal, and mention the bots with their assignments. Give the user the server UI link and explicitly tell them to open it in the same browser and profile they used to sign in to Alook at the start, not in the agent's built-in browser.
+
+5. **Wait for a real bot reply in the same `all` channel.** Onboarding is not complete until at least one bot has actually replied to the first task in that public `all` channel. An online machine, a created bot or a successful message send is not enough. Verify the reply in the user's signed-in Alook browser, or ask the user to confirm they can see it if you cannot access that session. The Automation CLI cannot read chat history. Do not send a message on a bot's behalf and count it as the bot's own reply. Until the reply is confirmed, keep setup open, investigate any failure within the granted permissions, and report blockers without claiming completion.
+
+6. **Confirm the user is satisfied, then expire the code.** Only after a bot reply is confirmed may you report onboarding as complete. Ask the user to check the result and explicitly confirm they are satisfied. If they report a problem, address it and confirm again. **Run `use expire` only after the user confirms they are satisfied.** Silence is not confirmation. Leave the daemon running so the bots can continue working. If a step is blocked or the temporary code expires before confirmation, explain what remains; do not claim setup is complete or attempt to extend access without the user's authorization.
+
+## FAQ
+
+### Why does the final server link ask me to sign in again or fail to open my server?
+
+An agent's built-in browser can have a separate cookie store from your normal browser. It may not have your Alook login session. Copy the server link and open it in the same browser and profile you used to sign in to Alook at the start. If that session has expired, sign in there again with the same Alook account. The setup access code does not sign a browser in.
+
+When handing over the link, tell the user where to open it. Do not treat a login failure in the agent's browser as proof that server creation failed.
+
+### Why were my bots created but cannot start in a sandbox?
+
+An agent's sandbox may only allow access to the current project directory. Alook creates a separate working directory for each bot, by default at `~/.alook/daemon/<bot-id>`. Access to the project alone may not cover those directories. If a custom Alook data or working directory is configured, check that location too.
+
+Allow the daemon and selected backend to create, read and write the bot working directories, start the required processes, and access the project files and network needed for the agreed task. If the sandbox blocks one of these operations, explain the blocked path or operation and ask the user to grant the required permission through their agent's permission controls. Use permissions that cover the task; do not assume unrestricted access is required.
+
+After permissions are granted, retry the blocked step and confirm the bots can receive and act on the first task. A bot record or an online machine alone does not prove that the bot can run.
diff --git a/src/web/src/components/community/onboarding/community-onboarding-form.navigation.dom.test.ts b/src/web/src/components/community/onboarding/community-onboarding-form.navigation.dom.test.ts
index c6d962786..3a42de350 100644
--- a/src/web/src/components/community/onboarding/community-onboarding-form.navigation.dom.test.ts
+++ b/src/web/src/components/community/onboarding/community-onboarding-form.navigation.dom.test.ts
@@ -62,20 +62,22 @@ vi.mock("./onboarding-machine-dialog", () => ({
}), createElement("button", { onClick: () => onConnected("machine-1") }, "Machine connected"), createElement("button", { onClick: onExit }, "Exit manual")),
}))
vi.mock("./onboarding-agent-dialog", () => ({
- OnboardingAgentDialog: ({ onExit }: { onExit: () => void }) => createElement("div", {},
+ OnboardingAgentDialog: ({ onExit, onChooseAgent }: { onExit: () => void; onChooseAgent: () => void }) => createElement("div", {},
createElement("p", {}, "Agent Setup"),
+ createElement("button", { onClick: onChooseAgent }, "Choose another agent"),
createElement("button", { onClick: onExit }, "Exit agent")),
}))
vi.mock("./onboarding-select-dialog", () => ({
- OnboardingSelectDialog: ({ value, onValueChange, onSubmit }: {
+ OnboardingSelectDialog: ({ value, onValueChange, onSubmit, advanceOnSelect }: {
+ advanceOnSelect?: boolean
value: string
onValueChange: (value: string) => void
onSubmit: (value: string) => void
}) => createElement("div", {}, createElement("button", {
"data-testid": "select-harness",
"data-value": value,
- onClick: () => onValueChange("codex"),
- }), createElement("button", { onClick: () => onSubmit("developer") }, "Finish setup")),
+ onClick: () => { onValueChange("codex"); if (advanceOnSelect) onSubmit("codex") },
+ }), advanceOnSelect ? null : createElement("button", { onClick: () => onSubmit("developer") }, "Finish setup")),
}))
vi.mock("@/hooks/community/use-machines", () => ({ useMachines: () => ({ machines: [] }) }))
vi.mock("../bots/model-field", () => ({ ModelField: ({ value, onChange }: { value: string | null; onChange: (value: string | null) => void }) => createElement("input", { "aria-label": "Model", value: value ?? "", onChange: (event: React.ChangeEvent<HTMLInputElement>) => onChange(event.target.value || null) }) }))
@@ -119,10 +121,29 @@ describe("CommunityOnboardingForm room navigation", () => {
})
})
+ it.each(["harness", "machine"])("ignores outside clicks and Escape during %s until Exit setup is clicked", async (stage) => {
+ mocks.state = { status: "active", stage, ...(stage === "machine" ? { harness: "codex", setupMode: "manual" } : {}) }
+ render(createElement(CommunityOnboardingForm))
+ const surface = screen.getByTestId("onboarding-surface")
+ await act(async () => {})
+ fireEvent.mouseDown(document.body)
+ fireEvent.mouseUp(document.body)
+ fireEvent.click(document.body)
+ expect(owner.runtime.ui.get().onboardingState).toMatchObject({ status: "active", stage })
+ expect(surface).toBeInTheDocument()
+ fireEvent.keyDown(surface, { key: "Escape", code: "Escape" })
+ expect(owner.runtime.ui.get().onboardingState).toMatchObject({ status: "active", stage })
+ expect(surface).toBeInTheDocument()
+ fireEvent.click(screen.getByRole("button", { name: "Exit setup" }))
+ expect(owner.runtime.ui.get().onboardingState).toBeNull()
+ expect(mocks.initialize).not.toHaveBeenCalled()
+ })
+
it("defaults to Agent Setup and supports Manual and exit without creating a team", async () => {
mocks.state = { status: "active", stage: "harness" }
render(createElement(CommunityOnboardingForm))
- fireEvent.click(screen.getByRole("button", { name: "Finish setup" }))
+ expect(screen.getByText("Pick your local agent")).toBeInTheDocument()
+ fireEvent.click(screen.getByTestId("select-harness"))
expect(screen.getByText("Agent Setup")).toBeInTheDocument()
expect(mocks.initialize).not.toHaveBeenCalled()
fireEvent.click(screen.getByRole("button", { name: "Manual" }))
@@ -132,6 +153,17 @@ describe("CommunityOnboardingForm room navigation", () => {
expect(mocks.initialize).not.toHaveBeenCalled()
})
+ it("allows the same agent to be selected again after returning", () => {
+ mocks.state = { status: "active", stage: "harness" }
+ render(createElement(CommunityOnboardingForm))
+ fireEvent.click(screen.getByTestId("select-harness"))
+ fireEvent.click(screen.getByRole("button", { name: "Choose another agent" }))
+ expect(screen.getByTestId("select-harness")).toHaveAttribute("data-value", "")
+ fireEvent.click(screen.getByTestId("select-harness"))
+ expect(screen.getByText("Agent Setup")).toBeInTheDocument()
+ expect(mocks.initialize).not.toHaveBeenCalled()
+ })
+
it.each(["machine", "model", "identity"])("keeps outer mode controls available from manual %s", (stage) => {
mocks.state = { status: "active", stage, harness: "opencode", setupMode: "manual", machineId: "machine-1" }
render(createElement(CommunityOnboardingForm))
@@ -185,7 +217,7 @@ describe("CommunityOnboardingForm room navigation", () => {
const rendered = render(createElement(CommunityOnboardingForm))
fireEvent.click(screen.getByTestId("select-harness"))
- expect(screen.getByTestId("select-harness")).toHaveAttribute("data-value", "codex")
+ expect(screen.getByText("Agent Setup")).toBeInTheDocument()
mocks.state = { status: "active", stage: "machine", harness: "codex" }
await act(async () => { owner.runtime.ui.setState((state) => ({ ...state, onboardingState: mocks.state as CommunityOnboardingState })) })
diff --git a/src/web/src/components/community/onboarding/community-onboarding-form.tsx b/src/web/src/components/community/onboarding/community-onboarding-form.tsx
index de54e3384..cb5def448 100644
--- a/src/web/src/components/community/onboarding/community-onboarding-form.tsx
+++ b/src/web/src/components/community/onboarding/community-onboarding-form.tsx
@@ -165,6 +165,7 @@ function CommunityOnboardingSteps() {
options={[...ONBOARDING_HARNESSES]}
value={harness}
onValueChange={setHarness}
+ advanceOnSelect
submitLabel="Continue"
onSubmit={(value) => {
advanceCommunityOnboarding(communityRuntime, "harness", "machine", { harness: value, setupMode: "agent" })
@@ -180,7 +181,7 @@ function CommunityOnboardingSteps() {
harness={state.harness ?? ""}
harnessLabel={harnessLabel(state.harness)}
onConnected={() => finishCommunityOnboardingAgentSetup(communityRuntime)}
- onChooseAgent={() => recoverCommunityOnboardingHarness(communityRuntime)}
+ onChooseAgent={() => { setHarness(""); recoverCommunityOnboardingHarness(communityRuntime) }}
onExit={() => skipCommunityOnboarding(communityRuntime)}
/>
}
@@ -286,7 +287,7 @@ export function CommunityOnboardingForm() {
const selected = Boolean(state.harness)
const mode = state.setupMode === "agent" ? "agent" : "manual"
const switching = selected && ["machine", "model", "identity"].includes(state.stage)
- return <SetupDialog.Root open onOpenChange={(open) => { if (!open) skipCommunityOnboarding(runtime) }}>
+ return <SetupDialog.Root open onOpenChange={(_open, details) => details.cancel()}>
<SetupDialog.Portal>
<SetupDialog.Backdrop className={`fixed inset-0 z-50 ${appBackdropClassName}`}><AppEdgeFade /></SetupDialog.Backdrop>
<SetupDialog.Popup aria-label="Set up Alook" data-testid="onboarding-surface" className="fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-xl -translate-x-1/2 -translate-y-1/2 flex-col gap-1 text-foreground outline-none">
@@ -297,7 +298,7 @@ export function CommunityOnboardingForm() {
key={value} type="button" data-testid={`onboarding-mode-${value}`} aria-pressed={mode === value}
disabled={!switching} onClick={() => { if (mode !== value) switchCommunityOnboardingSetup(runtime, value) }}
className={`inline-flex min-h-11 items-center bg-transparent px-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed ${mode === value ? "text-foreground" : "text-muted-foreground hover:text-foreground"}`}
- ><span className={`border-b-2 pb-1 ${mode === value ? "border-foreground" : "border-transparent"}`}>{value === "agent" ? "Agent" : "Manual"}</span></button>) : <span className="text-sm text-muted-foreground">Set up Alook</span>}
+ ><span className={`border-b-2 pb-1 ${mode === value ? "border-foreground" : "border-transparent"}`}>{value === "agent" ? "Agent" : "Manual"}</span></button>) : <span className="text-sm text-muted-foreground">Pick your local agent</span>}
</nav>
<Button type="button" variant="ghost" size="icon" aria-label="Exit setup" title="Exit setup" className="size-11 text-foreground" onClick={() => skipCommunityOnboarding(runtime)}><X aria-hidden className="size-4" /></Button>
</header>
diff --git a/src/web/src/components/community/onboarding/onboarding-agent-dialog.dom.test.tsx b/src/web/src/components/community/onboarding/onboarding-agent-dialog.dom.test.tsx
index c88e24e39..1331f3b21 100644
--- a/src/web/src/components/community/onboarding/onboarding-agent-dialog.dom.test.tsx
+++ b/src/web/src/components/community/onboarding/onboarding-agent-dialog.dom.test.tsx
@@ -36,7 +36,10 @@ describe("Agent Setup", () => {
fireEvent.click(screen.getByRole("button", { name: "Copy prompt" }))
await waitFor(() => expect(mocks.copy).toHaveBeenCalledOnce())
expect(mocks.copy.mock.calls[0][0]).toContain(`Follow ${location.origin}/onboard.md`)
- expect(mocks.copy.mock.calls[0][0]).toContain("/onboard.md")
+ expect(mocks.copy.mock.calls[0][0]).toContain("Setup assistant: Codex")
+ expect(mocks.copy.mock.calls[0][0]).toContain("Before creating bots, ask me which available agent backend I want for each bot.")
+ expect(mocks.copy.mock.calls[0][0]).toContain("Bots can use different backends from the setup assistant.")
+ expect(mocks.copy.mock.calls[0][0]).toContain("After confirming all expected bots have joined the server, send the first task to its public all channel. Wait for at least one bot to reply there before reporting setup complete. Confirm I am satisfied before expiring the access code.")
expect(mocks.copy.mock.calls[0][0]).toContain("pair fixture-pair")
expect(mocks.copy.mock.calls[0][0]).toContain("fixture-code")
expect(mocks.copy.mock.calls[0][0]).not.toContain("confirm the requirements with me")
diff --git a/src/web/src/components/community/onboarding/onboarding-agent-dialog.tsx b/src/web/src/components/community/onboarding/onboarding-agent-dialog.tsx
index f9e8e069b..ae6b636e4 100644
--- a/src/web/src/components/community/onboarding/onboarding-agent-dialog.tsx
+++ b/src/web/src/components/community/onboarding/onboarding-agent-dialog.tsx
@@ -20,7 +20,9 @@ type Setup = { signal?: AbortSignal; pair?: Pair; code?: AutomationAccessCodeCre
function buildOnboardingAgentPrompt(input: { baseUrl: string; harness: string; command?: string; machineId?: string; secret: string }) {
return [
`Follow ${input.baseUrl}/onboard.md to set up my Alook team.`,
- `Selected agent: ${input.harness}`,
+ `Setup assistant: ${input.harness}`,
+ "Before creating bots, ask me which available agent backend I want for each bot. Bots can use different backends from the setup assistant.",
+ "After confirming all expected bots have joined the server, send the first task to its public all channel. Wait for at least one bot to reply there before reporting setup complete. Confirm I am satisfied before expiring the access code.",
input.command ? `Daemon connection command: ${input.command}` : `Connected machine ID: ${input.machineId}`,
`Onboard access code (valid for one hour): ${input.secret}`,
].join("\n")
diff --git a/src/web/src/components/community/onboarding/onboarding-select-dialog.dom.test.tsx b/src/web/src/components/community/onboarding/onboarding-select-dialog.dom.test.tsx
new file mode 100644
index 000000000..c52bfb9db
--- /dev/null
+++ b/src/web/src/components/community/onboarding/onboarding-select-dialog.dom.test.tsx
@@ -0,0 +1,20 @@
+import { describe, expect, it, vi } from "vitest"
+import { fireEvent, render, screen } from "@/test/react-dom-harness"
+import { OnboardingSelectDialog } from "./onboarding-select-dialog"
+import { OnboardingSurface } from "./onboarding-surface"
+
+describe("agent selection", () => {
+ it("advances directly from a selected option without a Continue button", () => {
+ const submit = vi.fn()
+ render(<OnboardingSurface><OnboardingSelectDialog open onOpenChange={() => {}} title="Choose an agent" options={[{ value: "codex", label: "Codex" }]} value="" onValueChange={() => {}} advanceOnSelect submitLabel="Continue" onSubmit={submit} /></OnboardingSurface>)
+ expect(screen.queryByRole("button", { name: "Continue" })).toBeNull()
+ fireEvent.click(screen.getByRole("radio", { name: "Codex" }))
+ expect(submit).toHaveBeenCalledExactlyOnceWith("codex")
+ })
+ it("keeps explicit submission for later choices", () => {
+ const submit = vi.fn()
+ render(<OnboardingSurface><OnboardingSelectDialog open onOpenChange={() => {}} title="Your role" options={[{ value: "work", label: "Work" }]} value="work" onValueChange={() => {}} submitLabel="Finish setup" onSubmit={submit} /></OnboardingSurface>)
+ fireEvent.click(screen.getByRole("button", { name: "Finish setup" }))
+ expect(submit).toHaveBeenCalledExactlyOnceWith("work")
+ })
+})
diff --git a/src/web/src/components/community/onboarding/onboarding-select-dialog.tsx b/src/web/src/components/community/onboarding/onboarding-select-dialog.tsx
index a16dddbc0..9ad5495f3 100644
--- a/src/web/src/components/community/onboarding/onboarding-select-dialog.tsx
+++ b/src/web/src/components/community/onboarding/onboarding-select-dialog.tsx
@@ -74,6 +74,7 @@ export type OnboardingSelectDialogProps = {
}
customValue?: string
onCustomValueChange?: (value: string) => void
+ advanceOnSelect?: boolean
submitLabel: string
loadingLabel?: string
onSubmit: (value: string) => void
@@ -109,6 +110,7 @@ export function OnboardingSelectDialog({
customValue = "",
onCustomValueChange,
submitLabel,
+ advanceOnSelect = false,
loadingLabel = "Saving…",
onSubmit,
secondaryLabel,
@@ -132,12 +134,14 @@ export function OnboardingSelectDialog({
const invalid = status === "error"
const handleValueChange = (nextValue: string) => {
+ if (locked) return
const nextState = selectOnboardingOption(
{ value, customValue },
nextValue,
customOption?.value,
)
onValueChange(nextState.value)
+ if (advanceOnSelect && nextState.value && nextState.value !== customOption?.value) onSubmit(nextState.value)
if (nextState.customValue !== customValue) {
onCustomValueChange?.(nextState.customValue)
}
@@ -322,7 +326,7 @@ export function OnboardingSelectDialog({
) : null}
</div>
- <DialogFooter className="m-0 rounded-none border-0 bg-transparent px-4 py-4 sm:px-6">
+ {!advanceOnSelect && <DialogFooter className="m-0 rounded-none border-0 bg-transparent px-4 py-4 sm:px-6">
{secondaryLabel && onSecondaryAction ? (
<Button
type="button"
@@ -346,7 +350,7 @@ export function OnboardingSelectDialog({
) : null}
{status === "loading" ? loadingLabel : submitLabel}
</Button>
- </DialogFooter>
+ </DialogFooter>}
</form>
</DialogContent>
</Dialog>
diff --git a/src/web/src/components/home/document-navigation-link.dom.test.tsx b/src/web/src/components/home/document-navigation-link.dom.test.tsx
new file mode 100644
index 000000000..c16fc2a0e
--- /dev/null
+++ b/src/web/src/components/home/document-navigation-link.dom.test.tsx
@@ -0,0 +1,59 @@
+import { describe, expect, it, vi } from "vitest"
+import { act, fireEvent, render, screen } from "@/test/react-dom-harness"
+import { DocumentNavigationLink } from "./document-navigation-link"
+
+function mount() {
+ return render(<div onClick={event => event.preventDefault()}>
+ <DocumentNavigationLink href="/sign-in">Get started</DocumentNavigationLink>
+ <DocumentNavigationLink href="/sign-in">Sign in</DocumentNavigationLink>
+ </div>)
+}
+
+describe("document navigation feedback", () => {
+ it("marks only the clicked entrance while preserving the native link and its content", () => {
+ mount()
+ const [clicked, untouched] = screen.getAllByRole("link")
+ fireEvent.click(clicked)
+ expect(clicked).toHaveAttribute("aria-busy", "true")
+ expect(untouched).not.toHaveAttribute("aria-busy")
+ expect(clicked).toHaveAttribute("href", "/sign-in")
+ expect(screen.getByRole("status")).toHaveTextContent("Opening…")
+ expect(screen.getByText("Get started")).toHaveStyle({ visibility: "hidden" })
+ expect(clicked).not.toHaveAttribute("aria-disabled")
+ fireEvent.click(clicked)
+ expect(clicked).toHaveAttribute("aria-busy", "true")
+ })
+
+ it.each(["pageshow", "Escape"])("restores feedback after %s and allows another attempt", event => {
+ mount()
+ const clicked = screen.getAllByRole("link")[0]
+ fireEvent.click(clicked)
+ act(() => { window.dispatchEvent(event === "Escape" ? new KeyboardEvent("keydown", { key: "Escape" }) : new Event("pageshow")) })
+ expect(clicked).not.toHaveAttribute("aria-busy")
+ expect(screen.queryByRole("status")).toBeNull()
+ fireEvent.click(clicked)
+ expect(clicked).toHaveAttribute("aria-busy", "true")
+ })
+
+ it.each([{ ctrlKey: true }, { metaKey: true }, { shiftKey: true }, { altKey: true }, { button: 1 }])("does not mark modified click %j", modifiers => {
+ mount()
+ const clicked = screen.getAllByRole("link")[0]
+ fireEvent.click(clicked, modifiers)
+ expect(clicked).not.toHaveAttribute("aria-busy")
+ })
+
+ it.each([{ target: "_blank" }, { download: "file" }, { onClick: (event: React.MouseEvent) => event.preventDefault() }])("does not mark a different browsing context or cancelled click", props => {
+ render(<div onClick={event => event.preventDefault()}><DocumentNavigationLink href="/sign-in" {...props}>Continue</DocumentNavigationLink></div>)
+ fireEvent.click(screen.getByRole("link"))
+ expect(screen.getByRole("link")).not.toHaveAttribute("aria-busy")
+ })
+
+ it("does not prevent default document navigation and preserves the caller callback", () => {
+ const callback = vi.fn()
+ render(<DocumentNavigationLink href="/sign-in" onClick={callback}>Continue</DocumentNavigationLink>)
+ const event = new MouseEvent("click", { bubbles: true, cancelable: true })
+ act(() => { screen.getByRole("link").dispatchEvent(event) })
+ expect(event.defaultPrevented).toBe(false)
+ expect(callback).toHaveBeenCalledOnce()
+ })
+})
diff --git a/src/web/src/components/home/document-navigation-link.module.css b/src/web/src/components/home/document-navigation-link.module.css
new file mode 100644
index 000000000..7ff6d2d30
--- /dev/null
+++ b/src/web/src/components/home/document-navigation-link.module.css
@@ -0,0 +1,37 @@
+.link {
+ position: relative;
+}
+
+.content {
+ display: contents;
+}
+
+.link[aria-busy="true"] {
+ cursor: progress;
+}
+
+.pending {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.5rem;
+ letter-spacing: normal;
+ white-space: nowrap;
+}
+
+.spinner {
+ width: 1em;
+ height: 1em;
+ flex-shrink: 0;
+ animation: spin 1s linear infinite;
+}
+
+@keyframes spin {
+ to { transform: rotate(360deg); }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .spinner { animation: none; }
+}
diff --git a/src/web/src/components/home/document-navigation-link.tsx b/src/web/src/components/home/document-navigation-link.tsx
new file mode 100644
index 000000000..3302ad5e3
--- /dev/null
+++ b/src/web/src/components/home/document-navigation-link.tsx
@@ -0,0 +1,34 @@
+"use client"
+
+import { useEffect, useState, type ComponentPropsWithoutRef } from "react"
+import { LoaderCircle } from "lucide-react"
+import styles from "./document-navigation-link.module.css"
+
+export function DocumentNavigationLink({ children, className, onClick, ...props }: ComponentPropsWithoutRef<"a">) {
+ const [pending, setPending] = useState(false)
+
+ useEffect(() => {
+ if (!pending) return
+ const reset = () => setPending(false)
+ const cancel = (event: KeyboardEvent) => { if (event.key === "Escape") reset() }
+ window.addEventListener("pageshow", reset)
+ window.addEventListener("keydown", cancel)
+ return () => {
+ window.removeEventListener("pageshow", reset)
+ window.removeEventListener("keydown", cancel)
+ }
+ }, [pending])
+
+ return (
+ <a {...props} className={`${className ?? ""} ${styles.link}`} aria-busy={pending || undefined}
+ onClick={event => {
+ onClick?.(event)
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return
+ if (!props.href || (props.target && props.target !== "_self") || (props.download !== undefined && props.download !== false)) return
+ setPending(true)
+ }}>
+ <span className={styles.content} style={{ visibility: pending ? "hidden" : undefined }}>{children}</span>
+ {pending && <span className={styles.pending} role="status"><LoaderCircle aria-hidden="true" className={styles.spinner} />Opening…</span>}
+ </a>
+ )
+}
diff --git a/src/web/src/components/home/hero-section.tsx b/src/web/src/components/home/hero-section.tsx
index 20a4ea255..91c5e3425 100644
--- a/src/web/src/components/home/hero-section.tsx
+++ b/src/web/src/components/home/hero-section.tsx
@@ -1,5 +1,7 @@
"use client";
+import { DocumentNavigationLink } from "./document-navigation-link"
+
import { DISCORD_INVITE_URL } from "@/lib/discord-invite"
/* eslint-disable @next/next/no-html-link-for-pages -- Product entrances require a new document to unload public tracking. */
@@ -253,7 +255,7 @@ export function HeroSection({
{primaryCtaLabel ?? "OPEN APP"}
</a>
) : (
- <a
+ <DocumentNavigationLink
href="/sign-in"
onClick={() => trackLandingCtaClicked({ cta_name: "get_started" })}
className={`inline-flex items-center gap-2 transition-all duration-200 hover:opacity-80 ${ctaSizingClassName}`}
@@ -270,7 +272,7 @@ export function HeroSection({
<line x1="15" y1="12" x2="3" y2="12" />
</svg>
{primaryCtaLabel ?? "GET STARTED"}
- </a>
+ </DocumentNavigationLink>
)}
{secondaryCta !== null && (
secondaryCta?.kind === "github" ? (
diff --git a/src/web/src/components/home/landing-page.tsx b/src/web/src/components/home/landing-page.tsx
index 8df18a054..58c73d511 100644
--- a/src/web/src/components/home/landing-page.tsx
+++ b/src/web/src/components/home/landing-page.tsx
@@ -1,5 +1,7 @@
"use client"
+import { DocumentNavigationLink } from "./document-navigation-link"
+
import Image from "next/image"
import { useCallback, useState } from "react"
import { LANDING_HUMAN_AVATARS } from "./landing-human-avatars"
@@ -96,7 +98,7 @@ export function LandingPage({ isLoggedIn }: { isLoggedIn: boolean }) {
)}
</span>
))}
- <a
+ <DocumentNavigationLink
href={isLoggedIn ? "/c/me" : "/sign-in"}
className={styles.closingAction}
data-testid="landing-closing-open"
@@ -104,7 +106,7 @@ export function LandingPage({ isLoggedIn }: { isLoggedIn: boolean }) {
>
{isLoggedIn ? LANDING_HERO.loggedInCta : LANDING_HERO.loggedOutCta}{" "}
<span aria-hidden>↗</span>
- </a>
+ </DocumentNavigationLink>
</div>
</div>
</section>
diff --git a/src/web/src/components/home/marketing-nav.tsx b/src/web/src/components/home/marketing-nav.tsx
index 1f1ecc70d..b1816ffdb 100644
--- a/src/web/src/components/home/marketing-nav.tsx
+++ b/src/web/src/components/home/marketing-nav.tsx
@@ -1,5 +1,7 @@
"use client";
+import { DocumentNavigationLink } from "./document-navigation-link"
+
import { DISCORD_INVITE_URL } from "@/lib/discord-invite"
/* eslint-disable @next/next/no-html-link-for-pages -- Product entrances require a new document to unload public tracking. */
@@ -198,7 +200,7 @@ export function MarketingNav({
</svg>
</a>
) : (
- <a
+ <DocumentNavigationLink
href="/sign-in"
onClick={() => trackLandingCtaClicked({ cta_name: "public_nav_get_started" })}
className="inline-flex items-center gap-2 px-4 py-2 text-xs uppercase tracking-widest transition-opacity duration-150 hover:opacity-70"
@@ -209,7 +211,7 @@ export function MarketingNav({
}}
>
{ctaLabel ?? "Get Started"}
- </a>
+ </DocumentNavigationLink>
)}
</div>
</div>
diff --git a/src/web/src/test/e2e-ui/31-machine-guide-motion.spec.ts b/src/web/src/test/e2e-ui/31-machine-guide-motion.spec.ts
index af2128cb7..252214927 100644
--- a/src/web/src/test/e2e-ui/31-machine-guide-motion.spec.ts
+++ b/src/web/src/test/e2e-ui/31-machine-guide-motion.spec.ts
@@ -18,9 +18,10 @@ test("first-signup mobile starts onboarding once and retains it on desktop", asy
const onboarding = page.getByTestId(tid.onboardingHarnessDialog)
await expect(onboarding).toBeVisible()
+ await expect(page.getByText("Pick your local agent", { exact: true })).toBeVisible()
+ await expect(onboarding.getByRole("button", { name: "Continue", exact: true })).toHaveCount(0)
await expect(onboarding.getByRole("heading", { name: "Which harness do you already use?" })).toBeVisible()
await page.getByTestId(tid.onboardingHarnessOption("grok")).click()
- await onboarding.getByRole("button", { name: "Continue", exact: true }).click()
await expect(page.getByTestId(tid.onboardingAgentDialog)).toBeVisible()
await page.setViewportSize({ width: 1280, height: 800 })
@@ -41,6 +42,8 @@ test("first-signup desktop opens onboarding before the empty Machines guide", as
const onboarding = page.getByTestId(tid.onboardingHarnessDialog)
await expect(onboarding).toBeVisible()
+ await expect(page.getByText("Pick your local agent", { exact: true })).toBeVisible()
+ await expect(onboarding.getByRole("button", { name: "Continue", exact: true })).toHaveCount(0)
await expect(
onboarding.getByRole("heading", { name: "Which harness do you already use?" }),
).toBeVisible()
@@ -52,7 +55,6 @@ test("first-signup desktop opens onboarding before the empty Machines guide", as
await expect(grok).toContainText("Grok Build")
await expect(grok.locator('[data-provider-logo="grok"]')).toBeVisible()
await grok.click()
- await onboarding.getByRole("button", { name: "Continue", exact: true }).click()
const agentStep = page.getByTestId(tid.onboardingAgentDialog)
await expect(agentStep).toBeVisible()
diff --git a/src/web/src/test/e2e-ui/55-message-scroll-characterization.spec.ts b/src/web/src/test/e2e-ui/55-message-scroll-characterization.spec.ts
index c557c01c1..99d73381d 100644
--- a/src/web/src/test/e2e-ui/55-message-scroll-characterization.spec.ts
+++ b/src/web/src/test/e2e-ui/55-message-scroll-characterization.spec.ts
@@ -619,6 +619,8 @@ test.describe("message scroll characterization", () => {
const batches = [["👍", "❤️", "😂", "🎉", "👀"], ["🚀", "✅", "🔥", "💯", "🤔"]]
await gotoAfterUserWsAuth(page, `/c/channels/${serverId}/${channelId}`)
const scroller = page.getByTestId(tid.messageScroller)
+ await expect(scroller.locator('[data-message-list-content]')).toHaveAttribute("data-read-position-ready", "true")
+ await waitForCommittedGeometry(scroller)
await scroller.evaluate(element => { element.scrollTop = 0; element.dispatchEvent(new Event("scroll")) })
await expect(page.getByTestId(tid.message(messageId))).toHaveCount(1)
await scroller.evaluate((element, id) => {
diff --git a/src/web/src/test/e2e/device-code.test.ts b/src/web/src/test/e2e/device-code.test.ts
index 5816a8e61..8bd27cfe1 100644
--- a/src/web/src/test/e2e/device-code.test.ts
+++ b/src/web/src/test/e2e/device-code.test.ts
@@ -51,7 +51,7 @@ describe("retired CLI connection", () => {
const response = await fetch(`${appUrl}/onboard.md`)
expect(response.status).toBe(200)
const guide = await response.text()
- expect(guide).toContain("[agent.md](./agent.md)")
+ expect(guide).toContain("[agent.md](https://alook.ai/agent.md)")
expect(guide).toContain("use server --members")
expect(guide).not.toContain("/api/auth/device")
})