From d0aad32e9ff842d9a1847146a27f7b439ba33d98 Mon Sep 17 00:00:00 2001 From: Sam Julien Date: Tue, 1 Dec 2026 16:29:27 -0800 Subject: [PATCH 1/3] Skills, skill detail, Settings menu and Vault polish - Skills: Your skills and Workspace skills come before the setting for who else's Bots use your skills. - A skill opens read first: its name, who wrote it and its command, the one-liner, the tools it needs and the instructions as text. Edit opens the form. Workspace skills open the same way, with no Edit. - The tools it needs sit in a small box beside the instructions when the panel has room, and under the heading when it does not. - Settings menu rows are 36px, with the text-sm step. - Vault: a "Saved logins (3)" heading over the list. --- CHANGELOG.md | 10 ++ .../components/settings/learning-sharing.tsx | 153 ++++++++++-------- .../components/settings/settings-sidebar.tsx | 5 + app/src/components/skills/edit-skill.tsx | 3 +- app/src/components/skills/skill-detail.tsx | 77 +++++++++ app/src/components/skills/skill-overview.tsx | 105 ++++++++++++ app/src/components/skills/skill-tools.tsx | 2 +- .../skills/skills-settings-page.tsx | 137 ++++++++++------ app/src/components/vault/vault-page.tsx | 13 +- app/src/routes/_authed/_app/skills.tsx | 16 +- app/tests/skills-settings-page.test.tsx | 110 ++++++++++++- app/tests/vault.test.tsx | 52 ++++-- 12 files changed, 531 insertions(+), 152 deletions(-) create mode 100644 app/src/components/skills/skill-detail.tsx create mode 100644 app/src/components/skills/skill-overview.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index e28105213f..8f5ff62e31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,16 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged. widen it, so each new scope refused it. Now it reaches every scope, new ones included. A token of any other app is allowed exactly the scopes it was granted. +**Skills and Settings.** + +- **A skill opens to be read.** Opening a skill you wrote shows its name, who wrote it, its + one-liner, the tools it needs and its instructions. Edit opens the form. A workspace skill opens + the same way, with no Edit. +- **Skills lists come first.** Your skills and Workspace skills are above the setting for who + else's Bots use your skills. +- **Settings menu rows are 36px**, up from 32px. +- **Vault counts your saved logins** in a heading over the list. + **Smaller addresses.** - **Lists travel in a body, not the address.** Reading an app for the actions a Bot needs, and the diff --git a/app/src/components/settings/learning-sharing.tsx b/app/src/components/settings/learning-sharing.tsx index cc159451d1..752dcdde23 100644 --- a/app/src/components/settings/learning-sharing.tsx +++ b/app/src/components/settings/learning-sharing.tsx @@ -124,7 +124,7 @@ export function SkillMark({ children }: { children: React.ReactNode }) { * the Skills learned from their recordings and conversations, each marked Learned. * * Every recording a person makes goes into their own Learning space, and the Skills learned there - * reach every Bot they use. In the team edition they also choose, below the list, who else's Bots may + * reach every Bot they use. In the team edition they also choose, below the lists, who else's Bots may * draw on them: none (the default), all, or the Skills they open one by one. Each change takes effect * when it is made; there is no save. Sharing waits for an administrator (Admin, Automatic learning, * Skill sharing): until then nothing can be opened, and what was opened can still be closed. @@ -134,6 +134,7 @@ export function LearningSharing({ writtenKnown = true, heldAbove = false, action, + afterSkills = null, }: { /** * The page above has already said OpenBot is holding off (a move, or the database out of reach): @@ -146,6 +147,11 @@ export function LearningSharing({ writtenKnown?: boolean; /** The section's one verb: New skill. */ action?: React.ReactNode; + /** + * The page's other lists of skills (Workspace skills), drawn right after Your skills and before + * the sharing choice, so every list is read before the setting about them. + */ + afterSkills?: React.ReactNode; } = {}) { const sharing = useQuery(personalLearningQueryOptions()); const setMode = useMutation( @@ -165,9 +171,9 @@ export function LearningSharing({ )); // Which edition decides the layout, so nothing draws until it is known. A failed read counts as the team edition. - if (capabilities.isPending) return null; + if (capabilities.isPending) return afterSkills; // Nothing to list yet from either read. - if (sharing.isPending && !writtenKnown) return null; + if (sharing.isPending && !writtenKnown) return afterSkills; const personal = capabilities.data?.edition === "personal"; /* * The skills a person wrote don't come from Learning, so they and New skill are drawn whether or @@ -175,14 +181,17 @@ export function LearningSharing({ */ if (sharing.isPending || sharing.error) { return ( - - {sharing.error && !(heldAbove && isHeld(sharing.error)) ? ( -

- {failureSaid(sharing.error)} -

- ) : null} - {written.length > 0 ? {writtenRows} : null} -
+ <> + + {sharing.error && !(heldAbove && isHeld(sharing.error)) ? ( +

+ {failureSaid(sharing.error)} +

+ ) : null} + {written.length > 0 ? {writtenRows} : null} +
+ {afterSkills} + ); } const data = sharing.data; @@ -200,68 +209,71 @@ export function LearningSharing({ const learned = data.skills ?? []; const none = learned.length === 0 && written.length === 0; return ( - - {none ? ( - writtenKnown ? ( - - {data.skills === null - ? emptySentence(data, mode, true) - : "No skills yet. Write one with New skill, or teach a Bot a task."} - - ) : null - ) : ( - - {writtenRows} - {learned.map((skill, index) => ( - - {index > 0 || written.length > 0 ? : null} - setReading(skill.name)} - type="button" - /> - } - > - - - - - - {skillTitle(skill.name, skill.description)} - Learned - - {skill.description} - - - - - - - ))} - - )} - setReading(null)} - source={{ kind: "personal" }} - /> - + <> + + {none ? ( + writtenKnown ? ( + + {data.skills === null + ? emptySentence(data, mode, true) + : "No skills yet. Write one with New skill, or teach a Bot a task."} + + ) : null + ) : ( + + {writtenRows} + {learned.map((skill, index) => ( + + {index > 0 || written.length > 0 ? : null} + setReading(skill.name)} + type="button" + /> + } + > + + + + + + {skillTitle(skill.name, skill.description)} + Learned + + {skill.description} + + + + + + + ))} + + )} + setReading(null)} + source={{ kind: "personal" }} + /> + + {afterSkills} + ); } - // Below the list: it is a choice about the learned skills in it. + // Below the lists: it is a choice about the learned skills in them. const choiceSection = ( + {afterSkills} {choiceSection} {failure ? (

