/* Shared — the cross-project global feed and the shared key/value context store. * Writing a context key needs the higher-trust shared-write token. */ "use client"; import { useState } from "react"; import { useDashboard } from "@/components/store"; import { Button, Card, Input, StatusBadge } from "@/components/ui"; import { fmtFull } from "@/lib/format"; export function SharedSection() { const s = useDashboard(); const [key, setKey] = useState(""); const [value, setValue] = useState(""); const set = async () => { if (!key.trim() || !value.trim()) return; const ok = await s.setSharedKey(key.trim(), value.trim()); if (ok) { setKey(""); setValue(""); } }; return ( <>
Shared
The cross-project global feed and shared facts.
Global feed
{s.shared.log.length === 0 ? (
No global log entries.
) : (
{s.shared.log.map((e) => ( ))}
When Agent Status Summary CI
{fmtFull(e.created_at)} {e.agent_id} {e.summary || "—"}
)}
Set a shared key

Requires the shared-context write token (or admin/global if unset).

{s.shared.context.length > 0 && (
{s.shared.context.map((c) => ( ))}
Key Value Updated
{c.key} {c.value} {fmtFull(c.updated_at)}
)}
); }