mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 01:24:30 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Onboarding asks users to connect a model before they can finish setting up their agent. > - Cloud users can start setup on a phone, where provider sign-in and key entry can be difficult. > - They need a way to find the same workspace on a computer. > - This pull request adds a copyable link on the mobile model step and defers agent creation while the handoff is offered. > - A user can open the link on desktop or continue on the phone. ## Linked Issues or Issue Description **Subsystem affected** React onboarding UI and its Cloud health metadata. **Problem or motivation** On a phone, the Cloud model step does not explain how to find the same onboarding page on a computer. The fresh agent draft is local to that browser and can leave a provisional agent behind. **Proposed solution** Offer Continue on desktop and Keep going here at the start of the mobile model step. Copy the workspace's HTTPS `/onboarding` link. Ask users to sign in to the same account on desktop and explain that they may need to enter their choices again. **Alternatives considered** The original invite URL would carry an invite token. Copying the workspace's onboarding URL lets Cloud handle sign-in through its existing entry flow. **Roadmap alignment** This is a focused improvement to the existing onboarding wizard. It uses the current Cloud workspace entry flow and keeps model selection available on mobile. **Additional context** Refs #23315 for naming-step setup drafts. Related prior work: #3594 covered a native iOS-to-web handoff token and is closed. ## What Changed - Add the Cloud mobile handoff panel and clipboard fallback. - Prefer the canonical tenant HTTPS origin and build a clean `/onboarding` URL. Older tenants can use the current HTTPS tenant origin. - Defer the provisional agent in the naming and model steps while the mobile handoff is available. Desktop and self-hosted sessions keep the early-draft behavior from #23315. - Render the step indicators as round dots inside the step buttons so the mobile touch-height rule does not stretch them. - Add browser coverage for the Cloud and self-hosted paths and unit coverage for URL handling. ## Verification - Passed 52 focused Vitest tests for the onboarding route, stepper, handoff URL, and shared clipboard policy. - Passed UI typecheck, the test-budget guard, and `git diff --check`. - Passed 23 tests in desktop Chrome with four workers, including the affected CI browser shard and the upstream early-draft regression. The handoff scenarios cover the mobile dots, clipboard success and manual fallback, same-workspace desktop re-entry via simulated sign-in, continuing on mobile, and the self-hosted flow. - Manual reproduction: use a fresh Cloud test workspace and a 390 × 844 viewport. Enter an agent name and proceed to Connect a model. Open Continue on desktop and copy the link. Open it on desktop and sign in with the same account if needed. A real Cloud sign-in was outside the local fixture. ## Risks - Setup choices from the phone may need to be entered again on desktop. - Real Cloud sign-in and in-app mobile browsers still need a live tenant check. No database migration is needed. ## Model Used - OpenAI Codex with GPT-6.2 Sol (`gpt-6.2-sol`) for branch preparation and verification. Used the terminal and Chromium. The context window size is not available in the session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Scott Tong <1504818+scotttong@users.noreply.github.com>
144 lines
5.4 KiB
TypeScript
144 lines
5.4 KiB
TypeScript
import { cn } from "../../lib/utils";
|
|
|
|
/**
|
|
* The agent arc — create the agent, connect it, review — is the part of the
|
|
* wizard a customer walks as a numbered sequence. Company creation happens in
|
|
* Cloud before the tenant is ever reached, so it is not one of these steps.
|
|
*/
|
|
export const AGENT_ARC_TOTAL_STEPS = 3;
|
|
|
|
/**
|
|
* What each segment goes to. These are the labels assistive tech reads, in
|
|
* place of a bare number: the wizard has its own step numbering, and two
|
|
* controls both announcing "Step 1" while meaning different steps is worse
|
|
* than no number at all. The strip's own "Step N of 3" line carries the count.
|
|
*/
|
|
export const AGENT_ARC_STEP_LABELS = [
|
|
"Create your first agent",
|
|
"Connect a model",
|
|
"Review",
|
|
] as const;
|
|
|
|
/** Wizard step numbers that make up the arc, in order. */
|
|
export const AGENT_ARC_WIZARD_STEPS = [3, 4, 5] as const;
|
|
|
|
/**
|
|
* The full walk, for a run that started at the front door rather than partway
|
|
* into the arc.
|
|
*
|
|
* Step 2 is absent: onboarding no longer asks for the mission, so a segment for
|
|
* it would be one the run can never fill. The run still passes *through* step 2
|
|
* on the "grow" path, which is why position is counted rather than looked up —
|
|
* see `onboardingStepPositionFor`.
|
|
*/
|
|
export const ONBOARDING_WIZARD_STEPS = [1, 3, 4, 5] as const;
|
|
|
|
/** Destinations for the full walk, in the same order. */
|
|
export const ONBOARDING_STEP_LABELS = [
|
|
"Name your organization",
|
|
"Create your first agent",
|
|
"Connect a model",
|
|
"Review",
|
|
] as const;
|
|
|
|
/**
|
|
* Position in the full walk: how many of its steps are at or behind `step`.
|
|
*
|
|
* Counted rather than indexed because the wizard visits steps the strip does
|
|
* not draw. On the mission step there is no segment to be "on", and an index
|
|
* lookup would return nothing and light none of them — reporting no progress
|
|
* from a screen the customer reached by making progress. Counting keeps the
|
|
* strip on the last segment actually completed.
|
|
*/
|
|
export function onboardingStepPositionFor(step: number): number {
|
|
return ONBOARDING_WIZARD_STEPS.filter((entry) => entry <= step).length;
|
|
}
|
|
|
|
/**
|
|
* Map a wizard step onto its position in the arc, or `null` when the step is
|
|
* outside it.
|
|
*
|
|
* The two numbering schemes exist for different reasons and must not be
|
|
* conflated: the wizard's own step numbers include entries the customer may
|
|
* never see (the front door, and the company/mission steps that are skipped
|
|
* when Cloud already created the company), while the strip counts only what
|
|
* this leg of the walk actually shows. Deriving one from the other with
|
|
* arithmetic would silently produce "Step 0 of 3" the first time a step is
|
|
* inserted ahead of the arc.
|
|
*/
|
|
export function agentArcStepFor(wizardStep: number): number | null {
|
|
const index = AGENT_ARC_WIZARD_STEPS.indexOf(wizardStep as (typeof AGENT_ARC_WIZARD_STEPS)[number]);
|
|
return index === -1 ? null : index + 1;
|
|
}
|
|
|
|
/**
|
|
* Segmented progress strip: three dots, centred over the step's own centred
|
|
* hero and heading.
|
|
*
|
|
* The "Step N of M" count is announced but not drawn. Three dots at this size
|
|
* are read in a glance — there is no counting to help with — so the line was
|
|
* spending a whole row, and the only left-aligned element on an otherwise
|
|
* centred step, to restate what the dots already say. Assistive tech has no
|
|
* glance, so the sentence stays in the accessibility tree.
|
|
*
|
|
* Segments double as the way back to a step already completed, which is the
|
|
* affordance the wizard's full-length bar provides outside the arc. A segment
|
|
* the customer may not return to stays a disabled button rather than
|
|
* disappearing: the wizard can be entered partway in, and a strip that simply
|
|
* omitted the steps behind the entry point would misreport how far along they
|
|
* are.
|
|
*/
|
|
export function Stepper({
|
|
step,
|
|
total = AGENT_ARC_TOTAL_STEPS,
|
|
labels = AGENT_ARC_STEP_LABELS,
|
|
canJumpToStep,
|
|
onJumpToStep,
|
|
}: {
|
|
step: number;
|
|
total?: number;
|
|
/**
|
|
* What each segment goes to. Defaults to the arc's three; the full walk from
|
|
* the front door passes its own four, since the same strip serves both and a
|
|
* segment announcing "Create your first agent" on the organization step would
|
|
* be worse than a bare number.
|
|
*/
|
|
labels?: readonly string[];
|
|
canJumpToStep?: (target: number) => boolean;
|
|
onJumpToStep?: (target: number) => void;
|
|
}) {
|
|
return (
|
|
<div className="mb-11 flex items-center justify-center">
|
|
{Array.from({ length: total }, (_, index) => index + 1).map((segment) => {
|
|
const jumpable = Boolean(canJumpToStep?.(segment) && onJumpToStep);
|
|
return (
|
|
<button
|
|
key={segment}
|
|
type="button"
|
|
aria-label={labels[segment - 1] ?? `Step ${segment}`}
|
|
aria-current={segment === step ? "step" : undefined}
|
|
disabled={!jumpable}
|
|
onClick={() => jumpable && onJumpToStep?.(segment)}
|
|
className={cn(
|
|
"grid h-1.5 w-3.5 shrink-0 place-items-center rounded-full",
|
|
jumpable ? "cursor-pointer" : "cursor-default",
|
|
)}
|
|
>
|
|
<span
|
|
aria-hidden="true"
|
|
className={cn(
|
|
"size-1.5 rounded-full transition-colors",
|
|
segment <= step ? "bg-foreground" : "bg-border",
|
|
)}
|
|
/>
|
|
</button>
|
|
);
|
|
})}
|
|
{/* Out of flow, so it neither takes a row nor picks up the gap. */}
|
|
<span className="sr-only">
|
|
Step {step} of {total}
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|