diff --git a/app/src/components/settings/settings-sidebar.tsx b/app/src/components/settings/settings-sidebar.tsx index 6c61fe26b4..aedca3e538 100644 --- a/app/src/components/settings/settings-sidebar.tsx +++ b/app/src/components/settings/settings-sidebar.tsx @@ -232,7 +232,12 @@ export function SettingsSidebar({ {entries.map((option) => ( + {/* + * 36px rather than the menu's 32px: this list is the page's whole navigation, + * read row by row, as Claude's and ChatGPT's settings menus are. + */} ( } onSubmit={async (values) => { await saveSkill.mutateAsync(values); - await navigate({ search: {}, to: "/skills" }); + // Back to the skill as it now reads. + await navigate({ search: { skill: skill.slug }, to: "/skills" }); }} slugLocked submitLabel="Save changes" diff --git a/app/src/components/skills/skill-detail.tsx b/app/src/components/skills/skill-detail.tsx new file mode 100644 index 0000000000..96071d9ec3 --- /dev/null +++ b/app/src/components/skills/skill-detail.tsx @@ -0,0 +1,77 @@ +import { useQuery } from "@tanstack/react-query"; +import { Link } from "@tanstack/react-router"; +import { IconPencil } from "@/components/icons"; +import { SkillOverview, skillByline } from "@/components/skills/skill-overview"; +import { Button } from "@/components/ui/button"; +import { currentUserQueryOptions } from "@/lib/auth/queries"; +import { loadFailure } from "@/lib/load-failure"; +import { useManagePaths } from "@/lib/manage-paths"; +import { skillListQueryOptions } from "@/lib/skills/queries"; + +/** + * One skill, read first, in the panel beside the Skills list: its name, who wrote it, its one-liner, + * the tools it needs and its instructions. Edit opens the form (`EditSkill`) for a skill that is + * yours. A workspace skill is an admin's, so it has no Edit. + */ +export function SkillDetail({ slug }: { slug: string }) { + const paths = useManagePaths(); + const { data, error, isPending } = useQuery(skillListQueryOptions()); + const me = useQuery(currentUserQueryOptions()).data; + const skill = data?.find((candidate) => candidate.slug === slug); + + /* Nothing while it loads. "Missing" and "not yet arrived" must not read the same. */ + if (isPending) return null; + + if (!data) { + return ( +

+

+ {loadFailure( + error, + "Couldn't load this skill. Try again in a moment.", + )} +

+
+ ); + } + + if (!skill) { + return ( +
+

+ This skill was deleted, or you can't see it. +

+
+ ); + } + + const yours = !!me && skill.ownerUserId === me.id; + return ( +
+
+
+

+ {skill.title} +

+ {yours ? ( + + ) : null} +
+

+ {skillByline(skill, me?.id, paths.edition)} +

+ {skill.summary ?

{skill.summary}

: null} +
+ +
+ ); +} diff --git a/app/src/components/skills/skill-overview.tsx b/app/src/components/skills/skill-overview.tsx new file mode 100644 index 0000000000..a74c667543 --- /dev/null +++ b/app/src/components/skills/skill-overview.tsx @@ -0,0 +1,105 @@ +import { RESEARCH_ROLES } from "@openbot/shared/research"; +import { useQuery } from "@tanstack/react-query"; +import { PageCard } from "@/components/layout/page-shell"; +import { toolTitle } from "@/components/skills/skill-tools"; +import { appsQueryOptions } from "@/lib/apps/queries"; +import type { Skill } from "@/lib/skills/queries"; + +/** + * The grey line under a skill's name: who made it, and the command that runs it. Only what the API + * gives: a skill has an owner and a slug, and no date it was last changed. + */ +export function skillByline( + skill: Pick, + me: string | undefined, + edition: "team" | "personal", +): string { + const who = + skill.ownerUserId === null + ? edition === "personal" + ? "Written for every Bot" + : "Written by an admin for everyone" + : skill.ownerUserId === me + ? "Written by you" + : "Written by someone in your organization"; + return `${who} · /${skill.slug}`; +} + +const NOT_HERE = "Not available here"; + +/** The tools a skill names, one entry per app, in the names the tool picker shows. */ +function toolGroups( + refs: string[], + apps: { title: string; tools: { ref: string; name: string }[] }[] | undefined, +): { title: string; tools: string[] }[] { + const groups = new Map(); + const add = (title: string, tool: string) => + groups.set(title, [...(groups.get(title) ?? []), tool]); + for (const ref of refs) { + const research = RESEARCH_ROLES.find((role) => role.ref === ref); + if (research) { + add("Web research", research.label); + continue; + } + const app = apps?.find((each) => + each.tools.some((tool) => tool.ref === ref), + ); + const tool = app?.tools.find((each) => each.ref === ref); + // A ref no app here offers keeps its raw name, as the tool picker shows it. + if (app && tool) add(app.title, toolTitle(tool.name)); + else add(NOT_HERE, ref); + } + // What no app offers goes last: it is the part that does nothing yet. + return [...groups] + .map(([title, tools]) => ({ title, tools })) + .sort( + (a, b) => Number(a.title === NOT_HERE) - Number(b.title === NOT_HERE), + ); +} + +function SkillToolList({ refs }: { refs: string[] }) { + const apps = useQuery({ ...appsQueryOptions(), enabled: refs.length > 0 }); + if (refs.length === 0) { + return

None

; + } + // Until the apps arrive, nothing: a raw ref would flash and then turn into its name. + if (apps.isPending) return null; + return ( +
    + {toolGroups(refs, apps.data).map((group) => ( +
  • +
    {group.title}
    +
    {group.tools.join(", ")}
    +
  • + ))} +
+ ); +} + +/** + * A skill read, not edited: the tools it needs, then its instructions as text. The form is one click + * away, behind the host's Edit button. + * + * The tools come first in the markup, so in a narrow host (the side panel) they sit right under the + * heading. Where there is room they move into a small box beside the instructions. The width that + * decides it is the host's, not the window's: the same skill is drawn in a 400px panel and on a + * page. + */ +export function SkillOverview({ skill }: { skill: Skill }) { + return ( +
+
+ +

Tools it needs

+ +
+
+

Instructions

+

+ {skill.instructions} +

+
+
+
+ ); +} diff --git a/app/src/components/skills/skill-tools.tsx b/app/src/components/skills/skill-tools.tsx index f8bc7d32f4..388add610b 100644 --- a/app/src/components/skills/skill-tools.tsx +++ b/app/src/components/skills/skill-tools.tsx @@ -70,7 +70,7 @@ type ToolGroup = { }; /** `create_routine` → "Create routine". The raw name stays on the row's tooltip. */ -function toolTitle(name: string): string { +export function toolTitle(name: string): string { const words = name.replace(/[_-]+/g, " ").trim(); return words ? words[0]?.toUpperCase() + words.slice(1) : name; } diff --git a/app/src/components/skills/skills-settings-page.tsx b/app/src/components/skills/skills-settings-page.tsx index f1db62552a..170c394c9d 100644 --- a/app/src/components/skills/skills-settings-page.tsx +++ b/app/src/components/skills/skills-settings-page.tsx @@ -55,29 +55,42 @@ import { type Skill, skillListQueryOptions } from "@/lib/skills/queries"; import { queryClient } from "@/query-client"; import { EditSkill } from "./edit-skill"; import { NewSkill } from "./new-skill"; +import { SkillDetail } from "./skill-detail"; /** * Skills: the one page, for every Bot, that answers "what does it know how to do?", in the main * menu. It was Capabilities → Skills, Settings → Skills, and Settings → Learning. * * 1. Your skills: one list of the skills that are yours, each marked with how it was made. Skills - * you wrote open the side panel; in the personal edition the skills written for every Bot open - * their own page with a switch per Bot (`/skills/$slug`); learned ones open their dialog - * and keep the team edition's sharing switches (`LearningSharing`). - * 2. Workspace skills, team edition only: the admin's, read-only. - * 3. Waiting for your review: what OpenBot proposes, with Learn now and automatic approval. - * 4. Teach a Bot: one row to the recording page, where OpenBot can run a browser for you. + * you wrote open the side panel, read first, with Edit for the form; in the personal edition the + * skills written for every Bot open their own page with a switch per Bot (`/skills/$slug`); + * learned ones open their dialog and keep the team edition's sharing switches + * (`LearningSharing`). + * 2. Workspace skills, team edition only: the admin's, read-only. Each opens the same panel, with + * no Edit. + * 3. Who else's Bots use your skills, team edition only: after the lists, so both are read first. + * 4. Waiting for your review: what OpenBot proposes, with Learn now and automatic approval. + * 5. Teach a Bot: one row to the recording page, where OpenBot can run a browser for you. * - * Writing and editing a skill you own is a search parameter, as it was on Capabilities, so the list - * stays behind the panel and the form is linkable and closed by Back. + * Reading, writing and editing a skill is a search parameter, as it was on Capabilities, so the list + * stays behind the panel and the panel is linkable and closed by Back. */ +/** + * Wider than the panel's 400px when a skill is read or edited, so its instructions have room beside + * the tools box (`SkillOverview`). Writing a new one keeps the default. + */ +const SKILL_PANEL_WIDTH = 600; + export function SkillsSettingsPage({ creating, editing, + viewing, }: { creating: boolean; /** The slug being edited, or undefined. */ editing?: string; + /** The slug being read, or undefined. */ + viewing?: string; }) { const navigate = useNavigate(); const paths = useManagePaths(); @@ -98,6 +111,7 @@ export function SkillsSettingsPage({ // Creating wins if both are somehow set: it is the more recent intent. const showCreate = creating; const showEdit = !showCreate && editing !== undefined; + const showView = !showCreate && !showEdit && viewing !== undefined; const loaded = !skillList.isPending && !me.isPending; /** Both reads answered, so `written` is the whole truth and an empty list means none. */ const writtenKnown = skillList.data !== undefined && me.data !== undefined; @@ -118,19 +132,26 @@ export function SkillsSettingsPage({ const writtenRow = (skill: Skill) => ( - - - - - - {skill.title} - Written - - {/* What it is for, not its command: the `/` menu finds a skill by its name. */} - {skill.summary ? ( - {skill.summary} - ) : null} - + {/* The row opens the skill to read; the menu sits beside that link, not inside it. */} + + + + + + + {skill.title} + Written + + {/* What it is for, not its command: the `/` menu finds a skill by its name. */} + {skill.summary ? ( + {skill.summary} + ) : null} + +