Skip to content

feat(spa): skills mode UX — mode toggle, skills picker, request wiring (skills-mode PR-3)#476

Merged
philmerrell merged 2 commits into
developfrom
feature/skills-mode-spa
Jun 12, 2026
Merged

feat(spa): skills mode UX — mode toggle, skills picker, request wiring (skills-mode PR-3)#476
philmerrell merged 2 commits into
developfrom
feature/skills-mode-spa

Conversation

@philmerrell

Copy link
Copy Markdown
Contributor

Summary

PR-3 of skills mode (spec; follows #473 + #474). The user-facing half: a Skills/Tools mode toggle in the settings slide-over, a per-skill picker, and chat-request wiring against the PR-2 backend.

Changes

Frontend

  • SkillService (mirrors ToolService): loads GET /skills/, optimistic per-skill toggles persisted via PUT /skills/preferences with revert-on-error.
  • ChatModeService: loads the admin policy from GET /system/chat-settings (compiled-in defaults on failure). Effective mode precedence: policy lock > local selection > user preferred mode > admin default. Toggling persists preferredAgentMode (user settings) and the active session's agentType.
  • Model-settings panel: a "Capabilities" Skills/Tools segmented control (hidden entirely when the admin disallows toggling — the server enforces regardless); in skills mode a Skills section that is the visual twin of the Tools section (toggle list, enabled-count badge, bound-tool counts, role-based empty state); the existing Tools section shows only in tools mode.
  • Chat request: every non-assistant turn sends agent_type; skills mode sends enabled_skills + enabled_tools: [] (capabilities come exclusively from enabled skills' bound tools). Assistant turns are excluded and keep their exact pre-skills-mode payload.
  • Session hydration: a conversation reopens in the mode it was using (preferences.agentType), mirroring the lastModel pattern; sessions without a stored mode inherit the current selection so a home-page choice survives into the first message.

Backend (additive)

  • SessionPreferences.agent_type (validated skill|chat, merge-safe in the metadata PUT — added to both create/merge branches).
  • preferredAgentMode on user settings (model + repository read whitelist).

Testing

  • Frontend (ng test): 19 new tests (SkillService load/toggle/revert, ChatModeService precedence/lock/persistence/hydration/fallback, chat-request payload matrix incl. tools mode + assistant exclusion). Full suite 1215 green; production build clean.
  • Backend: 7 new tests (agentType merge/create/422, preferredAgentMode aliases + repo whitelist). Full suite green — two pre-existing Hypothesis PBT tests (session-manager truncation, untouched by this PR) flaked under load and pass clean in isolation and on file re-run.

Manual test script (alpha)

  1. As an admin, leave chat-mode settings unconfigured (defaults: skill default, toggling allowed).
  2. Open the settings slide-over in a chat → a Capabilities segmented control shows Skills selected; a Skills section lists your RBAC-granted active skills with toggles and an enabled count.
  3. Toggle a skill off → refresh → it stays off. Send a message → the request payload (network tab) carries agent_type: "skill", enabled_skills without the disabled skill, enabled_tools: [].
  4. Switch to Tools → the Tools section replaces Skills; send a message → payload carries agent_type: "chat", your tool selection, and no enabled_skills.
  5. Reopen the conversation from the sidenav → it comes back in Tools mode; a brand-new chat starts in your last-used mode.
  6. PUT /admin/settings/chat with {"defaultMode": "skill", "allowModeToggle": false} → after a reload the segmented control is gone, only Skills shows; a hand-crafted agent_type: "chat" request is overridden server-side (verify via the turn running through the SkillAgent).
  7. Open a conversation with an assistant attached → no mode control behavior change; payload has no agent_type.

🤖 Generated with Claude Code

philmerrell and others added 2 commits June 12, 2026 08:56
…g (skills-mode PR-3)

The user-facing half of skills mode (docs/specs/skills-mode.md), on top of
the #474 backend:

- New SkillService (mirrors ToolService): loads GET /skills/, per-skill
  optimistic toggles persisted via PUT /skills/preferences.
- New ChatModeService: admin policy from GET /system/chat-settings
  (compiled-in default on failure), effective mode precedence =
  policy lock > local selection > user preferred mode > admin default.
  Toggling persists preferredAgentMode (user settings) and the session's
  agentType so a conversation reopens in the mode it was using.
- Model-settings panel: Skills/Tools segmented control (hidden when the
  admin disallows toggling), Skills toggle section (visual twin of the
  Tools section, with empty state) in skills mode, Tools section in
  tools mode.
- Chat request: sends agent_type each turn; skills mode sends
  enabled_skills and enabled_tools=[] (capabilities come from skills);
  assistant turns are excluded and keep pre-skills-mode behavior.
- Session page hydrates the stored mode from session preferences,
  mirroring the lastModel pattern.
- Backend (additive): SessionPreferences.agent_type (validated to
  skill|chat, merge-safe in the metadata PUT) and user settings
  preferredAgentMode.

Frontend: 1215 tests green (ng test) + production build clean.
Backend: full suite green (two pre-existing PBT tests flaked under
load in an unrelated area — session-manager truncation — and pass
clean in isolation and on file re-run).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…persist

Toggling skills/tools mode persists preferredAgentMode via
PUT /users/me/settings, which fails loud (503, #161 behavior) when
user-settings storage isn't configured. The toggle already applied
in-memory, so the background persist now opts out of the global error
toast via the existing SUPPRESS_ERROR_TOAST context token; explicit
settings-page saves stay loud. Failure still logs to console.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@philmerrell philmerrell merged commit 9ed37a5 into develop Jun 12, 2026
1 check passed
@philmerrell philmerrell deleted the feature/skills-mode-spa branch June 12, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant