mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
fix(panel): KB playbooks category, LLM-health diagnostic, scorecard tab, feature-flags 2-col + X creds dropdown; fix(a2a): publish live event from direct send path; fix(docker): orchestrator Node 22 (#305)
Co-authored-by: Renn F <rennf93@users.noreply.github.com>
This commit is contained in:
@@ -43,10 +43,14 @@ RUN uv sync --frozen --no-dev
|
|||||||
FROM python:3.13-slim-bookworm AS runner
|
FROM python:3.13-slim-bookworm AS runner
|
||||||
|
|
||||||
# Runtime apt deps: docker-cli (spawn agents), git (workspace ops),
|
# Runtime apt deps: docker-cli (spawn agents), git (workspace ops),
|
||||||
# make (backstop for projects whose CI commands use make targets).
|
# make (backstop for projects whose CI commands use make targets), Node.js 22
|
||||||
# curl/gnupg/lsb-release are only needed to add the docker repo, then purged.
|
# via NodeSource. Debian's distro nodejs is v18, but current pnpm requires
|
||||||
|
# Node >=22.13 — installing v18 made `pnpm install` fail in Node/TS workspaces.
|
||||||
|
# curl/gnupg/lsb-release are only needed to add the repos, then purged.
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
curl ca-certificates gnupg lsb-release git make nodejs npm \
|
curl ca-certificates gnupg lsb-release git make \
|
||||||
|
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
||||||
|
&& apt-get install -y --no-install-recommends nodejs \
|
||||||
&& curl -fsSL https://download.docker.com/linux/debian/gpg \
|
&& curl -fsSL https://download.docker.com/linux/debian/gpg \
|
||||||
| gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
|
| gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
|
||||||
&& DEBIAN_CODENAME=$(lsb_release -cs) \
|
&& DEBIAN_CODENAME=$(lsb_release -cs) \
|
||||||
@@ -62,7 +66,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
# deps (`pnpm install`) the same way uv handles Python cells. Without it the
|
# deps (`pnpm install`) the same way uv handles Python cells. Without it the
|
||||||
# dep-install step gracefully skips (WorkspaceService._run_dep_install catches
|
# dep-install step gracefully skips (WorkspaceService._run_dep_install catches
|
||||||
# the missing-tool OSError) and the fe-dev re-installs per task. node/npm come
|
# the missing-tool OSError) and the fe-dev re-installs per task. node/npm come
|
||||||
# from the apt layer above; pnpm matches how agent-dev-fe installs it.
|
# from the NodeSource layer above; pnpm matches how agent-dev-fe installs it.
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useRouter, useSearchParams } from "next/navigation";
|
|||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { GoalsTab } from "@/components/business/goals-tab";
|
import { GoalsTab } from "@/components/business/goals-tab";
|
||||||
|
import { CompanyScorecardCard } from "@/components/business/company-scorecard-card";
|
||||||
import { SecretaryTab } from "@/components/business/secretary-tab";
|
import { SecretaryTab } from "@/components/business/secretary-tab";
|
||||||
import { PitchesTab } from "@/components/business/pitches-tab";
|
import { PitchesTab } from "@/components/business/pitches-tab";
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ import { PitchesTab } from "@/components/business/pitches-tab";
|
|||||||
// Valid tab values
|
// Valid tab values
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const TAB_VALUES = ["goals", "secretary", "pitches"] as const;
|
const TAB_VALUES = ["goals", "scorecard", "secretary", "pitches"] as const;
|
||||||
type TabValue = (typeof TAB_VALUES)[number];
|
type TabValue = (typeof TAB_VALUES)[number];
|
||||||
|
|
||||||
function isValidTab(value: string | null): value is TabValue {
|
function isValidTab(value: string | null): value is TabValue {
|
||||||
@@ -50,6 +51,7 @@ function BusinessPageContent() {
|
|||||||
<Tabs value={activeTab} onValueChange={handleTabChange}>
|
<Tabs value={activeTab} onValueChange={handleTabChange}>
|
||||||
<TabsList>
|
<TabsList>
|
||||||
<TabsTrigger value="goals">Goals</TabsTrigger>
|
<TabsTrigger value="goals">Goals</TabsTrigger>
|
||||||
|
<TabsTrigger value="scorecard">Scorecard</TabsTrigger>
|
||||||
<TabsTrigger value="secretary">Secretary</TabsTrigger>
|
<TabsTrigger value="secretary">Secretary</TabsTrigger>
|
||||||
<TabsTrigger value="pitches">Pitches</TabsTrigger>
|
<TabsTrigger value="pitches">Pitches</TabsTrigger>
|
||||||
</TabsList>
|
</TabsList>
|
||||||
@@ -58,6 +60,10 @@ function BusinessPageContent() {
|
|||||||
<GoalsTab />
|
<GoalsTab />
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="scorecard" className="mt-4">
|
||||||
|
<CompanyScorecardCard />
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
<TabsContent value="secretary" className="mt-4">
|
<TabsContent value="secretary" className="mt-4">
|
||||||
<SecretaryTab />
|
<SecretaryTab />
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import { toast } from "sonner";
|
|||||||
import { API_URL, WS_URL } from "@/lib/constants";
|
import { API_URL, WS_URL } from "@/lib/constants";
|
||||||
import { TranscriptRetentionCard } from "@/components/settings/transcript-retention-card";
|
import { TranscriptRetentionCard } from "@/components/settings/transcript-retention-card";
|
||||||
import { FeatureFlagsCard } from "@/components/settings/feature-flags-card";
|
import { FeatureFlagsCard } from "@/components/settings/feature-flags-card";
|
||||||
import { XCredentialsCard } from "@/components/settings/x-credentials-card";
|
|
||||||
|
|
||||||
export default function SettingsPage() {
|
export default function SettingsPage() {
|
||||||
const { theme, setTheme } = useTheme();
|
const { theme, setTheme } = useTheme();
|
||||||
@@ -55,8 +54,7 @@ export default function SettingsPage() {
|
|||||||
|
|
||||||
{/* Cards grid — two columns on large screens. Order (row,col):
|
{/* Cards grid — two columns on large screens. Order (row,col):
|
||||||
User Info (1,1) · Appearance (1,2) · Data & Refresh (2,1) ·
|
User Info (1,1) · Appearance (1,2) · Data & Refresh (2,1) ·
|
||||||
Transcript Retention (2,2) · Notifications (3,1) · Connection Info (3,2) ·
|
Transcript Retention (2,2) · Notifications (3,1) · Connection Info (3,2). */}
|
||||||
X Credentials (4,1). */}
|
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||||
{/* User Info */}
|
{/* User Info */}
|
||||||
<Card>
|
<Card>
|
||||||
@@ -248,12 +246,11 @@ export default function SettingsPage() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{/* X (Twitter) Credentials (4,1) — write-only, panel-tunable */}
|
|
||||||
<XCredentialsCard />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Feature Flags — master switches for optional subsystems (full width;
|
{/* Feature Flags — master switches for optional subsystems (full width;
|
||||||
persisted server-side, applied on next restart). */}
|
persisted server-side, applied on next restart). The X (Twitter)
|
||||||
|
credentials form nests as a collapsible under the X-engine flag. */}
|
||||||
<FeatureFlagsCard />
|
<FeatureFlagsCard />
|
||||||
|
|
||||||
{/* Save Button */}
|
{/* Save Button */}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import { Textarea } from "@/components/ui/textarea";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { OfflineState } from "@/components/ui/offline-state";
|
import { OfflineState } from "@/components/ui/offline-state";
|
||||||
import { CompanyScorecardCard } from "@/components/business/company-scorecard-card";
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Helpers
|
// Helpers
|
||||||
@@ -376,7 +375,6 @@ export function GoalsTab() {
|
|||||||
) : (
|
) : (
|
||||||
<GoalsForm goals={data} refetch={() => void refetch()} />
|
<GoalsForm goals={data} refetch={() => void refetch()} />
|
||||||
)}
|
)}
|
||||||
<CompanyScorecardCard />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
GitBranch,
|
GitBranch,
|
||||||
ClipboardCheck,
|
ClipboardCheck,
|
||||||
Lightbulb,
|
Lightbulb,
|
||||||
|
ScrollText,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
@@ -60,6 +61,11 @@ const categoryConfig: Record<
|
|||||||
description: "Cross-agent shared learnings",
|
description: "Cross-agent shared learnings",
|
||||||
icon: <Lightbulb className="h-5 w-5 text-yellow-500" />,
|
icon: <Lightbulb className="h-5 w-5 text-yellow-500" />,
|
||||||
},
|
},
|
||||||
|
[KBIndexType.PLAYBOOKS]: {
|
||||||
|
label: "Playbooks",
|
||||||
|
description: "Curated, reusable procedures",
|
||||||
|
icon: <ScrollText className="h-5 w-5 text-emerald-500" />,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
interface KBCategoryNavProps {
|
interface KBCategoryNavProps {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
GitBranch,
|
GitBranch,
|
||||||
ClipboardCheck,
|
ClipboardCheck,
|
||||||
Lightbulb,
|
Lightbulb,
|
||||||
|
ScrollText,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
|
||||||
const indexTypeConfig: Record<
|
const indexTypeConfig: Record<
|
||||||
@@ -50,6 +51,10 @@ const indexTypeConfig: Record<
|
|||||||
label: "Learnings",
|
label: "Learnings",
|
||||||
icon: <Lightbulb className="h-4 w-4 text-yellow-500" />,
|
icon: <Lightbulb className="h-4 w-4 text-yellow-500" />,
|
||||||
},
|
},
|
||||||
|
[KBIndexType.PLAYBOOKS]: {
|
||||||
|
label: "Playbooks",
|
||||||
|
icon: <ScrollText className="h-4 w-4 text-emerald-500" />,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
interface KBFiltersProps {
|
interface KBFiltersProps {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
GitBranch,
|
GitBranch,
|
||||||
ClipboardCheck,
|
ClipboardCheck,
|
||||||
Lightbulb,
|
Lightbulb,
|
||||||
|
ScrollText,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
|
||||||
const indexTypeConfig: Record<
|
const indexTypeConfig: Record<
|
||||||
@@ -60,6 +61,12 @@ const indexTypeConfig: Record<
|
|||||||
"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300",
|
"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300",
|
||||||
icon: <Lightbulb className="h-3 w-3" />,
|
icon: <Lightbulb className="h-3 w-3" />,
|
||||||
},
|
},
|
||||||
|
[KBIndexType.PLAYBOOKS]: {
|
||||||
|
label: "Playbooks",
|
||||||
|
color:
|
||||||
|
"bg-emerald-100 text-emerald-700 dark:bg-emerald-900 dark:text-emerald-300",
|
||||||
|
icon: <ScrollText className="h-3 w-3" />,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
interface KBIndexTypeBadgeProps {
|
interface KBIndexTypeBadgeProps {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
GitBranch,
|
GitBranch,
|
||||||
ClipboardCheck,
|
ClipboardCheck,
|
||||||
Lightbulb,
|
Lightbulb,
|
||||||
|
ScrollText,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { formatDistanceToNow } from "date-fns";
|
import { formatDistanceToNow } from "date-fns";
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ const indexIcons: Record<KBIndexType, React.ReactNode> = {
|
|||||||
[KBIndexType.DECISIONS]: <GitBranch className="h-4 w-4 text-indigo-500" />,
|
[KBIndexType.DECISIONS]: <GitBranch className="h-4 w-4 text-indigo-500" />,
|
||||||
[KBIndexType.REVIEWS]: <ClipboardCheck className="h-4 w-4 text-pink-500" />,
|
[KBIndexType.REVIEWS]: <ClipboardCheck className="h-4 w-4 text-pink-500" />,
|
||||||
[KBIndexType.LEARNINGS]: <Lightbulb className="h-4 w-4 text-yellow-500" />,
|
[KBIndexType.LEARNINGS]: <Lightbulb className="h-4 w-4 text-yellow-500" />,
|
||||||
|
[KBIndexType.PLAYBOOKS]: <ScrollText className="h-4 w-4 text-emerald-500" />,
|
||||||
};
|
};
|
||||||
|
|
||||||
const indexLabels: Record<KBIndexType, string> = {
|
const indexLabels: Record<KBIndexType, string> = {
|
||||||
@@ -38,6 +40,7 @@ const indexLabels: Record<KBIndexType, string> = {
|
|||||||
[KBIndexType.DECISIONS]: "Decisions",
|
[KBIndexType.DECISIONS]: "Decisions",
|
||||||
[KBIndexType.REVIEWS]: "Reviews",
|
[KBIndexType.REVIEWS]: "Reviews",
|
||||||
[KBIndexType.LEARNINGS]: "Learnings",
|
[KBIndexType.LEARNINGS]: "Learnings",
|
||||||
|
[KBIndexType.PLAYBOOKS]: "Playbooks",
|
||||||
};
|
};
|
||||||
|
|
||||||
interface KBStatsCardProps {
|
interface KBStatsCardProps {
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ const INDEX_LABELS: Record<KBIndexType, string> = {
|
|||||||
[KBIndexType.DECISIONS]: "Decisions",
|
[KBIndexType.DECISIONS]: "Decisions",
|
||||||
[KBIndexType.REVIEWS]: "Code Reviews",
|
[KBIndexType.REVIEWS]: "Code Reviews",
|
||||||
[KBIndexType.LEARNINGS]: "Learnings",
|
[KBIndexType.LEARNINGS]: "Learnings",
|
||||||
|
[KBIndexType.PLAYBOOKS]: "Playbooks",
|
||||||
};
|
};
|
||||||
|
|
||||||
// Valid KB index types for URL param validation
|
// Valid KB index types for URL param validation
|
||||||
@@ -84,6 +85,7 @@ const VALID_INDEX_TYPES: KBIndexType[] = [
|
|||||||
KBIndexType.DECISIONS,
|
KBIndexType.DECISIONS,
|
||||||
KBIndexType.REVIEWS,
|
KBIndexType.REVIEWS,
|
||||||
KBIndexType.LEARNINGS,
|
KBIndexType.LEARNINGS,
|
||||||
|
KBIndexType.PLAYBOOKS,
|
||||||
];
|
];
|
||||||
|
|
||||||
function KnowledgeBaseBrowserContent() {
|
function KnowledgeBaseBrowserContent() {
|
||||||
@@ -454,6 +456,16 @@ function KnowledgeBaseBrowserContent() {
|
|||||||
<div>LLM: {health.llm_status}</div>
|
<div>LLM: {health.llm_status}</div>
|
||||||
<div>Vector: {health.vector_store_status}</div>
|
<div>Vector: {health.vector_store_status}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{(["llm_error", "embedding_error", "vector_store_error"] as const)
|
||||||
|
.filter((k) => typeof health.details?.[k] === "string")
|
||||||
|
.map((k) => (
|
||||||
|
<p
|
||||||
|
key={k}
|
||||||
|
className="text-xs text-red-600 dark:text-red-400 break-words"
|
||||||
|
>
|
||||||
|
{health.details[k] as string}
|
||||||
|
</p>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<p className="text-muted-foreground text-sm">
|
<p className="text-muted-foreground text-sm">
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ vi.mock("@/lib/api", () => ({
|
|||||||
xApi: { getCredentialsStatus, setCredentials },
|
xApi: { getCredentialsStatus, setCredentials },
|
||||||
}));
|
}));
|
||||||
|
|
||||||
import { XCredentialsCard } from "../x-credentials-card";
|
import { XCredentialsForm } from "../x-credentials-card";
|
||||||
|
|
||||||
function withQueryClient(ui: ReactNode) {
|
function withQueryClient(ui: ReactNode) {
|
||||||
const client = new QueryClient({
|
const client = new QueryClient({
|
||||||
@@ -21,7 +21,7 @@ function withQueryClient(ui: ReactNode) {
|
|||||||
return <QueryClientProvider client={client}>{ui}</QueryClientProvider>;
|
return <QueryClientProvider client={client}>{ui}</QueryClientProvider>;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("XCredentialsCard", () => {
|
describe("XCredentialsForm", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
getCredentialsStatus.mockClear();
|
getCredentialsStatus.mockClear();
|
||||||
setCredentials.mockClear();
|
setCredentials.mockClear();
|
||||||
@@ -31,14 +31,14 @@ describe("XCredentialsCard", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("shows 'no credentials configured' by default and never renders a secret", async () => {
|
it("shows 'no credentials configured' by default and never renders a secret", async () => {
|
||||||
render(withQueryClient(<XCredentialsCard />));
|
render(withQueryClient(<XCredentialsForm />));
|
||||||
expect(
|
expect(
|
||||||
await screen.findByText("No credentials configured"),
|
await screen.findByText("No credentials configured"),
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("disables Save until all 4 fields are filled", async () => {
|
it("disables Save until all 4 fields are filled", async () => {
|
||||||
render(withQueryClient(<XCredentialsCard />));
|
render(withQueryClient(<XCredentialsForm />));
|
||||||
await screen.findByText("No credentials configured");
|
await screen.findByText("No credentials configured");
|
||||||
const saveButton = screen.getByRole("button", { name: "Save" });
|
const saveButton = screen.getByRole("button", { name: "Save" });
|
||||||
expect(saveButton).toBeDisabled();
|
expect(saveButton).toBeDisabled();
|
||||||
@@ -61,7 +61,7 @@ describe("XCredentialsCard", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("saves all 4 secrets and clears the inputs on success", async () => {
|
it("saves all 4 secrets and clears the inputs on success", async () => {
|
||||||
render(withQueryClient(<XCredentialsCard />));
|
render(withQueryClient(<XCredentialsForm />));
|
||||||
await screen.findByText("No credentials configured");
|
await screen.findByText("No credentials configured");
|
||||||
|
|
||||||
fireEvent.change(screen.getByLabelText("API key"), {
|
fireEvent.change(screen.getByLabelText("API key"), {
|
||||||
|
|||||||
@@ -10,10 +10,18 @@ import {
|
|||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "@/components/ui/card";
|
} from "@/components/ui/card";
|
||||||
|
import { useState } from "react";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Flag } from "lucide-react";
|
import {
|
||||||
|
Collapsible,
|
||||||
|
CollapsibleContent,
|
||||||
|
CollapsibleTrigger,
|
||||||
|
} from "@/components/ui/collapsible";
|
||||||
|
import { XCredentialsForm } from "@/components/settings/x-credentials-card";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
import { Flag, ChevronDown, ChevronRight } from "lucide-react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
|
||||||
// One-line blurb per flag so the operator knows what each master switch gates.
|
// One-line blurb per flag so the operator knows what each master switch gates.
|
||||||
@@ -60,6 +68,7 @@ const FLAG_DESCRIPTIONS: Record<string, string> = {
|
|||||||
|
|
||||||
export function FeatureFlagsCard() {
|
export function FeatureFlagsCard() {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
const [xCredsOpen, setXCredsOpen] = useState(false);
|
||||||
|
|
||||||
const { data, isLoading } = useQuery({
|
const { data, isLoading } = useQuery({
|
||||||
queryKey: ["feature-flags"],
|
queryKey: ["feature-flags"],
|
||||||
@@ -97,7 +106,7 @@ export function FeatureFlagsCard() {
|
|||||||
environment default. {note}
|
environment default. {note}
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-4">
|
<CardContent>
|
||||||
{isLoading && (
|
{isLoading && (
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
Loading feature flags…
|
Loading feature flags…
|
||||||
@@ -108,30 +117,65 @@ export function FeatureFlagsCard() {
|
|||||||
No feature flags available.
|
No feature flags available.
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{flags.map((flag, i) => (
|
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||||
<div key={flag.key}>
|
{flags.map((flag) => {
|
||||||
{i > 0 && <Separator className="mb-4" />}
|
const isXEngine = flag.key === "x_engine_enabled";
|
||||||
<div className="flex items-center justify-between gap-4">
|
return (
|
||||||
<div className="min-w-0">
|
<div
|
||||||
<Label htmlFor={`flag-${flag.key}`}>{flag.label}</Label>
|
key={flag.key}
|
||||||
<p className="text-sm text-muted-foreground">
|
className={cn(
|
||||||
{FLAG_DESCRIPTIONS[flag.key] ?? ""}
|
"rounded-lg border p-4",
|
||||||
</p>
|
isXEngine && "md:col-span-2",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div className="flex items-start justify-between gap-4">
|
||||||
|
<div className="min-w-0">
|
||||||
|
<Label htmlFor={`flag-${flag.key}`}>{flag.label}</Label>
|
||||||
|
<p className="text-sm text-muted-foreground">
|
||||||
|
{FLAG_DESCRIPTIONS[flag.key] ?? ""}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
id={`flag-${flag.key}`}
|
||||||
|
checked={flag.enabled}
|
||||||
|
disabled={
|
||||||
|
toggleMutation.isPending &&
|
||||||
|
toggleMutation.variables?.key === flag.key
|
||||||
|
}
|
||||||
|
onCheckedChange={(checked) =>
|
||||||
|
toggleMutation.mutate({ key: flag.key, enabled: checked })
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{isXEngine && (
|
||||||
|
<Collapsible
|
||||||
|
open={xCredsOpen}
|
||||||
|
onOpenChange={setXCredsOpen}
|
||||||
|
className="mt-3"
|
||||||
|
>
|
||||||
|
<CollapsibleTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
className="w-full justify-between px-2 text-muted-foreground"
|
||||||
|
>
|
||||||
|
<span className="text-sm">X (Twitter) credentials</span>
|
||||||
|
{xCredsOpen ? (
|
||||||
|
<ChevronDown className="h-4 w-4" />
|
||||||
|
) : (
|
||||||
|
<ChevronRight className="h-4 w-4" />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</CollapsibleTrigger>
|
||||||
|
<CollapsibleContent className="pt-3">
|
||||||
|
<XCredentialsForm />
|
||||||
|
</CollapsibleContent>
|
||||||
|
</Collapsible>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<Switch
|
);
|
||||||
id={`flag-${flag.key}`}
|
})}
|
||||||
checked={flag.enabled}
|
</div>
|
||||||
disabled={
|
|
||||||
toggleMutation.isPending &&
|
|
||||||
toggleMutation.variables?.key === flag.key
|
|
||||||
}
|
|
||||||
onCheckedChange={(checked) =>
|
|
||||||
toggleMutation.mutate({ key: flag.key, enabled: checked })
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,17 +3,10 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { xApi } from "@/lib/api";
|
import { xApi } from "@/lib/api";
|
||||||
import {
|
|
||||||
Card,
|
|
||||||
CardContent,
|
|
||||||
CardDescription,
|
|
||||||
CardHeader,
|
|
||||||
CardTitle,
|
|
||||||
} from "@/components/ui/card";
|
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { AtSign, Key, KeyRound, Save } from "lucide-react";
|
import { Key, KeyRound, Save } from "lucide-react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
|
||||||
const FIELDS: Array<{
|
const FIELDS: Array<{
|
||||||
@@ -29,7 +22,8 @@ const FIELDS: Array<{
|
|||||||
// The CEO's one-time (or rotate) entry of the 4 OAuth 1.0a user-context
|
// The CEO's one-time (or rotate) entry of the 4 OAuth 1.0a user-context
|
||||||
// secrets from the X developer app. Write-only — the stored values are never
|
// secrets from the X developer app. Write-only — the stored values are never
|
||||||
// displayed back, only whether they're set (mirrors the git-token card).
|
// displayed back, only whether they're set (mirrors the git-token card).
|
||||||
export function XCredentialsCard() {
|
// Rendered chrome-less so it can nest inside the X-engine feature-flag row.
|
||||||
|
export function XCredentialsForm() {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const [values, setValues] = useState({
|
const [values, setValues] = useState({
|
||||||
api_key: "",
|
api_key: "",
|
||||||
@@ -69,67 +63,61 @@ export function XCredentialsCard() {
|
|||||||
const canSave = allFilled || (noneFilled && !!status?.has_credentials);
|
const canSave = allFilled || (noneFilled && !!status?.has_credentials);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<div className="space-y-4">
|
||||||
<CardHeader>
|
<p className="text-sm text-muted-foreground">
|
||||||
<CardTitle className="flex items-center gap-2">
|
The 4 OAuth 1.0a user-context secrets from your X developer app. Stored
|
||||||
<AtSign className="h-5 w-5" />X (Twitter) Credentials
|
encrypted server-side; agents never see them and this panel never
|
||||||
</CardTitle>
|
displays them again once saved.
|
||||||
<CardDescription>
|
</p>
|
||||||
The 4 OAuth 1.0a user-context secrets from your X developer app.
|
|
||||||
Stored encrypted server-side; agents never see them and this panel
|
|
||||||
never displays them again once saved.
|
|
||||||
</CardDescription>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="space-y-4">
|
|
||||||
<div className="flex items-center gap-2 rounded-md border p-3">
|
|
||||||
{status?.has_credentials ? (
|
|
||||||
<>
|
|
||||||
<Key className="h-4 w-4 text-green-500" />
|
|
||||||
<span className="text-sm text-green-600 dark:text-green-400">
|
|
||||||
Credentials are set
|
|
||||||
</span>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<KeyRound className="h-4 w-4 text-amber-500" />
|
|
||||||
<span className="text-sm text-amber-600 dark:text-amber-400">
|
|
||||||
{isLoading ? "Checking..." : "No credentials configured"}
|
|
||||||
</span>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
<div className="flex items-center gap-2 rounded-md border p-3">
|
||||||
{FIELDS.map((field) => (
|
{status?.has_credentials ? (
|
||||||
<div key={field.key} className="space-y-2">
|
<>
|
||||||
<Label htmlFor={`x-cred-${field.key}`}>
|
<Key className="h-4 w-4 text-green-500" />
|
||||||
{status?.has_credentials ? `Replace ${field.label}` : field.label}
|
<span className="text-sm text-green-600 dark:text-green-400">
|
||||||
</Label>
|
Credentials are set
|
||||||
<Input
|
</span>
|
||||||
id={`x-cred-${field.key}`}
|
</>
|
||||||
type="password"
|
) : (
|
||||||
value={values[field.key]}
|
<>
|
||||||
onChange={(e) =>
|
<KeyRound className="h-4 w-4 text-amber-500" />
|
||||||
setValues((prev) => ({ ...prev, [field.key]: e.target.value }))
|
<span className="text-sm text-amber-600 dark:text-amber-400">
|
||||||
}
|
{isLoading ? "Checking..." : "No credentials configured"}
|
||||||
placeholder="••••••••••••"
|
</span>
|
||||||
/>
|
</>
|
||||||
</div>
|
)}
|
||||||
))}
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<p className="text-xs text-muted-foreground">
|
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||||
Set all 4 to save (or rotate); leave all 4 blank and save to clear.
|
{FIELDS.map((field) => (
|
||||||
</p>
|
<div key={field.key} className="space-y-2">
|
||||||
|
<Label htmlFor={`x-cred-${field.key}`}>
|
||||||
|
{status?.has_credentials ? `Replace ${field.label}` : field.label}
|
||||||
|
</Label>
|
||||||
|
<Input
|
||||||
|
id={`x-cred-${field.key}`}
|
||||||
|
type="password"
|
||||||
|
value={values[field.key]}
|
||||||
|
onChange={(e) =>
|
||||||
|
setValues((prev) => ({ ...prev, [field.key]: e.target.value }))
|
||||||
|
}
|
||||||
|
placeholder="••••••••••••"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
<Button
|
<p className="text-xs text-muted-foreground">
|
||||||
onClick={() => saveMutation.mutate()}
|
Set all 4 to save (or rotate); leave all 4 blank and save to clear.
|
||||||
disabled={saveMutation.isPending || !canSave}
|
</p>
|
||||||
>
|
|
||||||
<Save className="mr-2 h-4 w-4" />
|
<Button
|
||||||
{saveMutation.isPending ? "Saving..." : "Save"}
|
onClick={() => saveMutation.mutate()}
|
||||||
</Button>
|
disabled={saveMutation.isPending || !canSave}
|
||||||
</CardContent>
|
>
|
||||||
</Card>
|
<Save className="mr-2 h-4 w-4" />
|
||||||
|
{saveMutation.isPending ? "Saving..." : "Save"}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -757,6 +757,7 @@ export enum KBIndexType {
|
|||||||
DECISIONS = "decisions",
|
DECISIONS = "decisions",
|
||||||
REVIEWS = "reviews",
|
REVIEWS = "reviews",
|
||||||
LEARNINGS = "learnings",
|
LEARNINGS = "learnings",
|
||||||
|
PLAYBOOKS = "playbooks",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface KBSearchRequest {
|
export interface KBSearchRequest {
|
||||||
|
|||||||
+14
-4
@@ -1332,7 +1332,18 @@ class A2AService:
|
|||||||
from_agent=from_agent,
|
from_agent=from_agent,
|
||||||
)
|
)
|
||||||
|
|
||||||
return self._msg_to_model(msg)
|
model = self._msg_to_model(msg)
|
||||||
|
# Single chokepoint for the operator live view: every persisted A2A
|
||||||
|
# message emits A2A_MESSAGE_SENT here, so the direct REST send paths
|
||||||
|
# (conversation-create + post-message) light up the /a2a view too, not
|
||||||
|
# just the gateway send() wrapper. Suppressed duplicates return above
|
||||||
|
# and deliberately don't re-emit.
|
||||||
|
to_agent = conv.agent_b if from_agent == conv.agent_a else conv.agent_a
|
||||||
|
task_id = str(conv.task_id) if conv.task_id else None
|
||||||
|
await self._publish_a2a_message_sent(
|
||||||
|
model, task_id, from_agent, to_agent, skill
|
||||||
|
)
|
||||||
|
return model
|
||||||
|
|
||||||
async def get_messages(
|
async def get_messages(
|
||||||
self,
|
self,
|
||||||
@@ -1735,13 +1746,12 @@ class A2AService:
|
|||||||
content=body,
|
content=body,
|
||||||
options=options or None,
|
options=options or None,
|
||||||
)
|
)
|
||||||
await self._publish_a2a_message_sent(msg, task_id, from_slug, to_slug, skill)
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def _publish_a2a_message_sent(
|
async def _publish_a2a_message_sent(
|
||||||
msg: A2AChatMessage,
|
msg: A2AChatMessage,
|
||||||
task_id: UUID,
|
task_id: str | None,
|
||||||
from_slug: str,
|
from_slug: str,
|
||||||
to_slug: str,
|
to_slug: str,
|
||||||
skill: str | None,
|
skill: str | None,
|
||||||
@@ -1765,7 +1775,7 @@ class A2AService:
|
|||||||
data={
|
data={
|
||||||
"conversation_id": msg.conversation_id,
|
"conversation_id": msg.conversation_id,
|
||||||
"message_id": msg.id,
|
"message_id": msg.id,
|
||||||
"task_id": str(task_id),
|
"task_id": task_id,
|
||||||
"from_agent": from_slug,
|
"from_agent": from_slug,
|
||||||
"to_agent": to_slug,
|
"to_agent": to_slug,
|
||||||
"skill": skill,
|
"skill": skill,
|
||||||
|
|||||||
@@ -1947,6 +1947,17 @@ class OptimalService:
|
|||||||
details["llm_model"] = settings.local_llm_model
|
details["llm_model"] = settings.local_llm_model
|
||||||
details["llm_base_url"] = settings.local_llm_base_url
|
details["llm_base_url"] = settings.local_llm_base_url
|
||||||
return True
|
return True
|
||||||
|
# A non-2xx (e.g. Ollama Cloud 429 weekly-limit) is NOT an
|
||||||
|
# httpx exception, so record the status + upstream message
|
||||||
|
# instead of returning a bare, diagnostic-less False.
|
||||||
|
reason = resp.text[:200]
|
||||||
|
try:
|
||||||
|
body = resp.json()
|
||||||
|
if isinstance(body, dict) and body.get("error"):
|
||||||
|
reason = str(body["error"])
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
details["llm_error"] = f"HTTP {resp.status_code}: {reason}"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
details["llm_error"] = str(e)
|
details["llm_error"] = str(e)
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -529,6 +529,53 @@ async def test_send_bus_failure_does_not_break_send(a2a_setup: dict) -> None:
|
|||||||
assert sent.content == "hello"
|
assert sent.content == "hello"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_send_chat_message_directly_publishes_event(
|
||||||
|
a2a_setup: dict,
|
||||||
|
) -> None:
|
||||||
|
"""The REST send paths (conversation-create + post-message) call
|
||||||
|
send_chat_message directly, not the send() wrapper. That direct path must
|
||||||
|
still emit A2A_MESSAGE_SENT so those messages light up the CEO's live view
|
||||||
|
— the gap this test guards."""
|
||||||
|
svc = a2a_setup["svc"]
|
||||||
|
task_id = a2a_setup["task_id"]
|
||||||
|
conv = await svc.get_or_create_conversation("be-dev-1", "be-qa", task_id=task_id)
|
||||||
|
mock_bus = AsyncMock()
|
||||||
|
mock_bus.is_connected = lambda: True
|
||||||
|
mock_bus.publish = AsyncMock(return_value=None)
|
||||||
|
with patch("roboco.services.a2a.get_event_bus", return_value=mock_bus):
|
||||||
|
sent = await svc.send_chat_message(
|
||||||
|
UUID(conv.id),
|
||||||
|
"be-dev-1",
|
||||||
|
"please review",
|
||||||
|
options={"skill": "code_review"},
|
||||||
|
)
|
||||||
|
mock_bus.publish.assert_awaited_once()
|
||||||
|
data = mock_bus.publish.await_args.args[0].data
|
||||||
|
assert data["message_id"] == sent.id
|
||||||
|
assert data["from_agent"] == "be-dev-1"
|
||||||
|
assert data["to_agent"] == "be-qa"
|
||||||
|
assert data["skill"] == "code_review"
|
||||||
|
assert data["task_id"] == str(task_id)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_suppressed_duplicate_does_not_republish(
|
||||||
|
a2a_setup: dict,
|
||||||
|
) -> None:
|
||||||
|
"""A re-sent identical unread message dedups to the existing row and must
|
||||||
|
NOT emit a second live-view event (no redundant cache invalidation)."""
|
||||||
|
svc = a2a_setup["svc"]
|
||||||
|
conv = await svc.get_or_create_conversation("be-dev-1", "be-qa")
|
||||||
|
mock_bus = AsyncMock()
|
||||||
|
mock_bus.is_connected = lambda: True
|
||||||
|
mock_bus.publish = AsyncMock(return_value=None)
|
||||||
|
with patch("roboco.services.a2a.get_event_bus", return_value=mock_bus):
|
||||||
|
await svc.send_chat_message(UUID(conv.id), "be-dev-1", "same text")
|
||||||
|
await svc.send_chat_message(UUID(conv.id), "be-dev-1", "same text")
|
||||||
|
mock_bus.publish.assert_awaited_once()
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Admin (CEO live view) service methods — no participant filter
|
# Admin (CEO live view) service methods — no participant filter
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user