Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.
Let a coworker be pinned to the top of the Agents screen (#650)
Asem ahmed8abe8db20801
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f37d8968..784fdc80 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,15 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged.## Unreleased+### A coworker can be pinned to the top of the Agents screen++A coworker's Manage tab has a **Pin** switch beside Hide, and pinned coworkers move into a+**Pinned** section at the top of `/agents`. Like hiding, pinning is personal: it changes nothing for+anyone else. It is stored next to `hidden_at` in `agent_preferences` as a new `pinned_at` column+(migration `0047_agent_pinning`), and each write sets only its own column, so pinning a hidden+coworker keeps it hidden and it comes back pinned when unhidden. `POST /api/agents/:id/pin` and+`/unpin` record `bot.pinned` and `bot.unpinned` on the trail, as hiding does.+### A hidden coworker can be found again on the Agents screenHiding a coworker took it off both lists on `/agents`, and Unhide is only in the coworker's dialog,diff --git a/README.md b/README.mdindex 1f093e86..0a391dd4 100644--- a/README.md+++ b/README.md@@ -154,7 +154,7 @@ Leave `EMBEDDED_POSTGRES` off and set `DATABASE_URL` to point at a database you| Route | Purpose || --------------------------- | ------------------------------------------------------------------ || `/` | Start and browse channels. |-| `/agents` | Create, edit, duplicate, hide, delete, and launch coworkers. |+| `/agents` | Create, edit, duplicate, pin, hide, delete, and launch coworkers. || `/channel/:id` | Converse with one coworker, watch its screen, and see what it ran. || `/bot` | Direct chat with a Bot; `?agent=<id>` selects one. || `/skills` | Create and enable personal skills. |diff --git a/app/src/components/agents/agent-dialog.tsx b/app/src/components/agents/agent-dialog.tsxindex 25ff53b7..9b4f76b1 100644--- a/app/src/components/agents/agent-dialog.tsx+++ b/app/src/components/agents/agent-dialog.tsx@@ -67,6 +67,7 @@ import {deleteAgentMutationOptions,duplicateAgentMutationOptions,setAgentHiddenMutationOptions,+ setAgentPinnedMutationOptions,updateAgentMutationOptions,} from "@/lib/agents/mutations";import { type AgentProfile, agentQueryOptions } from "@/lib/agents/queries";@@ -694,17 +695,48 @@ function ManageSection({const queryClient = useQueryClient();const navigate = useNavigate();const [confirmingDelete, setConfirmingDelete] = useState(false);+ const setPinned = useMutation(setAgentPinnedMutationOptions(queryClient));const setHidden = useMutation(setAgentHiddenMutationOptions(queryClient));const duplicateAgent = useMutation(duplicateAgentMutationOptions(queryClient),);const deleteAgent = useMutation(deleteAgentMutationOptions(queryClient));- const actionError = setHidden.error ?? duplicateAgent.error;+ const actionError =+ setPinned.error ?? setHidden.error ?? duplicateAgent.error;return (<>{/* The same gap the General items keep, so the two screens read as one list style. */}<div className="flex flex-col gap-2">+ <Item variant="muted">+ <ItemContent>+ <ItemTitle>{profile.pinned ? "Pinned" : "Pin"}</ItemTitle>+ <ItemDescription>+ {profile.pinned+ ? "At the top of your agents list. This changes nothing for anyone else."+ : "Keep it at the top of your agents list. This changes nothing for anyone else."}+ </ItemDescription>+ </ItemContent>+ <ItemActions>+ <Button+ disabled={setPinned.isPending}+ onClick={() =>+ setPinned.mutate({ agentId, pinned: !profile.pinned })+ }+ size="sm"+ variant="outline"+ >+ {setPinned.isPending+ ? profile.pinned+ ? "Unpinning…"+ : "Pinning…"+ : profile.pinned+ ? "Unpin"+ : "Pin"}+ </Button>+ </ItemActions>+ </Item>+<Item variant="muted"><ItemContent><ItemTitle>{profile.hidden ? "Hidden" : "Hide"}</ItemTitle>diff --git a/app/src/lib/agents/mutations.ts b/app/src/lib/agents/mutations.tsindex ddbdb22b..639f6961 100644--- a/app/src/lib/agents/mutations.ts+++ b/app/src/lib/agents/mutations.ts@@ -76,6 +76,18 @@ export function setAgentHiddenMutationOptions(queryClient: QueryClient) {});}+export function setAgentPinnedMutationOptions(queryClient: QueryClient) {+ return mutationOptions({+ mutationFn: async (variables: { agentId: string; pinned: boolean }) => {+ await client(+ `${agentApiPath(variables.agentId)}/${variables.pinned ? "pin" : "unpin"}`,+ { method: "POST", fallback: FALLBACK },+ );+ },+ onSuccess: () => invalidateAgents(queryClient),+ });+}+export function deleteAgentMutationOptions(queryClient: QueryClient) {return mutationOptions({mutationFn: async (agentId: string) => {diff --git a/app/src/lib/agents/queries.ts b/app/src/lib/agents/queries.tsindex 86d179d6..a7f21036 100644--- a/app/src/lib/agents/queries.ts+++ b/app/src/lib/agents/queries.ts@@ -37,6 +37,8 @@ export type AgentProfile = {*/hasCallbackToken: boolean;hidden: boolean;+ /** Whether the signed-in person pinned it to the top of their agents list. Nobody else's. */+ pinned: boolean;systemOwned: boolean;canManage: boolean;/**diff --git a/app/src/routes/_authed/_app/agents/index.tsx b/app/src/routes/_authed/_app/agents/index.tsxindex fee6b3c8..cd1f7b06 100644--- a/app/src/routes/_authed/_app/agents/index.tsx+++ b/app/src/routes/_authed/_app/agents/index.tsx@@ -46,8 +46,15 @@ function AgentsScreen() {isPending: loading,isError: failed,} = useQuery(agentListQueryOptions());- const mine = agents?.filter((a) => a.mine);- const explore = agents?.filter(isSharedWithYou);+ /*+ * A pinned coworker moves up into its own section rather than appearing twice. The two rosters+ * below then say so when pinning emptied them, instead of claiming there is nothing at all.+ */+ const pinned = agents?.filter((a) => a.pinned);+ const mine = agents?.filter((a) => a.mine && !a.pinned);+ const explore = agents?.filter((a) => isSharedWithYou(a) && !a.pinned);+ const minePinned = agents?.some((a) => a.mine && a.pinned);+ const explorePinned = agents?.some((a) => isSharedWithYou(a) && a.pinned);/** Hiding takes a coworker off both lists above, and Unhide lives in its dialog, which only a card* opens. Without this section a hidden coworker had no way back onto the screen short of typing@@ -65,7 +72,21 @@ function AgentsScreen() {<><SidebarToggleBar /><div className="max-w-2xl px-4 w-full mx-auto">- <div className="mt-12 w-full max-w-2xl">+ {pinned?.length ? (+ <div className="mt-12 w-full max-w-2xl">+ <h2 className="font-bold text-lg">Pinned</h2>+ <div className="mt-4 grid grid-cols-2 gap-4">+ {pinned.map((agent, index) => (+ <StaggerItem className="min-w-0" index={index} key={agent.id}>+ <AgentCard agent={agent} />+ </StaggerItem>+ ))}+ </div>+ </div>+ ) : null}+ <div+ className={`${pinned?.length ? "mt-8" : "mt-12"} w-full max-w-2xl`}+ ><div className="flex flex-row w-full items-center justify-between"><h2 className="font-bold text-lg">Your agents</h2><Button@@ -97,6 +118,14 @@ function AgentsScreen() {);})}</div>+ ) : minePinned ? (+ <Empty className="mt-4 h-[180px] border border-dashed">+ <EmptyHeader>+ <EmptyTitle className="text-muted-foreground">+ Your agents are all pinned above.+ </EmptyTitle>+ </EmptyHeader>+ </Empty>) : failed && agents === undefined ? (// `agents === undefined` narrows this to "the query has never once returned// successfully" — not merely "the last request errored". `?.length` alone can't@@ -144,6 +173,14 @@ function AgentsScreen() {);})}</div>+ ) : explorePinned ? (+ <Empty className="mt-4 h-[180px] border border-dashed">+ <EmptyHeader>+ <EmptyTitle className="text-muted-foreground">+ The agents shared with you are all pinned above.+ </EmptyTitle>+ </EmptyHeader>+ </Empty>) : failed && agents === undefined ? (// `agents === undefined` narrows this to "the query has never once returned// successfully" — not merely "the last request errored". `?.length` alone can'tdiff --git a/app/tests/agent-api-path.test.ts b/app/tests/agent-api-path.test.tsindex 5dadf7ea..3f2f08d2 100644--- a/app/tests/agent-api-path.test.ts+++ b/app/tests/agent-api-path.test.ts@@ -12,6 +12,7 @@ import {issueCallbackTokenMutationOptions,revokeCallbackTokenMutationOptions,setAgentHiddenMutationOptions,+ setAgentPinnedMutationOptions,updateAgentMutationOptions,} from "../src/lib/agents/mutations";import {@@ -47,6 +48,7 @@ function boundary(id: string, refusal?: "unauthenticated" | "forbidden") {ownerUserId: actor.id,systemOwned: false,hidden: false,+ pinned: false,deletedAt: null,endpoint: null,hasAuth: false,@@ -86,6 +88,9 @@ function boundary(id: string, refusal?: "unauthenticated" | "forbidden") {async setHidden(_actor, receivedId, value) {record("setHidden", receivedId, value);},+ async setPinned(_actor, receivedId, value) {+ record("setPinned", receivedId, value);+ },async softDelete(_actor, receivedId) {record("softDelete", receivedId);},@@ -180,6 +185,26 @@ function operations(client: QueryClient, id: string) {setAgentHiddenMutationOptions(client),).mutate({ agentId: id, hidden: false }),},+ {+ method: "POST",+ suffix: "/pin",+ body: null,+ run: () =>+ new MutationObserver(+ client,+ setAgentPinnedMutationOptions(client),+ ).mutate({ agentId: id, pinned: true }),+ },+ {+ method: "POST",+ suffix: "/unpin",+ body: null,+ run: () =>+ new MutationObserver(+ client,+ setAgentPinnedMutationOptions(client),+ ).mutate({ agentId: id, pinned: false }),+ },{method: "DELETE",suffix: "",@@ -241,7 +266,7 @@ for (const id of [body: operation.body,});}- expect(calls.map((call) => call.id)).toEqual(Array(9).fill(id));+ expect(calls.map((call) => call.id)).toEqual(Array(11).fill(id));expect(calls.find((call) => call.operation === "update")?.value).toEqual(input,);@@ -268,10 +293,10 @@ for (const refusal of ["unauthenticated", "forbidden"] as const) {).rejects.toThrow();for (const operation of operations(client, id))await expect(operation.run()).rejects.toThrow();- expect(requests).toHaveLength(9);+ expect(requests).toHaveLength(11);expect(calls).toHaveLength(0);expect(statuses).toEqual(- Array(9).fill(refusal === "unauthenticated" ? 401 : 403),+ Array(11).fill(refusal === "unauthenticated" ? 401 : 403),);expect(requests.every((request) =>diff --git a/app/tests/agent-dialog-built-in-edit.test.tsx b/app/tests/agent-dialog-built-in-edit.test.tsxindex 0b320e5d..9b73f5b1 100644--- a/app/tests/agent-dialog-built-in-edit.test.tsx+++ b/app/tests/agent-dialog-built-in-edit.test.tsx@@ -74,6 +74,7 @@ function serve(endpoint: string) {ownerUserId: actor.id,systemOwned: false,hidden: false,+ pinned: false,deletedAt: null,endpoint,hasAuth: false,diff --git a/app/tests/agent-roster-error.test.tsx b/app/tests/agent-roster-error.test.tsxindex 12731ea2..44535d7c 100644--- a/app/tests/agent-roster-error.test.tsx+++ b/app/tests/agent-roster-error.test.tsx@@ -98,6 +98,7 @@ function agent(hasAuth: false,hasCallbackToken: false,hidden: false,+ pinned: false,systemOwned: false,canManage: true,mine: true,@@ -496,6 +497,48 @@ test("with nothing hidden, /agents has no Hidden section at all", async () => {expect(view.container.querySelector("details")).toBeNull();});+test("a pinned coworker moves into Pinned at the top, out of its roster", async () => {+ const kept = agent({ id: "mine-1", name: "Kept Agent" });+ const favourite = agent({ id: "mine-2", name: "Favourite", pinned: true });+ servingRosters([kept, favourite], []);++ const view = renderAgents(failingQueryClient());++ expect(await view.findByText("Pinned")).toBeTruthy();+ const headings = [...view.container.querySelectorAll("h2")].map(+ (heading) => heading.textContent,+ );+ expect(headings).toEqual(["Pinned", "Your agents", "Explore agents"]);+ // Once, in Pinned, rather than twice.+ expect(view.getAllByText("Favourite")).toHaveLength(1);+ const pinnedSection = view.getByText("Pinned").parentElement;+ expect(pinnedSection?.textContent).toContain("Favourite");+ expect(pinnedSection?.textContent).not.toContain("Kept Agent");+});++test("with every coworker of yours pinned, Your agents says so instead of claiming none", async () => {+ servingRosters(+ [agent({ id: "mine-1", name: "Favourite", pinned: true })],+ [],+ );++ const view = renderAgents(failingQueryClient());++ expect(+ await view.findByText("Your agents are all pinned above."),+ ).toBeTruthy();+ expect(view.queryByText("You don't have any agents created.")).toBeNull();+});++test("with nothing pinned, /agents has no Pinned section", async () => {+ servingRosters([agent({ id: "mine-1", name: "Mine Agent" })], []);++ const view = renderAgents(failingQueryClient());++ expect(await view.findByText("Mine Agent")).toBeTruthy();+ expect(view.queryByText("Pinned")).toBeNull();+});+test("a failed REFETCH on / with explore empty shows it as empty, not broken", async () => {const mine = agent({ id: "mine-1", name: "Mine Agent", mine: true });const queryClient = staleQueryClient([mine]);diff --git a/app/tests/agent-shared-with-you.test.ts b/app/tests/agent-shared-with-you.test.tsindex 5a3db04b..c1b6fbcc 100644--- a/app/tests/agent-shared-with-you.test.ts+++ b/app/tests/agent-shared-with-you.test.ts@@ -21,6 +21,7 @@ function agent(overrides: Partial<AgentProfile>): AgentProfile {hasAuth: false,hasCallbackToken: false,hidden: false,+ pinned: false,systemOwned: false,canManage: false,mine: false,diff --git a/app/tests/bot-route-default-agent.test.tsx b/app/tests/bot-route-default-agent.test.tsxindex f650dcdd..6baa2b40 100644--- a/app/tests/bot-route-default-agent.test.tsx+++ b/app/tests/bot-route-default-agent.test.tsx@@ -48,6 +48,7 @@ function agent(hasAuth: false,hasCallbackToken: false,hidden: false,+ pinned: false,mine: true,name: "Agent",roleDescription: "Role",diff --git a/app/tests/channel-new-error-state.test.tsx b/app/tests/channel-new-error-state.test.tsxindex f3f6991b..ac3bdc9d 100644--- a/app/tests/channel-new-error-state.test.tsx+++ b/app/tests/channel-new-error-state.test.tsx@@ -32,6 +32,7 @@ function agent(hasAuth: false,hasCallbackToken: false,hidden: false,+ pinned: false,mine: true,name: "Agent",roleDescription: "Role",diff --git a/app/tests/composing-enter.test.tsx b/app/tests/composing-enter.test.tsxindex 75a4f359..2c7b85a7 100644--- a/app/tests/composing-enter.test.tsx+++ b/app/tests/composing-enter.test.tsx@@ -61,6 +61,7 @@ const PROFILE: AgentProfile = {hasAuth: false,hasCallbackToken: false,hidden: false,+ pinned: false,systemOwned: false,canManage: true,mine: true,diff --git a/app/tests/default-agent.test.ts b/app/tests/default-agent.test.tsindex 9e68308b..a2d338d8 100644--- a/app/tests/default-agent.test.ts+++ b/app/tests/default-agent.test.ts@@ -15,6 +15,7 @@ function agent(id: string, name = id): AgentProfile {hasAuth: false,hasCallbackToken: false,hidden: false,+ pinned: false,id,mine: true,name,diff --git a/app/tests/home-fallback-routing.test.tsx b/app/tests/home-fallback-routing.test.tsxindex 97322038..e0d0ff42 100644--- a/app/tests/home-fallback-routing.test.tsx+++ b/app/tests/home-fallback-routing.test.tsx@@ -36,6 +36,7 @@ function agent(hasAuth: false,hasCallbackToken: false,hidden: false,+ pinned: false,mine: true,name: "Agent",roleDescription: "Role",diff --git a/server/drizzle/0047_agent_pinning.sql b/server/drizzle/0047_agent_pinning.sqlnew file mode 100644index 00000000..6b09a0c0--- /dev/null+++ b/server/drizzle/0047_agent_pinning.sql@@ -0,0 +1 @@+ALTER TABLE "agent_preferences" ADD COLUMN "pinned_at" timestamp with time zone;\ No newline at end of filediff --git a/server/drizzle/meta/0047_snapshot.json b/server/drizzle/meta/0047_snapshot.jsonnew file mode 100644index 00000000..7b89fa78--- /dev/null+++ b/server/drizzle/meta/0047_snapshot.json@@ -0,0 +1,3711 @@+{+ "id": "89c64692-6023-40e1-b56a-fd4dacc449ff",+ "prevId": "0dedfeb8-cb81-45b7-9510-633bc3bf8337",+ "version": "7",+ "dialect": "postgresql",+ "tables": {+ "public.accounts": {+ "name": "accounts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "account_id": {+ "name": "account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider_id": {+ "name": "provider_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "issuer": {+ "name": "issuer",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "accounts_provider_account_idx": {+ "name": "accounts_provider_account_idx",+ "columns": [+ {+ "expression": "provider_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "accounts_user_id_users_id_fk": {+ "name": "accounts_user_id_users_id_fk",+ "tableFrom": "accounts",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agents": {+ "name": "agents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "agent_type",+ "typeSchema": "public",+ "primaryKey": false,+ "notNull": true+ },+ "configuration": {+ "name": "configuration",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "package_id": {+ "name": "package_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "override": {+ "name": "override",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "agents_package_id_deployment_packages_id_fk": {+ "name": "agents_package_id_deployment_packages_id_fk",+ "tableFrom": "agents",+ "tableTo": "deployment_packages",+ "columnsFrom": [+ "package_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.attachments": {+ "name": "attachments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "uploaded_by": {+ "name": "uploaded_by",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "mime_type": {+ "name": "mime_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "bytes": {+ "name": "bytes",+ "type": "bytea",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "attached_at": {+ "name": "attached_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "upload_group": {+ "name": "upload_group",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "attachments_channel_idx": {+ "name": "attachments_channel_idx",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "attachments_uploaded_by_idx": {+ "name": "attachments_uploaded_by_idx",+ "columns": [+ {+ "expression": "uploaded_by",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "attachments_upload_group_idx": {+ "name": "attachments_upload_group_idx",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "uploaded_by",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "upload_group",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"attachments\".\"attached_at\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "attachments_staged_idx": {+ "name": "attachments_staged_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"attachments\".\"attached_at\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "attachments_channel_id_channels_id_fk": {+ "name": "attachments_channel_id_channels_id_fk",+ "tableFrom": "attachments",+ "tableTo": "channels",+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "attachments_uploaded_by_users_id_fk": {+ "name": "attachments_uploaded_by_users_id_fk",+ "tableFrom": "attachments",+ "tableTo": "users",+ "columnsFrom": [+ "uploaded_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.audit_events": {+ "name": "audit_events",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "initiator_kind": {+ "name": "initiator_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'person'"+ },+ "initiator_id": {+ "name": "initiator_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "event_type": {+ "name": "event_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_type": {+ "name": "target_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "audit_events_created_at_idx": {+ "name": "audit_events_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "audit_events_type_time_idx": {+ "name": "audit_events_type_time_idx",+ "columns": [+ {+ "expression": "event_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "audit_events_actor_time_idx": {+ "name": "audit_events_actor_time_idx",+ "columns": [+ {+ "expression": "actor_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "audit_events_target_time_idx": {+ "name": "audit_events_target_time_idx",+ "columns": [+ {+ "expression": "target_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "audit_events_initiator_time_idx": {+ "name": "audit_events_initiator_time_idx",+ "columns": [+ {+ "expression": "initiator_kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.channel_agents": {+ "name": "channel_agents",+ "schema": "",+ "columns": {+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "channel_agents_channel_id_channels_id_fk": {+ "name": "channel_agents_channel_id_channels_id_fk",+ "tableFrom": "channel_agents",+ "tableTo": "channels",+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_agents_agent_id_agents_id_fk": {+ "name": "channel_agents_agent_id_agents_id_fk",+ "tableFrom": "channel_agents",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "channel_agents_channel_id_agent_id_pk": {+ "name": "channel_agents_channel_id_agent_id_pk",+ "columns": [+ "channel_id",+ "agent_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.channel_memberships": {+ "name": "channel_memberships",+ "schema": "",+ "columns": {+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "pinned_at": {+ "name": "pinned_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_read_at": {+ "name": "last_read_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "channel_memberships_channel_id_channels_id_fk": {+ "name": "channel_memberships_channel_id_channels_id_fk",+ "tableFrom": "channel_memberships",+ "tableTo": "channels",+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_memberships_user_id_users_id_fk": {+ "name": "channel_memberships_user_id_users_id_fk",+ "tableFrom": "channel_memberships",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "channel_memberships_channel_id_user_id_pk": {+ "name": "channel_memberships_channel_id_user_id_pk",+ "columns": [+ "channel_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.channels": {+ "name": "channels",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "suggested_prompts": {+ "name": "suggested_prompts",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'"+ },+ "allowed_groups": {+ "name": "allowed_groups",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'"+ },+ "package_id": {+ "name": "package_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "override": {+ "name": "override",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "summary_at": {+ "name": "summary_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_message": {+ "name": "last_message",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_message_source_id": {+ "name": "last_message_source_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_message_at": {+ "name": "last_message_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_message_agent_id": {+ "name": "last_message_agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "channels_recent_activity_idx": {+ "name": "channels_recent_activity_idx",+ "columns": [+ {+ "expression": "COALESCE(\"last_message_at\", \"created_at\") DESC",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channels_awaiting_summary_idx": {+ "name": "channels_awaiting_summary_idx",+ "columns": [+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"channels\".\"summary\" is null and \"channels\".\"deleted_at\" is null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channels_package_id_deployment_packages_id_fk": {+ "name": "channels_package_id_deployment_packages_id_fk",+ "tableFrom": "channels",+ "tableTo": "deployment_packages",+ "columnsFrom": [+ "package_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "channels_last_message_agent_id_agents_id_fk": {+ "name": "channels_last_message_agent_id_agents_id_fk",+ "tableFrom": "channels",+ "tableTo": "agents",+ "columnsFrom": [+ "last_message_agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.credentials": {+ "name": "credentials",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "kind": {+ "name": "kind",+ "type": "credential_kind",+ "typeSchema": "public",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "encrypted_value": {+ "name": "encrypted_value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "key_id": {+ "name": "key_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "credentials_active_key_idx": {+ "name": "credentials_active_key_idx",+ "columns": [+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "key_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"credentials\".\"revoked_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.deployment_packages": {+ "name": "deployment_packages",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "tenant_id": {+ "name": "tenant_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_path": {+ "name": "source_path",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "checksum": {+ "name": "checksum",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "loaded_at": {+ "name": "loaded_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "deployment_packages_tenant_id_unique": {+ "name": "deployment_packages_tenant_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "tenant_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.intelligence_channel_mappings": {+ "name": "intelligence_channel_mappings",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "intelligence_channel_mappings_thread_idx": {+ "name": "intelligence_channel_mappings_thread_idx",+ "columns": [+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "intelligence_channel_mappings_user_id_users_id_fk": {+ "name": "intelligence_channel_mappings_user_id_users_id_fk",+ "tableFrom": "intelligence_channel_mappings",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "intelligence_channel_mappings_channel_id_channels_id_fk": {+ "name": "intelligence_channel_mappings_channel_id_channels_id_fk",+ "tableFrom": "intelligence_channel_mappings",+ "tableTo": "channels",+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "intelligence_channel_mappings_user_id_channel_id_pk": {+ "name": "intelligence_channel_mappings_user_id_channel_id_pk",+ "columns": [+ "user_id",+ "channel_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.revoked_access": {+ "name": "revoked_access",+ "schema": "",+ "columns": {+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "revoked_by": {+ "name": "revoked_by",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.sessions": {+ "name": "sessions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_agent": {+ "name": "user_agent",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "sessions_user_id_users_id_fk": {+ "name": "sessions_user_id_users_id_fk",+ "tableFrom": "sessions",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "sessions_token_unique": {+ "name": "sessions_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.sso_providers": {+ "name": "sso_providers",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "issuer": {+ "name": "issuer",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "oidc_config": {+ "name": "oidc_config",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "saml_config": {+ "name": "saml_config",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_id": {+ "name": "provider_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "domain": {+ "name": "domain",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "sso_providers_user_id_users_id_fk": {+ "name": "sso_providers_user_id_users_id_fk",+ "tableFrom": "sso_providers",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "sso_providers_provider_id_unique": {+ "name": "sso_providers_provider_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "provider_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_instructions": {+ "name": "user_instructions",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "instructions": {+ "name": "instructions",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "user_instructions_user_id_users_id_fk": {+ "name": "user_instructions_user_id_users_id_fk",+ "tableFrom": "user_instructions",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_roles": {+ "name": "user_roles",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "role",+ "typeSchema": "public",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "user_roles_user_id_users_id_fk": {+ "name": "user_roles_user_id_users_id_fk",+ "tableFrom": "user_roles",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "user_roles_user_id_role_pk": {+ "name": "user_roles_user_id_role_pk",+ "columns": [+ "user_id",+ "role"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.users": {+ "name": "users",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "email_verified": {+ "name": "email_verified",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "preferences": {+ "name": "preferences",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "groups": {+ "name": "groups",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'"+ },+ "onboarding_step": {+ "name": "onboarding_step",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "onboarding_completed_at": {+ "name": "onboarding_completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_signed_in_at": {+ "name": "last_signed_in_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "users_email_unique": {+ "name": "users_email_unique",+ "nullsNotDistinct": false,+ "columns": [+ "email"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verifications": {+ "name": "verifications",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.action_policy": {+ "name": "action_policy",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "mode": {+ "name": "mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "deny": {+ "name": "deny",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ },+ "allow": {+ "name": "allow",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ },+ "updated_by": {+ "name": "updated_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.computer_page_frame": {+ "name": "computer_page_frame",+ "schema": "",+ "columns": {+ "computer_id": {+ "name": "computer_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "tool_call_id": {+ "name": "tool_call_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "frame": {+ "name": "frame",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "computer_page_frame_captured_idx": {+ "name": "computer_page_frame_captured_idx",+ "columns": [+ {+ "expression": "captured_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "computer_page_frame_computer_id_tool_call_id_pk": {+ "name": "computer_page_frame_computer_id_tool_call_id_pk",+ "columns": [+ "computer_id",+ "tool_call_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.computer_snapshot": {+ "name": "computer_snapshot",+ "schema": "",+ "columns": {+ "computer_id": {+ "name": "computer_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "snapshot_id": {+ "name": "snapshot_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "elements": {+ "name": "elements",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "taken_at": {+ "name": "taken_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "session": {+ "name": "session",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_preferences": {+ "name": "agent_preferences",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "hidden_at": {+ "name": "hidden_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "pinned_at": {+ "name": "pinned_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "agent_preferences_user_id_users_id_fk": {+ "name": "agent_preferences_user_id_users_id_fk",+ "tableFrom": "agent_preferences",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_preferences_agent_id_agents_id_fk": {+ "name": "agent_preferences_agent_id_agents_id_fk",+ "tableFrom": "agent_preferences",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_preferences_user_id_agent_id_pk": {+ "name": "agent_preferences_user_id_agent_id_pk",+ "columns": [+ "user_id",+ "agent_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_profiles": {+ "name": "agent_profiles",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role_description": {+ "name": "role_description",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "avatar_seed": {+ "name": "avatar_seed",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "visibility": {+ "name": "visibility",+ "type": "agent_visibility",+ "typeSchema": "public",+ "primaryKey": false,+ "notNull": true+ },+ "callback_token_hash": {+ "name": "callback_token_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "callback_token_issued_at": {+ "name": "callback_token_issued_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_profiles_visibility_deleted_idx": {+ "name": "agent_profiles_visibility_deleted_idx",+ "columns": [+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "deleted_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_profiles_agent_id_agents_id_fk": {+ "name": "agent_profiles_agent_id_agents_id_fk",+ "tableFrom": "agent_profiles",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_profiles_owner_user_id_users_id_fk": {+ "name": "agent_profiles_owner_user_id_users_id_fk",+ "tableFrom": "agent_profiles",+ "tableTo": "users",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.routine_runs": {+ "name": "routine_runs",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "routine_id": {+ "name": "routine_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "routine_run_status",+ "typeSchema": "public",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "routine_runs_by_routine_idx": {+ "name": "routine_runs_by_routine_idx",+ "columns": [+ {+ "expression": "routine_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "routine_runs_routine_id_routines_id_fk": {+ "name": "routine_runs_routine_id_routines_id_fk",+ "tableFrom": "routine_runs",+ "tableTo": "routines",+ "columnsFrom": [+ "routine_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.routine_sweeps": {+ "name": "routine_sweeps",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "swept_at": {+ "name": "swept_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "owner": {+ "name": "owner",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.routines": {+ "name": "routines",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "instruction": {+ "name": "instruction",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "cron": {+ "name": "cron",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'UTC'"+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "next_run_at": {+ "name": "next_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "last_run_at": {+ "name": "last_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "routines_due_idx": {+ "name": "routines_due_idx",+ "columns": [+ {+ "expression": "enabled",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_run_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "routines_by_owner_idx": {+ "name": "routines_by_owner_idx",+ "columns": [+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "enabled",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "routines_owner_user_id_users_id_fk": {+ "name": "routines_owner_user_id_users_id_fk",+ "tableFrom": "routines",+ "tableTo": "users",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "routines_agent_id_agents_id_fk": {+ "name": "routines_agent_id_agents_id_fk",+ "tableFrom": "routines",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.component_exclusions": {+ "name": "component_exclusions",+ "schema": "",+ "columns": {+ "component_name": {+ "name": "component_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "withheld_by": {+ "name": "withheld_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "component_exclusions_component_name_components_name_fk": {+ "name": "component_exclusions_component_name_components_name_fk",+ "tableFrom": "component_exclusions",+ "tableTo": "components",+ "columnsFrom": [+ "component_name"+ ],+ "columnsTo": [+ "name"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "component_exclusions_agent_id_agents_id_fk": {+ "name": "component_exclusions_agent_id_agents_id_fk",+ "tableFrom": "component_exclusions",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "component_exclusions_component_name_agent_id_pk": {+ "name": "component_exclusions_component_name_agent_id_pk",+ "columns": [+ "component_name",+ "agent_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.component_functions": {+ "name": "component_functions",+ "schema": "",+ "columns": {+ "component_name": {+ "name": "component_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "function_name": {+ "name": "function_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "granted_by": {+ "name": "granted_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "component_functions_component_name_components_name_fk": {+ "name": "component_functions_component_name_components_name_fk",+ "tableFrom": "component_functions",+ "tableTo": "components",+ "columnsFrom": [+ "component_name"+ ],+ "columnsTo": [+ "name"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "component_functions_component_name_function_name_pk": {+ "name": "component_functions_component_name_function_name_pk",+ "columns": [+ "component_name",+ "function_name"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.components": {+ "name": "components",+ "schema": "",+ "columns": {+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "draft_description": {+ "name": "draft_description",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "published_description": {+ "name": "published_description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "published": {+ "name": "published",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "published_at": {+ "name": "published_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "updated_by": {+ "name": "updated_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.composio_connections": {+ "name": "composio_connections",+ "schema": "",+ "columns": {+ "toolkit": {+ "name": "toolkit",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "connected_at": {+ "name": "connected_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "verified": {+ "name": "verified",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "verified_at": {+ "name": "verified_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "probe_action": {+ "name": "probe_action",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "composio_connections_user_idx": {+ "name": "composio_connections_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "composio_connections_toolkit_user_id_pk": {+ "name": "composio_connections_toolkit_user_id_pk",+ "columns": [+ "toolkit",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.mcp_servers": {+ "name": "mcp_servers",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "logo": {+ "name": "logo",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "vendor": {+ "name": "vendor",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provenance": {+ "name": "provenance",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'first-party'"+ },+ "credential_id": {+ "name": "credential_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "auth_scheme": {+ "name": "auth_scheme",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tools_refreshed_at": {+ "name": "tools_refreshed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "added_by": {+ "name": "added_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "mcp_servers_credential_id_credentials_id_fk": {+ "name": "mcp_servers_credential_id_credentials_id_fk",+ "tableFrom": "mcp_servers",+ "tableTo": "credentials",+ "columnsFrom": [+ "credential_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "restrict",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.mcp_tools": {+ "name": "mcp_tools",+ "schema": "",+ "columns": {+ "server_id": {+ "name": "server_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "input_schema": {+ "name": "input_schema",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "effect": {+ "name": "effect",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "destructive": {+ "name": "destructive",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "version": {+ "name": "version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "mcp_tools_server_id_mcp_servers_id_fk": {+ "name": "mcp_tools_server_id_mcp_servers_id_fk",+ "tableFrom": "mcp_tools",+ "tableTo": "mcp_servers",+ "columnsFrom": [+ "server_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "mcp_tools_server_id_name_pk": {+ "name": "mcp_tools_server_id_name_pk",+ "columns": [+ "server_id",+ "name"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.mcp_user_credentials": {+ "name": "mcp_user_credentials",+ "schema": "",+ "columns": {+ "server_id": {+ "name": "server_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credential_id": {+ "name": "credential_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "connected_at": {+ "name": "connected_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "mcp_user_credentials_user_idx": {+ "name": "mcp_user_credentials_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "mcp_user_credentials_server_id_mcp_servers_id_fk": {+ "name": "mcp_user_credentials_server_id_mcp_servers_id_fk",+ "tableFrom": "mcp_user_credentials",+ "tableTo": "mcp_servers",+ "columnsFrom": [+ "server_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "mcp_user_credentials_user_id_users_id_fk": {+ "name": "mcp_user_credentials_user_id_users_id_fk",+ "tableFrom": "mcp_user_credentials",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "mcp_user_credentials_credential_id_credentials_id_fk": {+ "name": "mcp_user_credentials_credential_id_credentials_id_fk",+ "tableFrom": "mcp_user_credentials",+ "tableTo": "credentials",+ "columnsFrom": [+ "credential_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "mcp_user_credentials_server_id_user_id_pk": {+ "name": "mcp_user_credentials_server_id_user_id_pk",+ "columns": [+ "server_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.plugin_grants": {+ "name": "plugin_grants",+ "schema": "",+ "columns": {+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "ref": {+ "name": "ref",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "granted_by": {+ "name": "granted_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "plugin_grants_agent_idx": {+ "name": "plugin_grants_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "plugin_grants_agent_id_agents_id_fk": {+ "name": "plugin_grants_agent_id_agents_id_fk",+ "tableFrom": "plugin_grants",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "plugin_grants_kind_ref_agent_id_pk": {+ "name": "plugin_grants_kind_ref_agent_id_pk",+ "columns": [+ "kind",+ "ref",+ "agent_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.sandboxed_components": {+ "name": "sandboxed_components",+ "schema": "",+ "columns": {+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "draft_description": {+ "name": "draft_description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "draft_html": {+ "name": "draft_html",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "draft_css": {+ "name": "draft_css",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "draft_js_functions": {+ "name": "draft_js_functions",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "draft_argument_schema": {+ "name": "draft_argument_schema",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "published_description": {+ "name": "published_description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "published_html": {+ "name": "published_html",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "published_css": {+ "name": "published_css",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "published_js_functions": {+ "name": "published_js_functions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "published_argument_schema": {+ "name": "published_argument_schema",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "sample_arguments": {+ "name": "sample_arguments",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "revision": {+ "name": "revision",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "published": {+ "name": "published",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "published_at": {+ "name": "published_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "authored_by": {+ "name": "authored_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.skill_tools": {+ "name": "skill_tools",+ "schema": "",+ "columns": {+ "skill_id": {+ "name": "skill_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "ref": {+ "name": "ref",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "declared_by": {+ "name": "declared_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "skill_tools_ref_idx": {+ "name": "skill_tools_ref_idx",+ "columns": [+ {+ "expression": "ref",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "skill_tools_skill_id_skills_id_fk": {+ "name": "skill_tools_skill_id_skills_id_fk",+ "tableFrom": "skill_tools",+ "tableTo": "skills",+ "columnsFrom": [+ "skill_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "skill_tools_skill_id_ref_pk": {+ "name": "skill_tools_skill_id_ref_pk",+ "columns": [+ "skill_id",+ "ref"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.skills": {+ "name": "skills",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "instructions": {+ "name": "instructions",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "origin": {+ "name": "origin",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'yours'"+ },+ "installed_by": {+ "name": "installed_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "skills_slug_key": {+ "name": "skills_slug_key",+ "columns": [+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "skills_owner_idx": {+ "name": "skills_owner_idx",+ "columns": [+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "skills_owner_user_id_users_id_fk": {+ "name": "skills_owner_user_id_users_id_fk",+ "tableFrom": "skills",+ "tableTo": "users",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.work_items": {+ "name": "work_items",+ "schema": "",+ "columns": {+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "run_at": {+ "name": "run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "claimed_by": {+ "name": "claimed_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "lease_until": {+ "name": "lease_until",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "work_items_claimable_idx": {+ "name": "work_items_claimable_idx",+ "columns": [+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "work_items_kind_key_pk": {+ "name": "work_items_kind_key_pk",+ "columns": [+ "kind",+ "key"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.voice_sessions": {+ "name": "voice_sessions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "anchor_message_id": {+ "name": "anchor_message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "ended_at": {+ "name": "ended_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "duration_seconds": {+ "name": "duration_seconds",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "transcript": {+ "name": "transcript",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "summary_status": {+ "name": "summary_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'failed'"+ }+ },+ "indexes": {+ "voice_sessions_channel_started_idx": {+ "name": "voice_sessions_channel_started_idx",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "voice_sessions_channel_id_channels_id_fk": {+ "name": "voice_sessions_channel_id_channels_id_fk",+ "tableFrom": "voice_sessions",+ "tableTo": "channels",+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "voice_sessions_user_id_users_id_fk": {+ "name": "voice_sessions_user_id_users_id_fk",+ "tableFrom": "voice_sessions",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "voice_sessions_duration_check": {+ "name": "voice_sessions_duration_check",+ "value": "\"voice_sessions\".\"duration_seconds\" >= 0"+ },+ "voice_sessions_summary_check": {+ "name": "voice_sessions_summary_check",+ "value": "(\"voice_sessions\".\"summary_status\" = 'ready' AND \"voice_sessions\".\"summary\" IS NOT NULL) OR (\"voice_sessions\".\"summary_status\" = 'failed' AND \"voice_sessions\".\"summary\" IS NULL)"+ }+ },+ "isRLSEnabled": false+ },+ "public.learning_settings": {+ "name": "learning_settings",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "settings": {+ "name": "settings",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.learning_thread_bindings": {+ "name": "learning_thread_bindings",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "container_id": {+ "name": "container_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "learning_thread_bindings_user_id_thread_id_pk": {+ "name": "learning_thread_bindings_user_id_thread_id_pk",+ "columns": [+ "user_id",+ "thread_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ }+ },+ "enums": {+ "public.agent_type": {+ "name": "agent_type",+ "schema": "public",+ "values": [+ "built_in",+ "remote_ag_ui",+ "remote_mastra"+ ]+ },+ "public.credential_kind": {+ "name": "credential_kind",+ "schema": "public",+ "values": [+ "model",+ "connector",+ "agent",+ "mcp",+ "mcp_oauth_client",+ "mcp_user_token"+ ]+ },+ "public.role": {+ "name": "role",+ "schema": "public",+ "values": [+ "admin",+ "user"+ ]+ },+ "public.agent_visibility": {+ "name": "agent_visibility",+ "schema": "public",+ "values": [+ "public",+ "private"+ ]+ },+ "public.routine_run_status": {+ "name": "routine_run_status",+ "schema": "public",+ "values": [+ "succeeded",+ "failed",+ "skipped"+ ]+ }+ },+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/server/drizzle/meta/_journal.json b/server/drizzle/meta/_journal.jsonindex d3b7d0d6..9af4471d 100644--- a/server/drizzle/meta/_journal.json+++ b/server/drizzle/meta/_journal.json@@ -330,6 +330,13 @@"when": 1790447917102,"tag": "0046_automatic_learning","breakpoints": true+ },+ {+ "idx": 47,+ "version": "7",+ "when": 1790572443740,+ "tag": "0047_agent_pinning",+ "breakpoints": true}]}\ No newline at end of filediff --git a/server/src/agents/profile-store.ts b/server/src/agents/profile-store.tsindex 9fc2652d..c798c708 100644--- a/server/src/agents/profile-store.ts+++ b/server/src/agents/profile-store.ts@@ -71,6 +71,7 @@ export type AgentProfileStore = {): Promise<AgentProfile>;duplicate(actor: AgentActor, id: string): Promise<AgentProfile>;setHidden(actor: AgentActor, id: string, hidden: boolean): Promise<void>;+ setPinned(actor: AgentActor, id: string, pinned: boolean): Promise<void>;softDelete(actor: AgentActor, id: string): Promise<void>;/*** Issue this agent a credential for calling tools back, and return it once.@@ -131,6 +132,7 @@ const joinedProjection = {ownerUserId: agentProfiles.ownerUserId,packageId: deploymentPackages.id,hiddenAt: agentPreferences.hiddenAt,+ pinnedAt: agentPreferences.pinnedAt,deletedAt: agentProfiles.deletedAt,/* The hash, only so a surface can say whether one exists. It never leaves this module. */callbackTokenHash: agentProfiles.callbackTokenHash,@@ -177,6 +179,7 @@ function mapProfile(systemOwned: row.packageId !== null,hasCallbackToken: row.callbackTokenHash !== null,hidden: row.hiddenAt !== null,+ pinned: row.pinnedAt !== null,deletedAt: row.deletedAt,endpoint: endpointOf(row.configuration),// Whether a key is set, never which. The form needs to show "a key is set" so a person does not@@ -663,6 +666,31 @@ export function createAgentProfileStore(});},+ /*+ * The same row as hiding, one column over, and the upsert sets only its own column: pinning a+ * hidden coworker keeps it hidden, and it comes back pinned when it is unhidden. Two people, or+ * two tabs, pinning at once meet on the (user, agent) primary key, so the second write updates+ * the row the first one made instead of failing.+ */+ setPinned(actor, id, pinned) {+ return database.transaction(async (transaction) => {+ const profile = await findAccessibleProfile(transaction, actor, id);+ if (!profile) throw new AgentNotFoundError(id);++ await transaction+ .insert(agentPreferences)+ .values({+ userId: actor.id,+ agentId: id,+ pinnedAt: pinned ? new Date() : null,+ })+ .onConflictDoUpdate({+ target: [agentPreferences.userId, agentPreferences.agentId],+ set: { pinnedAt: pinned ? new Date() : null },+ });+ });+ },+softDelete(actor, id) {return database.transaction(async (transaction) => {diff --git a/server/src/agents/profile-types.ts b/server/src/agents/profile-types.tsindex 57dfe396..4d64a10b 100644--- a/server/src/agents/profile-types.ts+++ b/server/src/agents/profile-types.ts@@ -15,6 +15,7 @@ export type AgentProfile = {ownerUserId: string | null;systemOwned: boolean;hidden: boolean;+ pinned: boolean;deletedAt: Date | null;/** Where this coworker runs. Null for the Bot in the box. */endpoint: string | null;diff --git a/server/src/agents/routes.ts b/server/src/agents/routes.tsindex a02eb37e..96e3deb5 100644--- a/server/src/agents/routes.ts+++ b/server/src/agents/routes.ts@@ -604,6 +604,34 @@ export function createAgentRoutes(}});+ routes.post("/:agentId/pin", requireUser, async (context) => {+ try {+ await store.setPinned(+ context.var.actor,+ context.req.param("agentId"),+ true,+ );+ await record(context, "bot.pinned", context.req.param("agentId"));+ return context.body(null, 204);+ } catch (error) {+ return mapStoreError(context, error);+ }+ });++ routes.post("/:agentId/unpin", requireUser, async (context) => {+ try {+ await store.setPinned(+ context.var.actor,+ context.req.param("agentId"),+ false,+ );+ await record(context, "bot.unpinned", context.req.param("agentId"));+ return context.body(null, 204);+ } catch (error) {+ return mapStoreError(context, error);+ }+ });+/** Issue this agent its callback credential, and show it once.*@@ -725,6 +753,7 @@ function agentDto(actor: AgentActor, agent: AgentProfile) {avatarSeed: agent.avatarSeed,visibility: agent.visibility,hidden: agent.hidden,+ pinned: agent.pinned,systemOwned: agent.systemOwned,// Published so the edit form can show it. Safe to expose: it is an address the person supplied,// and any credential for it lives in the vault, never in this row.diff --git a/server/src/audit.ts b/server/src/audit.tsindex dcaba60a..02a8f399 100644--- a/server/src/audit.ts+++ b/server/src/audit.ts@@ -384,6 +384,8 @@ export const auditEventTypes = ["bot.duplicated","bot.hidden","bot.unhidden",+ "bot.pinned",+ "bot.unpinned","bot.deleted","bot.callback_token_issued","bot.callback_token_revoked",diff --git a/server/src/db/schema/coworker.ts b/server/src/db/schema/coworker.tsindex 6e337e4b..2e4dd8c6 100644--- a/server/src/db/schema/coworker.ts+++ b/server/src/db/schema/coworker.ts@@ -74,6 +74,7 @@ export const agentPreferences = pgTable(.notNull().references(() => agents.id, { onDelete: "cascade" }),hiddenAt: timestamp("hidden_at", { withTimezone: true }),+ pinnedAt: timestamp("pinned_at", { withTimezone: true }),},(table) => [primaryKey({ columns: [table.userId, table.agentId] })],);diff --git a/server/tests/agent-profile-store.integration.test.ts b/server/tests/agent-profile-store.integration.test.tsindex 4d8631c2..1511ac06 100644--- a/server/tests/agent-profile-store.integration.test.ts+++ b/server/tests/agent-profile-store.integration.test.ts@@ -395,6 +395,57 @@ describe("agent profile store integration", () => {expect(preference?.hiddenAt).toBeNull();});+ test("stores pinning per user, independently of hiding", async () => {+ const owner = await createUser();+ const other = await createUser();+ const source = await createProfileFixture({ owner, visibility: "public" });+ const pinnedFor = async (actor: AgentActor) =>+ (await profileById(actor, source.agentId)).pinned;++ expect(await pinnedFor(owner)).toBe(false);++ await store.setPinned(owner, source.agentId, true);+ expect(await pinnedFor(owner)).toBe(true);+ expect(await pinnedFor(other)).toBe(false);++ // The same preference row as hiding: each write must leave the other column alone.+ await store.setHidden(owner, source.agentId, true);+ const [hiddenWhilePinned] = await store.list(owner, true);+ expect(hiddenWhilePinned?.pinned).toBe(true);+ await store.setPinned(owner, source.agentId, false);+ await store.setPinned(owner, source.agentId, true);+ expectListed(await store.list(owner, true), source.agentId, true);++ await store.setHidden(owner, source.agentId, false);+ expect(await pinnedFor(owner)).toBe(true);+ await store.setPinned(owner, source.agentId, false);+ expect(await pinnedFor(owner)).toBe(false);+ const [preference] = await database+ .select()+ .from(agentPreferences)+ .where(+ and(+ eq(agentPreferences.userId, owner.id),+ eq(agentPreferences.agentId, source.agentId),+ ),+ );+ expect(preference?.pinnedAt).toBeNull();+ expect(preference?.hiddenAt).toBeNull();+ });++ test("refuses to pin a coworker the caller cannot see", async () => {+ const owner = await createUser();+ const other = await createUser();+ const privateSource = await createProfileFixture({+ owner,+ visibility: "private",+ });++ await expect(+ store.setPinned(other, privateSource.agentId, true),+ ).rejects.toBeInstanceOf(AgentNotFoundError);+ });+test("takes the endpoint and ignores every field a caller must not set", async () => {const owner = await createUser();const deploymentPackage = await createPackage();diff --git a/server/tests/agent-routes.test.ts b/server/tests/agent-routes.test.tsindex 500384d0..5e52b79c 100644--- a/server/tests/agent-routes.test.ts+++ b/server/tests/agent-routes.test.ts@@ -42,6 +42,7 @@ function profile(overrides: Partial<AgentProfile> = {}): AgentProfile {ownerUserId: actor.id,systemOwned: false,hidden: false,+ pinned: false,deletedAt: null,...overrides,};@@ -81,6 +82,9 @@ function fakeStore(async setHidden(receivedActor, id, hidden) {calls.push(["setHidden", receivedActor, id, hidden]);},+ async setPinned(receivedActor, id, pinned) {+ calls.push(["setPinned", receivedActor, id, pinned]);+ },async softDelete(receivedActor, id) {calls.push(["softDelete", receivedActor, id]);},@@ -289,6 +293,12 @@ describe("agent lifecycle routes", () => {const unhidden = await app.request("http://openbot.test/agent-1/unhide", {method: "POST",});+ const pinned = await app.request("http://openbot.test/agent-1/pin", {+ method: "POST",+ });+ const unpinned = await app.request("http://openbot.test/agent-1/unpin", {+ method: "POST",+ });const deleted = await app.request("http://openbot.test/agent-1", {method: "DELETE",});@@ -300,6 +310,8 @@ describe("agent lifecycle routes", () => {expect(duplicated.status).toBe(201);expect(hidden.status).toBe(204);expect(unhidden.status).toBe(204);+ expect(pinned.status).toBe(204);+ expect(unpinned.status).toBe(204);expect(deleted.status).toBe(204);expect(store.calls).toEqual([["list", actor, false],@@ -322,6 +334,8 @@ describe("agent lifecycle routes", () => {["duplicate", actor, "agent-1"],["setHidden", actor, "agent-1", true],["setHidden", actor, "agent-1", false],+ ["setPinned", actor, "agent-1", true],+ ["setPinned", actor, "agent-1", false],["softDelete", actor, "agent-1"],]);});@@ -354,6 +368,7 @@ describe("agent lifecycle routes", () => {avatarSeed: "expense-manager",visibility: "private",hidden: false,+ pinned: false,systemOwned: false,canManage: true,mine: true,@@ -367,6 +382,7 @@ describe("agent lifecycle routes", () => {avatarSeed: "expense-manager",visibility: "private",hidden: false,+ pinned: false,systemOwned: false,canManage: false,mine: false,@@ -380,6 +396,7 @@ describe("agent lifecycle routes", () => {avatarSeed: "expense-manager",visibility: "public",hidden: false,+ pinned: false,systemOwned: true,canManage: false,mine: false,diff --git a/server/tests/bot-lifecycle-audit.test.ts b/server/tests/bot-lifecycle-audit.test.tsindex 2ace6ea3..f446e73b 100644--- a/server/tests/bot-lifecycle-audit.test.ts+++ b/server/tests/bot-lifecycle-audit.test.ts@@ -32,6 +32,7 @@ function app(overrides: Record<string, unknown> = {}) {update: async () => ({ id: "bot-1", name: "Sales" }),duplicate: async () => ({ id: "bot-2", name: "Sales copy" }),setHidden: async () => undefined,+ setPinned: async () => undefined,softDelete: async () => undefined,issueCallbackToken: async () => "the-token-nobody-records",revokeCallbackToken: async () => undefined,@@ -167,6 +168,8 @@ describe("what a Bot is, on the trail", () => {test.each([["/api/agents/bot-1/hide", "POST", "bot.hidden"],["/api/agents/bot-1/unhide", "POST", "bot.unhidden"],+ ["/api/agents/bot-1/pin", "POST", "bot.pinned"],+ ["/api/agents/bot-1/unpin", "POST", "bot.unpinned"],["/api/agents/bot-1/callback-token","DELETE",diff --git a/server/tests/schema.test.ts b/server/tests/schema.test.tsindex 1f9665fd..e6e4220c 100644--- a/server/tests/schema.test.ts+++ b/server/tests/schema.test.ts@@ -333,6 +333,13 @@ describe("OpenBot database schema", () => {hasDefault: false,primary: false,},+ {+ name: "pinned_at",+ sqlType: "timestamp with time zone",+ notNull: false,+ hasDefault: false,+ primary: false,+ },]);expect(