updates on the logic on the skills and settings tab

This commit is contained in:
2026-10-06 20:58:15 +05:30
parent 21775fe6f9
commit 8dca169b83
5 changed files with 74 additions and 5 deletions

View File

@@ -10,6 +10,8 @@ import { SkillRegistry } from '@/lib/assistant/skills/SkillRegistry';
import { wallClockNow } from '@/lib/assistant/agent/signals';
import { executeProposal, canExecuteProposal } from '@/lib/assistant/agent/actions';
import { Button } from '@/components/ui/button';
import { useAuth } from '@/lib/AuthContext';
import { canOnboardClients } from '@/lib/clientOnboarding';
/**
* AgentOperationsBanner
@@ -40,6 +42,10 @@ export default function AgentOperationsBanner({
className = ''
}) {
const navigate = useNavigate();
// The Skills & Tools tab is the owner login's only; nobody else gets a
// button into it.
const { user, isClient } = useAuth();
const canConfigure = canOnboardClients(user, isClient);
// Which settings the rules are running on — the registry's, or the code
// defaults while it is unreachable. Said on screen, so a tuned threshold is
// never assumed when it is not in force.
@@ -141,7 +147,7 @@ export default function AgentOperationsBanner({
</div>
<div className="flex items-center gap-2">
<Button
{canConfigure && <Button
variant="outline"
size="sm"
onClick={() => navigate('/doormile/settings?tab=skills')}
@@ -150,7 +156,7 @@ export default function AgentOperationsBanner({
>
<SlidersHorizontal className="h-3.5 w-3.5 text-accent-ink" />
<span>Configure skills</span>
</Button>
</Button>}
<Button
variant="ghost"

View File

@@ -8,6 +8,8 @@ import { Input } from '@/components/ds';
import Customers from '@/pages/doormile/customers/Customers';
import Profitability from '@/pages/doormile/reports/Profitability';
import AgentStudio from './agentStudio/AgentStudio';
import { useAuth } from '@/lib/AuthContext';
import { canOnboardClients } from '@/lib/clientOnboarding';
// Skills & Tools (Agent Studio) reads and writes the backend agent registry
// (/admin/ai/*, docs/agent-platform-plan.md Phase 2). Changes are shared and
@@ -18,13 +20,24 @@ import AgentStudio from './agentStudio/AgentStudio';
//
// It is NOT the default tab. Landing on a section that does nothing is how an
// operator concludes the AI is broken; Profitability leads instead.
const TABS = [
const ALL_TABS = [
{ id: 'profitability', label: 'Profitability', icon: TrendingUp },
{ id: 'customers', label: 'Customers', icon: Users },
{ id: 'skills', label: 'Skills & Tools', icon: Sparkles },
{ id: 'skills', label: 'Skills & Tools', icon: Sparkles, ownerOnly: true },
];
/**
* Skills & Tools is shown to the console owner login only (admin@doormile.com,
* the same owner list as Client Onboarding). Everyone else, other staff and
* every client, gets the other tabs; a ?tab=skills link falls to the default.
*/
export function settingsTabsFor(isOwner) {
return ALL_TABS.filter((tab) => !tab.ownerOnly || isOwner);
}
export default function Settings() {
const { user, isClient } = useAuth();
const TABS = settingsTabsFor(canOnboardClients(user, isClient));
const [searchParams, setSearchParams] = useSearchParams();
const tabParam = searchParams.get('tab');
@@ -42,6 +55,8 @@ export default function Settings() {
if (tabParam && TABS.some((t) => t.id === tabParam)) {
setActiveTab(tabParam);
}
// TABS is derived from the login, which does not change on this page.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [tabParam]);
const handleTabChange = (id) => {
@@ -121,7 +136,7 @@ export default function Settings() {
exit={{ opacity: 0, y: -4 }}
transition={{ duration: 0.15 }}
>
{activeTab === 'skills' && <AgentStudio />}
{activeTab === 'skills' && TABS.some((t) => t.id === 'skills') && <AgentStudio />}
{activeTab === 'profitability' && (
<Profitability
embedded