Skip to content

A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.

TypeScript

feat(ui): list subscriptions first and API keys below in Accounts

Alan Buscaglia7c90f6b957df
diff --git a/odd/tasks/gentle-dot.md b/odd/tasks/gentle-dot.md
index 5ff004b..8fe7997 100644
--- a/odd/tasks/gentle-dot.md
+++ b/odd/tasks/gentle-dot.md
@@ -36,7 +36,8 @@ Branch: `feat/gentle-dot` · Delivery strategy: `single-pr` (user choice, L7; fo
- Acceptance (superseded part struck by L24): ~~the floating Dot is the rose itself in a transparent window, with no circle or container~~. Its traced strokes glow, and per state a line of light travels along the rose (design sheet `docs/brand/rose-design.html`). The menu bar uses `rose-glyph.svg` as a template icon, and the app icon is the neon rose on a black squircle. Reduce motion is respected.
- 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."
- - Acceptance: from the panel or web UI, without a terminal, the user can sign in to every subscription provider and 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.
+ - 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.
+ - 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."
- Acceptance: the user can list, create, edit, and switch the same profiles Gentle Shell supports today, from the UI, without a terminal.
@@ -96,4 +97,5 @@ Environment notes: Node v24.14.1 and pnpm are present. `cargo` is on PATH but `r
- **L22 (2026-10-08, T10 evidence):** The rose is an inline SVG built from the traced strokes: 178 static outline strokes, with light traveling along the 60 longest (at 64 px the shorter ones read as flicker). Finding: macOS system WebKit does not draw CSS `drop-shadow` on `<g>` inside inline SVG, so the rose is three stacked `<svg>` layers (base, light, sparkles), each with its own glow; verified with `qlmanage` system-WebKit renders. The Dot window is 64×84 with `initial_dot_position` using the real size. There are four tray template glyphs at 18/36 px (working is a static dashed variant, not two frames), plus a neon-rose squircle app icon and the favicon. Reduce motion hides the light layer and keeps a steady glow. Risks for T9: live animation in WKWebView is not yet observed, and the working tray glyph is subtle at 18 pt. The unused `icons/tray.png` was removed.
- **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".
-- **Next step:** T15 correction batch, then a recheck limited to B1–B4, the circle, and the window size; T14 when authorized.
+- **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.
diff --git a/packages/ui/src/accounts.css b/packages/ui/src/accounts.css
new file mode 100644
index 0000000..4d14c75
--- /dev/null
+++ b/packages/ui/src/accounts.css
@@ -0,0 +1,18 @@
+.provider-section {
+ margin-top: 18px;
+}
+
+.provider-section h3 {
+ margin: 0;
+ font-size: 12px;
+ line-height: 16px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+
+.provider-section > .muted {
+ margin: 2px 0 4px;
+ font-size: 12px;
+}
diff --git a/packages/ui/src/components/AccountsPanel.tsx b/packages/ui/src/components/AccountsPanel.tsx
index f2c518b..cacfa98 100644
--- a/packages/ui/src/components/AccountsPanel.tsx
+++ b/packages/ui/src/components/AccountsPanel.tsx
@@ -1,6 +1,7 @@
import type { AuthEvent, AuthPrompt, AuthProvider } from "@gentle-dot/protocol";
-import { useState } from "react";
+import { type ReactNode, useState } from "react";
import type { AuthState, DotAction } from "../store.ts";
+import "../accounts.css";
import type { Send } from "./types.ts";
interface AccountsPanelProps {
@@ -83,43 +84,78 @@ export function AccountsPanel({ auth, send, dispatch, openUrl }: AccountsPanelPr
value={filter}
onChange={(event) => setFilter(event.target.value)}
/>
- <ul className="providers">
- {providers.map((provider) => (
- <li key={provider.id}>
- <div className="provider-name">
- <b>{provider.name}</b>
- {provider.configured ? <span className="chip ok">Connected</span> : null}
- </div>
- <div className="provider-actions">
- {provider.methods.includes("oauth") ? (
- <button type="button" className="primary" onClick={() => login(provider, "oauth")}>
- {`Sign in with ${provider.oauthName ?? provider.name}`}
- </button>
- ) : null}
- {provider.methods.includes("api_key") ? (
- <button type="button" onClick={() => login(provider, "api_key")}>
- Use an API key
- </button>
- ) : null}
- {provider.configured && provider.source === "stored" ? (
- <button
- type="button"
- className="link"
- onClick={() => send({ type: "auth_logout", providerId: provider.id })}
- >
- Sign out
- </button>
- ) : null}
- </div>
- </li>
- ))}
- </ul>
+ <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.oauthName ?? p.name}
+ action={(p) => (
+ <button type="button" className="primary" onClick={() => login(p, "oauth")}>
+ {`Sign in with ${p.oauthName ?? p.name}`}
+ </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}
+ />
</>
)}
</section>
);
}
+interface ProviderSectionProps {
+ title: string;
+ hint: string;
+ providers: AuthProvider[];
+ label: (provider: AuthProvider) => string;
+ action: (provider: AuthProvider) => ReactNode;
+ send: Send;
+}
+
+function ProviderSection({ title, hint, providers, label, action, send }: ProviderSectionProps) {
+ if (providers.length === 0) return null;
+ const id = `providers-${title.toLowerCase().replace(/\W+/g, "-")}`;
+ return (
+ <section className="provider-section" aria-labelledby={id}>
+ <h3 id={id}>{title}</h3>
+ <p className="muted">{hint}</p>
+ <ul className="providers">
+ {providers.map((provider) => (
+ <li key={provider.id}>
+ <div className="provider-name">
+ <b>{label(provider)}</b>
+ {provider.configured ? <span className="chip ok">Connected</span> : null}
+ </div>
+ <div className="provider-actions">
+ {action(provider)}
+ {provider.configured && provider.source === "stored" ? (
+ <button
+ type="button"
+ className="link"
+ onClick={() => send({ type: "auth_logout", providerId: provider.id })}
+ >
+ Sign out
+ </button>
+ ) : null}
+ </div>
+ </li>
+ ))}
+ </ul>
+ </section>
+ );
+}
+
function FlowEvent({ event, openUrl }: { event: AuthEvent; openUrl: (url: string) => void }) {
switch (event.kind) {
case "auth_url":
diff --git a/packages/ui/test/accounts.test.tsx b/packages/ui/test/accounts.test.tsx
index b151d3b..57d4caa 100644
--- a/packages/ui/test/accounts.test.tsx
+++ b/packages/ui/test/accounts.test.tsx
@@ -1,5 +1,5 @@
import type { ServerMessage, ServerPayload } from "@gentle-dot/protocol";
-import { render, screen } from "@testing-library/react";
+import { render, screen, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi } from "vitest";
import { AccountsPanel } from "../src/components/AccountsPanel.tsx";
@@ -79,6 +79,42 @@ describe("AccountsPanel", () => {
expect(send).toHaveBeenCalledWith({ type: "auth_login", providerId: "anthropic", method: "api_key" });
});
+ it("lists subscriptions first and API keys below", () => {
+ const auth = apply(base(), {
+ type: "auth_providers",
+ providers: [
+ { id: "anthropic", name: "Anthropic", methods: ["api_key"], configured: false },
+ {
+ id: "github-copilot",
+ name: "GitHub Copilot",
+ methods: ["oauth"],
+ oauthName: "GitHub Copilot",
+ configured: false,
+ },
+ {
+ id: "openai-codex",
+ name: "OpenAI Codex",
+ methods: ["oauth"],
+ oauthName: "OpenAI (ChatGPT Plus/Pro)",
+ configured: false,
+ },
+ { id: "openai", name: "OpenAI", methods: ["api_key"], configured: false },
+ ],
+ }).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();
+ expect(
+ within(subscriptions)
+ .getAllByRole("button")
+ .map((b) => b.textContent),
+ ).toEqual(["Sign in with GitHub Copilot", "Sign in with OpenAI (ChatGPT Plus/Pro)"]);
+ expect(within(keys).getByText("Anthropic")).toBeInTheDocument();
+ expect(within(keys).getByText("OpenAI")).toBeInTheDocument();
+ expect(within(keys).queryByText("GitHub Copilot")).toBeNull();
+ });
+
it("filters providers by name", async () => {
render(<AccountsPanel auth={base().auth} send={vi.fn()} dispatch={vi.fn()} openUrl={vi.fn()} />);
await userEvent.type(screen.getByRole("searchbox", { name: "Search providers" }), "open");