diff --git a/apps/api/src/handlers/custom-automations/__tests__/custom-automations-routes.test.ts b/apps/api/src/handlers/custom-automations/__tests__/custom-automations-routes.test.ts
index 2680752b6..b35b153ed 100644
--- a/apps/api/src/handlers/custom-automations/__tests__/custom-automations-routes.test.ts
+++ b/apps/api/src/handlers/custom-automations/__tests__/custom-automations-routes.test.ts
@@ -684,6 +684,39 @@ describe('custom-automations MCP routes', () => {
);
});
+ it('rebinds an ownerless DM target when a partial update claims ownership', async () => {
+ const { app } = createApp();
+ mockGetCustomAutomationById.mockResolvedValue({
+ ...existing,
+ createdByUserId: null,
+ target: {
+ provider: 'telegram',
+ targetKind: 'telegram_user',
+ externalRef: 'deleted-owner',
+ },
+ });
+ mockUpdateCustomAutomation.mockResolvedValue({ id: 'automation-1' });
+
+ const res = await app.request('/custom-automations/automation-1', {
+ method: 'PATCH',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ enabled: false }),
+ });
+
+ expect(res.status).toBe(200);
+ expect(mockUpdateCustomAutomation).toHaveBeenCalledWith(
+ 'automation-1',
+ expect.objectContaining({
+ createdByUserId: 'admin-1',
+ target: {
+ provider: 'telegram',
+ targetKind: 'telegram_user',
+ externalRef: 'admin-1',
+ },
+ }),
+ );
+ });
+
it('rejects switching a DM target to channel mode without a channel', async () => {
const { app } = createApp();
mockGetCustomAutomationById.mockResolvedValue({
diff --git a/apps/api/src/handlers/custom-automations/index.ts b/apps/api/src/handlers/custom-automations/index.ts
index ea27c413e..b0e0cc4fe 100644
--- a/apps/api/src/handlers/custom-automations/index.ts
+++ b/apps/api/src/handlers/custom-automations/index.ts
@@ -491,6 +491,7 @@ customAutomationsRouter.patch('/:id', async (c) => {
existing.createdByUserId ?? adminId(c),
)
: existingTarget,
+ createdByUserId: existing.createdByUserId ?? adminId(c),
});
return c.json({
automation: toApiAutomation(automation),
diff --git a/apps/docs/automations.mdx b/apps/docs/automations.mdx
index 233661c11..44bcef422 100644
--- a/apps/docs/automations.mdx
+++ b/apps/docs/automations.mdx
@@ -85,6 +85,21 @@ conflict resolution, and remove it when a human should handle the conflict
instead. Roomote only tries this on labeled PRs that are still active, and it
skips PRs older than the age cap you set.
+Built-in repository scans, audits, issue and CI investigations, PR reviews,
+conflict resolution, setup scans, and snapshot maintenance continue to start
+tasks directly. Those automations either have no human run-as identity, produce
+structured results consumed by another Roomote workflow, or require a sandbox
+by definition. Deterministic alert and stats automations that do not need an
+agent post their result directly without launching a task.
+
+Roomote is rolling out automation-owned Fast sessions in two releases. This
+release adds the principal-aware storage, read, and authorization shape, but
+continues writing only human-owned Fast sessions. Built-in and integration
+automation principals therefore keep their existing direct-task behavior until
+the follow-up release enables deployment-principal capabilities and Session
+writes. This keeps one-release rollback safe: the previous version never sees a
+new ownerless Session row.
+
## Custom automations
Create arbitrary scheduled agent runs with:
@@ -92,7 +107,8 @@ Create arbitrary scheduled agent runs with:
- a clear **name**
- the **prompt** Roomote should run
- a **cadence** (`every hour`, `every 6 hours`, `daily`, or `weekly`)
-- one required **execution target**: **Fast**, a named environment, or **All repositories**
+- one required **delegated task scope**: no default environment, a named
+ environment, or **All repositories**
- an optional **model** override for the runs; the default follows the
deployment task model
- an optional **report destination**: a direct message to the automation owner,
@@ -101,9 +117,9 @@ Create arbitrary scheduled agent runs with:
Each automation card summarizes its cadence, workspace target, report destination,
creator, and most recent run.
-Use **View previous runs** on an automation card to open the task list
-filtered to that automation's runs. For a custom automation, the history is
-scoped to that specific automation rather than all custom automations.
+Legacy ownerless automations that still run directly in a sandbox show **View
+previous runs** on their automation card. Owned automation results stay with
+their Fast sessions and any tasks delegated from those sessions.
When creating an automation through Roomote chat, ask for **suggested tasks** or
**launchable follow-ups** if qualifying findings should become tasks that
@@ -121,10 +137,13 @@ five-field cron expression or a natural-language schedule such as “weekdays at
clarification rather than guessing when the recurrence itself is ambiguous.
Custom schedules do not support seconds or cron macros.
-On each due tick, Roomote either launches a normal task in the selected
-environment (or across all active repositories), or runs the prompt directly in
-**Fast** without starting a sandbox. A Fast run can still delegate a normal task
-when repository or workspace execution is required.
+On each due tick, an owned custom automation starts in **Fast** without a
+sandbox. Fast uses integrations directly when that is enough and delegates a
+normal task only when repository or workspace execution is required. The
+selected task scope controls that delegated task; it does not force every run to
+start a sandbox. Legacy automation records whose owner was deleted retain their
+previous direct sandbox behavior because there is no user identity that can
+authorize a Fast session safely.
Fast runs deliver to every custom-automation report destination: Slack,
Discord, Microsoft Teams, or Telegram, as either a channel/chat or a direct
@@ -144,9 +163,9 @@ or important findings, meaningful completed results, blockers, and questions
that need input. Routine success, healthy status, and no-change results stay
silent unless the automation prompt explicitly asks for a report in those
cases. The first message starts a thread, later updates continue that same
-thread, and you can reply there to talk to the task. There is no progress
-chatter in between. Without a destination, the run happens silently and its
-results appear only in the task view.
+thread, and you can reply there to continue the Fast session. There is no
+progress chatter in between. Without a destination, the run happens silently
+and its result remains in the stored Fast session.
Unless the prompt asks for a different presentation, custom automation reports
lead with the result, stay concise, and use short Markdown headings and bullets
diff --git a/apps/web/src/app/(sandbox)/sessions/[sessionId]/FastSessionTranscript.client.test.tsx b/apps/web/src/app/(sandbox)/sessions/[sessionId]/FastSessionTranscript.client.test.tsx
index 5d8930f6d..8853fec5a 100644
--- a/apps/web/src/app/(sandbox)/sessions/[sessionId]/FastSessionTranscript.client.test.tsx
+++ b/apps/web/src/app/(sandbox)/sessions/[sessionId]/FastSessionTranscript.client.test.tsx
@@ -373,6 +373,26 @@ describe('FastSessionTranscript', () => {
});
});
+ it('shows staged automation sessions as read-only without a composer', () => {
+ render(
+ ,
+ );
+
+ expect(
+ screen.getByText(
+ 'Automation-owned sessions are read-only until the next release.',
+ ),
+ ).toBeInTheDocument();
+ expect(
+ screen.queryByPlaceholderText('Message agent'),
+ ).not.toBeInTheDocument();
+ });
+
it('sends an image-only reply', async () => {
preparePromptAttachments.mockResolvedValueOnce({
text: '',
diff --git a/apps/web/src/app/(sandbox)/sessions/[sessionId]/FastSessionTranscript.tsx b/apps/web/src/app/(sandbox)/sessions/[sessionId]/FastSessionTranscript.tsx
index 8066694fc..ce82381d2 100644
--- a/apps/web/src/app/(sandbox)/sessions/[sessionId]/FastSessionTranscript.tsx
+++ b/apps/web/src/app/(sandbox)/sessions/[sessionId]/FastSessionTranscript.tsx
@@ -55,6 +55,7 @@ export function FastSessionTranscript({
initialMessages,
hasOlderMessages,
canReply,
+ readOnlyReason,
initialTitle = null,
fallbackTitle = 'Session',
sessionModel = null,
@@ -66,6 +67,7 @@ export function FastSessionTranscript({
initialMessages: FastSessionMessage[];
hasOlderMessages?: boolean;
canReply?: boolean;
+ readOnlyReason?: string;
initialTitle?: string | null;
fallbackTitle?: string;
sessionModel?: string | null;
@@ -289,6 +291,10 @@ export function FastSessionTranscript({
{replyError}
) : null}
+ ) : readOnlyReason ? (
+
+ {readOnlyReason}
+
) : null}
);
diff --git a/apps/web/src/app/(sandbox)/sessions/[sessionId]/page.tsx b/apps/web/src/app/(sandbox)/sessions/[sessionId]/page.tsx
index c042a4893..e720b47d4 100644
--- a/apps/web/src/app/(sandbox)/sessions/[sessionId]/page.tsx
+++ b/apps/web/src/app/(sandbox)/sessions/[sessionId]/page.tsx
@@ -68,7 +68,12 @@ export default async function SessionDetailPage({
sessionId={session.id}
initialMessages={session.messages}
hasOlderMessages={session.hasOlderMessages}
- canReply
+ canReply={!session.ownerAutomation}
+ readOnlyReason={
+ session.ownerAutomation
+ ? 'Automation-owned sessions are read-only until the next release.'
+ : undefined
+ }
initialTitle={session.title}
fallbackTitle={fallbackTitle}
sessionModel={session.model}
diff --git a/apps/web/src/components/settings/automations/AutomationsSettings.render.client.test.tsx b/apps/web/src/components/settings/automations/AutomationsSettings.render.client.test.tsx
index 5965fa397..23f037031 100644
--- a/apps/web/src/components/settings/automations/AutomationsSettings.render.client.test.tsx
+++ b/apps/web/src/components/settings/automations/AutomationsSettings.render.client.test.tsx
@@ -22,6 +22,7 @@ const state = vi.hoisted(() => ({
cronExpression: string | null;
model: null;
executionMode?: 'sandbox_task' | 'fast';
+ launchMode?: 'fast_session' | 'legacy_sandbox_task' | 'unavailable';
environmentId: string;
target: {
provider?: 'slack' | 'discord' | 'teams' | 'telegram';
@@ -280,7 +281,11 @@ const mutations = vi.hoisted(() => ({
) => void;
} | null,
latestCustomTriggerOptions: null as {
- onSuccess?: (result: { outcome: 'launched'; taskId: string }) => void;
+ onSuccess?: (
+ result:
+ | { outcome: 'launched'; taskId: string }
+ | { outcome: 'completed' },
+ ) => void;
} | null,
}));
@@ -1082,6 +1087,7 @@ describe('AutomationsSettings', () => {
scheduleMode: 'weekly',
cronExpression: null,
model: null,
+ launchMode: 'fast_session',
environmentId: 'env-1',
target: { provider: 'slack', externalRef: 'C123MANAGER' },
lastRunAt: null,
@@ -1108,13 +1114,10 @@ describe('AutomationsSettings', () => {
screen.getByRole('button', { name: 'Run Weekly flaky-test scan now' }),
).toBeEnabled();
expect(
- screen.getByRole('link', {
+ screen.queryByRole('link', {
name: 'View previous runs for Weekly flaky-test scan',
}),
- ).toHaveAttribute(
- 'href',
- '/tasks?userId=automation%3Acustom_automation%3Aautomation-1',
- );
+ ).not.toBeInTheDocument();
fireEvent.click(
screen.getByRole('button', { name: 'Run Weekly flaky-test scan now' }),
);
@@ -1123,15 +1126,11 @@ describe('AutomationsSettings', () => {
});
act(() => {
mutations.latestCustomTriggerOptions?.onSuccess?.({
- outcome: 'launched',
- taskId: 'task-custom-1',
+ outcome: 'completed',
});
});
expect(toast.success).toHaveBeenCalledWith(
- 'Running Weekly flaky-test scan now',
- expect.objectContaining({
- action: expect.objectContaining({ label: 'View task' }),
- }),
+ 'Weekly flaky-test scan ran successfully.',
);
state.customAutomations.push({
@@ -1161,10 +1160,10 @@ describe('AutomationsSettings', () => {
}),
).toBeInTheDocument();
expect(
- screen.getByRole('link', {
+ screen.queryByRole('link', {
name: 'View previous runs for Weekly flaky-test scan',
}),
- ).toBeInTheDocument();
+ ).not.toBeInTheDocument();
expect(
screen.getByRole('button', { name: 'Delete Weekly flaky-test scan' }),
).toBeInTheDocument();
@@ -1199,6 +1198,7 @@ describe('AutomationsSettings', () => {
scheduleMode: 'daily',
cronExpression: null,
model: null,
+ launchMode: 'fast_session',
environmentId: '__all_repositories__',
target: { provider: 'slack', externalRef: 'C123MANAGER' },
lastRunAt: null,
@@ -1218,7 +1218,9 @@ describe('AutomationsSettings', () => {
await screen.findByText('Daily, in All repositories →'),
).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'New' }));
- fireEvent.click(screen.getByRole('combobox', { name: 'Environment' }));
+ fireEvent.click(
+ screen.getByRole('combobox', { name: 'Delegated task environment' }),
+ );
expect(
screen.getByRole('option', { name: 'All repositories' }),
).toBeInTheDocument();
@@ -1235,6 +1237,7 @@ describe('AutomationsSettings', () => {
cronExpression: null,
model: null,
executionMode: 'fast',
+ launchMode: 'fast_session',
environmentId: '__fast__',
target: {},
lastRunAt: null,
@@ -1251,7 +1254,11 @@ describe('AutomationsSettings', () => {
render( );
- expect(await screen.findByText('Daily, in Fast →')).toBeInTheDocument();
+ expect(
+ await screen.findByText(
+ 'Daily, in Fast with no default task environment →',
+ ),
+ ).toBeInTheDocument();
expect(
screen.getByText('No actionable regressions found.'),
).toBeInTheDocument();
@@ -1266,15 +1273,59 @@ describe('AutomationsSettings', () => {
expect(screen.getByText('Delegated task model')).toBeInTheDocument();
expect(
screen.getByText(
- 'This run is stored as a Fast conversation without posting to chat.',
+ 'Each run starts as a stored Fast session. A sandbox task uses the selected environment only when workspace execution is required.',
),
).toBeInTheDocument();
- fireEvent.click(screen.getByRole('combobox', { name: 'Environment' }));
+ fireEvent.click(
+ screen.getByRole('combobox', { name: 'Delegated task environment' }),
+ );
expect(
- screen.getByRole('option', { name: 'Fast (no sandbox)' }),
+ screen.getByRole('option', { name: 'No default task environment' }),
).toBeInTheDocument();
});
+ it('keeps an owner-deleted Fast automation unavailable until it is claimed', async () => {
+ state.customAutomations = [
+ {
+ id: 'automation-unavailable',
+ name: 'Ownerless Fast digest',
+ prompt: 'Summarize priorities.',
+ enabled: true,
+ scheduleMode: 'daily',
+ cronExpression: null,
+ model: null,
+ executionMode: 'fast',
+ launchMode: 'unavailable',
+ environmentId: '__fast__',
+ target: {},
+ lastRunAt: null,
+ lastSucceededAt: null,
+ lastFailedAt: null,
+ lastError: null,
+ lastLaunchedTaskId: null,
+ createdByName: 'Unknown',
+ createdAt: new Date('2026-01-01T00:00:00Z'),
+ updatedAt: new Date('2026-01-01T00:00:00Z'),
+ },
+ ];
+
+ render( );
+
+ expect(
+ await screen.findByText(
+ 'Owner unavailable. Configure and save to claim this automation before running it.',
+ ),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByRole('button', { name: 'Run Ownerless Fast digest now' }),
+ ).toBeDisabled();
+ expect(
+ screen.getByRole('button', {
+ name: 'Configure Ownerless Fast digest',
+ }),
+ ).toBeEnabled();
+ });
+
it('humanizes custom schedules and shows the last run when available', async () => {
state.environments = [{ id: 'env-1', name: 'Production' }];
state.customAutomations = [
@@ -1357,7 +1408,7 @@ describe('AutomationsSettings', () => {
).toBeInTheDocument();
expect(
screen.getByText(
- 'Each Fast run posts here, and replies continue the Fast session.',
+ 'Each run starts as Fast and posts here; replies continue the Fast session.',
),
).toBeInTheDocument();
});
@@ -1408,7 +1459,7 @@ describe('AutomationsSettings', () => {
).toBeInTheDocument();
expect(
screen.getByText(
- 'Each Fast run posts here, and replies continue the Fast session.',
+ 'Each run starts as Fast and posts here; replies continue the Fast session.',
),
).toBeInTheDocument();
});
@@ -1451,7 +1502,7 @@ describe('AutomationsSettings', () => {
expect(
screen.getByText(
- 'Each Fast run posts here, and replies continue the Fast session.',
+ 'Each run starts as Fast and posts here; replies continue the Fast session.',
),
).toBeInTheDocument();
});
diff --git a/apps/web/src/components/settings/automations/CustomAutomationsSection.tsx b/apps/web/src/components/settings/automations/CustomAutomationsSection.tsx
index ade8f27e6..6708b5bd5 100644
--- a/apps/web/src/components/settings/automations/CustomAutomationsSection.tsx
+++ b/apps/web/src/components/settings/automations/CustomAutomationsSection.tsx
@@ -326,7 +326,7 @@ export function CustomAutomationsSection() {
const environmentOptions = useMemo(
() => [
- { id: FAST_EXECUTION, name: 'Fast (no sandbox)' },
+ { id: FAST_EXECUTION, name: 'No default task environment' },
{ id: ALL_REPOSITORIES, name: 'All repositories' },
...(environmentsQuery.data ?? []).map((environment) => ({
id: environment.id,
@@ -727,7 +727,9 @@ export function CustomAutomationsSection() {
-
Environment
+
+ Delegated task environment
+
-
- {form.environmentId === FAST_EXECUTION
- ? 'Delegated task model'
- : 'Model'}
-
+ Delegated task model
setForm((current) => ({ ...current, model: value }))
@@ -917,15 +911,13 @@ export function CustomAutomationsSection() {
)}
- {form.environmentId === FAST_EXECUTION ? (
-
- {form.targetProvider === 'none'
- ? 'This run is stored as a Fast conversation without posting to chat.'
- : form.targetProvider === 'telegram'
- ? 'Each Fast run posts here. Continue the session from the web app; chat replies on this provider do not resume Fast yet.'
- : 'Each Fast run posts here, and replies continue the Fast session.'}
-
- ) : null}
+
+ {form.targetProvider === 'none'
+ ? 'Each run starts as a stored Fast session. A sandbox task uses the selected environment only when workspace execution is required.'
+ : form.targetProvider === 'telegram'
+ ? 'Each run starts as Fast and posts here. Continue the session from the web app; chat replies on this provider do not resume Fast yet.'
+ : 'Each run starts as Fast and posts here; replies continue the Fast session.'}
+
@@ -1049,9 +1041,14 @@ export function CustomAutomationsSection() {
{rows.map((row) => {
+ const launchMode =
+ row.launchMode ??
+ (row.executionMode === 'fast'
+ ? 'fast_session'
+ : 'legacy_sandbox_task');
const environmentName =
row.executionMode === 'fast'
- ? 'Fast'
+ ? 'Fast with no default task environment'
: (environmentOptions.find(
(environment) => environment.id === row.environmentId,
)?.name ?? 'Environment missing');
@@ -1135,14 +1132,20 @@ export function CustomAutomationsSection() {
>
) : null}
- {row.executionMode === 'fast' && row.latestFastResult ? (
+ {launchMode === 'unavailable' ? (
+
+ Owner unavailable. Configure and save to claim this
+ automation before running it.
+
+ ) : null}
+ {launchMode === 'fast_session' && row.latestFastResult ? (
{row.latestFastResult}
) : null}
- {row.executionMode !== 'fast' ? (
+ {launchMode === 'legacy_sandbox_task' ? (
{
);
});
+ it('shows staged automation-owned sessions only to admins', async () => {
+ const admin = await userFactory.create();
+ const member = await userFactory.create();
+ await ensureAutomationRowsOnce();
+ const [automationSession] = await db
+ .insert(fastAgentConversations)
+ .values({
+ userId: null,
+ ownerAutomation: 'announcer',
+ surface: 'automation',
+ workspaceId: 'announcer',
+ conversationId: 'staged-announcer-session',
+ })
+ .returning();
+
+ const memberSessions = await getFastSessions({
+ userId: member.id,
+ isAdmin: false,
+ });
+ expect(memberSessions.sessions).not.toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({ id: automationSession!.id }),
+ ]),
+ );
+ await expect(
+ getFastSessionById(
+ { userId: member.id, isAdmin: false },
+ automationSession!.id,
+ ),
+ ).resolves.toBeNull();
+ await expect(
+ getFastSessionById(
+ { userId: admin.id, isAdmin: true },
+ automationSession!.id,
+ ),
+ ).resolves.toMatchObject({
+ id: automationSession!.id,
+ userId: null,
+ ownerAutomation: 'announcer',
+ ownerName: null,
+ });
+ });
+
it('pages older sessions with a keyset cursor', async () => {
const owner = await userFactory.create();
const oldest = await createFastSession({
diff --git a/apps/web/src/lib/server/fast-sessions.ts b/apps/web/src/lib/server/fast-sessions.ts
index 96eccfc9a..ed6f045ab 100644
--- a/apps/web/src/lib/server/fast-sessions.ts
+++ b/apps/web/src/lib/server/fast-sessions.ts
@@ -48,6 +48,7 @@ const FAST_SESSION_TRANSCRIPT_MESSAGE_LIMIT = 1000;
const fastSessionSelection = {
id: fastAgentConversations.id,
userId: fastAgentConversations.userId,
+ ownerAutomation: fastAgentConversations.ownerAutomation,
ownerName: users.name,
ownerEmail: users.email,
ownerImageUrl: users.imageUrl,
@@ -104,6 +105,7 @@ export async function findAccessibleFastSession(
.select({
id: fastAgentConversations.id,
userId: fastAgentConversations.userId,
+ ownerAutomation: fastAgentConversations.ownerAutomation,
title: fastAgentConversations.title,
surface: fastAgentConversations.surface,
workspaceId: fastAgentConversations.workspaceId,
@@ -261,7 +263,7 @@ export async function getFastSessions(
const rows = await db
.select(fastSessionSelection)
.from(fastAgentConversations)
- .innerJoin(users, eq(fastAgentConversations.userId, users.id))
+ .leftJoin(users, eq(fastAgentConversations.userId, users.id))
.where(and(fastSessionScope(auth), ownerFilter, timeFilter, beforeCursor))
.orderBy(
desc(fastAgentConversations.updatedAt),
@@ -288,7 +290,7 @@ export async function getFastSessionById(
const [session] = await db
.select(fastSessionSelection)
.from(fastAgentConversations)
- .innerJoin(users, eq(fastAgentConversations.userId, users.id))
+ .leftJoin(users, eq(fastAgentConversations.userId, users.id))
.where(
and(eq(fastAgentConversations.id, sessionId), fastSessionScope(auth)),
)
diff --git a/apps/web/src/trpc/commands/automations/custom-automations.ts b/apps/web/src/trpc/commands/automations/custom-automations.ts
index 6d709d6e2..63120605c 100644
--- a/apps/web/src/trpc/commands/automations/custom-automations.ts
+++ b/apps/web/src/trpc/commands/automations/custom-automations.ts
@@ -25,6 +25,7 @@ import {
FAST_EXECUTION,
getCommunicationAutomationTargetKind,
isScheduleOnlyBackgroundAutomationFrequency,
+ resolveAutomationTaskLaunchMode,
type AutomationTarget,
type BackgroundAutomationProvider,
type CustomAutomationScheduleMode,
@@ -46,6 +47,7 @@ export type CustomAutomationListItem = {
cronExpression: string | null;
model: string | null;
executionMode: 'sandbox_task' | 'fast';
+ launchMode: 'fast_session' | 'legacy_sandbox_task' | 'unavailable';
environmentId: string | null;
target: OptionalAutomationTarget;
lastRunAt: Date | null;
@@ -111,6 +113,10 @@ function toListItem(
: isScheduleOnlyBackgroundAutomationFrequency(row.scheduleMode)
? row.scheduleMode
: 'off';
+ const launchMode = resolveAutomationTaskLaunchMode({
+ policyId: 'custom_automation',
+ runAsUserId: row.createdByUserId,
+ });
return {
id: row.id,
@@ -121,6 +127,12 @@ function toListItem(
cronExpression: row.cronExpression,
model: row.model,
executionMode: row.executionMode,
+ launchMode:
+ launchMode === 'fast_session'
+ ? 'fast_session'
+ : row.executionMode === 'sandbox_task'
+ ? 'legacy_sandbox_task'
+ : 'unavailable',
environmentId:
row.executionMode === 'fast'
? FAST_EXECUTION
@@ -295,6 +307,7 @@ export async function updateCustomAutomationCommand(
model: input.model ?? null,
environmentId: input.environmentId,
target: buildTarget(input, existing.createdByUserId ?? auth.userId),
+ createdByUserId: existing.createdByUserId ?? auth.userId,
});
return toListItem(updated);
diff --git a/apps/web/src/trpc/commands/fast-sessions/index.test.ts b/apps/web/src/trpc/commands/fast-sessions/index.test.ts
index 68860bfe5..2da3bf1bc 100644
--- a/apps/web/src/trpc/commands/fast-sessions/index.test.ts
+++ b/apps/web/src/trpc/commands/fast-sessions/index.test.ts
@@ -2,6 +2,7 @@ const mocks = vi.hoisted(() => ({
after: vi.fn(),
acquireTurnLock: vi.fn(),
answerQuestion: vi.fn(),
+ dbUpdate: vi.fn(),
}));
vi.mock('next/server', () => ({ after: mocks.after }));
@@ -20,7 +21,7 @@ vi.mock('@roomote/sdk/server', () => ({
}));
vi.mock('@roomote/db/server', () => ({
- db: {},
+ db: { update: mocks.dbUpdate },
eq: vi.fn(),
fastAgentConversations: {},
}));
@@ -29,7 +30,10 @@ vi.mock('@/lib/server/fast-sessions', () => ({
findAccessibleFastSession: vi.fn(),
}));
-import { scheduleWebFastAgentTurn } from './index';
+import { buildFastAgentSurfaceReplyDelivery } from '@roomote/sdk/server';
+import { findAccessibleFastSession } from '@/lib/server/fast-sessions';
+
+import { replyToFastSessionCommand, scheduleWebFastAgentTurn } from './index';
describe('scheduleWebFastAgentTurn', () => {
beforeEach(() => {
@@ -69,3 +73,39 @@ describe('scheduleWebFastAgentTurn', () => {
expect(release).toHaveBeenCalledOnce();
});
});
+
+describe('replyToFastSessionCommand', () => {
+ it('rejects staged automation-owned sessions before persisting settings', async () => {
+ vi.mocked(findAccessibleFastSession).mockResolvedValue({
+ id: 'session-1',
+ userId: null,
+ ownerAutomation: 'announcer',
+ title: null,
+ surface: 'automation',
+ workspaceId: 'announcer',
+ conversationId: 'occurrence-1',
+ model: null,
+ reasoningEffort: null,
+ });
+
+ await expect(
+ replyToFastSessionCommand(
+ {
+ success: true,
+ userId: 'admin-1',
+ name: 'Admin',
+ primaryEmail: 'admin@example.com',
+ isAdmin: true,
+ } as never,
+ {
+ sessionId: 'session-1',
+ text: 'Continue',
+ model: 'openai/gpt-5.6',
+ reasoningEffort: 'high',
+ },
+ ),
+ ).rejects.toThrow('read-only until the next release');
+ expect(mocks.dbUpdate).not.toHaveBeenCalled();
+ expect(buildFastAgentSurfaceReplyDelivery).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/web/src/trpc/commands/fast-sessions/index.ts b/apps/web/src/trpc/commands/fast-sessions/index.ts
index dc7e9280e..43b63fe3c 100644
--- a/apps/web/src/trpc/commands/fast-sessions/index.ts
+++ b/apps/web/src/trpc/commands/fast-sessions/index.ts
@@ -208,6 +208,11 @@ export async function replyToFastSessionCommand(
if (!session) {
throw new Error('Fast session not found');
}
+ if (session.ownerAutomation) {
+ throw new Error(
+ 'Automation-owned Fast sessions are read-only until the next release.',
+ );
+ }
const senderDisplayName =
getUserDisplayName({ name: auth.name, email: auth.primaryEmail }) ?? null;
diff --git a/packages/cloud-agents/src/server/fast-agent/__tests__/fast-agent-conversation-repository.test.ts b/packages/cloud-agents/src/server/fast-agent/__tests__/fast-agent-conversation-repository.test.ts
index ccdd907a9..ba4bad16a 100644
--- a/packages/cloud-agents/src/server/fast-agent/__tests__/fast-agent-conversation-repository.test.ts
+++ b/packages/cloud-agents/src/server/fast-agent/__tests__/fast-agent-conversation-repository.test.ts
@@ -2,6 +2,7 @@ import {
and,
db,
eq,
+ ensureAutomationRowsOnce,
fastAgentConversations,
fastAgentMessages,
userFactory,
@@ -12,6 +13,7 @@ import { fastAgentConversationRepository } from '../fast-agent-conversation-repo
import { hasFastAgentSession } from '../fast-agent-session';
const createdUserIds: string[] = [];
+const createdConversationIds: string[] = [];
async function createUser() {
const user = await userFactory.create();
@@ -30,6 +32,11 @@ const slackConversation = {
};
afterEach(async () => {
+ for (const conversationId of createdConversationIds.splice(0)) {
+ await db
+ .delete(fastAgentConversations)
+ .where(eq(fastAgentConversations.id, conversationId));
+ }
for (const userId of createdUserIds.splice(0)) {
await db.delete(users).where(eq(users.id, userId));
}
@@ -54,6 +61,7 @@ describe('Fast conversation repository', () => {
});
expect(stored?.conversation).toEqual(conversation);
+ expect(stored?.owner).toEqual({ kind: 'user', userId: user.id });
expect(stored?.openCodeSessionId).toBeNull();
const [row] = await db
.select({
@@ -65,6 +73,42 @@ describe('Fast conversation repository', () => {
expect(row).toEqual({ channelId: null, surface: 'automation' });
});
+ it('reads a staged automation-owned conversation without enabling writes', async () => {
+ await ensureAutomationRowsOnce();
+ const conversation = {
+ surface: 'automation' as const,
+ workspaceId: 'staged-automation-owner',
+ conversationId: 'staged-automation-occurrence',
+ };
+ const [inserted] = await db
+ .insert(fastAgentConversations)
+ .values({
+ userId: null,
+ ownerAutomation: 'custom_automation',
+ surface: conversation.surface,
+ workspaceId: conversation.workspaceId,
+ conversationId: conversation.conversationId,
+ })
+ .returning({ id: fastAgentConversations.id });
+ createdConversationIds.push(inserted!.id);
+
+ await expect(
+ fastAgentConversationRepository.findById({ id: inserted!.id }),
+ ).resolves.toMatchObject({
+ userId: null,
+ owner: { kind: 'automation', automationKey: 'custom_automation' },
+ conversation,
+ });
+
+ const user = await createUser();
+ await expect(
+ fastAgentConversationRepository.getOrCreate({
+ userId: user.id,
+ conversation,
+ }),
+ ).rejects.toThrow('owner does not match');
+ });
+
it.each(['teams', 'telegram'] as const)(
'persists and reconstructs a %s Fast conversation reply target',
async (surface) => {
diff --git a/packages/cloud-agents/src/server/fast-agent/fast-agent-conversation-repository.ts b/packages/cloud-agents/src/server/fast-agent/fast-agent-conversation-repository.ts
index 748539b60..4cd763ba9 100644
--- a/packages/cloud-agents/src/server/fast-agent/fast-agent-conversation-repository.ts
+++ b/packages/cloud-agents/src/server/fast-agent/fast-agent-conversation-repository.ts
@@ -9,13 +9,17 @@ import {
sql,
type DatabaseOrTransaction,
} from '@roomote/db/server';
-import { fastAgentConversationSchema } from '@roomote/types';
+import {
+ fastAgentConversationSchema,
+ type FastAgentConversationOwner,
+} from '@roomote/types';
import type { FastAgentConversation } from './fast-agent-conversation';
export type FastAgentConversationRecord = {
id: string;
- userId: string;
+ userId: string | null;
+ owner: FastAgentConversationOwner;
conversation: FastAgentConversation;
/**
* Durable visible history for cold starts and provider retries. OpenCode,
@@ -142,10 +146,18 @@ async function loadConversationRecord(
if (!record || !conversation) {
throw new Error('Fast conversation has an invalid reply target.');
}
+ const owner: FastAgentConversationOwner = record.userId
+ ? { kind: 'user', userId: record.userId }
+ : record.ownerAutomation
+ ? { kind: 'automation', automationKey: record.ownerAutomation }
+ : (() => {
+ throw new Error('Fast conversation has an invalid owner.');
+ })();
return {
id: record.id,
userId: record.userId,
+ owner,
conversation,
compatibilityMessages: record.compatibilityMessages as ModelMessage[],
openCodeSessionId: record.openCodeSessionId,
@@ -194,6 +206,9 @@ export const fastAgentConversationRepository: FastAgentConversationRepository =
if (!record) {
throw new Error('Failed to create or load Fast conversation.');
}
+ if (record.userId !== userId || record.ownerAutomation !== null) {
+ throw new Error('Fast conversation owner does not match the caller.');
+ }
await tx.execute(
sql`select pg_advisory_xact_lock(hashtextextended(${`fast-agent-conversation:${record.id}`}, 0))`,
diff --git a/packages/db/drizzle/0064_round_surge.sql b/packages/db/drizzle/0064_round_surge.sql
new file mode 100644
index 000000000..7a1e8d8c3
--- /dev/null
+++ b/packages/db/drizzle/0064_round_surge.sql
@@ -0,0 +1,9 @@
+ALTER TABLE "fast_agent_conversations" ALTER COLUMN "user_id" DROP NOT NULL;--> statement-breakpoint
+ALTER TABLE "fast_agent_conversations" ADD COLUMN "owner_automation" text;--> statement-breakpoint
+ALTER TABLE "fast_agent_conversations" ADD CONSTRAINT "fast_agent_conversations_owner_automation_automations_key_fk" FOREIGN KEY ("owner_automation") REFERENCES "public"."automations"("key") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+CREATE INDEX "fast_agent_conversations_owner_automation_idx" ON "fast_agent_conversations" USING btree ("owner_automation");--> statement-breakpoint
+ALTER TABLE "fast_agent_conversations" ADD CONSTRAINT "fast_agent_conversations_owner_shape_check" CHECK ((
+ ("fast_agent_conversations"."user_id" is not null and "fast_agent_conversations"."owner_automation" is null)
+ or
+ ("fast_agent_conversations"."user_id" is null and "fast_agent_conversations"."owner_automation" is not null)
+ ));
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0064_snapshot.json b/packages/db/drizzle/meta/0064_snapshot.json
new file mode 100644
index 000000000..127b934e9
--- /dev/null
+++ b/packages/db/drizzle/meta/0064_snapshot.json
@@ -0,0 +1,13250 @@
+{
+ "id": "9659ceaf-5195-4237-abff-ef45d271a596",
+ "prevId": "8fe248da-e7e1-4c29-a67f-44344572ce6a",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.auth_accounts": {
+ "name": "auth_accounts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_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
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "auth_accounts_user_id_idx": {
+ "name": "auth_accounts_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "auth_accounts_provider_account_unique": {
+ "name": "auth_accounts_provider_account_unique",
+ "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": {
+ "auth_accounts_user_id_auth_users_id_fk": {
+ "name": "auth_accounts_user_id_auth_users_id_fk",
+ "tableFrom": "auth_accounts",
+ "tableTo": "auth_users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.auth_sessions": {
+ "name": "auth_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",
+ "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",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "auth_sessions_token_unique": {
+ "name": "auth_sessions_token_unique",
+ "columns": [
+ {
+ "expression": "token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "auth_sessions_user_id_idx": {
+ "name": "auth_sessions_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "auth_sessions_user_id_auth_users_id_fk": {
+ "name": "auth_sessions_user_id_auth_users_id_fk",
+ "tableFrom": "auth_sessions",
+ "tableTo": "auth_users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.auth_users": {
+ "name": "auth_users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "auth_users_email_unique": {
+ "name": "auth_users_email_unique",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "auth_users_created_at_idx": {
+ "name": "auth_users_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.auth_verifications": {
+ "name": "auth_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",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "auth_verifications_identifier_idx": {
+ "name": "auth_verifications_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.automations": {
+ "name": "automations",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "internal": {
+ "name": "internal",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "schedule": {
+ "name": "schedule",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "instructions": {
+ "name": "instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "settings": {
+ "name": "settings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "targets": {
+ "name": "targets",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "last_run_at": {
+ "name": "last_run_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_succeeded_at": {
+ "name": "last_succeeded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_failed_at": {
+ "name": "last_failed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scan_cursor": {
+ "name": "scan_cursor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.brain_collector_items": {
+ "name": "brain_collector_items",
+ "schema": "",
+ "columns": {
+ "collector_id": {
+ "name": "collector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "brain_collector_items_collector_seen_idx": {
+ "name": "brain_collector_items_collector_seen_idx",
+ "columns": [
+ {
+ "expression": "collector_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_seen_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "brain_collector_items_collector_item_pk": {
+ "name": "brain_collector_items_collector_item_pk",
+ "columns": ["collector_id", "item_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.brain_memory_events": {
+ "name": "brain_memory_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "agent_summary": {
+ "name": "agent_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processed_at": {
+ "name": "processed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "brain_memory_events_status_created_idx": {
+ "name": "brain_memory_events_status_created_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "brain_memory_events_run_id_task_runs_id_fk": {
+ "name": "brain_memory_events_run_id_task_runs_id_fk",
+ "tableFrom": "brain_memory_events",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "brain_memory_events_run_unique": {
+ "name": "brain_memory_events_run_unique",
+ "nullsNotDistinct": false,
+ "columns": ["run_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.brain_sync_state": {
+ "name": "brain_sync_state",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "collector_id": {
+ "name": "collector_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "watermark": {
+ "name": "watermark",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backfill_cursor": {
+ "name": "backfill_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backfill_completed_at": {
+ "name": "backfill_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "brain_sync_state_collector_id_unique": {
+ "name": "brain_sync_state_collector_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["collector_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.compute_provider_usage": {
+ "name": "compute_provider_usage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_usage_id": {
+ "name": "provider_usage_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_kind": {
+ "name": "auth_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "launch_mode": {
+ "name": "launch_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lifecycle_action": {
+ "name": "lifecycle_action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "measurement_source": {
+ "name": "measurement_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "configured_vcpus": {
+ "name": "configured_vcpus",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "configured_cpu_cores": {
+ "name": "configured_cpu_cores",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "configured_memory_mib": {
+ "name": "configured_memory_mib",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "wall_clock_duration_ms": {
+ "name": "wall_clock_duration_ms",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_cpu_duration_ms": {
+ "name": "active_cpu_duration_ms",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "observed_memory_mib_milliseconds": {
+ "name": "observed_memory_mib_milliseconds",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "network_ingress_bytes": {
+ "name": "network_ingress_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "network_egress_bytes": {
+ "name": "network_egress_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "details": {
+ "name": "details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "compute_provider_usage_provider_usage_id_unique": {
+ "name": "compute_provider_usage_provider_usage_id_unique",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_usage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "compute_provider_usage_run_id_idx": {
+ "name": "compute_provider_usage_run_id_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "compute_provider_usage_task_id_idx": {
+ "name": "compute_provider_usage_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "compute_provider_usage_created_at_idx": {
+ "name": "compute_provider_usage_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "compute_provider_usage_run_id_task_runs_id_fk": {
+ "name": "compute_provider_usage_run_id_task_runs_id_fk",
+ "tableFrom": "compute_provider_usage",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "compute_provider_usage_task_id_tasks_id_fk": {
+ "name": "compute_provider_usage_task_id_tasks_id_fk",
+ "tableFrom": "compute_provider_usage",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.compute_provider_usage_samples": {
+ "name": "compute_provider_usage_samples",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_usage_id": {
+ "name": "provider_usage_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sampled_at": {
+ "name": "sampled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cpu_usage_ns_total": {
+ "name": "cpu_usage_ns_total",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_usage_bytes": {
+ "name": "memory_usage_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_peak_usage_bytes": {
+ "name": "memory_peak_usage_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "details": {
+ "name": "details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "compute_provider_usage_samples_provider_usage_sampled_at_unique": {
+ "name": "compute_provider_usage_samples_provider_usage_sampled_at_unique",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_usage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sampled_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "compute_provider_usage_samples_run_id_idx": {
+ "name": "compute_provider_usage_samples_run_id_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "compute_provider_usage_samples_task_id_idx": {
+ "name": "compute_provider_usage_samples_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "compute_provider_usage_samples_created_at_idx": {
+ "name": "compute_provider_usage_samples_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "compute_provider_usage_samples_run_id_task_runs_id_fk": {
+ "name": "compute_provider_usage_samples_run_id_task_runs_id_fk",
+ "tableFrom": "compute_provider_usage_samples",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "compute_provider_usage_samples_task_id_tasks_id_fk": {
+ "name": "compute_provider_usage_samples_task_id_tasks_id_fk",
+ "tableFrom": "compute_provider_usage_samples",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_automations": {
+ "name": "custom_automations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "schedule_mode": {
+ "name": "schedule_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'off'"
+ },
+ "cron_expression": {
+ "name": "cron_expression",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "all_repositories": {
+ "name": "all_repositories",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "execution_mode": {
+ "name": "execution_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'sandbox_task'"
+ },
+ "target": {
+ "name": "target",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_run_at": {
+ "name": "last_run_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_succeeded_at": {
+ "name": "last_succeeded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_failed_at": {
+ "name": "last_failed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_launched_task_id": {
+ "name": "last_launched_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "launch_claimed_at": {
+ "name": "launch_claimed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "custom_automations_name_unique_idx": {
+ "name": "custom_automations_name_unique_idx",
+ "columns": [
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "custom_automations_enabled_idx": {
+ "name": "custom_automations_enabled_idx",
+ "columns": [
+ {
+ "expression": "enabled",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "custom_automations_environment_id_idx": {
+ "name": "custom_automations_environment_id_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "custom_automations_environment_id_environments_id_fk": {
+ "name": "custom_automations_environment_id_environments_id_fk",
+ "tableFrom": "custom_automations",
+ "tableTo": "environments",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "custom_automations_created_by_user_id_users_id_fk": {
+ "name": "custom_automations_created_by_user_id_users_id_fk",
+ "tableFrom": "custom_automations",
+ "tableTo": "users",
+ "columnsFrom": ["created_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "custom_automations_last_launched_task_id_tasks_id_fk": {
+ "name": "custom_automations_last_launched_task_id_tasks_id_fk",
+ "tableFrom": "custom_automations",
+ "tableTo": "tasks",
+ "columnsFrom": ["last_launched_task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_mcp_servers": {
+ "name": "custom_mcp_servers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_type": {
+ "name": "auth_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'none'"
+ },
+ "headers": {
+ "name": "headers",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stdio": {
+ "name": "stdio",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled_tools": {
+ "name": "disabled_tools",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manual_client_id": {
+ "name": "manual_client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manual_client_secret": {
+ "name": "manual_client_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_server_metadata": {
+ "name": "oauth_server_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_server_metadata_fetched_at": {
+ "name": "oauth_server_metadata_fetched_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_resource_indicator_disabled": {
+ "name": "oauth_resource_indicator_disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "custom_mcp_servers_created_by_user_id_users_id_fk": {
+ "name": "custom_mcp_servers_created_by_user_id_users_id_fk",
+ "tableFrom": "custom_mcp_servers",
+ "tableTo": "users",
+ "columnsFrom": ["created_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "custom_mcp_servers_name_unique": {
+ "name": "custom_mcp_servers_name_unique",
+ "nullsNotDistinct": false,
+ "columns": ["name"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployment_mcp_enablements": {
+ "name": "deployment_mcp_enablements",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "mcp_id": {
+ "name": "mcp_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "enabled_by_user_id": {
+ "name": "enabled_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled_tools": {
+ "name": "disabled_tools",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_access_mode": {
+ "name": "tool_access_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "deployment_mcp_enablements_enabled_by_user_id_users_id_fk": {
+ "name": "deployment_mcp_enablements_enabled_by_user_id_users_id_fk",
+ "tableFrom": "deployment_mcp_enablements",
+ "tableTo": "users",
+ "columnsFrom": ["enabled_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "deployment_mcp_enablements_mcp_unique": {
+ "name": "deployment_mcp_enablements_mcp_unique",
+ "nullsNotDistinct": false,
+ "columns": ["mcp_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployment_secrets": {
+ "name": "deployment_secrets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "deployment_secrets_name_unique": {
+ "name": "deployment_secrets_name_unique",
+ "columns": [
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployment_settings": {
+ "name": "deployment_settings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "task_model_settings": {
+ "name": "task_model_settings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_routing_settings": {
+ "name": "workspace_routing_settings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "router_debug_provider": {
+ "name": "router_debug_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "router_debug_channel_id": {
+ "name": "router_debug_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "router_debug_disabled": {
+ "name": "router_debug_disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "router_debug_slack_channel_id": {
+ "name": "router_debug_slack_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_model_config": {
+ "name": "runtime_model_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_compute_config": {
+ "name": "runtime_compute_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_policy": {
+ "name": "access_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "brain_enabled": {
+ "name": "brain_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "license_key": {
+ "name": "license_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "license_cloud_state": {
+ "name": "license_cloud_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instance_analytics_id": {
+ "name": "instance_analytics_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_known_version": {
+ "name": "latest_known_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_version_checked_at": {
+ "name": "latest_version_checked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "setup_completed_at": {
+ "name": "setup_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "setup_new_state": {
+ "name": "setup_new_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_onboarding_stage": {
+ "name": "slack_onboarding_stage",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manager_slack_channel_id": {
+ "name": "manager_slack_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manager_discord_channel_id": {
+ "name": "manager_discord_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "global_agent_instructions": {
+ "name": "global_agent_instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "time_zone": {
+ "name": "time_zone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "time_zone_updated_at": {
+ "name": "time_zone_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorship_instructions": {
+ "name": "authorship_instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "compiled_authorship_rules": {
+ "name": "compiled_authorship_rules",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "compiled_authorship_issues": {
+ "name": "compiled_authorship_issues",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "compiled_authorship_at": {
+ "name": "compiled_authorship_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "style_guidance": {
+ "name": "style_guidance",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_summon_emoji": {
+ "name": "slack_summon_emoji",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_ack_emoji": {
+ "name": "slack_ack_emoji",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'eyes'"
+ },
+ "slack_completion_emoji": {
+ "name": "slack_completion_emoji",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'white_check_mark'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.discord_gateway_sessions": {
+ "name": "discord_gateway_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resume_gateway_url": {
+ "name": "resume_gateway_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shard_count": {
+ "name": "shard_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_connected_at": {
+ "name": "last_connected_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_heartbeat_ack_at": {
+ "name": "last_heartbeat_ack_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disconnected_at": {
+ "name": "disconnected_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.discord_installation_channels": {
+ "name": "discord_installation_channels",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "discord_installation_id": {
+ "name": "discord_installation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel_id": {
+ "name": "channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel_name": {
+ "name": "channel_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "channel_type": {
+ "name": "channel_type",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_available": {
+ "name": "is_available",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "discord_installation_channels_installation_id_idx": {
+ "name": "discord_installation_channels_installation_id_idx",
+ "columns": [
+ {
+ "expression": "discord_installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "discord_installation_channels_unique": {
+ "name": "discord_installation_channels_unique",
+ "columns": [
+ {
+ "expression": "discord_installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "discord_installation_channels_discord_installation_id_discord_installations_id_fk": {
+ "name": "discord_installation_channels_discord_installation_id_discord_installations_id_fk",
+ "tableFrom": "discord_installation_channels",
+ "tableTo": "discord_installations",
+ "columnsFrom": ["discord_installation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.discord_installations": {
+ "name": "discord_installations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "guild_id": {
+ "name": "guild_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "guild_name": {
+ "name": "guild_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "application_id": {
+ "name": "application_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bot_user_id": {
+ "name": "bot_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "installed_by_user_id": {
+ "name": "installed_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "default_channel_id": {
+ "name": "default_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "default_channel_name": {
+ "name": "default_channel_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "default_channel_type": {
+ "name": "default_channel_type",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "discord_installations_guild_id_unique": {
+ "name": "discord_installations_guild_id_unique",
+ "columns": [
+ {
+ "expression": "guild_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "discord_installations_active_idx": {
+ "name": "discord_installations_active_idx",
+ "columns": [
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "discord_installations_default_channel_idx": {
+ "name": "discord_installations_default_channel_idx",
+ "columns": [
+ {
+ "expression": "default_channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "discord_installations_installed_by_user_id_users_id_fk": {
+ "name": "discord_installations_installed_by_user_id_users_id_fk",
+ "tableFrom": "discord_installations",
+ "tableTo": "users",
+ "columnsFrom": ["installed_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.discord_user_mappings": {
+ "name": "discord_user_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "discord_user_id": {
+ "name": "discord_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "discord_username": {
+ "name": "discord_username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discord_global_name": {
+ "name": "discord_global_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discord_dm_channel_id": {
+ "name": "discord_dm_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "discord_user_mappings_user_id_idx": {
+ "name": "discord_user_mappings_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "discord_user_mappings_discord_user_id_unique": {
+ "name": "discord_user_mappings_discord_user_id_unique",
+ "columns": [
+ {
+ "expression": "discord_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "discord_user_mappings_user_id_users_id_fk": {
+ "name": "discord_user_mappings_user_id_users_id_fk",
+ "tableFrom": "discord_user_mappings",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.environment_config_versions": {
+ "name": "environment_config_versions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environment_config_versions_environment_id_idx": {
+ "name": "environment_config_versions_environment_id_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "environment_config_versions_environment_version_unique": {
+ "name": "environment_config_versions_environment_version_unique",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_config_versions_environment_id_environments_id_fk": {
+ "name": "environment_config_versions_environment_id_environments_id_fk",
+ "tableFrom": "environment_config_versions",
+ "tableTo": "environments",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_config_versions_created_by_user_id_users_id_fk": {
+ "name": "environment_config_versions_created_by_user_id_users_id_fk",
+ "tableFrom": "environment_config_versions",
+ "tableTo": "users",
+ "columnsFrom": ["created_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.environment_repository_mappings": {
+ "name": "environment_repository_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_id": {
+ "name": "repository_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "env_repo_mappings_env_id_idx": {
+ "name": "env_repo_mappings_env_id_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "env_repo_mappings_repo_id_idx": {
+ "name": "env_repo_mappings_repo_id_idx",
+ "columns": [
+ {
+ "expression": "repository_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_repository_mappings_environment_id_environments_id_fk": {
+ "name": "environment_repository_mappings_environment_id_environments_id_fk",
+ "tableFrom": "environment_repository_mappings",
+ "tableTo": "environments",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_repository_mappings_repository_id_repositories_id_fk": {
+ "name": "environment_repository_mappings_repository_id_repositories_id_fk",
+ "tableFrom": "environment_repository_mappings",
+ "tableTo": "repositories",
+ "columnsFrom": ["repository_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "env_repo_mappings_unique": {
+ "name": "env_repo_mappings_unique",
+ "nullsNotDistinct": false,
+ "columns": ["environment_id", "repository_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.environment_snapshots": {
+ "name": "environment_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "snapshot_id": {
+ "name": "snapshot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_created_at": {
+ "name": "snapshot_created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_expires_at": {
+ "name": "snapshot_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_status": {
+ "name": "snapshot_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environment_snapshots_environment_id_idx": {
+ "name": "environment_snapshots_environment_id_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "environment_snapshots_env_provider_unique": {
+ "name": "environment_snapshots_env_provider_unique",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"environment_snapshots\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_snapshots_environment_id_environments_id_fk": {
+ "name": "environment_snapshots_environment_id_environments_id_fk",
+ "tableFrom": "environment_snapshots",
+ "tableTo": "environments",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.environment_variables": {
+ "name": "environment_variables",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_updated_by_user_id": {
+ "name": "last_updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environment_variables_user_id_idx": {
+ "name": "environment_variables_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "environment_variables_name_unique": {
+ "name": "environment_variables_name_unique",
+ "columns": [
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_variables_user_id_users_id_fk": {
+ "name": "environment_variables_user_id_users_id_fk",
+ "tableFrom": "environment_variables",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_variables_created_by_user_id_users_id_fk": {
+ "name": "environment_variables_created_by_user_id_users_id_fk",
+ "tableFrom": "environment_variables",
+ "tableTo": "users",
+ "columnsFrom": ["created_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "environment_variables_last_updated_by_user_id_users_id_fk": {
+ "name": "environment_variables_last_updated_by_user_id_users_id_fk",
+ "tableFrom": "environment_variables",
+ "tableTo": "users",
+ "columnsFrom": ["last_updated_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.environments": {
+ "name": "environments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_eval": {
+ "name": "is_eval",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "declarative_source": {
+ "name": "declarative_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_verified": {
+ "name": "is_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "verification_task_id": {
+ "name": "verification_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "verified_at": {
+ "name": "verified_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "verification_error": {
+ "name": "verification_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_id": {
+ "name": "snapshot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_created_at": {
+ "name": "snapshot_created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_expires_at": {
+ "name": "snapshot_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_status": {
+ "name": "snapshot_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environments_user_id_idx": {
+ "name": "environments_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "environments_created_by_user_id_idx": {
+ "name": "environments_created_by_user_id_idx",
+ "columns": [
+ {
+ "expression": "created_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "environments_snapshot_expires_at_idx": {
+ "name": "environments_snapshot_expires_at_idx",
+ "columns": [
+ {
+ "expression": "snapshot_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "environments_name_unique": {
+ "name": "environments_name_unique",
+ "columns": [
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environments_user_id_users_id_fk": {
+ "name": "environments_user_id_users_id_fk",
+ "tableFrom": "environments",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environments_created_by_user_id_users_id_fk": {
+ "name": "environments_created_by_user_id_users_id_fk",
+ "tableFrom": "environments",
+ "tableTo": "users",
+ "columnsFrom": ["created_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.fast_agent_conversations": {
+ "name": "fast_agent_conversations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_automation": {
+ "name": "owner_automation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "surface": {
+ "name": "surface",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "current_reply_channel_id": {
+ "name": "current_reply_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "current_reply_thread_id": {
+ "name": "current_reply_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "current_reply_service_url": {
+ "name": "current_reply_service_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reply_target_verified": {
+ "name": "reply_target_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "compatibility_messages": {
+ "name": "compatibility_messages",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "opencode_session_id": {
+ "name": "opencode_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reasoning_effort": {
+ "name": "reasoning_effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title_edited_by_user_at": {
+ "name": "title_edited_by_user_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "llm_title_checkpoint": {
+ "name": "llm_title_checkpoint",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "legacy_conversation_ids": {
+ "name": "legacy_conversation_ids",
+ "type": "uuid[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::uuid[]"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "fast_agent_conversations_identity_unique": {
+ "name": "fast_agent_conversations_identity_unique",
+ "columns": [
+ {
+ "expression": "surface",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "fast_agent_conversations_user_idx": {
+ "name": "fast_agent_conversations_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "fast_agent_conversations_owner_automation_idx": {
+ "name": "fast_agent_conversations_owner_automation_idx",
+ "columns": [
+ {
+ "expression": "owner_automation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "fast_agent_conversations_legacy_ids_idx": {
+ "name": "fast_agent_conversations_legacy_ids_idx",
+ "columns": [
+ {
+ "expression": "legacy_conversation_ids",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "gin",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "fast_agent_conversations_user_id_users_id_fk": {
+ "name": "fast_agent_conversations_user_id_users_id_fk",
+ "tableFrom": "fast_agent_conversations",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "fast_agent_conversations_owner_automation_automations_key_fk": {
+ "name": "fast_agent_conversations_owner_automation_automations_key_fk",
+ "tableFrom": "fast_agent_conversations",
+ "tableTo": "automations",
+ "columnsFrom": ["owner_automation"],
+ "columnsTo": ["key"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "fast_agent_conversations_owner_shape_check": {
+ "name": "fast_agent_conversations_owner_shape_check",
+ "value": "(\n (\"fast_agent_conversations\".\"user_id\" is not null and \"fast_agent_conversations\".\"owner_automation\" is null)\n or\n (\"fast_agent_conversations\".\"user_id\" is null and \"fast_agent_conversations\".\"owner_automation\" is not null)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.fast_agent_memory_events": {
+ "name": "fast_agent_memory_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "memory": {
+ "name": "memory",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processed_at": {
+ "name": "processed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "fast_agent_memory_events_status_created_idx": {
+ "name": "fast_agent_memory_events_status_created_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "fast_agent_memory_events_conversation_id_fast_agent_conversations_id_fk": {
+ "name": "fast_agent_memory_events_conversation_id_fast_agent_conversations_id_fk",
+ "tableFrom": "fast_agent_memory_events",
+ "tableTo": "fast_agent_conversations",
+ "columnsFrom": ["conversation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "fast_agent_memory_events_conversation_unique": {
+ "name": "fast_agent_memory_events_conversation_unique",
+ "nullsNotDistinct": false,
+ "columns": ["conversation_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.fast_agent_messages": {
+ "name": "fast_agent_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "turn_seq": {
+ "name": "turn_seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ts": {
+ "name": "ts",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content_blocks": {
+ "name": "content_blocks",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "native_session_id": {
+ "name": "native_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "native_message_id": {
+ "name": "native_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "fast_agent_messages_conversation_event_unique": {
+ "name": "fast_agent_messages_conversation_event_unique",
+ "columns": [
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "fast_agent_messages_conversation_order_idx": {
+ "name": "fast_agent_messages_conversation_order_idx",
+ "columns": [
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "ts",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "turn_seq",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "fast_agent_messages_conversation_id_fast_agent_conversations_id_fk": {
+ "name": "fast_agent_messages_conversation_id_fast_agent_conversations_id_fk",
+ "tableFrom": "fast_agent_messages",
+ "tableTo": "fast_agent_conversations",
+ "columnsFrom": ["conversation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.fast_agent_pr_feedback_deliveries": {
+ "name": "fast_agent_pr_feedback_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback_id": {
+ "name": "feedback_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_token": {
+ "name": "lease_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "fast_agent_pr_feedback_deliveries_identity_unique": {
+ "name": "fast_agent_pr_feedback_deliveries_identity_unique",
+ "columns": [
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "feedback_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "fast_agent_pr_feedback_deliveries_task_idx": {
+ "name": "fast_agent_pr_feedback_deliveries_task_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "fast_agent_pr_feedback_deliveries_conversation_id_fast_agent_conversations_id_fk": {
+ "name": "fast_agent_pr_feedback_deliveries_conversation_id_fast_agent_conversations_id_fk",
+ "tableFrom": "fast_agent_pr_feedback_deliveries",
+ "tableTo": "fast_agent_conversations",
+ "columnsFrom": ["conversation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "fast_agent_pr_feedback_deliveries_task_id_tasks_id_fk": {
+ "name": "fast_agent_pr_feedback_deliveries_task_id_tasks_id_fk",
+ "tableFrom": "fast_agent_pr_feedback_deliveries",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.fast_agent_provider_messages": {
+ "name": "fast_agent_provider_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_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": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "fast_agent_provider_messages_route_unique": {
+ "name": "fast_agent_provider_messages_route_unique",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "fast_agent_provider_messages_conversation_idx": {
+ "name": "fast_agent_provider_messages_conversation_idx",
+ "columns": [
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "fast_agent_provider_messages_thread_idx": {
+ "name": "fast_agent_provider_messages_thread_idx",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "thread_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "fast_agent_provider_messages_conversation_id_fast_agent_conversations_id_fk": {
+ "name": "fast_agent_provider_messages_conversation_id_fast_agent_conversations_id_fk",
+ "tableFrom": "fast_agent_provider_messages",
+ "tableTo": "fast_agent_conversations",
+ "columnsFrom": ["conversation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "fast_agent_provider_messages_provider_check": {
+ "name": "fast_agent_provider_messages_provider_check",
+ "value": "\"fast_agent_provider_messages\".\"provider\" in ('discord', 'teams')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.github_installations": {
+ "name": "github_installations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_id": {
+ "name": "app_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_login": {
+ "name": "account_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_type": {
+ "name": "account_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "installed_by_user_id": {
+ "name": "installed_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "members_count": {
+ "name": "members_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspended_at": {
+ "name": "suspended_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "github_installations_account_login_idx": {
+ "name": "github_installations_account_login_idx",
+ "columns": [
+ {
+ "expression": "account_login",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "github_installations_deployment_installation_unique": {
+ "name": "github_installations_deployment_installation_unique",
+ "columns": [
+ {
+ "expression": "installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "github_installations_user_id_users_id_fk": {
+ "name": "github_installations_user_id_users_id_fk",
+ "tableFrom": "github_installations",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "github_installations_installed_by_user_id_users_id_fk": {
+ "name": "github_installations_installed_by_user_id_users_id_fk",
+ "tableFrom": "github_installations",
+ "tableTo": "users",
+ "columnsFrom": ["installed_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.github_pending_installations": {
+ "name": "github_pending_installations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by_user_id": {
+ "name": "requested_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_id": {
+ "name": "app_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "github_pending_installations_requested_by_user_id_idx": {
+ "name": "github_pending_installations_requested_by_user_id_idx",
+ "columns": [
+ {
+ "expression": "requested_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "github_pending_installations_user_id_users_id_fk": {
+ "name": "github_pending_installations_user_id_users_id_fk",
+ "tableFrom": "github_pending_installations",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "github_pending_installations_requested_by_user_id_users_id_fk": {
+ "name": "github_pending_installations_requested_by_user_id_users_id_fk",
+ "tableFrom": "github_pending_installations",
+ "tableTo": "users",
+ "columnsFrom": ["requested_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.github_user_mappings": {
+ "name": "github_user_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "github_login": {
+ "name": "github_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_user_id": {
+ "name": "github_user_id",
+ "type": "bigint",
+ "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
+ },
+ "token_expires_at": {
+ "name": "token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "github_user_mappings_github_login_idx": {
+ "name": "github_user_mappings_github_login_idx",
+ "columns": [
+ {
+ "expression": "github_login",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "github_user_mappings_user_id_idx": {
+ "name": "github_user_mappings_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "github_user_mappings_user_id_users_id_fk": {
+ "name": "github_user_mappings_user_id_users_id_fk",
+ "tableFrom": "github_user_mappings",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "github_user_mappings_unique": {
+ "name": "github_user_mappings_unique",
+ "nullsNotDistinct": false,
+ "columns": ["github_user_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invites": {
+ "name": "invites",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invited_by_user_id": {
+ "name": "invited_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "max_uses": {
+ "name": "max_uses",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "used_count": {
+ "name": "used_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "invites_token_hash_unique": {
+ "name": "invites_token_hash_unique",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invites_created_at_idx": {
+ "name": "invites_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invites_invited_by_user_id_users_id_fk": {
+ "name": "invites_invited_by_user_id_users_id_fk",
+ "tableFrom": "invites",
+ "tableTo": "users",
+ "columnsFrom": ["invited_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.license_usage_observations": {
+ "name": "license_usage_observations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "observed_at": {
+ "name": "observed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_users": {
+ "name": "active_users",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_attempted_at": {
+ "name": "last_attempted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "license_usage_observations_pending_idx": {
+ "name": "license_usage_observations_pending_idx",
+ "columns": [
+ {
+ "expression": "delivered_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "observed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.linear_pending_selections": {
+ "name": "linear_pending_selections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "linear_organization_id": {
+ "name": "linear_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "step": {
+ "name": "step",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'awaiting_workspace'"
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "selected_repo": {
+ "name": "selected_repo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_options": {
+ "name": "workspace_options",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "linear_pending_selections_expires_at_idx": {
+ "name": "linear_pending_selections_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "linear_pending_selections_step_idx": {
+ "name": "linear_pending_selections_step_idx",
+ "columns": [
+ {
+ "expression": "step",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "linear_pending_selections_user_id_users_id_fk": {
+ "name": "linear_pending_selections_user_id_users_id_fk",
+ "tableFrom": "linear_pending_selections",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "linear_pending_selections_session_id_unique": {
+ "name": "linear_pending_selections_session_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["session_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_inference_usage_events": {
+ "name": "task_inference_usage_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'opencode'"
+ },
+ "usage_type": {
+ "name": "usage_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'inference'"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_key": {
+ "name": "event_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "harness_session_id": {
+ "name": "harness_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent": {
+ "name": "agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "reasoning_tokens": {
+ "name": "reasoning_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "cache_read_tokens": {
+ "name": "cache_read_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "cache_write_tokens": {
+ "name": "cache_write_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "context_tokens": {
+ "name": "context_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "cost_micro_usd": {
+ "name": "cost_micro_usd",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "cost_source": {
+ "name": "cost_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pricing_metadata": {
+ "name": "pricing_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "message_created_at": {
+ "name": "message_created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_completed_at": {
+ "name": "message_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "details": {
+ "name": "details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_inference_usage_events_session_message_unique": {
+ "name": "task_inference_usage_events_session_message_unique",
+ "columns": [
+ {
+ "expression": "harness_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_inference_usage_events_event_key_unique": {
+ "name": "task_inference_usage_events_event_key_unique",
+ "columns": [
+ {
+ "expression": "event_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_inference_usage_events_task_id_idx": {
+ "name": "task_inference_usage_events_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_inference_usage_events_run_id_idx": {
+ "name": "task_inference_usage_events_run_id_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_inference_usage_events_user_id_idx": {
+ "name": "task_inference_usage_events_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_inference_usage_events_environment_id_idx": {
+ "name": "task_inference_usage_events_environment_id_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_inference_usage_events_provider_model_idx": {
+ "name": "task_inference_usage_events_provider_model_idx",
+ "columns": [
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "model_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_inference_usage_events_created_at_idx": {
+ "name": "task_inference_usage_events_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_inference_usage_events_task_id_tasks_id_fk": {
+ "name": "task_inference_usage_events_task_id_tasks_id_fk",
+ "tableFrom": "task_inference_usage_events",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_inference_usage_events_run_id_task_runs_id_fk": {
+ "name": "task_inference_usage_events_run_id_task_runs_id_fk",
+ "tableFrom": "task_inference_usage_events",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "task_inference_usage_events_user_id_users_id_fk": {
+ "name": "task_inference_usage_events_user_id_users_id_fk",
+ "tableFrom": "task_inference_usage_events",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "task_inference_usage_events_environment_id_environments_id_fk": {
+ "name": "task_inference_usage_events_environment_id_environments_id_fk",
+ "tableFrom": "task_inference_usage_events",
+ "tableTo": "environments",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_connections": {
+ "name": "mcp_connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_id": {
+ "name": "mcp_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_role": {
+ "name": "connection_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "auth_config": {
+ "name": "auth_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "auth_status": {
+ "name": "auth_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_expires_at": {
+ "name": "token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_connections_user_id_idx": {
+ "name": "mcp_connections_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_connections_role_idx": {
+ "name": "mcp_connections_role_idx",
+ "columns": [
+ {
+ "expression": "mcp_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_role",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_connections_user_id_users_id_fk": {
+ "name": "mcp_connections_user_id_users_id_fk",
+ "tableFrom": "mcp_connections",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "mcp_connections_user_mcp_id_unique": {
+ "name": "mcp_connections_user_mcp_id_unique",
+ "nullsNotDistinct": true,
+ "columns": ["user_id", "mcp_id", "connection_role"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_oauth_replays": {
+ "name": "mcp_oauth_replays",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_id": {
+ "name": "mcp_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_role": {
+ "name": "connection_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "redirect_to": {
+ "name": "redirect_to",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_oauth_replays_connection_id_idx": {
+ "name": "mcp_oauth_replays_connection_id_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_oauth_replays_user_id_idx": {
+ "name": "mcp_oauth_replays_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_oauth_replays_expires_at_idx": {
+ "name": "mcp_oauth_replays_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_oauth_replays_connection_id_mcp_connections_id_fk": {
+ "name": "mcp_oauth_replays_connection_id_mcp_connections_id_fk",
+ "tableFrom": "mcp_oauth_replays",
+ "tableTo": "mcp_connections",
+ "columnsFrom": ["connection_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_oauth_replays_user_id_users_id_fk": {
+ "name": "mcp_oauth_replays_user_id_users_id_fk",
+ "tableFrom": "mcp_oauth_replays",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "mcp_oauth_replays_token_unique": {
+ "name": "mcp_oauth_replays_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.microsoft_auth_user_mappings": {
+ "name": "microsoft_auth_user_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "auth_account_id": {
+ "name": "auth_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "microsoft_tenant_id": {
+ "name": "microsoft_tenant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "microsoft_aad_object_id": {
+ "name": "microsoft_aad_object_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "microsoft_auth_user_mappings_user_id_idx": {
+ "name": "microsoft_auth_user_mappings_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "microsoft_auth_user_mappings_account_id_idx": {
+ "name": "microsoft_auth_user_mappings_account_id_idx",
+ "columns": [
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "microsoft_auth_user_mappings_auth_account_idx": {
+ "name": "microsoft_auth_user_mappings_auth_account_idx",
+ "columns": [
+ {
+ "expression": "auth_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "microsoft_auth_user_mappings_aad_object_unique": {
+ "name": "microsoft_auth_user_mappings_aad_object_unique",
+ "columns": [
+ {
+ "expression": "microsoft_tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "microsoft_aad_object_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "microsoft_auth_user_mappings_auth_account_id_auth_accounts_id_fk": {
+ "name": "microsoft_auth_user_mappings_auth_account_id_auth_accounts_id_fk",
+ "tableFrom": "microsoft_auth_user_mappings",
+ "tableTo": "auth_accounts",
+ "columnsFrom": ["auth_account_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "microsoft_auth_user_mappings_user_id_auth_users_id_fk": {
+ "name": "microsoft_auth_user_mappings_user_id_auth_users_id_fk",
+ "tableFrom": "microsoft_auth_user_mappings",
+ "tableTo": "auth_users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notion_directory_users": {
+ "name": "notion_directory_users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "notion_user_id": {
+ "name": "notion_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_deleted": {
+ "name": "is_deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "notion_directory_users_unique": {
+ "name": "notion_directory_users_unique",
+ "nullsNotDistinct": false,
+ "columns": ["notion_user_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_state": {
+ "name": "oauth_state",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code_verifier": {
+ "name": "code_verifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "replay_token": {
+ "name": "replay_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "oauth_state_connection_id_idx": {
+ "name": "oauth_state_connection_id_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_state_replay_token_idx": {
+ "name": "oauth_state_replay_token_idx",
+ "columns": [
+ {
+ "expression": "replay_token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauth_state_expires_at_idx": {
+ "name": "oauth_state_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_state_connection_id_mcp_connections_id_fk": {
+ "name": "oauth_state_connection_id_mcp_connections_id_fk",
+ "tableFrom": "oauth_state",
+ "tableTo": "mcp_connections",
+ "columnsFrom": ["connection_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pr_review_auto_preferences": {
+ "name": "pr_review_auto_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "source_control_provider": {
+ "name": "source_control_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "host": {
+ "name": "host",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_id": {
+ "name": "repository_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_identity_key": {
+ "name": "repository_identity_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled_by_user_id": {
+ "name": "enabled_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled_at": {
+ "name": "enabled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "source_task_id": {
+ "name": "source_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_destination_key": {
+ "name": "source_destination_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pr_review_auto_preferences_identity_unique": {
+ "name": "pr_review_auto_preferences_identity_unique",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository_identity_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pr_review_auto_preferences_repository_idx": {
+ "name": "pr_review_auto_preferences_repository_idx",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pr_review_auto_preferences_repository_id_repositories_id_fk": {
+ "name": "pr_review_auto_preferences_repository_id_repositories_id_fk",
+ "tableFrom": "pr_review_auto_preferences",
+ "tableTo": "repositories",
+ "columnsFrom": ["repository_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "pr_review_auto_preferences_enabled_by_user_id_users_id_fk": {
+ "name": "pr_review_auto_preferences_enabled_by_user_id_users_id_fk",
+ "tableFrom": "pr_review_auto_preferences",
+ "tableTo": "users",
+ "columnsFrom": ["enabled_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "pr_review_auto_preferences_source_task_id_tasks_id_fk": {
+ "name": "pr_review_auto_preferences_source_task_id_tasks_id_fk",
+ "tableFrom": "pr_review_auto_preferences",
+ "tableTo": "tasks",
+ "columnsFrom": ["source_task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pr_review_cycles": {
+ "name": "pr_review_cycles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "source_control_provider": {
+ "name": "source_control_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "review_head_sha": {
+ "name": "review_head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cycle_id": {
+ "name": "cycle_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "pr_review_cycles_source_unique": {
+ "name": "pr_review_cycles_source_unique",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "review_head_sha",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pr_review_event_deliveries": {
+ "name": "pr_review_event_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "due_at": {
+ "name": "due_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deferrals": {
+ "name": "deferrals",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lease_token": {
+ "name": "lease_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pr_review_event_deliveries_event_task_unique": {
+ "name": "pr_review_event_deliveries_event_task_unique",
+ "columns": [
+ {
+ "expression": "event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pr_review_event_deliveries_due_idx": {
+ "name": "pr_review_event_deliveries_due_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "due_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lease_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pr_review_event_deliveries_event_id_pr_review_events_id_fk": {
+ "name": "pr_review_event_deliveries_event_id_pr_review_events_id_fk",
+ "tableFrom": "pr_review_event_deliveries",
+ "tableTo": "pr_review_events",
+ "columnsFrom": ["event_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "pr_review_event_deliveries_task_id_tasks_id_fk": {
+ "name": "pr_review_event_deliveries_task_id_tasks_id_fk",
+ "tableFrom": "pr_review_event_deliveries",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pr_review_event_deliveries_status_check": {
+ "name": "pr_review_event_deliveries_status_check",
+ "value": "\"pr_review_event_deliveries\".\"status\" in ('pending', 'processing', 'delivered', 'suppressed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pr_review_events": {
+ "name": "pr_review_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "event_key": {
+ "name": "event_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_control_provider": {
+ "name": "source_control_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_url": {
+ "name": "pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event": {
+ "name": "event",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "batch_kind": {
+ "name": "batch_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "batch_id": {
+ "name": "batch_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "review_head_sha": {
+ "name": "review_head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sealed_at": {
+ "name": "sealed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "superseded": {
+ "name": "superseded",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "available_at": {
+ "name": "available_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "observed_at": {
+ "name": "observed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pr_review_events_source_unique": {
+ "name": "pr_review_events_source_unique",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "event_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pr_review_events_pr_idx": {
+ "name": "pr_review_events_pr_idx",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pr_review_events_batch_kind_check": {
+ "name": "pr_review_events_batch_kind_check",
+ "value": "\"pr_review_events\".\"batch_kind\" in ('human', 'roomote')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pr_review_notification_deliveries": {
+ "name": "pr_review_notification_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "notification_unit_id": {
+ "name": "notification_unit_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "destination_kind": {
+ "name": "destination_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "destination_key": {
+ "name": "destination_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "due_at": {
+ "name": "due_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deferrals": {
+ "name": "deferrals",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "attempt": {
+ "name": "attempt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lease_token": {
+ "name": "lease_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "route_provider": {
+ "name": "route_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "route_workspace_id": {
+ "name": "route_workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "route_channel_id": {
+ "name": "route_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "route_thread_id": {
+ "name": "route_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "follow_up_prompt": {
+ "name": "follow_up_prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_task_id": {
+ "name": "target_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acting_user_id": {
+ "name": "acting_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_message_id": {
+ "name": "provider_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action_claimed_at": {
+ "name": "action_claimed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dispatch_key": {
+ "name": "dispatch_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dispatched_run_id": {
+ "name": "dispatched_run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pr_review_notification_deliveries_destination_unique": {
+ "name": "pr_review_notification_deliveries_destination_unique",
+ "columns": [
+ {
+ "expression": "notification_unit_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "destination_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "destination_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pr_review_notification_deliveries_dispatch_key_unique": {
+ "name": "pr_review_notification_deliveries_dispatch_key_unique",
+ "columns": [
+ {
+ "expression": "dispatch_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pr_review_notification_deliveries_due_idx": {
+ "name": "pr_review_notification_deliveries_due_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "due_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lease_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pr_review_notification_deliveries_destination_idx": {
+ "name": "pr_review_notification_deliveries_destination_idx",
+ "columns": [
+ {
+ "expression": "destination_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "destination_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pr_review_notification_deliveries_notification_unit_id_pr_review_notification_units_id_fk": {
+ "name": "pr_review_notification_deliveries_notification_unit_id_pr_review_notification_units_id_fk",
+ "tableFrom": "pr_review_notification_deliveries",
+ "tableTo": "pr_review_notification_units",
+ "columnsFrom": ["notification_unit_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "pr_review_notification_deliveries_task_id_tasks_id_fk": {
+ "name": "pr_review_notification_deliveries_task_id_tasks_id_fk",
+ "tableFrom": "pr_review_notification_deliveries",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "pr_review_notification_deliveries_target_task_id_tasks_id_fk": {
+ "name": "pr_review_notification_deliveries_target_task_id_tasks_id_fk",
+ "tableFrom": "pr_review_notification_deliveries",
+ "tableTo": "tasks",
+ "columnsFrom": ["target_task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "pr_review_notification_deliveries_acting_user_id_users_id_fk": {
+ "name": "pr_review_notification_deliveries_acting_user_id_users_id_fk",
+ "tableFrom": "pr_review_notification_deliveries",
+ "tableTo": "users",
+ "columnsFrom": ["acting_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pr_review_notification_deliveries_destination_kind_check": {
+ "name": "pr_review_notification_deliveries_destination_kind_check",
+ "value": "\"pr_review_notification_deliveries\".\"destination_kind\" in ('fast_conversation', 'task')"
+ },
+ "pr_review_notification_deliveries_status_check": {
+ "name": "pr_review_notification_deliveries_status_check",
+ "value": "\"pr_review_notification_deliveries\".\"status\" in ('pending', 'claimed', 'prepared', 'prompt_posting', 'awaiting_user_action', 'auto_dispatch_pending', 'completed', 'suppressed', 'dismissed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pr_review_notification_unit_events": {
+ "name": "pr_review_notification_unit_events",
+ "schema": "",
+ "columns": {
+ "unit_id": {
+ "name": "unit_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attached_at": {
+ "name": "attached_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pr_review_notification_unit_events_event_unique": {
+ "name": "pr_review_notification_unit_events_event_unique",
+ "columns": [
+ {
+ "expression": "event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pr_review_notification_unit_events_unit_id_pr_review_notification_units_id_fk": {
+ "name": "pr_review_notification_unit_events_unit_id_pr_review_notification_units_id_fk",
+ "tableFrom": "pr_review_notification_unit_events",
+ "tableTo": "pr_review_notification_units",
+ "columnsFrom": ["unit_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "pr_review_notification_unit_events_event_id_pr_review_events_id_fk": {
+ "name": "pr_review_notification_unit_events_event_id_pr_review_events_id_fk",
+ "tableFrom": "pr_review_notification_unit_events",
+ "tableTo": "pr_review_events",
+ "columnsFrom": ["event_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "pr_review_notification_unit_events_pk": {
+ "name": "pr_review_notification_unit_events_pk",
+ "columns": ["unit_id", "event_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pr_review_notification_units": {
+ "name": "pr_review_notification_units",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "source_control_provider": {
+ "name": "source_control_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "host": {
+ "name": "host",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_id": {
+ "name": "repository_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_identity_key": {
+ "name": "repository_identity_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_url": {
+ "name": "pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "head_identity_key": {
+ "name": "head_identity_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "episode_kind": {
+ "name": "episode_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "episode_id": {
+ "name": "episode_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "due_at": {
+ "name": "due_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "first_observed_at": {
+ "name": "first_observed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_observed_at": {
+ "name": "last_observed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sealed_at": {
+ "name": "sealed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pr_review_notification_units_identity_unique": {
+ "name": "pr_review_notification_units_identity_unique",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository_identity_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "head_identity_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "episode_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "episode_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pr_review_notification_units_open_head_idx": {
+ "name": "pr_review_notification_units_open_head_idx",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "head_sha",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sealed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pr_review_notification_units_repository_id_repositories_id_fk": {
+ "name": "pr_review_notification_units_repository_id_repositories_id_fk",
+ "tableFrom": "pr_review_notification_units",
+ "tableTo": "repositories",
+ "columnsFrom": ["repository_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pr_review_notification_units_episode_kind_check": {
+ "name": "pr_review_notification_units_episode_kind_check",
+ "value": "\"pr_review_notification_units\".\"episode_kind\" in ('roomote_cycle', 'human', 'automated', 'ci')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pull_request_facts": {
+ "name": "pull_request_facts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "repository_id": {
+ "name": "repository_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_full_name": {
+ "name": "repository_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_control_provider": {
+ "name": "source_control_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'github'"
+ },
+ "external_pull_request_id": {
+ "name": "external_pull_request_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "html_url": {
+ "name": "html_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "author_login": {
+ "name": "author_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "labels": {
+ "name": "labels",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changed_files": {
+ "name": "changed_files",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changed_file_count": {
+ "name": "changed_file_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "files_capped": {
+ "name": "files_capped",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reviews_capped": {
+ "name": "reviews_capped",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "additions": {
+ "name": "additions",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletions": {
+ "name": "deletions",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reviews": {
+ "name": "reviews",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enriched_at": {
+ "name": "enriched_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enriched_for_updated_at": {
+ "name": "enriched_for_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enrichment_failed_at": {
+ "name": "enrichment_failed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at_remote": {
+ "name": "created_at_remote",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at_remote": {
+ "name": "updated_at_remote",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "closed_at_remote": {
+ "name": "closed_at_remote",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "merged_at_remote": {
+ "name": "merged_at_remote",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_seen_at": {
+ "name": "first_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "synced_at": {
+ "name": "synced_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pull_request_facts_deployment_repo_pr_unique": {
+ "name": "pull_request_facts_deployment_repo_pr_unique",
+ "columns": [
+ {
+ "expression": "repository_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pull_request_facts_deployment_created_idx": {
+ "name": "pull_request_facts_deployment_created_idx",
+ "columns": [
+ {
+ "expression": "created_at_remote",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pull_request_facts_deployment_repo_created_idx": {
+ "name": "pull_request_facts_deployment_repo_created_idx",
+ "columns": [
+ {
+ "expression": "repository_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at_remote",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pull_request_facts_deployment_state_created_idx": {
+ "name": "pull_request_facts_deployment_state_created_idx",
+ "columns": [
+ {
+ "expression": "state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at_remote",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pull_request_facts_deployment_author_created_idx": {
+ "name": "pull_request_facts_deployment_author_created_idx",
+ "columns": [
+ {
+ "expression": "author_login",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at_remote",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pull_request_facts_deployment_updated_idx": {
+ "name": "pull_request_facts_deployment_updated_idx",
+ "columns": [
+ {
+ "expression": "updated_at_remote",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pull_request_facts_repository_id_repositories_id_fk": {
+ "name": "pull_request_facts_repository_id_repositories_id_fk",
+ "tableFrom": "pull_request_facts",
+ "tableTo": "repositories",
+ "columnsFrom": ["repository_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pull_request_facts_source_control_provider_check": {
+ "name": "pull_request_facts_source_control_provider_check",
+ "value": "\"pull_request_facts\".\"source_control_provider\" in ('github', 'gitlab', 'gitea', 'ado', 'bitbucket')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pull_request_sync_states": {
+ "name": "pull_request_sync_states",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "repository_id": {
+ "name": "repository_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_incremental_updated_at": {
+ "name": "last_incremental_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backfill_completed_at": {
+ "name": "backfill_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cooldown_until": {
+ "name": "cooldown_until",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_successful_sync_at": {
+ "name": "last_successful_sync_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_attempted_sync_at": {
+ "name": "last_attempted_sync_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_at": {
+ "name": "last_error_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_message": {
+ "name": "last_error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pull_request_sync_states_repo_unique": {
+ "name": "pull_request_sync_states_repo_unique",
+ "columns": [
+ {
+ "expression": "repository_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pull_request_sync_states_deployment_updated_idx": {
+ "name": "pull_request_sync_states_deployment_updated_idx",
+ "columns": [
+ {
+ "expression": "last_successful_sync_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "pull_request_sync_states_cooldown_idx": {
+ "name": "pull_request_sync_states_cooldown_idx",
+ "columns": [
+ {
+ "expression": "cooldown_until",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "pull_request_sync_states_repository_id_repositories_id_fk": {
+ "name": "pull_request_sync_states_repository_id_repositories_id_fk",
+ "tableFrom": "pull_request_sync_states",
+ "tableTo": "repositories",
+ "columnsFrom": ["repository_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.repositories": {
+ "name": "repositories",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "source_control_provider": {
+ "name": "source_control_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'github'"
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github_repo_id": {
+ "name": "github_repo_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_repo_id": {
+ "name": "external_repo_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "host": {
+ "name": "host",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "full_name": {
+ "name": "full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "private": {
+ "name": "private",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "default_branch": {
+ "name": "default_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'main'"
+ },
+ "clone_url": {
+ "name": "clone_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "html_url": {
+ "name": "html_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "linked_by_user_id": {
+ "name": "linked_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "repositories_source_control_provider_idx": {
+ "name": "repositories_source_control_provider_idx",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "repositories_installation_id_idx": {
+ "name": "repositories_installation_id_idx",
+ "columns": [
+ {
+ "expression": "installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "repositories_full_name_idx": {
+ "name": "repositories_full_name_idx",
+ "columns": [
+ {
+ "expression": "full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "repositories_provider_host_full_name_idx": {
+ "name": "repositories_provider_host_full_name_idx",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "host",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "repositories_deployment_active_installation_idx": {
+ "name": "repositories_deployment_active_installation_idx",
+ "columns": [
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "repositories_deployment_github_repo_unique": {
+ "name": "repositories_deployment_github_repo_unique",
+ "columns": [
+ {
+ "expression": "github_repo_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "repositories_provider_host_external_repo_unique": {
+ "name": "repositories_provider_host_external_repo_unique",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"host\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_repo_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "repositories_provider_host_full_name_unique": {
+ "name": "repositories_provider_host_full_name_unique",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"host\", '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "repositories_installation_id_github_installations_id_fk": {
+ "name": "repositories_installation_id_github_installations_id_fk",
+ "tableFrom": "repositories",
+ "tableTo": "github_installations",
+ "columnsFrom": ["installation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "repositories_user_id_users_id_fk": {
+ "name": "repositories_user_id_users_id_fk",
+ "tableFrom": "repositories",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "repositories_linked_by_user_id_users_id_fk": {
+ "name": "repositories_linked_by_user_id_users_id_fk",
+ "tableFrom": "repositories",
+ "tableTo": "users",
+ "columnsFrom": ["linked_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "repositories_source_control_provider_check": {
+ "name": "repositories_source_control_provider_check",
+ "value": "\"repositories\".\"source_control_provider\" in ('github', 'gitlab', 'gitea', 'ado', 'bitbucket')"
+ },
+ "repositories_github_shape_check": {
+ "name": "repositories_github_shape_check",
+ "value": "\"repositories\".\"source_control_provider\" != 'github' OR (\"repositories\".\"installation_id\" IS NOT NULL AND \"repositories\".\"github_repo_id\" IS NOT NULL)"
+ },
+ "repositories_gitlab_shape_check": {
+ "name": "repositories_gitlab_shape_check",
+ "value": "\"repositories\".\"source_control_provider\" != 'gitlab' OR \"repositories\".\"external_repo_id\" IS NOT NULL"
+ },
+ "repositories_gitea_shape_check": {
+ "name": "repositories_gitea_shape_check",
+ "value": "\"repositories\".\"source_control_provider\" != 'gitea' OR \"repositories\".\"external_repo_id\" IS NOT NULL"
+ },
+ "repositories_ado_shape_check": {
+ "name": "repositories_ado_shape_check",
+ "value": "\"repositories\".\"source_control_provider\" != 'ado' OR \"repositories\".\"external_repo_id\" IS NOT NULL"
+ },
+ "repositories_bitbucket_shape_check": {
+ "name": "repositories_bitbucket_shape_check",
+ "value": "\"repositories\".\"source_control_provider\" != 'bitbucket' OR \"repositories\".\"external_repo_id\" IS NOT NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.repository_automation_signals": {
+ "name": "repository_automation_signals",
+ "schema": "",
+ "columns": {
+ "repository_id": {
+ "name": "repository_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "signals_version": {
+ "name": "signals_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "collected_at": {
+ "name": "collected_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "partial": {
+ "name": "partial",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "repository_automation_signals_collected_idx": {
+ "name": "repository_automation_signals_collected_idx",
+ "columns": [
+ {
+ "expression": "collected_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "repository_automation_signals_repository_id_repositories_id_fk": {
+ "name": "repository_automation_signals_repository_id_repositories_id_fk",
+ "tableFrom": "repository_automation_signals",
+ "tableTo": "repositories",
+ "columnsFrom": ["repository_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "repository_automation_signals_repository_id_signals_version_pk": {
+ "name": "repository_automation_signals_repository_id_signals_version_pk",
+ "columns": ["repository_id", "signals_version"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sandbox_oidc_targets": {
+ "name": "sandbox_oidc_targets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "compute_provider": {
+ "name": "compute_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "compute_provider_id": {
+ "name": "compute_provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_kind": {
+ "name": "target_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "audience": {
+ "name": "audience",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_file": {
+ "name": "token_file",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "aws_role_arn": {
+ "name": "aws_role_arn",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aws_region": {
+ "name": "aws_region",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_at": {
+ "name": "refresh_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "sandbox_oidc_targets_environment_id_idx": {
+ "name": "sandbox_oidc_targets_environment_id_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sandbox_oidc_targets_run_id_idx": {
+ "name": "sandbox_oidc_targets_run_id_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sandbox_oidc_targets_refresh_at_idx": {
+ "name": "sandbox_oidc_targets_refresh_at_idx",
+ "columns": [
+ {
+ "expression": "refresh_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "sandbox_oidc_targets_provider_target_file_unique": {
+ "name": "sandbox_oidc_targets_provider_target_file_unique",
+ "columns": [
+ {
+ "expression": "compute_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "compute_provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "token_file",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "sandbox_oidc_targets_environment_id_environments_id_fk": {
+ "name": "sandbox_oidc_targets_environment_id_environments_id_fk",
+ "tableFrom": "sandbox_oidc_targets",
+ "tableTo": "environments",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sandbox_oidc_targets_run_id_task_runs_id_fk": {
+ "name": "sandbox_oidc_targets_run_id_task_runs_id_fk",
+ "tableFrom": "sandbox_oidc_targets",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "sandbox_oidc_targets_owner_required": {
+ "name": "sandbox_oidc_targets_owner_required",
+ "value": "run_id IS NOT NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.setup_qualification_blocks": {
+ "name": "setup_qualification_blocks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'blocked'"
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_domain": {
+ "name": "email_domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github_account_login": {
+ "name": "github_account_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github_account_type": {
+ "name": "github_account_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_blocked_at": {
+ "name": "first_blocked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_blocked_at": {
+ "name": "last_blocked_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lifted_by_admin_user_id": {
+ "name": "lifted_by_admin_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lifted_by_admin_email": {
+ "name": "lifted_by_admin_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "setup_qualification_blocks_deployment_user_reason_unique": {
+ "name": "setup_qualification_blocks_deployment_user_reason_unique",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "reason",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "setup_qualification_blocks_deployment_status_idx": {
+ "name": "setup_qualification_blocks_deployment_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "setup_qualification_blocks_user_status_idx": {
+ "name": "setup_qualification_blocks_user_status_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "setup_qualification_blocks_user_id_users_id_fk": {
+ "name": "setup_qualification_blocks_user_id_users_id_fk",
+ "tableFrom": "setup_qualification_blocks",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.slack_auth_tokens": {
+ "name": "slack_auth_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_user_id": {
+ "name": "slack_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_team_id": {
+ "name": "slack_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "thread_ts": {
+ "name": "thread_ts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_text": {
+ "name": "original_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "slack_auth_tokens_expires_at_idx": {
+ "name": "slack_auth_tokens_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "slack_auth_tokens_token_unique": {
+ "name": "slack_auth_tokens_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.slack_conversation_messages": {
+ "name": "slack_conversation_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "subject_user_id": {
+ "name": "subject_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_team_id": {
+ "name": "slack_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_slack_user_id": {
+ "name": "subject_slack_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sender_user_id": {
+ "name": "sender_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sender_slack_user_id": {
+ "name": "sender_slack_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_channel_id": {
+ "name": "slack_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_kind": {
+ "name": "conversation_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "thread_ts": {
+ "name": "thread_ts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_ts": {
+ "name": "message_ts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message_at": {
+ "name": "message_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "direction": {
+ "name": "direction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "author_kind": {
+ "name": "author_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "slack_conversation_messages_deployment_user_message_at_idx": {
+ "name": "slack_conversation_messages_deployment_user_message_at_idx",
+ "columns": [
+ {
+ "expression": "subject_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "message_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_conversation_messages_deployment_user_thread_idx": {
+ "name": "slack_conversation_messages_deployment_user_thread_idx",
+ "columns": [
+ {
+ "expression": "subject_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slack_channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "thread_ts",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "message_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_conversation_messages_task_id_idx": {
+ "name": "slack_conversation_messages_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_conversation_messages_run_id_idx": {
+ "name": "slack_conversation_messages_run_id_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_conversation_messages_team_channel_message_unique": {
+ "name": "slack_conversation_messages_team_channel_message_unique",
+ "columns": [
+ {
+ "expression": "slack_team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slack_channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "message_ts",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "slack_conversation_messages_subject_user_id_users_id_fk": {
+ "name": "slack_conversation_messages_subject_user_id_users_id_fk",
+ "tableFrom": "slack_conversation_messages",
+ "tableTo": "users",
+ "columnsFrom": ["subject_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "slack_conversation_messages_sender_user_id_users_id_fk": {
+ "name": "slack_conversation_messages_sender_user_id_users_id_fk",
+ "tableFrom": "slack_conversation_messages",
+ "tableTo": "users",
+ "columnsFrom": ["sender_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "slack_conversation_messages_task_id_tasks_id_fk": {
+ "name": "slack_conversation_messages_task_id_tasks_id_fk",
+ "tableFrom": "slack_conversation_messages",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "slack_conversation_messages_run_id_task_runs_id_fk": {
+ "name": "slack_conversation_messages_run_id_task_runs_id_fk",
+ "tableFrom": "slack_conversation_messages",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.slack_directory_users": {
+ "name": "slack_directory_users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "slack_user_id": {
+ "name": "slack_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_team_id": {
+ "name": "slack_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "real_name": {
+ "name": "real_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_deleted": {
+ "name": "is_deleted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_bot": {
+ "name": "is_bot",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_app_user": {
+ "name": "is_app_user",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "profile_updated_at": {
+ "name": "profile_updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "slack_directory_users_team_id_idx": {
+ "name": "slack_directory_users_team_id_idx",
+ "columns": [
+ {
+ "expression": "slack_team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "slack_directory_users_unique": {
+ "name": "slack_directory_users_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slack_user_id", "slack_team_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.slack_fast_integration_calls": {
+ "name": "slack_fast_integration_calls",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "fast_agent_conversation_id": {
+ "name": "fast_agent_conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_team_id": {
+ "name": "slack_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_channel": {
+ "name": "slack_channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_thread_ts": {
+ "name": "slack_thread_ts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_message_ts": {
+ "name": "slack_message_ts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "arguments": {
+ "name": "arguments",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "result_preview": {
+ "name": "result_preview",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "slack_fast_integration_calls_conversation_idx": {
+ "name": "slack_fast_integration_calls_conversation_idx",
+ "columns": [
+ {
+ "expression": "fast_agent_conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_fast_integration_calls_user_idx": {
+ "name": "slack_fast_integration_calls_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_fast_integration_calls_status_idx": {
+ "name": "slack_fast_integration_calls_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "slack_fast_integration_calls_fast_agent_conversation_id_fast_agent_conversations_id_fk": {
+ "name": "slack_fast_integration_calls_fast_agent_conversation_id_fast_agent_conversations_id_fk",
+ "tableFrom": "slack_fast_integration_calls",
+ "tableTo": "fast_agent_conversations",
+ "columnsFrom": ["fast_agent_conversation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "slack_fast_integration_calls_user_id_users_id_fk": {
+ "name": "slack_fast_integration_calls_user_id_users_id_fk",
+ "tableFrom": "slack_fast_integration_calls",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.slack_installation_channels": {
+ "name": "slack_installation_channels",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "slack_installation_id": {
+ "name": "slack_installation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel_id": {
+ "name": "channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "slack_installation_channels_installation_id_idx": {
+ "name": "slack_installation_channels_installation_id_idx",
+ "columns": [
+ {
+ "expression": "slack_installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "slack_installation_channels_slack_installation_id_slack_installations_id_fk": {
+ "name": "slack_installation_channels_slack_installation_id_slack_installations_id_fk",
+ "tableFrom": "slack_installation_channels",
+ "tableTo": "slack_installations",
+ "columnsFrom": ["slack_installation_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "slack_installation_channels_unique": {
+ "name": "slack_installation_channels_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slack_installation_id", "channel_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.slack_installations": {
+ "name": "slack_installations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_name": {
+ "name": "team_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_domain": {
+ "name": "team_domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enterprise_id": {
+ "name": "enterprise_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enterprise_name": {
+ "name": "enterprise_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "app_id": {
+ "name": "app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bot_user_id": {
+ "name": "bot_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bot_name": {
+ "name": "bot_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "app_name": {
+ "name": "app_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bot_access_token": {
+ "name": "bot_access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_access_token": {
+ "name": "user_access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'bot'"
+ },
+ "installed_by_user_id": {
+ "name": "installed_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "member_count_snapshot": {
+ "name": "member_count_snapshot",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "member_count_snapshot_at": {
+ "name": "member_count_snapshot_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "slack_installations_bot_user_id_idx": {
+ "name": "slack_installations_bot_user_id_idx",
+ "columns": [
+ {
+ "expression": "bot_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "slack_installations_active_idx": {
+ "name": "slack_installations_active_idx",
+ "columns": [
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "slack_installations_installed_by_user_id_users_id_fk": {
+ "name": "slack_installations_installed_by_user_id_users_id_fk",
+ "tableFrom": "slack_installations",
+ "tableTo": "users",
+ "columnsFrom": ["installed_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "slack_installations_team_id_unique": {
+ "name": "slack_installations_team_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["team_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.slack_user_mappings": {
+ "name": "slack_user_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "slack_user_id": {
+ "name": "slack_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_team_id": {
+ "name": "slack_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "slack_user_mappings_user_id_idx": {
+ "name": "slack_user_mappings_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "slack_user_mappings_user_id_users_id_fk": {
+ "name": "slack_user_mappings_user_id_users_id_fk",
+ "tableFrom": "slack_user_mappings",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "slack_user_mappings_unique": {
+ "name": "slack_user_mappings_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slack_user_id", "slack_team_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.source_control_user_mappings": {
+ "name": "source_control_user_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "auth_account_id": {
+ "name": "auth_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_control_provider": {
+ "name": "source_control_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "host": {
+ "name": "host",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_account_id": {
+ "name": "external_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "source_control_user_mappings_auth_account_unique": {
+ "name": "source_control_user_mappings_auth_account_unique",
+ "columns": [
+ {
+ "expression": "auth_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "source_control_user_mappings_user_provider_host_idx": {
+ "name": "source_control_user_mappings_user_provider_host_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "host",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "source_control_user_mappings_provider_identity_unique": {
+ "name": "source_control_user_mappings_provider_identity_unique",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "host",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "source_control_user_mappings_auth_account_id_auth_accounts_id_fk": {
+ "name": "source_control_user_mappings_auth_account_id_auth_accounts_id_fk",
+ "tableFrom": "source_control_user_mappings",
+ "tableTo": "auth_accounts",
+ "columnsFrom": ["auth_account_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "source_control_user_mappings_user_id_auth_users_id_fk": {
+ "name": "source_control_user_mappings_user_id_auth_users_id_fk",
+ "tableFrom": "source_control_user_mappings",
+ "tableTo": "auth_users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_artifacts": {
+ "name": "task_artifacts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "artifact_type": {
+ "name": "artifact_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'general'"
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "size": {
+ "name": "size",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploaded": {
+ "name": "uploaded",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_artifacts_task_id_idx": {
+ "name": "task_artifacts_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_artifacts_run_id_idx": {
+ "name": "task_artifacts_run_id_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_artifacts_uploaded_idx": {
+ "name": "task_artifacts_uploaded_idx",
+ "columns": [
+ {
+ "expression": "uploaded",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_artifacts_created_at_idx": {
+ "name": "task_artifacts_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_artifacts_path_idx": {
+ "name": "task_artifacts_path_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "path",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_artifacts_task_id_tasks_id_fk": {
+ "name": "task_artifacts_task_id_tasks_id_fk",
+ "tableFrom": "task_artifacts",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_artifacts_run_id_task_runs_id_fk": {
+ "name": "task_artifacts_run_id_task_runs_id_fk",
+ "tableFrom": "task_artifacts",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "task_artifacts_task_id_path_version_unique": {
+ "name": "task_artifacts_task_id_path_version_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "path", "version"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_messages": {
+ "name": "task_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ts": {
+ "name": "ts",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "protocol": {
+ "name": "protocol",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_blocks": {
+ "name": "content_blocks",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_messages_task_id_ts_idx": {
+ "name": "task_messages_task_id_ts_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "ts",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_messages_run_id_idx": {
+ "name": "task_messages_run_id_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_messages_created_at_idx": {
+ "name": "task_messages_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_messages_run_id_task_runs_id_fk": {
+ "name": "task_messages_run_id_task_runs_id_fk",
+ "tableFrom": "task_messages",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_messages_task_id_tasks_id_fk": {
+ "name": "task_messages_task_id_tasks_id_fk",
+ "tableFrom": "task_messages",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_messages_user_id_users_id_fk": {
+ "name": "task_messages_user_id_users_id_fk",
+ "tableFrom": "task_messages",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "task_messages_task_protocol_ts_event_type_unique": {
+ "name": "task_messages_task_protocol_ts_event_type_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "protocol", "ts", "event_type"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_pins": {
+ "name": "task_pins",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_pins_deployment_user_task_unique": {
+ "name": "task_pins_deployment_user_task_unique",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_pins_deployment_user_updated_at_idx": {
+ "name": "task_pins_deployment_user_updated_at_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_pins_task_id_idx": {
+ "name": "task_pins_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_pins_task_id_tasks_id_fk": {
+ "name": "task_pins_task_id_tasks_id_fk",
+ "tableFrom": "task_pins",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_pins_user_id_users_id_fk": {
+ "name": "task_pins_user_id_users_id_fk",
+ "tableFrom": "task_pins",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_platform_issue_reports": {
+ "name": "task_platform_issue_reports",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_message_id": {
+ "name": "task_message_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "report": {
+ "name": "report",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_posted_at": {
+ "name": "slack_posted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_platform_issue_reports_created_at_idx": {
+ "name": "task_platform_issue_reports_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_platform_issue_reports_task_id_created_at_idx": {
+ "name": "task_platform_issue_reports_task_id_created_at_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_platform_issue_reports_run_id_created_at_idx": {
+ "name": "task_platform_issue_reports_run_id_created_at_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_platform_issue_reports_task_message_id_unique": {
+ "name": "task_platform_issue_reports_task_message_id_unique",
+ "columns": [
+ {
+ "expression": "task_message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_platform_issue_reports_task_id_tasks_id_fk": {
+ "name": "task_platform_issue_reports_task_id_tasks_id_fk",
+ "tableFrom": "task_platform_issue_reports",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_platform_issue_reports_run_id_task_runs_id_fk": {
+ "name": "task_platform_issue_reports_run_id_task_runs_id_fk",
+ "tableFrom": "task_platform_issue_reports",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_platform_issue_reports_task_message_id_task_messages_id_fk": {
+ "name": "task_platform_issue_reports_task_message_id_task_messages_id_fk",
+ "tableFrom": "task_platform_issue_reports",
+ "tableTo": "task_messages",
+ "columnsFrom": ["task_message_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_pull_requests": {
+ "name": "task_pull_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_control_provider": {
+ "name": "source_control_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'github'"
+ },
+ "host": {
+ "name": "host",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_id": {
+ "name": "repository_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_url": {
+ "name": "pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_title": {
+ "name": "pr_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_sha": {
+ "name": "pr_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_base_ref": {
+ "name": "pr_base_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_base_sha": {
+ "name": "pr_base_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github_reaction_id": {
+ "name": "github_reaction_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github_check_run_id": {
+ "name": "github_check_run_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github_review_comment_id": {
+ "name": "github_review_comment_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_roomote": {
+ "name": "created_by_roomote",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mergeability_status": {
+ "name": "mergeability_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "conflict_detected_at": {
+ "name": "conflict_detected_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conflict_notification_claimed_at": {
+ "name": "conflict_notification_claimed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conflict_notified_at": {
+ "name": "conflict_notified_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_handle_feedback_by_user_id": {
+ "name": "auto_handle_feedback_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "detected_at": {
+ "name": "detected_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_pull_requests_task_id_idx": {
+ "name": "task_pull_requests_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_pull_requests_repository_id_idx": {
+ "name": "task_pull_requests_repository_id_idx",
+ "columns": [
+ {
+ "expression": "repository_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_pull_requests_provider_repository_pr_number_idx": {
+ "name": "task_pull_requests_provider_repository_pr_number_idx",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_pull_requests_mergeability_lookup_idx": {
+ "name": "task_pull_requests_mergeability_lookup_idx",
+ "columns": [
+ {
+ "expression": "source_control_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_by_roomote",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_base_ref",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_pull_requests_task_id_tasks_id_fk": {
+ "name": "task_pull_requests_task_id_tasks_id_fk",
+ "tableFrom": "task_pull_requests",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_pull_requests_repository_id_repositories_id_fk": {
+ "name": "task_pull_requests_repository_id_repositories_id_fk",
+ "tableFrom": "task_pull_requests",
+ "tableTo": "repositories",
+ "columnsFrom": ["repository_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "task_pull_requests_auto_handle_feedback_by_user_id_users_id_fk": {
+ "name": "task_pull_requests_auto_handle_feedback_by_user_id_users_id_fk",
+ "tableFrom": "task_pull_requests",
+ "tableTo": "users",
+ "columnsFrom": ["auto_handle_feedback_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "task_pull_requests_task_pr_unique": {
+ "name": "task_pull_requests_task_pr_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "pr_url"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "task_pull_requests_source_control_provider_check": {
+ "name": "task_pull_requests_source_control_provider_check",
+ "value": "\"task_pull_requests\".\"source_control_provider\" in ('github', 'gitlab', 'gitea', 'ado', 'bitbucket')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.task_run_events": {
+ "name": "task_run_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "details": {
+ "name": "details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_run_events_run_id_created_at_idx": {
+ "name": "task_run_events_run_id_created_at_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_run_events_task_id_created_at_idx": {
+ "name": "task_run_events_task_id_created_at_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_run_events_created_at_idx": {
+ "name": "task_run_events_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_run_events_source_created_at_idx": {
+ "name": "task_run_events_source_created_at_idx",
+ "columns": [
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_run_events_run_id_task_runs_id_fk": {
+ "name": "task_run_events_run_id_task_runs_id_fk",
+ "tableFrom": "task_run_events",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_run_events_task_id_tasks_id_fk": {
+ "name": "task_run_events_task_id_tasks_id_fk",
+ "tableFrom": "task_run_events",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_runs": {
+ "name": "task_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "task_runs_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'fresh'"
+ },
+ "source_run_id": {
+ "name": "source_run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acting_user_id": {
+ "name": "acting_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload_kind": {
+ "name": "payload_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "harness": {
+ "name": "harness",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'opencode-server'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "queue_scope": {
+ "name": "queue_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "task_phase": {
+ "name": "task_phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "fast_agent_session_id": {
+ "name": "fast_agent_session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false,
+ "generated": {
+ "as": "((payload ->> 'fastAgentSessionId')::uuid)",
+ "type": "stored"
+ }
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log": {
+ "name": "log",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "artifacts": {
+ "name": "artifacts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result": {
+ "name": "result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "machine_id": {
+ "name": "machine_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sandbox_cmd_id": {
+ "name": "sandbox_cmd_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "machine_domain": {
+ "name": "machine_domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "machine_domains": {
+ "name": "machine_domains",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initial_paths": {
+ "name": "initial_paths",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "primary_port_name": {
+ "name": "primary_port_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sandbox_server_url": {
+ "name": "sandbox_server_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proxy_ports": {
+ "name": "proxy_ports",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "worker_release_tag": {
+ "name": "worker_release_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "worker_version": {
+ "name": "worker_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "worker_commit": {
+ "name": "worker_commit",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor": {
+ "name": "vendor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "port": {
+ "name": "port",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "configured_vcpus": {
+ "name": "configured_vcpus",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "configured_cpu_cores": {
+ "name": "configured_cpu_cores",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "configured_memory_mib": {
+ "name": "configured_memory_mib",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_id": {
+ "name": "snapshot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_requested_at": {
+ "name": "snapshot_requested_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_created_at": {
+ "name": "snapshot_created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot_failed_at": {
+ "name": "snapshot_failed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "keepalive_ms": {
+ "name": "keepalive_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sleep_at": {
+ "name": "sleep_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sleep_requested_at": {
+ "name": "sleep_requested_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "worker_heartbeat_at": {
+ "name": "worker_heartbeat_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_snapshot_id": {
+ "name": "source_snapshot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_bypass_value": {
+ "name": "auth_bypass_value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_bypass_header_name": {
+ "name": "auth_bypass_header_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "dequeued_at": {
+ "name": "dequeued_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provision_started_at": {
+ "name": "provision_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provision_ready_at": {
+ "name": "provision_ready_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "setup_completed_at": {
+ "name": "setup_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "environment_setup_state": {
+ "name": "environment_setup_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "environment_setup_completed_at": {
+ "name": "environment_setup_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "harness_started_at": {
+ "name": "harness_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_task_started_at": {
+ "name": "runtime_task_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_assistant_output_at": {
+ "name": "first_assistant_output_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancel_requested_at": {
+ "name": "cancel_requested_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canceled_at": {
+ "name": "canceled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "launch_mode": {
+ "name": "launch_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "task_runs_task_id_idx": {
+ "name": "task_runs_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_fast_agent_session_id_idx": {
+ "name": "task_runs_fast_agent_session_id_idx",
+ "columns": [
+ {
+ "expression": "fast_agent_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_queue_scope_idx": {
+ "name": "task_runs_queue_scope_idx",
+ "columns": [
+ {
+ "expression": "queue_scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_acting_user_id_idx": {
+ "name": "task_runs_acting_user_id_idx",
+ "columns": [
+ {
+ "expression": "acting_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_snapshot_id_idx": {
+ "name": "task_runs_snapshot_id_idx",
+ "columns": [
+ {
+ "expression": "snapshot_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_sleep_at_idx": {
+ "name": "task_runs_sleep_at_idx",
+ "columns": [
+ {
+ "expression": "sleep_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_worker_heartbeat_at_idx": {
+ "name": "task_runs_worker_heartbeat_at_idx",
+ "columns": [
+ {
+ "expression": "worker_heartbeat_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_sleep_check_due_v2_idx": {
+ "name": "task_runs_sleep_check_due_v2_idx",
+ "columns": [
+ {
+ "expression": "sleep_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "vendor",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"task_runs\".\"status\" IN ('running', 'idle') AND \"task_runs\".\"machine_id\" IS NOT NULL AND \"task_runs\".\"sleep_at\" IS NOT NULL AND \"task_runs\".\"sleep_requested_at\" IS NULL AND \"task_runs\".\"snapshot_id\" IS NULL AND \"task_runs\".\"snapshot_requested_at\" IS NULL AND \"task_runs\".\"vendor\" IN ('modal', 'daytona', 'e2b', 'docker', 'blaxel', 'box', 'roomote', 'azure')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_sleep_check_stale_worker_v2_idx": {
+ "name": "task_runs_sleep_check_stale_worker_v2_idx",
+ "columns": [
+ {
+ "expression": "worker_heartbeat_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "vendor",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"task_runs\".\"status\" IN ('running', 'idle') AND \"task_runs\".\"machine_id\" IS NOT NULL AND \"task_runs\".\"worker_heartbeat_at\" IS NOT NULL AND \"task_runs\".\"sleep_requested_at\" IS NULL AND \"task_runs\".\"snapshot_id\" IS NULL AND \"task_runs\".\"snapshot_requested_at\" IS NULL AND \"task_runs\".\"vendor\" IN ('modal', 'daytona', 'e2b', 'docker', 'blaxel', 'box', 'roomote', 'azure')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_sleep_check_active_v2_idx": {
+ "name": "task_runs_sleep_check_active_v2_idx",
+ "columns": [
+ {
+ "expression": "vendor",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"task_runs\".\"status\" IN ('running', 'idle') AND \"task_runs\".\"machine_id\" IS NOT NULL AND \"task_runs\".\"sleep_requested_at\" IS NULL AND \"task_runs\".\"snapshot_id\" IS NULL AND \"task_runs\".\"snapshot_requested_at\" IS NULL AND \"task_runs\".\"vendor\" IN ('modal', 'daytona', 'e2b', 'docker', 'blaxel', 'box', 'roomote', 'azure')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_source_snapshot_id_idx": {
+ "name": "task_runs_source_snapshot_id_idx",
+ "columns": [
+ {
+ "expression": "source_snapshot_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_source_run_id_idx": {
+ "name": "task_runs_source_run_id_idx",
+ "columns": [
+ {
+ "expression": "source_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_discord_source_event_unique": {
+ "name": "task_runs_discord_source_event_unique",
+ "columns": [
+ {
+ "expression": "(\"payload\"->>'communicationSourceEventId')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"task_runs\".\"payload\"->>'communicationProvider' = 'discord' AND \"task_runs\".\"payload\"->>'communicationSourceEventId' IS NOT NULL AND \"task_runs\".\"canceled_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_launch_idempotency_key_unique": {
+ "name": "task_runs_launch_idempotency_key_unique",
+ "columns": [
+ {
+ "expression": "(\"payload\"->>'launchIdempotencyKey')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"task_runs\".\"payload\"->>'launchIdempotencyKey' IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_runs_first_assistant_output_at_idx": {
+ "name": "task_runs_first_assistant_output_at_idx",
+ "columns": [
+ {
+ "expression": "first_assistant_output_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_runs_task_id_tasks_id_fk": {
+ "name": "task_runs_task_id_tasks_id_fk",
+ "tableFrom": "task_runs",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_runs_source_run_id_task_runs_id_fk": {
+ "name": "task_runs_source_run_id_task_runs_id_fk",
+ "tableFrom": "task_runs",
+ "tableTo": "task_runs",
+ "columnsFrom": ["source_run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "task_runs_acting_user_id_users_id_fk": {
+ "name": "task_runs_acting_user_id_users_id_fk",
+ "tableFrom": "task_runs",
+ "tableTo": "users",
+ "columnsFrom": ["acting_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "task_runs_kind_check": {
+ "name": "task_runs_kind_check",
+ "value": "\"task_runs\".\"kind\" in ('fresh', 'resume')"
+ },
+ "task_runs_harness_check": {
+ "name": "task_runs_harness_check",
+ "value": "\"task_runs\".\"harness\" in ('opencode-server')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.task_slack_reply_details": {
+ "name": "task_slack_reply_details",
+ "schema": "",
+ "columns": {
+ "detail_id": {
+ "name": "detail_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "findings": {
+ "name": "findings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_slack_reply_details_task_id_idx": {
+ "name": "task_slack_reply_details_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_slack_reply_details_deployment_task_detail_unique": {
+ "name": "task_slack_reply_details_deployment_task_detail_unique",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "detail_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_slack_reply_details_task_id_tasks_id_fk": {
+ "name": "task_slack_reply_details_task_id_tasks_id_fk",
+ "tableFrom": "task_slack_reply_details",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_start_parallel_counts": {
+ "name": "task_start_parallel_counts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload_kind": {
+ "name": "payload_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parallel_count": {
+ "name": "parallel_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "activity_window_seconds": {
+ "name": "activity_window_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_start_parallel_counts_run_id_unique": {
+ "name": "task_start_parallel_counts_run_id_unique",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_start_parallel_counts_task_id_started_at_idx": {
+ "name": "task_start_parallel_counts_task_id_started_at_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_start_parallel_counts_started_at_idx": {
+ "name": "task_start_parallel_counts_started_at_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_start_parallel_counts_task_id_tasks_id_fk": {
+ "name": "task_start_parallel_counts_task_id_tasks_id_fk",
+ "tableFrom": "task_start_parallel_counts",
+ "tableTo": "tasks",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "task_start_parallel_counts_run_id_task_runs_id_fk": {
+ "name": "task_start_parallel_counts_run_id_task_runs_id_fk",
+ "tableFrom": "task_start_parallel_counts",
+ "tableTo": "task_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tasks": {
+ "name": "tasks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workflow": {
+ "name": "workflow",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "surface": {
+ "name": "surface",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'visible'"
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "initiator_kind": {
+ "name": "initiator_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "initiator_user_id": {
+ "name": "initiator_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiator_automation": {
+ "name": "initiator_automation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_external_id": {
+ "name": "actor_external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_display_name": {
+ "name": "actor_display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commit_author_kind": {
+ "name": "commit_author_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commit_author_user_id": {
+ "name": "commit_author_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commit_author_login": {
+ "name": "commit_author_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commit_author_external_id": {
+ "name": "commit_author_external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_assignee_login": {
+ "name": "pr_assignee_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_channel_id": {
+ "name": "slack_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_thread_ts": {
+ "name": "slack_thread_ts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linear_session_id": {
+ "name": "linear_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linear_issue_id": {
+ "name": "linear_issue_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linear_organization_id": {
+ "name": "linear_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "harness": {
+ "name": "harness",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'opencode-server'"
+ },
+ "harness_session_id": {
+ "name": "harness_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model_provider": {
+ "name": "model_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title_edited_by_user_at": {
+ "name": "title_edited_by_user_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "llm_title_checkpoint": {
+ "name": "llm_title_checkpoint",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_objective": {
+ "name": "goal_objective",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_status": {
+ "name": "goal_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_max_continuations": {
+ "name": "goal_max_continuations",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_continuations_used": {
+ "name": "goal_continuations_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "goal_blocked_reason": {
+ "name": "goal_blocked_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_completed_at": {
+ "name": "goal_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_last_continuation_id": {
+ "name": "goal_last_continuation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_continuation_ids": {
+ "name": "goal_continuation_ids",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::text[]"
+ },
+ "goal_generation_ids": {
+ "name": "goal_generation_ids",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::text[]"
+ },
+ "goal_blocker_candidate_reason": {
+ "name": "goal_blocker_candidate_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_blocker_candidate_count": {
+ "name": "goal_blocker_candidate_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "goal_blocker_last_continuation_used": {
+ "name": "goal_blocker_last_continuation_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "draft_prompt": {
+ "name": "draft_prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_work_kind": {
+ "name": "requested_work_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "requested_work_kind_source": {
+ "name": "requested_work_kind_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system_default'"
+ },
+ "requested_work_kind_confidence": {
+ "name": "requested_work_kind_confidence",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "harness_instructions": {
+ "name": "harness_instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "compute_duration_ms": {
+ "name": "compute_duration_ms",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "activity_at": {
+ "name": "activity_at",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_url": {
+ "name": "repository_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_name": {
+ "name": "repository_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "default_branch": {
+ "name": "default_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tasks_initiator_user_id_idx": {
+ "name": "tasks_initiator_user_id_idx",
+ "columns": [
+ {
+ "expression": "initiator_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tasks_initiator_automation_idx": {
+ "name": "tasks_initiator_automation_idx",
+ "columns": [
+ {
+ "expression": "initiator_automation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tasks_workflow_idx": {
+ "name": "tasks_workflow_idx",
+ "columns": [
+ {
+ "expression": "workflow",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tasks_visibility_activity_at_idx": {
+ "name": "tasks_visibility_activity_at_idx",
+ "columns": [
+ {
+ "expression": "visibility",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "activity_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tasks_harness_session_id_idx": {
+ "name": "tasks_harness_session_id_idx",
+ "columns": [
+ {
+ "expression": "harness_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tasks_timestamp_idx": {
+ "name": "tasks_timestamp_idx",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tasks_deployment_activity_at_idx": {
+ "name": "tasks_deployment_activity_at_idx",
+ "columns": [
+ {
+ "expression": "activity_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tasks_created_at_idx": {
+ "name": "tasks_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "tasks_initiator_user_id_users_id_fk": {
+ "name": "tasks_initiator_user_id_users_id_fk",
+ "tableFrom": "tasks",
+ "tableTo": "users",
+ "columnsFrom": ["initiator_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "tasks_initiator_automation_automations_key_fk": {
+ "name": "tasks_initiator_automation_automations_key_fk",
+ "tableFrom": "tasks",
+ "tableTo": "automations",
+ "columnsFrom": ["initiator_automation"],
+ "columnsTo": ["key"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "tasks_commit_author_user_id_users_id_fk": {
+ "name": "tasks_commit_author_user_id_users_id_fk",
+ "tableFrom": "tasks",
+ "tableTo": "users",
+ "columnsFrom": ["commit_author_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "tasks_initiator_shape_check": {
+ "name": "tasks_initiator_shape_check",
+ "value": "(\"tasks\".\"initiator_kind\" = 'user' AND \"tasks\".\"initiator_automation\" IS NULL AND (\"tasks\".\"initiator_user_id\" IS NOT NULL OR \"tasks\".\"actor_external_id\" IS NOT NULL)) OR (\"tasks\".\"initiator_kind\" = 'automation' AND \"tasks\".\"initiator_automation\" IS NOT NULL AND \"tasks\".\"initiator_user_id\" IS NULL)"
+ },
+ "tasks_workflow_check": {
+ "name": "tasks_workflow_check",
+ "value": "\"tasks\".\"workflow\" in ('standard', 'pr_review', 'pr_conflict_resolve', 'scan', 'mcp_recommendations', 'setup_onboarding', 'env_snapshot', 'eval')"
+ },
+ "tasks_surface_check": {
+ "name": "tasks_surface_check",
+ "value": "\"tasks\".\"surface\" in ('web', 'api', 'slack', 'teams', 'telegram', 'discord', 'linear', 'github', 'gitlab', 'gitea', 'ado', 'bitbucket', 'system')"
+ },
+ "tasks_trigger_check": {
+ "name": "tasks_trigger_check",
+ "value": "\"tasks\".\"trigger\" in ('message', 'webhook', 'schedule', 'manual')"
+ },
+ "tasks_visibility_check": {
+ "name": "tasks_visibility_check",
+ "value": "\"tasks\".\"visibility\" in ('visible', 'hidden')"
+ },
+ "tasks_state_check": {
+ "name": "tasks_state_check",
+ "value": "\"tasks\".\"state\" in ('active', 'completed', 'failed', 'canceled')"
+ },
+ "tasks_goal_status_check": {
+ "name": "tasks_goal_status_check",
+ "value": "\"tasks\".\"goal_status\" IS NULL OR \"tasks\".\"goal_status\" in ('active', 'complete', 'blocked', 'budget_limited')"
+ },
+ "tasks_goal_continuations_check": {
+ "name": "tasks_goal_continuations_check",
+ "value": "\"tasks\".\"goal_continuations_used\" >= 0 AND (\"tasks\".\"goal_max_continuations\" IS NULL OR \"tasks\".\"goal_max_continuations\" > 0)"
+ },
+ "tasks_goal_blocker_candidate_count_check": {
+ "name": "tasks_goal_blocker_candidate_count_check",
+ "value": "\"tasks\".\"goal_blocker_candidate_count\" >= 0"
+ },
+ "tasks_harness_check": {
+ "name": "tasks_harness_check",
+ "value": "\"tasks\".\"harness\" in ('opencode-server')"
+ },
+ "tasks_requested_work_kind_check": {
+ "name": "tasks_requested_work_kind_check",
+ "value": "\"tasks\".\"requested_work_kind\" in ('question', 'plan', 'implement', 'unknown')"
+ },
+ "tasks_requested_work_kind_source_check": {
+ "name": "tasks_requested_work_kind_source_check",
+ "value": "\"tasks\".\"requested_work_kind_source\" in ('explicit_bootstrap', 'task_tool', 'llm_classifier', 'inherited', 'system_default')"
+ },
+ "tasks_commit_author_kind_check": {
+ "name": "tasks_commit_author_kind_check",
+ "value": "\"tasks\".\"commit_author_kind\" IS NULL OR \"tasks\".\"commit_author_kind\" in ('roomote', 'user', 'external')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.teams_installations": {
+ "name": "teams_installations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "installation_key": {
+ "name": "installation_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tenant_id": {
+ "name": "tenant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_name": {
+ "name": "team_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "channel_id": {
+ "name": "channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "channel_name": {
+ "name": "channel_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_type": {
+ "name": "conversation_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bot_app_id": {
+ "name": "bot_app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bot_user_id": {
+ "name": "bot_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bot_name": {
+ "name": "bot_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "service_url": {
+ "name": "service_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "last_activity_at": {
+ "name": "last_activity_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "teams_installations_tenant_id_idx": {
+ "name": "teams_installations_tenant_id_idx",
+ "columns": [
+ {
+ "expression": "tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "teams_installations_team_id_idx": {
+ "name": "teams_installations_team_id_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "teams_installations_conversation_id_idx": {
+ "name": "teams_installations_conversation_id_idx",
+ "columns": [
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "teams_installations_active_idx": {
+ "name": "teams_installations_active_idx",
+ "columns": [
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "teams_installations_installation_key_unique": {
+ "name": "teams_installations_installation_key_unique",
+ "nullsNotDistinct": false,
+ "columns": ["installation_key"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.teams_user_mappings": {
+ "name": "teams_user_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "teams_user_id": {
+ "name": "teams_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "teams_tenant_id": {
+ "name": "teams_tenant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "teams_aad_object_id": {
+ "name": "teams_aad_object_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "teams_user_mappings_aad_object_idx": {
+ "name": "teams_user_mappings_aad_object_idx",
+ "columns": [
+ {
+ "expression": "teams_aad_object_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "teams_tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "teams_user_mappings_user_id_idx": {
+ "name": "teams_user_mappings_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "teams_user_mappings_user_id_users_id_fk": {
+ "name": "teams_user_mappings_user_id_users_id_fk",
+ "tableFrom": "teams_user_mappings",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "teams_user_mappings_unique": {
+ "name": "teams_user_mappings_unique",
+ "nullsNotDistinct": false,
+ "columns": ["teams_user_id", "teams_tenant_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.telegram_user_mappings": {
+ "name": "telegram_user_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "telegram_user_id": {
+ "name": "telegram_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "telegram_chat_id": {
+ "name": "telegram_chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "telegram_username": {
+ "name": "telegram_username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "telegram_user_mappings_user_id_idx": {
+ "name": "telegram_user_mappings_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "telegram_user_mappings_user_id_users_id_fk": {
+ "name": "telegram_user_mappings_user_id_users_id_fk",
+ "tableFrom": "telegram_user_mappings",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "telegram_user_mappings_unique": {
+ "name": "telegram_user_mappings_unique",
+ "nullsNotDistinct": false,
+ "columns": ["telegram_user_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tracked_messages": {
+ "name": "tracked_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "surface": {
+ "name": "surface",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dedupe_key": {
+ "name": "dedupe_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel_id": {
+ "name": "channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message_ts": {
+ "name": "message_ts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "thread_ts": {
+ "name": "thread_ts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "work_item_id": {
+ "name": "work_item_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "automation_key": {
+ "name": "automation_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "summary_text": {
+ "name": "summary_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "posted_at": {
+ "name": "posted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "dismissed_at": {
+ "name": "dismissed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tracked_messages_kind_dedupe_key_unique": {
+ "name": "tracked_messages_kind_dedupe_key_unique",
+ "columns": [
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "dedupe_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tracked_messages_work_item_id_idx": {
+ "name": "tracked_messages_work_item_id_idx",
+ "columns": [
+ {
+ "expression": "work_item_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tracked_messages_channel_message_idx": {
+ "name": "tracked_messages_channel_message_idx",
+ "columns": [
+ {
+ "expression": "channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "message_ts",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "tracked_messages_automation_channel_posted_idx": {
+ "name": "tracked_messages_automation_channel_posted_idx",
+ "columns": [
+ {
+ "expression": "automation_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "posted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "tracked_messages_work_item_id_work_items_id_fk": {
+ "name": "tracked_messages_work_item_id_work_items_id_fk",
+ "tableFrom": "tracked_messages",
+ "tableTo": "work_items",
+ "columnsFrom": ["work_item_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "tracked_messages_automation_key_automations_key_fk": {
+ "name": "tracked_messages_automation_key_automations_key_fk",
+ "tableFrom": "tracked_messages",
+ "tableTo": "automations",
+ "columnsFrom": ["automation_key"],
+ "columnsTo": ["key"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "tracked_messages_created_by_user_id_users_id_fk": {
+ "name": "tracked_messages_created_by_user_id_users_id_fk",
+ "tableFrom": "tracked_messages",
+ "tableTo": "users",
+ "columnsFrom": ["created_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_api_keys": {
+ "name": "user_api_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "api_key": {
+ "name": "api_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_api_keys_user_id_idx": {
+ "name": "user_api_keys_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_api_keys_user_deployment_provider_unique": {
+ "name": "user_api_keys_user_deployment_provider_unique",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_api_keys_user_id_users_id_fk": {
+ "name": "user_api_keys_user_id_users_id_fk",
+ "tableFrom": "user_api_keys",
+ "tableTo": "users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.users": {
+ "name": "users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image_url": {
+ "name": "image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity": {
+ "name": "entity",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "analytics_id": {
+ "name": "analytics_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cookie_consented_at": {
+ "name": "cookie_consented_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "onboarding_completed_at": {
+ "name": "onboarding_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invited_by_invite_id": {
+ "name": "invited_by_invite_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_sync_at": {
+ "name": "last_sync_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "users_email_idx": {
+ "name": "users_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "users_created_at_idx": {
+ "name": "users_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "users_analytics_id_unique_idx": {
+ "name": "users_analytics_id_unique_idx",
+ "columns": [
+ {
+ "expression": "analytics_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhooks": {
+ "name": "webhooks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "delivery_id": {
+ "name": "delivery_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event": {
+ "name": "event",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "succeeded_at": {
+ "name": "succeeded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failed_at": {
+ "name": "failed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "webhooks_provider_delivery_id_unique": {
+ "name": "webhooks_provider_delivery_id_unique",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "delivery_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhooks_event_idx": {
+ "name": "webhooks_event_idx",
+ "columns": [
+ {
+ "expression": "event",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhooks_created_at_idx": {
+ "name": "webhooks_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "webhooks_status_exclusive": {
+ "name": "webhooks_status_exclusive",
+ "value": "(\n (succeeded_at IS NOT NULL)::int +\n (failed_at IS NOT NULL)::int\n ) <= 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.work_items": {
+ "name": "work_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "automation_key": {
+ "name": "automation_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_task_id": {
+ "name": "source_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "selected_by_user_id": {
+ "name": "selected_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_work_item_id": {
+ "name": "source_work_item_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "brief": {
+ "name": "brief",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_prompt": {
+ "name": "execution_prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "investigation_context": {
+ "name": "investigation_context",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "category": {
+ "name": "category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action_kind": {
+ "name": "action_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disposition": {
+ "name": "disposition",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_ids": {
+ "name": "repository_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "target_repository_full_name": {
+ "name": "target_repository_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_environment_id": {
+ "name": "target_environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_readiness": {
+ "name": "workspace_readiness",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "readiness_message": {
+ "name": "readiness_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fingerprint": {
+ "name": "fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "launch_claimed_at": {
+ "name": "launch_claimed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "launched_task_id": {
+ "name": "launched_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "launched_at": {
+ "name": "launched_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failed_at": {
+ "name": "failed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "launch_error": {
+ "name": "launch_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dismissed_at": {
+ "name": "dismissed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "work_items_source_task_idx": {
+ "name": "work_items_source_task_idx",
+ "columns": [
+ {
+ "expression": "source_task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "work_items_kind_status_idx": {
+ "name": "work_items_kind_status_idx",
+ "columns": [
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "work_items_automation_key_fingerprint_idx": {
+ "name": "work_items_automation_key_fingerprint_idx",
+ "columns": [
+ {
+ "expression": "automation_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "work_items_fingerprint_idx": {
+ "name": "work_items_fingerprint_idx",
+ "columns": [
+ {
+ "expression": "fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "work_items_launched_task_id_idx": {
+ "name": "work_items_launched_task_id_idx",
+ "columns": [
+ {
+ "expression": "launched_task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "work_items_source_task_kind_sort_order_unique": {
+ "name": "work_items_source_task_kind_sort_order_unique",
+ "columns": [
+ {
+ "expression": "source_task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sort_order",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "work_items_automation_key_automations_key_fk": {
+ "name": "work_items_automation_key_automations_key_fk",
+ "tableFrom": "work_items",
+ "tableTo": "automations",
+ "columnsFrom": ["automation_key"],
+ "columnsTo": ["key"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "work_items_source_task_id_tasks_id_fk": {
+ "name": "work_items_source_task_id_tasks_id_fk",
+ "tableFrom": "work_items",
+ "tableTo": "tasks",
+ "columnsFrom": ["source_task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "work_items_selected_by_user_id_users_id_fk": {
+ "name": "work_items_selected_by_user_id_users_id_fk",
+ "tableFrom": "work_items",
+ "tableTo": "users",
+ "columnsFrom": ["selected_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "work_items_source_work_item_id_work_items_id_fk": {
+ "name": "work_items_source_work_item_id_work_items_id_fk",
+ "tableFrom": "work_items",
+ "tableTo": "work_items",
+ "columnsFrom": ["source_work_item_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "work_items_target_environment_id_environments_id_fk": {
+ "name": "work_items_target_environment_id_environments_id_fk",
+ "tableFrom": "work_items",
+ "tableTo": "environments",
+ "columnsFrom": ["target_environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "work_items_launched_task_id_tasks_id_fk": {
+ "name": "work_items_launched_task_id_tasks_id_fk",
+ "tableFrom": "work_items",
+ "tableTo": "tasks",
+ "columnsFrom": ["launched_task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index 9169311e1..491dd3156 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -449,6 +449,13 @@
"when": 1787897902620,
"tag": "0063_organic_garia",
"breakpoints": true
+ },
+ {
+ "idx": 64,
+ "version": "7",
+ "when": 1787922571469,
+ "tag": "0064_round_surge",
+ "breakpoints": true
}
]
}
diff --git a/packages/db/src/lib/__tests__/custom-automations.test.ts b/packages/db/src/lib/__tests__/custom-automations.test.ts
index 8557cb615..8ddf7f6f1 100644
--- a/packages/db/src/lib/__tests__/custom-automations.test.ts
+++ b/packages/db/src/lib/__tests__/custom-automations.test.ts
@@ -17,6 +17,7 @@ import {
environments,
eq,
taskFactory,
+ userFactory,
} from '../../server';
describe('custom automations helpers', () => {
@@ -37,6 +38,31 @@ describe('custom automations helpers', () => {
await deleteCustomAutomation(created.id);
});
+ it('lets an admin claim an owner-deleted Fast automation on update', async () => {
+ const created = await createCustomAutomation({
+ name: `Ownerless Fast digest ${Date.now()}`,
+ prompt: 'Summarize actionable work using Fast.',
+ enabled: true,
+ scheduleMode: 'daily',
+ environmentId: FAST_EXECUTION,
+ target: {},
+ });
+ const owner = await userFactory.create();
+
+ const updated = await updateCustomAutomation(created.id, {
+ name: created.name,
+ prompt: created.prompt,
+ enabled: created.enabled,
+ scheduleMode: 'daily',
+ environmentId: FAST_EXECUTION,
+ target: {},
+ createdByUserId: owner.id,
+ });
+
+ expect(updated.createdByUserId).toBe(owner.id);
+ await deleteCustomAutomation(created.id);
+ });
+
it('persists an explicit all-repositories workspace target', async () => {
const created = await createCustomAutomation({
name: `Org-wide digest ${Date.now()}`,
diff --git a/packages/db/src/lib/custom-automations.ts b/packages/db/src/lib/custom-automations.ts
index 2a0b0236e..62687e5dc 100644
--- a/packages/db/src/lib/custom-automations.ts
+++ b/packages/db/src/lib/custom-automations.ts
@@ -283,6 +283,8 @@ export async function updateCustomAutomation(
allRepositories,
executionMode,
target: input.target,
+ createdByUserId:
+ existing.createdByUserId ?? input.createdByUserId ?? null,
updatedAt: new Date(),
})
.where(eq(customAutomations.id, id))
diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts
index b6e9981cb..54c972a5e 100644
--- a/packages/db/src/schema.ts
+++ b/packages/db/src/schema.ts
@@ -3060,9 +3060,16 @@ export const fastAgentConversations = pgTable(
'fast_agent_conversations',
{
id: uuid('id').primaryKey().defaultRandom(),
- userId: text('user_id')
- .notNull()
- .references(() => users.id, { onDelete: 'cascade' }),
+ userId: text('user_id').references(() => users.id, {
+ onDelete: 'cascade',
+ }),
+ /**
+ * Release-N compatibility field. Automation-owned rows are readable now,
+ * but are not written until N+1 capability routing ships.
+ */
+ ownerAutomation: text('owner_automation')
+ .$type()
+ .references(() => automations.key, { onDelete: 'cascade' }),
surface: text('surface').notNull().$type(),
workspaceId: text('workspace_id').notNull(),
conversationId: text('conversation_id').notNull(),
@@ -3096,6 +3103,17 @@ export const fastAgentConversations = pgTable(
table.conversationId,
),
index('fast_agent_conversations_user_idx').on(table.userId),
+ index('fast_agent_conversations_owner_automation_idx').on(
+ table.ownerAutomation,
+ ),
+ check(
+ 'fast_agent_conversations_owner_shape_check',
+ sql`(
+ (${table.userId} is not null and ${table.ownerAutomation} is null)
+ or
+ (${table.userId} is null and ${table.ownerAutomation} is not null)
+ )`,
+ ),
index('fast_agent_conversations_legacy_ids_idx').using(
'gin',
table.legacyConversationIds,
diff --git a/packages/sdk/src/server/automations/__tests__/custom-automations.test.ts b/packages/sdk/src/server/automations/__tests__/custom-automations.test.ts
index fee0f6d5e..4cd3485e7 100644
--- a/packages/sdk/src/server/automations/__tests__/custom-automations.test.ts
+++ b/packages/sdk/src/server/automations/__tests__/custom-automations.test.ts
@@ -131,7 +131,6 @@ import {
runCustomAutomationNow,
} from '../custom-automations';
import {
- buildDestinationTaskPayloadFields,
findTeamsConversationRoute,
listConnectedCommunicationProviders,
} from '../destination';
@@ -151,7 +150,7 @@ const automation = {
targetKind: 'slack_channel',
externalRef: 'C123',
},
- createdByUserId: null,
+ createdByUserId: 'user-1',
lastRunAt: null,
lastSucceededAt: null,
lastFailedAt: null,
@@ -184,9 +183,10 @@ describe('customAutomationsJob', () => {
id: 'slack-installation-channel-1',
slackInstallation: { isActive: true, teamId: 'T123' },
} as never);
- vi.mocked(db.query.slackInstallations.findFirst).mockResolvedValue(
- undefined,
- );
+ vi.mocked(db.query.slackInstallations.findFirst).mockResolvedValue({
+ botAccessToken: 'xoxb-test',
+ teamId: 'T123',
+ } as never);
vi.mocked(enqueueTask).mockResolvedValue({
taskId: 'task_abc',
} as never);
@@ -748,10 +748,11 @@ describe('customAutomationsJob', () => {
});
});
- it('launches a StandardTask for due automations', async () => {
+ it('starts a scheduled legacy sandbox automation as a Fast Session', async () => {
const result = await customAutomationsJob();
- expect(result.launchedTaskId).toBe('task_abc');
+ expect(result.completed).toBe(true);
+ expect(result.launchedTaskId).toBeNull();
expect(tryClaimCustomAutomationLaunch).toHaveBeenCalledWith(
automation.id,
automation.lastRunAt,
@@ -762,32 +763,19 @@ describe('customAutomationsJob', () => {
scheduleHourLocal: 3,
}),
);
- expect(enqueueTask).toHaveBeenCalledWith(
+ expect(enqueueTask).not.toHaveBeenCalled();
+ expect(fastMocks.getSession).toHaveBeenCalledWith(
+ expect.objectContaining({ userId: 'user-1' }),
+ );
+ expect(fastMocks.deliverParentEvent).toHaveBeenCalledWith(
expect.objectContaining({
- task: expect.objectContaining({
- type: TaskPayloadKind.StandardTask,
- payload: expect.objectContaining({
- environmentId: automation.environmentId,
- description: expect.stringContaining(automation.prompt),
- repo: '',
- customAutomationId: automation.id,
- channel: 'C123',
- slackChannel: 'C123',
- }),
+ event: expect.objectContaining({
+ type: 'automation_triggered',
+ automationId: automation.id,
+ prompt: automation.prompt,
+ trigger: 'schedule',
+ taskEnvironmentId: automation.environmentId,
}),
- initiator: {
- kind: 'automation',
- key: 'custom_automation',
- actor: {
- externalId: automation.id,
- displayName: automation.name,
- },
- },
- title: automation.name,
- workflow: 'standard',
- surface: 'system',
- trigger: 'schedule',
- channels: { slackChannelId: 'C123' },
}),
);
expect(recordCustomAutomationRunOutcome).toHaveBeenCalledWith(
@@ -795,13 +783,44 @@ describe('customAutomationsJob', () => {
expect.objectContaining({
id: automation.id,
status: 'succeeded',
- lastLaunchedTaskId: 'task_abc',
launchClaimedAt: expect.any(Date),
}),
);
});
- it('launches all-repositories automations without a named environment', async () => {
+ it('keeps an ownerless legacy sandbox automation on the direct task path', async () => {
+ vi.mocked(listEnabledCustomAutomations).mockResolvedValue([
+ { ...automation, createdByUserId: null } as never,
+ ]);
+
+ const result = await customAutomationsJob();
+
+ expect(result.launchedTaskId).toBe('task_abc');
+ expect(fastMocks.getSession).not.toHaveBeenCalled();
+ expect(fastMocks.deliverParentEvent).not.toHaveBeenCalled();
+ expect(enqueueTask).toHaveBeenCalledWith(
+ expect.objectContaining({
+ trigger: 'schedule',
+ initiator: {
+ kind: 'automation',
+ key: 'custom_automation',
+ actor: {
+ externalId: automation.id,
+ displayName: automation.name,
+ },
+ },
+ task: expect.objectContaining({
+ type: TaskPayloadKind.StandardTask,
+ payload: expect.objectContaining({
+ environmentId: automation.environmentId,
+ description: expect.stringContaining(automation.prompt),
+ }),
+ }),
+ }),
+ );
+ });
+
+ it('preserves all-repositories scope on the Fast automation event', async () => {
vi.mocked(listEnabledCustomAutomations).mockResolvedValue([
{
...automation,
@@ -812,100 +831,44 @@ describe('customAutomationsJob', () => {
const result = await customAutomationsJob();
- expect(result.launchedTaskId).toBe('task_abc');
+ expect(result.completed).toBe(true);
expect(db.query.environments.findFirst).not.toHaveBeenCalled();
- expect(enqueueTask).toHaveBeenCalledWith(
+ expect(enqueueTask).not.toHaveBeenCalled();
+ expect(fastMocks.deliverParentEvent).toHaveBeenCalledWith(
expect.objectContaining({
- task: expect.objectContaining({
- payload: expect.objectContaining({ repo: ALL_REPOSITORIES }),
+ event: expect.objectContaining({
+ taskEnvironmentId: ALL_REPOSITORIES,
}),
}),
);
- const enqueued = vi.mocked(enqueueTask).mock.calls[0]?.[0] as {
- task: { payload: Record & { description: string } };
- };
- expect(enqueued.task.payload).not.toHaveProperty('environmentId');
- expect(enqueued.task.payload.description).toContain(
- 'must include the concrete `targetRepositoryFullName`',
- );
});
- it('passes a model override through to the launch', async () => {
+ it('passes a valid model override to delegated tasks through Fast', async () => {
vi.mocked(listEnabledCustomAutomations).mockResolvedValue([
{ ...automation, model: 'anthropic/claude-sonnet-5' } as never,
]);
await customAutomationsJob();
- expect(enqueueTask).toHaveBeenCalledWith(
+ expect(fastMocks.deliverParentEvent).toHaveBeenCalledWith(
expect.objectContaining({
- task: expect.objectContaining({
- harness: 'opencode-server',
- payload: expect.objectContaining({
- harnessModelOverrides: {
- 'opencode-server': 'anthropic/claude-sonnet-5',
- },
- }),
+ event: expect.objectContaining({
+ defaultTaskModel: 'anthropic/claude-sonnet-5',
}),
}),
);
});
- it('launches on the deployment default when a persisted model is invalid', async () => {
+ it('uses the delegated-task default when a persisted model is invalid', async () => {
vi.mocked(listEnabledCustomAutomations).mockResolvedValue([
{ ...automation, model: 'not-a-model' } as never,
]);
const result = await customAutomationsJob();
- expect(result.launchedTaskId).toBe('task_abc');
- const enqueued = vi.mocked(enqueueTask).mock.calls[0]?.[0] as {
- task: { harness?: string; payload: Record };
- };
- expect(enqueued.task.harness).toBeUndefined();
- expect(enqueued.task.payload.harnessModelOverrides).toBeUndefined();
- });
-
- it('makes the configured channel available for interruption-worthy reports', async () => {
- await customAutomationsJob();
-
- const enqueued = vi.mocked(enqueueTask).mock.calls[0]?.[0] as {
- task: { payload: { description: string } };
- };
- expect(enqueued.task.payload.description).toContain(
- 'C123 ',
- );
- expect(enqueued.task.payload.description).toContain('send_chat_reply');
- expect(enqueued.task.payload.description).toContain(
- 'do not post progress updates',
- );
- expect(enqueued.task.payload.description).toContain(
- 'Default to finishing silently',
- );
- expect(enqueued.task.payload.description).toContain(
- 'a concrete actionable or important finding',
- );
- expect(enqueued.task.payload.description).toContain(
- 'Routine success, healthy status, no-change results',
- );
- expect(enqueued.task.payload.description).toContain(
- 'do not mention this automation',
- );
- expect(enqueued.task.payload.description).toContain(
- '',
- );
- expect(enqueued.task.payload.description).toContain(
- 'On any conflict, follow the request',
- );
- expect(enqueued.task.payload.description).toContain(
- 'normally no more than about 250 words',
- );
- expect(enqueued.task.payload.description).toContain(
- 'send the detail in follow-up replies in the same thread',
- );
- expect(enqueued.task.payload.description.indexOf(automation.prompt)).toBe(
- 0,
- );
+ expect(result.completed).toBe(true);
+ const event = fastMocks.deliverParentEvent.mock.calls[0]?.[0]?.event;
+ expect(event).not.toHaveProperty('defaultTaskModel');
});
it('resolves a Slack DM target for the automation owner', async () => {
@@ -923,22 +886,17 @@ describe('customAutomationsJob', () => {
const result = await customAutomationsJob();
- expect(result.launchedTaskId).toBe('task_abc');
+ expect(result.completed).toBe(true);
expect(findUserDirectMessageDestination).toHaveBeenCalledWith(
'slack',
'user-1',
);
- expect(enqueueTask).toHaveBeenCalledWith(
+ expect(fastMocks.getSession).toHaveBeenCalledWith(
expect.objectContaining({
- task: expect.objectContaining({
- payload: expect.objectContaining({
- channel: 'D123',
- slackChannel: 'D123',
- teamId: 'T123',
- slackTeamId: 'T123',
- }),
+ conversation: expect.objectContaining({
+ surface: 'slack',
+ replyTarget: { channelId: 'D123', threadId: '100.001' },
}),
- channels: { slackChannelId: 'D123' },
}),
);
});
@@ -970,6 +928,7 @@ describe('customAutomationsJob', () => {
'teams_user',
{
channelId: 'teams-dm-1',
+ teamId: 'tenant-1',
serviceUrl: 'https://smba.example.com/amer/',
},
],
@@ -998,83 +957,33 @@ describe('customAutomationsJob', () => {
const result = await customAutomationsJob();
- expect(result.launchedTaskId).toBe('task_abc');
+ expect(result.completed).toBe(true);
expect(findUserDirectMessageDestination).toHaveBeenCalledWith(
provider,
'user-1',
);
- expect(buildDestinationTaskPayloadFields).toHaveBeenCalledWith(
+ expect(fastMocks.getSession).toHaveBeenCalledWith(
expect.objectContaining({
- provider,
- ...resolvedDestination,
+ conversation: expect.objectContaining({ surface: provider }),
}),
);
},
);
- it('adds presentation defaults without channel anchoring when no report channel is configured', async () => {
+ it('uses a stored Fast conversation when no report destination is configured', async () => {
vi.mocked(listEnabledCustomAutomations).mockResolvedValue([
{ ...automation, target: {} } as never,
]);
const result = await customAutomationsJob();
- expect(result.launchedTaskId).toBe('task_abc');
- const enqueued = vi.mocked(enqueueTask).mock.calls[0]?.[0] as {
- task: { payload: Record };
- channels?: unknown;
- };
- expect(enqueued.task.payload.description).toEqual(
- expect.stringContaining(automation.prompt),
- );
- expect(enqueued.task.payload.description).toEqual(
- expect.stringContaining(''),
- );
- expect(enqueued.task.payload.description).toEqual(
- expect.stringContaining('On any conflict, follow the request'),
- );
- expect(enqueued.task.payload.description).not.toEqual(
- expect.stringContaining('send_chat_reply'),
- );
- expect(
- String(enqueued.task.payload.description).indexOf(automation.prompt),
- ).toBe(0);
- expect(enqueued.task.payload.customAutomationId).toBeUndefined();
- expect(enqueued.task.payload.channel).toBeUndefined();
- expect(enqueued.channels).toBeUndefined();
- expect(buildDestinationTaskPayloadFields).not.toHaveBeenCalled();
- });
-
- it("falls back to the enabling admin's DM when no report channel is configured", async () => {
- vi.mocked(listEnabledCustomAutomations).mockResolvedValue([
- {
- ...automation,
- target: {},
- createdByUserId: 'user-1',
- } as never,
- ]);
-
- const result = await customAutomationsJob();
-
- expect(result.launchedTaskId).toBe('task_abc');
- expect(findUserDirectMessageDestination).toHaveBeenCalledWith(
- 'slack',
- 'user-1',
- );
- expect(enqueueTask).toHaveBeenCalledWith(
- expect.objectContaining({
- task: expect.objectContaining({
- payload: expect.objectContaining({
- customAutomationId: automation.id,
- channel: 'D123',
- slackChannel: 'D123',
- teamId: 'T123',
- slackTeamId: 'T123',
- }),
- }),
- channels: { slackChannelId: 'D123' },
- }),
- );
+ expect(result.completed).toBe(true);
+ expect(enqueueTask).not.toHaveBeenCalled();
+ expect(findUserDirectMessageDestination).not.toHaveBeenCalled();
+ expect(fastMocks.getSession).toHaveBeenCalledWith({
+ userId: 'user-1',
+ conversation: expect.objectContaining({ surface: 'automation' }),
+ });
});
it('uses hour-0 boundary for hourly schedules', async () => {
@@ -1125,23 +1034,19 @@ describe('customAutomationsJob', () => {
serviceUrl: 'https://smba.trafficmanager.net/amer/',
workspaceId: 'tenant-1',
});
- vi.mocked(buildDestinationTaskPayloadFields).mockReturnValue({
- communicationProvider: 'teams',
- communicationChannelId: '19:abc@thread.tacv2',
- communicationServiceUrl: 'https://smba.trafficmanager.net/amer/',
- });
const result = await customAutomationsJob();
- expect(result.launchedTaskId).toBe('task_abc');
+ expect(result.completed).toBe(true);
expect(findTeamsConversationRoute).toHaveBeenCalledWith(
'19:abc@thread.tacv2',
);
- expect(enqueueTask).toHaveBeenCalledWith(
+ expect(fastMocks.getSession).toHaveBeenCalledWith(
expect.objectContaining({
- task: expect.objectContaining({
- payload: expect.objectContaining({
- communicationServiceUrl: 'https://smba.trafficmanager.net/amer/',
+ conversation: expect.objectContaining({
+ surface: 'teams',
+ replyTarget: expect.objectContaining({
+ serviceUrl: 'https://smba.trafficmanager.net/amer/',
}),
}),
}),
@@ -1178,42 +1083,62 @@ describe('customAutomationsJob', () => {
describe('runCustomAutomationNow', () => {
beforeEach(() => {
vi.clearAllMocks();
- vi.mocked(getCustomAutomationById).mockResolvedValue(automation as never);
+ vi.mocked(getCustomAutomationById).mockResolvedValue({
+ ...automation,
+ target: {},
+ } as never);
vi.mocked(getCustomAutomationFrequency).mockReturnValue('daily');
vi.mocked(tryClaimCustomAutomationLaunch).mockResolvedValue(new Date());
vi.mocked(db.query.environments.findFirst).mockResolvedValue({
id: automation.environmentId,
} as never);
- vi.mocked(enqueueTask).mockResolvedValue({
- taskId: 'task_manual',
- } as never);
+ fastMocks.getSession.mockResolvedValue({
+ id: '33333333-3333-4333-8333-333333333333',
+ compatibilityMessages: [],
+ });
+ fastMocks.deliverParentEvent.mockResolvedValue('delivered');
});
- it('launches with a manual trigger', async () => {
+ it('starts a Fast Session with a manual trigger and configured scope', async () => {
const result = await runCustomAutomationNow(automation.id);
- expect(result).toEqual({
- outcome: 'launched',
- taskId: 'task_manual',
- });
+ expect(result).toEqual({ outcome: 'completed' });
expect(tryClaimCustomAutomationLaunch).toHaveBeenCalledWith(
automation.id,
automation.lastRunAt,
);
- expect(enqueueTask).toHaveBeenCalledWith(
+ expect(enqueueTask).not.toHaveBeenCalled();
+ expect(fastMocks.deliverParentEvent).toHaveBeenCalledWith(
expect.objectContaining({
- trigger: 'manual',
- task: expect.objectContaining({
- payload: expect.objectContaining({
- description: expect.stringContaining(
- '',
- ),
- }),
+ event: expect.objectContaining({
+ type: 'automation_triggered',
+ trigger: 'manual',
+ taskEnvironmentId: automation.environmentId,
}),
}),
);
});
+ it('keeps an ownerless manual run on the legacy sandbox path', async () => {
+ vi.mocked(getCustomAutomationById).mockResolvedValue({
+ ...automation,
+ createdByUserId: null,
+ target: {},
+ } as never);
+ vi.mocked(enqueueTask).mockResolvedValue({
+ taskId: 'task_manual',
+ } as never);
+
+ const result = await runCustomAutomationNow(automation.id);
+
+ expect(result).toEqual({ outcome: 'launched', taskId: 'task_manual' });
+ expect(fastMocks.getSession).not.toHaveBeenCalled();
+ expect(fastMocks.deliverParentEvent).not.toHaveBeenCalled();
+ expect(enqueueTask).toHaveBeenCalledWith(
+ expect.objectContaining({ trigger: 'manual' }),
+ );
+ });
+
it('skips manual run when a concurrent launch holds the claim', async () => {
vi.mocked(tryClaimCustomAutomationLaunch).mockResolvedValue(null);
@@ -1226,10 +1151,10 @@ describe('runCustomAutomationNow', () => {
expect(enqueueTask).not.toHaveBeenCalled();
});
- it('releases the launch claim when enqueue fails', async () => {
+ it('releases the launch claim when Fast delivery fails', async () => {
const claimAt = new Date('2026-07-21T00:00:00.000Z');
vi.mocked(tryClaimCustomAutomationLaunch).mockResolvedValue(claimAt);
- vi.mocked(enqueueTask).mockRejectedValue(new Error('queue down'));
+ fastMocks.deliverParentEvent.mockRejectedValue(new Error('inference down'));
const result = await runCustomAutomationNow(automation.id);
diff --git a/packages/sdk/src/server/automations/custom-automations.ts b/packages/sdk/src/server/automations/custom-automations.ts
index 35dafdbc1..39ef72ade 100644
--- a/packages/sdk/src/server/automations/custom-automations.ts
+++ b/packages/sdk/src/server/automations/custom-automations.ts
@@ -26,6 +26,7 @@ import {
isConfiguredAutomationTarget,
isBackgroundAutomationUserTargetKind,
isCommunicationAutomationTarget,
+ resolveAutomationTaskLaunchMode,
resolveEvalHarnessSelection,
TaskPayloadKind,
type AutomationTarget,
@@ -163,14 +164,15 @@ async function resolveDestination(
};
}
-function buildDefaultReportPresentationGuidance(
- hasDestination: boolean,
+function buildLegacySandboxDescription(
+ prompt: string,
+ destination: ResolvedAutomationDestination | null,
+ allRepositories: boolean,
): string {
- const channelGuidance = hasDestination
+ const channelGuidance = destination
? '\n- The first `send_chat_reply` is the report root and must stand alone. If important supporting detail would make it too long, keep the root concise and send the detail in follow-up replies in the same thread with clear headings. Keep essential conclusions and required actions in the root.'
: '';
-
- return `
+ const presentationGuidance = `
These are defaults, not requirements that override the automation request above. Before applying them, check the request for explicit guidance about format, structure, length, tone, audience, or where details should appear. On any conflict, follow the request. Apply these defaults only where the request is silent.
- Lead with the result or most important takeaway in 1-2 sentences.
@@ -181,56 +183,6 @@ These are defaults, not requirements that override the automation request above.
- If the request explicitly requires a clean or no-action report, say so briefly and include only the most useful supporting evidence or caveats.
- Use inline links with descriptive labels instead of raw URLs when possible.${channelGuidance}
`;
-}
-
-/**
- * Adds default reporting guidance to every custom automation prompt and,
- * when configured, makes its destination conversation available for
- * interruption-worthy results.
- *
- * A custom automation may intentionally omit a report destination. When it
- * does, prefer the admin who created/enabled it as a private fallback so an
- * enabled automation does not disappear from the communication surface.
- */
-async function resolveOwnerFallbackDestination(
- ownerUserId: string | null,
-): Promise {
- if (!ownerUserId) {
- return null;
- }
-
- const connectedProviders = await listConnectedCommunicationProviders();
- for (const provider of connectedProviders) {
- try {
- const destination = await findUserDirectMessageDestination(
- provider,
- ownerUserId,
- );
- if (destination) {
- return {
- provider,
- ...destination,
- source: 'automation_target',
- };
- }
- } catch (error) {
- console.warn(
- `${LOG_PREFIX} Failed to resolve owner DM on ${provider}: ${error instanceof Error ? error.message : String(error)}`,
- );
- }
- }
-
- return null;
-}
-
-function buildCustomAutomationDescription(
- prompt: string,
- destination: ResolvedAutomationDestination | null,
- options: { allRepositories: boolean },
-): string {
- const presentationGuidance = buildDefaultReportPresentationGuidance(
- destination !== null,
- );
if (!destination) {
return `${prompt}
@@ -239,7 +191,7 @@ ${presentationGuidance}`;
}
const promptContext = buildDestinationPromptContext(destination);
- const orgWideSuggestionInstruction = options.allRepositories
+ const orgWideSuggestionInstruction = allRepositories
? ' This run spans all active repositories. Every launchable suggestion must include the concrete `targetRepositoryFullName` that owns the work so Roomote can start it in the matching environment.'
: '';
@@ -436,6 +388,7 @@ async function runFastCustomAutomation(params: {
destination: ResolvedAutomationDestination | null;
launchClaimedAt: Date;
trigger: 'schedule' | 'manual';
+ defaultTaskModel?: string;
}): Promise {
if (!params.automation.createdByUserId) {
throw new Error('Fast automation run-as user is not configured.');
@@ -470,9 +423,14 @@ async function runFastCustomAutomation(params: {
automationName: params.automation.name,
prompt: params.automation.prompt,
trigger: params.trigger,
- ...(params.automation.model
- ? { defaultTaskModel: params.automation.model }
+ ...(params.defaultTaskModel
+ ? { defaultTaskModel: params.defaultTaskModel }
: {}),
+ ...(params.automation.allRepositories
+ ? { taskEnvironmentId: ALL_REPOSITORIES }
+ : params.automation.environmentId
+ ? { taskEnvironmentId: params.automation.environmentId }
+ : {}),
...(rootMessageId ? { rootMessageId } : {}),
};
await deliverFastAgentParentEvent({
@@ -558,7 +516,13 @@ async function launchCustomAutomationRow(
): Promise {
const result = emptyJobResult();
const frequency = getCustomAutomationFrequency(automation);
- const fastExecution = automation.executionMode === 'fast';
+ const hasUnconfiguredTaskScope = automation.executionMode === 'fast';
+ const useLegacySandboxFallback =
+ automation.executionMode === 'sandbox_task' &&
+ resolveAutomationTaskLaunchMode({
+ policyId: 'custom_automation',
+ runAsUserId: automation.createdByUserId,
+ }) === 'sandbox_task';
if (automation.scheduleMode !== 'cron' && frequency === 'off') {
result.skippedReason = 'Automation is disabled.';
@@ -612,7 +576,7 @@ async function launchCustomAutomationRow(
}
if (
- fastExecution &&
+ !useLegacySandboxFallback &&
automation.launchClaimedAt &&
Date.now() - automation.launchClaimedAt.getTime() >=
CUSTOM_AUTOMATION_LAUNCH_STALE_CLAIM_MS
@@ -631,7 +595,7 @@ async function launchCustomAutomationRow(
}
if (
- !fastExecution &&
+ !hasUnconfiguredTaskScope &&
!automation.allRepositories &&
!automation.environmentId
) {
@@ -646,14 +610,18 @@ async function launchCustomAutomationRow(
}
const environment =
- fastExecution || automation.allRepositories
+ hasUnconfiguredTaskScope || automation.allRepositories
? null
: await db.query.environments.findFirst({
columns: { id: true },
where: eq(environments.id, automation.environmentId!),
});
- if (!fastExecution && !automation.allRepositories && !environment) {
+ if (
+ !hasUnconfiguredTaskScope &&
+ !automation.allRepositories &&
+ !environment
+ ) {
result.skippedReason = 'Environment no longer exists.';
result.errors.push('Environment no longer exists.');
await recordCustomAutomationRunOutcome(db, {
@@ -664,12 +632,11 @@ async function launchCustomAutomationRow(
return result;
}
- // A report destination is optional. Prefer a private DM to the admin who
- // created/enabled the automation so an enabled run still has a chat-facing
- // result; if that admin has no linked DM, preserve the task-UI fallback.
+ // A report destination is optional. Fast runs without one retain their
+ // result in the stored automation conversation.
let destination: ResolvedAutomationDestination | null = null;
if (isConfiguredAutomationTarget(automation.target)) {
- if (fastExecution && !isFastDeliveryTarget(automation.target)) {
+ if (!useLegacySandboxFallback && !isFastDeliveryTarget(automation.target)) {
const message = `${PROVIDER_LABELS[automation.target.provider as CommunicationProvider]} report destinations of this type are not supported in Fast mode.`;
result.skippedReason = message;
result.errors.push(message);
@@ -712,14 +679,10 @@ async function launchCustomAutomationRow(
});
return result;
}
- } else if (!fastExecution) {
- destination = await resolveOwnerFallbackDestination(
- automation.createdByUserId,
- );
}
// The short claim fence prevents concurrent launchers from double-launching
- // without blocking a due run behind a previous task that still appears active.
+ // without blocking a due run behind a previous run that still appears active.
const launchClaimedAt = await tryClaimCustomAutomationLaunch(
automation.id,
automation.lastRunAt,
@@ -743,99 +706,91 @@ async function launchCustomAutomationRow(
const modelOverride = modelSelection?.ok ? modelSelection : null;
try {
- if (fastExecution) {
- await db
- .update(customAutomations)
- .set({ lastLaunchedTaskId: null })
- .where(
- and(
- eq(customAutomations.id, automation.id),
- eq(customAutomations.launchClaimedAt, launchClaimedAt),
- ),
- );
- await runFastCustomAutomation({
- automation,
- destination,
- launchClaimedAt,
+ if (useLegacySandboxFallback) {
+ const launchResult = await enqueueTask({
+ task: {
+ type: TaskPayloadKind.StandardTask,
+ ...(modelOverride?.harness ? { harness: modelOverride.harness } : {}),
+ payload: {
+ repo: automation.allRepositories ? ALL_REPOSITORIES : '',
+ ...(automation.environmentId
+ ? { environmentId: automation.environmentId }
+ : {}),
+ description: buildLegacySandboxDescription(
+ automation.prompt,
+ destination,
+ automation.allRepositories,
+ ),
+ ...(destination
+ ? buildDestinationTaskPayloadFields(destination)
+ : {}),
+ ...(destination ? { customAutomationId: automation.id } : {}),
+ ...(destination?.provider === 'slack'
+ ? {
+ channel: destination.channelId,
+ slackChannel: destination.channelId,
+ ...(destination.teamId
+ ? {
+ teamId: destination.teamId,
+ slackTeamId: destination.teamId,
+ }
+ : {}),
+ }
+ : {}),
+ ...(modelOverride?.harnessModelOverrides
+ ? { harnessModelOverrides: modelOverride.harnessModelOverrides }
+ : {}),
+ },
+ },
+ title: automation.name,
+ initiator: {
+ kind: 'automation',
+ key: 'custom_automation',
+ actor: {
+ externalId: automation.id,
+ displayName: automation.name,
+ },
+ },
+ workflow: 'standard',
+ surface: 'system',
trigger: opts.manualTrigger ? 'manual' : 'schedule',
+ ...(destination?.provider === 'slack'
+ ? { channels: { slackChannelId: destination.channelId } }
+ : {}),
});
+
await recordCustomAutomationRunOutcome(db, {
id: automation.id,
status: 'succeeded',
+ lastLaunchedTaskId: launchResult.taskId,
launchClaimedAt,
});
+ result.launchedTaskId = launchResult.taskId;
result.completed = true;
return result;
}
- const launchResult = await enqueueTask({
- task: {
- type: TaskPayloadKind.StandardTask,
- ...(modelOverride?.harness ? { harness: modelOverride.harness } : {}),
- payload: {
- repo: automation.allRepositories ? ALL_REPOSITORIES : '',
- ...(automation.environmentId
- ? { environmentId: automation.environmentId }
- : {}),
- description: buildCustomAutomationDescription(
- automation.prompt,
- destination,
- {
- allRepositories: automation.allRepositories,
- },
- ),
- ...(destination
- ? buildDestinationTaskPayloadFields(destination)
- : {}),
- // customAutomationId authorizes the Slack late-bound thread flow:
- // the run's first send_chat_reply posts a root message in the
- // destination channel and binds it as the task thread, so later
- // updates continue the thread and user replies route back into the
- // task. The channel/slackChannel payload fields give the sandbox
- // its Slack reply context (ROOMOTE_SLACK_CHANNEL).
- ...(destination ? { customAutomationId: automation.id } : {}),
- ...(destination?.provider === 'slack'
- ? {
- channel: destination.channelId,
- slackChannel: destination.channelId,
- ...(destination.teamId
- ? {
- teamId: destination.teamId,
- slackTeamId: destination.teamId,
- }
- : {}),
- }
- : {}),
- ...(modelOverride?.harnessModelOverrides
- ? { harnessModelOverrides: modelOverride.harnessModelOverrides }
- : {}),
- },
- },
- title: automation.name,
- initiator: {
- kind: 'automation',
- key: 'custom_automation',
- actor: {
- externalId: automation.id,
- displayName: automation.name,
- },
- },
- workflow: 'standard',
- surface: 'system',
+ await db
+ .update(customAutomations)
+ .set({ lastLaunchedTaskId: null })
+ .where(
+ and(
+ eq(customAutomations.id, automation.id),
+ eq(customAutomations.launchClaimedAt, launchClaimedAt),
+ ),
+ );
+ await runFastCustomAutomation({
+ automation,
+ destination,
+ launchClaimedAt,
trigger: opts.manualTrigger ? 'manual' : 'schedule',
- ...(destination?.provider === 'slack'
- ? { channels: { slackChannelId: destination.channelId } }
- : {}),
+ ...(modelOverride ? { defaultTaskModel: automation.model! } : {}),
});
-
await recordCustomAutomationRunOutcome(db, {
id: automation.id,
status: 'succeeded',
- lastLaunchedTaskId: launchResult.taskId,
launchClaimedAt,
});
-
- result.launchedTaskId = launchResult.taskId;
result.completed = true;
return result;
} catch (error) {
diff --git a/packages/sdk/src/server/lib/fast-agent-parent-event.test.ts b/packages/sdk/src/server/lib/fast-agent-parent-event.test.ts
index 56e9a7a28..6bbf68f79 100644
--- a/packages/sdk/src/server/lib/fast-agent-parent-event.test.ts
+++ b/packages/sdk/src/server/lib/fast-agent-parent-event.test.ts
@@ -3,6 +3,7 @@ const mocks = vi.hoisted(() => ({
releaseTurnLock: vi.fn(),
answerQuestion: vi.fn(),
createLauncher: vi.fn(),
+ createTaskLauncher: vi.fn(),
launchTask: vi.fn(),
findSession: vi.fn(),
findInstallation: vi.fn(),
@@ -56,18 +57,18 @@ vi.mock('@roomote/cloud-agents/server', () => ({
answerFastAgentQuestion: mocks.answerQuestion,
resolveApiBaseUrl: () => 'https://roomote.example.com',
fastAgentConversationRepository: { findById: mocks.findSession },
- createFastAgentTaskLauncher:
- ({
- buildTask,
- }: {
- buildTask: (input: {
- prompt: string;
- environmentId: string | null;
- model?: string | null;
- parentSessionId: string;
- }) => unknown | Promise;
- }) =>
- async (input: {
+ createFastAgentTaskLauncher: (params: {
+ initiator: unknown;
+ buildTask: (input: {
+ prompt: string;
+ environmentId: string | null;
+ model?: string | null;
+ parentSessionId: string;
+ }) => unknown | Promise;
+ }) => {
+ mocks.createTaskLauncher(params);
+ const { buildTask } = params;
+ return async (input: {
prompt: string;
environmentId: string | null;
model?: string | null;
@@ -82,7 +83,8 @@ vi.mock('@roomote/cloud-agents/server', () => ({
await input.postKickoff({ taskId: 'child-task-1', taskUrl });
await mocks.enqueueTask({ task });
return { success: true, taskId: 'child-task-1', taskUrl };
- },
+ };
+ },
}));
vi.mock('@roomote/db/server', () => ({
@@ -445,6 +447,45 @@ describe('deliverFastAgentParentEvent', () => {
expect(mocks.createDiscordProvider).not.toHaveBeenCalled();
});
+ it('fails closed when a staged automation-owned session reaches execution', async () => {
+ mocks.findSession.mockResolvedValueOnce({
+ id: parent.sessionId,
+ userId: null,
+ owner: { kind: 'automation', automationKey: 'announcer' },
+ conversation: {
+ surface: 'automation',
+ workspaceId: 'announcer',
+ conversationId: 'occurrence-1',
+ },
+ compatibilityMessages: [],
+ openCodeSessionId: null,
+ });
+
+ await expect(
+ deliverFastAgentParentEvent({
+ parent: {
+ sessionId: parent.sessionId,
+ conversation: {
+ surface: 'automation',
+ workspaceId: 'announcer',
+ conversationId: 'occurrence-1',
+ },
+ },
+ event: {
+ type: 'automation_triggered',
+ eventId: 'occurrence-1',
+ automationId: 'announcer',
+ automationName: 'Summarize merged PRs',
+ prompt: 'Summarize merged pull requests.',
+ trigger: 'schedule',
+ },
+ }),
+ ).rejects.toThrow(
+ 'Automation-owned Fast execution is staged for the next release.',
+ );
+ expect(mocks.answerQuestion).not.toHaveBeenCalled();
+ });
+
it('updates the Slack root for a channel-backed automation turn', async () => {
await deliverFastAgentParentEvent({
parent,
@@ -651,7 +692,7 @@ describe('deliverFastAgentParentEvent', () => {
await adapter.resolveMcpServerConfigs();
return adapter.launchTask({
prompt: 'Inspect the repository.',
- environmentId: null,
+ environmentId: 'agent-selected-environment',
parentSessionId: automationParent.sessionId,
postKickoff: vi.fn(),
});
@@ -668,6 +709,7 @@ describe('deliverFastAgentParentEvent', () => {
prompt: 'Find actionable regressions.',
trigger: 'schedule',
defaultTaskModel: 'openai/gpt-5.6-luna',
+ taskEnvironmentId: 'configured-automation-environment',
},
});
@@ -676,11 +718,15 @@ describe('deliverFastAgentParentEvent', () => {
apiBaseUrl: 'https://roomote.example.com',
includeRoomoteMemberTools: true,
});
+ expect(mocks.createTaskLauncher).toHaveBeenCalledWith(
+ expect.objectContaining({ initiator: { kind: 'user', userId: 'u1' } }),
+ );
expect(mocks.enqueueTask).toHaveBeenCalledWith({
task: expect.objectContaining({
payload: expect.objectContaining({
fastAgentSessionId: automationParent.sessionId,
fastAgentParent: automationParent,
+ environmentId: 'configured-automation-environment',
harnessModelOverrides: {
'opencode-server': 'openai/gpt-5.6-luna',
},
diff --git a/packages/sdk/src/server/lib/fast-agent-parent-event.ts b/packages/sdk/src/server/lib/fast-agent-parent-event.ts
index a0cb12acf..a1b3dba6b 100644
--- a/packages/sdk/src/server/lib/fast-agent-parent-event.ts
+++ b/packages/sdk/src/server/lib/fast-agent-parent-event.ts
@@ -9,6 +9,7 @@ import {
fastAgentConversationRepository,
resolveApiBaseUrl,
type FastAgentTurnAdapter,
+ type FastAgentConversationRecord,
type LaunchFastAgentTask,
} from '@roomote/cloud-agents/server';
import { buildCommunicationTaskThreadName } from '@roomote/communication/task-thread-title';
@@ -79,6 +80,18 @@ import {
const EXITED_RUN_STATUSES = new Set(exitedRunStatuses);
+function requireFastAgentHumanUserId(
+ session: FastAgentConversationRecord,
+): string {
+ if (!session.userId) {
+ throw new FastAgentParentEventDeliveryError(
+ 'Automation-owned Fast execution is staged for the next release.',
+ { replyPosted: false, permanent: true },
+ );
+ }
+ return session.userId;
+}
+
/** Deterministic uuid-shaped Slack client_msg_id so a retried delivery of the
* same event posts with the same idempotency key instead of duplicating. */
export function buildSlackClientMessageId(seed: string): string {
@@ -124,6 +137,8 @@ export type FastAgentParentEvent =
prompt: string;
trigger: 'schedule' | 'manual';
defaultTaskModel?: string;
+ /** Enforced scope for sandbox tasks delegated by this automation. */
+ taskEnvironmentId?: string;
rootMessageId?: string;
}
| {
@@ -344,11 +359,6 @@ function createFastAgentAutomationTaskLauncher(params: {
conversation: Extract;
event: FastAgentParentEvent;
}): LaunchFastAgentTask {
- const automationName =
- params.event.type === 'automation_triggered'
- ? params.event.automationName
- : 'Custom automation';
-
return createFastAgentTaskLauncher({
userId: params.userId,
surface: 'system',
@@ -358,12 +368,8 @@ function createFastAgentAutomationTaskLauncher(params: {
: 'schedule',
taskUrlCampaign: 'fast-automation-delegation',
initiator: {
- kind: 'automation',
- key: 'custom_automation',
- actor: {
- externalId: params.conversation.workspaceId,
- displayName: automationName,
- },
+ userId: params.userId,
+ kind: 'user',
},
afterKickoff: async (taskRun) => {
await db
@@ -424,11 +430,11 @@ async function createAutomationFastAgentParentTurn(params: {
}
return {
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation: session.conversation,
adapter: {
launchTask: createFastAgentAutomationTaskLauncher({
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation: session.conversation,
event: params.event,
}),
@@ -461,11 +467,11 @@ async function createWebFastAgentParentTurn(params: {
}
return {
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation: session.conversation,
adapter: {
launchTask: createFastAgentWebTaskLauncher({
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation: session.conversation,
}),
// Web replies are read from the canonical transcript; posting is the
@@ -528,12 +534,12 @@ async function createSlackFastAgentParentTurn(params: {
}
return {
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation,
adapter: {
launchTask: createFastAgentSlackLiveTaskLauncher({
slack,
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
teamId: conversation.workspaceId,
...(installation.teamDomain
? { teamDomain: installation.teamDomain }
@@ -602,7 +608,7 @@ async function createSlackFastAgentParentTurn(params: {
threadTs:
params.event.rootMessageId ?? conversation.replyTarget.threadId,
eventId: params.event.eventId,
- createdByUserId: session.userId,
+ createdByUserId: requireFastAgentHumanUserId(session),
suggestions,
});
}
@@ -853,12 +859,12 @@ async function createDiscordFastAgentParentTurn(params: {
const conversation = session.conversation;
return {
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation,
adapter: {
launchTask: createFastAgentDiscordTaskLauncher({
provider,
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation,
}),
postReply: async ({
@@ -931,7 +937,7 @@ async function createDiscordFastAgentParentTurn(params: {
? { threadId: conversation.replyTarget.threadId }
: {}),
eventId: params.event.eventId,
- createdByUserId: session.userId,
+ createdByUserId: requireFastAgentHumanUserId(session),
suggestions,
});
}
@@ -1062,11 +1068,11 @@ async function createTeamsFastAgentParentTurn(params: {
);
}
return {
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation,
adapter: {
launchTask: createFastAgentCommunicationTaskLauncher({
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation,
serviceUrl,
}),
@@ -1116,7 +1122,7 @@ async function createTeamsFastAgentParentTurn(params: {
? { threadId: conversation.replyTarget.threadId }
: {}),
eventId: params.event.eventId,
- createdByUserId: session.userId,
+ createdByUserId: requireFastAgentHumanUserId(session),
suggestions,
});
}
@@ -1149,7 +1155,7 @@ async function createTeamsFastAgentParentTurn(params: {
? { threadId: conversation.replyTarget.threadId }
: {}),
eventId: params.event.eventId,
- createdByUserId: session.userId,
+ createdByUserId: requireFastAgentHumanUserId(session),
suggestions,
});
}
@@ -1189,11 +1195,11 @@ async function createTelegramFastAgentParentTurn(params: {
}
const conversation = session.conversation;
return {
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation,
adapter: {
launchTask: createFastAgentCommunicationTaskLauncher({
- userId: session.userId,
+ userId: requireFastAgentHumanUserId(session),
conversation,
}),
postReply: async ({
@@ -1235,7 +1241,7 @@ async function createTelegramFastAgentParentTurn(params: {
? { threadId: conversation.replyTarget.threadId }
: {}),
eventId: params.event.eventId,
- createdByUserId: session.userId,
+ createdByUserId: requireFastAgentHumanUserId(session),
suggestions,
});
}
@@ -1316,13 +1322,23 @@ export async function deliverFastAgentParentEvent(params: {
params.event.type === 'automation_triggered'
? params.event.defaultTaskModel
: undefined;
- const launchTask = defaultTaskModel
- ? (input: Parameters[0]) =>
- parentTurn.adapter.launchTask({
- ...input,
- model: input.model ?? defaultTaskModel,
- })
- : parentTurn.adapter.launchTask;
+ const taskEnvironmentId =
+ params.event.type === 'automation_triggered'
+ ? params.event.taskEnvironmentId
+ : undefined;
+ const launchTask =
+ defaultTaskModel || taskEnvironmentId
+ ? (input: Parameters[0]) =>
+ parentTurn.adapter.launchTask({
+ ...input,
+ ...(defaultTaskModel
+ ? { model: input.model ?? defaultTaskModel }
+ : {}),
+ ...(taskEnvironmentId
+ ? { environmentId: taskEnvironmentId }
+ : {}),
+ })
+ : parentTurn.adapter.launchTask;
// The same base URL must reach both the config resolver and the broker:
// the broker only injects its auth header on deployment-proxy URLs whose
// origin matches its own apiBaseUrl, so a mismatched pair silently drops
diff --git a/packages/types/src/__tests__/automation-task-launch-policy.test.ts b/packages/types/src/__tests__/automation-task-launch-policy.test.ts
new file mode 100644
index 000000000..305ee92f3
--- /dev/null
+++ b/packages/types/src/__tests__/automation-task-launch-policy.test.ts
@@ -0,0 +1,76 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ AUTOMATION_OWNED_FAST_SESSION_WRITES_ENABLED,
+ AUTOMATION_TASK_LAUNCH_POLICIES,
+ resolveAutomationTaskLaunchMode,
+} from '../automation-task-launch-policy';
+
+describe('automation task launch policies', () => {
+ it('keeps automation-owned Fast Session writes disabled for release N', () => {
+ expect(AUTOMATION_OWNED_FAST_SESSION_WRITES_ENABLED).toBe(false);
+ });
+
+ it('keeps a complete, uniquely identified launcher inventory', () => {
+ expect(AUTOMATION_TASK_LAUNCH_POLICIES.map(({ id }) => id)).toEqual([
+ 'custom_automation',
+ 'scheduled_triage_scan',
+ 'merged_pr_audit_scan',
+ 'suggester_scan',
+ 'announcer',
+ 'conflict_resolution',
+ 'ci_failure_triage',
+ 'issue_fixer',
+ 'automation_work_item',
+ 'pr_review',
+ 'chat_channel_auto_start',
+ 'slack_workflow',
+ 'snapshot_refresh',
+ 'mcp_recommendations',
+ 'onboarding_suggestion_scan',
+ 'deployment_ci_probe',
+ ]);
+ expect(
+ new Set(
+ AUTOMATION_TASK_LAUNCH_POLICIES.flatMap(({ launchSites }) =>
+ launchSites.map((site) => site),
+ ),
+ ).size,
+ ).toBe(
+ AUTOMATION_TASK_LAUNCH_POLICIES.reduce(
+ (count, { launchSites }) => count + launchSites.length,
+ 0,
+ ),
+ );
+ for (const policy of AUTOMATION_TASK_LAUNCH_POLICIES) {
+ expect(policy.automationKeys.length).toBeGreaterThan(0);
+ expect(policy.launchSites.length).toBeGreaterThan(0);
+ expect(policy.reason.length).toBeGreaterThan(40);
+ }
+ });
+
+ it('starts only owned custom automations as Fast Sessions', () => {
+ expect(
+ resolveAutomationTaskLaunchMode({
+ policyId: 'custom_automation',
+ runAsUserId: 'user-1',
+ }),
+ ).toBe('fast_session');
+ expect(
+ resolveAutomationTaskLaunchMode({
+ policyId: 'custom_automation',
+ runAsUserId: null,
+ }),
+ ).toBe('sandbox_task');
+
+ for (const policy of AUTOMATION_TASK_LAUNCH_POLICIES) {
+ if (policy.id === 'custom_automation') continue;
+ expect(
+ resolveAutomationTaskLaunchMode({
+ policyId: policy.id,
+ runAsUserId: 'user-1',
+ }),
+ ).toBe('sandbox_task');
+ }
+ });
+});
diff --git a/packages/types/src/__tests__/background-automation-registry.test.ts b/packages/types/src/__tests__/background-automation-registry.test.ts
index 85b983db4..5eec3bdfa 100644
--- a/packages/types/src/__tests__/background-automation-registry.test.ts
+++ b/packages/types/src/__tests__/background-automation-registry.test.ts
@@ -155,4 +155,42 @@ describe('background automation registry', () => {
'gitea',
]);
});
+
+ it('classifies every triggerable automation that launches sandbox tasks', () => {
+ expect(
+ (
+ [
+ 'conflict_resolver',
+ 'suggester',
+ 'announcer',
+ 'manager_stats',
+ 'provider_usage_limit',
+ 'sentry_triage',
+ 'dependabot_triage',
+ 'codeql_triage',
+ 'issue_fixer',
+ 'security_auditor',
+ 'code_quality_auditor',
+ 'ci_failure_triage',
+ ] as const
+ ).map((key) => [
+ key,
+ getTriggerableBackgroundAutomationDescriptorByKey(key)
+ ?.taskLaunchPolicyId,
+ ]),
+ ).toEqual([
+ ['conflict_resolver', 'conflict_resolution'],
+ ['suggester', 'suggester_scan'],
+ ['announcer', 'announcer'],
+ ['manager_stats', null],
+ ['provider_usage_limit', null],
+ ['sentry_triage', 'scheduled_triage_scan'],
+ ['dependabot_triage', 'scheduled_triage_scan'],
+ ['codeql_triage', 'scheduled_triage_scan'],
+ ['issue_fixer', 'issue_fixer'],
+ ['security_auditor', 'merged_pr_audit_scan'],
+ ['code_quality_auditor', 'merged_pr_audit_scan'],
+ ['ci_failure_triage', 'ci_failure_triage'],
+ ]);
+ });
});
diff --git a/packages/types/src/automation-task-launch-policy.ts b/packages/types/src/automation-task-launch-policy.ts
new file mode 100644
index 000000000..246cca50e
--- /dev/null
+++ b/packages/types/src/automation-task-launch-policy.ts
@@ -0,0 +1,227 @@
+import type { BackgroundAutomationKey } from './background-agents';
+
+/** Release-N gate: schema/read support ships now; ownerless writes start N+1. */
+export const AUTOMATION_OWNED_FAST_SESSION_WRITES_ENABLED = false;
+
+export type AutomationTaskLaunchPolicyId =
+ | 'custom_automation'
+ | 'scheduled_triage_scan'
+ | 'merged_pr_audit_scan'
+ | 'suggester_scan'
+ | 'announcer'
+ | 'conflict_resolution'
+ | 'ci_failure_triage'
+ | 'issue_fixer'
+ | 'automation_work_item'
+ | 'pr_review'
+ | 'chat_channel_auto_start'
+ | 'slack_workflow'
+ | 'snapshot_refresh'
+ | 'mcp_recommendations'
+ | 'onboarding_suggestion_scan'
+ | 'deployment_ci_probe';
+
+type AutomationTaskLaunchPolicy = {
+ id: AutomationTaskLaunchPolicyId;
+ automationKeys: readonly BackgroundAutomationKey[];
+ launchSites: readonly string[];
+} & (
+ | {
+ mode: 'owned_fast_session';
+ ownerlessFallback: 'legacy_sandbox_task';
+ reason: string;
+ }
+ | {
+ mode: 'sandbox_task';
+ reason: string;
+ }
+);
+
+/**
+ * Complete inventory of production automation paths that can create a fresh
+ * sandbox task. Fast eligibility is explicit here so reviews can distinguish
+ * owned conversational runs from system workflows that require a task.
+ */
+export const AUTOMATION_TASK_LAUNCH_POLICIES = [
+ {
+ id: 'custom_automation',
+ automationKeys: ['custom_automation'],
+ launchSites: ['packages/sdk/src/server/automations/custom-automations.ts'],
+ mode: 'owned_fast_session',
+ ownerlessFallback: 'legacy_sandbox_task',
+ reason:
+ 'Custom automation rows persist createdByUserId, so owned runs can authorize a Fast Session; legacy rows whose owner was deleted retain their previous sandbox path.',
+ },
+ {
+ id: 'scheduled_triage_scan',
+ automationKeys: ['sentry_triage', 'dependabot_triage', 'codeql_triage'],
+ launchSites: [
+ 'packages/sdk/src/server/automations/scheduled-triage-runner.ts',
+ ],
+ mode: 'sandbox_task',
+ reason:
+ 'These deployment-owned hidden Scan tasks have no run-as user and produce machine-consumed automation work items.',
+ },
+ {
+ id: 'merged_pr_audit_scan',
+ automationKeys: ['security_auditor', 'code_quality_auditor'],
+ launchSites: [
+ 'packages/sdk/src/server/automations/merged-pr-audit-runner.ts',
+ ],
+ mode: 'sandbox_task',
+ reason:
+ 'These deployment-owned hidden Scan tasks have no run-as user and preserve provider-partitioned audit cursors and machine-consumed work items.',
+ },
+ {
+ id: 'suggester_scan',
+ automationKeys: ['suggester'],
+ launchSites: ['packages/sdk/src/server/automations/suggester-dispatch.ts'],
+ mode: 'sandbox_task',
+ reason:
+ 'The deployment-owned hidden Scan task has no run-as user and feeds the structured suggestion pipeline.',
+ },
+ {
+ id: 'announcer',
+ automationKeys: ['announcer'],
+ launchSites: ['packages/sdk/src/server/automations/announcer.ts'],
+ mode: 'sandbox_task',
+ reason:
+ 'The announcer is deployment-owned and has no persisted user whose integrations and credentials can authorize a Fast Session.',
+ },
+ {
+ id: 'conflict_resolution',
+ automationKeys: ['conflict_resolver'],
+ launchSites: [
+ 'packages/sdk/src/server/automations/conflict-scan.ts',
+ 'apps/api/src/handlers/github/conflict-resolution/process-candidates.ts',
+ ],
+ mode: 'sandbox_task',
+ reason:
+ 'Conflict resolution always requires repository execution and specialized pr_conflict_resolve payload, PR linkage, and deduplication contracts.',
+ },
+ {
+ id: 'ci_failure_triage',
+ automationKeys: ['ci_failure_triage'],
+ launchSites: [
+ 'packages/sdk/src/server/automations/ci-failure-triage.ts',
+ 'packages/sdk/src/server/automations/ci-failure-triage-launch.ts',
+ ],
+ mode: 'sandbox_task',
+ reason:
+ 'CI triage is deployment-owned, always requires workspace investigation, and carries fingerprint claims plus webhook announcement-thread state.',
+ },
+ {
+ id: 'issue_fixer',
+ automationKeys: ['issue_fixer'],
+ launchSites: ['apps/api/src/handlers/shared/issue-fixer-launch.ts'],
+ mode: 'sandbox_task',
+ reason:
+ 'Issue fixing is deployment-owned, always requires repository inspection, and must preserve provider issue-comment delivery semantics.',
+ },
+ {
+ id: 'automation_work_item',
+ automationKeys: [
+ 'sentry_triage',
+ 'dependabot_triage',
+ 'codeql_triage',
+ 'security_auditor',
+ 'code_quality_auditor',
+ 'ci_failure_triage',
+ ],
+ launchSites: [
+ 'apps/api/src/handlers/tasks/automation-work-items/launch.ts',
+ ],
+ mode: 'sandbox_task',
+ reason:
+ 'Accepted work items are explicit repository implementation requests with launch claims and linked-task finalization, so a sandbox is required rather than optional.',
+ },
+ {
+ id: 'pr_review',
+ automationKeys: ['review_code'],
+ launchSites: [
+ 'apps/api/src/handlers/github/handlePrOpen.ts',
+ 'apps/api/src/handlers/github/handlePrSynchronize.ts',
+ 'apps/api/src/handlers/gitlab/handleMergeRequest.ts',
+ 'apps/api/src/handlers/gitea/handlePullRequest.ts',
+ 'apps/api/src/handlers/bitbucket/handlePullRequest.ts',
+ 'apps/api/src/handlers/ado/handlePullRequest.ts',
+ 'apps/bullmq/src/jobs/active-pr-review-follow-up.ts',
+ ],
+ mode: 'sandbox_task',
+ reason:
+ 'Automated PR reviews are deployment-owned and require specialized review payload, PR linkage, check publication, and follow-up deduplication.',
+ },
+ {
+ id: 'chat_channel_auto_start',
+ automationKeys: ['slack_channel_auto_start'],
+ launchSites: [
+ 'apps/api/src/handlers/slack/events/message-entry.ts',
+ 'apps/api/src/handlers/discord/channel-auto-start.ts',
+ ],
+ mode: 'sandbox_task',
+ reason:
+ 'Only bot, webhook, or relay-authored channel events use the automation path; they have external attribution but no mapped Roomote run-as user.',
+ },
+ {
+ id: 'slack_workflow',
+ automationKeys: ['slack_workflow'],
+ launchSites: ['apps/api/src/handlers/slack/events/function-executed.ts'],
+ mode: 'sandbox_task',
+ reason:
+ 'Prompt-author-owned Slack workflow runs already use a user launch; the automation fallback is used only when no mapped prompt author exists.',
+ },
+ {
+ id: 'snapshot_refresh',
+ automationKeys: ['snapshot_refresh'],
+ launchSites: ['apps/bullmq/src/scheduled-jobs/refresh-snapshots.ts'],
+ mode: 'sandbox_task',
+ reason:
+ 'Snapshot refresh exists to execute sandbox snapshot lifecycle work and cannot complete without compute.',
+ },
+ {
+ id: 'mcp_recommendations',
+ automationKeys: ['mcp_recommendations'],
+ launchSites: ['apps/web/src/trpc/commands/setup/index.ts'],
+ mode: 'sandbox_task',
+ reason:
+ 'MCP recommendations run inside setup against a selected environment and have no persisted automation owner.',
+ },
+ {
+ id: 'onboarding_suggestion_scan',
+ automationKeys: ['suggester'],
+ launchSites: ['apps/web/src/trpc/commands/task-suggestions/onboarding.ts'],
+ mode: 'sandbox_task',
+ reason:
+ 'This user-owned setup scan writes machine-consumed onboarding suggestion state and requires the selected repository workspace rather than an optional sandbox.',
+ },
+ {
+ id: 'deployment_ci_probe',
+ automationKeys: ['suggester'],
+ launchSites: [
+ 'packages/cloud-agents/src/server/deployment-ci-launch-task.ts',
+ ],
+ mode: 'sandbox_task',
+ reason:
+ 'The deployment probe exists specifically to start and verify Docker sandbox compute.',
+ },
+] as const satisfies readonly AutomationTaskLaunchPolicy[];
+
+const AUTOMATION_TASK_LAUNCH_POLICY_BY_ID = new Map(
+ AUTOMATION_TASK_LAUNCH_POLICIES.map((policy) => [policy.id, policy]),
+);
+
+export function resolveAutomationTaskLaunchMode(params: {
+ policyId: AutomationTaskLaunchPolicyId;
+ runAsUserId?: string | null;
+}): 'fast_session' | 'sandbox_task' {
+ const policy = AUTOMATION_TASK_LAUNCH_POLICY_BY_ID.get(params.policyId);
+ if (!policy) {
+ throw new Error(
+ `Unknown automation task launch policy: ${params.policyId}`,
+ );
+ }
+
+ return policy.mode === 'owned_fast_session' && params.runAsUserId
+ ? 'fast_session'
+ : 'sandbox_task';
+}
diff --git a/packages/types/src/background-automation-registry.ts b/packages/types/src/background-automation-registry.ts
index 83fd8c148..6eccf9820 100644
--- a/packages/types/src/background-automation-registry.ts
+++ b/packages/types/src/background-automation-registry.ts
@@ -17,6 +17,7 @@ import type { CommunicationProvider } from './communication';
import { sourceControlProviders } from './source-control';
import type { SourceControlProvider } from './source-control';
import type { TaskSuggestionSource } from './task-runs';
+import type { AutomationTaskLaunchPolicyId } from './automation-task-launch-policy';
export const AUTO_RESPOND_CHANNELS_SETTINGS_HASH = 'auto-respond-channels';
export const MANAGER_CHANNEL_SETTINGS_HASH = 'roomote-managers';
@@ -87,6 +88,8 @@ export type TriggerableBackgroundAutomationDescriptor<
*/
supportedSourceControlProviders: readonly SourceControlProvider[];
scheduledSuggestionSource?: TaskSuggestionSource;
+ /** Policy for fresh sandbox tasks launched by this automation, if any. */
+ taskLaunchPolicyId: AutomationTaskLaunchPolicyId | null;
};
const CONFLICT_RESOLVER_SCHEDULE_MODES = [
@@ -152,6 +155,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
usesManagerChannel: false,
supportedCommunicationProviders: [],
supportedSourceControlProviders: ['github', 'gitlab', 'ado', 'gitea'],
+ taskLaunchPolicyId: 'conflict_resolution',
},
{
automationKey: 'suggester',
@@ -166,6 +170,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
supportedCommunicationProviders: ['slack', 'teams', 'telegram', 'discord'],
supportedSourceControlProviders: sourceControlProviders,
scheduledSuggestionSource: 'suggest_ideas',
+ taskLaunchPolicyId: 'suggester_scan',
},
{
automationKey: 'announcer',
@@ -177,6 +182,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
usesManagerChannel: true,
supportedCommunicationProviders: ['slack', 'teams', 'telegram', 'discord'],
supportedSourceControlProviders: sourceControlProviders,
+ taskLaunchPolicyId: 'announcer',
},
{
automationKey: 'manager_stats',
@@ -189,6 +195,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
usesManagerChannel: true,
supportedCommunicationProviders: ['slack', 'teams', 'telegram', 'discord'],
supportedSourceControlProviders: sourceControlProviders,
+ taskLaunchPolicyId: null,
},
{
automationKey: 'provider_usage_limit',
@@ -199,6 +206,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
usesManagerChannel: true,
supportedCommunicationProviders: ['slack', 'teams', 'telegram', 'discord'],
supportedSourceControlProviders: [],
+ taskLaunchPolicyId: null,
},
{
automationKey: 'sentry_triage',
@@ -210,6 +218,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
supportedCommunicationProviders: ['slack', 'teams', 'telegram', 'discord'],
supportedSourceControlProviders: sourceControlProviders,
scheduledSuggestionSource: 'sentry_triage',
+ taskLaunchPolicyId: 'scheduled_triage_scan',
},
{
automationKey: 'dependabot_triage',
@@ -221,6 +230,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
supportedCommunicationProviders: ['slack', 'teams', 'telegram', 'discord'],
supportedSourceControlProviders: ['github'],
scheduledSuggestionSource: 'dependabot_triage',
+ taskLaunchPolicyId: 'scheduled_triage_scan',
},
{
automationKey: 'codeql_triage',
@@ -232,6 +242,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
supportedCommunicationProviders: ['slack', 'teams', 'telegram', 'discord'],
supportedSourceControlProviders: ['github'],
scheduledSuggestionSource: 'codeql_triage',
+ taskLaunchPolicyId: 'scheduled_triage_scan',
},
{
automationKey: 'issue_fixer',
@@ -247,6 +258,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
usesManagerChannel: false,
supportedCommunicationProviders: [],
supportedSourceControlProviders: ['github', 'gitlab', 'gitea'],
+ taskLaunchPolicyId: 'issue_fixer',
},
{
automationKey: 'security_auditor',
@@ -259,6 +271,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
supportedCommunicationProviders: ['slack', 'teams', 'telegram', 'discord'],
supportedSourceControlProviders: sourceControlProviders,
scheduledSuggestionSource: 'security_auditor',
+ taskLaunchPolicyId: 'merged_pr_audit_scan',
},
{
automationKey: 'code_quality_auditor',
@@ -271,6 +284,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
supportedCommunicationProviders: ['slack', 'teams', 'telegram', 'discord'],
supportedSourceControlProviders: sourceControlProviders,
scheduledSuggestionSource: 'code_quality_auditor',
+ taskLaunchPolicyId: 'merged_pr_audit_scan',
},
{
automationKey: 'ci_failure_triage',
@@ -292,6 +306,7 @@ export const TRIGGERABLE_BACKGROUND_AUTOMATION_DESCRIPTORS = [
'gitea',
],
scheduledSuggestionSource: 'ci_failure_triage',
+ taskLaunchPolicyId: 'ci_failure_triage',
},
] as const satisfies readonly TriggerableBackgroundAutomationDescriptor[];
diff --git a/packages/types/src/fast-agent.ts b/packages/types/src/fast-agent.ts
index 4558f53be..0b62e825f 100644
--- a/packages/types/src/fast-agent.ts
+++ b/packages/types/src/fast-agent.ts
@@ -1,5 +1,7 @@
import { z } from 'zod';
+import { BACKGROUND_AUTOMATION_KEYS } from './background-agents';
+
export const fastAgentSurfaces = [
'slack',
'discord',
@@ -12,6 +14,18 @@ export const fastAgentSurfaceSchema = z.enum(fastAgentSurfaces);
export type FastAgentSurface = z.infer;
+export const fastAgentConversationOwnerSchema = z.discriminatedUnion('kind', [
+ z.object({ kind: z.literal('user'), userId: z.string().min(1) }),
+ z.object({
+ kind: z.literal('automation'),
+ automationKey: z.enum(BACKGROUND_AUTOMATION_KEYS),
+ }),
+]);
+
+export type FastAgentConversationOwner = z.infer<
+ typeof fastAgentConversationOwnerSchema
+>;
+
export const fastAgentReplyTargetSchema = z.object({
channelId: z.string().min(1),
threadId: z.string().min(1).optional(),
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 2bc249120..c86797715 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -6,6 +6,7 @@ export * from './auth';
export * from './automation-label';
export * from './background-agents';
export * from './background-automation-registry';
+export * from './automation-task-launch-policy';
export * from './automation-recommendations';
export * from './automation-destination-fields';
export * from './cloud-agents';
diff --git a/packages/types/src/manage-custom-automations-tool.test.ts b/packages/types/src/manage-custom-automations-tool.test.ts
index 80ca11422..3cde765ec 100644
--- a/packages/types/src/manage-custom-automations-tool.test.ts
+++ b/packages/types/src/manage-custom-automations-tool.test.ts
@@ -23,11 +23,11 @@ describe('manage custom automations tool contract', () => {
'Admin-only management of deployment custom automations.',
);
expect(MANAGE_CUSTOM_AUTOMATIONS_TOOL.description).toContain(
- 'run the automation in Fast mode',
+ 'Every run starts as a Fast Session',
);
expect(
MANAGE_CUSTOM_AUTOMATIONS_TOOL.inputSchema.environmentId.description,
- ).toContain('Fast mode without an initial sandbox task');
+ ).toContain('Execution scope for tasks delegated by the Fast Session');
expect(
MANAGE_CUSTOM_AUTOMATIONS_TOOL.inputSchema.schedule.description,
).toContain('off, every_hour, every_6_hours, daily, weekly');
diff --git a/packages/types/src/manage-custom-automations-tool.ts b/packages/types/src/manage-custom-automations-tool.ts
index c3347d628..5c6bf74cc 100644
--- a/packages/types/src/manage-custom-automations-tool.ts
+++ b/packages/types/src/manage-custom-automations-tool.ts
@@ -43,7 +43,7 @@ export const manageCustomAutomationsFieldSchemas = {
environmentId: z
.string()
.describe(
- `Environment UUID, "${ALL_REPOSITORIES}", or "${FAST_EXECUTION}" for Fast mode without an initial sandbox task.`,
+ `Execution scope for tasks delegated by the Fast Session: an environment UUID, "${ALL_REPOSITORIES}" for every active repository, or "${FAST_EXECUTION}" to leave the task environment unconfigured.`,
)
.optional(),
targetProvider: z
@@ -174,7 +174,7 @@ export function buildManageCustomAutomationsRequest(
export const MANAGE_CUSTOM_AUTOMATIONS_TOOL = {
name: 'manage_custom_automations',
title: 'Manage Custom Automations',
- description: `Admin-only management of deployment custom automations. List existing automations or enabled task models, resolve a cron or natural-language schedule, create or update an automation, delete an automation by exact ID, or run an enabled automation now. Pass environmentId "${FAST_EXECUTION}" to run the automation in Fast mode without starting a sandbox; Fast may still delegate a task when repository or workspace execution is required. Use list_models before setting a model override; create and update accept only exact model IDs returned by that action. Model IDs encode the inference route: for example, openrouter/... targets OpenRouter, while openai/... uses the deployment OpenAI route, including a connected ChatGPT subscription when configured. When the user asks an automation to DM them, set their preferred connected targetProvider and targetMode to direct_message; no targetChannelId is needed. Natural-language schedules are converted to validated five-field cron in the deployment scheduling timezone. Keep cadence only in the schedule field; do not repeat it in the stored prompt. When a user asks an automation to offer help, suggest tasks, make follow-ups actionable or launchable, or turn findings or action items into tasks, encode that intent in product language by instructing the automation to post concrete actions as launchable suggested tasks alongside its report. Do not expose runtime tool names or parameter syntax in the stored prompt. A request only to summarize or list action items is not suggested-task intent. Only promise launchable suggested tasks when the automation has both a configured chat report destination and a repository or environment for executable work; otherwise keep actions as report text and explain the missing capability. After successfully creating an automation in response to a conversational request, ask the user whether they want to run it now to test it.`,
+ description: `Admin-only management of deployment custom automations. List existing automations or enabled task models, resolve a cron or natural-language schedule, create or update an automation, delete an automation by exact ID, or run an enabled automation now. Every run starts as a Fast Session and may delegate a sandbox task only when repository or workspace execution is required. The configured environmentId scopes delegated tasks; pass "${FAST_EXECUTION}" to leave their environment unconfigured. Use list_models before setting a model override; create and update accept only exact model IDs returned by that action. Model IDs encode the inference route: for example, openrouter/... targets OpenRouter, while openai/... uses the deployment OpenAI route, including a connected ChatGPT subscription when configured. When the user asks an automation to DM them, set their preferred connected targetProvider and targetMode to direct_message; no targetChannelId is needed. Natural-language schedules are converted to validated five-field cron in the deployment scheduling timezone. Keep cadence only in the schedule field; do not repeat it in the stored prompt. When a user asks an automation to offer help, suggest tasks, make follow-ups actionable or launchable, or turn findings or action items into tasks, encode that intent in product language by instructing the automation to post concrete actions as launchable suggested tasks alongside its report. Do not expose runtime tool names or parameter syntax in the stored prompt. A request only to summarize or list action items is not suggested-task intent. Only promise launchable suggested tasks when the automation has both a configured chat report destination and a repository or environment for executable work; otherwise keep actions as report text and explain the missing capability. After successfully creating an automation in response to a conversational request, ask the user whether they want to run it now to test it.`,
inputSchema: manageCustomAutomationsFieldSchemas,
annotations: {
readOnlyHint: false,