A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.
TypeScript
feat(ui): choose subscription or API key first in Accounts, like Pi's /login
Alan Buscaglia7337b52b6a74
diff --git a/odd/tasks/gentle-dot.md b/odd/tasks/gentle-dot.mdindex 8fe7997..9f46f39 100644--- a/odd/tasks/gentle-dot.md+++ b/odd/tasks/gentle-dot.md@@ -37,6 +37,7 @@ Branch: `feat/gentle-dot` · Delivery strategy: `single-pr` (user choice, L7; fo- Checks: UI tests for state classes; a screenshot review of every state; tray and app icons regenerated.- **S10 — Sign in from the assistant itself.** User: "tenemos que tener la posibilidad de, desde lo que es el bot, poder hacer un login para las suscripciones y demás de que ya soporta API, bien, que ya soporta genteel Cell. Tenemos que tener esa capacidad. Eso es muy importante." "Puede ser alguna opción, hacer un barra login desde ahí mismo, etcétera. Te lo digo porque la idea es que esto es para las personas que no saben determinar eso, literal."- Change (L25): user: "y solo aparece para loguearse con claude, que justo es algo que no anda proque no esta soportado por pi de forma legal, tenemos que ofrecer todas las otras opciones, de ultima para todo lo que no es sub que sea por api". The Claude (Anthropic) subscription sign-in is not offered (Anthropic is API key only, and the daemon refuses an Anthropic OAuth login). The accounts screen shows every other subscription first, then API keys for everything else.+ - Change (L26): user: "entonces demos una mejor variante, elegir entre sub y api primero". The accounts screen first asks for the method (subscription or API key), then lists the providers for that method, like Pi's `/login`.- Acceptance: from the panel or web UI, without a terminal, the user can sign in to every subscription provider except Anthropic and to every API key that Gentle Shell supports. That works both from a visible option and by typing `/login`, with plain-language guidance. Credentials stay where Gentle Shell keeps them and never pass through logs or the UI after entry.- Checks: to be defined after exploring how Gentle Shell performs login in RPC mode.- **S11 — Create and edit profiles from the assistant.** User: "También la de crear profiles y modificarlos, como tenemos ahora, bien, pero desde el bot mismo."@@ -48,6 +49,10 @@ Branch: `feat/gentle-dot` · Delivery strategy: `single-pr` (user choice, L7; fo- Checks: integration test of the spawn arguments and environment; a smoke run with a fresh data dir and no `gentle-shell` on PATH.- Decided (L20): profiles are the assistant's own, with a one-time "Import my Gentle Shell profiles" action when an existing setup is found.+- **S13 — Linux desktop app for Debian, Ubuntu, and Omarchy.** User: "Para lo de Linux... la que use debian, ubuntu o omarchy" (answering whether to port for X11 only or also Wayland, L21).+ - Acceptance: the desktop app builds and runs on Debian and Ubuntu (GNOME, Wayland by default) and Omarchy (Arch with Hyprland, Wayland). The floating rose, panel, tray, and toggle shortcut work on each. Where Wayland forbids it (self-positioning, always-on-top, app-registered global shortcuts), a documented fallback is used: XWayland for the GNOME session, Hyprland window rules plus a bind for Omarchy, and a `toggle` entry point a desktop shortcut can call. Packages: `.deb` for Debian/Ubuntu and AppImage (also usable on Arch).+ - Checks: Rust unit tests per platform branch; a Linux build of the app (.deb and AppImage) in a Debian container; GUI behavior on real Linux desktops is not verifiable from this Mac unless a VM is available — reported as such.+## Tasks| ID | Specs | Route | Status | Commit / evidence | Scope |@@ -65,8 +70,9 @@ Branch: `feat/gentle-dot` · Delivery strategy: `single-pr` (user choice, L7; fo| T11 | S10 | explore (delegated) then inline | done | `43a512d` RED → GREEN: 12 daemon auth tests (fake runtime + real offline ModelRuntime), 9 UI tests, e2e 8/8 incl. `/login` + API key connect/disconnect | Login from the UI for subscriptions and API keys (`/login` and a visible option) || T12 | S11 | explore (delegated) then delegated writer (context backstop; parallel with T10) | done | see L23; RED → GREEN per layer; parent re-ran 179 tests + typecheck | Profiles: list, create, edit, switch from the UI || T13 | S12 | inline | done | `43a512d` config + spawn tests; real smoke without gentle-shell on PATH: own home created, 42 providers, none configured | Bundle `gentle-pi`, own `--home` and profile store, first-run timeout, no PATH dependency |-| T14 | — (evaluation only, L21) | inline | pending | — | Linux port of the desktop app: per-platform window effects, tray icon, Wayland fallbacks, AppImage/deb bundles |+| T14 | S13 | delegated writer (after T15, shares apps/desktop) | pending | — | Linux port of the desktop app: per-platform window effects, tray icon, Wayland fallbacks, AppImage/deb bundles || T15 | S6, S7, S11, S12, S9 | delegated writers (parallel: daemon/isolation vs. Dot circle) | in progress | — | One correction batch for verifier blockers B1–B4 and the S9 circle change, then a recheck limited to them |+| T16 | S10 | inline | in progress | — | Accounts in two steps: method first, then provider || T9 | S1–S6, S9–S12 | delegated verifier (high risk: process supervision, auth) | pending | — | Full verification: unit, integration, Playwright, `@real-agent`, `tauri build` + launch, manual macOS checklist with observed results |Environment notes: Node v24.14.1 and pnpm are present. `cargo` is on PATH but `rustc` is not, so T7 must first install or repair the Rust toolchain (rustup) and asks before installing. Xcode is present.@@ -98,4 +104,5 @@ Environment notes: Node v24.14.1 and pnpm are present. `cargo` is on PATH but `r- **L23 (2026-10-08, T12 evidence):** The writer stalled once on a bash command and was resumed in its own session with timeouts on every long command. The daemon reimplements the `gentle-pi.agent_model_profiles` v1 store: atomic 0600 writes through one queue. Applying a profile writes the four files in order, restores all four on failure, never touches agent `.md` files, then sends `set_model` and `set_thinking_level` (deferred until `agent_settled` while busy). Models forward only provider, id, name, and reasoning (a gateway test asserts that `headers` never reach a client). The import is read-only, skips `active`, renames collisions to `-imported[-N]`, and reports missing sign-ins. Extras beyond the request: editing the active profile re-applies it, identical imports are skipped, and Delete is disabled for the active profile. `SettingsManager` was not used because it cannot delete `defaultThinkingLevel`; a `settings.json.lock` mkdir lock (stale after 10 s) mimics proper-lockfile. Verification: 179 tests passed (2 opt-in skipped), typecheck OK, biome OK, e2e 9/9 (the e2e test was written after the implementation, so no RED). Open for T9: `set_model` against the real engine, lock compatibility with proper-lockfile, and one flaky `supervisor.test.ts:54` (busy after settle), seen once in four runs.- **L24 (2026-10-08, T9 evidence and user feedback):** Independent verifier (scratch copy, temp HOME): runners all green (179 tests, typecheck, lint, e2e 9/9, cargo 34/34, `test:real` 2/2, supervisor ×10 = 10/10). Verdicts: pass S2, S3, S4, S5, S8, S10; not verifiable S1, S9; FAIL S6, S7, S11, S12. BLOCKERS: B1 the token printed by `cli.ts:21` lands in `~/.gentle-dot/daemon.log` (0644, dir 0755), readable by other local users. B2 the first run writes outside the instance (`~/.gentle-shell/config.json` provisioned mark, `~/.pi/agent/pi-pretty/fff/*.mdb` via a fixed `$HOME`, `~/.gentle-ai/state.json`, and `~/.gentle-ai/backups`). B3 with the default workspace `~`, the engine reads `~/.pi/gentle-ai/models.json` as project config and writes it into `<data>/agent/agents/*.md` frontmatter, and an applied profile that omits a role does not clear that frontmatter. B4 deploy-vps step 3 (`docker compose run … gentle-shell`) cannot work. Advisories: generic error with no account; a `busy` race in `supervisor.ts:118-123`; stale `ready.model` after `set_model`; `auth_logout` accepts any providerId; `auth_reply` has no owner check; symlinked session files are accepted; rollback leaves 0600; internal role ids in the payload; unpinned `engram@latest`; the token in `docker logs`. App launched on the user's Mac: CGWindowList shows the Dot window floating (layer 5) but at 59×76 and about 106 px from the edge, against a saved 64×84 at a 12 pt margin; screenshots are not possible (no screen-recording permission). User: menu bar icon and menu OK; clicking the rose or ⌥ Space opens the panel beside it; on the rose: "ponle un fondo negro y que sea un circulo".- **L25 (2026-10-08, user):** S10 change quote. Reproduced: the accounts list is alphabetical with 42 rows, so the only subscription button on the first screen is "Sign in with Anthropic (Claude Pro/Max)", and ChatGPT, Copilot, Grok, Kimi, Meta, OpenRouter, and Radius sit far below among the API keys. Fix: a daemon policy that drops and refuses Anthropic OAuth (sent to the T15 daemon writer), and an accounts UI with a "Use your subscription" section first and "Use an API key" below (parent, inline).-- **Next step:** T15 correction batch, then a recheck limited to B1–B4, the circle, the window size, and the L25 change; T14 when authorized.+- **L26 (2026-10-08, user):** "entonces demos una mejor variante, elegir entre sub y api primero. Para lo de Linux... la que use debian, ubuntu o omarchy". The user had shared screenshots of Pi's `/login` showing the method choice and the 9 subscription providers (Anthropic, GitHub Copilot, Kimi For Coding, Meta, OpenAI, OpenAI Codex (legacy), OpenRouter, Radius, xAI), which matches the assistant's list; rows now use provider names with the plan underneath (`7998aea`). Linux targets all default to Wayland (Debian/Ubuntu GNOME, Omarchy Hyprland), so S13 includes Wayland fallbacks.+- **Next step:** T16 inline; T15 writers finish, then the limited recheck; then T14 (Linux).diff --git a/packages/ui/src/accounts.css b/packages/ui/src/accounts.cssindex 160b153..82f75b5 100644--- a/packages/ui/src/accounts.css+++ b/packages/ui/src/accounts.css@@ -12,6 +12,45 @@color: var(--muted);}+.method-choices {+ display: flex;+ flex-direction: column;+ gap: 10px;+ margin-top: 14px;+}++.method-choice {+ display: flex;+ flex-direction: column;+ align-items: flex-start;+ gap: 4px;+ padding: 14px;+ border-radius: 14px;+ text-align: left;+}++.method-choice b {+ font-size: 14px;+}++.method-choice span {+ font-size: 12px;+ line-height: 16px;+ color: var(--muted);+}++.connected-row {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+}++button.back {+ margin: 4px 0 10px;+ padding: 0;+}+.provider-plan {margin: -4px 0 8px;font-size: 12px;diff --git a/packages/ui/src/components/AccountsPanel.tsx b/packages/ui/src/components/AccountsPanel.tsxindex 7d3bd99..46c07e7 100644--- a/packages/ui/src/components/AccountsPanel.tsx+++ b/packages/ui/src/components/AccountsPanel.tsx@@ -14,6 +14,7 @@ interface AccountsPanelProps {/** Sign-in for subscriptions and API keys, without a terminal. */export function AccountsPanel({ auth, send, dispatch, openUrl }: AccountsPanelProps) {const [filter, setFilter] = useState("");+ const [method, setMethod] = useState<"oauth" | "api_key" | undefined>(undefined);const flow = auth.flow;const busy = flow !== undefined && flow.done === undefined;const login = (provider: AuthProvider, method: "oauth" | "api_key") => {@@ -23,6 +24,7 @@ export function AccountsPanel({ auth, send, dispatch, openUrl }: AccountsPanelPrconst providers = (auth.providers ?? []).filter((p) =>p.name.toLowerCase().includes(filter.trim().toLowerCase()),);+ const connected = (auth.providers ?? []).filter((p) => p.configured);const providerName = (id: string) => auth.providers?.find((p) => p.id === id)?.name ?? id;return (@@ -74,8 +76,55 @@ export function AccountsPanel({ auth, send, dispatch, openUrl }: AccountsPanelPr) : null}</div></div>+ ) : method === undefined ? (+ <>+ {connected.length > 0 ? (+ <section className="provider-section" aria-labelledby="accounts-connected">+ <h3 id="accounts-connected">Connected</h3>+ <ul className="providers">+ {connected.map((provider) => (+ <li key={provider.id} className="connected-row">+ <b>{provider.name}</b>+ {provider.source === "stored" ? (+ <button+ type="button"+ className="link"+ aria-label={`Sign out of ${provider.name}`}+ onClick={() => send({ type: "auth_logout", providerId: provider.id })}+ >+ Sign out+ </button>+ ) : (+ <span className="muted">from your computer's settings</span>+ )}+ </li>+ ))}+ </ul>+ </section>+ ) : null}+ <div className="method-choices">+ <button type="button" className="method-choice" onClick={() => setMethod("oauth")}>+ <b>Use a subscription</b>+ <span>Sign in with a plan you already pay for, like ChatGPT, GitHub Copilot, or Grok.</span>+ </button>+ <button type="button" className="method-choice" onClick={() => setMethod("api_key")}>+ <b>Use an API key</b>+ <span>Paste a key from the provider's website. Works with every service.</span>+ </button>+ </div>+ </>) : (<>+ <button+ type="button"+ className="link back"+ onClick={() => {+ setMethod(undefined);+ setFilter("");+ }}+ >+ Back+ </button><inputtype="search"className="accounts-search"@@ -84,36 +133,43 @@ export function AccountsPanel({ auth, send, dispatch, openUrl }: AccountsPanelPrvalue={filter}onChange={(event) => setFilter(event.target.value)}/>- <ProviderSection- title="Use your subscription"- hint="Sign in with a plan you already pay for."- providers={providers.filter((p) => p.methods.includes("oauth"))}- label={(p) => p.name}- plan={(p) => (p.oauthName && p.oauthName !== p.name ? p.oauthName : undefined)}- action={(p) => (- <button- type="button"- className="primary"- aria-label={`Sign in with ${p.oauthName ?? p.name}`}- onClick={() => login(p, "oauth")}- >- Sign in- </button>- )}- send={send}- />- <ProviderSection- title="Use an API key"- hint="For every other service: paste the key from its website."- providers={providers.filter((p) => p.methods.includes("api_key"))}- label={(p) => p.name}- action={(p) => (- <button type="button" onClick={() => login(p, "api_key")}>- Use an API key- </button>- )}- send={send}- />+ {method === "oauth" ? (+ <ProviderSection+ title="Use a subscription"+ hint="Sign in with a plan you already pay for."+ providers={providers.filter((p) => p.methods.includes("oauth"))}+ label={(p) => p.name}+ plan={(p) => (p.oauthName && p.oauthName !== p.name ? p.oauthName : undefined)}+ action={(p) => (+ <button+ type="button"+ className="primary"+ aria-label={`Sign in with ${p.oauthName ?? p.name}`}+ onClick={() => login(p, "oauth")}+ >+ Sign in+ </button>+ )}+ send={send}+ />+ ) : (+ <ProviderSection+ title="Use an API key"+ hint="Paste the key from the provider's website."+ providers={providers.filter((p) => p.methods.includes("api_key"))}+ label={(p) => p.name}+ action={(p) => (+ <button+ type="button"+ aria-label={`Use an API key for ${p.name}`}+ onClick={() => login(p, "api_key")}+ >+ Use an API key+ </button>+ )}+ send={send}+ />+ )}</>)}</section>diff --git a/packages/ui/test/accounts.test.tsx b/packages/ui/test/accounts.test.tsxindex f6df239..e5237fc 100644--- a/packages/ui/test/accounts.test.tsx+++ b/packages/ui/test/accounts.test.tsx@@ -66,22 +66,8 @@ describe("auth state", () => {});describe("AccountsPanel", () => {- it("lists providers with their status and sign-in options", async () => {- const send = vi.fn();- const dispatch = vi.fn();- render(<AccountsPanel auth={base().auth} send={send} dispatch={dispatch} openUrl={vi.fn()} />);- // A provider with both methods appears once in each section.- expect(screen.getAllByText("Anthropic")).toHaveLength(2);- expect(screen.getByText("Connected")).toBeInTheDocument();- await userEvent.click(screen.getByRole("button", { name: "Sign in with Claude Pro/Max" }));- expect(send).toHaveBeenCalledWith({ type: "auth_login", providerId: "anthropic", method: "oauth" });- expect(dispatch).toHaveBeenCalledWith({ type: "auth_started", providerId: "anthropic" });- await userEvent.click(screen.getAllByRole("button", { name: "Use an API key" })[0] as HTMLElement);- expect(send).toHaveBeenCalledWith({ type: "auth_login", providerId: "anthropic", method: "api_key" });- });-- it("lists subscriptions first and API keys below", () => {- const auth = apply(base(), {+ const mixed = () =>+ apply(base(), {type: "auth_providers",providers: [{ id: "anthropic", name: "Anthropic", methods: ["api_key"], configured: false },@@ -99,32 +85,59 @@ describe("AccountsPanel", () => {oauthName: "OpenAI (ChatGPT Plus/Pro)",configured: false,},- { id: "openai", name: "OpenAI", methods: ["api_key"], configured: false },+ { id: "openai", name: "OpenAI", methods: ["api_key"], configured: true, source: "stored" },],}).auth;- render(<AccountsPanel auth={auth} send={vi.fn()} dispatch={vi.fn()} openUrl={vi.fn()} />);- const subscriptions = screen.getByRole("region", { name: "Use your subscription" });- const keys = screen.getByRole("region", { name: "Use an API key" });- expect(subscriptions.compareDocumentPosition(keys) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();++ it("asks for the method first, like Pi's /login", () => {+ render(<AccountsPanel auth={mixed()} send={vi.fn()} dispatch={vi.fn()} openUrl={vi.fn()} />);+ expect(screen.getByRole("button", { name: /Use a subscription/ })).toBeInTheDocument();+ expect(screen.getByRole("button", { name: /Use an API key/ })).toBeInTheDocument();+ expect(screen.queryByRole("searchbox")).toBeNull();+ expect(screen.queryByText("GitHub Copilot")).toBeNull();+ });++ it("shows connected accounts on the first step and signs out", async () => {+ const send = vi.fn();+ render(<AccountsPanel auth={mixed()} send={send} dispatch={vi.fn()} openUrl={vi.fn()} />);+ const connected = screen.getByRole("region", { name: "Connected" });+ expect(within(connected).getByText("OpenAI")).toBeInTheDocument();+ await userEvent.click(within(connected).getByRole("button", { name: "Sign out of OpenAI" }));+ expect(send).toHaveBeenCalledWith({ type: "auth_logout", providerId: "openai" });+ });++ it("lists only subscriptions after choosing a subscription, named like Pi's account list", async () => {+ const send = vi.fn();+ const dispatch = vi.fn();+ render(<AccountsPanel auth={mixed()} send={send} dispatch={dispatch} openUrl={vi.fn()} />);+ await userEvent.click(screen.getByRole("button", { name: /Use a subscription/ }));+ const list = screen.getByRole("region", { name: "Use a subscription" });expect(- within(subscriptions)- .getAllByRole("button")+ within(list)+ .getAllByRole("button", { name: /^Sign in with/ }).map((b) => b.getAttribute("aria-label")),).toEqual(["Sign in with GitHub Copilot", "Sign in with OpenAI (ChatGPT Plus/Pro)"]);- // Rows read like Pi's account list: the provider name, with the plan underneath when it differs.- expect(within(subscriptions).getByText("OpenAI Codex")).toBeInTheDocument();- expect(within(subscriptions).getByText("OpenAI (ChatGPT Plus/Pro)")).toHaveClass("provider-plan");- expect(within(subscriptions).queryAllByText("GitHub Copilot")).toHaveLength(1);- expect(within(keys).getByText("Anthropic")).toBeInTheDocument();- expect(within(keys).getByText("OpenAI")).toBeInTheDocument();- expect(within(keys).queryByText("GitHub Copilot")).toBeNull();+ expect(within(list).getByText("OpenAI Codex")).toBeInTheDocument();+ expect(within(list).getByText("OpenAI (ChatGPT Plus/Pro)")).toHaveClass("provider-plan");+ expect(within(list).queryByText("Anthropic")).toBeNull();+ await userEvent.click(within(list).getByRole("button", { name: "Sign in with GitHub Copilot" }));+ expect(dispatch).toHaveBeenCalledWith({ type: "auth_started", providerId: "github-copilot" });+ expect(send).toHaveBeenCalledWith({ type: "auth_login", providerId: "github-copilot", method: "oauth" });});- it("filters providers by name", async () => {- render(<AccountsPanel auth={base().auth} send={vi.fn()} dispatch={vi.fn()} openUrl={vi.fn()} />);+ it("lists API keys after choosing an API key, with search and a way back", async () => {+ const send = vi.fn();+ render(<AccountsPanel auth={mixed()} send={send} dispatch={vi.fn()} openUrl={vi.fn()} />);+ await userEvent.click(screen.getByRole("button", { name: /Use an API key/ }));+ const list = screen.getByRole("region", { name: "Use an API key" });+ expect(within(list).getByText("Anthropic")).toBeInTheDocument();+ expect(within(list).queryByText("GitHub Copilot")).toBeNull();await userEvent.type(screen.getByRole("searchbox", { name: "Search providers" }), "open");- expect(screen.queryByText("Anthropic")).toBeNull();- expect(screen.getByText("OpenAI")).toBeInTheDocument();+ expect(within(list).queryByText("Anthropic")).toBeNull();+ await userEvent.click(within(list).getByRole("button", { name: "Use an API key for OpenAI" }));+ expect(send).toHaveBeenCalledWith({ type: "auth_login", providerId: "openai", method: "api_key" });+ await userEvent.click(screen.getByRole("button", { name: "Back" }));+ expect(screen.getByRole("button", { name: /Use a subscription/ })).toBeInTheDocument();});it("opens the sign-in page, takes the pasted code, and can cancel", async () => {