diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 06bce83a52..7e4c9b51ec 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -137,6 +137,9 @@ jobs:
- name: Build trpc types
run: pnpm --filter @kilocode/trpc run build
+ - name: Build harness SDK
+ run: pnpm --filter @kilocode/harness-sdk run build
+
- name: Lint
run: scripts/lint-all.sh
@@ -412,6 +415,12 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
+ # apps/mobile tests the app against the built harness SDK, the way it
+ # already runs against built trpc types.
+ - name: Build harness SDK
+ if: matrix.workspace.name == 'kilo-app'
+ run: pnpm --filter @kilocode/harness-sdk run build
+
- name: Run tests
run: pnpm --filter ${{ matrix.workspace.name }} test
diff --git a/.github/workflows/kilo-app-ci.yml b/.github/workflows/kilo-app-ci.yml
index 4af383da43..ab827ab651 100644
--- a/.github/workflows/kilo-app-ci.yml
+++ b/.github/workflows/kilo-app-ci.yml
@@ -65,6 +65,9 @@ jobs:
- name: Build trpc types
run: pnpm --filter @kilocode/trpc run build
+ - name: Build harness SDK
+ run: pnpm --filter @kilocode/harness-sdk run build
+
- name: Typecheck
run: pnpm --filter kilo-app run typecheck
@@ -96,6 +99,9 @@ jobs:
- name: Build trpc types
run: pnpm --filter @kilocode/trpc run build
+ - name: Build harness SDK
+ run: pnpm --filter @kilocode/harness-sdk run build
+
- name: Lint
run: pnpm --filter kilo-app run lint
@@ -122,6 +128,9 @@ jobs:
- name: Build trpc types
run: pnpm --filter @kilocode/trpc run build
+ - name: Build harness SDK
+ run: pnpm --filter @kilocode/harness-sdk run build
+
- name: Check i18n catalogs and leftover copy
run: pnpm --filter kilo-app run check:i18n
- name: Check for silently-dropped NativeWind classes
@@ -203,5 +212,8 @@ jobs:
- name: Build trpc types
run: pnpm --filter @kilocode/trpc run build
+ - name: Build harness SDK
+ run: pnpm --filter @kilocode/harness-sdk run build
+
- name: Test
run: pnpm --filter kilo-app run test
diff --git a/.github/workflows/mobile-native-build.yml b/.github/workflows/mobile-native-build.yml
index 40e39f6e4b..38867b093d 100644
--- a/.github/workflows/mobile-native-build.yml
+++ b/.github/workflows/mobile-native-build.yml
@@ -137,6 +137,9 @@ jobs:
- name: Build trpc types
run: pnpm --filter @kilocode/trpc run build
+ - name: Build harness SDK
+ run: pnpm --filter @kilocode/harness-sdk run build
+
# A consumer computes the hash on macOS; the gate computed it on
# Linux. A mismatch would publish an artifact nobody can ever find,
# so fail loudly instead. Android is checked here too: it builds on
@@ -225,6 +228,9 @@ jobs:
- name: Build trpc types
run: pnpm --filter @kilocode/trpc run build
+ - name: Build harness SDK
+ run: pnpm --filter @kilocode/harness-sdk run build
+
- name: Expo prebuild
run: CI=1 pnpm --filter kilo-app exec expo prebuild --platform android
diff --git a/apps/mobile/.oxlintrc.json b/apps/mobile/.oxlintrc.json
index b5da29bb3a..e50a34f24f 100644
--- a/apps/mobile/.oxlintrc.json
+++ b/apps/mobile/.oxlintrc.json
@@ -225,6 +225,12 @@
"import/no-nodejs-modules": "off"
}
},
+ {
+ "files": ["src/lib/chat/store.test.ts"],
+ "rules": {
+ "import/no-nodejs-modules": "off"
+ }
+ },
{
"files": ["src/lib/expo-router-linking.mounted.test.tsx"],
"rules": {
diff --git a/apps/mobile/AGENTS.md b/apps/mobile/AGENTS.md
index d3485984cd..0642b2f45a 100644
--- a/apps/mobile/AGENTS.md
+++ b/apps/mobile/AGENTS.md
@@ -110,3 +110,15 @@ The app follows https://github.com/Kilo-Org/kilo-design/ in general, except wher
## Debugging
Add narrow temporary logs at the real boundaries. Reproduce. Read the tmux service logs. Fix the demonstrated cause. Remove the logs. Do not guess, and do not commit debug logging.
+
+## Chat tab
+
+The Chat tab runs `@kilocode/harness-sdk` on the device. `src/lib/chat/` holds the registry (the conversations that are running), the layers (the plugins they run on) and the store (the list and its CRUD). The SDK saves one conversation; this app owns the list, the ordering, the titles, the deleting and the scoping.
+
+**A conversation can move, and the screen follows the state rather than a return value.** Switching models clones the conversation onto a new session, and the mover is not always the screen: a question typed on another model while an answer was arriving moves the chat from inside the registry. So the chat that was left points at the one it became, and `useChat` follows that.
+
+A chat is opened with the SDK's `time` tool and no other. A model has no clock, so it answers a dated question from its training date, confidently and wrong. The other three tools the SDK ships stay off: the composer is already how a person is asked something, a subagent costs a second session, and a to-do list is working memory for a run a chat does not have.
+
+**Prove a chat change against the same eleven models the SDK's live runs use.** The list is in `packages/harness-sdk/e2e/setup.ts`, and `pnpm --filter @kilocode/harness-sdk test:e2e:time full` is the sweep across all of them. Take one of those models through the app itself on the simulator as well: the sweep proves what the models do, the simulator proves this app's wiring, and neither proves the other. Both cost real money, so run the sweep when the tool set or the system prompt changes, not for a change to a screen.
+
+Reading the model picker's accessibility tree in full takes WebDriverAgent down, and the Appium server with it. Drive it by XPath, never `getPageSource`, and cap the snapshot with `driver.updateSettings({ snapshotMaxDepth: 50 })`.
diff --git a/apps/mobile/drizzle/0001_safe_hellfire_club.sql b/apps/mobile/drizzle/0001_safe_hellfire_club.sql
new file mode 100644
index 0000000000..04f1cadc74
--- /dev/null
+++ b/apps/mobile/drizzle/0001_safe_hellfire_club.sql
@@ -0,0 +1,7 @@
+CREATE TABLE `chats` (
+ `session_id` text PRIMARY KEY NOT NULL,
+ `scope` text NOT NULL,
+ `updated_at` integer NOT NULL
+);
+--> statement-breakpoint
+CREATE INDEX `chats_scope_updated_at` ON `chats` (`scope`,`updated_at`);
\ No newline at end of file
diff --git a/apps/mobile/drizzle/meta/0001_snapshot.json b/apps/mobile/drizzle/meta/0001_snapshot.json
new file mode 100644
index 0000000000..96b95c61d8
--- /dev/null
+++ b/apps/mobile/drizzle/meta/0001_snapshot.json
@@ -0,0 +1,104 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "32071253-3838-4db3-aee9-d05b75bc652b",
+ "prevId": "e7d69526-c2d6-4633-b14f-24bcef818f44",
+ "tables": {
+ "chats": {
+ "name": "chats",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "chats_scope_updated_at": {
+ "name": "chats_scope_updated_at",
+ "columns": [
+ "scope",
+ "updated_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "kv": {
+ "name": "kv",
+ "columns": {
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "k": {
+ "name": "k",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "v": {
+ "name": "v",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "kv_scope_k_pk": {
+ "columns": [
+ "scope",
+ "k"
+ ],
+ "name": "kv_scope_k_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
\ No newline at end of file
diff --git a/apps/mobile/drizzle/meta/_journal.json b/apps/mobile/drizzle/meta/_journal.json
index 038ee24956..dcece48abd 100644
--- a/apps/mobile/drizzle/meta/_journal.json
+++ b/apps/mobile/drizzle/meta/_journal.json
@@ -8,6 +8,13 @@
"when": 1786968532800,
"tag": "0000_material_toad",
"breakpoints": true
+ },
+ {
+ "idx": 1,
+ "version": "6",
+ "when": 1788574828397,
+ "tag": "0001_safe_hellfire_club",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/apps/mobile/drizzle/migrations.js b/apps/mobile/drizzle/migrations.js
index 7678d896f4..625fd15585 100644
--- a/apps/mobile/drizzle/migrations.js
+++ b/apps/mobile/drizzle/migrations.js
@@ -2,10 +2,12 @@
import journal from './meta/_journal.json';
import m0000 from './0000_material_toad.sql';
+import m0001 from './0001_safe_hellfire_club.sql';
export default {
journal,
migrations: {
m0000,
+ m0001,
},
};
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 1eb0b3be9a..0df18c0921 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -38,6 +38,7 @@
"@kilocode/app-shared": "workspace:*",
"@kilocode/cloud-agent-sdk": "workspace:*",
"@kilocode/event-service": "workspace:*",
+ "@kilocode/harness-sdk": "workspace:*",
"@kilocode/kilo-chat": "workspace:*",
"@kilocode/kilo-chat-hooks": "workspace:*",
"@kilocode/notifications": "workspace:*",
@@ -58,6 +59,7 @@
"class-variance-authority": "0.7.1",
"clsx": "2.1.1",
"drizzle-orm": "catalog:",
+ "effect": "3.22.1",
"expo": "~57.0.15",
"expo-apple-authentication": "~57.0.1",
"expo-application": "~57.0.2",
diff --git a/apps/mobile/src/app/(app)/(tabs)/(4_chat)/[id].tsx b/apps/mobile/src/app/(app)/(tabs)/(4_chat)/[id].tsx
new file mode 100644
index 0000000000..717648f1a9
--- /dev/null
+++ b/apps/mobile/src/app/(app)/(tabs)/(4_chat)/[id].tsx
@@ -0,0 +1,8 @@
+import { useLocalSearchParams } from 'expo-router';
+
+import { ChatScreen } from '@/components/chat/chat-screen';
+
+export default function ChatConversation() {
+ const { id } = useLocalSearchParams<{ id: string }>();
+ return ;
+}
diff --git a/apps/mobile/src/app/(app)/(tabs)/(4_chat)/_layout.tsx b/apps/mobile/src/app/(app)/(tabs)/(4_chat)/_layout.tsx
index ea2bcd5308..58ddd8614d 100644
--- a/apps/mobile/src/app/(app)/(tabs)/(4_chat)/_layout.tsx
+++ b/apps/mobile/src/app/(app)/(tabs)/(4_chat)/_layout.tsx
@@ -1,5 +1,9 @@
import { Stack } from 'expo-router';
+export const unstable_settings = {
+ initialRouteName: 'index',
+};
+
export default function ChatLayout() {
return ;
}
diff --git a/apps/mobile/src/app/(app)/(tabs)/(4_chat)/index.tsx b/apps/mobile/src/app/(app)/(tabs)/(4_chat)/index.tsx
index ed28d1ac9f..3ec98851c1 100644
--- a/apps/mobile/src/app/(app)/(tabs)/(4_chat)/index.tsx
+++ b/apps/mobile/src/app/(app)/(tabs)/(4_chat)/index.tsx
@@ -1,5 +1,5 @@
-import { QuickChatScreen } from '@/components/quick-chat/quick-chat-screen';
+import { ChatListScreen } from '@/components/chat/chat-list-screen';
-export default function QuickChatIndex() {
- return ;
+export default function ChatIndex() {
+ return ;
}
diff --git a/apps/mobile/src/app/(app)/(tabs)/_layout.tsx b/apps/mobile/src/app/(app)/(tabs)/_layout.tsx
index ae9e60f1cc..122efc35f5 100644
--- a/apps/mobile/src/app/(app)/(tabs)/_layout.tsx
+++ b/apps/mobile/src/app/(app)/(tabs)/_layout.tsx
@@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';
import { StateSurfaceInsets } from '@/components/centered-state-surface';
import { BlurBar } from '@/components/ui/blur-bar';
import { Text } from '@/components/ui/text';
-import { FEATURE_FLAG_QUICK_CHAT, useFeatureFlag } from '@/lib/analytics/posthog';
+import { FEATURE_FLAG_CHAT, useFeatureFlag } from '@/lib/analytics/posthog';
import { PROFILE_TAB_ROOT } from '@/lib/finding-detail-back';
import { useLiveAgentSessions } from '@/lib/hooks/use-agent-sessions';
import { useKiloClawTabVisible } from '@/lib/hooks/use-kiloclaw-tab-visible';
@@ -71,7 +71,7 @@ export default function TabsLayout() {
const colors = useThemeColors();
const { bottom } = useSafeAreaInsets();
const { fontScale } = useWindowDimensions();
- const hideTabs = shouldHideTabBar(pathname);
+ const hideTabs = shouldHideTabBar(pathname, segments);
const showTabLabel = shouldShowTabLabel(fontScale);
const tabBarHeight = getEffectiveTabBarHeight({
bottomInset: bottom,
@@ -80,9 +80,9 @@ export default function TabsLayout() {
});
const tabIconSize = getTabBarIconSize(fontScale);
const showKiloClawTab = useKiloClawTabVisible();
- const showQuickChatTab = useFeatureFlag(FEATURE_FLAG_QUICK_CHAT, false);
- const tabFlags = { showKiloClaw: showKiloClawTab, showQuickChat: showQuickChatTab };
- const tabCount = visibleTabCount(showKiloClawTab, showQuickChatTab);
+ const showChatTab = useFeatureFlag(FEATURE_FLAG_CHAT, false);
+ const tabFlags = { showKiloClaw: showKiloClawTab, showChat: showChatTab };
+ const tabCount = visibleTabCount(showKiloClawTab, showChatTab);
const { t } = useTranslation();
const { organizationId, isLoaded: orgLoaded } = useOrganization();
const { activeSessions, isLoading, isError } = useLiveAgentSessions({
@@ -109,13 +109,13 @@ export default function TabsLayout() {
orgLoaded && !isLoading && !isError && needsInputCount > 0 ? needsInputCount : undefined;
// If the flag flips off while the Chat tab is focused, its `href` becomes
- // null but the route is still mounted — move to Home instead.
+ // null but the route is still mounted, so move to Home instead.
const onChatTab = segments.some(segment => segment === '(4_chat)');
useEffect(() => {
- if (!showQuickChatTab && onChatTab) {
+ if (!showChatTab && onChatTab) {
router.replace('/(app)/(tabs)/(0_home)' as Href);
}
- }, [showQuickChatTab, onChatTab, router]);
+ }, [showChatTab, onChatTab, router]);
return (
@@ -218,7 +218,7 @@ export default function TabsLayout() {
({
useThemeColors: () => ({ foreground: '#000000', mutedForeground: '#666666' }),
}));
vi.mock('@/lib/analytics/posthog', () => ({
- FEATURE_FLAG_QUICK_CHAT: 'quick-chat',
+ FEATURE_FLAG_CHAT: 'mobile-chat',
useFeatureFlag: () => false,
}));
vi.mock('@/lib/hooks/use-kiloclaw-tab-visible', () => ({ useKiloClawTabVisible: () => false }));
diff --git a/apps/mobile/src/components/chat/beta-pill.tsx b/apps/mobile/src/components/chat/beta-pill.tsx
new file mode 100644
index 0000000000..982841cac1
--- /dev/null
+++ b/apps/mobile/src/components/chat/beta-pill.tsx
@@ -0,0 +1,16 @@
+import { View } from 'react-native';
+import { useTranslation } from 'react-i18next';
+
+import { Text } from '@/components/ui/text';
+
+/** Says, everywhere the chat is shown, that the chat is not finished yet. */
+export function BetaPill() {
+ const { t } = useTranslation();
+ return (
+
+
+ {t('modelChat.beta')}
+
+
+ );
+}
diff --git a/apps/mobile/src/components/chat/chat-list-screen.tsx b/apps/mobile/src/components/chat/chat-list-screen.tsx
new file mode 100644
index 0000000000..9fc2052a19
--- /dev/null
+++ b/apps/mobile/src/components/chat/chat-list-screen.tsx
@@ -0,0 +1,233 @@
+import { FlashList } from '@shopify/flash-list';
+import { type Href, useRouter } from 'expo-router';
+import { useCallback, useEffect, useMemo } from 'react';
+import { Platform, Pressable, useWindowDimensions, View } from 'react-native';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
+import { useTranslation } from 'react-i18next';
+
+import { FAB_MARGIN, FAB_SIZE } from '@/components/agents/session-list-content';
+import { StateSurfaceInsets } from '@/components/centered-state-surface';
+import { EmptyState } from '@/components/empty-state';
+import { QueryError } from '@/components/query-error';
+import { ScreenHeader } from '@/components/screen-header';
+import { Button } from '@/components/ui/button';
+import { MessageCircle, Plus } from '@/components/ui/icons';
+import { Skeleton } from '@/components/ui/skeleton';
+import { Text } from '@/components/ui/text';
+import { useAuth } from '@/lib/auth/auth-context';
+import { rememberModelFacts } from '@/lib/chat/layers';
+import { type ChatSummary } from '@/lib/chat/store';
+import { chatPlaceOf, newChat, useChatList } from '@/lib/chat/use-chat';
+import { useAvailableModels } from '@/lib/hooks/use-available-models';
+import { useCurrentUserId } from '@/lib/hooks/use-current-user-id';
+import { useThemeColors } from '@/lib/hooks/use-theme-colors';
+import { useOrganization } from '@/lib/organization-context';
+import { getEffectiveTabBarHeight } from '@/lib/tab-bar-layout';
+
+import { BetaPill } from './beta-pill';
+import { ChatRow } from './chat-row';
+
+/**
+ * The chats a person has, newest first.
+ *
+ * Several can be running at once: the conversations are held in the registry
+ * rather than by whichever screen is mounted, so a chat that is answering is
+ * still answering while this list is on screen.
+ *
+ * It is laid out the way the sessions list is, because a chat is a session of
+ * a plainer kind: the same header, the same edge-to-edge rows, and the same
+ * button in the same corner for starting one.
+ */
+
+const SKELETON_ROW_COUNT = 8;
+
+export function ChatListScreen() {
+ const { organizationId } = useOrganization();
+ const { authEpoch } = useAuth();
+ return ;
+}
+
+function ScopedChatListScreen() {
+ const { t } = useTranslation();
+ const router = useRouter();
+ const colors = useThemeColors();
+ const { organizationId } = useOrganization();
+ const { userId } = useCurrentUserId();
+ const place = chatPlaceOf(userId, organizationId);
+ const { bottom } = useSafeAreaInsets();
+ const { fontScale } = useWindowDimensions();
+ const tabBarHeight = useMemo(
+ () => getEffectiveTabBarHeight({ bottomInset: bottom, platform: Platform.OS, fontScale }),
+ [bottom, fontScale]
+ );
+
+ const {
+ models,
+ isError: modelsFailed,
+ refetch: refetchModels,
+ } = useAvailableModels(organizationId ?? undefined);
+
+ // The catalog is what tells a session its context window, and a session with
+ // no window never compacts. It is handed over as it arrives.
+ useEffect(() => {
+ rememberModelFacts(models);
+ }, [models]);
+
+ const { chats, isLoading, isError, refetch, remove } = useChatList(place);
+
+ const nameOf = useCallback(
+ (id: string) => models.find(model => model.id === id)?.name ?? '',
+ [models]
+ );
+
+ const start = useCallback(() => {
+ const model = models.find(one => one.isPreferred)?.id ?? models[0]?.id;
+ if (place === null || model === undefined) {
+ return;
+ }
+ void (async () => {
+ const sessionId = await newChat(place, model);
+ router.push(`/(app)/(tabs)/(4_chat)/${sessionId}` as Href);
+ })();
+ }, [models, place, router]);
+
+ const open = useCallback(
+ (sessionId: string) => {
+ router.push(`/(app)/(tabs)/(4_chat)/${sessionId}` as Href);
+ },
+ [router]
+ );
+
+ const drop = useCallback(
+ (sessionId: string) => {
+ void remove(sessionId);
+ },
+ [remove]
+ );
+
+ const renderItem = useCallback(
+ ({ item, index }: { item: ChatSummary; index: number }) => (
+
+ ),
+ [chats.length, drop, nameOf, open]
+ );
+
+ // Nothing to start a chat with is nothing for the button to do, and an empty
+ // list carries its own button, so the corner one would be the second.
+ const empty = !isLoading && chats.length === 0;
+ const failed = isError || (modelsFailed && chats.length === 0);
+ const showFab = !empty && !failed && place !== null && models.length > 0;
+
+ const fabStyle = useMemo(
+ () => ({
+ bottom: tabBarHeight + FAB_MARGIN,
+ right: 20,
+ width: FAB_SIZE,
+ height: FAB_SIZE,
+ }),
+ [tabBarHeight]
+ );
+
+ const listStyle = useMemo(
+ () => ({ paddingBottom: tabBarHeight + (showFab ? FAB_SIZE + FAB_MARGIN : 0) }),
+ [showFab, tabBarHeight]
+ );
+
+ function renderBody() {
+ if (isError) {
+ return (
+
+ );
+ }
+ if (modelsFailed && chats.length === 0) {
+ return (
+ {
+ void refetchModels();
+ }}
+ />
+ );
+ }
+ if (isLoading) {
+ return (
+
+ {Array.from({ length: SKELETON_ROW_COUNT }, (_, index) => (
+
+
+
+ ))}
+
+ );
+ }
+ if (empty) {
+ return (
+
+ {t('modelChat.list.new')}
+
+ }
+ />
+ );
+ }
+ return (
+ chat.sessionId}
+ renderItem={renderItem}
+ // Newest first: a chat that just arrived belongs on screen, and holding
+ // the old scroll position would put it above the top of the list.
+ maintainVisibleContentPosition={{ disabled: true }}
+ contentContainerStyle={listStyle}
+ />
+ );
+ }
+
+ return (
+
+
+
+
+ {t('common.chat')}
+
+
+
+ }
+ size="large"
+ showBackButton={false}
+ className="px-[22px] pb-1"
+ />
+ {renderBody()}
+ {showFab && (
+
+
+
+ )}
+
+
+ );
+}
diff --git a/apps/mobile/src/components/chat/chat-row.tsx b/apps/mobile/src/components/chat/chat-row.tsx
new file mode 100644
index 0000000000..9eec34c5df
--- /dev/null
+++ b/apps/mobile/src/components/chat/chat-row.tsx
@@ -0,0 +1,95 @@
+import { useActionSheet } from '@expo/react-native-action-sheet';
+import * as Haptics from 'expo-haptics';
+import { Alert, Pressable } from 'react-native';
+import { useTranslation } from 'react-i18next';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
+
+import { SessionRow } from '@/components/ui/session-row';
+import { type ChatSummary } from '@/lib/chat/store';
+import { useChatStatus } from '@/lib/chat/use-chat';
+import { timeAgo } from '@/lib/utils';
+
+/**
+ * One chat in the list.
+ *
+ * It is the row every other list in the app uses, so a chat looks like a
+ * session: the model names the row and colours its strip, an answer still
+ * arriving shows the same live dot a running session does, and the title is
+ * the first thing the person said — a chat has no name of its own, and one
+ * with nothing said in it yet is the single case that needs a word instead.
+ */
+
+type ChatRowProps = {
+ chat: ChatSummary;
+ modelName: string;
+ /** Last of the list, which drops the divider under it. */
+ last: boolean;
+ onPress: (sessionId: string) => void;
+ onDelete: (sessionId: string) => void;
+};
+
+export function ChatRow({ chat, modelName, last, onPress, onDelete }: Readonly) {
+ const { t } = useTranslation();
+ // The answer may be arriving on another screen: the chat says so, not the row.
+ const working = useChatStatus(chat.sessionId) === 'working';
+ const { bottom } = useSafeAreaInsets();
+ const { showActionSheetWithOptions } = useActionSheet();
+ const title = chat.title === '' ? t('chat.conversation.untitled') : chat.title;
+ const label = modelName === '' ? t('common.chat') : modelName;
+
+ function confirmDelete() {
+ void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Warning);
+ Alert.alert(t('modelChat.list.deleteTitle'), undefined, [
+ { text: t('common.cancel'), style: 'cancel' },
+ {
+ text: t('common.delete'),
+ style: 'destructive',
+ onPress: () => {
+ onDelete(chat.sessionId);
+ },
+ },
+ ]);
+ }
+
+ function openActions() {
+ void Haptics.selectionAsync();
+ showActionSheetWithOptions(
+ {
+ title,
+ options: [t('common.delete'), t('common.cancel')],
+ cancelButtonIndex: 1,
+ destructiveButtonIndex: 0,
+ containerStyle: { paddingBottom: bottom },
+ },
+ index => {
+ if (index === 0) {
+ confirmDelete();
+ }
+ }
+ );
+ }
+
+ return (
+ {
+ onPress(chat.sessionId);
+ }}
+ onLongPress={openActions}
+ >
+
+
+ );
+}
diff --git a/apps/mobile/src/components/chat/chat-screen.tsx b/apps/mobile/src/components/chat/chat-screen.tsx
new file mode 100644
index 0000000000..1e4f45dc68
--- /dev/null
+++ b/apps/mobile/src/components/chat/chat-screen.tsx
@@ -0,0 +1,242 @@
+import { type ListRenderItem } from '@shopify/flash-list';
+import { type RemoteModelState, type StoredMessage } from '@kilocode/cloud-agent-sdk';
+import { useCallback, useEffect, useState } from 'react';
+import { ActivityIndicator, Keyboard, KeyboardAvoidingView, Platform, View } from 'react-native';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
+import { useTranslation } from 'react-i18next';
+
+import { ChatComposer, type ChatComposerSendOptions } from '@/components/agents/chat-composer';
+import { MessageBubble } from '@/components/agents/message-bubble';
+import { SessionMessageList } from '@/components/agents/session-message-list';
+import { getSessionKeyboardContainerKind } from '@/components/agents/session-keyboard-container-state';
+import { AppAwareKeyboardPaddingView } from '@/components/kilo-chat/app-aware-keyboard-padding';
+import { EmptyState } from '@/components/empty-state';
+import { ScreenHeader } from '@/components/screen-header';
+import { MessageCircle } from '@/components/ui/icons';
+import { Text } from '@/components/ui/text';
+import { useAvailableModels } from '@/lib/hooks/use-available-models';
+import { useSessionModelOptions } from '@/lib/hooks/use-session-model-options';
+import { useCurrentUserId } from '@/lib/hooks/use-current-user-id';
+import { useOrganization } from '@/lib/organization-context';
+import { chatPlaceOf, useChat } from '@/lib/chat/use-chat';
+import { asMessages } from '@/lib/chat/turns';
+
+import { BetaPill } from './beta-pill';
+
+/**
+ * One conversation.
+ *
+ * The transcript, the composer and the bubbles are the ones every other
+ * conversation in this app uses. What is different is underneath: the turns
+ * come from the harness SDK on the device rather than from a session on a
+ * server, so nothing here polls and nothing here reconnects.
+ */
+
+// The remote branch is never taken here (`activeSessionType` is null), but the
+// hook wants a state of the right shape.
+const NO_REMOTE: RemoteModelState = {
+ ownerConnectionId: null,
+ protocol: 'unknown',
+ refresh: 'idle',
+};
+
+/* eslint-disable require-await, @typescript-eslint/require-await, no-empty-function -- the composer's session callbacks; a chat creates, restarts and exits nothing */
+async function noSessionCommand(): Promise {
+ return false;
+}
+async function noSessionChange(): Promise {
+ return false;
+}
+async function noSessionExit(): Promise {}
+/* eslint-enable require-await, @typescript-eslint/require-await, no-empty-function */
+
+type ChatScreenProps = {
+ /** The session the route named. A model switch moves the chat off it. */
+ opened: string;
+};
+
+export function ChatScreen({ opened }: Readonly) {
+ const { t } = useTranslation();
+ const { organizationId } = useOrganization();
+ const { userId } = useCurrentUserId();
+ const place = chatPlaceOf(userId, organizationId);
+ const { state, send, stop, retry } = useChat(place, opened);
+ const [keyboardVisible, setKeyboardVisible] = useState(false);
+
+ const {
+ models,
+ isLoading: modelsLoading,
+ isError: modelsFailed,
+ } = useAvailableModels(organizationId ?? undefined);
+
+ const modelOptions = useSessionModelOptions({
+ activeSessionType: null,
+ observedModel: null,
+ remoteModelOverride: null,
+ gatewayModels: models,
+ gatewayModelsLoading: modelsLoading,
+ organizationId: organizationId ?? undefined,
+ remoteModelState: NO_REMOTE,
+ });
+
+ // The model the next message goes to. It starts as the one the conversation
+ // is on and changes the moment the person picks another, which is what makes
+ // the switch apply to the next message and not to what was already said.
+ const [picked, setPicked] = useState(null);
+ const [variant, setVariant] = useState('');
+ const model = picked ?? state.model;
+
+ useEffect(() => {
+ const shown = Keyboard.addListener('keyboardDidShow', () => {
+ setKeyboardVisible(true);
+ });
+ const hidden = Keyboard.addListener('keyboardDidHide', () => {
+ setKeyboardVisible(false);
+ });
+ return () => {
+ shown.remove();
+ hidden.remove();
+ };
+ }, []);
+
+ const messages = asMessages(state);
+ // The question that has no answer is the last thing on screen, and while the
+ // chat is idle it is the one that offers a Retry.
+ const unanswered =
+ state.status === 'idle' && state.asked !== null ? messages.at(-1)?.info.id : undefined;
+
+ const renderItem: ListRenderItem = useCallback(
+ ({ item }) => (
+ {
+ void retry();
+ },
+ }
+ : {})}
+ />
+ ),
+ [retry, unanswered]
+ );
+
+ const handleSend = useCallback(
+ (text: string, options?: ChatComposerSendOptions) => {
+ // The question is on screen the moment it is asked, so the composer
+ // empties now rather than when the answer lands.
+ options?.onOptimisticSend?.();
+ void send(text, model);
+ },
+ [model, send]
+ );
+
+ const handleStop = useCallback(() => {
+ void stop();
+ }, [stop]);
+
+ const keyboardKind = getSessionKeyboardContainerKind(Platform.OS);
+ const { bottom } = useSafeAreaInsets();
+ // A conversation fills the screen: the tab bar is gone and the composer sits
+ // on the home indicator, except while the keyboard covers it.
+ const composerPadding = { paddingBottom: keyboardVisible ? 0 : bottom };
+
+ function renderTranscript() {
+ if (messages.length === 0) {
+ return (
+
+ );
+ }
+ return (
+
+ sessionId={state.sessionId}
+ items={messages}
+ keyExtractor={message => message.info.id}
+ hasOlderMessages={false}
+ isLoadingOlderMessages={false}
+ olderMessagesError={null}
+ olderMessagesOmittedItemCount={0}
+ onLoadOlderMessages={() => undefined}
+ renderItem={renderItem}
+ />
+ );
+ }
+
+ function renderBody() {
+ return (
+ <>
+ {renderTranscript()}
+
+ {state.status === 'working' ? (
+
+
+
+ {t('common.working')}
+
+
+ ) : null}
+
+
+ {
+ // A chat is only ever an ask.
+ }}
+ model={model}
+ variant={variant}
+ modelOptions={modelOptions.options}
+ onModelSelect={(modelId, variantId) => {
+ setPicked(modelId);
+ setVariant(variantId);
+ }}
+ attachmentsEnabled={false}
+ activeSessionType={null}
+ organizationId={organizationId ?? undefined}
+ disabled={modelsFailed && modelOptions.options.length === 0}
+ />
+
+ >
+ );
+ }
+
+ return (
+
+
+
+ {t('common.chat')}
+
+
+
+ }
+ showBackButton
+ />
+ {keyboardKind === 'app-aware-padding' ? (
+ {renderBody()}
+ ) : (
+
+ {renderBody()}
+
+ )}
+
+ );
+}
diff --git a/apps/mobile/src/components/quick-chat/quick-chat-gateway.test.ts b/apps/mobile/src/components/quick-chat/quick-chat-gateway.test.ts
deleted file mode 100644
index 9e671fb71d..0000000000
--- a/apps/mobile/src/components/quick-chat/quick-chat-gateway.test.ts
+++ /dev/null
@@ -1,155 +0,0 @@
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-
-import {
- parseSseDataLine,
- type QuickChatCompletionInput,
- streamQuickChatCompletion,
-} from './quick-chat-gateway';
-
-vi.mock('@/lib/config', () => ({ API_BASE_URL: 'https://gateway.test' }));
-
-const fetchMock = vi.hoisted(() => vi.fn());
-
-beforeEach(() => {
- fetchMock.mockReset();
- vi.stubGlobal('fetch', fetchMock);
-});
-
-afterEach(() => {
- vi.unstubAllGlobals();
-});
-
-/** A ReadableStream that enqueues the given chunks then closes. */
-function chunkedStream(chunks: string[]): ReadableStream {
- const encoder = new TextEncoder();
- return new ReadableStream({
- start(controller) {
- for (const chunk of chunks) {
- controller.enqueue(encoder.encode(chunk));
- }
- controller.close();
- },
- });
-}
-
-const baseInput: QuickChatCompletionInput = {
- model: 'test-model',
- messages: [
- { role: 'user', content: 'hi' },
- { role: 'assistant', content: 'hello' },
- ],
- organizationId: 'org-1',
- authToken: 'token-1',
-};
-
-async function collect(generator: AsyncGenerator): Promise {
- const out: string[] = [];
- for await (const value of generator) {
- out.push(value);
- }
- return out;
-}
-
-describe('parseSseDataLine', () => {
- it('extracts the content delta from a data line', () => {
- expect(parseSseDataLine('data: {"choices":[{"delta":{"content":"Hi"}}]}')).toEqual({
- content: 'Hi',
- done: false,
- });
- });
-
- it('returns a null content for an empty delta', () => {
- expect(parseSseDataLine('data: {"choices":[{"delta":{}}]}').content).toBeNull();
- });
-
- it('marks [DONE] as the terminal event', () => {
- expect(parseSseDataLine('data: [DONE]')).toEqual({ content: null, done: true });
- });
-
- it('ignores non-data lines and malformed JSON', () => {
- expect(parseSseDataLine(': keep-alive').content).toBeNull();
- expect(parseSseDataLine('data: not-json').content).toBeNull();
- });
-});
-
-describe('streamQuickChatCompletion', () => {
- it('concatenates content deltas across SSE chunks and stops at [DONE]', async () => {
- fetchMock.mockResolvedValue({
- ok: true,
- body: chunkedStream([
- 'data: {"choices":[{"delta":{"content":"Hel"}}]}\n\n',
- 'data: {"choices":[{"delta":{"content":"lo"}}]}\n\n',
- 'data: {"choices":[{"delta":{"content":" world"}}]}\n\ndata: [DONE]\n\n',
- ]),
- });
-
- const out = await collect(streamQuickChatCompletion(baseInput));
-
- expect(out).toEqual(['Hel', 'lo', ' world']);
- });
-
- it('sends the feature header and no tools field', async () => {
- fetchMock.mockResolvedValue({ ok: true, body: chunkedStream(['data: [DONE]\n\n']) });
-
- await collect(streamQuickChatCompletion(baseInput));
-
- const [url, init] = fetchMock.mock.calls[0] as [string, RequestInit];
- expect(url).toBe('https://gateway.test/api/gateway/chat/completions');
-
- const headers = init.headers as Record;
- const headerNames = Object.keys(headers);
- const featureKey = headerNames.find(key => key.toLowerCase() === 'x-kilocode-feature');
- expect(featureKey).toBeDefined();
- expect(featureKey ? headers[featureKey] : undefined).toBe('quick-chat');
-
- const body = JSON.parse(init.body as string) as Record;
- expect(body.tools).toBeUndefined();
- expect(body.stream).toBe(true);
- expect(body.model).toBe('test-model');
- expect(body.messages).toEqual(baseInput.messages);
- });
-
- it('omits the organization header when organizationId is absent', async () => {
- fetchMock.mockResolvedValue({ ok: true, body: chunkedStream(['data: [DONE]\n\n']) });
-
- await collect(streamQuickChatCompletion({ ...baseInput, organizationId: null }));
-
- const [, init] = fetchMock.mock.calls[0] as [string, RequestInit];
- const headers = init.headers as Record;
- const hasOrgHeader = Object.keys(headers).some(
- key => key.toLowerCase() === 'x-kilocode-organizationid'
- );
- expect(hasOrgHeader).toBe(false);
- });
-
- it('stops reading when the signal aborts', async () => {
- fetchMock.mockResolvedValue({
- ok: true,
- body: chunkedStream([
- 'data: {"choices":[{"delta":{"content":"first"}}]}\n\n',
- 'data: {"choices":[{"delta":{"content":"second"}}]}\n\n',
- 'data: [DONE]\n\n',
- ]),
- });
-
- const controller = new AbortController();
- const generator = streamQuickChatCompletion({ ...baseInput, signal: controller.signal });
-
- const first = await generator.next();
- expect(first.done).toBe(false);
- expect(first.value).toBe('first');
-
- controller.abort();
-
- const afterAbort = await generator.next();
- expect(afterAbort.done).toBe(true);
- });
-
- it('throws when the gateway responds with a non-OK status', async () => {
- fetchMock.mockResolvedValue({ ok: false, status: 500 });
-
- await expect(collect(streamQuickChatCompletion(baseInput))).rejects.toThrow(
- 'Gateway request failed with status 500'
- );
- });
-});
diff --git a/apps/mobile/src/components/quick-chat/quick-chat-gateway.ts b/apps/mobile/src/components/quick-chat/quick-chat-gateway.ts
deleted file mode 100644
index 31b34c2055..0000000000
--- a/apps/mobile/src/components/quick-chat/quick-chat-gateway.ts
+++ /dev/null
@@ -1,153 +0,0 @@
-import { API_BASE_URL } from '@/lib/config';
-
-/**
- * The single Kilo gateway entry point for the quick-chat surface. Every call
- * to the gateway for this chat lives here so the request shape (feature
- * header, no tools, stream-only) is one place to review.
- */
-
-export type QuickChatGatewayMessage = {
- role: 'user' | 'assistant';
- content: string;
-};
-
-export type QuickChatCompletionInput = {
- model: string;
- messages: QuickChatGatewayMessage[];
- organizationId: string | null | undefined;
- authToken: string;
- signal?: AbortSignal;
-};
-
-/** Header set for the gateway chat-completions request. */
-type QuickChatRequestHeaders = {
- Authorization: string;
- 'Content-Type': string;
- 'X-KILOCODE-FEATURE': string;
- 'X-KiloCode-OrganizationId'?: string;
-};
-
-/** One parsed SSE `data:` line: a content delta (or null) plus the done marker. */
-export type SseParseResult = {
- content: string | null;
- done: boolean;
-};
-
-const GATEWAY_CHAT_COMPLETIONS_PATH = '/api/gateway/chat/completions';
-const SSE_DONE_PAYLOAD = '[DONE]';
-
-/**
- * Stream a chat completion from the Kilo gateway. Yields each
- * `choices[0].delta.content` string until the stream sends `[DONE]` or the
- * caller's `signal` aborts. The caller owns the auth token: obtain it with
- * `getAuthTokenForRequest` and pass it in — nothing here mints a token.
- */
-export async function* streamQuickChatCompletion({
- model,
- messages,
- organizationId,
- authToken,
- signal,
-}: QuickChatCompletionInput): AsyncGenerator {
- const headers: QuickChatRequestHeaders = {
- Authorization: `Bearer ${authToken}`,
- 'Content-Type': 'application/json',
- 'X-KILOCODE-FEATURE': 'quick-chat',
- };
- if (organizationId && organizationId !== '') {
- headers['X-KiloCode-OrganizationId'] = organizationId;
- }
-
- const response = await fetch(`${API_BASE_URL}${GATEWAY_CHAT_COMPLETIONS_PATH}`, {
- method: 'POST',
- headers,
- // No `tools` key: quick-chat is a plain completion, never a tool loop.
- body: JSON.stringify({ model, messages, stream: true }),
- signal,
- });
-
- if (!response.ok) {
- throw new Error(`Gateway request failed with status ${response.status}`);
- }
- if (!response.body) {
- throw new Error('Gateway returned an empty stream');
- }
-
- yield* readSseContent(response.body, signal);
-}
-
-/**
- * Parse one SSE `data:` line. Returns the content delta (or null) and whether
- * the line is the terminal `[DONE]` marker. Non-data lines and malformed JSON
- * are skipped without throwing, so a stray keep-alive comment or an unrelated
- * event never breaks the stream.
- */
-export function parseSseDataLine(line: string): SseParseResult {
- const trimmed = line.trim();
- if (!trimmed.startsWith('data:')) {
- return { content: null, done: false };
- }
- const payload = trimmed.slice('data:'.length).trim();
- if (payload === '') {
- return { content: null, done: false };
- }
- if (payload === SSE_DONE_PAYLOAD) {
- return { content: null, done: true };
- }
- try {
- const parsed = JSON.parse(payload) as {
- choices?: { delta?: { content?: unknown } }[];
- };
- const content = parsed.choices?.[0]?.delta?.content;
- // oxlint-disable-next-line anti-slop/no-runtime-typeof -- untrusted gateway SSE payload; the delta content must be narrowed at the stream boundary before it enters the transcript
- return { content: typeof content === 'string' ? content : null, done: false };
- } catch {
- return { content: null, done: false };
- }
-}
-
-/**
- * Read an SSE response body and yield every content delta until `[DONE]` or
- * an abort. Lines split across chunk boundaries are buffered so a partial
- * `data:` event is still parsed whole.
- */
-async function* readSseContent(
- body: ReadableStream,
- signal?: AbortSignal
-): AsyncGenerator {
- const reader = body.getReader();
- const decoder = new TextDecoder();
- let buffer = '';
- try {
- // eslint-disable-next-line no-unmodified-loop-condition -- `signal.aborted` is external state flipped by the caller's AbortController, not a loop-local variable
- while (!signal?.aborted) {
- // eslint-disable-next-line no-await-in-loop -- streaming reads are sequential; each read depends on the previous chunk
- const { done, value } = await reader.read();
- if (done) {
- break;
- }
- buffer += decoder.decode(value, { stream: true });
- const lines = buffer.split('\n');
- buffer = lines.pop() ?? '';
- for (const line of lines) {
- const result = parseSseDataLine(line);
- if (result.done) {
- return;
- }
- if (result.content !== null) {
- yield result.content;
- }
- }
- }
- // Flush the last line when the stream ended without a trailing newline.
- const trailing = buffer + decoder.decode();
- if (trailing.trim() !== '') {
- const result = parseSseDataLine(trailing);
- if (result.content !== null) {
- yield result.content;
- }
- }
- } finally {
- reader.releaseLock();
- }
-}
diff --git a/apps/mobile/src/components/quick-chat/quick-chat-messages.test.ts b/apps/mobile/src/components/quick-chat/quick-chat-messages.test.ts
deleted file mode 100644
index 5d43256793..0000000000
--- a/apps/mobile/src/components/quick-chat/quick-chat-messages.test.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import { describe, expect, it, vi } from 'vitest';
-
-import { adaptQuickChatRow, mergeQuickChatRows, type QuickChatRow } from './quick-chat-messages';
-
-vi.mock('@/lib/utils', () => ({
- parseTimestamp: (value: string) => new Date(value),
-}));
-
-const userRow: QuickChatRow = {
- id: 'u1',
- role: 'user',
- content: 'hello',
- createdAt: '2024-01-01T00:00:00.000Z',
- clientId: 'c1',
-};
-
-const assistantRow: QuickChatRow = {
- id: 'a1',
- role: 'assistant',
- content: 'hey',
- createdAt: '2024-01-01T00:00:01.000Z',
- clientId: null,
-};
-
-describe('adaptQuickChatRow', () => {
- it('maps a user row to a StoredMessage with a single text part', () => {
- const message = adaptQuickChatRow(userRow, 'thread-1');
-
- expect(message.info.role).toBe('user');
- expect(message.info.id).toBe('u1');
- expect(message.info.time.created).toBe(Date.parse('2024-01-01T00:00:00.000Z'));
- expect(message.parts).toEqual([
- { id: 'u1:text', sessionID: 'thread-1', messageID: 'u1', type: 'text', text: 'hello' },
- ]);
- });
-
- it('maps an assistant row with the assistant role', () => {
- const message = adaptQuickChatRow(assistantRow, 'thread-1');
-
- expect(message.info.role).toBe('assistant');
- expect(message.parts).toEqual([
- { id: 'a1:text', sessionID: 'thread-1', messageID: 'a1', type: 'text', text: 'hey' },
- ]);
- });
-});
-
-describe('mergeQuickChatRows', () => {
- it('keeps a sent turn when a late listMessages does not include it', () => {
- const merged = mergeQuickChatRows([], [{ clientId: 'c1', rows: [userRow, assistantRow] }]);
-
- expect(merged).toEqual([userRow, assistantRow]);
- });
-
- it('drops a local turn once the server persists the user message by clientId', () => {
- const serverRows = [
- { ...userRow, id: 'server-u1' },
- { ...assistantRow, id: 'server-a1' },
- ];
-
- const merged = mergeQuickChatRows(serverRows, [
- { clientId: 'c1', rows: [userRow, assistantRow] },
- ]);
-
- expect(merged).toEqual(serverRows);
- });
-
- it('appends still-pending turns after the persisted rows in order', () => {
- const serverRows = [{ ...userRow, id: 'server-u1', clientId: 'c0' }];
-
- const merged = mergeQuickChatRows(serverRows, [
- { clientId: 'c1', rows: [userRow, assistantRow] },
- { clientId: 'c2', rows: [{ ...userRow, id: 'u2', clientId: 'c2' }] },
- ]);
-
- expect(merged.map(row => row.id)).toEqual(['server-u1', 'u1', 'a1', 'u2']);
- });
-});
diff --git a/apps/mobile/src/components/quick-chat/quick-chat-messages.ts b/apps/mobile/src/components/quick-chat/quick-chat-messages.ts
deleted file mode 100644
index 5d22c4bbd1..0000000000
--- a/apps/mobile/src/components/quick-chat/quick-chat-messages.ts
+++ /dev/null
@@ -1,94 +0,0 @@
-import { type MessageInfo, type StoredMessage } from '@kilocode/cloud-agent-sdk';
-
-import { parseTimestamp } from '@/lib/utils';
-
-/**
- * The stored quick-chat row contract, matching `listMessages` / `appendMessages`
- * serialization from `apps/web/src/routers/quick-chat-router.ts`.
- */
-type QuickChatMessageRole = 'user' | 'assistant';
-
-export type QuickChatRow = {
- id: string;
- role: QuickChatMessageRole;
- content: string;
- createdAt: string;
- clientId?: string | null;
-};
-
-/**
- * One locally-accepted turn that may not be visible to a `listMessages` yet:
- * the user message plus (once streaming starts) its assistant reply.
- */
-export type LocalTurn = {
- clientId: string;
- rows: QuickChatRow[];
-};
-
-/**
- * Adapt a stored row into the `StoredMessage` shape `MessageBubble` renders.
- * The row carries only `{ id, role, content, createdAt }`; the remaining
- * `MessageInfo` fields are filled with neutral values because quick-chat has
- * no session tooling, model tracking, or cost accounting on the client.
- */
-export function adaptQuickChatRow(row: QuickChatRow, threadId: string): StoredMessage {
- const created = parseTimestamp(row.createdAt).getTime();
- const info: MessageInfo =
- row.role === 'user'
- ? {
- id: row.id,
- sessionID: threadId,
- role: 'user',
- time: { created },
- agent: 'quick-chat',
- model: { providerID: 'kilo', modelID: '' },
- }
- : {
- id: row.id,
- sessionID: threadId,
- role: 'assistant',
- time: { created },
- parentID: '',
- modelID: '',
- providerID: 'kilo',
- mode: 'ask',
- agent: 'quick-chat',
- path: { cwd: '', root: '' },
- cost: 0,
- tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
- };
- return {
- info,
- parts: [
- {
- id: `${row.id}:text`,
- sessionID: threadId,
- messageID: row.id,
- type: 'text',
- text: row.content,
- },
- ],
- };
-}
-
-/**
- * Union the persisted rows with local turns so a late `listMessages` cannot
- * drop a sent turn. A local turn is dropped only once the server has returned
- * the user message bearing its `clientId` (the append persists the whole turn,
- * so the assistant reply is present too).
- */
-export function mergeQuickChatRows(
- serverRows: readonly QuickChatRow[],
- localTurns: readonly LocalTurn[]
-): QuickChatRow[] {
- const persistedClientIds = new Set();
- for (const row of serverRows) {
- if (row.clientId) {
- persistedClientIds.add(row.clientId);
- }
- }
- const pending = localTurns
- .filter(turn => !persistedClientIds.has(turn.clientId))
- .flatMap(turn => turn.rows);
- return [...serverRows, ...pending];
-}
diff --git a/apps/mobile/src/components/quick-chat/quick-chat-screen.mounted.test.tsx b/apps/mobile/src/components/quick-chat/quick-chat-screen.mounted.test.tsx
deleted file mode 100644
index 7c2ea1a3aa..0000000000
--- a/apps/mobile/src/components/quick-chat/quick-chat-screen.mounted.test.tsx
+++ /dev/null
@@ -1,966 +0,0 @@
-/* eslint-disable typescript-eslint/no-deprecated -- react-test-renderer is the DOM-free renderer for RN trees under vitest (node env, no jsdom). */
-/* eslint-disable max-lines -- the mounted screen contract shares one mock harness across the state tests */
-
-// Quick-chat screen contract: an empty composer always renders, a send accept
-// puts a user bubble into the transcript, a first history failure with no rows
-// shows Retry (a permanent code shows none), a refetch failure keeps existing
-// rows with an inline retry, and a missing or failed model catalog never
-// disables the composer. A failed catalog with no rows shows the catalog
-// QueryError, not the happy empty copy; its compact retry only appears once
-// rows exist and names the failure for screen readers. Four-state coverage adds
-// the assistant reply after a stream (happy), the stream-failure-after-accept
-// outcome, the empty copy, and the flag-off replace to Home. The hook also must
-// not fetch history, create a thread, or accept a send before the org scope
-// hydrates (showing the skeleton, not EmptyState), and a send must abort an
-// in-flight stream.
-
-import { createElement, type ReactNode } from 'react';
-import { QueryClientProvider } from '@tanstack/react-query';
-import { act } from 'react-test-renderer';
-import { beforeEach, describe, expect, it, vi } from 'vitest';
-
-import TabsLayout from '@/app/(app)/(tabs)/_layout';
-import { i18n } from '@/i18n';
-import { renderWithProviders, waitFor } from '@/test/render-with-providers';
-
-import { type QuickChatRow } from './quick-chat-messages';
-import { QuickChatScreen } from './quick-chat-screen';
-
-vi.mock('@/components/centered-state-surface', () => ({
- StateSurfaceInsets: 'StateSurfaceInsets',
-}));
-
-const listMessagesQueryFn = vi.hoisted(() => vi.fn());
-const getOrCreateThreadMutate = vi.hoisted(() => vi.fn());
-const listMessagesQuery = vi.hoisted(() => vi.fn());
-const appendMessagesMutate = vi.hoisted(() => vi.fn());
-const streamMock = vi.hoisted(() => vi.fn());
-const toastError = vi.hoisted(() => vi.fn());
-const routerReplace = vi.hoisted(() => vi.fn());
-const routerNavigate = vi.hoisted(() => vi.fn());
-
-const modelsState = vi.hoisted(() => ({
- models: [] as { id: string; name: string; variants: string[]; isPreferred: boolean }[],
- isLoading: false,
- isError: false,
- refetch: vi.fn(),
-}));
-
-const modelOptionsState = vi.hoisted(() => ({
- options: [] as {
- id: string;
- name: string;
- displayId: string;
- variants: string[];
- isPreferred: boolean;
- }[],
- selectedValue: '',
- selectedVariant: '',
-}));
-
-const composerRenders = vi.hoisted(() => ({ list: [] as Record[] }));
-const sessionListRenders = vi.hoisted(() => ({ list: [] as Record[] }));
-const queryErrors = vi.hoisted(() => ({ list: [] as Record[] }));
-const buttonRenders = vi.hoisted(() => ({
- list: [] as { onPress?: () => void; accessibilityLabel?: string }[],
-}));
-const emptyStateRenders = vi.hoisted(() => ({ list: [] as { title?: string }[] }));
-const skeletonRenders = vi.hoisted(() => ({ count: 0 }));
-
-// Feature-flag / router / org-hydration knobs shared by the flag-gate and
-// org-loading tests.
-const quickChatFlagEnabled = vi.hoisted(() => ({ value: true }));
-const kiloclawVisible = vi.hoisted(() => ({ value: false }));
-const focusedSegments = vi.hoisted(() => ({ value: ['(app)', '(tabs)', '(0_home)'] }));
-const orgLoaded = vi.hoisted(() => ({ value: true }));
-const organizationId = vi.hoisted(() => ({ value: null as string | null }));
-const authEpoch = vi.hoisted(() => ({ value: 0 }));
-
-vi.mock('react-native', () => ({
- I18nManager: { isRTL: false },
- Pressable: 'Pressable',
- View: 'View',
- Keyboard: { addListener: () => ({ remove: vi.fn() }) },
- KeyboardAvoidingView: 'KeyboardAvoidingView',
- ActivityIndicator: 'ActivityIndicator',
- Platform: { OS: 'ios' },
- useWindowDimensions: () => ({ fontScale: 1, width: 0, height: 0 }),
-}));
-vi.mock('sonner-native', () => ({
- toast: { error: toastError, success: vi.fn(), warning: vi.fn() },
-}));
-vi.mock('expo-router', () => {
- const Tabs = Object.assign(() => null, { Screen: () => null });
- return {
- useRouter: () => ({ replace: routerReplace, navigate: routerNavigate, push: routerNavigate }),
- usePathname: () => '/(app)/(tabs)/(0_home)',
- useSegments: () => focusedSegments.value,
- Tabs,
- };
-});
-vi.mock('expo-haptics', () => ({
- selectionAsync: vi.fn(),
- impactAsync: vi.fn(),
- notificationAsync: vi.fn(),
- ImpactFeedbackStyle: { Light: 'light', Medium: 'medium' },
-}));
-vi.mock('react-native-safe-area-context', () => ({
- useSafeAreaInsets: () => ({ bottom: 0, top: 0, left: 0, right: 0 }),
-}));
-
-vi.mock('@/lib/utils', () => ({
- cn: (...args: unknown[]) => args.filter(Boolean).join(' '),
- parseTimestamp: (value: string) => new Date(value),
-}));
-vi.mock('@/lib/auth/auth-context', () => ({
- useAuth: () => ({ authEpoch: authEpoch.value, token: 'token' }),
-}));
-vi.mock('@/lib/auth/token-owner', () => ({
- getAuthTokenForRequest: () => 'token-1',
-}));
-vi.mock('@/lib/organization-context', () => ({
- useOrganization: () => ({
- organizationId: organizationId.value,
- isLoaded: orgLoaded.value,
- error: null,
- retry: vi.fn(),
- setOrganizationId: vi.fn(),
- }),
-}));
-vi.mock('@/lib/hooks/use-agent-sessions', () => ({
- useLiveAgentSessions: () => ({ activeSessions: [], isLoading: false, isError: false }),
-}));
-vi.mock('@/lib/hooks/use-current-user-id', () => ({
- useCurrentUserId: () => ({
- userId: 'u-1',
- email: null,
- isLoading: false,
- isError: false,
- refetch: vi.fn(),
- }),
-}));
-vi.mock('@/lib/persist/use-draft-load', () => ({
- useFencedDraftLoad: () => ({ settled: true, value: null }),
-}));
-vi.mock('@/lib/analytics/posthog', () => ({
- FEATURE_FLAG_QUICK_CHAT: 'mobile-quick-chat',
- useFeatureFlag: () => quickChatFlagEnabled.value,
-}));
-vi.mock('@/lib/hooks/use-kiloclaw-tab-visible', () => ({
- useKiloClawTabVisible: () => kiloclawVisible.value,
-}));
-vi.mock('@/lib/hooks/use-theme-colors', () => ({
- useThemeColors: () => ({ foreground: '#000000', mutedForeground: '#888888' }),
-}));
-vi.mock('@/lib/finding-detail-back', () => ({
- PROFILE_TAB_ROOT: '/(app)/(tabs)/(3_profile)',
-}));
-vi.mock('@/lib/trpc', () => ({
- useTRPC: () => ({
- organizations: {
- list: {
- queryOptions: () => ({
- queryKey: ['organizations-list'],
- queryFn: () => [{ organizationId: 'org-1', organizationName: 'Chat organization' }],
- }),
- },
- },
- quickChat: {
- listMessages: {
- queryKey: (input: unknown) => [['quickChat', 'listMessages'], { input, type: 'query' }],
- },
- },
- }),
- trpcClient: {
- quickChat: {
- getOrCreateThread: { mutate: getOrCreateThreadMutate },
- listMessages: {
- query: (input: { cursor?: string }) =>
- input.cursor ? listMessagesQuery(input) : listMessagesQueryFn(input),
- },
- appendMessages: { mutate: appendMessagesMutate },
- },
- },
-}));
-vi.mock('@/lib/hooks/use-available-models', () => ({
- useAvailableModels: () => ({
- models: modelsState.models,
- isLoading: modelsState.isLoading,
- isError: modelsState.isError,
- error: null,
- refetch: modelsState.refetch,
- }),
-}));
-vi.mock('@/lib/hooks/use-session-model-options', () => ({
- useSessionModelOptions: () => ({
- source: 'cloud-agent-gateway',
- options: modelOptionsState.options,
- selectedValue: modelOptionsState.selectedValue,
- selectedVariant: modelOptionsState.selectedVariant,
- pickerDisabled: false,
- isLoading: false,
- }),
-}));
-vi.mock('@/components/tab-screen', () => ({ useTabBarBottomPadding: () => 0 }));
-vi.mock('@/components/agents/session-keyboard-container-state', () => ({
- getSessionKeyboardContainerKind: () => 'keyboard-avoiding',
-}));
-vi.mock('@/components/kilo-chat/app-aware-keyboard-padding', () => ({
- AppAwareKeyboardPaddingView: 'AppAwareKeyboardPaddingView',
-}));
-vi.mock('@expo/react-native-action-sheet', () => ({
- useActionSheet: () => ({ showActionSheetWithOptions: vi.fn() }),
-}));
-vi.mock('@/components/ui/skeleton', () => ({ Skeleton: 'Skeleton' }));
-vi.mock('@/components/agents/session-detail-skeleton', () => ({
- SessionSkeletonMessages: () => {
- skeletonRenders.count += 1;
- return null;
- },
-}));
-vi.mock('@/components/ui/blur-bar', () => ({ BlurBar: 'BlurBar' }));
-vi.mock('@/components/ui/text', () => ({ Text: 'Text' }));
-vi.mock('@/components/ui/icons', () => ({
- ChevronDown: 'ChevronDown',
- Bot: 'Bot',
- House: 'House',
- MessageCircle: 'MessageCircle',
- MessageSquare: 'MessageSquare',
- UserRound: 'UserRound',
-}));
-vi.mock('@/components/empty-state', () => ({
- EmptyState: ({ title }: { title?: string }) => {
- emptyStateRenders.list.push({ title });
- return null;
- },
-}));
-vi.mock('@/components/query-error', () => ({
- QueryError: (props: Record) => {
- queryErrors.list.push(props);
- return null;
- },
-}));
-vi.mock('@/components/ui/button', () => ({
- Button: (props: { onPress?: () => void; accessibilityLabel?: string; children?: ReactNode }) => {
- buttonRenders.list.push(props);
- return createElement('View', null, props.children);
- },
-}));
-vi.mock('@/components/agents/session-message-list', () => ({
- SessionMessageList: (props: Record) => {
- sessionListRenders.list.push(props);
- return null;
- },
-}));
-vi.mock('@/components/agents/message-bubble', () => ({
- MessageBubble: () => null,
-}));
-vi.mock('@/components/agents/chat-composer', () => ({
- ChatComposer: (props: Record) => {
- composerRenders.list.push(props);
- return null;
- },
-}));
-vi.mock('./quick-chat-gateway', () => ({
- streamQuickChatCompletion: streamMock,
-}));
-
-type RenderedMessage = { info: { role: string }; parts: { text?: string }[] };
-
-const modelOption = {
- id: 'm1',
- name: 'Model 1',
- displayId: 'm1',
- variants: [],
- isPreferred: false,
-};
-
-const secondModelOption = {
- id: 'm2',
- name: 'Model 2',
- displayId: 'm2',
- variants: [],
- isPreferred: false,
-};
-
-/** A stream that never completes on its own: the hook's abort must end it. */
-async function* hangingStream(): AsyncGenerator {
- await new Promise(() => undefined);
- yield '';
-}
-
-function transcriptItems(): RenderedMessage[] {
- const latest = sessionListRenders.list.at(-1);
- return (latest?.items as RenderedMessage[] | undefined) ?? [];
-}
-
-function latestComposer(): Record | undefined {
- return composerRenders.list.at(-1);
-}
-
-async function mountScreen() {
- const result = await renderWithProviders(createElement(QuickChatScreen));
- return result;
-}
-
-function pressSend(text: string): void {
- const onSend = latestComposer()?.onSend as ((text: string) => void) | undefined;
- onSend?.(text);
-}
-
-beforeEach(() => {
- listMessagesQueryFn.mockReset();
- getOrCreateThreadMutate.mockReset();
- listMessagesQuery.mockReset();
- appendMessagesMutate.mockReset();
- streamMock.mockReset();
- toastError.mockReset();
- routerReplace.mockReset();
- routerNavigate.mockReset();
- modelsState.models = [];
- modelsState.isLoading = false;
- modelsState.isError = false;
- modelsState.refetch.mockClear();
- modelOptionsState.options = [];
- modelOptionsState.selectedValue = '';
- modelOptionsState.selectedVariant = '';
- composerRenders.list = [];
- sessionListRenders.list = [];
- queryErrors.list = [];
- buttonRenders.list = [];
- emptyStateRenders.list = [];
- skeletonRenders.count = 0;
- quickChatFlagEnabled.value = true;
- kiloclawVisible.value = false;
- focusedSegments.value = ['(app)', '(tabs)', '(0_home)'];
- orgLoaded.value = true;
- organizationId.value = null;
- authEpoch.value = 0;
-
- getOrCreateThreadMutate.mockResolvedValue({
- id: 'thread-1',
- organizationId: null,
- createdAt: '2024-01-01T00:00:00.000Z',
- });
- listMessagesQueryFn.mockResolvedValue({ messages: [], nextCursor: null });
- listMessagesQuery.mockResolvedValue({ messages: [], nextCursor: null });
- appendMessagesMutate.mockResolvedValue([]);
- streamMock.mockReturnValue([]);
-});
-
-describe('QuickChatScreen composer', () => {
- it.each(['pending', 'restored', 'history-error', 'catalog-error'])(
- 'keeps the accessible context control in the %s state',
- async state => {
- orgLoaded.value = state !== 'pending';
- organizationId.value = 'org-1';
- modelsState.isError = state === 'catalog-error';
- if (state === 'history-error') {
- listMessagesQueryFn.mockRejectedValue(new Error('offline'));
- }
- const { renderer, unmount } = await mountScreen();
- const control = () =>
- renderer.root.find(
- node =>
- (node.type as string) === 'Pressable' &&
- node.props.accessibilityHint === 'Select account'
- );
- if (orgLoaded.value) {
- await waitFor(() => control().props.accessibilityLabel === 'Chat organization');
- }
- expect(control().props.accessibilityRole).toBe('button');
- expect(control().props.accessibilityState).toEqual({
- busy: !orgLoaded.value,
- disabled: !orgLoaded.value,
- });
- expect(
- renderer.root
- .findAll(node => (node.type as string) === 'Text')
- .flatMap(node => node.children)
- ).not.toContain('Personal');
- expect(latestComposer()?.placeholder).toBe('Message');
- unmount();
- }
- );
-
- it('renders the composer with the quick-chat placeholder even when empty', async () => {
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- const composer = latestComposer();
- expect(composer?.placeholder).toBe('Message');
- expect(composer?.attachmentsEnabled).toBe(false);
- });
-
- it('does not disable the composer when the model catalog is empty', async () => {
- modelOptionsState.options = [];
-
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- expect(latestComposer()?.disabled).toBeUndefined();
- });
-
- it('keeps the composer enabled when the catalog errors', async () => {
- modelsState.isError = true;
-
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- expect(latestComposer()?.disabled).toBeUndefined();
- expect(latestComposer()?.model).toBe('');
- });
-
- it('shows the catalog QueryError when the catalog errors with an empty transcript', async () => {
- modelsState.isError = true;
-
- await mountScreen();
- await waitFor(() => queryErrors.list.length > 0);
-
- expect(latestComposer()?.disabled).toBeUndefined();
- const error = queryErrors.list[0];
- expect(error?.variant).toBe('server');
- expect(error?.title).toBe(i18n.t('common.couldNotLoadModels'));
- expect(error?.onRetry).toBeDefined();
- expect(emptyStateRenders.list).toHaveLength(0);
- });
-});
-
-describe('QuickChatScreen send', () => {
- it('shows a user bubble after an accepted send', async () => {
- modelOptionsState.options = [modelOption];
-
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- await act(async () => {
- pressSend('hello');
- await Promise.resolve();
- });
-
- const items = transcriptItems();
- expect(items.some(item => item.info.role === 'user' && item.parts[0]?.text === 'hello')).toBe(
- true
- );
- });
-
- it('does not send when no model is available and toasts instead', async () => {
- modelOptionsState.options = [];
-
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- await act(async () => {
- expect(() => {
- pressSend('hello');
- }).toThrow();
- await Promise.resolve();
- });
-
- expect(toastError).toHaveBeenCalledWith('Could not load models');
- expect(transcriptItems()).toHaveLength(0);
- });
-
- it('shows assistant text after a completed stream', async () => {
- modelOptionsState.options = [modelOption];
- streamMock.mockImplementation(async function* assistantStream() {
- await Promise.resolve();
- yield 'Hi';
- yield ' there';
- });
-
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- await act(async () => {
- pressSend('hello');
- await Promise.resolve();
- });
-
- await waitFor(() =>
- transcriptItems().some(
- item => item.info.role === 'assistant' && item.parts[0]?.text === 'Hi there'
- )
- );
- });
-
- it('keeps the user bubble, toasts, and leaves the draft cleared when the stream fails', async () => {
- modelOptionsState.options = [modelOption];
- streamMock.mockImplementation(() => {
- throw new Error('stream boom');
- });
-
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- await act(async () => {
- pressSend('hello');
- await Promise.resolve();
- });
-
- await waitFor(() => toastError.mock.calls.length > 0);
- await waitFor(() => latestComposer()?.isStreaming === false);
-
- expect(toastError).toHaveBeenCalledWith(i18n.t('quickChat.sendError'));
- const userBubbles = transcriptItems().filter(item => item.info.role === 'user');
- expect(userBubbles).toHaveLength(1);
- expect(userBubbles[0]?.parts[0]?.text).toBe('hello');
- expect(transcriptItems().some(item => item.info.role === 'assistant')).toBe(false);
- });
-
- it('aborts the in-flight stream when a second send starts', async () => {
- modelOptionsState.options = [modelOption];
-
- const firstSignal = { value: undefined as AbortSignal | undefined };
- streamMock.mockImplementationOnce((input: { signal?: AbortSignal }) => {
- firstSignal.value = input.signal;
- return hangingStream();
- });
-
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- await act(async () => {
- pressSend('first');
- await Promise.resolve();
- });
-
- expect(firstSignal.value?.aborted).toBe(false);
-
- await act(async () => {
- pressSend('second');
- await Promise.resolve();
- });
-
- expect(firstSignal.value?.aborted).toBe(true);
- });
-
- it('onStop aborts the in-flight completion', async () => {
- modelOptionsState.options = [modelOption];
-
- const streamSignal = { value: undefined as AbortSignal | undefined };
- streamMock.mockImplementation((input: { signal?: AbortSignal }) => {
- streamSignal.value = input.signal;
- return hangingStream();
- });
-
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- await act(async () => {
- pressSend('hello');
- await Promise.resolve();
- });
-
- expect(streamSignal.value?.aborted).toBe(false);
-
- await act(async () => {
- const onStop = latestComposer()?.onStop as (() => void) | undefined;
- onStop?.();
- await Promise.resolve();
- });
-
- expect(streamSignal.value?.aborted).toBe(true);
- expect(appendMessagesMutate).toHaveBeenCalledTimes(1);
- });
-
- it('persists a prompt stopped before authentication settles without starting the gateway', async () => {
- modelOptionsState.options = [modelOption];
- const { unmount } = await mountScreen();
-
- await act(async () => {
- pressSend('Stop immediately');
- (latestComposer()?.onStop as (() => void) | undefined)?.();
- await Promise.resolve();
- });
-
- expect(streamMock).not.toHaveBeenCalled();
- expect(appendMessagesMutate).toHaveBeenCalledTimes(1);
- expect(appendMessagesMutate).toHaveBeenCalledWith({
- organizationId: null,
- messages: [{ role: 'user', content: 'Stop immediately', clientId: expect.any(String) }],
- });
- expect(toastError).not.toHaveBeenCalled();
- unmount();
- });
-
- it.each([
- { partial: '', abortThrows: true },
- { partial: 'Partial reply', abortThrows: true },
- { partial: 'Partial reply', abortThrows: false },
- ])('persists a stopped turn across remounts: %j', async ({ partial, abortThrows }) => {
- modelOptionsState.options = [modelOption];
- const saved: QuickChatRow[] = [];
- listMessagesQueryFn.mockImplementation(() => ({ messages: [...saved], nextCursor: null }));
- appendMessagesMutate.mockImplementation(
- (input: { messages: Pick[] }) => {
- const rows = input.messages.map((message, index) => ({
- ...message,
- id: `saved-${index}`,
- createdAt: '2024-01-01T00:00:00.000Z',
- }));
- saved.push(...rows);
- return rows;
- }
- );
- let waitingForStop = false;
- streamMock.mockImplementation(async function* stoppedStream(input: { signal: AbortSignal }) {
- if (partial) {
- yield partial;
- }
- await new Promise((resolve, reject) => {
- waitingForStop = true;
- input.signal.addEventListener(
- 'abort',
- () => {
- if (abortThrows) {
- reject(new Error('Aborted'));
- } else {
- resolve();
- }
- },
- { once: true }
- );
- });
- yield 'late delta';
- });
-
- const { unmount } = await mountScreen();
- await act(async () => {
- pressSend('Keep this prompt');
- await Promise.resolve();
- });
- await waitFor(() => waitingForStop);
-
- await act(async () => {
- (latestComposer()?.onStop as (() => void) | undefined)?.();
- (latestComposer()?.onStop as (() => void) | undefined)?.();
- await Promise.resolve();
- });
-
- expect(appendMessagesMutate).toHaveBeenCalledTimes(1);
- expect(latestComposer()?.isStreaming).toBe(false);
- expect(toastError).not.toHaveBeenCalled();
- unmount();
- sessionListRenders.list = [];
-
- const remounted = await mountScreen();
- await waitFor(() => transcriptItems().length === (partial ? 2 : 1));
- expect(transcriptItems().map(item => [item.info.role, item.parts[0]?.text])).toEqual([
- ['user', 'Keep this prompt'],
- ...(partial ? [['assistant', partial]] : []),
- ]);
- remounted.unmount();
- });
-
- it('aborts the in-flight stream on unmount without persisting late data', async () => {
- modelOptionsState.options = [modelOption];
-
- const streamSignal = { value: undefined as AbortSignal | undefined };
- streamMock.mockImplementation(async function* unmountedStream(input: { signal: AbortSignal }) {
- streamSignal.value = input.signal;
- await new Promise(resolve => {
- input.signal.addEventListener(
- 'abort',
- () => {
- resolve();
- },
- { once: true }
- );
- });
- yield 'late delta';
- });
-
- const { unmount } = await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- await act(async () => {
- pressSend('hello');
- await Promise.resolve();
- });
-
- expect(streamSignal.value?.aborted).toBe(false);
-
- await act(async () => {
- unmount();
- await Promise.resolve();
- });
-
- expect(streamSignal.value?.aborted).toBe(true);
- expect(appendMessagesMutate).not.toHaveBeenCalled();
- expect(toastError).not.toHaveBeenCalled();
- });
-});
-
-describe('QuickChatScreen history errors', () => {
- it('shows Retry for a first transient history failure with no rows', async () => {
- listMessagesQueryFn.mockRejectedValue(
- Object.assign(new Error('boom'), { data: { code: 'INTERNAL_SERVER_ERROR' } })
- );
-
- await mountScreen();
- await waitFor(() => queryErrors.list.length > 0);
-
- const error = queryErrors.list[0];
- expect(error?.variant).toBe('server');
- expect(error?.onRetry).toBeDefined();
- });
-
- it('shows no Retry for a permanent (NOT_FOUND) history failure', async () => {
- listMessagesQueryFn.mockRejectedValue(
- Object.assign(new Error('missing'), { data: { code: 'NOT_FOUND' } })
- );
-
- await mountScreen();
- await waitFor(() => queryErrors.list.length > 0);
-
- const error = queryErrors.list[0];
- expect(error?.variant).toBe('not-found');
- expect(error?.onRetry).toBeUndefined();
- });
-
- it('keeps rows and offers a compact retry when a later refetch fails', async () => {
- listMessagesQueryFn.mockResolvedValueOnce({
- messages: [
- {
- id: 's1',
- role: 'user',
- content: 'kept',
- createdAt: '2024-01-01T00:00:00.000Z',
- clientId: null,
- },
- ],
- nextCursor: null,
- });
-
- const { queryClient } = await mountScreen();
- await waitFor(() => transcriptItems().length > 0);
-
- listMessagesQueryFn.mockRejectedValue(
- Object.assign(new Error('boom'), { data: { code: 'INTERNAL_SERVER_ERROR' } })
- );
- await act(async () => {
- await queryClient.invalidateQueries({ queryKey: [['quickChat', 'listMessages']] });
- });
- await waitFor(() => buttonRenders.list.length > 0);
-
- expect(
- transcriptItems().some(item => item.info.role === 'user' && item.parts[0]?.text === 'kept')
- ).toBe(true);
- expect(buttonRenders.list.length).toBeGreaterThan(0);
- const retryButton = buttonRenders.list.find(button => typeof button.onPress === 'function');
- expect(retryButton?.accessibilityLabel).toBe(i18n.t('quickChat.historyRetry'));
- });
-});
-
-describe('QuickChatScreen older-page paging', () => {
- it('releases the older-page lock on a first-page reset and ignores a stale load finally', async () => {
- modelOptionsState.options = [modelOption];
- const firstPageRow = {
- id: 's1',
- role: 'user',
- content: 'first',
- createdAt: '2024-01-01T00:00:00.000Z',
- clientId: null,
- };
- listMessagesQueryFn.mockResolvedValueOnce({ messages: [firstPageRow], nextCursor: 'c1' });
-
- let resolveStale:
- | ((value: { messages: unknown[]; nextCursor: string | null }) => void)
- | undefined = undefined;
- const stalePromise = new Promise<{ messages: unknown[]; nextCursor: string | null }>(
- _resolve => {
- resolveStale = _resolve;
- }
- );
- let resolveFresh:
- | ((value: { messages: unknown[]; nextCursor: string | null }) => void)
- | undefined = undefined;
- const freshPromise = new Promise<{ messages: unknown[]; nextCursor: string | null }>(
- _resolve => {
- resolveFresh = _resolve;
- }
- );
- listMessagesQuery.mockReturnValueOnce(stalePromise).mockReturnValueOnce(freshPromise);
-
- const { queryClient } = await mountScreen();
- await waitFor(() => transcriptItems().length > 0);
-
- const olderList = () => sessionListRenders.list.at(-1);
-
- // Start the first older-page load and hold it in flight.
- await act(async () => {
- (olderList()?.onLoadOlderMessages as (() => void) | undefined)?.();
- await Promise.resolve();
- });
- expect(olderList()?.isLoadingOlderMessages).toBe(true);
-
- // Reset the first page while the older load is still in flight. The reset
- // must release the lock so pagination is not stuck behind the stale load.
- listMessagesQueryFn.mockResolvedValue({ messages: [firstPageRow], nextCursor: 'c2' });
- await act(async () => {
- await queryClient.invalidateQueries({ queryKey: [['quickChat', 'listMessages']] });
- });
- await waitFor(() => olderList()?.isLoadingOlderMessages === false);
-
- // Start a newer older-page load; it now owns the lock.
- await act(async () => {
- (olderList()?.onLoadOlderMessages as (() => void) | undefined)?.();
- await Promise.resolve();
- });
- expect(olderList()?.isLoadingOlderMessages).toBe(true);
-
- // Resolve the stale load: its finally must not clear the newer load's lock.
- await act(async () => {
- resolveStale?.({ messages: [], nextCursor: null });
- await Promise.resolve();
- });
- expect(olderList()?.isLoadingOlderMessages).toBe(true);
-
- // Resolve the fresh load: it releases the lock normally.
- await act(async () => {
- resolveFresh?.({ messages: [], nextCursor: null });
- await Promise.resolve();
- });
- expect(olderList()?.isLoadingOlderMessages).toBe(false);
- });
-});
-
-describe('QuickChatScreen empty state', () => {
- it('renders the empty copy when there are no messages and no error', async () => {
- await mountScreen();
- await waitFor(() => emptyStateRenders.list.length > 0);
-
- expect(
- emptyStateRenders.list.some(render => render.title === i18n.t('quickChat.empty.title'))
- ).toBe(true);
- });
-});
-
-describe('QuickChatScreen org hydration', () => {
- it.each(['account', 'organization'])(
- 'never renders the prior %s transcript during a scope change',
- async scope => {
- modelOptionsState.options = [modelOption];
- const historyRow: QuickChatRow = {
- id: 'history',
- role: 'user',
- content: 'Private history',
- createdAt: '2024-01-01T00:00:00.000Z',
- };
- listMessagesQueryFn.mockResolvedValue({ messages: [historyRow], nextCursor: 'older' });
- listMessagesQuery.mockResolvedValue({
- messages: [{ ...historyRow, id: 'older', content: 'Private older history' }],
- nextCursor: null,
- });
- streamMock.mockReturnValue(hangingStream());
- const { renderer, queryClient, unmount } = await mountScreen();
- await waitFor(() => transcriptItems().length === 1);
- await act(async () => {
- (sessionListRenders.list.at(-1)?.onLoadOlderMessages as (() => void) | undefined)?.();
- pressSend('Private local prompt');
- await Promise.resolve();
- });
- await waitFor(() => transcriptItems().length === 3);
-
- listMessagesQueryFn.mockReturnValue(new Promise(() => undefined));
- getOrCreateThreadMutate.mockReturnValue(new Promise(() => undefined));
- sessionListRenders.list = [];
- skeletonRenders.count = 0;
- await act(async () => {
- if (scope === 'account') {
- authEpoch.value += 1;
- } else {
- organizationId.value = 'org-2';
- }
- renderer.update(
- createElement(
- QueryClientProvider,
- { client: queryClient },
- createElement(QuickChatScreen)
- )
- );
- await Promise.resolve();
- });
-
- expect(sessionListRenders.list).toHaveLength(0);
- expect(skeletonRenders.count).toBeGreaterThan(0);
- unmount();
- }
- );
-
- it('does not fetch history until the organization scope is loaded', async () => {
- orgLoaded.value = false;
-
- await mountScreen();
-
- expect(listMessagesQueryFn).not.toHaveBeenCalled();
- });
-
- it('shows the skeleton, not EmptyState, and rejects a send until the org scope is loaded', async () => {
- orgLoaded.value = false;
-
- await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- expect(skeletonRenders.count).toBeGreaterThan(0);
- expect(emptyStateRenders.list).toHaveLength(0);
-
- await act(async () => {
- expect(() => {
- pressSend('hello');
- }).toThrow('Organization scope not loaded');
- await Promise.resolve();
- });
-
- expect(getOrCreateThreadMutate).not.toHaveBeenCalled();
- expect(listMessagesQueryFn).not.toHaveBeenCalled();
- expect(appendMessagesMutate).not.toHaveBeenCalled();
- expect(streamMock).not.toHaveBeenCalled();
- expect(transcriptItems()).toHaveLength(0);
- });
-
- it('resets the picked model to the new catalog default when the org scope changes', async () => {
- modelOptionsState.options = [modelOption, secondModelOption];
- organizationId.value = 'org-1';
-
- const { renderer, queryClient } = await mountScreen();
- await waitFor(() => composerRenders.list.length > 0);
-
- // Pick a non-default model through the composer's model select handler.
- await act(async () => {
- const onModelSelect = latestComposer()?.onModelSelect as
- | ((modelId: string, variantId: string) => void)
- | undefined;
- onModelSelect?.('m2', 'v2');
- await Promise.resolve();
- });
-
- expect(latestComposer()?.model).toBe('m2');
-
- // Switch the org scope; the composer remounts and the picked model must fall
- // back to the new catalog default, not the stale prior id.
- await act(async () => {
- organizationId.value = 'org-2';
- renderer.update(
- createElement(QueryClientProvider, { client: queryClient }, createElement(QuickChatScreen))
- );
- await Promise.resolve();
- });
-
- await waitFor(() => latestComposer()?.model === 'm1');
- expect(latestComposer()?.model).toBe('m1');
- expect(latestComposer()?.variant).toBe('');
- });
-});
-
-describe('QuickChat flag gate', () => {
- it('replaces to Home when the flag is off while the Chat tab is focused', async () => {
- quickChatFlagEnabled.value = false;
- focusedSegments.value = ['(app)', '(tabs)', '(4_chat)'];
-
- await renderWithProviders(createElement(TabsLayout));
-
- expect(routerReplace).toHaveBeenCalledWith('/(app)/(tabs)/(0_home)');
- });
-});
diff --git a/apps/mobile/src/components/quick-chat/quick-chat-screen.tsx b/apps/mobile/src/components/quick-chat/quick-chat-screen.tsx
deleted file mode 100644
index 395636a548..0000000000
--- a/apps/mobile/src/components/quick-chat/quick-chat-screen.tsx
+++ /dev/null
@@ -1,273 +0,0 @@
-import { type ListRenderItem } from '@shopify/flash-list';
-import { type RemoteModelState, type StoredMessage } from '@kilocode/cloud-agent-sdk';
-import { useEffect, useState } from 'react';
-import { ActivityIndicator, Keyboard, KeyboardAvoidingView, Platform, View } from 'react-native';
-import { useTranslation } from 'react-i18next';
-
-import { ChatComposer } from '@/components/agents/chat-composer';
-import { MessageBubble } from '@/components/agents/message-bubble';
-import { SessionMessageList } from '@/components/agents/session-message-list';
-import { SessionSkeletonMessages } from '@/components/agents/session-detail-skeleton';
-import { getSessionKeyboardContainerKind } from '@/components/agents/session-keyboard-container-state';
-import { AppAwareKeyboardPaddingView } from '@/components/kilo-chat/app-aware-keyboard-padding';
-import { EmptyState } from '@/components/empty-state';
-import { QueryError } from '@/components/query-error';
-import { ContextControl } from '@/components/context-control';
-import { ScreenHeader } from '@/components/screen-header';
-import { useTabBarBottomPadding } from '@/components/tab-screen';
-import { Button } from '@/components/ui/button';
-import { MessageCircle } from '@/components/ui/icons';
-import { Text } from '@/components/ui/text';
-import { useAuth } from '@/lib/auth/auth-context';
-import { useAvailableModels } from '@/lib/hooks/use-available-models';
-import { useCurrentUserId } from '@/lib/hooks/use-current-user-id';
-import { useSessionModelOptions } from '@/lib/hooks/use-session-model-options';
-import { useOrganization } from '@/lib/organization-context';
-import { useFencedDraftLoad } from '@/lib/persist/use-draft-load';
-
-import { useQuickChat } from './use-quick-chat';
-
-// The remote model branch is never taken for quick-chat (`activeSessionType`
-// is null), but `useSessionModelOptions` requires a state of the right shape.
-const QUICK_CHAT_REMOTE_MODEL_STATE: RemoteModelState = {
- ownerConnectionId: null,
- protocol: 'unknown',
- refresh: 'idle',
-};
-
-// Message rows carry no quick-chat state, so the renderer lives at module
-// scope and is never recreated per render.
-const renderItem: ListRenderItem = ({ item }) => ;
-
-/* eslint-disable require-await, @typescript-eslint/require-await, no-empty-function -- no-op async session callbacks required by ChatComposer's non-session API; quick-chat never creates, restarts, or exits a session */
-async function noopSendCommand(): Promise {
- return false;
-}
-async function noopCreateSession(): Promise {
- return false;
-}
-async function noopRestartSession(): Promise {
- return false;
-}
-async function noopExitSession(): Promise {}
-/* eslint-enable require-await, @typescript-eslint/require-await, no-empty-function */
-
-export function QuickChatScreen() {
- const { organizationId } = useOrganization();
- const { authEpoch } = useAuth();
- return ;
-}
-
-function ScopedQuickChatScreen() {
- const { t } = useTranslation();
- const { organizationId } = useOrganization();
- const { authEpoch } = useAuth();
- const { userId, isLoading: isIdentityLoading } = useCurrentUserId();
- const [keyboardVisible, setKeyboardVisible] = useState(false);
-
- const {
- models,
- isLoading: gatewayModelsLoading,
- isError: catalogError,
- refetch: refetchModels,
- } = useAvailableModels(organizationId ?? undefined);
-
- const modelOptions = useSessionModelOptions({
- activeSessionType: null,
- observedModel: null,
- remoteModelOverride: null,
- gatewayModels: models,
- gatewayModelsLoading,
- organizationId: organizationId ?? undefined,
- remoteModelState: QUICK_CHAT_REMOTE_MODEL_STATE,
- });
-
- // The composer shows the session model options; the default model is the
- // first gateway option until the user picks a different one.
- const [pickedModel, setPickedModel] = useState(null);
- const [pickedVariant, setPickedVariant] = useState('');
- const model = pickedModel ?? (modelOptions.selectedValue || (modelOptions.options[0]?.id ?? ''));
- const variant = pickedModel !== null ? pickedVariant : modelOptions.selectedVariant;
-
- const chat = useQuickChat(model);
-
- useEffect(() => {
- const show = Keyboard.addListener('keyboardDidShow', () => {
- setKeyboardVisible(true);
- });
- const hide = Keyboard.addListener('keyboardDidHide', () => {
- setKeyboardVisible(false);
- });
- return () => {
- show.remove();
- hide.remove();
- };
- }, []);
-
- const tabBarBottomPadding = useTabBarBottomPadding();
- const keyboardContainerKind = getSessionKeyboardContainerKind(Platform.OS);
- const composerScope = `${authEpoch}:${organizationId ?? 'personal'}`;
- const draftKey = `quick-chat:${composerScope}`;
- const composerDraft = useFencedDraftLoad({ userId, isIdentityLoading, entityKey: draftKey });
- const composerBottomPadding = keyboardVisible ? 0 : tabBarBottomPadding;
- // Passthrough aliases keep the JSX handler values in the `handle*` convention.
- const handleSend = chat.onSend;
- const handleStop = chat.onStop;
- const handleLoadOlderMessages = chat.onLoadOlderMessages;
-
- const listErrorCode = chat.isError
- ? (chat.error as { data?: { code?: string } } | null)?.data?.code
- : undefined;
- const nonRetryableHistoryError =
- listErrorCode === 'NOT_FOUND' ||
- listErrorCode === 'FORBIDDEN' ||
- listErrorCode === 'UNAUTHORIZED';
- // A compact Retry only renders above the composer once rows exist: an empty
- // transcript shows either the full-region catalog QueryError or the history
- // error, each with its own Retry.
- const showRetryAboveComposer =
- (catalogError && chat.messages.length > 0) || (chat.messages.length > 0 && chat.isError);
-
- const handleModelSelect = (modelId: string, variantId: string) => {
- setPickedModel(modelId);
- setPickedVariant(variantId);
- };
-
- function renderTranscript() {
- // oxlint-disable-next-line typescript-eslint/no-unnecessary-condition -- `isLoading` is false while the query is disabled before the org scope hydrates
- if (chat.isLoading && chat.messages.length === 0) {
- return ;
- }
-
- if (chat.isError && chat.messages.length === 0) {
- if (nonRetryableHistoryError) {
- return ;
- }
- return (
- {
- void chat.refetch();
- }}
- />
- );
- }
-
- if (catalogError && chat.messages.length === 0) {
- return (
- {
- void refetchModels();
- }}
- />
- );
- }
-
- if (chat.messages.length === 0) {
- return (
-
- );
- }
-
- return (
-
- sessionId={chat.threadId ?? 'pending'}
- items={chat.messages}
- keyExtractor={message => message.info.id}
- hasOlderMessages={chat.hasOlderMessages}
- isLoadingOlderMessages={chat.isLoadingOlderMessages}
- olderMessagesError={chat.olderMessagesError}
- olderMessagesOmittedItemCount={chat.olderMessagesOmittedItemCount}
- onLoadOlderMessages={handleLoadOlderMessages}
- renderItem={renderItem}
- />
- );
- }
-
- function renderKeyboardBody() {
- return (
- <>
- {renderTranscript()}
-
- {/* Inline working row between the transcript and the composer. */}
- {chat.isStreaming && chat.messages.length > 0 ? (
-
-
-
- {t('common.working')}
-
-
- ) : null}
-
- {/* Compact retry above the composer, only once rows exist: a history
- refetch or model-catalog failure after messages were already shown. */}
- {showRetryAboveComposer ? (
-
-
-
- ) : null}
-
-
- {
- // Mode is locked to ask; any picker change snaps back on the next render.
- }}
- model={model}
- variant={variant}
- modelOptions={modelOptions.options}
- onModelSelect={handleModelSelect}
- attachmentsEnabled={false}
- activeSessionType={null}
- organizationId={organizationId ?? undefined}
- />
-
- >
- );
- }
-
- return (
-
- } />
- {keyboardContainerKind === 'app-aware-padding' ? (
-
- {renderKeyboardBody()}
-
- ) : (
-
- {renderKeyboardBody()}
-
- )}
-
- );
-}
diff --git a/apps/mobile/src/components/quick-chat/use-quick-chat.ts b/apps/mobile/src/components/quick-chat/use-quick-chat.ts
deleted file mode 100644
index e7f323ad4f..0000000000
--- a/apps/mobile/src/components/quick-chat/use-quick-chat.ts
+++ /dev/null
@@ -1,360 +0,0 @@
-import { useQuery } from '@tanstack/react-query';
-import { type OlderMessagesError, type StoredMessage } from '@kilocode/cloud-agent-sdk';
-import { useEffect, useMemo, useRef, useState } from 'react';
-import { toast } from 'sonner-native';
-import { ulid } from 'ulid';
-
-import { i18n } from '@/i18n';
-import { useAuth } from '@/lib/auth/auth-context';
-import { getAuthTokenForRequest } from '@/lib/auth/token-owner';
-import { useOrganization } from '@/lib/organization-context';
-import { trpcClient, useTRPC } from '@/lib/trpc';
-
-import { type QuickChatGatewayMessage, streamQuickChatCompletion } from './quick-chat-gateway';
-import {
- adaptQuickChatRow,
- type LocalTurn,
- mergeQuickChatRows,
- type QuickChatRow,
-} from './quick-chat-messages';
-
-/** One locally-accepted turn: the user row plus, once streaming starts, the assistant reply. */
-type HookLocalTurn = {
- clientId: string;
- user: QuickChatRow;
- assistant: QuickChatRow | null;
-};
-
-/**
- * Data layer for the quick-chat tab. Owns the `listMessages` query, older-page
- * paging, the locally-accepted turns, and the gateway stream/append pipeline.
- * All local state is torn down and in-flight streams aborted when the auth
- * epoch or organization changes, so no stale account data survives a scope
- * switch.
- */
-export function useQuickChat(model: string) {
- const { organizationId, isLoaded: orgLoaded } = useOrganization();
- const { authEpoch } = useAuth();
- const trpc = useTRPC();
-
- const [localTurns, setLocalTurns] = useState([]);
- const [isStreaming, setIsStreaming] = useState(false);
- const [threadId, setThreadId] = useState(null);
- const [olderRows, setOlderRows] = useState([]);
- const [nextCursor, setNextCursor] = useState(null);
- const [isLoadingOlder, setIsLoadingOlder] = useState(false);
- const [olderError, setOlderError] = useState(null);
-
- const abortRef = useRef(null);
- const stopRef = useRef<(() => void) | null>(null);
- const nextCursorRef = useRef(null);
- const olderLoadingRef = useRef(false);
- // Bumped every time the newest page resets (or the scope changes), so an
- // older-page load that raced the reset can drop its now-stale result instead
- // of prepending rows contiguous with the old first page.
- const pageResetRef = useRef(0);
-
- const listQuery = useQuery({
- // Key the page by the auth epoch so a sign-in can never render the previous
- // account's cached page, and keep it disabled until the org scope hydrates
- // (the context starts as null while SecureStore loads, so an early fetch
- // would resolve the personal thread first and then swap when the stored org
- // arrives).
- queryKey: [...trpc.quickChat.listMessages.queryKey({ organizationId }), authEpoch],
- queryFn: async () => {
- const page = await trpcClient.quickChat.listMessages.query({ organizationId });
- return page;
- },
- enabled: orgLoaded,
- });
-
- const scopeKey = `${authEpoch}:${organizationId ?? 'personal'}`;
- const scopeKeyRef = useRef(scopeKey);
-
- // Remount all local state and drop any in-flight stream when the account or
- // organization scope changes.
- useEffect(() => {
- if (scopeKeyRef.current === scopeKey) {
- return;
- }
- scopeKeyRef.current = scopeKey;
- abortRef.current?.abort();
- abortRef.current = null;
- stopRef.current = null;
- setLocalTurns([]);
- setIsStreaming(false);
- setThreadId(null);
- setOlderRows([]);
- setNextCursor(null);
- nextCursorRef.current = null;
- setOlderError(null);
- setIsLoadingOlder(false);
- olderLoadingRef.current = false;
- pageResetRef.current += 1;
- }, [scopeKey]);
-
- // A plain unmount (flag-off redirect, tab teardown) leaves no scope-change:
- // the effect above returns early on the first mount, so it never registers a
- // cleanup. Abort the in-flight stream here so a completion never outlives the
- // screen.
- useEffect(
- () => () => {
- abortRef.current?.abort();
- abortRef.current = null;
- stopRef.current = null;
- },
- []
- );
-
- // Resolve the thread id for the transcript list's reset key. The id is
- // cosmetic: listMessages/appendMessages resolve the thread server-side. The
- // create is gated on the same org-hydration flag as listMessages, so a mount
- // before SecureStore loads cannot write the personal thread by accident.
- useEffect(() => {
- let cancelled = false;
- void (async () => {
- // The create is gated on the same org-hydration flag as listMessages, so
- // a mount before SecureStore loads cannot write the personal thread.
- if (!orgLoaded) {
- return;
- }
- try {
- const thread = await trpcClient.quickChat.getOrCreateThread.mutate({ organizationId });
- // oxlint-disable-next-line typescript-eslint/no-unnecessary-condition -- `cancelled` flips in the cleanup when the scope changes mid-flight
- if (!cancelled) {
- setThreadId(thread.id);
- }
- } catch {
- // Keep `threadId` null; the screen falls back to the "pending" key.
- }
- })();
- return () => {
- cancelled = true;
- };
- }, [scopeKey, organizationId, orgLoaded]);
-
- // A first-page refetch (send → append → refetch, or Retry) shifts the newest
- // window, so the older rows and the cursor must reset together: keeping old
- // `olderRows` while overwriting the cursor would leave a gap where the rows
- // that fell off the first page live, and a later older load would prepend
- // overlapping ids. Reset both so the next older load starts contiguous with
- // the new first page.
- useEffect(() => {
- const data = listQuery.data;
- // oxlint-disable-next-line typescript-eslint/no-unnecessary-condition -- `data` is undefined while the query is disabled before the org scope hydrates
- if (data) {
- pageResetRef.current += 1;
- setOlderRows([]);
- nextCursorRef.current = data.nextCursor;
- setNextCursor(data.nextCursor);
- // A reset bumps `pageResetRef`, which makes an in-flight older load drop
- // its result and skip releasing the lock in its `finally`. Release the
- // lock here so pagination is not stuck behind the stale load.
- olderLoadingRef.current = false;
- setIsLoadingOlder(false);
- }
- }, [listQuery.data]);
-
- const onLoadOlderMessages = () => {
- const cursor = nextCursorRef.current;
- if (cursor === null || olderLoadingRef.current) {
- return;
- }
- const resetGen = pageResetRef.current;
- olderLoadingRef.current = true;
- setIsLoadingOlder(true);
- setOlderError(null);
- void (async () => {
- try {
- const result = await trpcClient.quickChat.listMessages.query({ organizationId, cursor });
- // If a newest-page refetch or scope change reset the page since this
- // load started, the row window moved: prepending these rows would leave
- // a gap or duplicate ids. Drop the stale page.
- // oxlint-disable-next-line typescript-eslint/no-unnecessary-condition -- a dropped page must not mix into the newer window
- if (pageResetRef.current !== resetGen) {
- return;
- }
- setOlderRows(prev => [...result.messages, ...prev]);
- nextCursorRef.current = result.nextCursor;
- setNextCursor(result.nextCursor);
- } catch {
- // A stale page's failure is not the current window's failure.
- if (pageResetRef.current !== resetGen) {
- return;
- }
- setOlderError({ kind: 'retryable' });
- } finally {
- // Only the load that still owns the reset generation clears the lock:
- // a stale load's finally must not clobber a newer load's
- // `olderLoadingRef`/loading indicator.
- if (pageResetRef.current === resetGen) {
- olderLoadingRef.current = false;
- setIsLoadingOlder(false);
- }
- }
- })();
- };
-
- const mergedRows = useMemo(() => {
- // oxlint-disable-next-line typescript-eslint/no-unnecessary-condition -- `listQuery.data` is undefined until the first page resolves
- const serverRows = [...olderRows, ...(listQuery.data?.messages ?? [])];
- const turns: LocalTurn[] = localTurns.map(turn => ({
- clientId: turn.clientId,
- rows: turn.assistant ? [turn.user, turn.assistant] : [turn.user],
- }));
- return mergeQuickChatRows(serverRows, turns);
- }, [olderRows, listQuery.data, localTurns]);
-
- const messages = useMemo(
- () => mergedRows.map(row => adaptQuickChatRow(row, threadId ?? 'pending')),
- [mergedRows, threadId]
- );
-
- function gatewayHistory(): QuickChatGatewayMessage[] {
- return mergedRows.map(row => ({ role: row.role, content: row.content }));
- }
-
- async function appendTurn(clientId: string, userContent: string, assistantContent: string) {
- // Defensive last line: a stream that completed just as the scope swapped
- // out (or before hydration ever finished) must never persist to the wrong
- // thread.
- if (!orgLoaded) {
- return;
- }
- const outgoing: { role: 'user' | 'assistant'; content: string; clientId?: string }[] = [
- { role: 'user', content: userContent, clientId },
- ];
- if (assistantContent.trim() !== '') {
- outgoing.push({ role: 'assistant', content: assistantContent });
- }
- try {
- await trpcClient.quickChat.appendMessages.mutate({ organizationId, messages: outgoing });
- void listQuery.refetch();
- } catch {
- // Keep the local rows; the merge keeps the turn visible on retry. The
- // failure copy is localized and generic: the gateway's raw error strings
- // are technical and never user-facing.
- toast.error(i18n.t('quickChat.sendError'));
- }
- }
-
- function startStream(
- clientId: string,
- userRow: QuickChatRow,
- history: QuickChatGatewayMessage[]
- ) {
- onStop();
- const controller = new AbortController();
- abortRef.current = controller;
- setIsStreaming(true);
- const assistantId = `local-${clientId}-assistant`;
- let assistantText = '';
-
- const finishTurn = () => {
- if (abortRef.current !== controller) {
- return;
- }
- abortRef.current = null;
- stopRef.current = null;
- setIsStreaming(false);
- void appendTurn(clientId, userRow.content, assistantText);
- };
- stopRef.current = () => {
- controller.abort();
- finishTurn();
- };
-
- void (async () => {
- try {
- const authToken = await getAuthTokenForRequest();
- if (abortRef.current !== controller) {
- return;
- }
- if (!authToken) {
- throw new Error('Missing auth token');
- }
- for await (const delta of streamQuickChatCompletion({
- model,
- messages: [...history, { role: 'user', content: userRow.content }],
- organizationId,
- authToken,
- signal: controller.signal,
- })) {
- if (abortRef.current !== controller) {
- return;
- }
- assistantText += delta;
- const content = assistantText;
- setLocalTurns(prev =>
- prev.map(turn =>
- turn.clientId === clientId
- ? {
- ...turn,
- assistant: {
- id: assistantId,
- role: 'assistant',
- content,
- createdAt: userRow.createdAt,
- },
- }
- : turn
- )
- );
- }
- } catch {
- if (!controller.signal.aborted) {
- toast.error(i18n.t('quickChat.sendError'));
- }
- } finally {
- finishTurn();
- }
- })();
- }
-
- function onSend(text: string): void {
- if (!orgLoaded) {
- // The org scope has not hydrated. Accepting would persist to the personal
- // thread before the stored org swaps in. Throw so the composer preserves
- // the draft (a plain return would clear it).
- throw new Error('Organization scope not loaded');
- }
- if (!model) {
- toast.error(i18n.t('common.couldNotLoadModels'));
- throw new Error('No model selected');
- }
- const clientId = ulid();
- const now = new Date().toISOString();
- const userRow: QuickChatRow = {
- id: `local-${clientId}`,
- role: 'user',
- content: text,
- createdAt: now,
- clientId,
- };
- const history = gatewayHistory();
- setLocalTurns(prev => [...prev, { clientId, user: userRow, assistant: null }]);
- startStream(clientId, userRow, history);
- }
-
- function onStop(): void {
- stopRef.current?.();
- }
-
- return {
- threadId,
- messages,
- // oxlint-disable-next-line typescript-eslint/no-unnecessary-condition -- the query is disabled while the org scope hydrates, but the screen must still treat that window as loading
- isLoading: listQuery.isLoading || !orgLoaded,
- isError: listQuery.isError,
- error: listQuery.error,
- refetch: listQuery.refetch,
- hasOlderMessages: nextCursor !== null,
- isLoadingOlderMessages: isLoadingOlder,
- olderMessagesError: olderError,
- olderMessagesOmittedItemCount: 0,
- onLoadOlderMessages,
- isStreaming,
- onSend,
- onStop,
- };
-}
diff --git a/apps/mobile/src/i18n/locales/af.json b/apps/mobile/src/i18n/locales/af.json
index 286b0850a4..c7c7a14b1e 100644
--- a/apps/mobile/src/i18n/locales/af.json
+++ b/apps/mobile/src/i18n/locales/af.json
@@ -2905,14 +2905,6 @@
"revoke": "Herroep vertroue in {{host}}",
"backToPreferences": "Terug na voorkeure"
},
- "quickChat": {
- "empty": {
- "title": "Begin 'n klets",
- "description": "Stuur 'n boodskap om met 'n model te gesels."
- },
- "historyRetry": "Kon nie kletsgeskiedenis laai nie.",
- "sendError": "Kon nie die boodskap stuur nie. Probeer asseblief weer."
- },
"glanceable": {
"waiting": "Besig om agente op te dateer",
"empty": "Geen werk aan die gang nie",
@@ -2924,5 +2916,18 @@
"needsInput": "Wag op invoer",
"channelName": "Aktiewe agente",
"activityKitDisabledBody": "Skakel regstreekse aktiwiteite in die instellings aan om aktiewe agente op die sluitskerm te sien."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Begin 'n klets",
+ "description": "Stuur 'n boodskap om met 'n model te gesels."
+ },
+ "list": {
+ "loadFailed": "Kon nie kletsgeskiedenis laai nie.",
+ "new": "Nuwe klets",
+ "openHint": "Maak die klets oop. Hou lank in om te skrap.",
+ "deleteTitle": "Skrap hierdie klets?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/am.json b/apps/mobile/src/i18n/locales/am.json
index 36ac76d577..da88be4bc3 100644
--- a/apps/mobile/src/i18n/locales/am.json
+++ b/apps/mobile/src/i18n/locales/am.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}}ን ከታመኑ አስተናጋጆች ያስወግዱ",
"backToPreferences": "ወደ ምርጫዎች ይመለሱ"
},
- "quickChat": {
- "empty": {
- "title": "ውይይት ይጀምሩ",
- "description": "ከሞዴል ጋር ለመወያየት መልዕክት ይላኩ።"
- },
- "historyRetry": "የውይይት ታሪኩን መጫን አልተቻለም።",
- "sendError": "መልዕክቱን መላክ አልተቻለም። እንደገና ይሞክሩ።"
- },
"glanceable": {
"waiting": "ወኪሎችን በማዘመን ላይ",
"empty": "በሂደት ላይ ያለ ስራ የለም",
@@ -2924,5 +2916,18 @@
"needsInput": "ምላሽ ይፈልጋል",
"channelName": "ንቁ ወኪሎች",
"activityKitDisabledBody": "ንቁ ወኪሎችን በተቆለፈው ማያ ገጽ ላይ ለማየት በቅንብሮች ውስጥ የቀጥታ እንቅስቃሴዎችን አንቃ።"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "ውይይት ጀምር",
+ "description": "ከሞዴል ጋር ለመወያየት መልእክት ይላኩ።"
+ },
+ "list": {
+ "loadFailed": "የውይይት ታሪክ መጫን አልተቻለም።",
+ "new": "አዲስ ውይይት",
+ "openHint": "ውይይቱን ይከፍታል። ለመሰረዝ ተጭነው ይያዙ።",
+ "deleteTitle": "ይህ ውይይት ይሰረዝ?"
+ },
+ "beta": "ቤታ"
}
}
diff --git a/apps/mobile/src/i18n/locales/ar.json b/apps/mobile/src/i18n/locales/ar.json
index ca7998ce9e..764522b041 100644
--- a/apps/mobile/src/i18n/locales/ar.json
+++ b/apps/mobile/src/i18n/locales/ar.json
@@ -2993,14 +2993,6 @@
"revoke": "إلغاء الثقة بالمضيف {{host}}",
"backToPreferences": "العودة إلى التفضيلات"
},
- "quickChat": {
- "empty": {
- "title": "ابدأ محادثة",
- "description": "أرسل رسالة للتحدث مع نموذج."
- },
- "historyRetry": "تعذّر تحميل سجل المحادثة.",
- "sendError": "تعذّر إرسال الرسالة. حاول مرة أخرى."
- },
"glanceable": {
"waiting": "جارٍ تحديث الوكلاء",
"empty": "لا يوجد عمل قيد التنفيذ",
@@ -3012,5 +3004,18 @@
"needsInput": "بانتظار تدخلك",
"channelName": "الوكلاء النشطون",
"activityKitDisabledBody": "فعّل الأنشطة المباشرة في الإعدادات لعرض الوكلاء النشطين على شاشة القفل."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "بدء محادثة",
+ "description": "أرسل رسالة للتحدث مع نموذج."
+ },
+ "list": {
+ "loadFailed": "تعذّر تحميل سجل المحادثة.",
+ "new": "محادثة جديدة",
+ "openHint": "يفتح المحادثة. اضغط مطولاً للحذف.",
+ "deleteTitle": "حذف هذه المحادثة؟"
+ },
+ "beta": "بيتا"
}
}
diff --git a/apps/mobile/src/i18n/locales/az.json b/apps/mobile/src/i18n/locales/az.json
index 6477004095..8ed143ace8 100644
--- a/apps/mobile/src/i18n/locales/az.json
+++ b/apps/mobile/src/i18n/locales/az.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} üçün etibarı ləğv et",
"backToPreferences": "Parametrlərə qayıt"
},
- "quickChat": {
- "empty": {
- "title": "Söhbətə başla",
- "description": "Modellə danışmaq üçün mesaj göndər."
- },
- "historyRetry": "Söhbət tarixçəsi yüklənə bilmədi.",
- "sendError": "Mesajı göndərmək mümkün olmadı. Yenidən cəhd et."
- },
"glanceable": {
"waiting": "Agentlər yenilənir",
"empty": "Davam edən iş yoxdur",
@@ -2924,5 +2916,18 @@
"needsInput": "Cavab gözləyir",
"channelName": "Aktiv agentlər",
"activityKitDisabledBody": "Kilid ekranında aktiv agentləri görmək üçün parametrlərdə canlı fəaliyyətləri aktivləşdir."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Söhbətə başlayın",
+ "description": "Bir modellə danışmaq üçün mesaj göndərin."
+ },
+ "list": {
+ "loadFailed": "Söhbət tarixçəsi yüklənə bilmədi.",
+ "new": "Yeni söhbət",
+ "openHint": "Söhbəti açır. Silmək üçün basıb saxlayın.",
+ "deleteTitle": "Bu söhbət silinsin?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/be.json b/apps/mobile/src/i18n/locales/be.json
index 1b138c1007..fc3eb17976 100644
--- a/apps/mobile/src/i18n/locales/be.json
+++ b/apps/mobile/src/i18n/locales/be.json
@@ -2949,14 +2949,6 @@
"revoke": "Адклікаць давер да {{host}}",
"backToPreferences": "Назад да налад"
},
- "quickChat": {
- "empty": {
- "title": "Пачніце размову",
- "description": "Адпраўце паведамленне, каб пачаць размову з мадэллю."
- },
- "historyRetry": "Не атрымалася загрузіць гісторыю чата.",
- "sendError": "Не атрымалася адправіць паведамленне. Паспрабуйце яшчэ раз."
- },
"glanceable": {
"waiting": "Абнаўленне агентаў",
"empty": "Няма задач у працы",
@@ -2968,5 +2960,18 @@
"needsInput": "Чакае адказу",
"channelName": "Актыўныя агенты",
"activityKitDisabledBody": "Уключы дзеянні ў рэальным часе ў наладах, каб бачыць актыўных агентаў на экране блакіроўкі."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Пачаць чат",
+ "description": "Адпраўце паведамленне, каб паразмаўляць з мадэллю."
+ },
+ "list": {
+ "loadFailed": "Не атрымалася загрузіць гісторыю чата.",
+ "new": "Новы чат",
+ "openHint": "Адкрывае чат. Утрымлівайце, каб выдаліць.",
+ "deleteTitle": "Выдаліць гэты чат?"
+ },
+ "beta": "Бэта"
}
}
diff --git a/apps/mobile/src/i18n/locales/bg.json b/apps/mobile/src/i18n/locales/bg.json
index a12a172a07..4fab3dded1 100644
--- a/apps/mobile/src/i18n/locales/bg.json
+++ b/apps/mobile/src/i18n/locales/bg.json
@@ -2905,14 +2905,6 @@
"revoke": "Премахни {{host}} от доверените хостове",
"backToPreferences": "Обратно към предпочитанията"
},
- "quickChat": {
- "empty": {
- "title": "Започни чат",
- "description": "Изпрати съобщение, за да разговаряш с модел."
- },
- "historyRetry": "Не можа да се зареди историята на чата.",
- "sendError": "Не успяхме да изпратим съобщението. Опитай отново."
- },
"glanceable": {
"waiting": "Актуализиране на агентите",
"empty": "Няма задачи в ход",
@@ -2924,5 +2916,18 @@
"needsInput": "Нужен е отговор",
"channelName": "Активни агенти",
"activityKitDisabledBody": "Включи дейностите на живо в настройките, за да виждаш активните агенти на заключения екран."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Започнете разговор",
+ "description": "Изпратете съобщение, за да говорите с модел."
+ },
+ "list": {
+ "loadFailed": "Не можа да се зареди историята на чата.",
+ "new": "Нов чат",
+ "openHint": "Отваря чата. Задръжте, за да изтриете.",
+ "deleteTitle": "Изтриване на този чат?"
+ },
+ "beta": "Бета"
}
}
diff --git a/apps/mobile/src/i18n/locales/bn.json b/apps/mobile/src/i18n/locales/bn.json
index a746383e78..dc5229f36c 100644
--- a/apps/mobile/src/i18n/locales/bn.json
+++ b/apps/mobile/src/i18n/locales/bn.json
@@ -2905,14 +2905,6 @@
"revoke": "বিশ্বস্ত হোস্টের তালিকা থেকে {{host}} সরান",
"backToPreferences": "পছন্দসমূহে ফিরুন"
},
- "quickChat": {
- "empty": {
- "title": "চ্যাট শুরু করুন",
- "description": "মডেলের সাথে কথা বলতে একটি বার্তা পাঠান।"
- },
- "historyRetry": "চ্যাটের ইতিহাস লোড করা যায়নি।",
- "sendError": "বার্তাটি পাঠানো যায়নি। আবার চেষ্টা করুন।"
- },
"glanceable": {
"waiting": "এজেন্টের তথ্য আপডেট হচ্ছে",
"empty": "কোনো কাজ চলছে না",
@@ -2924,5 +2916,18 @@
"needsInput": "ইনপুট প্রয়োজন",
"channelName": "সক্রিয় এজেন্ট",
"activityKitDisabledBody": "লক স্ক্রিনে সক্রিয় এজেন্ট দেখতে সেটিংসে লাইভ অ্যাক্টিভিটি চালু করুন।"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "চ্যাট শুরু করুন",
+ "description": "মডেলের সাথে কথা বলতে একটি বার্তা পাঠান।"
+ },
+ "list": {
+ "loadFailed": "চ্যাট ইতিহাস লোড করা যায়নি।",
+ "new": "নতুন চ্যাট",
+ "openHint": "চ্যাট খোলে। মুছে ফেলতে চেপে ধরুন।",
+ "deleteTitle": "এই চ্যাট মুছবেন?"
+ },
+ "beta": "বিটা"
}
}
diff --git a/apps/mobile/src/i18n/locales/bs.json b/apps/mobile/src/i18n/locales/bs.json
index ec78daca02..0b447e2bba 100644
--- a/apps/mobile/src/i18n/locales/bs.json
+++ b/apps/mobile/src/i18n/locales/bs.json
@@ -2927,14 +2927,6 @@
"revoke": "Povuci povjerenje za {{host}}",
"backToPreferences": "Nazad na postavke"
},
- "quickChat": {
- "empty": {
- "title": "Započni razgovor",
- "description": "Pošalji poruku za razgovor s modelom."
- },
- "historyRetry": "Nije moguće učitati historiju razgovora.",
- "sendError": "Nije moguće poslati poruku. Pokušaj ponovo."
- },
"glanceable": {
"waiting": "Ažuriranje agenata",
"empty": "Nema zadataka u toku",
@@ -2946,5 +2938,18 @@
"needsInput": "Čeka unos",
"channelName": "Aktivni agenti",
"activityKitDisabledBody": "Uključi aktivnosti uživo u postavkama da vidiš aktivne agente na zaključanom ekranu."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Započni razgovor",
+ "description": "Pošalji poruku za razgovor s modelom."
+ },
+ "list": {
+ "loadFailed": "Nije moguće učitati istoriju razgovora.",
+ "new": "Novi razgovor",
+ "openHint": "Otvara razgovor. Dugo pritisnite za brisanje.",
+ "deleteTitle": "Izbrisati ovaj razgovor?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ca.json b/apps/mobile/src/i18n/locales/ca.json
index 8646dddfdf..614288d7d9 100644
--- a/apps/mobile/src/i18n/locales/ca.json
+++ b/apps/mobile/src/i18n/locales/ca.json
@@ -2927,14 +2927,6 @@
"revoke": "Deixa de confiar en {{host}}",
"backToPreferences": "Torna a les preferències"
},
- "quickChat": {
- "empty": {
- "title": "Comença un xat",
- "description": "Envia un missatge per parlar amb un model."
- },
- "historyRetry": "No s'ha pogut carregar l'historial del xat.",
- "sendError": "No s'ha pogut enviar el missatge. Torna-ho a provar."
- },
"glanceable": {
"waiting": "S'estan actualitzant els agents",
"empty": "No hi ha cap feina en curs",
@@ -2946,5 +2938,18 @@
"needsInput": "Pendent de resposta",
"channelName": "Agents actius",
"activityKitDisabledBody": "Activa les activitats en directe a la configuració del dispositiu per veure els agents actius a la pantalla de bloqueig."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Comença un xat",
+ "description": "Envia un missatge per parlar amb un model."
+ },
+ "list": {
+ "loadFailed": "No s'ha pogut carregar l'historial del xat.",
+ "new": "Xat nou",
+ "openHint": "Obre el xat. Mantén premut per suprimir.",
+ "deleteTitle": "Vols suprimir aquest xat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ckb.json b/apps/mobile/src/i18n/locales/ckb.json
index ecd8a6c111..036ece83e4 100644
--- a/apps/mobile/src/i18n/locales/ckb.json
+++ b/apps/mobile/src/i18n/locales/ckb.json
@@ -2905,14 +2905,6 @@
"revoke": "هەڵوەشاندنەوەی متمانە بە {{host}}",
"backToPreferences": "گەڕانەوە بۆ ڕێکخستنەکان"
},
- "quickChat": {
- "empty": {
- "title": "دەست بە گفتوگۆ بکە",
- "description": "بۆ قسەکردن لەگەڵ مۆدێلێک، نامەیەک بنێرە."
- },
- "historyRetry": "نەتوانرا مێژووی گفتوگۆ بار بکرێت.",
- "sendError": "نەتوانرا نامەکە بنێردرێت. دووبارە هەوڵ بدە."
- },
"glanceable": {
"waiting": "لە نوێکردنەوەی ئەجێنتەکاندایە",
"empty": "هیچ کارێک بەڕێوە ناچێت",
@@ -2924,5 +2916,18 @@
"needsInput": "چاوەڕێی وەڵام",
"channelName": "ئەجێنتە چالاکەکان",
"activityKitDisabledBody": "بۆ بینینی ئەجێنتە چالاکەکان لە شاشەی قوفڵدا، چالاکییە ڕاستەوخۆکان لە ڕێکخستنەکاندا چالاک بکە."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "دەستپێکردنی گفتوگۆیەک",
+ "description": "پەیامێک بنێرە بۆ قسەکردن لەگەڵ مۆدێلێک."
+ },
+ "list": {
+ "loadFailed": "نەتوانرا مێژووی گفتوگۆ بار بکرێت.",
+ "new": "چاتی نوێ",
+ "openHint": "چاتەکە دەکاتەوە. بۆ سڕینەوە دەست بگرە.",
+ "deleteTitle": "ئەم چاتە بسڕدرێتەوە؟"
+ },
+ "beta": "بێتا"
}
}
diff --git a/apps/mobile/src/i18n/locales/cs.json b/apps/mobile/src/i18n/locales/cs.json
index 5edfa12109..1471b2fdc3 100644
--- a/apps/mobile/src/i18n/locales/cs.json
+++ b/apps/mobile/src/i18n/locales/cs.json
@@ -2949,14 +2949,6 @@
"revoke": "Odebrat důvěru doméně {{host}}",
"backToPreferences": "Zpět na předvolby"
},
- "quickChat": {
- "empty": {
- "title": "Začněte chatovat",
- "description": "Napište zprávu a začněte chatovat s modelem."
- },
- "historyRetry": "Historii chatu se nepodařilo načíst.",
- "sendError": "Zprávu se nepodařilo odeslat. Zkuste to prosím znovu."
- },
"glanceable": {
"waiting": "Aktualizace agentů",
"empty": "Žádné probíhající úkoly",
@@ -2968,5 +2960,18 @@
"needsInput": "Čeká na reakci",
"channelName": "Aktivní agenti",
"activityKitDisabledBody": "V nastavení zapni živé aktivity, aby se aktivní agenti zobrazovali na zamknuté obrazovce."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Začněte chatovat",
+ "description": "Pošlete zprávu, abyste si popovídali s modelem."
+ },
+ "list": {
+ "loadFailed": "Historie chatu se nepodařila načíst.",
+ "new": "Nový chat",
+ "openHint": "Otevře chat. Dlouhým stisknutím smažete.",
+ "deleteTitle": "Smazat tento chat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/cy.json b/apps/mobile/src/i18n/locales/cy.json
index 571519fd8a..3415a2555f 100644
--- a/apps/mobile/src/i18n/locales/cy.json
+++ b/apps/mobile/src/i18n/locales/cy.json
@@ -2993,14 +2993,6 @@
"revoke": "Dirymu ymddiriedaeth yn {{host}}",
"backToPreferences": "Yn ôl i'r dewisiadau"
},
- "quickChat": {
- "empty": {
- "title": "Dechrau sgwrs",
- "description": "Anfonwch neges i siarad â model."
- },
- "historyRetry": "Ni ellid llwytho hanes y sgwrs.",
- "sendError": "Ni ellid anfon y neges. Ceisiwch eto."
- },
"glanceable": {
"waiting": "Yn diweddaru asiantau",
"empty": "Dim gwaith ar y gweill",
@@ -3012,5 +3004,18 @@
"needsInput": "Angen mewnbwn",
"channelName": "Asiantau gweithredol",
"activityKitDisabledBody": "Trowch weithgareddau byw ymlaen yn y gosodiadau i weld asiantau gweithredol ar y sgrin glo."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Dechrau sgwrs",
+ "description": "Anfonwch neges i siarad â model."
+ },
+ "list": {
+ "loadFailed": "Ni ellid llwytho hanes y sgwrs.",
+ "new": "Sgwrs newydd",
+ "openHint": "Yn agor y sgwrs. Pwyswch yn hir i ddileu.",
+ "deleteTitle": "Dileu'r sgwrs hon?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/da.json b/apps/mobile/src/i18n/locales/da.json
index 729d83840c..a09cd4d7a4 100644
--- a/apps/mobile/src/i18n/locales/da.json
+++ b/apps/mobile/src/i18n/locales/da.json
@@ -2905,14 +2905,6 @@
"revoke": "Fjern tillid til {{host}}",
"backToPreferences": "Tilbage til indstillinger"
},
- "quickChat": {
- "empty": {
- "title": "Start en chat",
- "description": "Send en besked for at tale med en model."
- },
- "historyRetry": "Chathistorikken kunne ikke indlæses.",
- "sendError": "Kunne ikke sende beskeden. Prøv igen."
- },
"glanceable": {
"waiting": "Opdaterer agenter",
"empty": "Intet arbejde i gang",
@@ -2924,5 +2916,18 @@
"needsInput": "Afventer svar",
"channelName": "Aktive agenter",
"activityKitDisabledBody": "Slå liveaktiviteter til i Indstillinger for at se aktive agenter på låseskærmen."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Start en chat",
+ "description": "Send en besked for at tale med en model."
+ },
+ "list": {
+ "loadFailed": "Kunne ikke indlæse chathistorik.",
+ "new": "Ny chat",
+ "openHint": "Åbner chatten. Tryk og hold for at slette.",
+ "deleteTitle": "Slet denne chat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/de.json b/apps/mobile/src/i18n/locales/de.json
index a59ea3d1ee..153ce2a05a 100644
--- a/apps/mobile/src/i18n/locales/de.json
+++ b/apps/mobile/src/i18n/locales/de.json
@@ -2905,14 +2905,6 @@
"revoke": "Vertrauen in {{host}} widerrufen",
"backToPreferences": "Zurück zu den Einstellungen"
},
- "quickChat": {
- "empty": {
- "title": "Chat starten",
- "description": "Sende eine Nachricht, um mit einem Modell zu sprechen."
- },
- "historyRetry": "Der Chatverlauf konnte nicht geladen werden.",
- "sendError": "Die Nachricht konnte nicht gesendet werden. Versuche es erneut."
- },
"glanceable": {
"waiting": "Agenten werden aktualisiert",
"empty": "Keine laufenden Aufgaben",
@@ -2924,5 +2916,18 @@
"needsInput": "Eingabe erforderlich",
"channelName": "Aktive Agenten",
"activityKitDisabledBody": "Aktiviere Live-Aktivitäten in den Einstellungen, um aktive Agenten auf dem Sperrbildschirm zu sehen."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Chat starten",
+ "description": "Sende eine Nachricht, um mit einem Modell zu sprechen."
+ },
+ "list": {
+ "loadFailed": "Chatverlauf konnte nicht geladen werden.",
+ "new": "Neuer Chat",
+ "openHint": "Öffnet den Chat. Zum Löschen lange drücken.",
+ "deleteTitle": "Diesen Chat löschen?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/el.json b/apps/mobile/src/i18n/locales/el.json
index f07cd65fc9..e0ad94b30a 100644
--- a/apps/mobile/src/i18n/locales/el.json
+++ b/apps/mobile/src/i18n/locales/el.json
@@ -2905,14 +2905,6 @@
"revoke": "Ανάκληση εμπιστοσύνης για το {{host}}",
"backToPreferences": "Επιστροφή στις προτιμήσεις"
},
- "quickChat": {
- "empty": {
- "title": "Έναρξη συνομιλίας",
- "description": "Στείλε ένα μήνυμα για να συνομιλήσεις με ένα μοντέλο."
- },
- "historyRetry": "Δεν ήταν δυνατή η φόρτωση του ιστορικού συνομιλίας.",
- "sendError": "Δεν ήταν δυνατή η αποστολή του μηνύματος. Δοκίμασε ξανά."
- },
"glanceable": {
"waiting": "Ενημέρωση πρακτόρων",
"empty": "Καμία εργασία σε εξέλιξη",
@@ -2924,5 +2916,18 @@
"needsInput": "Αναμονή απάντησης",
"channelName": "Ενεργοί πράκτορες",
"activityKitDisabledBody": "Ενεργοποίησε τις ζωντανές δραστηριότητες στις ρυθμίσεις για να βλέπεις τους ενεργούς πράκτορες στην οθόνη κλειδώματος."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Ξεκινήστε μια συνομιλία",
+ "description": "Στείλτε ένα μήνυμα για να συνομιλήσετε με ένα μοντέλο."
+ },
+ "list": {
+ "loadFailed": "Δεν ήταν δυνατή η φόρτωση του ιστορικού συνομιλίας.",
+ "new": "Νέα συνομιλία",
+ "openHint": "Ανοίγει τη συνομιλία. Πατήστε παρατεταμένα για διαγραφή.",
+ "deleteTitle": "Διαγραφή αυτής της συνομιλίας;"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/en.json b/apps/mobile/src/i18n/locales/en.json
index 45c2163436..695b174a41 100644
--- a/apps/mobile/src/i18n/locales/en.json
+++ b/apps/mobile/src/i18n/locales/en.json
@@ -727,14 +727,6 @@
"kiloclawWrapped": "Kilo\nClaw",
"position": "{{name}}, tab, {{position}} of {{total}}"
},
- "quickChat": {
- "empty": {
- "title": "Start a chat",
- "description": "Send a message to talk to a model."
- },
- "historyRetry": "Could not load chat history.",
- "sendError": "Could not send the message. Try again."
- },
"chat": {
"instancePicker": {
"switchInstance": "Switch instance",
@@ -2924,5 +2916,18 @@
"needsInput": "Needs input",
"channelName": "Active agents",
"activityKitDisabledBody": "Turn on Live Activities in Settings to see Active Agents on the Lock Screen."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Start a chat",
+ "description": "Send a message to talk to a model."
+ },
+ "list": {
+ "loadFailed": "Could not load chat history.",
+ "new": "New chat",
+ "openHint": "Opens the chat. Long press to delete.",
+ "deleteTitle": "Delete this chat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/es.json b/apps/mobile/src/i18n/locales/es.json
index 8e10557c5e..6e1456d35b 100644
--- a/apps/mobile/src/i18n/locales/es.json
+++ b/apps/mobile/src/i18n/locales/es.json
@@ -2927,14 +2927,6 @@
"revoke": "Dejar de confiar en {{host}}",
"backToPreferences": "Volver a preferencias"
},
- "quickChat": {
- "empty": {
- "title": "Inicia un chat",
- "description": "Envía un mensaje para hablar con un modelo."
- },
- "historyRetry": "No se pudo cargar el historial del chat.",
- "sendError": "No se pudo enviar el mensaje. Inténtalo de nuevo."
- },
"glanceable": {
"waiting": "Actualizando el estado de los agentes",
"empty": "No hay trabajo en curso",
@@ -2946,5 +2938,18 @@
"needsInput": "En espera de respuesta",
"channelName": "Agentes activos",
"activityKitDisabledBody": "Activa las actividades en directo en Ajustes para ver los agentes activos en la pantalla de bloqueo."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Inicia un chat",
+ "description": "Envía un mensaje para hablar con un modelo."
+ },
+ "list": {
+ "loadFailed": "No se pudo cargar el historial del chat.",
+ "new": "Chat nuevo",
+ "openHint": "Abre el chat. Mantén pulsado para eliminar.",
+ "deleteTitle": "¿Eliminar este chat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/et.json b/apps/mobile/src/i18n/locales/et.json
index e4819e35fe..7f35bc4782 100644
--- a/apps/mobile/src/i18n/locales/et.json
+++ b/apps/mobile/src/i18n/locales/et.json
@@ -2905,14 +2905,6 @@
"revoke": "Lõpeta hosti {{host}} usaldamine",
"backToPreferences": "Tagasi eelistuste juurde"
},
- "quickChat": {
- "empty": {
- "title": "Alusta vestlust",
- "description": "Mudeliga vestlemiseks saada sõnum."
- },
- "historyRetry": "Vestluse ajaloo laadimine ei õnnestunud.",
- "sendError": "Sõnumi saatmine ebaõnnestus. Proovi uuesti."
- },
"glanceable": {
"waiting": "Agentide oleku värskendamine",
"empty": "Ühtegi tööd pole pooleli",
@@ -2924,5 +2916,18 @@
"needsInput": "Vajab sisendit",
"channelName": "Aktiivsed agendid",
"activityKitDisabledBody": "Lülita seadetes reaalajas tegevused sisse, et näha lukustuskuval aktiivseid agente."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Alusta vestlust",
+ "description": "Mudeliga vestlemiseks saada sõnum."
+ },
+ "list": {
+ "loadFailed": "Vestluse ajaloo laadimine ei õnnestunud.",
+ "new": "Uus vestlus",
+ "openHint": "Avab vestluse. Kustutamiseks hoia all.",
+ "deleteTitle": "Kas kustutada see vestlus?"
+ },
+ "beta": "Beeta"
}
}
diff --git a/apps/mobile/src/i18n/locales/eu.json b/apps/mobile/src/i18n/locales/eu.json
index 135d373cd1..49e15e929b 100644
--- a/apps/mobile/src/i18n/locales/eu.json
+++ b/apps/mobile/src/i18n/locales/eu.json
@@ -2905,14 +2905,6 @@
"revoke": "Kendu ostalari honi emandako konfiantza: {{host}}",
"backToPreferences": "Itzuli hobespenetara"
},
- "quickChat": {
- "empty": {
- "title": "Hasi txat bat",
- "description": "Bidali mezu bat eredu batekin hitz egiteko."
- },
- "historyRetry": "Ezin izan da txataren historiala kargatu.",
- "sendError": "Ezin izan da mezua bidali. Saiatu berriro."
- },
"glanceable": {
"waiting": "Agenteak eguneratzen",
"empty": "Ez dago lanik abian",
@@ -2924,5 +2916,18 @@
"needsInput": "Zure erantzunaren zain",
"channelName": "Agente aktiboak",
"activityKitDisabledBody": "Aktibatu zuzeneko jarduerak ezarpenetan, agente aktiboak blokeo-pantailan ikusteko."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Hasi txat bat",
+ "description": "Bidali mezu bat modelo batekin hitz egiteko."
+ },
+ "list": {
+ "loadFailed": "Ezin izan da txat-historia kargatu.",
+ "new": "Txat berria",
+ "openHint": "Txata irekitzen du. Ezabatzeko, sakatu luze.",
+ "deleteTitle": "Txat hau ezabatu?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/fa.json b/apps/mobile/src/i18n/locales/fa.json
index 950576699a..6e8132d806 100644
--- a/apps/mobile/src/i18n/locales/fa.json
+++ b/apps/mobile/src/i18n/locales/fa.json
@@ -2905,14 +2905,6 @@
"revoke": "لغو اعتماد به {{host}}",
"backToPreferences": "بازگشت به تنظیمات"
},
- "quickChat": {
- "empty": {
- "title": "شروع گفتوگو",
- "description": "برای گفتوگو با یک مدل، پیامی ارسال کنید."
- },
- "historyRetry": "بارگذاری تاریخچه گفتوگو ممکن نشد.",
- "sendError": "ارسال پیام ممکن نشد. دوباره تلاش کنید."
- },
"glanceable": {
"waiting": "در حال بهروزرسانی عاملها",
"empty": "هیچ کاری در حال انجام نیست",
@@ -2924,5 +2916,18 @@
"needsInput": "در انتظار ورودی",
"channelName": "عاملهای فعال",
"activityKitDisabledBody": "برای دیدن عاملهای فعال در صفحهٔ قفل، فعالیتهای زنده را در تنظیمات فعال کنید."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "شروع گفتگو",
+ "description": "برای گفتگو با یک مدل، یک پیام ارسال کنید."
+ },
+ "list": {
+ "loadFailed": "تاریخچه گفتگو بارگذاری نشد.",
+ "new": "گفتگوی جدید",
+ "openHint": "گفتگو را باز میکند. برای حذف، لمس کنید و نگه دارید.",
+ "deleteTitle": "این گفتگو حذف شود؟"
+ },
+ "beta": "بتا"
}
}
diff --git a/apps/mobile/src/i18n/locales/fi.json b/apps/mobile/src/i18n/locales/fi.json
index dacd5e04ff..393bb23d6f 100644
--- a/apps/mobile/src/i18n/locales/fi.json
+++ b/apps/mobile/src/i18n/locales/fi.json
@@ -2905,14 +2905,6 @@
"revoke": "Poista luottamus verkkotunnukseen {{host}}",
"backToPreferences": "Takaisin asetuksiin"
},
- "quickChat": {
- "empty": {
- "title": "Aloita keskustelu",
- "description": "Aloita keskustelu mallin kanssa lähettämällä viesti."
- },
- "historyRetry": "Keskusteluhistoriaa ei voitu ladata.",
- "sendError": "Viestiä ei voitu lähettää. Yritä uudelleen."
- },
"glanceable": {
"waiting": "Päivitetään agentteja",
"empty": "Ei keskeneräisiä töitä",
@@ -2924,5 +2916,18 @@
"needsInput": "Odottaa vastausta",
"channelName": "Aktiiviset agentit",
"activityKitDisabledBody": "Ota live-aktiviteetit käyttöön asetuksissa, niin näet aktiiviset agentit lukitusnäytöllä."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Aloita keskustelu",
+ "description": "Lähetä viesti keskustellaksesi mallin kanssa."
+ },
+ "list": {
+ "loadFailed": "Keskusteluhistoriaa ei voitu ladata.",
+ "new": "Uusi keskustelu",
+ "openHint": "Avaa keskustelun. Poista painamalla pitkään.",
+ "deleteTitle": "Poistetaanko tämä keskustelu?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/fil.json b/apps/mobile/src/i18n/locales/fil.json
index c8bd2187c1..ba5c148d8e 100644
--- a/apps/mobile/src/i18n/locales/fil.json
+++ b/apps/mobile/src/i18n/locales/fil.json
@@ -2905,14 +2905,6 @@
"revoke": "Bawiin ang tiwala sa {{host}}",
"backToPreferences": "Bumalik sa mga setting"
},
- "quickChat": {
- "empty": {
- "title": "Magsimula ng chat",
- "description": "Magpadala ng mensahe para makipag-usap sa isang modelo."
- },
- "historyRetry": "Hindi ma-load ang kasaysayan ng chat.",
- "sendError": "Hindi maipadala ang mensahe. Subukang muli."
- },
"glanceable": {
"waiting": "Ina-update ang mga agent",
"empty": "Walang kasalukuyang gawain",
@@ -2924,5 +2916,18 @@
"needsInput": "Naghihintay ng sagot",
"channelName": "Mga aktibong agent",
"activityKitDisabledBody": "Paganahin ang mga live na aktibidad sa mga setting para makita ang mga aktibong agent sa naka-lock na screen."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Magsimula ng chat",
+ "description": "Magpadala ng mensahe para makipag-usap sa isang modelo."
+ },
+ "list": {
+ "loadFailed": "Hindi ma-load ang kasaysayan ng chat.",
+ "new": "Bagong chat",
+ "openHint": "Binubuksan ang chat. Pindutin nang matagal para burahin.",
+ "deleteTitle": "Burahin ang chat na ito?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/fr.json b/apps/mobile/src/i18n/locales/fr.json
index bc7bd2a4e9..6699d0416e 100644
--- a/apps/mobile/src/i18n/locales/fr.json
+++ b/apps/mobile/src/i18n/locales/fr.json
@@ -2927,14 +2927,6 @@
"revoke": "Retirer {{host}} des sites de confiance",
"backToPreferences": "Retour aux préférences"
},
- "quickChat": {
- "empty": {
- "title": "Démarrer une discussion",
- "description": "Envoyez un message pour discuter avec un modèle."
- },
- "historyRetry": "Impossible de charger l'historique de la conversation.",
- "sendError": "Impossible d'envoyer le message. Réessayez."
- },
"glanceable": {
"waiting": "Actualisation des agents",
"empty": "Aucun travail en cours",
@@ -2946,5 +2938,18 @@
"needsInput": "Intervention requise",
"channelName": "Agents actifs",
"activityKitDisabledBody": "Activez les activités en direct dans les paramètres pour voir les agents actifs sur l'écran verrouillé."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Démarrer une discussion",
+ "description": "Envoyez un message pour discuter avec un modèle."
+ },
+ "list": {
+ "loadFailed": "Impossible de charger l'historique de la conversation.",
+ "new": "Nouvelle discussion",
+ "openHint": "Ouvre la discussion. Appui long pour supprimer.",
+ "deleteTitle": "Supprimer cette discussion ?"
+ },
+ "beta": "Bêta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ga.json b/apps/mobile/src/i18n/locales/ga.json
index d0500c53fe..f43f5b20b3 100644
--- a/apps/mobile/src/i18n/locales/ga.json
+++ b/apps/mobile/src/i18n/locales/ga.json
@@ -2971,14 +2971,6 @@
"revoke": "Bain {{host}} de na hóstaigh iontaofa",
"backToPreferences": "Ar ais go dtí na roghanna"
},
- "quickChat": {
- "empty": {
- "title": "Tosaigh comhrá",
- "description": "Seol teachtaireacht chun labhairt le samhail."
- },
- "historyRetry": "Níorbh fhéidir stair an chomhrá a lódáil.",
- "sendError": "Níorbh fhéidir an teachtaireacht a sheoladh. Bain triail as arís."
- },
"glanceable": {
"waiting": "Gníomhairí á nuashonrú",
"empty": "Níl aon obair ar siúl",
@@ -2990,5 +2982,18 @@
"needsInput": "Ionchur de dhíth",
"channelName": "Gníomhairí gníomhacha",
"activityKitDisabledBody": "Cumasaigh gníomhaíochtaí beo sna socruithe chun gníomhairí gníomhacha a fheiceáil ar an scáileán glasála."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Tosaigh comhrá",
+ "description": "Seol teachtaireacht chun labhairt le samhail."
+ },
+ "list": {
+ "loadFailed": "Níorbh fhéidir stair an chomhrá a lódáil.",
+ "new": "Comhrá nua",
+ "openHint": "Osclaíonn sé an comhrá. Brúigh go fada chun scriosadh.",
+ "deleteTitle": "An comhrá seo a scriosadh?"
+ },
+ "beta": "Béite"
}
}
diff --git a/apps/mobile/src/i18n/locales/gl.json b/apps/mobile/src/i18n/locales/gl.json
index 13e58a59ba..017500b57b 100644
--- a/apps/mobile/src/i18n/locales/gl.json
+++ b/apps/mobile/src/i18n/locales/gl.json
@@ -2905,14 +2905,6 @@
"revoke": "Revogar a confianza en {{host}}",
"backToPreferences": "Volver ás preferencias"
},
- "quickChat": {
- "empty": {
- "title": "Inicia un chat",
- "description": "Envía unha mensaxe para falar cun modelo."
- },
- "historyRetry": "Non se puido cargar o historial do chat.",
- "sendError": "Non se puido enviar a mensaxe. Téntao de novo."
- },
"glanceable": {
"waiting": "Actualizando axentes",
"empty": "Non hai traballo en curso",
@@ -2924,5 +2916,18 @@
"needsInput": "Agardando resposta",
"channelName": "Axentes activos",
"activityKitDisabledBody": "Activa as actividades en directo nos axustes para ver os axentes activos na pantalla de bloqueo."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Inicia un chat",
+ "description": "Envía unha mensaxe para falar cun modelo."
+ },
+ "list": {
+ "loadFailed": "Non se puido cargar o historial do chat.",
+ "new": "Chat novo",
+ "openHint": "Abre o chat. Mantén premido para eliminar.",
+ "deleteTitle": "Eliminar este chat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/gu.json b/apps/mobile/src/i18n/locales/gu.json
index cc0ea227c8..ec4ab4a6dc 100644
--- a/apps/mobile/src/i18n/locales/gu.json
+++ b/apps/mobile/src/i18n/locales/gu.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} માટેની મંજૂરી રદ કરો",
"backToPreferences": "પસંદગીઓ પર પાછા જાઓ"
},
- "quickChat": {
- "empty": {
- "title": "વાતચીત શરૂ કરો",
- "description": "મોડલ સાથે વાત કરવા સંદેશ મોકલો."
- },
- "historyRetry": "વાતચીતનો ઇતિહાસ લોડ કરી શકાયો નહીં.",
- "sendError": "સંદેશ મોકલી શકાયો નહીં. ફરી પ્રયાસ કરો."
- },
"glanceable": {
"waiting": "એજન્ટોની માહિતી અપડેટ થઈ રહી છે",
"empty": "કોઈ કાર્ય ચાલુ નથી",
@@ -2924,5 +2916,18 @@
"needsInput": "જવાબ જરૂરી",
"channelName": "સક્રિય એજન્ટો",
"activityKitDisabledBody": "લૉક સ્ક્રીન પર સક્રિય એજન્ટો જોવા માટે સેટિંગ્સમાં લાઇવ પ્રવૃત્તિઓ ચાલુ કરો."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "વાતચીત શરૂ કરો",
+ "description": "મોડેલ સાથે વાત કરવા સંદેશ મોકલો."
+ },
+ "list": {
+ "loadFailed": "વાતચીત ઇતિહાસ લોડ કરી શકાયો નહીં.",
+ "new": "નવી ચેટ",
+ "openHint": "ચેટ ખોલે છે. કાઢી નાખવા માટે લાંબું દબાવો.",
+ "deleteTitle": "આ ચેટ કાઢી નાખવી?"
+ },
+ "beta": "બીટા"
}
}
diff --git a/apps/mobile/src/i18n/locales/ha.json b/apps/mobile/src/i18n/locales/ha.json
index 262e3ac410..f5a8820fae 100644
--- a/apps/mobile/src/i18n/locales/ha.json
+++ b/apps/mobile/src/i18n/locales/ha.json
@@ -2905,14 +2905,6 @@
"revoke": "Soke amincewa da {{host}}",
"backToPreferences": "Koma ga zaɓuɓɓuka"
},
- "quickChat": {
- "empty": {
- "title": "Fara tattaunawa",
- "description": "Aika saƙo don tattaunawa da samfuri."
- },
- "historyRetry": "An kasa loda tarihin tattaunawa.",
- "sendError": "An kasa aika saƙon. Sake gwadawa."
- },
"glanceable": {
"waiting": "Ana sabunta wakilai",
"empty": "Babu aikin da ke gudana",
@@ -2924,5 +2916,18 @@
"needsInput": "Ana buƙatar bayani",
"channelName": "Wakilai da ke aiki",
"activityKitDisabledBody": "Kunna ayyukan kai tsaye a saituna don ganin wakilan da ke aiki a allon kulle."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Fara tattaunawa",
+ "description": "Aika saƙo don tattaunawa da samfurin."
+ },
+ "list": {
+ "loadFailed": "Ba a iya loda tarihin tattaunawa.",
+ "new": "Sabuwar tattaunawa",
+ "openHint": "Yana buɗe tattaunawar. Danna sosai don sharewa.",
+ "deleteTitle": "A share wannan tattaunawar?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/he.json b/apps/mobile/src/i18n/locales/he.json
index 6d18afc406..7caea19402 100644
--- a/apps/mobile/src/i18n/locales/he.json
+++ b/apps/mobile/src/i18n/locales/he.json
@@ -2927,14 +2927,6 @@
"revoke": "ביטול האמון באתר {{host}}",
"backToPreferences": "חזרה להעדפות"
},
- "quickChat": {
- "empty": {
- "title": "התחלת שיחה",
- "description": "שלח הודעה כדי לשוחח עם מודל."
- },
- "historyRetry": "לא ניתן לטעון את היסטוריית השיחה.",
- "sendError": "לא ניתן לשלוח את ההודעה. נסה שוב."
- },
"glanceable": {
"waiting": "נתוני הסוכנים מתעדכנים",
"empty": "אין משימות בביצוע",
@@ -2946,5 +2938,18 @@
"needsInput": "נדרש קלט",
"channelName": "סוכנים פעילים",
"activityKitDisabledBody": "הפעל פעילויות בזמן אמת בהגדרות כדי לראות סוכנים פעילים במסך הנעילה."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "התחל שיחה",
+ "description": "שלח הודעה כדי לשוחח עם מודל."
+ },
+ "list": {
+ "loadFailed": "לא ניתן היה לטעון את היסטוריית השיחה.",
+ "new": "צ'אט חדש",
+ "openHint": "פותח את הצ'אט. לחיצה ארוכה למחיקה.",
+ "deleteTitle": "למחוק את הצ'אט הזה?"
+ },
+ "beta": "בטא"
}
}
diff --git a/apps/mobile/src/i18n/locales/hi.json b/apps/mobile/src/i18n/locales/hi.json
index ff34f0d476..afe3246068 100644
--- a/apps/mobile/src/i18n/locales/hi.json
+++ b/apps/mobile/src/i18n/locales/hi.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} को विश्वसनीय होस्ट से हटाएँ",
"backToPreferences": "प्राथमिकताओं पर वापस जाएँ"
},
- "quickChat": {
- "empty": {
- "title": "चैट शुरू करें",
- "description": "किसी मॉडल से बात करने के लिए संदेश भेजें।"
- },
- "historyRetry": "चैट का इतिहास लोड नहीं हो सका।",
- "sendError": "संदेश भेजा नहीं जा सका। फिर से कोशिश करें।"
- },
"glanceable": {
"waiting": "एजेंट की जानकारी अपडेट हो रही है",
"empty": "अभी कोई काम नहीं चल रहा",
@@ -2924,5 +2916,18 @@
"needsInput": "इनपुट चाहिए",
"channelName": "सक्रिय एजेंट",
"activityKitDisabledBody": "लॉक स्क्रीन पर सक्रिय एजेंट देखने के लिए सेटिंग में लाइव ऐक्टिविटी चालू करें।"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "चैट शुरू करें",
+ "description": "किसी मॉडल से बात करने के लिए संदेश भेजें।"
+ },
+ "list": {
+ "loadFailed": "चैट इतिहास लोड नहीं किया जा सका।",
+ "new": "नई चैट",
+ "openHint": "चैट खोलता है। मिटाने के लिए देर तक दबाएँ।",
+ "deleteTitle": "यह चैट मिटाएँ?"
+ },
+ "beta": "बीटा"
}
}
diff --git a/apps/mobile/src/i18n/locales/hr.json b/apps/mobile/src/i18n/locales/hr.json
index 2eead89508..02768b5041 100644
--- a/apps/mobile/src/i18n/locales/hr.json
+++ b/apps/mobile/src/i18n/locales/hr.json
@@ -2927,14 +2927,6 @@
"revoke": "Opozovi povjerenje za {{host}}",
"backToPreferences": "Natrag na postavke"
},
- "quickChat": {
- "empty": {
- "title": "Započni razgovor",
- "description": "Pošalji poruku za razgovor s modelom."
- },
- "historyRetry": "Nije moguće učitati povijest razgovora.",
- "sendError": "Nije moguće poslati poruku. Pokušaj ponovno."
- },
"glanceable": {
"waiting": "Ažuriranje agenata",
"empty": "Nema zadataka u tijeku",
@@ -2946,5 +2938,18 @@
"needsInput": "Čeka unos",
"channelName": "Aktivni agenti",
"activityKitDisabledBody": "Uključi aktivnosti uživo u postavkama za prikaz aktivnih agenata na zaključanom zaslonu."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Započnite chat",
+ "description": "Pošaljite poruku za razgovor s modelom."
+ },
+ "list": {
+ "loadFailed": "Nije moguće učitati povijest razgovora.",
+ "new": "Novi razgovor",
+ "openHint": "Otvara razgovor. Dugo pritisnite za brisanje.",
+ "deleteTitle": "Izbrisati ovaj razgovor?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ht.json b/apps/mobile/src/i18n/locales/ht.json
index 3c23c3b25a..2c7565ac59 100644
--- a/apps/mobile/src/i18n/locales/ht.json
+++ b/apps/mobile/src/i18n/locales/ht.json
@@ -2905,14 +2905,6 @@
"revoke": "Retire {{host}}",
"backToPreferences": "Tounen nan preferans yo"
},
- "quickChat": {
- "empty": {
- "title": "Kòmanse yon konvèsasyon",
- "description": "Voye yon mesaj pou pale ak yon modèl."
- },
- "historyRetry": "Nou pa t ka chaje istwa konvèsasyon an.",
- "sendError": "Nou pa t ka voye mesaj la. Eseye ankò."
- },
"glanceable": {
"waiting": "Ap mete ajan yo ajou",
"empty": "Pa gen travay k ap fèt",
@@ -2924,5 +2916,18 @@
"needsInput": "Bezwen repons",
"channelName": "Ajan aktif",
"activityKitDisabledBody": "Nan paramèt yo, aktive aktivite an dirèk yo pou wè ajan aktif yo sou ekran fèmen an."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Kòmanse yon chat",
+ "description": "Voye yon mesaj pou pale ak yon modèl."
+ },
+ "list": {
+ "loadFailed": "Pa t ka chaje istwa chat la.",
+ "new": "Nouvo chat",
+ "openHint": "Louvri chat la. Peze lontan pou efase.",
+ "deleteTitle": "Efase chat sa a?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/hu.json b/apps/mobile/src/i18n/locales/hu.json
index efef5fe362..731eb83a0a 100644
--- a/apps/mobile/src/i18n/locales/hu.json
+++ b/apps/mobile/src/i18n/locales/hu.json
@@ -2905,14 +2905,6 @@
"revoke": "A megbízható jelölés visszavonása: {{host}}",
"backToPreferences": "Vissza a beállításokhoz"
},
- "quickChat": {
- "empty": {
- "title": "Csevegés indítása",
- "description": "Küldj egy üzenetet, hogy beszélgethess egy modellel."
- },
- "historyRetry": "Nem sikerült betölteni a csevegés előzményeit.",
- "sendError": "Nem sikerült elküldeni az üzenetet. Próbáld újra."
- },
"glanceable": {
"waiting": "Ügynökök frissítése",
"empty": "Nincs folyamatban lévő munka",
@@ -2924,5 +2916,18 @@
"needsInput": "Válaszra vár",
"channelName": "Aktív ügynökök",
"activityKitDisabledBody": "Kapcsold be az Élő tevékenységek funkciót a Beállításokban, hogy az aktív ügynökök megjelenjenek a zárolási képernyőn."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Kezdjen csevegést",
+ "description": "Küldjön egy üzenetet, hogy beszélgessen egy modellel."
+ },
+ "list": {
+ "loadFailed": "Nem sikerült betölteni a csevegés előzményeit.",
+ "new": "Új csevegés",
+ "openHint": "Megnyitja a csevegést. Hosszan nyomja meg a törléshez.",
+ "deleteTitle": "Törli ezt a csevegést?"
+ },
+ "beta": "Béta"
}
}
diff --git a/apps/mobile/src/i18n/locales/hy.json b/apps/mobile/src/i18n/locales/hy.json
index db557ba6d2..abedc3c252 100644
--- a/apps/mobile/src/i18n/locales/hy.json
+++ b/apps/mobile/src/i18n/locales/hy.json
@@ -2905,14 +2905,6 @@
"revoke": "Չեղարկել վստահությունը {{host}} կայքի նկատմամբ",
"backToPreferences": "Վերադառնալ կարգավորումներին"
},
- "quickChat": {
- "empty": {
- "title": "Զրույցի սկիզբ",
- "description": "Ուղարկիր հաղորդագրություն՝ մոդելի հետ զրուցելու համար։"
- },
- "historyRetry": "Չհաջողվեց բեռնել զրույցի պատմությունը։",
- "sendError": "Չհաջողվեց ուղարկել հաղորդագրությունը։ Կրկին փորձիր։"
- },
"glanceable": {
"waiting": "Գործակալների տվյալները թարմացվում են",
"empty": "Ընթացիկ աշխատանք չկա",
@@ -2924,5 +2916,18 @@
"needsInput": "Սպասում է պատասխանի",
"channelName": "Ակտիվ գործակալներ",
"activityKitDisabledBody": "Կարգավորումներում միացրու ընթացիկ գործողությունների ցուցադրումը՝ ակտիվ գործակալներին կողպման էկրանին տեսնելու համար։"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Սկսել զրույց",
+ "description": "Ուղարկեք հաղորդագրություն մոդելի հետ խոսելու համար."
+ },
+ "list": {
+ "loadFailed": "Հնարավոր չեղավ բեռնել զրույցի պատմությունը.",
+ "new": "Նոր զրույց",
+ "openHint": "Բացում է զրույցը. Երկար սեղմեք ջնջելու համար:",
+ "deleteTitle": "Ջնջե՞լ այս զրույցը:"
+ },
+ "beta": "Բետա"
}
}
diff --git a/apps/mobile/src/i18n/locales/id.json b/apps/mobile/src/i18n/locales/id.json
index 3de086c2c5..b4a5272bec 100644
--- a/apps/mobile/src/i18n/locales/id.json
+++ b/apps/mobile/src/i18n/locales/id.json
@@ -2905,14 +2905,6 @@
"revoke": "Cabut kepercayaan untuk {{host}}",
"backToPreferences": "Kembali ke preferensi"
},
- "quickChat": {
- "empty": {
- "title": "Mulai obrolan",
- "description": "Kirim pesan untuk mengobrol dengan model."
- },
- "historyRetry": "Tidak dapat memuat riwayat obrolan.",
- "sendError": "Tidak dapat mengirim pesan. Coba lagi."
- },
"glanceable": {
"waiting": "Memperbarui agen",
"empty": "Tidak ada tugas yang sedang berjalan",
@@ -2924,5 +2916,18 @@
"needsInput": "Perlu masukan",
"channelName": "Agen aktif",
"activityKitDisabledBody": "Aktifkan Aktivitas Langsung di pengaturan untuk melihat agen aktif di layar terkunci."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Mulai obrolan",
+ "description": "Kirim pesan untuk berbicara dengan model."
+ },
+ "list": {
+ "loadFailed": "Tidak dapat memuat riwayat obrolan.",
+ "new": "Obrolan baru",
+ "openHint": "Membuka obrolan. Tekan lama untuk menghapus.",
+ "deleteTitle": "Hapus obrolan ini?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ig.json b/apps/mobile/src/i18n/locales/ig.json
index d31b71aa27..49afc2e8c4 100644
--- a/apps/mobile/src/i18n/locales/ig.json
+++ b/apps/mobile/src/i18n/locales/ig.json
@@ -2905,14 +2905,6 @@
"revoke": "Kagbuo ntụkwasị obi na {{host}}",
"backToPreferences": "Laghachi na nhọrọ"
},
- "quickChat": {
- "empty": {
- "title": "Malite mkparịta ụka",
- "description": "Ziga ozi ka ị kparịta ụka na ụdị AI."
- },
- "historyRetry": "Enweghị ike ibudata ndekọ mkparịta ụka.",
- "sendError": "Enweghị ike iziga ozi ahụ. Nwaa ọzọ."
- },
"glanceable": {
"waiting": "Na-emelite ndị nnọchi anya",
"empty": "Enweghị ọrụ na-aga n'ihu",
@@ -2924,5 +2916,18 @@
"needsInput": "Chọrọ nzaghachi",
"channelName": "Ndị nnọchi anya na-arụ ọrụ",
"activityKitDisabledBody": "Gbanye ihe omume na-emelite ozugbo n'ime ntọala ka ị hụ ndị nnọchi anya na-arụ ọrụ n'ihuenyo mkpọchi."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Malite nkata",
+ "description": "Ziga ozi ka ị soro ihe nlereanya kparịta ụka."
+ },
+ "list": {
+ "loadFailed": "Enweghị ike ibutu akụkọ nkata.",
+ "new": "Nkata ọhụrụ",
+ "openHint": "Na-emeghe nkata ahụ. Pịgide iji hichapụ.",
+ "deleteTitle": "Hichapụ nkata a?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/is.json b/apps/mobile/src/i18n/locales/is.json
index d0cb73eb26..41b3cce01a 100644
--- a/apps/mobile/src/i18n/locales/is.json
+++ b/apps/mobile/src/i18n/locales/is.json
@@ -2905,14 +2905,6 @@
"revoke": "Afturkalla traust á {{host}}",
"backToPreferences": "Til baka í stillingar"
},
- "quickChat": {
- "empty": {
- "title": "Byrjaðu spjall",
- "description": "Sendu skilaboð til að spjalla við líkan."
- },
- "historyRetry": "Ekki tókst að sækja spjallferilinn.",
- "sendError": "Ekki tókst að senda skilaboðin. Reyndu aftur."
- },
"glanceable": {
"waiting": "Uppfæri fulltrúa",
"empty": "Engin vinna í gangi",
@@ -2924,5 +2916,18 @@
"needsInput": "Bíður eftir svari",
"channelName": "Virkir fulltrúar",
"activityKitDisabledBody": "Kveiktu á rauntímavirkni í stillingum til að sjá virka fulltrúa á lásskjánum."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Byrjaðu spjall",
+ "description": "Sendu skilaboð til að tala við líkan."
+ },
+ "list": {
+ "loadFailed": "Ekki tókst að hlaða samtalsferilinn.",
+ "new": "Nýtt spjall",
+ "openHint": "Opnar spjallið. Haltu inni til að eyða.",
+ "deleteTitle": "Eyða þessu spjalli?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/it.json b/apps/mobile/src/i18n/locales/it.json
index 5694d74ab6..1eb3d1f969 100644
--- a/apps/mobile/src/i18n/locales/it.json
+++ b/apps/mobile/src/i18n/locales/it.json
@@ -2927,14 +2927,6 @@
"revoke": "Revoca l'attendibilità di {{host}}",
"backToPreferences": "Torna alle preferenze"
},
- "quickChat": {
- "empty": {
- "title": "Avvia una chat",
- "description": "Invia un messaggio per parlare con un modello."
- },
- "historyRetry": "Impossibile caricare la cronologia della chat.",
- "sendError": "Impossibile inviare il messaggio. Riprova."
- },
"glanceable": {
"waiting": "Aggiornamento degli agenti",
"empty": "Nessun lavoro in corso",
@@ -2946,5 +2938,18 @@
"needsInput": "In attesa di risposta",
"channelName": "Agenti attivi",
"activityKitDisabledBody": "Attiva le attività in tempo reale nelle impostazioni per vedere gli agenti attivi nella schermata di blocco."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Avvia una chat",
+ "description": "Invia un messaggio per parlare con un modello."
+ },
+ "list": {
+ "loadFailed": "Impossibile caricare la cronologia della chat.",
+ "new": "Nuova chat",
+ "openHint": "Apre la chat. Tieni premuto per eliminare.",
+ "deleteTitle": "Eliminare questa chat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ja.json b/apps/mobile/src/i18n/locales/ja.json
index 725ef3ca06..0cc3ef15f1 100644
--- a/apps/mobile/src/i18n/locales/ja.json
+++ b/apps/mobile/src/i18n/locales/ja.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}}を信頼済みホストから削除",
"backToPreferences": "設定に戻る"
},
- "quickChat": {
- "empty": {
- "title": "チャットを開始",
- "description": "モデルと話すにはメッセージを送信してください。"
- },
- "historyRetry": "チャット履歴を読み込めませんでした。",
- "sendError": "メッセージを送信できませんでした。もう一度お試しください。"
- },
"glanceable": {
"waiting": "エージェントの状態を更新中",
"empty": "進行中の作業はありません",
@@ -2924,5 +2916,18 @@
"needsInput": "入力が必要",
"channelName": "アクティブなエージェント",
"activityKitDisabledBody": "ロック画面にアクティブなエージェントを表示するには、設定でライブアクティビティをオンにしてください。"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "チャットを開始",
+ "description": "モデルと話すにはメッセージを送信してください。"
+ },
+ "list": {
+ "loadFailed": "チャット履歴を読み込めませんでした。",
+ "new": "新しいチャット",
+ "openHint": "チャットを開きます。長押しで削除します。",
+ "deleteTitle": "このチャットを削除しますか?"
+ },
+ "beta": "ベータ"
}
}
diff --git a/apps/mobile/src/i18n/locales/ka.json b/apps/mobile/src/i18n/locales/ka.json
index 2b7e4e29b2..0ea4f52801 100644
--- a/apps/mobile/src/i18n/locales/ka.json
+++ b/apps/mobile/src/i18n/locales/ka.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}}-ის სანდო ჰოსტებიდან ამოღება",
"backToPreferences": "პარამეტრებში დაბრუნება"
},
- "quickChat": {
- "empty": {
- "title": "დაიწყე ჩატი",
- "description": "მოდელთან სასაუბროდ გაგზავნე შეტყობინება."
- },
- "historyRetry": "ჩატის ისტორიის ჩატვირთვა ვერ მოხერხდა.",
- "sendError": "შეტყობინების გაგზავნა ვერ მოხერხდა. სცადე ხელახლა."
- },
"glanceable": {
"waiting": "აგენტები ახლდება",
"empty": "მიმდინარე სამუშაო არ არის",
@@ -2924,5 +2916,18 @@
"needsInput": "პასუხს ელის",
"channelName": "აქტიური აგენტები",
"activityKitDisabledBody": "დაბლოკილ ეკრანზე აქტიური აგენტების სანახავად პარამეტრებში ჩართე მიმდინარე აქტივობები."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "დაიწყეთ ჩატი",
+ "description": "გაგზავნეთ შეტყობინება მოდელთან სასაუბროდ."
+ },
+ "list": {
+ "loadFailed": "ჩატის ისტორიის ჩატვირთვა ვერ მოხერხდა.",
+ "new": "ახალი ჩატი",
+ "openHint": "ხსნის ჩატს. წასაშლელად დიდხანს დააჭირეთ.",
+ "deleteTitle": "წაიშალოს ეს ჩატი?"
+ },
+ "beta": "ბეტა"
}
}
diff --git a/apps/mobile/src/i18n/locales/kk.json b/apps/mobile/src/i18n/locales/kk.json
index c878522091..a28cf3ab1a 100644
--- a/apps/mobile/src/i18n/locales/kk.json
+++ b/apps/mobile/src/i18n/locales/kk.json
@@ -2905,14 +2905,6 @@
"revoke": "Хостқа берілген сенімді қайтарып алу: {{host}}",
"backToPreferences": "Баптауларға оралу"
},
- "quickChat": {
- "empty": {
- "title": "Чатты бастаңыз",
- "description": "Модельмен сөйлесу үшін хабарлама жіберіңіз."
- },
- "historyRetry": "Чат тарихын жүктеу мүмкін болмады.",
- "sendError": "Хабарламаны жіберу мүмкін болмады. Қайталап көріңіз."
- },
"glanceable": {
"waiting": "Агенттер жаңартылуда",
"empty": "Орындалып жатқан жұмыс жоқ",
@@ -2924,5 +2916,18 @@
"needsInput": "Жауап қажет",
"channelName": "Белсенді агенттер",
"activityKitDisabledBody": "Құлыптау экранында белсенді агенттерді көру үшін баптауларда тікелей эфирдегі әрекеттерді қосыңыз."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Чатты бастаңыз",
+ "description": "Модельмен сөйлесу үшін хабарлама жіберіңіз."
+ },
+ "list": {
+ "loadFailed": "Чат тарихын жүктеу мүмкін болмады.",
+ "new": "Жаңа чат",
+ "openHint": "Чатты ашады. Жою үшін басып тұрыңыз.",
+ "deleteTitle": "Осы чат жойылсын ба?"
+ },
+ "beta": "Бета"
}
}
diff --git a/apps/mobile/src/i18n/locales/km.json b/apps/mobile/src/i18n/locales/km.json
index 166a5ee206..8a8494c1ec 100644
--- a/apps/mobile/src/i18n/locales/km.json
+++ b/apps/mobile/src/i18n/locales/km.json
@@ -2905,14 +2905,6 @@
"revoke": "ដកហូតការជឿទុកចិត្តលើ {{host}}",
"backToPreferences": "ត្រឡប់ទៅការកំណត់"
},
- "quickChat": {
- "empty": {
- "title": "ចាប់ផ្តើមជជែក",
- "description": "ផ្ញើសារដើម្បីជជែកជាមួយម៉ូដែល។"
- },
- "historyRetry": "មិនអាចផ្ទុកប្រវត្តិជជែកបានទេ។",
- "sendError": "មិនអាចផ្ញើសារបានទេ។ សូមព្យាយាមម្តងទៀត។"
- },
"glanceable": {
"waiting": "កំពុងធ្វើបច្ចុប្បន្នភាពស្ថានភាពភ្នាក់ងារ",
"empty": "គ្មានការងារកំពុងដំណើរការ",
@@ -2924,5 +2916,18 @@
"needsInput": "ត្រូវការការឆ្លើយតប",
"channelName": "ភ្នាក់ងារសកម្ម",
"activityKitDisabledBody": "បើកសកម្មភាពបន្តផ្ទាល់នៅក្នុងការកំណត់ ដើម្បីមើលភ្នាក់ងារសកម្មនៅលើអេក្រង់ចាក់សោ។"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "ចាប់ផ្តើមជជែក",
+ "description": "ផ្ញើសារដើម្បីនិយាយជាមួយគំរូមួយ។"
+ },
+ "list": {
+ "loadFailed": "មិនអាចផ្ទុកប្រវត្តិជជែកបានទេ។",
+ "new": "ការជជែកថ្មី",
+ "openHint": "បើកការជជែក។ ចុចឱ្យយូរដើម្បីលុប។",
+ "deleteTitle": "លុបការជជែកនេះ?"
+ },
+ "beta": "បេតា"
}
}
diff --git a/apps/mobile/src/i18n/locales/kn.json b/apps/mobile/src/i18n/locales/kn.json
index 3478cb4686..d7422b9bc2 100644
--- a/apps/mobile/src/i18n/locales/kn.json
+++ b/apps/mobile/src/i18n/locales/kn.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} ಗೆ ನೀಡಿದ ಅನುಮತಿಯನ್ನು ಹಿಂಪಡೆಯಿರಿ",
"backToPreferences": "ಆದ್ಯತೆಗಳಿಗೆ ಹಿಂತಿರುಗಿ"
},
- "quickChat": {
- "empty": {
- "title": "ಚಾಟ್ ಪ್ರಾರಂಭಿಸಿ",
- "description": "ಮಾದರಿಯೊಂದಿಗೆ ಮಾತನಾಡಲು ಸಂದೇಶ ಕಳುಹಿಸಿ."
- },
- "historyRetry": "ಚಾಟ್ ಇತಿಹಾಸವನ್ನು ಲೋಡ್ ಮಾಡಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ.",
- "sendError": "ಸಂದೇಶವನ್ನು ಕಳುಹಿಸಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ. ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ."
- },
"glanceable": {
"waiting": "ಏಜೆಂಟ್ಗಳನ್ನು ನವೀಕರಿಸಲಾಗುತ್ತಿದೆ",
"empty": "ಯಾವುದೇ ಕೆಲಸ ಪ್ರಗತಿಯಲ್ಲಿಲ್ಲ",
@@ -2924,5 +2916,18 @@
"needsInput": "ನಿಮ್ಮ ಪ್ರತಿಕ್ರಿಯೆ ಅಗತ್ಯ",
"channelName": "ಸಕ್ರಿಯ ಏಜೆಂಟ್ಗಳು",
"activityKitDisabledBody": "ಲಾಕ್ ಪರದೆಯಲ್ಲಿ ಸಕ್ರಿಯ ಏಜೆಂಟ್ಗಳನ್ನು ನೋಡಲು ಸೆಟ್ಟಿಂಗ್ಗಳಲ್ಲಿ ಲೈವ್ ಚಟುವಟಿಕೆಗಳನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಿ."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "ಚಾಟ್ ಪ್ರಾರಂಭಿಸಿ",
+ "description": "ಮಾಡೆಲ್ನೊಂದಿಗೆ ಮಾತನಾಡಲು ಸಂದೇಶ ಕಳುಹಿಸಿ."
+ },
+ "list": {
+ "loadFailed": "ಚಾಟ್ ಇತಿಹಾಸವನ್ನು ಲೋಡ್ ಮಾಡಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ.",
+ "new": "ಹೊಸ ಚಾಟ್",
+ "openHint": "ಚಾಟ್ ತೆರೆಯುತ್ತದೆ. ಅಳಿಸಲು ದೀರ್ಘವಾಗಿ ಒತ್ತಿರಿ.",
+ "deleteTitle": "ಈ ಚಾಟ್ ಅಳಿಸಬೇಕೇ?"
+ },
+ "beta": "ಬೀಟಾ"
}
}
diff --git a/apps/mobile/src/i18n/locales/ko.json b/apps/mobile/src/i18n/locales/ko.json
index 4658659c1b..87b1c5d45c 100644
--- a/apps/mobile/src/i18n/locales/ko.json
+++ b/apps/mobile/src/i18n/locales/ko.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} 신뢰 해제",
"backToPreferences": "환경설정으로 돌아가기"
},
- "quickChat": {
- "empty": {
- "title": "채팅 시작하기",
- "description": "모델과 대화하려면 메시지를 보내세요."
- },
- "historyRetry": "채팅 기록을 불러올 수 없습니다.",
- "sendError": "메시지를 보낼 수 없습니다. 다시 시도하세요."
- },
"glanceable": {
"waiting": "에이전트 상태 업데이트 중",
"empty": "진행 중인 작업 없음",
@@ -2924,5 +2916,18 @@
"needsInput": "입력 필요",
"channelName": "활성 에이전트",
"activityKitDisabledBody": "잠금 화면에서 활성 에이전트를 보려면 설정에서 실시간 현황을 켜세요."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "채팅 시작하기",
+ "description": "모델과 대화하려면 메시지를 보내세요."
+ },
+ "list": {
+ "loadFailed": "채팅 기록을 불러올 수 없습니다.",
+ "new": "새 채팅",
+ "openHint": "채팅을 엽니다. 길게 눌러 삭제합니다.",
+ "deleteTitle": "이 채팅을 삭제할까요?"
+ },
+ "beta": "베타"
}
}
diff --git a/apps/mobile/src/i18n/locales/lo.json b/apps/mobile/src/i18n/locales/lo.json
index f9123cd9c8..b670e09fb9 100644
--- a/apps/mobile/src/i18n/locales/lo.json
+++ b/apps/mobile/src/i18n/locales/lo.json
@@ -2905,14 +2905,6 @@
"revoke": "ຍົກເລີກການໄວ້ໃຈ {{host}}",
"backToPreferences": "ກັບໄປທີ່ການຕັ້ງຄ່າ"
},
- "quickChat": {
- "empty": {
- "title": "ເລີ່ມການສົນທະນາ",
- "description": "ສົ່ງຂໍ້ຄວາມເພື່ອສົນທະນາກັບໂມເດວ."
- },
- "historyRetry": "ບໍ່ສາມາດໂຫຼດປະຫວັດການສົນທະນາໄດ້.",
- "sendError": "ບໍ່ສາມາດສົ່ງຂໍ້ຄວາມໄດ້. ລອງອີກຄັ້ງ."
- },
"glanceable": {
"waiting": "ກຳລັງອັບເດດເອເຈນ",
"empty": "ບໍ່ມີວຽກທີ່ດຳເນີນຢູ່",
@@ -2924,5 +2916,18 @@
"needsInput": "ລໍຂໍ້ມູນຈາກທ່ານ",
"channelName": "ເອເຈນທີ່ກຳລັງເຮັດວຽກ",
"activityKitDisabledBody": "ເປີດກິດຈະກຳສົດໃນການຕັ້ງຄ່າ ເພື່ອເບິ່ງເອເຈນທີ່ກຳລັງເຮັດວຽກໃນໜ້າຈໍລັອກ."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "ເລີ່ມການສົນທະນາ",
+ "description": "ສົ່ງຂໍ້ຄວາມເພື່ອສົນທະນາກັບໂມເດວ."
+ },
+ "list": {
+ "loadFailed": "ບໍ່ສາມາດໂຫຼດປະຫວັດການສົນທະນາໄດ້.",
+ "new": "ແຊັດໃໝ່",
+ "openHint": "ເປີດແຊັດ. ກົດຄ້າງເພື່ອລຶບ.",
+ "deleteTitle": "ລຶບແຊັດນີ້ບໍ?"
+ },
+ "beta": "ເບຕ້າ"
}
}
diff --git a/apps/mobile/src/i18n/locales/lt.json b/apps/mobile/src/i18n/locales/lt.json
index 4dd0d7f401..fc63b98b6f 100644
--- a/apps/mobile/src/i18n/locales/lt.json
+++ b/apps/mobile/src/i18n/locales/lt.json
@@ -2949,14 +2949,6 @@
"revoke": "Atšaukti pasitikėjimą svetaine {{host}}",
"backToPreferences": "Grįžti į nuostatas"
},
- "quickChat": {
- "empty": {
- "title": "Pradėk pokalbį",
- "description": "Parašyk žinutę ir pradėk pokalbį su modeliu."
- },
- "historyRetry": "Nepavyko įkelti pokalbio istorijos.",
- "sendError": "Nepavyko išsiųsti žinutės. Bandyk dar kartą."
- },
"glanceable": {
"waiting": "Atnaujinami agentai",
"empty": "Nėra vykdomų darbų",
@@ -2968,5 +2960,18 @@
"needsInput": "Laukia atsakymo",
"channelName": "Aktyvūs agentai",
"activityKitDisabledBody": "Nustatymuose įjunk tiesiogines veiklas, kad užrakinimo ekrane matytum aktyvius agentus."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Pradėti pokalbį",
+ "description": "Siųskite žinutę, kad pakalbėtumėte su modeliu."
+ },
+ "list": {
+ "loadFailed": "Nepavyko įkelti pokalbio istorijos.",
+ "new": "Naujas pokalbis",
+ "openHint": "Atidaro pokalbį. Palaikykite, kad ištrintumėte.",
+ "deleteTitle": "Ištrinti šį pokalbį?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/lv.json b/apps/mobile/src/i18n/locales/lv.json
index a0c7b8f5ab..afda0ed88a 100644
--- a/apps/mobile/src/i18n/locales/lv.json
+++ b/apps/mobile/src/i18n/locales/lv.json
@@ -2927,14 +2927,6 @@
"revoke": "Atsaukt uzticību resursdatoram {{host}}",
"backToPreferences": "Atpakaļ uz iestatījumiem"
},
- "quickChat": {
- "empty": {
- "title": "Sāc tērzēt",
- "description": "Nosūti ziņojumu, lai sarunātos ar modeli."
- },
- "historyRetry": "Neizdevās ielādēt tērzēšanas vēsturi.",
- "sendError": "Neizdevās nosūtīt ziņojumu. Mēģini vēlreiz."
- },
"glanceable": {
"waiting": "Tiek atjaunināta informācija par aģentiem",
"empty": "Pašlaik nav aktīvu uzdevumu",
@@ -2946,5 +2938,18 @@
"needsInput": "Gaida ievadi",
"channelName": "Aktīvie aģenti",
"activityKitDisabledBody": "Iestatījumos ieslēdz tiešraides aktivitātes, lai bloķēšanas ekrānā redzētu aktīvos aģentus."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Sākt tērzēšanu",
+ "description": "Nosūti ziņojumu, lai sarunātos ar modeli."
+ },
+ "list": {
+ "loadFailed": "Neizdevās ielādēt tērzēšanas vēsturi.",
+ "new": "Jauna tērzēšana",
+ "openHint": "Atver tērzēšanu. Turiet nospiestu, lai dzēstu.",
+ "deleteTitle": "Vai dzēst šo tērzēšanu?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/mg.json b/apps/mobile/src/i18n/locales/mg.json
index 695d7dbe6f..edd9859168 100644
--- a/apps/mobile/src/i18n/locales/mg.json
+++ b/apps/mobile/src/i18n/locales/mg.json
@@ -2905,14 +2905,6 @@
"revoke": "Foano ny fitokisana ny {{host}}",
"backToPreferences": "Miverena amin'ny safidy"
},
- "quickChat": {
- "empty": {
- "title": "Atombohy ny resaka",
- "description": "Mandefasa hafatra hiresahana amin'ny modely."
- },
- "historyRetry": "Tsy nety nampidirina ny tantaran'ny resaka.",
- "sendError": "Tsy nety nalefa ny hafatra. Andramo indray."
- },
"glanceable": {
"waiting": "Manavao ny mpanatanteraka",
"empty": "Tsy misy asa mandeha",
@@ -2924,5 +2916,18 @@
"needsInput": "Mila valiny",
"channelName": "Mpanatanteraka mandeha",
"activityKitDisabledBody": "Alefaso ao amin'ny fikirana ny hetsika mivantana mba hahitana ny mpanatanteraka mandeha eo amin'ny efijery mihidy."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Atombohy resaka",
+ "description": "Mandefasa hafatra mba hiresaka amin'ny Modely."
+ },
+ "list": {
+ "loadFailed": "Tsy afaka nampidirina ny tantaran'ny resaka.",
+ "new": "Resaka vaovao",
+ "openHint": "Manokatra ny resaka. Tsindrio ela mba hamafana.",
+ "deleteTitle": "Hamafa ity resaka ity?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/mi.json b/apps/mobile/src/i18n/locales/mi.json
index b679487eca..c20ec3c5eb 100644
--- a/apps/mobile/src/i18n/locales/mi.json
+++ b/apps/mobile/src/i18n/locales/mi.json
@@ -2905,14 +2905,6 @@
"revoke": "Whakakorea te whirinaki ki {{host}}",
"backToPreferences": "Hoki ki ngā manakohanga"
},
- "quickChat": {
- "empty": {
- "title": "Tīmatahia he kōrerorero",
- "description": "Tukuna he karere hei kōrero ki tētahi tauira."
- },
- "historyRetry": "Kāore i taea te uta i te hītori kōrerorero.",
- "sendError": "Kāore i taea te tuku i te karere. Whakamātau anō."
- },
"glanceable": {
"waiting": "Kei te whakahou i ngā māngai",
"empty": "Kāore he mahi e haere ana",
@@ -2924,5 +2916,18 @@
"needsInput": "Me whai urupare",
"channelName": "Ngā māngai e mahi ana",
"activityKitDisabledBody": "Whakakāngia ngā mahi wā-tūturu i ngā tautuhinga kia kite ai i ngā māngai e mahi ana i te mata maukati."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Tīmata he kōrero",
+ "description": "Tukuna he karere hei kōrero ki tētahi tauira."
+ },
+ "list": {
+ "loadFailed": "Kāore i taea te uta te hītori kōrero.",
+ "new": "Kōrero hou",
+ "openHint": "Ka whakatuwhera i te kōrero. Pēhia roa hei muku.",
+ "deleteTitle": "Muku i tēnei kōrero?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/mk.json b/apps/mobile/src/i18n/locales/mk.json
index a8f09d348b..e28a3aeeaf 100644
--- a/apps/mobile/src/i18n/locales/mk.json
+++ b/apps/mobile/src/i18n/locales/mk.json
@@ -2905,14 +2905,6 @@
"revoke": "Отстрани го {{host}} од доверливите хостови",
"backToPreferences": "Назад на поставките"
},
- "quickChat": {
- "empty": {
- "title": "Започни разговор",
- "description": "Испрати порака за да разговараш со модел."
- },
- "historyRetry": "Не успеа вчитувањето на историјата на разговорот.",
- "sendError": "Не можеше да се испрати пораката. Обиди се повторно."
- },
"glanceable": {
"waiting": "Се ажурираат агентите",
"empty": "Нема работа во тек",
@@ -2924,5 +2916,18 @@
"needsInput": "Чека внес",
"channelName": "Активни агенти",
"activityKitDisabledBody": "Вклучи ги активностите во живо во поставките за да ги видиш активните агенти на заклучениот екран."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Започнете разговор",
+ "description": "Испратете порака за да разговарате со модел."
+ },
+ "list": {
+ "loadFailed": "Не можев да ја вчитам историјата на разговорот.",
+ "new": "Нов разговор",
+ "openHint": "Го отвора разговорот. Држете за да избришете.",
+ "deleteTitle": "Да се избрише овој разговор?"
+ },
+ "beta": "Бета"
}
}
diff --git a/apps/mobile/src/i18n/locales/ml.json b/apps/mobile/src/i18n/locales/ml.json
index 82782bd51f..087c428bc1 100644
--- a/apps/mobile/src/i18n/locales/ml.json
+++ b/apps/mobile/src/i18n/locales/ml.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}}-നുള്ള വിശ്വാസം പിൻവലിക്കുക",
"backToPreferences": "മുൻഗണനകളിലേക്ക് മടങ്ങുക"
},
- "quickChat": {
- "empty": {
- "title": "ഒരു ചാറ്റ് ആരംഭിക്കുക",
- "description": "ഒരു മോഡലുമായി സംസാരിക്കാൻ സന്ദേശം അയയ്ക്കുക."
- },
- "historyRetry": "ചാറ്റ് ചരിത്രം ലോഡ് ചെയ്യാനായില്ല.",
- "sendError": "സന്ദേശം അയയ്ക്കാൻ കഴിഞ്ഞില്ല. വീണ്ടും ശ്രമിക്കുക."
- },
"glanceable": {
"waiting": "ഏജന്റുകളുടെ വിവരങ്ങൾ പുതുക്കുന്നു",
"empty": "ജോലികളൊന്നും പുരോഗമിക്കുന്നില്ല",
@@ -2924,5 +2916,18 @@
"needsInput": "നിങ്ങളുടെ പ്രതികരണം വേണം",
"channelName": "സജീവ ഏജന്റുകൾ",
"activityKitDisabledBody": "ലോക്ക് സ്ക്രീനിൽ സജീവ ഏജന്റുകളെ കാണാൻ ക്രമീകരണങ്ങളിൽ തത്സമയ പ്രവർത്തനങ്ങൾ പ്രവർത്തനക്ഷമമാക്കുക."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "ഒരു ചാറ്റ് ആരംഭിക്കുക",
+ "description": "ഒരു മോഡലുമായി സംസാരിക്കാൻ സന്ദേശം അയയ്ക്കുക."
+ },
+ "list": {
+ "loadFailed": "ചാറ്റ് ചരിത്രം ലോഡ് ചെയ്യാനായില്ല.",
+ "new": "പുതിയ ചാറ്റ്",
+ "openHint": "ചാറ്റ് തുറക്കുന്നു. ഇല്ലാതാക്കാൻ അമർത്തിപ്പിടിക്കുക.",
+ "deleteTitle": "ഈ ചാറ്റ് ഇല്ലാതാക്കണോ?"
+ },
+ "beta": "ബീറ്റ"
}
}
diff --git a/apps/mobile/src/i18n/locales/mn.json b/apps/mobile/src/i18n/locales/mn.json
index f76177507f..12dde0cae1 100644
--- a/apps/mobile/src/i18n/locales/mn.json
+++ b/apps/mobile/src/i18n/locales/mn.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} хостын итгэмжлэлийг цуцлах",
"backToPreferences": "Тохиргоо руу буцах"
},
- "quickChat": {
- "empty": {
- "title": "Чат эхлүүлэх",
- "description": "Загвартай ярилцахын тулд мессеж илгээнэ үү."
- },
- "historyRetry": "Чатын түүхийг ачаалж чадсангүй.",
- "sendError": "Мессежийг илгээж чадсангүй. Дахин оролдоно уу."
- },
"glanceable": {
"waiting": "Агентуудын мэдээллийг шинэчилж байна",
"empty": "Гүйцэтгэж буй ажил алга",
@@ -2924,5 +2916,18 @@
"needsInput": "Хариу хүлээж байна",
"channelName": "Идэвхтэй агентууд",
"activityKitDisabledBody": "Түгжээтэй дэлгэц дээр идэвхтэй агентуудыг харахын тулд тохиргооноос шууд үйл ажиллагааг идэвхжүүлнэ үү."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Чат эхлүүлэх",
+ "description": "Загвартай ярилцахын тулд мессеж илгээнэ үү."
+ },
+ "list": {
+ "loadFailed": "Чат түүхийг ачаалж чадсангүй.",
+ "new": "Шинэ чат",
+ "openHint": "Чатыг нээнэ. Устгахын тулд удаан дарна уу.",
+ "deleteTitle": "Энэ чатыг устгах уу?"
+ },
+ "beta": "Бета"
}
}
diff --git a/apps/mobile/src/i18n/locales/mr.json b/apps/mobile/src/i18n/locales/mr.json
index b83d3da894..313834d669 100644
--- a/apps/mobile/src/i18n/locales/mr.json
+++ b/apps/mobile/src/i18n/locales/mr.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} वरील विश्वास रद्द करा",
"backToPreferences": "प्राधान्यांवर परत जा"
},
- "quickChat": {
- "empty": {
- "title": "चॅट सुरू करा",
- "description": "मॉडेलशी बोलण्यासाठी संदेश पाठवा."
- },
- "historyRetry": "चॅटचा इतिहास लोड करता आला नाही.",
- "sendError": "संदेश पाठवता आला नाही. पुन्हा प्रयत्न करा."
- },
"glanceable": {
"waiting": "एजंट्सची माहिती अपडेट होत आहे",
"empty": "कोणतेही काम सुरू नाही",
@@ -2924,5 +2916,18 @@
"needsInput": "प्रतिसाद आवश्यक",
"channelName": "सक्रिय एजंट्स",
"activityKitDisabledBody": "लॉक स्क्रीनवर सक्रिय एजंट्स पाहण्यासाठी सेटिंग्जमध्ये लाइव्ह अॅक्टिव्हिटी चालू करा."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "चॅट सुरू करा",
+ "description": "मॉडेलशी बोलण्यासाठी संदेश पाठवा."
+ },
+ "list": {
+ "loadFailed": "चॅट इतिहास लोड करता आला नाही.",
+ "new": "नवीन चॅट",
+ "openHint": "चॅट उघडते. हटवण्यासाठी दाबून धरा.",
+ "deleteTitle": "ही चॅट हटवायची?"
+ },
+ "beta": "बीटा"
}
}
diff --git a/apps/mobile/src/i18n/locales/ms.json b/apps/mobile/src/i18n/locales/ms.json
index 5917e7bd90..e0a273ef46 100644
--- a/apps/mobile/src/i18n/locales/ms.json
+++ b/apps/mobile/src/i18n/locales/ms.json
@@ -2905,14 +2905,6 @@
"revoke": "Tarik balik kepercayaan terhadap {{host}}",
"backToPreferences": "Kembali ke keutamaan"
},
- "quickChat": {
- "empty": {
- "title": "Mulakan sembang",
- "description": "Hantar mesej untuk bersembang dengan model."
- },
- "historyRetry": "Tidak dapat memuatkan sejarah sembang.",
- "sendError": "Mesej tidak dapat dihantar. Cuba lagi."
- },
"glanceable": {
"waiting": "Mengemas kini ejen",
"empty": "Tiada kerja yang sedang dijalankan",
@@ -2924,5 +2916,18 @@
"needsInput": "Perlu input",
"channelName": "Ejen aktif",
"activityKitDisabledBody": "Dayakan Aktiviti Langsung dalam Tetapan untuk melihat ejen aktif pada Skrin Kunci."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Mulakan sembang",
+ "description": "Hantar mesej untuk bercakap dengan model."
+ },
+ "list": {
+ "loadFailed": "Tidak dapat memuatkan sejarah sembang.",
+ "new": "Sembang baharu",
+ "openHint": "Membuka sembang. Tekan lama untuk memadam.",
+ "deleteTitle": "Padam sembang ini?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/mt.json b/apps/mobile/src/i18n/locales/mt.json
index 0999de335b..81e3ce2a82 100644
--- a/apps/mobile/src/i18n/locales/mt.json
+++ b/apps/mobile/src/i18n/locales/mt.json
@@ -2971,14 +2971,6 @@
"revoke": "Irtira l-fiduċja f'{{host}}",
"backToPreferences": "Lura għall-preferenzi"
},
- "quickChat": {
- "empty": {
- "title": "Ibda chat",
- "description": "Ibgħat messaġġ biex titkellem ma' mudell."
- },
- "historyRetry": "Ma setgħetx titgħabba l-istorja taċ-chat.",
- "sendError": "Ma setax jintbagħat il-messaġġ. Erġa' pprova."
- },
"glanceable": {
"waiting": "Qed jiġu aġġornati l-aġenti",
"empty": "L-ebda xogħol għaddej",
@@ -2990,5 +2982,18 @@
"needsInput": "Jistenna tweġiba",
"channelName": "Aġenti attivi",
"activityKitDisabledBody": "Attiva l-attivitajiet diretti fl-issettjar biex tara l-aġenti attivi fuq l-iskrin imsakkar."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Ibda chat",
+ "description": "Ibgħat messaġġ biex tikkellem ma' mudell."
+ },
+ "list": {
+ "loadFailed": "Ma setgħux jitgħabbew l-istorja taċ-chat.",
+ "new": "Chat ġdid",
+ "openHint": "Jiftaħ iċ-chat. Agħfas fit-tul biex tħassar.",
+ "deleteTitle": "Tħassar dan iċ-chat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/my.json b/apps/mobile/src/i18n/locales/my.json
index a31852eada..d780b82aa0 100644
--- a/apps/mobile/src/i18n/locales/my.json
+++ b/apps/mobile/src/i18n/locales/my.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} အပေါ် ယုံကြည်မှုကို ပြန်ရုပ်သိမ်းပါ",
"backToPreferences": "ဆက်တင်များသို့ ပြန်သွားပါ"
},
- "quickChat": {
- "empty": {
- "title": "စကားဝိုင်းစတင်ပါ",
- "description": "မော်ဒယ်တစ်ခုနှင့် စကားပြောရန် မက်ဆေ့ချ်ပို့ပါ။"
- },
- "historyRetry": "စကားဝိုင်းမှတ်တမ်းကို ရယူ၍ မရပါ။",
- "sendError": "မက်ဆေ့ချ်ကို ပို့၍ မရပါ။ ထပ်ကြိုးစားပါ။"
- },
"glanceable": {
"waiting": "အေးဂျင့်အချက်အလက်များကို မွမ်းမံနေသည်",
"empty": "လုပ်ဆောင်နေသော အလုပ် မရှိပါ",
@@ -2924,5 +2916,18 @@
"needsInput": "တုံ့ပြန်ချက် လိုအပ်",
"channelName": "လုပ်ဆောင်နေသော အေးဂျင့်များ",
"activityKitDisabledBody": "သော့ခတ်မျက်နှာပြင်တွင် လုပ်ဆောင်နေသော အေးဂျင့်များကို ကြည့်ရန် ဆက်တင်များ၌ တိုက်ရိုက်လုပ်ဆောင်မှုများကို ဖွင့်ပါ။"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "စကားဝိုင်းစတင်ပါ",
+ "description": "မော်ဒယ်တစ်ခုနှင့် စကားပြောရန် မက်ဆေ့ချ်ပို့ပါ။"
+ },
+ "list": {
+ "loadFailed": "စကားဝိုင်းသမိုင်းကို တင်မရပါ။",
+ "new": "စကားပြောခန်းအသစ်",
+ "openHint": "စကားပြောခန်းကို ဖွင့်သည်။ ဖျက်ရန် ကြာကြာဖိပါ။",
+ "deleteTitle": "ဤစကားပြောခန်းကို ဖျက်မလား။"
+ },
+ "beta": "ဘီတာ"
}
}
diff --git a/apps/mobile/src/i18n/locales/nb.json b/apps/mobile/src/i18n/locales/nb.json
index 88b6525fae..d644c882fb 100644
--- a/apps/mobile/src/i18n/locales/nb.json
+++ b/apps/mobile/src/i18n/locales/nb.json
@@ -2905,14 +2905,6 @@
"revoke": "Trekk tilbake godkjenningen av {{host}}",
"backToPreferences": "Tilbake til innstillinger"
},
- "quickChat": {
- "empty": {
- "title": "Start en chat",
- "description": "Send en melding for å snakke med en modell."
- },
- "historyRetry": "Kunne ikke laste inn chathistorikken.",
- "sendError": "Kunne ikke sende meldingen. Prøv igjen."
- },
"glanceable": {
"waiting": "Oppdaterer agenter",
"empty": "Ingen oppgaver pågår",
@@ -2924,5 +2916,18 @@
"needsInput": "Venter på svar",
"channelName": "Aktive agenter",
"activityKitDisabledBody": "Slå på oppdateringer i sanntid i innstillingene for å se aktive agenter på låseskjermen."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Start en chat",
+ "description": "Send en melding for å snakke med en modell."
+ },
+ "list": {
+ "loadFailed": "Kunne ikke laste inn chathistorikken.",
+ "new": "Ny chat",
+ "openHint": "Åpner chatten. Trykk og hold for å slette.",
+ "deleteTitle": "Slette denne chatten?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ne.json b/apps/mobile/src/i18n/locales/ne.json
index 9528ad1997..43f2cd4819 100644
--- a/apps/mobile/src/i18n/locales/ne.json
+++ b/apps/mobile/src/i18n/locales/ne.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} को विश्वसनीयता हटाउनुहोस्",
"backToPreferences": "प्राथमिकताहरूमा फर्कनुहोस्"
},
- "quickChat": {
- "empty": {
- "title": "कुराकानी सुरु गर्नुहोस्",
- "description": "मोडेलसँग कुरा गर्न सन्देश पठाउनुहोस्।"
- },
- "historyRetry": "कुराकानीको इतिहास लोड गर्न सकिएन।",
- "sendError": "सन्देश पठाउन सकिएन। फेरि प्रयास गर्नुहोस्।"
- },
"glanceable": {
"waiting": "एजेन्टहरूको जानकारी अद्यावधिक गर्दै",
"empty": "कुनै काम चलिरहेको छैन",
@@ -2924,5 +2916,18 @@
"needsInput": "जवाफ चाहिन्छ",
"channelName": "सक्रिय एजेन्टहरू",
"activityKitDisabledBody": "लक स्क्रिनमा सक्रिय एजेन्टहरू हेर्न सेटिङ्समा प्रत्यक्ष गतिविधिहरू चालू गर्नुहोस्।"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "कुराकानी सुरु गर्नुहोस्",
+ "description": "मोडेलसँग कुरा गर्न सन्देश पठाउनुहोस्।"
+ },
+ "list": {
+ "loadFailed": "कुराकानी इतिहास लोड गर्न सकिएन।",
+ "new": "नयाँ च्याट",
+ "openHint": "च्याट खोल्छ। मेट्न लामो थिच्नुहोस्।",
+ "deleteTitle": "यो च्याट मेट्ने?"
+ },
+ "beta": "बिटा"
}
}
diff --git a/apps/mobile/src/i18n/locales/nl.json b/apps/mobile/src/i18n/locales/nl.json
index 1c765b33d1..999416a134 100644
--- a/apps/mobile/src/i18n/locales/nl.json
+++ b/apps/mobile/src/i18n/locales/nl.json
@@ -2905,14 +2905,6 @@
"revoke": "Vertrouwen in {{host}} intrekken",
"backToPreferences": "Terug naar voorkeuren"
},
- "quickChat": {
- "empty": {
- "title": "Start een chat",
- "description": "Stuur een bericht om met een model te praten."
- },
- "historyRetry": "De chatgeschiedenis kon niet worden geladen.",
- "sendError": "Het bericht kon niet worden verzonden. Probeer het opnieuw."
- },
"glanceable": {
"waiting": "Agents bijwerken",
"empty": "Geen lopende taken",
@@ -2924,5 +2916,18 @@
"needsInput": "Invoer nodig",
"channelName": "Actieve agents",
"activityKitDisabledBody": "Schakel liveactiviteiten in via de instellingen om actieve agents op het toegangsscherm te zien."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Start een chat",
+ "description": "Stuur een bericht om met een model te praten."
+ },
+ "list": {
+ "loadFailed": "Kon de chatgeschiedenis niet laden.",
+ "new": "Nieuwe chat",
+ "openHint": "Opent de chat. Lang indrukken om te verwijderen.",
+ "deleteTitle": "Deze chat verwijderen?"
+ },
+ "beta": "Bèta"
}
}
diff --git a/apps/mobile/src/i18n/locales/om.json b/apps/mobile/src/i18n/locales/om.json
index 1281c9c57d..66f17d0474 100644
--- a/apps/mobile/src/i18n/locales/om.json
+++ b/apps/mobile/src/i18n/locales/om.json
@@ -2905,14 +2905,6 @@
"revoke": "Amanamummaa {{host}} haqi",
"backToPreferences": "Gara filannoowwaniitti deebi'i"
},
- "quickChat": {
- "empty": {
- "title": "Marii jalqabi",
- "description": "Moodeela waliin haasa'uuf ergaa ergi."
- },
- "historyRetry": "Seenaa marii fe'uun hin danda'amne.",
- "sendError": "Ergaa erguun hin danda'amne. Irra deebi'ii yaali."
- },
"glanceable": {
"waiting": "Eejentoota haaromsaa jira",
"empty": "Hojiin hojjetamaa jiru hin jiru",
@@ -2924,5 +2916,18 @@
"needsInput": "Deebii barbaada",
"channelName": "Eejentoota hojii irra jiran",
"activityKitDisabledBody": "Eejentoota hojii irra jiran iskiriinii qulfii irratti ilaaluuf, qindaa'ina keessatti sochiiwwan yeroo ammaa hojii irra oolchi."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Chaat jalqabi",
+ "description": "Modeelii wajjin haasa'uuf ergaa ergi."
+ },
+ "list": {
+ "loadFailed": "Seenaa chaat fudhachuu hin dandeenye.",
+ "new": "Marii haaraa",
+ "openHint": "Marii ni bana. Haquuf cuqaasii dheeraa godhi.",
+ "deleteTitle": "Marii kana haquuf?"
+ },
+ "beta": "Beetaa"
}
}
diff --git a/apps/mobile/src/i18n/locales/or.json b/apps/mobile/src/i18n/locales/or.json
index f8640ffe2a..071f6bd9c4 100644
--- a/apps/mobile/src/i18n/locales/or.json
+++ b/apps/mobile/src/i18n/locales/or.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} ପ୍ରତି ବିଶ୍ୱାସ ପ୍ରତ୍ୟାହାର କରନ୍ତୁ",
"backToPreferences": "ପସନ୍ଦକୁ ଫେରନ୍ତୁ"
},
- "quickChat": {
- "empty": {
- "title": "ଏକ ଚାଟ୍ ଆରମ୍ଭ କରନ୍ତୁ",
- "description": "ଏକ ମଡେଲ୍ ସହିତ କଥା ହେବାକୁ ଏକ ସନ୍ଦେଶ ପଠାନ୍ତୁ।"
- },
- "historyRetry": "ଚାଟ୍ ଇତିହାସ ଲୋଡ୍ ହୋଇପାରିଲା ନାହିଁ।",
- "sendError": "ସନ୍ଦେଶ ପଠାଯାଇପାରିଲା ନାହିଁ। ପୁଣି ଚେଷ୍ଟା କରନ୍ତୁ।"
- },
"glanceable": {
"waiting": "ଏଜେଣ୍ଟଙ୍କ ସ୍ଥିତି ଅପଡେଟ୍ ହେଉଛି",
"empty": "କୌଣସି କାର୍ଯ୍ୟ ଚାଲୁ ନାହିଁ",
@@ -2924,5 +2916,18 @@
"needsInput": "ଆପଣଙ୍କ ଉତ୍ତର ଆବଶ୍ୟକ",
"channelName": "ସକ୍ରିୟ ଏଜେଣ୍ଟଗୁଡ଼ିକ",
"activityKitDisabledBody": "ଲକ୍ ସ୍କ୍ରିନ୍ରେ ସକ୍ରିୟ ଏଜେଣ୍ଟଗୁଡ଼ିକ ଦେଖିବାକୁ ସେଟିଂସ୍ରେ ଲାଇଭ୍ କାର୍ଯ୍ୟକଳାପ ଚାଲୁ କରନ୍ତୁ।"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "ଏକ ଚାଟ୍ ଆରମ୍ଭ କରନ୍ତୁ",
+ "description": "ଏକ ମଡେଲ୍ ସହିତ କଥା ହେବାକୁ ଏକ ସନ୍ଦେଶ ପଠାନ୍ତୁ।"
+ },
+ "list": {
+ "loadFailed": "ଚାଟ୍ ଇତିହାସ ଲୋଡ୍ ହୋଇପାରିଲା ନାହିଁ।",
+ "new": "ନୂଆ ଚାଟ୍",
+ "openHint": "ଚାଟ୍ ଖୋଲେ। ବିଲୋପ କରିବାକୁ ଦବାଇ ଧରନ୍ତୁ।",
+ "deleteTitle": "ଏହି ଚାଟ୍ ବିଲୋପ କରିବେ?"
+ },
+ "beta": "ବିଟା"
}
}
diff --git a/apps/mobile/src/i18n/locales/pa.json b/apps/mobile/src/i18n/locales/pa.json
index 8eb46225e4..1bbf63d4d8 100644
--- a/apps/mobile/src/i18n/locales/pa.json
+++ b/apps/mobile/src/i18n/locales/pa.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} ਨੂੰ ਭਰੋਸੇਯੋਗ ਹੋਸਟਾਂ ਤੋਂ ਹਟਾਓ",
"backToPreferences": "ਤਰਜੀਹਾਂ 'ਤੇ ਵਾਪਸ ਜਾਓ"
},
- "quickChat": {
- "empty": {
- "title": "ਚੈਟ ਸ਼ੁਰੂ ਕਰੋ",
- "description": "ਕਿਸੇ ਮਾਡਲ ਨਾਲ ਗੱਲ ਕਰਨ ਲਈ ਸੁਨੇਹਾ ਭੇਜੋ।"
- },
- "historyRetry": "ਚੈਟ ਦਾ ਇਤਿਹਾਸ ਲੋਡ ਨਹੀਂ ਹੋ ਸਕਿਆ।",
- "sendError": "ਸੁਨੇਹਾ ਭੇਜਿਆ ਨਹੀਂ ਜਾ ਸਕਿਆ। ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ।"
- },
"glanceable": {
"waiting": "ਏਜੰਟਾਂ ਦੀ ਜਾਣਕਾਰੀ ਅੱਪਡੇਟ ਹੋ ਰਹੀ ਹੈ",
"empty": "ਕੋਈ ਕੰਮ ਜਾਰੀ ਨਹੀਂ",
@@ -2924,5 +2916,18 @@
"needsInput": "ਜਵਾਬ ਦੀ ਉਡੀਕ",
"channelName": "ਸਰਗਰਮ ਏਜੰਟ",
"activityKitDisabledBody": "ਲਾਕ ਸਕ੍ਰੀਨ 'ਤੇ ਸਰਗਰਮ ਏਜੰਟ ਵੇਖਣ ਲਈ ਸੈਟਿੰਗਾਂ ਵਿੱਚ ਲਾਈਵ ਗਤੀਵਿਧੀਆਂ ਚਾਲੂ ਕਰੋ।"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "ਚੈਟ ਸ਼ੁਰੂ ਕਰੋ",
+ "description": "ਕਿਸੇ ਮਾਡਲ ਨਾਲ ਗੱਲ ਕਰਨ ਲਈ ਸੁਨੇਹਾ ਭੇਜੋ।"
+ },
+ "list": {
+ "loadFailed": "ਚੈਟ ਇਤਿਹਾਸ ਲੋਡ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਿਆ।",
+ "new": "ਨਵੀਂ ਚੈਟ",
+ "openHint": "ਚੈਟ ਖੋਲ੍ਹਦਾ ਹੈ। ਮਿਟਾਉਣ ਲਈ ਲੰਮਾ ਦਬਾਓ।",
+ "deleteTitle": "ਇਹ ਚੈਟ ਮਿਟਾਉਣੀ ਹੈ?"
+ },
+ "beta": "ਬੀਟਾ"
}
}
diff --git a/apps/mobile/src/i18n/locales/pl.json b/apps/mobile/src/i18n/locales/pl.json
index 417a95dc19..43f0e1198d 100644
--- a/apps/mobile/src/i18n/locales/pl.json
+++ b/apps/mobile/src/i18n/locales/pl.json
@@ -2949,14 +2949,6 @@
"revoke": "Cofnij zaufanie do {{host}}",
"backToPreferences": "Wróć do preferencji"
},
- "quickChat": {
- "empty": {
- "title": "Rozpocznij czat",
- "description": "Wyślij wiadomość, aby porozmawiać z modelem."
- },
- "historyRetry": "Nie udało się wczytać historii czatu.",
- "sendError": "Nie udało się wysłać wiadomości. Spróbuj ponownie."
- },
"glanceable": {
"waiting": "Aktualizowanie stanu agentów",
"empty": "Brak zadań w toku",
@@ -2968,5 +2960,18 @@
"needsInput": "Czeka na odpowiedź",
"channelName": "Aktywni agenci",
"activityKitDisabledBody": "Włącz aktywności na żywo w ustawieniach, aby widzieć aktywnych agentów na ekranie blokady."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Rozpocznij czat",
+ "description": "Wyślij wiadomość, aby porozmawiać z modelem."
+ },
+ "list": {
+ "loadFailed": "Nie udało się wczytać historii czatu.",
+ "new": "Nowy czat",
+ "openHint": "Otwiera czat. Naciśnij i przytrzymaj, aby usunąć.",
+ "deleteTitle": "Usunąć ten czat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ps.json b/apps/mobile/src/i18n/locales/ps.json
index 4334d2027d..9944e4a924 100644
--- a/apps/mobile/src/i18n/locales/ps.json
+++ b/apps/mobile/src/i18n/locales/ps.json
@@ -2905,14 +2905,6 @@
"revoke": "پر {{host}} باور لغوه کړئ",
"backToPreferences": "بېرته تنظیماتو ته ورشئ"
},
- "quickChat": {
- "empty": {
- "title": "خبرې اترې پیل کړئ",
- "description": "له ماډل سره د خبرو لپاره پیغام ولېږئ."
- },
- "historyRetry": "د خبرو اترو تاریخچه بار نه شوه.",
- "sendError": "پیغام و نه لېږل شو. بیا هڅه وکړئ."
- },
"glanceable": {
"waiting": "اجنټان تازه کېږي",
"empty": "هېڅ کار روان نه دی",
@@ -2924,5 +2916,18 @@
"needsInput": "ځواب ته اړتیا لري",
"channelName": "فعال اجنټان",
"activityKitDisabledBody": "په قلف شوې پرده کې د فعالو اجنټانو د لیدلو لپاره په ترتیباتو کې روان فعالیتونه فعال کړئ."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "چټ پیل کړئ",
+ "description": "د ماډل سره د خبرو کولو لپاره پیغام ولېږئ."
+ },
+ "list": {
+ "loadFailed": "د چټ تاریخ بار کیدلای نه شو.",
+ "new": "نوې خبرې اترې",
+ "openHint": "خبرې اترې پرانیزي. د حذف لپاره اوږده کېکاږئ.",
+ "deleteTitle": "دا خبرې اترې حذف کړئ؟"
+ },
+ "beta": "بیټا"
}
}
diff --git a/apps/mobile/src/i18n/locales/pt-BR.json b/apps/mobile/src/i18n/locales/pt-BR.json
index 74cb75fe1a..bb67b0d463 100644
--- a/apps/mobile/src/i18n/locales/pt-BR.json
+++ b/apps/mobile/src/i18n/locales/pt-BR.json
@@ -2927,14 +2927,6 @@
"revoke": "Deixar de confiar em {{host}}",
"backToPreferences": "Voltar às preferências"
},
- "quickChat": {
- "empty": {
- "title": "Iniciar um chat",
- "description": "Envie uma mensagem para conversar com um modelo."
- },
- "historyRetry": "Não foi possível carregar o histórico do chat.",
- "sendError": "Não foi possível enviar a mensagem. Tente novamente."
- },
"glanceable": {
"waiting": "Atualizando agentes",
"empty": "Nenhuma tarefa em andamento",
@@ -2946,5 +2938,18 @@
"needsInput": "Aguardando resposta",
"channelName": "Agentes ativos",
"activityKitDisabledBody": "Ative as Atividades ao Vivo nos Ajustes para ver os agentes ativos na tela bloqueada."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Iniciar um chat",
+ "description": "Envie uma mensagem para conversar com um modelo."
+ },
+ "list": {
+ "loadFailed": "Não foi possível carregar o histórico do chat.",
+ "new": "Nova conversa",
+ "openHint": "Abre a conversa. Toque e segure para excluir.",
+ "deleteTitle": "Excluir esta conversa?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/pt.json b/apps/mobile/src/i18n/locales/pt.json
index b3f23af8e0..f8fdfe5b09 100644
--- a/apps/mobile/src/i18n/locales/pt.json
+++ b/apps/mobile/src/i18n/locales/pt.json
@@ -2927,14 +2927,6 @@
"revoke": "Deixar de confiar em {{host}}",
"backToPreferences": "Voltar às preferências"
},
- "quickChat": {
- "empty": {
- "title": "Iniciar uma conversa",
- "description": "Envia uma mensagem para falar com um modelo."
- },
- "historyRetry": "Não foi possível carregar o histórico da conversa.",
- "sendError": "Não foi possível enviar a mensagem. Tenta novamente."
- },
"glanceable": {
"waiting": "A atualizar agentes",
"empty": "Nenhum trabalho em curso",
@@ -2946,5 +2938,18 @@
"needsInput": "À espera de resposta",
"channelName": "Agentes ativos",
"activityKitDisabledBody": "Ativa as atividades em direto nas definições para ver os agentes ativos no ecrã bloqueado."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Inicie uma conversa",
+ "description": "Envie uma mensagem para falar com um modelo."
+ },
+ "list": {
+ "loadFailed": "Não foi possível carregar o histórico do chat.",
+ "new": "Nova conversa",
+ "openHint": "Abre a conversa. Prima continuamente para eliminar.",
+ "deleteTitle": "Eliminar esta conversa?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ro.json b/apps/mobile/src/i18n/locales/ro.json
index b0a75f0871..5b2c724177 100644
--- a/apps/mobile/src/i18n/locales/ro.json
+++ b/apps/mobile/src/i18n/locales/ro.json
@@ -2927,14 +2927,6 @@
"revoke": "Retrage încrederea acordată gazdei {{host}}",
"backToPreferences": "Înapoi la preferințe"
},
- "quickChat": {
- "empty": {
- "title": "Începe o conversație",
- "description": "Trimite un mesaj pentru a vorbi cu un model."
- },
- "historyRetry": "Nu s-a putut încărca istoricul conversației.",
- "sendError": "Nu s-a putut trimite mesajul. Încearcă din nou."
- },
"glanceable": {
"waiting": "Se actualizează agenții",
"empty": "Nicio sarcină în curs",
@@ -2946,5 +2938,18 @@
"needsInput": "Așteaptă un răspuns",
"channelName": "Agenți activi",
"activityKitDisabledBody": "Activează activitățile live din setări pentru a vedea agenții activi pe ecranul de blocare."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Începe un chat",
+ "description": "Trimite un mesaj pentru a vorbi cu un model."
+ },
+ "list": {
+ "loadFailed": "Nu s-a putut încărca istoricul de chat.",
+ "new": "Chat nou",
+ "openHint": "Deschide chatul. Apasă lung pentru a șterge.",
+ "deleteTitle": "Ștergi acest chat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ru.json b/apps/mobile/src/i18n/locales/ru.json
index 16092f95b3..58274d5159 100644
--- a/apps/mobile/src/i18n/locales/ru.json
+++ b/apps/mobile/src/i18n/locales/ru.json
@@ -2949,14 +2949,6 @@
"revoke": "Перестать доверять сайту {{host}}",
"backToPreferences": "К настройкам"
},
- "quickChat": {
- "empty": {
- "title": "Начните общение",
- "description": "Отправьте сообщение, чтобы поговорить с моделью."
- },
- "historyRetry": "Не удалось загрузить историю чата.",
- "sendError": "Не удалось отправить сообщение. Попробуйте снова."
- },
"glanceable": {
"waiting": "Обновление данных об агентах",
"empty": "Нет задач в работе",
@@ -2968,5 +2960,18 @@
"needsInput": "Ожидание ввода",
"channelName": "Активные агенты",
"activityKitDisabledBody": "Включите «Эфир активности» в настройках, чтобы видеть активных агентов на экране блокировки."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Начать чат",
+ "description": "Отправьте сообщение, чтобы поговорить с моделью."
+ },
+ "list": {
+ "loadFailed": "Не удалось загрузить историю чата.",
+ "new": "Новый чат",
+ "openHint": "Открывает чат. Удерживайте, чтобы удалить.",
+ "deleteTitle": "Удалить этот чат?"
+ },
+ "beta": "Бета"
}
}
diff --git a/apps/mobile/src/i18n/locales/si.json b/apps/mobile/src/i18n/locales/si.json
index 622939ae4f..dbf4239407 100644
--- a/apps/mobile/src/i18n/locales/si.json
+++ b/apps/mobile/src/i18n/locales/si.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} වෙත දුන් විශ්වාසය ඉවත් කරන්න",
"backToPreferences": "මනාප වෙත ආපසු යන්න"
},
- "quickChat": {
- "empty": {
- "title": "කතාබසක් ආරම්භ කරන්න",
- "description": "ආකෘතියක් සමඟ කතා කිරීමට පණිවිඩයක් යවන්න."
- },
- "historyRetry": "කතාබස් ඉතිහාසය පූරණය කළ නොහැකි විය.",
- "sendError": "පණිවිඩය යැවිය නොහැකි විය. නැවත උත්සාහ කරන්න."
- },
"glanceable": {
"waiting": "නියෝජිතයන් යාවත්කාලීන කරමින්",
"empty": "සිදු කෙරෙන වැඩ කිසිවක් නැත",
@@ -2924,5 +2916,18 @@
"needsInput": "ඔබේ ප්රතිචාරය අවශ්යයි",
"channelName": "සක්රීය නියෝජිතයන්",
"activityKitDisabledBody": "අගුළු තිරයේ සක්රීය නියෝජිතයන් බැලීමට සැකසුම් තුළ සජීවී ක්රියාකාරකම් සක්රීය කරන්න."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "කතාවක් ආරම්භ කරන්න",
+ "description": "ආකෘතියක් සමඟ කතා කිරීමට පණිවිඩයක් යවන්න."
+ },
+ "list": {
+ "loadFailed": "සංවාද ඉතිහාසය පූරණය කළ නොහැකි විය.",
+ "new": "නව කතාබහ",
+ "openHint": "කතාබහ විවෘත කරයි. මකා දැමීමට දිගු ලෙස ඔබන්න.",
+ "deleteTitle": "මෙම කතාබහ මකන්නද?"
+ },
+ "beta": "බීටා"
}
}
diff --git a/apps/mobile/src/i18n/locales/sk.json b/apps/mobile/src/i18n/locales/sk.json
index 6c9763823d..bcf85152fd 100644
--- a/apps/mobile/src/i18n/locales/sk.json
+++ b/apps/mobile/src/i18n/locales/sk.json
@@ -2949,14 +2949,6 @@
"revoke": "Zrušiť dôveru serveru {{host}}",
"backToPreferences": "Späť na predvoľby"
},
- "quickChat": {
- "empty": {
- "title": "Začnite chat",
- "description": "Pošlite správu a porozprávajte sa s modelom."
- },
- "historyRetry": "Históriu chatu sa nepodarilo načítať.",
- "sendError": "Nepodarilo sa odoslať správu. Skúste to znova."
- },
"glanceable": {
"waiting": "Aktualizujú sa údaje o agentoch",
"empty": "Žiadne rozpracované úlohy",
@@ -2968,5 +2960,18 @@
"needsInput": "Čaká na odpoveď",
"channelName": "Aktívne agenty",
"activityKitDisabledBody": "Zapni v nastaveniach živé aktivity, aby sa aktívne agenty zobrazovali na zamknutej obrazovke."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Začať chat",
+ "description": "Pošlite správu a porozprávajte sa s modelom."
+ },
+ "list": {
+ "loadFailed": "Históriu chatu sa nepodarilo načítať.",
+ "new": "Nový chat",
+ "openHint": "Otvorí chat. Dlhým stlačením odstránite.",
+ "deleteTitle": "Odstrániť tento chat?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/sl.json b/apps/mobile/src/i18n/locales/sl.json
index b4c2daf386..8c4dd52085 100644
--- a/apps/mobile/src/i18n/locales/sl.json
+++ b/apps/mobile/src/i18n/locales/sl.json
@@ -2949,14 +2949,6 @@
"revoke": "Prekliči zaupanje gostitelju {{host}}",
"backToPreferences": "Nazaj na nastavitve"
},
- "quickChat": {
- "empty": {
- "title": "Začni klepet",
- "description": "Pošlji sporočilo za pogovor z modelom."
- },
- "historyRetry": "Zgodovine klepeta ni bilo mogoče naložiti.",
- "sendError": "Sporočila ni bilo mogoče poslati. Poskusi znova."
- },
"glanceable": {
"waiting": "Posodabljanje agentov",
"empty": "Trenutno ni aktivnih nalog",
@@ -2968,5 +2960,18 @@
"needsInput": "Čaka na vnos",
"channelName": "Aktivni agenti",
"activityKitDisabledBody": "V nastavitvah vklopi dejavnosti v živo, da se aktivni agenti prikažejo na zaklenjenem zaslonu."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Začni klepet",
+ "description": "Pošlji sporočilo za pogovor z modelom."
+ },
+ "list": {
+ "loadFailed": "Zgodovine klepeta ni bilo mogoče naložiti.",
+ "new": "Nov klepet",
+ "openHint": "Odpre klepet. Pridržite za brisanje.",
+ "deleteTitle": "Izbrišem ta klepet?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/so.json b/apps/mobile/src/i18n/locales/so.json
index 19a2a388d8..2a38b1ca41 100644
--- a/apps/mobile/src/i18n/locales/so.json
+++ b/apps/mobile/src/i18n/locales/so.json
@@ -2905,14 +2905,6 @@
"revoke": "Ka noqo aaminaadda {{host}}",
"backToPreferences": "Ku noqo doorashooyinka"
},
- "quickChat": {
- "empty": {
- "title": "Bilow wada sheekaysi",
- "description": "Dir fariin si aad ula hadasho moodeel."
- },
- "historyRetry": "Taariikhda wada sheekaysiga lama soo dejin karin.",
- "sendError": "Fariinta lama diri karin. Mar kale isku day."
- },
"glanceable": {
"waiting": "Wakiillada ayaa la cusboonaysiinayaa",
"empty": "Ma jirto hawl socota",
@@ -2924,5 +2916,18 @@
"needsInput": "Jawaab sugaya",
"channelName": "Wakiillada firfircoon",
"activityKitDisabledBody": "Ka daar hawlaha tooska ah dejinta si aad wakiillada firfircoon ugu aragto shaashadda qufulka."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Bilow wada sheekaysi",
+ "description": "Dir fariin si aad ula hadasho model."
+ },
+ "list": {
+ "loadFailed": "Taariikhda wada sheekaysiga lama soo gelin karin.",
+ "new": "Wada sheekaysi cusub",
+ "openHint": "Wada sheekaysiga ayuu furayaa. Si aad u tirtirto si dheer u taabo.",
+ "deleteTitle": "Ma tirtiraa wada sheekaysigan?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/sq.json b/apps/mobile/src/i18n/locales/sq.json
index 36b039d5c7..da22b96ce8 100644
--- a/apps/mobile/src/i18n/locales/sq.json
+++ b/apps/mobile/src/i18n/locales/sq.json
@@ -2905,14 +2905,6 @@
"revoke": "Hiq besimin për {{host}}",
"backToPreferences": "Kthehu te preferencat"
},
- "quickChat": {
- "empty": {
- "title": "Fillo një bisedë",
- "description": "Dërgo një mesazh për të biseduar me një model."
- },
- "historyRetry": "Nuk u ngarkua historiku i bisedës.",
- "sendError": "Nuk u dërgua mesazhi. Provo përsëri."
- },
"glanceable": {
"waiting": "Po përditësohen agjentët",
"empty": "Nuk ka punë në vazhdim",
@@ -2924,5 +2916,18 @@
"needsInput": "Pret përgjigje",
"channelName": "Agjentët aktivë",
"activityKitDisabledBody": "Aktivizo aktivitetet në kohë reale në cilësimet e pajisjes për të parë agjentët aktivë në ekranin e kyçjes."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Filloni një bisedë",
+ "description": "Dërgo një mesazh për të biseduar me një model."
+ },
+ "list": {
+ "loadFailed": "Nuk u arrit të ngarkohej historia e bisedës.",
+ "new": "Bisedë e re",
+ "openHint": "Hap bisedën. Shtypni gjatë për ta fshirë.",
+ "deleteTitle": "Ta fshini këtë bisedë?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/sr.json b/apps/mobile/src/i18n/locales/sr.json
index f96238042d..e9d400cc38 100644
--- a/apps/mobile/src/i18n/locales/sr.json
+++ b/apps/mobile/src/i18n/locales/sr.json
@@ -2927,14 +2927,6 @@
"revoke": "Ukloni {{host}} iz pouzdanih hostova",
"backToPreferences": "Nazad na podešavanja"
},
- "quickChat": {
- "empty": {
- "title": "Započni ćaskanje",
- "description": "Pošalji poruku da razgovaraš sa modelom."
- },
- "historyRetry": "Nije moguće učitati istoriju ćaskanja.",
- "sendError": "Slanje poruke nije uspelo. Pokušaj ponovo."
- },
"glanceable": {
"waiting": "Ažuriranje agenata",
"empty": "Nema zadataka u toku",
@@ -2946,5 +2938,18 @@
"needsInput": "Čeka unos",
"channelName": "Aktivni agenti",
"activityKitDisabledBody": "Uključi aktivnosti uživo u podešavanjima da vidiš aktivne agente na zaključanom ekranu."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Započnite ćaskanje",
+ "description": "Pošaljite poruku da razgovarate sa modelom."
+ },
+ "list": {
+ "loadFailed": "Nije moguće učitati istoriju ćaskanja.",
+ "new": "Novo ćaskanje",
+ "openHint": "Otvara ćaskanje. Dugo pritisnite za brisanje.",
+ "deleteTitle": "Izbrisati ovo ćaskanje?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/sv.json b/apps/mobile/src/i18n/locales/sv.json
index 8faace4fcb..782fd36e31 100644
--- a/apps/mobile/src/i18n/locales/sv.json
+++ b/apps/mobile/src/i18n/locales/sv.json
@@ -2905,14 +2905,6 @@
"revoke": "Sluta lita på {{host}}",
"backToPreferences": "Tillbaka till inställningarna"
},
- "quickChat": {
- "empty": {
- "title": "Starta en chatt",
- "description": "Skicka ett meddelande för att prata med en modell."
- },
- "historyRetry": "Kunde inte läsa in chatthistoriken.",
- "sendError": "Kunde inte skicka meddelandet. Försök igen."
- },
"glanceable": {
"waiting": "Uppdaterar agenter",
"empty": "Inget arbete pågår",
@@ -2924,5 +2916,18 @@
"needsInput": "Väntar på svar",
"channelName": "Aktiva agenter",
"activityKitDisabledBody": "Aktivera liveaktiviteter i Inställningar för att se aktiva agenter på låsskärmen."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Starta en chatt",
+ "description": "Skicka ett meddelande för att prata med en modell."
+ },
+ "list": {
+ "loadFailed": "Det gick inte att läsa in chatthistoriken.",
+ "new": "Ny chatt",
+ "openHint": "Öppnar chatten. Tryck länge för att ta bort.",
+ "deleteTitle": "Ta bort den här chatten?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/sw.json b/apps/mobile/src/i18n/locales/sw.json
index 838e76c486..4f5b6361d6 100644
--- a/apps/mobile/src/i18n/locales/sw.json
+++ b/apps/mobile/src/i18n/locales/sw.json
@@ -2905,14 +2905,6 @@
"revoke": "Ondoa uaminifu kwa {{host}}",
"backToPreferences": "Rudi kwenye mapendeleo"
},
- "quickChat": {
- "empty": {
- "title": "Anza mazungumzo",
- "description": "Tuma ujumbe ili kuzungumza na modeli."
- },
- "historyRetry": "Imeshindikana kupakia historia ya mazungumzo.",
- "sendError": "Imeshindikana kutuma ujumbe. Jaribu tena."
- },
"glanceable": {
"waiting": "Inasasisha mawakala",
"empty": "Hakuna kazi inayoendelea",
@@ -2924,5 +2916,18 @@
"needsInput": "Inasubiri jibu",
"channelName": "Mawakala wanaofanya kazi",
"activityKitDisabledBody": "Washa shughuli za wakati halisi kwenye mipangilio ili uone mawakala wanaofanya kazi kwenye skrini iliyofungwa."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Anza mazungumzo",
+ "description": "Tuma ujumbe ili uongee na mfano."
+ },
+ "list": {
+ "loadFailed": "Haikuweza kupakia historia ya mazungumzo.",
+ "new": "Gumzo jipya",
+ "openHint": "Hufungua gumzo. Bonyeza kwa muda mrefu ili kufuta.",
+ "deleteTitle": "Futa gumzo hili?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/ta.json b/apps/mobile/src/i18n/locales/ta.json
index 3c07c96fc1..e04d142028 100644
--- a/apps/mobile/src/i18n/locales/ta.json
+++ b/apps/mobile/src/i18n/locales/ta.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} தளத்திற்கான நம்பக அனுமதியை ரத்து செய்யவும்",
"backToPreferences": "விருப்பத்தேர்வுகளுக்குத் திரும்பவும்"
},
- "quickChat": {
- "empty": {
- "title": "அரட்டையைத் தொடங்கவும்",
- "description": "மாதிரியுடன் பேச ஒரு செய்தியை அனுப்பவும்."
- },
- "historyRetry": "அரட்டை வரலாற்றை ஏற்ற முடியவில்லை.",
- "sendError": "செய்தியை அனுப்ப முடியவில்லை. மீண்டும் முயற்சிக்கவும்."
- },
"glanceable": {
"waiting": "ஏஜெண்டுகள் புதுப்பிக்கப்படுகின்றன",
"empty": "எந்தப் பணியும் நடைபெறவில்லை",
@@ -2924,5 +2916,18 @@
"needsInput": "உள்ளீடு தேவை",
"channelName": "செயலில் உள்ள ஏஜெண்டுகள்",
"activityKitDisabledBody": "பூட்டுத் திரையில் செயலில் உள்ள ஏஜெண்டுகளைப் பார்க்க, அமைப்புகளில் நேரலைச் செயல்பாடுகளை இயக்கவும்."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "அரட்டையைத் தொடங்கு",
+ "description": "ஒரு மாதிரியுடன் பேசுவதற்கு ஒரு செய்தியை அனுப்பவும்."
+ },
+ "list": {
+ "loadFailed": "அரட்டை வரலாற்றை ஏற்ற முடியவில்லை.",
+ "new": "புதிய அரட்டை",
+ "openHint": "அரட்டையைத் திறக்கும். நீக்க நீண்ட நேரம் அழுத்தவும்.",
+ "deleteTitle": "இந்த அரட்டையை நீக்கவா?"
+ },
+ "beta": "பீட்டா"
}
}
diff --git a/apps/mobile/src/i18n/locales/te.json b/apps/mobile/src/i18n/locales/te.json
index 946dddd994..a45c3d40e5 100644
--- a/apps/mobile/src/i18n/locales/te.json
+++ b/apps/mobile/src/i18n/locales/te.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}}పై నమ్మకాన్ని ఉపసంహరించండి",
"backToPreferences": "ప్రాధాన్యతలకు తిరిగి వెళ్లండి"
},
- "quickChat": {
- "empty": {
- "title": "చాట్ ప్రారంభించండి",
- "description": "మోడల్తో మాట్లాడటానికి సందేశం పంపండి."
- },
- "historyRetry": "చాట్ చరిత్రను లోడ్ చేయలేకపోయాము.",
- "sendError": "సందేశాన్ని పంపలేకపోయాము. మళ్లీ ప్రయత్నించండి."
- },
"glanceable": {
"waiting": "ఏజెంట్లను నవీకరిస్తోంది",
"empty": "పని ఏదీ కొనసాగడం లేదు",
@@ -2924,5 +2916,18 @@
"needsInput": "మీ స్పందన అవసరం",
"channelName": "పనిచేస్తున్న ఏజెంట్లు",
"activityKitDisabledBody": "లాక్ స్క్రీన్పై పనిచేస్తున్న ఏజెంట్లను చూడటానికి సెట్టింగ్లలో లైవ్ యాక్టివిటీస్ను ఆన్ చేయండి."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "చాట్ ప్రారంభించండి",
+ "description": "మోడల్తో మాట్లాడటానికి సందేశం పంపండి."
+ },
+ "list": {
+ "loadFailed": "చాట్ చరిత్రను లోడ్ చేయలేకపోయాము.",
+ "new": "కొత్త చాట్",
+ "openHint": "చాట్ను తెరుస్తుంది. తొలగించడానికి నొక్కి ఉంచండి.",
+ "deleteTitle": "ఈ చాట్ను తొలగించాలా?"
+ },
+ "beta": "బీటా"
}
}
diff --git a/apps/mobile/src/i18n/locales/th.json b/apps/mobile/src/i18n/locales/th.json
index f494aeb3a4..b5447fb9d2 100644
--- a/apps/mobile/src/i18n/locales/th.json
+++ b/apps/mobile/src/i18n/locales/th.json
@@ -2905,14 +2905,6 @@
"revoke": "เลิกเชื่อถือ {{host}}",
"backToPreferences": "กลับไปที่การตั้งค่า"
},
- "quickChat": {
- "empty": {
- "title": "เริ่มแชท",
- "description": "ส่งข้อความเพื่อพูดคุยกับโมเดล"
- },
- "historyRetry": "ไม่สามารถโหลดประวัติแชทได้",
- "sendError": "ไม่สามารถส่งข้อความได้ ลองอีกครั้ง"
- },
"glanceable": {
"waiting": "กำลังอัปเดตสถานะเอเจนต์",
"empty": "ไม่มีงานที่กำลังดำเนินการ",
@@ -2924,5 +2916,18 @@
"needsInput": "รอข้อมูลจากคุณ",
"channelName": "เอเจนต์ที่กำลังทำงาน",
"activityKitDisabledBody": "เปิดกิจกรรมสดในการตั้งค่าเพื่อดูเอเจนต์ที่กำลังทำงานบนหน้าจอล็อก"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "เริ่มแชท",
+ "description": "ส่งข้อความเพื่อพูดคุยกับโมเดล"
+ },
+ "list": {
+ "loadFailed": "ไม่สามารถโหลดประวัติแชทได้",
+ "new": "แชทใหม่",
+ "openHint": "เปิดแชท กดค้างเพื่อลบ",
+ "deleteTitle": "ลบแชทนี้ไหม"
+ },
+ "beta": "เบต้า"
}
}
diff --git a/apps/mobile/src/i18n/locales/tr.json b/apps/mobile/src/i18n/locales/tr.json
index f3d89c8ec5..06a70bc3a9 100644
--- a/apps/mobile/src/i18n/locales/tr.json
+++ b/apps/mobile/src/i18n/locales/tr.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} sunucusuna verilen güveni kaldır",
"backToPreferences": "Tercihlere dön"
},
- "quickChat": {
- "empty": {
- "title": "Bir sohbet başlat",
- "description": "Bir modelle konuşmak için mesaj gönder."
- },
- "historyRetry": "Sohbet geçmişi yüklenemedi.",
- "sendError": "Mesaj gönderilemedi. Tekrar dene."
- },
"glanceable": {
"waiting": "Ajanlar güncelleniyor",
"empty": "Devam eden iş yok",
@@ -2924,5 +2916,18 @@
"needsInput": "Yanıt bekliyor",
"channelName": "Etkin ajanlar",
"activityKitDisabledBody": "Etkin ajanları kilit ekranında görmek için ayarlardan Canlı Etkinlikler özelliğini aç."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Bir sohbet başlat",
+ "description": "Bir modelle konuşmak için mesaj gönder."
+ },
+ "list": {
+ "loadFailed": "Sohbet geçmişi yüklenemedi.",
+ "new": "Yeni sohbet",
+ "openHint": "Sohbeti açar. Silmek için uzun basın.",
+ "deleteTitle": "Bu sohbet silinsin mi?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/uk.json b/apps/mobile/src/i18n/locales/uk.json
index 10b7ddd170..88946c81de 100644
--- a/apps/mobile/src/i18n/locales/uk.json
+++ b/apps/mobile/src/i18n/locales/uk.json
@@ -2949,14 +2949,6 @@
"revoke": "Скасувати довіру до {{host}}",
"backToPreferences": "Назад до налаштувань"
},
- "quickChat": {
- "empty": {
- "title": "Розпочніть чат",
- "description": "Надішліть повідомлення, щоб поговорити з моделлю."
- },
- "historyRetry": "Не вдалося завантажити історію чату.",
- "sendError": "Не вдалося надіслати повідомлення. Спробуйте ще раз."
- },
"glanceable": {
"waiting": "Оновлення агентів",
"empty": "Немає активних завдань",
@@ -2968,5 +2960,18 @@
"needsInput": "Очікує відповіді",
"channelName": "Активні агенти",
"activityKitDisabledBody": "Увімкніть «Дії наживо» в «Параметрах», щоб бачити активних агентів на замкненому екрані."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Розпочніть чат",
+ "description": "Надішліть повідомлення, щоб поговорити з моделлю."
+ },
+ "list": {
+ "loadFailed": "Не вдалося завантажити історію чату.",
+ "new": "Новий чат",
+ "openHint": "Відкриває чат. Утримуйте, щоб видалити.",
+ "deleteTitle": "Видалити цей чат?"
+ },
+ "beta": "Бета"
}
}
diff --git a/apps/mobile/src/i18n/locales/ur.json b/apps/mobile/src/i18n/locales/ur.json
index ac56511395..84aed4e191 100644
--- a/apps/mobile/src/i18n/locales/ur.json
+++ b/apps/mobile/src/i18n/locales/ur.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} پر اعتماد ختم کریں",
"backToPreferences": "ترجیحات پر واپس جائیں"
},
- "quickChat": {
- "empty": {
- "title": "چیٹ شروع کریں",
- "description": "کسی ماڈل سے بات کرنے کے لیے پیغام بھیجیں۔"
- },
- "historyRetry": "چیٹ کی سرگزشت لوڈ نہیں ہو سکی۔",
- "sendError": "پیغام نہیں بھیجا جا سکا۔ دوبارہ کوشش کریں۔"
- },
"glanceable": {
"waiting": "ایجنٹس کی معلومات اپ ڈیٹ ہو رہی ہیں",
"empty": "کوئی کام جاری نہیں",
@@ -2924,5 +2916,18 @@
"needsInput": "ان پٹ درکار",
"channelName": "فعال ایجنٹس",
"activityKitDisabledBody": "لاک اسکرین پر فعال ایجنٹس دیکھنے کے لیے ترتیبات میں لائیو سرگرمیاں فعال کریں۔"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "چیٹ شروع کریں",
+ "description": "کسی ماڈل سے بات کرنے کے لیے پیغام بھیجیں۔"
+ },
+ "list": {
+ "loadFailed": "چیٹ کی سرگزشت لوڈ نہیں ہو سکی۔",
+ "new": "نئی چیٹ",
+ "openHint": "چیٹ کھولتا ہے۔ حذف کرنے کے لیے دبائے رکھیں۔",
+ "deleteTitle": "یہ چیٹ حذف کریں؟"
+ },
+ "beta": "بیٹا"
}
}
diff --git a/apps/mobile/src/i18n/locales/uz.json b/apps/mobile/src/i18n/locales/uz.json
index 9a155bb25b..878bcef485 100644
--- a/apps/mobile/src/i18n/locales/uz.json
+++ b/apps/mobile/src/i18n/locales/uz.json
@@ -2905,14 +2905,6 @@
"revoke": "{{host}} saytiga berilgan ishonchni bekor qilish",
"backToPreferences": "Sozlamalarga qaytish"
},
- "quickChat": {
- "empty": {
- "title": "Suhbatni boshlang",
- "description": "Model bilan gaplashish uchun xabar yuboring."
- },
- "historyRetry": "Suhbat tarixini yuklab bo'lmadi.",
- "sendError": "Xabarni yuborib bo'lmadi. Qayta urinib ko'ring."
- },
"glanceable": {
"waiting": "Agentlar yangilanmoqda",
"empty": "Bajarilayotgan ish yo'q",
@@ -2924,5 +2916,18 @@
"needsInput": "Javob kutilmoqda",
"channelName": "Faol agentlar",
"activityKitDisabledBody": "Qulflangan ekranda faol agentlarni ko'rish uchun sozlamalarda jonli faoliyatlarni yoqing."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Suhbatni boshlang",
+ "description": "Model bilan gaplashish uchun xabar yuboring."
+ },
+ "list": {
+ "loadFailed": "Suhbat tarixini yuklab bo'lmadi.",
+ "new": "Yangi chat",
+ "openHint": "Chatni ochadi. Oʻchirish uchun bosib turing.",
+ "deleteTitle": "Bu chat oʻchirilsinmi?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/vi.json b/apps/mobile/src/i18n/locales/vi.json
index 8acdf1bcef..f7f84901e6 100644
--- a/apps/mobile/src/i18n/locales/vi.json
+++ b/apps/mobile/src/i18n/locales/vi.json
@@ -2905,14 +2905,6 @@
"revoke": "Bỏ tin cậy {{host}}",
"backToPreferences": "Quay lại cài đặt"
},
- "quickChat": {
- "empty": {
- "title": "Bắt đầu trò chuyện",
- "description": "Gửi tin nhắn để trò chuyện với mô hình AI."
- },
- "historyRetry": "Không thể tải lịch sử trò chuyện.",
- "sendError": "Không thể gửi tin nhắn. Vui lòng thử lại."
- },
"glanceable": {
"waiting": "Đang cập nhật tác nhân",
"empty": "Không có tác vụ đang chạy",
@@ -2924,5 +2916,18 @@
"needsInput": "Cần phản hồi",
"channelName": "Tác nhân đang hoạt động",
"activityKitDisabledBody": "Bật Hoạt động trực tiếp trong Cài đặt để xem các tác nhân đang hoạt động trên màn hình khóa."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Bắt đầu trò chuyện",
+ "description": "Gửi tin nhắn để trò chuyện với mô hình."
+ },
+ "list": {
+ "loadFailed": "Không thể tải lịch sử trò chuyện.",
+ "new": "Cuộc trò chuyện mới",
+ "openHint": "Mở cuộc trò chuyện. Nhấn giữ để xóa.",
+ "deleteTitle": "Xóa cuộc trò chuyện này?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/yo.json b/apps/mobile/src/i18n/locales/yo.json
index 02ef87d2b6..d397df05ed 100644
--- a/apps/mobile/src/i18n/locales/yo.json
+++ b/apps/mobile/src/i18n/locales/yo.json
@@ -2905,14 +2905,6 @@
"revoke": "Fagilé ìgbẹ́kẹ̀lé {{host}}",
"backToPreferences": "Padà sí àwọn ààyò"
},
- "quickChat": {
- "empty": {
- "title": "Bẹ̀rẹ̀ ìjíròrò",
- "description": "Fi ìfiránṣẹ́ ránṣẹ́ láti bá àwòṣe kan sọ̀rọ̀."
- },
- "historyRetry": "A kò lè gbé ìtàn ìjíròrò wọlé.",
- "sendError": "A kò lè fi ìfiránṣẹ́ náà ránṣẹ́. Gbìyànjú lẹ́ẹ̀kan sí i."
- },
"glanceable": {
"waiting": "Ń ṣe ìmúdójúìwọ̀n àwọn aṣojú",
"empty": "Kò sí iṣẹ́ tó ń lọ",
@@ -2924,5 +2916,18 @@
"needsInput": "Nílò èsì rẹ",
"channelName": "Àwọn aṣojú tó ń ṣiṣẹ́",
"activityKitDisabledBody": "Tan àwọn ìgbòkègbodò ìsinsìnyí nínú àwọn ètò láti rí àwọn aṣojú tó ń ṣiṣẹ́ lórí ojú ìwé títìpa."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Bẹ̀rẹ̀ iwiregbe kan",
+ "description": "Fi ifiranṣẹ ranṣẹ láti bá awoṣe kan sọ̀rọ̀."
+ },
+ "list": {
+ "loadFailed": "Kò lè ṣagbewọ ìtàn iwiregbe.",
+ "new": "Ìjíròrò tuntun",
+ "openHint": "Ṣí ìjíròrò náà. Tẹ̀ mọ́lẹ̀ láti pa á rẹ́.",
+ "deleteTitle": "Pa ìjíròrò yìí rẹ́?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/i18n/locales/zh-Hans.json b/apps/mobile/src/i18n/locales/zh-Hans.json
index ac625d27f1..5a60926911 100644
--- a/apps/mobile/src/i18n/locales/zh-Hans.json
+++ b/apps/mobile/src/i18n/locales/zh-Hans.json
@@ -2905,14 +2905,6 @@
"revoke": "撤销对 {{host}} 的信任",
"backToPreferences": "返回偏好设置"
},
- "quickChat": {
- "empty": {
- "title": "开始聊天",
- "description": "发送一条消息,即可与模型对话。"
- },
- "historyRetry": "无法加载历史聊天记录。",
- "sendError": "无法发送消息。请重试。"
- },
"glanceable": {
"waiting": "正在更新智能体状态",
"empty": "暂无进行中的任务",
@@ -2924,5 +2916,18 @@
"needsInput": "等待输入",
"channelName": "运行中的智能体",
"activityKitDisabledBody": "请在设置中开启实时活动,在锁定屏幕上查看运行中的智能体。"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "开始聊天",
+ "description": "发送消息以与模型对话。"
+ },
+ "list": {
+ "loadFailed": "无法加载聊天历史。",
+ "new": "新对话",
+ "openHint": "打开对话。长按可删除。",
+ "deleteTitle": "删除这个对话?"
+ },
+ "beta": "测试版"
}
}
diff --git a/apps/mobile/src/i18n/locales/zh-Hant.json b/apps/mobile/src/i18n/locales/zh-Hant.json
index 7909394aa2..7d06bb07cb 100644
--- a/apps/mobile/src/i18n/locales/zh-Hant.json
+++ b/apps/mobile/src/i18n/locales/zh-Hant.json
@@ -2905,14 +2905,6 @@
"revoke": "撤銷對 {{host}} 的信任",
"backToPreferences": "返回偏好設定"
},
- "quickChat": {
- "empty": {
- "title": "開始聊天",
- "description": "傳送訊息,即可與模型對話。"
- },
- "historyRetry": "無法載入聊天記錄。",
- "sendError": "無法傳送訊息。請再試一次。"
- },
"glanceable": {
"waiting": "正在更新代理程式狀態",
"empty": "沒有進行中的工作",
@@ -2924,5 +2916,18 @@
"needsInput": "等待輸入",
"channelName": "執行中的代理程式",
"activityKitDisabledBody": "請在「設定」中開啟「即時動態」,即可在鎖定畫面查看執行中的代理程式。"
+ },
+ "modelChat": {
+ "empty": {
+ "title": "開始聊天",
+ "description": "傳送訊息以與模型對話。"
+ },
+ "list": {
+ "loadFailed": "無法載入聊天記錄。",
+ "new": "新對話",
+ "openHint": "開啟對話。長按可刪除。",
+ "deleteTitle": "刪除這個對話?"
+ },
+ "beta": "測試版"
}
}
diff --git a/apps/mobile/src/i18n/locales/zu.json b/apps/mobile/src/i18n/locales/zu.json
index 85f294b0f3..eee3e01b34 100644
--- a/apps/mobile/src/i18n/locales/zu.json
+++ b/apps/mobile/src/i18n/locales/zu.json
@@ -2905,14 +2905,6 @@
"revoke": "Hoxisa ukwethenjwa kuka-{{host}}",
"backToPreferences": "Buyela ezilungiselelweni"
},
- "quickChat": {
- "empty": {
- "title": "Qala ingxoxo",
- "description": "Thumela umlayezo ukuze uxoxe nemodeli."
- },
- "historyRetry": "Asikwazanga ukulayisha umlando wengxoxo.",
- "sendError": "Asikwazanga ukuthumela umlayezo. Zama futhi."
- },
"glanceable": {
"waiting": "Kubuyekezwa ama-ejenti",
"empty": "Awukho umsebenzi oqhubekayo",
@@ -2924,5 +2916,18 @@
"needsInput": "Kudinga impendulo",
"channelName": "Ama-ejenti asebenzayo",
"activityKitDisabledBody": "Vula imisebenzi ebukhoma kuzilungiselelo ukuze ubone ama-ejenti asebenzayo esikrinini esikhiyiwe."
+ },
+ "modelChat": {
+ "empty": {
+ "title": "Qala ingxoxo",
+ "description": "Thumela umlayezo ukuze uxoxe nomodeli."
+ },
+ "list": {
+ "loadFailed": "Asikwazanga ukulayisha umlando wengxoxo.",
+ "new": "Ingxoxo entsha",
+ "openHint": "Ivula ingxoxo. Cindezela isikhathi eside ukuze usule.",
+ "deleteTitle": "Susa le ngxoxo?"
+ },
+ "beta": "Beta"
}
}
diff --git a/apps/mobile/src/lib/analytics/posthog.ts b/apps/mobile/src/lib/analytics/posthog.ts
index 7567bb3597..56f7cb9629 100644
--- a/apps/mobile/src/lib/analytics/posthog.ts
+++ b/apps/mobile/src/lib/analytics/posthog.ts
@@ -72,7 +72,8 @@ export type AnalyticsSurface = (typeof ANALYTICS_SURFACES)[number];
// PostHog feature flags. The project is shared with web, so mobile-only flags
// are prefixed to avoid colliding with web flag keys.
export const FEATURE_FLAG_PR_REVIEW = 'mobile-pr-review';
-export const FEATURE_FLAG_QUICK_CHAT = 'mobile-quick-chat';
+/* The key is the one PostHog already rolls out; the surface behind it was rebuilt. */
+export const FEATURE_FLAG_CHAT = 'mobile-quick-chat';
let client: PostHog | null = null;
/** Generation that created the client. Stale events from a prior account
diff --git a/apps/mobile/src/lib/auth/auth-context.test.tsx b/apps/mobile/src/lib/auth/auth-context.test.tsx
index 9681c95e5a..b764265275 100644
--- a/apps/mobile/src/lib/auth/auth-context.test.tsx
+++ b/apps/mobile/src/lib/auth/auth-context.test.tsx
@@ -260,6 +260,11 @@ vi.mock('@/lib/kilo-pass/use-store-kilo-pass-purchase', () => ({
resetPurchaseErrorToastDedup: vi.fn(),
}));
+vi.mock('@/lib/chat/sign-out', () => ({
+ clearChatsForSignOut: vi.fn().mockResolvedValue(undefined),
+ releaseChatsForAccountSwitch: vi.fn().mockResolvedValue(undefined),
+}));
+
vi.mock('@/lib/pr-review/recent-prs', () => ({
clearRecentPrs: vi.fn().mockResolvedValue(undefined),
}));
@@ -543,6 +548,25 @@ describe('sign-out teardown ordering', () => {
unmount();
});
+ it('ends the prior account chats on sign-in, and signs in even when that fails', async () => {
+ const { ctx, unmount } = await mountAndGetContext();
+ const { releaseChatsForAccountSwitch } = await import('@/lib/chat/sign-out');
+ const { queryClient: queryClientMock } = await import('@/lib/query-client');
+ const release = vi.mocked(releaseChatsForAccountSwitch);
+ release.mockRejectedValueOnce(new Error('the store is locked'));
+
+ await act(async () => {
+ await ctx.signIn(makeToken({ kiloUserId: 'user-2' }));
+ });
+
+ expect(release).toHaveBeenCalledTimes(1);
+ // The rest of the switch ran: a chat that would not close cannot stop the
+ // prior account's cache being cleared.
+ expect(vi.mocked(queryClientMock.clear)).toHaveBeenCalled();
+
+ unmount();
+ });
+
it('clears the trusted hosts and image confirmations on sign-in', async () => {
const { ctx, unmount } = await mountAndGetContext();
const trustedHosts = await import('@/lib/hooks/use-trusted-hosts');
@@ -656,6 +680,22 @@ describe('sign-out teardown ordering', () => {
unmount();
});
+ it("takes the account's chats off the device, and survives a wipe that fails", async () => {
+ const { ctx, unmount } = await mountAndGetContext();
+ const { clearChatsForSignOut } = await import('@/lib/chat/sign-out');
+ const wipe = vi.mocked(clearChatsForSignOut);
+ wipe.mockRejectedValueOnce(new Error('database locked'));
+
+ await act(async () => {
+ await ctx.signOut();
+ });
+
+ expect(wipe).toHaveBeenCalledWith(null);
+ expect(hoisted.secureStore.deleteItemAsync).toHaveBeenCalledWith('active-user-id');
+
+ unmount();
+ });
+
it('regression: a cache cleanup failure does not abort sign-out query or auth state reset', async () => {
const { ctx, unmount } = await mountAndGetContext();
const { queryClient: queryClientMock } = await import('@/lib/query-client');
diff --git a/apps/mobile/src/lib/auth/auth-context.tsx b/apps/mobile/src/lib/auth/auth-context.tsx
index 81965603f9..15a3b336bd 100644
--- a/apps/mobile/src/lib/auth/auth-context.tsx
+++ b/apps/mobile/src/lib/auth/auth-context.tsx
@@ -19,6 +19,7 @@ import {
flushLastPostHogEvent,
LOGOUT_EVENT,
} from '@/lib/analytics/posthog';
+import { clearChatsForSignOut, releaseChatsForAccountSwitch } from '@/lib/chat/sign-out';
import { clearPendingConsentOutcome } from '@/lib/consent';
import { resetAppsFlyerState, trackEvent } from '@/lib/appsflyer';
import { clearAccountBoundPendingDeepLink, setCurrentDeepLinkUserId } from '@/lib/deep-link-launch';
@@ -260,6 +261,10 @@ export function AuthProvider({ children }: { readonly children: ReactNode }) {
// A direct account switch must not keep the prior account's query
// cache: the org list is keyed account-independently, so a stale list
// would otherwise drive a false lost-org blank in the org fence.
+ // A direct account switch must not keep the prior account's running
+ // chats, which outlive any screen. A release that fails can never hold
+ // up the account signing in.
+ await Promise.allSettled([releaseChatsForAccountSwitch()]);
queryClient.clear();
setToken(tokenValue);
// A direct account switch must not keep the prior account's session
@@ -380,6 +385,10 @@ export function AuthProvider({ children }: { readonly children: ReactNode }) {
// unknown — privacy wins). Best effort: a failed cleanup can
// never abort sign-out.
clearCacheScopeForSignOut(readCachedUserId(queryClient)),
+ // The chats on the device are read from the same cached user id,
+ // and an unknown one takes every chat rather than leaving one
+ // account's conversations for the next person to sign in.
+ clearChatsForSignOut(readCachedUserId(queryClient)),
clearLastActiveInstance(),
clearKiloClawOwned(),
clearRecentPrs(),
diff --git a/apps/mobile/src/lib/auth/credentials.test.ts b/apps/mobile/src/lib/auth/credentials.test.ts
index f96267aa88..dda0d4b1cc 100644
--- a/apps/mobile/src/lib/auth/credentials.test.ts
+++ b/apps/mobile/src/lib/auth/credentials.test.ts
@@ -56,6 +56,10 @@ vi.mock('@/lib/auth/logout-cleanup', () => ({
vi.mock('@/lib/query-client', () => ({
queryClient: { clear: vi.fn(), invalidateQueries: vi.fn() },
}));
+vi.mock('@/lib/chat/sign-out', () => ({
+ clearChatsForSignOut: vi.fn(),
+ releaseChatsForAccountSwitch: vi.fn(),
+}));
vi.mock('@/lib/auth/trpc-unauthorized', () => ({ setTrpcUnauthorizedHandler: vi.fn() }));
vi.mock('@/lib/hooks/use-persisted-agent-model', () => ({ clearAgentModelPreference: vi.fn() }));
vi.mock('@/lib/hooks/use-keep-screen-on-preference', () => ({
diff --git a/apps/mobile/src/lib/chat/fetch.ts b/apps/mobile/src/lib/chat/fetch.ts
new file mode 100644
index 0000000000..5c5ddaf020
--- /dev/null
+++ b/apps/mobile/src/lib/chat/fetch.ts
@@ -0,0 +1,63 @@
+import { type FetchLike } from '@kilocode/harness-sdk';
+
+/**
+ * The one call the harness makes, as this app makes it.
+ *
+ * The package ships `webFetch`, and it reads a response body by iterating it.
+ * React Native's body is a `ReadableStream` that iterates on Node and not
+ * here, so this reads it the way the rest of the app reads a stream: with a
+ * reader. The README calls this out as the case a runtime writes its own
+ * adapter for.
+ *
+ * It is also where the feature header goes. The gateway attributes every
+ * microdollar to the header's value, and the harness knows nothing about which
+ * of Kilo's products is holding it.
+ */
+
+const FEATURE_HEADER = 'X-KILOCODE-FEATURE';
+
+/** What the gateway files this surface's spending under. */
+const FEATURE = 'mobile-chat';
+
+/**
+ * Yields the body as text, in the pieces it arrives in. The reader is released
+ * whether the stream ended, failed, or the caller stopped listening: a lock
+ * left behind holds the connection open for the life of the app.
+ */
+async function* decoded(body: ReadableStream): AsyncGenerator {
+ const reader = body.getReader();
+ const decoder = new TextDecoder();
+ try {
+ for (;;) {
+ // eslint-disable-next-line no-await-in-loop -- a stream is read one chunk after the previous one, which is the whole point
+ const { done, value } = await reader.read();
+ if (done) {
+ return;
+ }
+ yield decoder.decode(value, { stream: true });
+ }
+ } finally {
+ reader.releaseLock();
+ }
+}
+
+export const chatFetch: FetchLike = async (url, request) => {
+ const response = await fetch(url, {
+ method: request.method,
+ headers: { ...request.headers, [FEATURE_HEADER]: FEATURE },
+ body: request.body,
+ // The runtime's own signal type. Dropping it would leave a stopped answer
+ // still arriving, and still being paid for, at the provider.
+ signal: (request.signal ?? null) as AbortSignal | null,
+ });
+ const { body } = response;
+ return {
+ ok: response.ok,
+ status: response.status,
+ text: async () => {
+ const said = await response.text();
+ return said;
+ },
+ ...(body === null ? {} : { stream: () => decoded(body) }),
+ };
+};
diff --git a/apps/mobile/src/lib/chat/layers.ts b/apps/mobile/src/lib/chat/layers.ts
new file mode 100644
index 0000000000..34fae37f71
--- /dev/null
+++ b/apps/mobile/src/lib/chat/layers.ts
@@ -0,0 +1,126 @@
+import { Effect, Layer } from 'effect';
+import {
+ EntropySource,
+ layerAssembler,
+ layerBackoff,
+ layerKiloGateway,
+ ModelCatalog,
+ type ModelFacts,
+ TokenError,
+ TokenSource,
+ type TokenSourceService,
+ ToolRegistry,
+} from '@kilocode/harness-sdk';
+import { layerExpoStore } from '@kilocode/harness-sdk/plugins/store/expo';
+import * as Crypto from 'expo-crypto';
+import { type SQLiteDatabase } from 'expo-sqlite';
+
+import { getAuthTokenForRequest } from '@/lib/auth/token-owner';
+import { API_BASE_URL } from '@/lib/config';
+import { chatFetch } from './fetch';
+import { chatTools } from './tools';
+
+/**
+ * The plugins the chat runs on.
+ *
+ * `layerKilo` is the wiring most callers want and it builds its own catalog
+ * from a fixed table. This app's table is not fixed: the models come from the
+ * gateway while the app is running, and a session opened before they arrived
+ * would never learn its own context window and so would never compact. So the
+ * layers are composed by hand, over a catalog that reads what the app knows now.
+ */
+
+/**
+ * Every relayed model speaks all three gateway shapes, and the best one it
+ * really speaks is picked from this list. A model nobody has told us about gets
+ * this and no window, which means it never compacts — an honest answer, and one
+ * the next catalog read fixes.
+ */
+const EVERY_SHAPE: ModelFacts = { apiKinds: ['messages', 'responses', 'chat_completions'] };
+
+/** What the app has been told about each model, replaced as the catalog loads. */
+let known: ReadonlyMap = new Map();
+
+/**
+ * Takes the gateway's model list as the facts a session needs.
+ *
+ * Only the window comes from it. The shapes do not: the gateway relays a model
+ * from whichever provider serves it and says nothing about which shapes that
+ * provider speaks, so the assumption above stands for every model.
+ */
+export function rememberModelFacts(
+ models: readonly { readonly id: string; readonly context_length?: number | null }[]
+): void {
+ known = new Map(
+ models.map(model => [
+ model.id,
+ model.context_length === null || model.context_length === undefined
+ ? EVERY_SHAPE
+ : { ...EVERY_SHAPE, contextWindow: model.context_length },
+ ])
+ );
+}
+
+/**
+ * Randomness, which React Native has no global `crypto` for.
+ *
+ * The SDK's default reads `crypto.getRandomValues` and says so: a runtime
+ * without one supplies its own. This app already ships expo-crypto — it is
+ * what encrypts the database — so the identifiers come from the same source
+ * as the key.
+ */
+const layerEntropy = Layer.succeed(EntropySource, {
+ bytes: (count: number) => Crypto.getRandomBytes(count),
+});
+
+/** One catalog instance, shared by the session and the gateway as it must be. */
+const layerCatalog = Layer.succeed(ModelCatalog, {
+ facts: (model: string) => Effect.succeed(known.get(model) ?? EVERY_SHAPE),
+});
+
+/**
+ * The signed-in credential, read for every call.
+ *
+ * The app's token expires and is refreshed under this, and a chat outlives
+ * both. Reading it per call is why: a source that held a string would start
+ * failing with 401 while still believing in it.
+ */
+const layerToken = Layer.succeed(TokenSource, {
+ get: () =>
+ Effect.tryPromise({
+ try: async () => {
+ const token = await getAuthTokenForRequest();
+ if (token === null) {
+ throw new Error('the app is signed out');
+ }
+ return token;
+ },
+ catch: cause => new TokenError({ cause }),
+ }),
+} satisfies TokenSourceService);
+
+/**
+ * The tools a session may name. It is assembled once: the set is frozen for
+ * the life of a session, so a registry rebuilt per call would be the same one
+ * every time.
+ */
+const layerTools = Layer.succeed(ToolRegistry, { tools: chatTools() });
+
+/** Whose credit pays for the chat. */
+export type ChatOrg =
+ | { readonly kind: 'personal' }
+ | { readonly kind: 'organization'; readonly id: string };
+
+export function chatLayers(database: SQLiteDatabase, org: ChatOrg) {
+ const gateway = layerKiloGateway({ baseUrl: API_BASE_URL, org, fetch: chatFetch }).pipe(
+ Layer.provide(Layer.mergeAll(layerCatalog, layerToken, layerBackoff(2)))
+ );
+ return Layer.mergeAll(
+ layerAssembler,
+ layerEntropy,
+ layerCatalog,
+ layerTools,
+ gateway,
+ layerExpoStore(database)
+ );
+}
diff --git a/apps/mobile/src/lib/chat/pending.ts b/apps/mobile/src/lib/chat/pending.ts
new file mode 100644
index 0000000000..46f168c347
--- /dev/null
+++ b/apps/mobile/src/lib/chat/pending.ts
@@ -0,0 +1,38 @@
+import { getItem, removeItem, setItem } from '@/lib/persist/encrypted-kv';
+
+/**
+ * The question a chat is waiting on an answer to.
+ *
+ * The SDK writes a question and its answer together or neither, which is what
+ * keeps a paid-for question from going back out with every later request. It
+ * also means a question whose answer never arrived — the app was killed, the
+ * network went, the person pressed stop — is nowhere afterwards.
+ *
+ * So the app remembers it, and the chat screen draws it as the last thing said
+ * with a Retry under it. It is written before the question goes out and removed
+ * when the answer lands, so what is here is always a question with no answer.
+ */
+
+const SCOPE = 'chat-asked';
+
+export async function rememberAsked(sessionId: string, text: string): Promise {
+ await setItem(SCOPE, sessionId, text);
+}
+
+export async function forgetAsked(sessionId: string): Promise {
+ await removeItem(SCOPE, sessionId);
+}
+
+export async function askedIn(sessionId: string): Promise {
+ const asked = await getItem(SCOPE, sessionId);
+ return asked;
+}
+
+/** Carries the question across a model switch, which opens a new session. */
+export async function moveAsked(from: string, to: string): Promise {
+ const text = await askedIn(from);
+ await forgetAsked(from);
+ if (text !== null) {
+ await rememberAsked(to, text);
+ }
+}
diff --git a/apps/mobile/src/lib/chat/registry.test.ts b/apps/mobile/src/lib/chat/registry.test.ts
new file mode 100644
index 0000000000..ca4c98a0fa
--- /dev/null
+++ b/apps/mobile/src/lib/chat/registry.test.ts
@@ -0,0 +1,205 @@
+import { Effect, Layer, Stream } from 'effect';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+/**
+ * The line a chat keeps.
+ *
+ * The composer stays open while the model works, so a person can ask twice
+ * before the first answer lands. What that costs — a second read of one
+ * session, a question asked on a model the person had already changed, a
+ * question asked of a session that is closing — is what these cover. The SDK
+ * is faked because none of it is about the SDK: it is about what this app does
+ * with one question at a time.
+ */
+
+type Asked = { readonly sessionId: string; readonly text: string };
+
+const asked: Asked[] = [];
+/** What the session was opened with, so the tools it offers can be read back. */
+let openedWith: { readonly tools?: readonly string[] } | undefined = undefined;
+/** Ends the answer that is arriving, so a test decides when a turn finishes. */
+let finish: (() => void) | undefined = undefined;
+
+const handleFor = (id: string) => ({
+ id,
+ ask: (text: string) =>
+ Stream.asyncPush<{ kind: 'delta'; text: string }>(emit =>
+ Effect.sync(() => {
+ asked.push({ sessionId: id, text });
+ emit.single({ kind: 'delta', text: 'ok' });
+ finish = () => {
+ emit.end();
+ };
+ return Effect.void;
+ })
+ ),
+ history: Effect.succeed([]),
+});
+
+vi.mock('@kilocode/harness-sdk', () => ({
+ openSession: (options: { readonly tools?: readonly string[] }) => {
+ openedWith = options;
+ return Effect.succeed(handleFor('s1'));
+ },
+ continueSession: (id: string) => Effect.succeed(handleFor(id)),
+ cloneSession: () => Effect.succeed(handleFor('s2')),
+}));
+vi.mock('./layers', () => ({ chatLayers: () => Layer.empty }));
+vi.mock('@/lib/persist/encrypted-kv', () => ({
+ encryptedDatabase: async () => {
+ await Promise.resolve();
+ return {};
+ },
+}));
+vi.mock('./pending', () => ({
+ askedIn: async () => {
+ await Promise.resolve();
+ return null;
+ },
+ forgetAsked: async () => {
+ await Promise.resolve();
+ },
+ moveAsked: async () => {
+ await Promise.resolve();
+ },
+ rememberAsked: async () => {
+ await Promise.resolve();
+ },
+}));
+vi.mock('./store', () => ({
+ forgetSession: () => undefined,
+ modelOfSession: () => 'kilo/one',
+ moveChat: () => undefined,
+ rememberChat: () => undefined,
+ touchChat: () => undefined,
+}));
+
+const { enterChat, releaseChat, say, startChat, stopChat } = await import('./registry');
+const { snapshotOf } = await import('./state');
+
+const place = { chatScope: 'me:personal', org: { kind: 'personal' } } as const;
+
+/** Lets the forked reading fiber run to wherever it gets to. */
+const settled = async () => {
+ for (let round = 0; round < 20; round += 1) {
+ // eslint-disable-next-line no-await-in-loop -- each turn of the loop hands the fiber another tick
+ await new Promise(resolve => {
+ setTimeout(resolve, 0);
+ });
+ }
+};
+
+let opened = '';
+
+beforeEach(async () => {
+ asked.length = 0;
+ finish = undefined;
+ opened = await startChat(place, 'kilo/one');
+ await settled();
+});
+
+describe('what a chat is opened with', () => {
+ it('offers the clock, because a model has none and answers from a stale date', () => {
+ expect(openedWith?.tools).toEqual(['time']);
+ });
+});
+
+describe('a second question while the first is being answered', () => {
+ it('waits rather than starting a second read of the session', async () => {
+ await say(opened, 'first', 'kilo/one');
+ await settled();
+ await say(opened, 'second', 'kilo/one');
+ await settled();
+
+ expect(asked.map(one => one.text)).toEqual(['first']);
+ expect(snapshotOf(opened).waiting).toEqual(['second']);
+ });
+
+ it('is asked when the answer lands, on the model it was sent with', async () => {
+ await say(opened, 'first', 'kilo/one');
+ await settled();
+ await say(opened, 'second', 'kilo/two');
+ await settled();
+
+ finish?.();
+ await settled();
+
+ expect(asked.map(one => one.text)).toEqual(['first', 'second']);
+ // The move onto kilo/two is what makes the clone the session to carry on
+ // with: the question is asked of the model that was on screen when it was
+ // typed, not of the one the session happened to be on.
+ expect(asked.at(-1)?.sessionId).toBe('s2');
+ expect(snapshotOf('s2').waiting).toEqual([]);
+ });
+
+ it('is asked when the person stops the answer, because they still asked it', async () => {
+ await say(opened, 'first', 'kilo/one');
+ await settled();
+ await say(opened, 'second', 'kilo/one');
+ await settled();
+
+ await stopChat(opened);
+ await settled();
+
+ expect(asked.map(one => one.text)).toEqual(['first', 'second']);
+ });
+
+ it('goes with the chat when the chat is closed', async () => {
+ await say(opened, 'first', 'kilo/one');
+ await settled();
+ await say(opened, 'second', 'kilo/one');
+ await settled();
+
+ await releaseChat(opened);
+ await settled();
+
+ expect(asked.map(one => one.text)).toEqual(['first']);
+ });
+});
+
+describe('a chat that moved', () => {
+ it('leaves the chat it moved off pointing at the one it became', async () => {
+ await say(opened, 'first', 'kilo/one');
+ await settled();
+ await say(opened, 'second', 'kilo/two');
+ await settled();
+
+ finish?.();
+ await settled();
+
+ /* The queued question moved the conversation, and nobody handed the new
+ identifier back to the screen. The chat it left says where it went, so a
+ screen watching the old one follows without being told. */
+ expect(snapshotOf(opened).sessionId).toBe('s2');
+ });
+});
+
+describe('a question asked before the session has opened', () => {
+ it('waits for the open rather than vanishing', async () => {
+ await releaseChat(opened);
+ asked.length = 0;
+
+ /* No await: this is a person typing while the screen is still opening the
+ chat, which is exactly the window the question used to be dropped in. */
+ const entering = enterChat(place, 'later');
+ await say('later', 'typed early', 'kilo/one');
+ await entering;
+ await settled();
+
+ expect(asked).toEqual([{ sessionId: 'later', text: 'typed early' }]);
+ });
+
+ it('says so rather than reporting success when the chat is not there', async () => {
+ await releaseChat(opened);
+ asked.length = 0;
+
+ await say(opened, 'into nothing', 'kilo/one');
+ await settled();
+
+ expect(asked).toEqual([]);
+ /* The question is on screen with a Retry under it, which is what every
+ other question that never reached the model gets. */
+ expect(snapshotOf(opened)).toMatchObject({ status: 'idle', asked: 'into nothing' });
+ expect(snapshotOf(opened).failed).not.toBeNull();
+ });
+});
diff --git a/apps/mobile/src/lib/chat/registry.ts b/apps/mobile/src/lib/chat/registry.ts
new file mode 100644
index 0000000000..9fb8a8b0bc
--- /dev/null
+++ b/apps/mobile/src/lib/chat/registry.ts
@@ -0,0 +1,444 @@
+import { Cause, Effect, Exit, Fiber, ManagedRuntime, Option, Scope, Stream } from 'effect';
+import {
+ cloneSession,
+ continueSession,
+ type ModelEvent,
+ openSession,
+ type SessionHandle,
+} from '@kilocode/harness-sdk';
+import { type SQLiteDatabase } from 'expo-sqlite';
+
+import { encryptedDatabase } from '@/lib/persist/encrypted-kv';
+import { change, forgetState, NOTHING, snapshotOf } from './state';
+import { chatLayers, type ChatOrg } from './layers';
+import { askedIn, forgetAsked, moveAsked, rememberAsked } from './pending';
+import { CHAT_TOOL_NAMES } from './tools';
+import { forgetSession, modelOfSession, moveChat, rememberChat, touchChat } from './store';
+
+/**
+ * The chats that are running, for as long as they run.
+ *
+ * A chat is not tied to the screen showing it: a person asks something, leaves
+ * for another tab, and comes back to the answer. So the live sessions live here,
+ * in the module, and a screen subscribes to one rather than owning it.
+ *
+ * Everything a screen draws is in `ChatState`, and every change to one is
+ * published to whoever is watching. Nothing here draws anything and nothing
+ * here reads React.
+ */
+
+const openRuntime = (database: SQLiteDatabase, org: ChatOrg) =>
+ ManagedRuntime.make(chatLayers(database, org));
+
+type ChatRuntime = ReturnType;
+
+/** Every plugin the runtime holds, which is what a session may still ask for. */
+type ChatContext = ManagedRuntime.ManagedRuntime.Context;
+
+/**
+ * A question typed while an answer was arriving, and the model it was meant
+ * for. The model is carried because a person can change it between the two,
+ * and the question was asked of the one that was on screen.
+ */
+type Waiting = {
+ readonly text: string;
+ readonly model: string;
+};
+
+/** A chat that is open: the session behind it, and what it is doing. */
+type Chat = {
+ readonly handle: SessionHandle;
+ readonly scope: Scope.CloseableScope;
+ answering: Fiber.RuntimeFiber | undefined;
+ /** What was typed while `answering` was running. Drained when it ends well. */
+ readonly waiting: Waiting[];
+ readonly chatScope: string;
+ readonly org: ChatOrg;
+};
+
+/** Where a chat belongs, which every call needs and no chat holds before it opens. */
+export type ChatPlace = {
+ readonly chatScope: string;
+ readonly org: ChatOrg;
+};
+
+const chats = new Map();
+
+/** One open at a time per chat, so entering a screen twice opens one session. */
+const opening = new Map>();
+
+/**
+ * One runtime per scope, because whose credit pays is part of the wiring and a
+ * person switching organizations is asking for the other one. Each builds its
+ * layers once and holds them for as long as the app runs, which is what keeps a
+ * session alive between two visits to the screen.
+ */
+const runtimes = new Map();
+
+let sqlite: SQLiteDatabase | undefined = undefined;
+
+async function open(): Promise {
+ sqlite ??= await encryptedDatabase();
+ return sqlite;
+}
+
+async function runtimeFor(place: ChatPlace): Promise {
+ const held = runtimes.get(place.chatScope);
+ if (held !== undefined) {
+ return held;
+ }
+ const made = openRuntime(await open(), place.org);
+ runtimes.set(place.chatScope, made);
+ return made;
+}
+
+/**
+ * Opens a session in a scope of its own, which outlives the screen that asked
+ * for it. Closing that scope later is what tells the store to write down
+ * whatever it still holds.
+ */
+async function inOwnScope(
+ runtime: ChatRuntime,
+ opened: Effect.Effect
+): Promise<{ readonly handle: SessionHandle; readonly scope: Scope.CloseableScope }> {
+ const scope = await runtime.runPromise(Scope.make());
+ const handle = await runtime.runPromise(Scope.extend(opened, scope));
+ return { handle, scope };
+}
+
+/**
+ * The system prompt, frozen for the life of every session and identical across
+ * them. It is the front of the cached prefix, so it is one constant here and is
+ * never built out of anything that varies.
+ */
+const SYSTEM =
+ 'You are Kilo, a helpful assistant inside a mobile app. ' +
+ 'Answer briefly and in plain language, in the language the person writes in. ' +
+ 'Your one tool tells you the date and time; the date you were trained on has ' +
+ 'passed, so read the clock rather than assuming it. You have no files and no ' +
+ 'internet: when something needs one of those, say so rather than guessing. ' +
+ 'Use markdown sparingly, and code blocks for code.';
+
+/**
+ * Makes the database ready to be read.
+ *
+ * The SDK's store creates its own tables when its layer is built, and the list
+ * joins those tables. A list drawn before any chat was ever opened would be
+ * reading tables that do not exist yet, so the screen asks for the runtime
+ * first and the store's own migrations run under it.
+ */
+export async function prepareChats(place: ChatPlace): Promise {
+ const runtime = await runtimeFor(place);
+ await runtime.runPromise(Effect.void);
+}
+
+/** Starts a chat: a session of its own, and a row so the list has it. */
+export async function startChat(place: ChatPlace, model: string): Promise {
+ const runtime = await runtimeFor(place);
+ const { handle, scope } = await inOwnScope(
+ runtime,
+ openSession({ system: SYSTEM, model, tools: CHAT_TOOL_NAMES })
+ );
+ rememberChat(await open(), { sessionId: handle.id, scope: place.chatScope, at: Date.now() });
+ chats.set(handle.id, { handle, scope, answering: undefined, waiting: [], ...place });
+ change(handle.id, { ...NOTHING, model, status: 'idle' });
+ return handle.id;
+}
+
+/**
+ * Reopens a chat the store holds, unless it is still running from before.
+ *
+ * A chat that is still answering is the whole reason this registry exists, so
+ * entering one twice must not restart it — and two screens entering at once
+ * must not open two sessions onto one conversation.
+ */
+export async function enterChat(place: ChatPlace, sessionId: string): Promise {
+ if (chats.has(sessionId)) {
+ return;
+ }
+ const already = opening.get(sessionId);
+ if (already !== undefined) {
+ await already;
+ return;
+ }
+ const work = (async () => {
+ try {
+ await reopen(place, sessionId);
+ } finally {
+ opening.delete(sessionId);
+ }
+ })();
+ opening.set(sessionId, work);
+ await work;
+}
+
+async function reopen(place: ChatPlace, sessionId: string): Promise {
+ const runtime = await runtimeFor(place);
+ const { handle, scope } = await inOwnScope(runtime, continueSession(sessionId));
+ const turns = await runtime.runPromise(handle.history);
+ const asked = await askedIn(sessionId);
+ chats.set(sessionId, { handle, scope, answering: undefined, waiting: [], ...place });
+ change(sessionId, {
+ ...NOTHING,
+ model: modelOfSession(await open(), sessionId) ?? '',
+ turns,
+ status: 'idle',
+ asked,
+ });
+}
+
+/**
+ * Says something and reads the answer as it arrives.
+ *
+ * A model that is not the one the session was opened on moves the conversation
+ * first, because a session freezes its model. The identifier changes when it
+ * does, and the state of the chat it moved off says where it went, so whoever
+ * is watching follows without being told.
+ */
+export async function say(sessionId: string, text: string, model: string): Promise {
+ /* Where the failure below belongs. It is the chat the move landed on, not
+ the one it started from, or the report goes to a chat nobody is watching. */
+ let current = sessionId;
+ try {
+ /* A person can type before the session has finished opening, and a
+ question asked of a chat that is not there yet used to vanish with the
+ composer reporting success. It waits for the open instead. */
+ await opening.get(sessionId);
+ const held = chats.get(sessionId);
+ if (held?.answering !== undefined) {
+ /* A session answers one question at a time, and the composer stays open
+ while it works. So a second question joins the line rather than racing
+ the first, and it is on screen while it waits. It is held in memory
+ only: an answer that is still arriving is not written down either. */
+ held.waiting.push({ text, model });
+ change(sessionId, { waiting: held.waiting.map(one => one.text) });
+ return;
+ }
+ current = await ontoModel(sessionId, model);
+ const chat = chats.get(current);
+ if (chat === undefined) {
+ throw new Error('the chat is not open');
+ }
+ const runtime = await runtimeFor(chat);
+ await rememberAsked(current, text);
+ touchChat(await open(), current, Date.now());
+ change(current, { status: 'working', answering: '', asked: text, failed: null });
+ chat.answering = runtime.runFork(reading(current, text, runtime));
+ } catch (error) {
+ /* The open, the move, or the write that remembers the question failed. The
+ question is not lost: it stays on screen with a Retry under it, the same
+ as one whose answer never arrived. */
+ change(current, { status: 'idle', answering: '', asked: text, failed: reason(error) });
+ }
+}
+
+/** A short reason for the log, from something thrown rather than from a cause. */
+const reason = (error: unknown): string =>
+ error instanceof Error ? error.message : 'the question could not be sent';
+
+/** Asks again what was asked and never answered. */
+export async function retryChat(sessionId: string): Promise {
+ const { asked, model } = snapshotOf(sessionId);
+ if (asked !== null) {
+ await say(sessionId, asked, model);
+ }
+}
+
+/** Reads one answer to the end, however it ends. */
+function reading(sessionId: string, text: string, runtime: ChatRuntime): Effect.Effect {
+ const chat = chats.get(sessionId);
+ if (chat === undefined) {
+ return Effect.void;
+ }
+ let said = '';
+ return Stream.runForEach(chat.handle.ask(text), (event: ModelEvent) =>
+ Effect.sync(() => {
+ if (event.kind === 'delta') {
+ said += event.text;
+ change(sessionId, { answering: said });
+ }
+ })
+ ).pipe(
+ Effect.matchCauseEffect({
+ onFailure: (cause: Cause.Cause) =>
+ Effect.promise(async () => {
+ await settle(sessionId, runtime, why(cause));
+ }),
+ onSuccess: () =>
+ Effect.promise(async () => {
+ await settle(sessionId, runtime, null);
+ }),
+ })
+ );
+}
+
+/**
+ * A short reason for the log. The screen says the same thing whatever it is.
+ *
+ * The failure itself is read rather than the cause's own text: every error this
+ * package raises is a tagged value whose fields — the status, the body, the
+ * tool — are what say what happened, and none of them are in its message.
+ */
+function why(cause: Cause.Cause): string {
+ const failure = Option.getOrUndefined(Cause.failureOption(cause));
+ if (failure === undefined) {
+ return Cause.pretty(cause).slice(0, 300);
+ }
+ try {
+ return JSON.stringify(failure).slice(0, 300);
+ } catch {
+ // A value that will not serialise — a cycle, or a BigInt. The cause's own
+ // text is all there is left to log.
+ return Cause.pretty(cause).slice(0, 300);
+ }
+}
+
+/**
+ * What is true once an answer has ended.
+ *
+ * The turns come from the session rather than from what was streamed: the store
+ * holds what was written, and a question that failed was never written. That
+ * question stays remembered, which is what offers the Retry.
+ */
+async function settle(
+ sessionId: string,
+ runtime: ChatRuntime,
+ failed: string | null
+): Promise {
+ const chat = chats.get(sessionId);
+ if (chat === undefined) {
+ return;
+ }
+ const turns = await runtime.runPromise(chat.handle.history);
+ if (failed === null) {
+ await forgetAsked(sessionId);
+ }
+ chat.answering = undefined;
+ change(sessionId, {
+ turns,
+ answering: '',
+ status: 'idle',
+ asked: failed === null ? null : snapshotOf(sessionId).asked,
+ failed,
+ });
+ /* The line moves only when the answer landed. A question that failed keeps
+ its Retry, and asking the next one would take the place that Retry hangs
+ off — so what is waiting stays waiting until the person deals with it. */
+ if (failed === null) {
+ await drain(sessionId, chat);
+ }
+}
+
+/**
+ * Asks the next question the person left, if they left one.
+ *
+ * They typed it while the last answer was arriving, so it was never a draft
+ * they could go back and change: it is a question they asked, and it is asked
+ * as soon as the session is free.
+ */
+async function drain(sessionId: string, chat: Chat): Promise {
+ const next = chat.waiting.shift();
+ if (next === undefined) {
+ return;
+ }
+ change(sessionId, { waiting: chat.waiting.map(one => one.text) });
+ await say(sessionId, next.text, next.model);
+}
+
+/**
+ * Moves the chat onto the model the person picked, and answers with the session
+ * to carry on with.
+ *
+ * The old session goes: the copy holds every turn of it, and two rows for one
+ * conversation is a list that lies. What a copy cannot carry is the thinking,
+ * which is signed by the model that made it — that rule is the SDK's, and this
+ * only asks for the move.
+ */
+async function ontoModel(sessionId: string, model: string): Promise {
+ const chat = chats.get(sessionId);
+ const held = snapshotOf(sessionId);
+ if (chat === undefined || model === '' || model === held.model) {
+ return sessionId;
+ }
+ const runtime = await runtimeFor(chat);
+ const { handle, scope } = await inOwnScope(runtime, cloneSession(sessionId, { model }));
+ const database = await open();
+ moveChat(database, { from: sessionId, to: handle.id, at: Date.now() });
+ await moveAsked(sessionId, handle.id);
+ const turns = await runtime.runPromise(handle.history);
+ chats.delete(sessionId);
+ chats.set(handle.id, { ...chat, handle, scope, answering: undefined });
+ change(handle.id, { ...held, sessionId: handle.id, model, turns });
+ /* The chat it moved off is left pointing at the one it became, rather than
+ forgotten. Whoever asked for the move is not always the screen — a question
+ queued on another model moves the chat from inside the registry — so the
+ state is what says where the conversation went. */
+ change(sessionId, { sessionId: handle.id });
+ await runtime.runPromise(Scope.close(chat.scope, Exit.void));
+ forgetSession(database, sessionId);
+ return handle.id;
+}
+
+/**
+ * Stops the answer that is arriving.
+ *
+ * Interrupting the reading aborts the request, so the provider stops sending.
+ * The question stays remembered: nothing was answered, so the person is left
+ * with what they asked and a Retry under it, rather than with a message that
+ * vanished.
+ */
+export async function stopChat(sessionId: string): Promise {
+ const chat = chats.get(sessionId);
+ if (chat === undefined) {
+ return;
+ }
+ const stopped = await halt(sessionId, chat);
+ if (stopped) {
+ await drain(sessionId, chat);
+ }
+}
+
+/**
+ * Interrupts the answer arriving, and answers whether there was one.
+ *
+ * Interrupting the reading aborts the request, so the provider stops sending.
+ * It is deliberately only the interrupt: a chat being stopped goes on to ask
+ * what is waiting, and a chat being closed does not.
+ */
+async function halt(sessionId: string, chat: Chat): Promise {
+ if (chat.answering === undefined) {
+ return false;
+ }
+ const runtime = await runtimeFor(chat);
+ await runtime.runPromise(Fiber.interrupt(chat.answering));
+ chat.answering = undefined;
+ change(sessionId, { status: 'idle', answering: '' });
+ return true;
+}
+
+/**
+ * Ends a chat, whether it is being deleted or the account is going. Closing the
+ * scope is what tells the store to write down whatever it still holds.
+ */
+export async function releaseChat(sessionId: string): Promise {
+ const chat = chats.get(sessionId);
+ if (chat === undefined) {
+ return;
+ }
+ await halt(sessionId, chat);
+ /* Whatever was still waiting goes with the chat. Asking it now would open a
+ round on a session whose scope is closing under it. */
+ chat.waiting.length = 0;
+ const runtime = await runtimeFor(chat);
+ await runtime.runPromise(Scope.close(chat.scope, Exit.void));
+ chats.delete(sessionId);
+ forgetState(sessionId);
+}
+
+/** Ends every chat, which is what signing out does before the wipe. */
+export async function releaseEveryChat(): Promise {
+ for (const sessionId of chats.keys()) {
+ // eslint-disable-next-line no-await-in-loop -- one scope closes after another: the store has no lock, and two closes at once would write over each other
+ await releaseChat(sessionId);
+ }
+}
diff --git a/apps/mobile/src/lib/chat/scope.ts b/apps/mobile/src/lib/chat/scope.ts
new file mode 100644
index 0000000000..9eae7a1bd6
--- /dev/null
+++ b/apps/mobile/src/lib/chat/scope.ts
@@ -0,0 +1,14 @@
+/**
+ * Which account and organization a chat belongs to.
+ *
+ * A chat is private to the person who had it and to the organization whose
+ * credit paid for it, so every read and every write is scoped. The harness SDK
+ * holds the conversation and knows nothing about either, which is why this is
+ * the app's to keep.
+ *
+ * Personal has a name of its own rather than an empty one, so a bug that lost
+ * the organization cannot quietly read another scope's chats.
+ */
+export function chatScope(userId: string, organizationId: string | null | undefined): string {
+ return `${userId}:${organizationId ?? 'personal'}`;
+}
diff --git a/apps/mobile/src/lib/chat/sign-out.ts b/apps/mobile/src/lib/chat/sign-out.ts
new file mode 100644
index 0000000000..8e15b774f7
--- /dev/null
+++ b/apps/mobile/src/lib/chat/sign-out.ts
@@ -0,0 +1,27 @@
+import { encryptedDatabase } from '@/lib/persist/encrypted-kv';
+import { releaseEveryChat } from './registry';
+import { wipeChats } from './store';
+
+/**
+ * Takes the account's chats off the device.
+ *
+ * The running sessions end first, so nothing writes a turn into a conversation
+ * that is being deleted. Then the rows go, the account's own and no others —
+ * unless the sign-out could not name the account, which takes the lot.
+ */
+export async function clearChatsForSignOut(userId: string | null): Promise {
+ await releaseEveryChat();
+ wipeChats(await encryptedDatabase(), userId);
+}
+
+/**
+ * Ends the running chats when another account signs in without signing out.
+ *
+ * The rows stay: they are scoped to the account that made them, the way the
+ * read cache on disk is, and the next account never lists them. What must not
+ * stay is a live session belonging to the account that left — it would go on
+ * writing under whoever is signed in now.
+ */
+export async function releaseChatsForAccountSwitch(): Promise {
+ await releaseEveryChat();
+}
diff --git a/apps/mobile/src/lib/chat/state.ts b/apps/mobile/src/lib/chat/state.ts
new file mode 100644
index 0000000000..ad04572e59
--- /dev/null
+++ b/apps/mobile/src/lib/chat/state.ts
@@ -0,0 +1,119 @@
+import { type Turn } from '@kilocode/harness-sdk';
+
+/**
+ * What a chat looks like to whoever is drawing it.
+ *
+ * A screen never holds this: it reads it. The conversation runs in the
+ * registry whether or not a screen is mounted, and every change to one is
+ * published to whoever is watching.
+ */
+
+/** What a chat screen draws. */
+export type ChatState = {
+ readonly sessionId: string;
+ readonly model: string;
+ /** Every turn the store holds, oldest first. */
+ readonly turns: readonly Turn[];
+ /** The answer arriving right now, empty when none is. */
+ readonly answering: string;
+ readonly status: 'opening' | 'idle' | 'working';
+ /**
+ * A question with no answer: still being asked, or asked and nothing came
+ * back. `status` tells the two apart, and an idle chat holding one is what
+ * puts a Retry under the last thing the person said.
+ */
+ readonly asked: string | null;
+ /**
+ * Questions typed while an answer was arriving, in the order they will be
+ * asked. The composer stays open while the model works, so a person can ask
+ * twice; a session answers one question at a time, so the second waits here
+ * rather than racing the first.
+ */
+ readonly waiting: readonly string[];
+ /** Why the last question ended with no answer, for the log rather than the screen. */
+ readonly failed: string | null;
+};
+
+/**
+ * What every chat looks like, open or not.
+ *
+ * It is kept apart from the sessions the registry holds, so a screen can
+ * subscribe to a chat before it has opened and read the same object every time
+ * it asks: a snapshot built fresh on each read would tell React the screen had
+ * changed, forever.
+ */
+const states = new Map();
+
+const watchers = new Map void>>();
+
+/**
+ * Whoever draws the list of chats, rather than one of them.
+ *
+ * A chat writes its turns when the answer ends, and the title of a row is the
+ * first thing said in it — so a list drawn before that is a list with a row it
+ * cannot name yet. The screen showing the list is not the screen the answer
+ * arrived on, and may not even be mounted, so the registry says when a chat
+ * changed and the list reads the database again.
+ */
+const listWatchers = new Set<() => void>();
+
+export function watchChats(watcher: () => void): () => void {
+ listWatchers.add(watcher);
+ return () => {
+ listWatchers.delete(watcher);
+ };
+}
+
+/** A chat with nothing in it, which is what every chat starts as. */
+export const NOTHING = {
+ turns: [] as readonly Turn[],
+ answering: '',
+ asked: null,
+ waiting: [] as readonly string[],
+ failed: null,
+} satisfies Omit;
+
+function publish(sessionId: string): void {
+ for (const watcher of watchers.get(sessionId) ?? []) {
+ watcher();
+ }
+}
+
+/** Changes what a chat looks like, and tells whoever is watching. */
+export function change(sessionId: string, into: Partial): void {
+ states.set(sessionId, { ...snapshotOf(sessionId), ...into });
+ publish(sessionId);
+ // Only when a chat starts or stops working: every word of an answer is a
+ // change too, and a list that read the database once per word would read it
+ // hundreds of times for one answer.
+ if (into.status !== undefined) {
+ for (const watcher of listWatchers) {
+ watcher();
+ }
+ }
+}
+
+/** The state a screen draws, whether or not the chat has opened yet. */
+export function snapshotOf(sessionId: string): ChatState {
+ const held = states.get(sessionId);
+ if (held !== undefined) {
+ return held;
+ }
+ const fresh: ChatState = { sessionId, model: '', status: 'opening', ...NOTHING };
+ states.set(sessionId, fresh);
+ return fresh;
+}
+
+export function watch(sessionId: string, watcher: () => void): () => void {
+ const held = watchers.get(sessionId) ?? new Set<() => void>();
+ held.add(watcher);
+ watchers.set(sessionId, held);
+ return () => {
+ held.delete(watcher);
+ };
+}
+
+/** Forgets a chat, which is what closing or deleting one does. */
+export function forgetState(sessionId: string): void {
+ states.delete(sessionId);
+}
diff --git a/apps/mobile/src/lib/chat/store.test.ts b/apps/mobile/src/lib/chat/store.test.ts
new file mode 100644
index 0000000000..3e4e93afd0
--- /dev/null
+++ b/apps/mobile/src/lib/chat/store.test.ts
@@ -0,0 +1,179 @@
+import { readFileSync } from 'node:fs';
+import { DatabaseSync } from 'node:sqlite';
+
+import { SessionStore, type Turn } from '@kilocode/harness-sdk';
+import { layerNodeStore } from '@kilocode/harness-sdk/plugins/store/node';
+import { Effect } from 'effect';
+import { beforeEach, describe, expect, it } from 'vitest';
+
+import {
+ type ChatDatabase,
+ deleteChat,
+ listChats,
+ moveChat,
+ rememberChat,
+ scopeOfChat,
+ wipeChats,
+} from './store';
+
+/**
+ * The list and the delete run against the real schema of both owners: the SDK's
+ * store plugin creates its own tables, and the app's `chats` table comes from
+ * the migration the app ships. Neither is restated here, so a schema that moves
+ * breaks this suite rather than passing against a copy that no longer matches.
+ */
+
+const CHATS = readFileSync(
+ new URL('../../../drizzle/0001_safe_hellfire_club.sql', import.meta.url),
+ 'utf8'
+);
+
+const chatDatabase = (database: DatabaseSync): ChatDatabase => ({
+ getAllSync: (source: string, params: (string | number)[]) =>
+ database.prepare(source).all(...params) as T[],
+ runSync: (source: string, params: (string | number)[]) => {
+ database.prepare(source).run(...params);
+ },
+});
+
+const said = (sessionId: string, role: Turn['role'], body: string): Turn => ({
+ id: `${sessionId}-${role}`,
+ sessionId,
+ role,
+ parts: [{ id: `${sessionId}-${role}-1`, kind: 'text', body }],
+});
+
+let database = new DatabaseSync(':memory:');
+let db: ChatDatabase = chatDatabase(database);
+
+/** Writes a session and one exchange through the SDK, as the app does. */
+const conversation = (sessionId: string, model: string, question: string) =>
+ Effect.gen(function* conversing() {
+ const store = yield* SessionStore;
+ yield* store.create({ id: sessionId, system: 'be brief', model });
+ yield* store.append({
+ sessionId,
+ turns: [said(sessionId, 'user', question), said(sessionId, 'assistant', 'ok')],
+ prompted: 10,
+ });
+ yield* store.flush();
+ });
+
+const write = async (work: Effect.Effect) => {
+ await Effect.runPromise(Effect.provide(work, layerNodeStore(database)) as Effect.Effect);
+};
+
+beforeEach(async () => {
+ database = new DatabaseSync(':memory:');
+ database.exec('PRAGMA foreign_keys = ON');
+ for (const statement of CHATS.split('--> statement-breakpoint')) {
+ database.exec(statement);
+ }
+ db = chatDatabase(database);
+ // Opening the store is what creates its tables, and the list reads them even
+ // when this test writes no conversation of its own.
+ await write(Effect.void);
+});
+
+describe('listChats', () => {
+ it('lists one scope newest first, titled by the first thing the user said', async () => {
+ await write(conversation('s1', 'kilo/one', 'what is a monad'));
+ await write(conversation('s2', 'kilo/two', 'and a functor'));
+ await write(conversation('s3', 'kilo/one', 'not yours'));
+ rememberChat(db, { sessionId: 's1', scope: 'me:personal', at: 100 });
+ rememberChat(db, { sessionId: 's2', scope: 'me:personal', at: 200 });
+ rememberChat(db, { sessionId: 's3', scope: 'me:acme', at: 300 });
+
+ expect(listChats(db, 'me:personal')).toEqual([
+ { sessionId: 's2', model: 'kilo/two', title: 'and a functor', updatedAt: 200 },
+ { sessionId: 's1', model: 'kilo/one', title: 'what is a monad', updatedAt: 100 },
+ ]);
+ });
+
+ it('leaves out a chat whose session was never written', () => {
+ rememberChat(db, { sessionId: 'ghost', scope: 'me:personal', at: 100 });
+
+ expect(listChats(db, 'me:personal')).toEqual([]);
+ });
+
+ it('gives an empty title to a chat nothing was said in', async () => {
+ await write(
+ Effect.gen(function* opening() {
+ const store = yield* SessionStore;
+ yield* store.create({ id: 'fresh', system: 'be brief', model: 'kilo/one' });
+ yield* store.flush();
+ })
+ );
+ rememberChat(db, { sessionId: 'fresh', scope: 'me:personal', at: 1 });
+
+ expect(listChats(db, 'me:personal')[0]?.title).toBe('');
+ });
+});
+
+describe('moveChat', () => {
+ it('keeps one row when a chat moves onto another model', async () => {
+ await write(conversation('old', 'kilo/one', 'hello'));
+ await write(conversation('new', 'kilo/two', 'hello'));
+ rememberChat(db, { sessionId: 'old', scope: 'me:personal', at: 100 });
+
+ moveChat(db, { from: 'old', to: 'new', at: 400 });
+
+ expect(listChats(db, 'me:personal')).toEqual([
+ { sessionId: 'new', model: 'kilo/two', title: 'hello', updatedAt: 400 },
+ ]);
+ expect(scopeOfChat(db, 'old')).toBeNull();
+ expect(scopeOfChat(db, 'new')).toBe('me:personal');
+ });
+});
+
+describe('deleteChat', () => {
+ it('removes the row and the conversation under it', async () => {
+ await write(conversation('s1', 'kilo/one', 'hello'));
+ rememberChat(db, { sessionId: 's1', scope: 'me:personal', at: 100 });
+
+ deleteChat(db, 's1');
+
+ expect(listChats(db, 'me:personal')).toEqual([]);
+ for (const table of ['sessions', 'turns', 'parts']) {
+ expect(database.prepare(`select count(*) as n from ${table}`).get()).toEqual({ n: 0 });
+ }
+ });
+});
+
+describe('wipeChats', () => {
+ it('clears one scope and leaves the other alone', async () => {
+ await write(conversation('mine', 'kilo/one', 'hello'));
+ await write(conversation('theirs', 'kilo/one', 'hello'));
+ rememberChat(db, { sessionId: 'mine', scope: 'me:personal', at: 100 });
+ rememberChat(db, { sessionId: 'theirs', scope: 'you:personal', at: 100 });
+
+ wipeChats(db, 'me');
+
+ expect(listChats(db, 'me:personal')).toEqual([]);
+ expect(listChats(db, 'you:personal')).toHaveLength(1);
+ expect(database.prepare('select count(*) as n from sessions').get()).toEqual({ n: 1 });
+ });
+
+ it('takes every account when the account is unknown', async () => {
+ await write(conversation('mine', 'kilo/one', 'hello'));
+ await write(conversation('theirs', 'kilo/one', 'hello'));
+ rememberChat(db, { sessionId: 'mine', scope: 'me:acme', at: 100 });
+ rememberChat(db, { sessionId: 'theirs', scope: 'you:personal', at: 100 });
+
+ wipeChats(db, null);
+
+ expect(database.prepare('select count(*) as n from chats').get()).toEqual({ n: 0 });
+ expect(database.prepare('select count(*) as n from sessions').get()).toEqual({ n: 0 });
+ });
+
+ it('keeps another account whose identifier starts the same way', async () => {
+ await write(conversation('mine', 'kilo/one', 'hello'));
+ await write(conversation('theirs', 'kilo/one', 'hello'));
+ rememberChat(db, { sessionId: 'mine', scope: 'me:personal', at: 100 });
+ rememberChat(db, { sessionId: 'theirs', scope: 'mendel:personal', at: 100 });
+
+ wipeChats(db, 'me');
+
+ expect(listChats(db, 'mendel:personal')).toHaveLength(1);
+ });
+});
diff --git a/apps/mobile/src/lib/chat/store.ts b/apps/mobile/src/lib/chat/store.ts
new file mode 100644
index 0000000000..cd6b9d6cdf
--- /dev/null
+++ b/apps/mobile/src/lib/chat/store.ts
@@ -0,0 +1,171 @@
+/**
+ * Everything about *many* chats: which ones there are, what to call them, what
+ * order they come in, and how one is thrown away.
+ *
+ * None of it belongs to the harness SDK. Its store saves one conversation and
+ * reads it back, and that is the whole of its job — a list, a title and a
+ * delete are the app's, because only the app knows who is signed in, which
+ * organization is paying, and what a person expects a screen to show.
+ *
+ * So this file reads across two owners on the one database: the `chats` table
+ * the app owns (`src/lib/persist/schema.ts`), and the `sessions`, `turns` and
+ * `parts` tables the SDK's SQLite store plugin owns. The join is the point of
+ * the file, and it is why the SQL is here in one place and nowhere else.
+ */
+
+/** What SQLite takes as a bound value here. Chats hold text and numbers. */
+type SqlValue = string | number;
+
+/** The part of an Expo database this file uses, so a test can supply one. */
+export type ChatDatabase = {
+ readonly getAllSync: (source: string, params: SqlValue[]) => T[];
+ readonly runSync: (source: string, params: SqlValue[]) => void;
+};
+
+/** One row of the chat list. */
+export type ChatSummary = {
+ readonly sessionId: string;
+ /** The model the conversation is on now, which a switch changes. */
+ readonly model: string;
+ /** The first thing the user said, or empty for a chat with nothing in it. */
+ readonly title: string;
+ readonly updatedAt: number;
+};
+
+type SummaryRow = {
+ readonly session_id: string;
+ readonly model: string;
+ readonly title: string | null;
+ readonly updated_at: number;
+};
+
+/**
+ * The list, newest first.
+ *
+ * The title is the first thing the user said, read as a subquery rather than by
+ * loading every turn of every conversation to draw one screen. Both subqueries
+ * are answered by the store's own `(session_id, id)` indexes.
+ *
+ * A chat whose session the SDK never wrote — a create that failed half way —
+ * is left out by the join rather than drawn as a row that opens onto nothing.
+ */
+const LIST = `
+ select
+ chats.session_id,
+ sessions.model,
+ chats.updated_at,
+ (
+ select parts.body from parts
+ join turns on parts.turn_id = turns.id
+ where turns.session_id = chats.session_id
+ and turns.role = 'user' and parts.kind = 'text'
+ order by parts.id limit 1
+ ) as title
+ from chats
+ join sessions on sessions.id = chats.session_id
+ where chats.scope = ?
+ order by chats.updated_at desc
+`;
+
+export function listChats(db: ChatDatabase, scope: string): ChatSummary[] {
+ return db.getAllSync(LIST, [scope]).map(row => ({
+ sessionId: row.session_id,
+ model: row.model,
+ title: row.title ?? '',
+ updatedAt: row.updated_at,
+ }));
+}
+
+/** The scope a chat belongs to, or null when the chat is not one of ours. */
+export function scopeOfChat(db: ChatDatabase, sessionId: string): string | null {
+ const rows = db.getAllSync<{ scope: string }>('select scope from chats where session_id = ?', [
+ sessionId,
+ ]);
+ return rows[0]?.scope ?? null;
+}
+
+/** The model a session was opened on, which the SDK's store holds. */
+export function modelOfSession(db: ChatDatabase, sessionId: string): string | null {
+ const rows = db.getAllSync<{ model: string }>('select model from sessions where id = ?', [
+ sessionId,
+ ]);
+ return rows[0]?.model ?? null;
+}
+
+/** Records a chat, so the list has it. */
+export function rememberChat(
+ db: ChatDatabase,
+ chat: { readonly sessionId: string; readonly scope: string; readonly at: number }
+): void {
+ db.runSync(
+ 'insert into chats (session_id, scope, updated_at) values (?, ?, ?) ' +
+ 'on conflict (session_id) do update set updated_at = excluded.updated_at',
+ [chat.sessionId, chat.scope, chat.at]
+ );
+}
+
+/** Moves a chat to the top of the list. Called when something is said in it. */
+export function touchChat(db: ChatDatabase, sessionId: string, at: number): void {
+ db.runSync('update chats set updated_at = ? where session_id = ?', [at, sessionId]);
+}
+
+/**
+ * Moves a chat onto another session, keeping its place in the list.
+ *
+ * Switching models is what moves one: the harness copies the conversation onto
+ * a session opened on the other model, and the chat the person is looking at is
+ * now that session. The row is updated rather than added to, so one
+ * conversation stays one row.
+ */
+export function moveChat(
+ db: ChatDatabase,
+ move: { readonly from: string; readonly to: string; readonly at: number }
+): void {
+ db.runSync('update chats set session_id = ?, updated_at = ? where session_id = ?', [
+ move.to,
+ move.at,
+ move.from,
+ ]);
+}
+
+/**
+ * Forgets the conversation the SDK holds under one session.
+ *
+ * Children first: the store runs with foreign keys on, so a session deleted out
+ * from under its own turns is refused. Half a delete would leave turns nothing
+ * can reach and nothing can remove.
+ */
+export function forgetSession(db: ChatDatabase, sessionId: string): void {
+ db.runSync('delete from parts where session_id = ?', [sessionId]);
+ db.runSync('delete from turns where session_id = ?', [sessionId]);
+ db.runSync('delete from sessions where id = ?', [sessionId]);
+}
+
+/** Forgets a chat: the row that lists it, and the conversation under it. */
+export function deleteChat(db: ChatDatabase, sessionId: string): void {
+ forgetSession(db, sessionId);
+ db.runSync('delete from chats where session_id = ?', [sessionId]);
+}
+
+/**
+ * Forgets every chat of one account, which is what signing out does.
+ *
+ * A conversation is the most personal thing this app keeps on the device, so it
+ * goes when the account does rather than waiting for the next person to sign in
+ * under the same install. An account with several organizations has a scope for
+ * each, so this takes the account rather than one scope.
+ *
+ * An unknown account wipes the lot, because privacy wins over keeping someone
+ * else's chats through a sign-out that could not name them.
+ */
+export function wipeChats(db: ChatDatabase, userId: string | null): void {
+ const rows =
+ userId === null
+ ? db.getAllSync<{ session_id: string }>('select session_id from chats', [])
+ : db.getAllSync<{ session_id: string }>('select session_id from chats where scope like ?', [
+ `${userId}:%`,
+ ]);
+ for (const { session_id: sessionId } of rows) {
+ deleteChat(db, sessionId);
+ }
+}
diff --git a/apps/mobile/src/lib/chat/tools.test.ts b/apps/mobile/src/lib/chat/tools.test.ts
new file mode 100644
index 0000000000..fab5cd9cee
--- /dev/null
+++ b/apps/mobile/src/lib/chat/tools.test.ts
@@ -0,0 +1,47 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { dateTimeFormat } from '@/lib/intl-cache';
+import { CHAT_TOOL_NAMES, chatTools, deviceZone } from './tools';
+
+// A zone from the first line: the tool set is built when the module loads.
+vi.mock('@/lib/intl-cache', () => ({
+ dateTimeFormat: vi.fn(() => ({ resolvedOptions: () => ({ timeZone: 'Europe/Amsterdam' }) })),
+}));
+
+const resolvesTo = (timeZone: string) => {
+ vi.mocked(dateTimeFormat).mockReturnValue({
+ resolvedOptions: () => ({ timeZone }),
+ } as unknown as Intl.DateTimeFormat);
+};
+
+/**
+ * What a chat offers the model.
+ *
+ * One tool, and the zone it reports local time in. The zone is the part that
+ * can go wrong on a device: a runtime with no zone data must give UTC alone
+ * rather than a local time that is somebody else's.
+ */
+
+describe('the tools a chat offers', () => {
+ it('is the clock, and nothing that belongs to a working harness', () => {
+ expect(CHAT_TOOL_NAMES).toEqual(['time']);
+ });
+
+ it('answers with the tool itself, ready to run', () => {
+ const [tool] = chatTools();
+ expect(tool?.definition.name).toBe('time');
+ expect(tool?.run).toBeTypeOf('function');
+ });
+});
+
+describe('the zone local time is reported in', () => {
+ it('is the one the device is set to', () => {
+ resolvesTo('Europe/Amsterdam');
+ expect(deviceZone()).toBe('Europe/Amsterdam');
+ });
+
+ it('is none when the runtime cannot name one, so the answer stays UTC', () => {
+ resolvesTo('');
+ expect(deviceZone()).toBeUndefined();
+ });
+});
diff --git a/apps/mobile/src/lib/chat/tools.ts b/apps/mobile/src/lib/chat/tools.ts
new file mode 100644
index 0000000000..13a970e8c1
--- /dev/null
+++ b/apps/mobile/src/lib/chat/tools.ts
@@ -0,0 +1,36 @@
+import { type Tool } from '@kilocode/harness-sdk';
+import { timeTool } from '@kilocode/harness-sdk/plugins/tools';
+
+import { dateTimeFormat } from '@/lib/intl-cache';
+
+/**
+ * What a chat can do besides talk.
+ *
+ * One tool: the clock. A model does not have one — it answers "what day is it"
+ * from the date it was trained on, confidently and wrong — and a phone is where
+ * that question gets asked. The rest of the SDK's tools are for a harness
+ * driving work: asking the person something is what the composer is already
+ * for, delegating to a second session costs a second session, and a to-do list
+ * is working memory for a long run that a chat does not have.
+ */
+
+/**
+ * The zone to report local time in, or none.
+ *
+ * The tool formats through `Intl`, so a runtime that cannot name a zone gets
+ * UTC alone rather than a wrong local time. What a phone answers is the zone
+ * the person set, which is the one they mean when they ask what time it is.
+ */
+export function deviceZone(): string | undefined {
+ const zone = dateTimeFormat(undefined, {}).resolvedOptions().timeZone;
+ return zone === '' ? undefined : zone;
+}
+
+/** The tools every chat is opened with, in the order the model sees them. */
+export function chatTools(): readonly Tool[] {
+ const zone = deviceZone();
+ return [timeTool(zone === undefined ? undefined : { zone })];
+}
+
+/** The names of those tools, which is what a session is opened with. */
+export const CHAT_TOOL_NAMES: readonly string[] = chatTools().map(tool => tool.definition.name);
diff --git a/apps/mobile/src/lib/chat/turns.test.ts b/apps/mobile/src/lib/chat/turns.test.ts
new file mode 100644
index 0000000000..03a950d2c7
--- /dev/null
+++ b/apps/mobile/src/lib/chat/turns.test.ts
@@ -0,0 +1,136 @@
+import { type Turn } from '@kilocode/harness-sdk';
+import { describe, expect, it } from 'vitest';
+
+import { asMessages } from './turns';
+
+const turn = (id: string, role: Turn['role'], parts: Turn['parts']): Turn => ({
+ id,
+ sessionId: 's1',
+ role,
+ parts,
+});
+
+const text = (id: string, body: string) => ({ id, kind: 'text' as const, body });
+
+const drawn = (input: Parameters[0]) =>
+ asMessages(input).map(message => ({
+ role: message.info.role,
+ said: message.parts.map(part => (part.type === 'text' ? part.text : '')).join(''),
+ }));
+
+describe('asMessages', () => {
+ it('draws the words of each turn, oldest first', () => {
+ expect(
+ drawn({
+ sessionId: 's1',
+ model: 'kilo/one',
+ turns: [
+ turn('t1', 'user', [text('p1', 'what is a monad')]),
+ turn('t2', 'assistant', [text('p2', 'a burrito')]),
+ ],
+ answering: '',
+ asked: null,
+ waiting: [],
+ })
+ ).toEqual([
+ { role: 'user', said: 'what is a monad' },
+ { role: 'assistant', said: 'a burrito' },
+ ]);
+ });
+
+ it('leaves out thinking and tool work, and the turns that are only that', () => {
+ expect(
+ drawn({
+ sessionId: 's1',
+ model: 'kilo/one',
+ turns: [
+ turn('t1', 'assistant', [
+ { id: 'p1', kind: 'reasoning', body: 'working it out' },
+ text('p2', 'a burrito'),
+ ]),
+ turn('t2', 'assistant', [{ id: 'p3', kind: 'reasoning', body: 'more working' }]),
+ ],
+ answering: '',
+ asked: null,
+ waiting: [],
+ })
+ ).toEqual([{ role: 'assistant', said: 'a burrito' }]);
+ });
+
+ it('puts the unanswered question last, ahead of the answer arriving now', () => {
+ expect(
+ drawn({
+ sessionId: 's1',
+ model: 'kilo/one',
+ turns: [turn('t1', 'user', [text('p1', 'first')])],
+ answering: 'well',
+ asked: 'second',
+ waiting: [],
+ })
+ ).toEqual([
+ { role: 'user', said: 'first' },
+ { role: 'user', said: 'second' },
+ { role: 'assistant', said: 'well' },
+ ]);
+ });
+
+ it('gives every message its own identifier, so a list can key on it', () => {
+ const messages = asMessages({
+ sessionId: 's1',
+ model: 'kilo/one',
+ turns: [turn('t1', 'user', [text('p1', 'first')])],
+ answering: 'well',
+ asked: 'second',
+ waiting: [],
+ });
+
+ expect(new Set(messages.map(message => message.info.id)).size).toBe(messages.length);
+ });
+
+ it('shows the question while its answer is still arriving', () => {
+ expect(
+ drawn({
+ sessionId: 's1',
+ model: 'kilo/one',
+ turns: [],
+ answering: 'a bur',
+ asked: 'what is a monad',
+ waiting: [],
+ })
+ ).toEqual([
+ { role: 'user', said: 'what is a monad' },
+ { role: 'assistant', said: 'a bur' },
+ ]);
+ });
+
+ it('draws what was typed while the answer arrived, in the order it will be asked', () => {
+ expect(
+ drawn({
+ sessionId: 's1',
+ model: 'kilo/one',
+ turns: [],
+ answering: 'a bur',
+ asked: 'what is a monad',
+ waiting: ['and a functor', 'and a natural transformation'],
+ })
+ ).toEqual([
+ { role: 'user', said: 'what is a monad' },
+ { role: 'assistant', said: 'a bur' },
+ { role: 'user', said: 'and a functor' },
+ { role: 'user', said: 'and a natural transformation' },
+ ]);
+ });
+
+ it('names the model the conversation is on', () => {
+ const [message] = asMessages({
+ sessionId: 's1',
+ model: 'kilo/two',
+ turns: [turn('t1', 'assistant', [text('p1', 'a burrito')])],
+ answering: '',
+ asked: null,
+ waiting: [],
+ });
+
+ expect(message?.info).toMatchObject({ modelID: 'kilo/two', providerID: 'kilo' });
+ });
+});
diff --git a/apps/mobile/src/lib/chat/turns.ts b/apps/mobile/src/lib/chat/turns.ts
new file mode 100644
index 0000000000..d3cfd307db
--- /dev/null
+++ b/apps/mobile/src/lib/chat/turns.ts
@@ -0,0 +1,127 @@
+import { type MessageInfo, type StoredMessage } from '@kilocode/cloud-agent-sdk';
+import { type Turn } from '@kilocode/harness-sdk';
+
+/**
+ * A harness turn, as the bubble that draws an agent message.
+ *
+ * `MessageBubble` renders the cloud agent's shape, and every screen in this app
+ * that shows a conversation goes through it. A chat is a conversation, so it
+ * goes through it too rather than growing a second bubble that drifts from the
+ * first.
+ *
+ * The fields a chat has no answer for are filled with neutral values: there is
+ * no path, no cost and no token accounting on the device, and inventing numbers
+ * for them would put wrong ones on the screen.
+ */
+
+const infoFor = (turn: Turn, model: string): MessageInfo =>
+ turn.role === 'user'
+ ? {
+ id: turn.id,
+ sessionID: turn.sessionId,
+ role: 'user',
+ time: { created: 0 },
+ agent: 'chat',
+ model: { providerID: 'kilo', modelID: model },
+ }
+ : {
+ id: turn.id,
+ sessionID: turn.sessionId,
+ role: 'assistant',
+ time: { created: 0 },
+ parentID: '',
+ modelID: model,
+ providerID: 'kilo',
+ mode: 'ask',
+ agent: 'chat',
+ path: { cwd: '', root: '' },
+ cost: 0,
+ tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
+ };
+
+/**
+ * What of a turn a reader sees.
+ *
+ * The words, and only the words. A chat offers no tools, so a tool part can
+ * only come from a conversation that was moved here from elsewhere; thinking is
+ * the model's own working and is not what was said. Both would draw as empty
+ * bubbles, so neither becomes one.
+ */
+const said = (turn: Turn) => turn.parts.filter(part => part.kind === 'text');
+
+function asMessage(turn: Turn, model: string): StoredMessage {
+ return {
+ info: infoFor(turn, model),
+ parts: said(turn).map(part => ({
+ id: part.id,
+ sessionID: turn.sessionId,
+ messageID: turn.id,
+ type: 'text' as const,
+ text: part.body,
+ })),
+ };
+}
+
+/**
+ * The whole transcript, plus what is not in the store yet: the question being
+ * answered right now, the answer as it arrives, and anything typed while that
+ * was happening.
+ *
+ * The pending question is drawn from what the app remembers rather than from the
+ * store, because the store holds a question and its answer together or neither.
+ * It is what the Retry hangs off, and it is on screen from the moment it is
+ * asked rather than when its answer lands.
+ */
+export function asMessages(input: {
+ readonly sessionId: string;
+ readonly model: string;
+ readonly turns: readonly Turn[];
+ readonly answering: string;
+ readonly asked: string | null;
+ /** Questions typed while an answer was arriving, in the order they go. */
+ readonly waiting: readonly string[];
+}): StoredMessage[] {
+ const drawn = input.turns
+ .filter(turn => said(turn).length > 0)
+ .map(turn => asMessage(turn, input.model));
+ if (input.asked !== null) {
+ drawn.push(
+ asMessage(
+ {
+ id: `${input.sessionId}:asked`,
+ sessionId: input.sessionId,
+ role: 'user',
+ parts: [{ id: `${input.sessionId}:asked:text`, kind: 'text', body: input.asked }],
+ },
+ input.model
+ )
+ );
+ }
+ if (input.answering !== '') {
+ drawn.push(
+ asMessage(
+ {
+ id: `${input.sessionId}:answering`,
+ sessionId: input.sessionId,
+ role: 'assistant',
+ parts: [{ id: `${input.sessionId}:answering:text`, kind: 'text', body: input.answering }],
+ },
+ input.model
+ )
+ );
+ }
+ for (const [index, question] of input.waiting.entries()) {
+ drawn.push(
+ asMessage(
+ {
+ id: `${input.sessionId}:waiting:${index}`,
+ sessionId: input.sessionId,
+ role: 'user',
+ parts: [{ id: `${input.sessionId}:waiting:${index}:text`, kind: 'text', body: question }],
+ },
+ input.model
+ )
+ );
+ }
+ return drawn;
+}
diff --git a/apps/mobile/src/lib/chat/use-chat.ts b/apps/mobile/src/lib/chat/use-chat.ts
new file mode 100644
index 0000000000..9b57df7fe1
--- /dev/null
+++ b/apps/mobile/src/lib/chat/use-chat.ts
@@ -0,0 +1,167 @@
+import { useQuery, useQueryClient } from '@tanstack/react-query';
+import { useCallback, useEffect, useState, useSyncExternalStore } from 'react';
+
+import { encryptedDatabase } from '@/lib/persist/encrypted-kv';
+import { chatScope } from './scope';
+import {
+ type ChatPlace,
+ enterChat,
+ prepareChats,
+ releaseChat,
+ retryChat,
+ say,
+ startChat,
+ stopChat,
+} from './registry';
+import { type ChatState, snapshotOf, watch, watchChats } from './state';
+import { type ChatSummary, deleteChat, listChats } from './store';
+
+/**
+ * The chat surface, as React sees it.
+ *
+ * The list is a query, because it is read from the database and refetched when
+ * something changes it. One conversation is not: it is running in the registry
+ * whether or not a screen is mounted, so a screen subscribes to it and draws
+ * whatever it says.
+ */
+
+export function chatPlaceOf(
+ userId: string | null | undefined,
+ organizationId: string | null | undefined
+): ChatPlace | null {
+ if (userId === null || userId === undefined || userId === '') {
+ return null;
+ }
+ return {
+ chatScope: chatScope(userId, organizationId),
+ org:
+ organizationId === null || organizationId === undefined || organizationId === ''
+ ? { kind: 'personal' }
+ : { kind: 'organization', id: organizationId },
+ };
+}
+
+const listKey = (scope: string) => ['chats', scope] as const;
+
+/** The chat list, as a screen reads it. */
+export type ChatList = {
+ readonly chats: readonly ChatSummary[];
+ readonly isLoading: boolean;
+ readonly isError: boolean;
+ readonly refetch: () => void;
+ readonly remove: (sessionId: string) => Promise;
+};
+
+export function useChatList(place: ChatPlace | null): ChatList {
+ const scope = place?.chatScope ?? null;
+ const client = useQueryClient();
+ const query = useQuery({
+ queryKey: listKey(scope ?? ''),
+ enabled: place !== null,
+ queryFn: async () => {
+ if (place === null) {
+ return [];
+ }
+ await prepareChats(place);
+ return listChats(await encryptedDatabase(), place.chatScope);
+ },
+ });
+ // A chat writes its turns when its answer ends, and the title of a row is the
+ // first thing said in it. The list is read again whenever a chat starts or
+ // stops working, whichever screen that happened on.
+ useEffect(
+ () =>
+ watchChats(() => {
+ void client.invalidateQueries({ queryKey: listKey(scope ?? '') });
+ }),
+ [client, scope]
+ );
+
+ const remove = useCallback(
+ async (sessionId: string) => {
+ await releaseChat(sessionId);
+ deleteChat(await encryptedDatabase(), sessionId);
+ await client.invalidateQueries({ queryKey: listKey(scope ?? '') });
+ },
+ [client, scope]
+ );
+ return {
+ chats: query.data ?? [],
+ isLoading: query.isLoading,
+ isError: query.isError,
+ refetch: () => {
+ void query.refetch();
+ },
+ remove,
+ };
+}
+
+/**
+ * One conversation.
+ *
+ * `sessionId` is state rather than a prop straight from the route, because
+ * switching models moves the conversation onto a new session and the screen
+ * has to follow it.
+ */
+/** One conversation, as a screen reads it. */
+export type OpenChat = {
+ readonly state: ChatState;
+ readonly send: (text: string, model: string) => Promise;
+ readonly stop: () => Promise;
+ readonly retry: () => Promise;
+};
+
+export function useChat(place: ChatPlace | null, opened: string): OpenChat {
+ const [sessionId, setSessionId] = useState(opened);
+
+ useEffect(() => {
+ if (place !== null) {
+ void enterChat(place, sessionId);
+ }
+ }, [place, sessionId]);
+
+ const state = useSyncExternalStore(
+ useCallback(listener => watch(sessionId, listener), [sessionId]),
+ useCallback(() => snapshotOf(sessionId), [sessionId])
+ );
+
+ // Switching models clones the conversation onto a new session, and the screen
+ // has to follow it. It is not always this screen that asks: a question typed
+ // on another model while an answer was arriving moves the chat when it is
+ // finally asked. The state says where it went, so the screen reads that
+ // rather than every mover having to hand the identifier back.
+ const moved = state.sessionId;
+ useEffect(() => {
+ setSessionId(moved);
+ }, [moved]);
+
+ return {
+ state,
+ send: async (text, model) => {
+ await say(sessionId, text, model);
+ },
+ stop: async () => {
+ await stopChat(sessionId);
+ },
+ retry: async () => {
+ await retryChat(sessionId);
+ },
+ };
+}
+
+/**
+ * Whether a chat is answering right now.
+ *
+ * A row in the list shows the same live mark a running session does, and the
+ * answer it is waiting on may have been asked on another screen, so the row
+ * reads the registry rather than the database.
+ */
+export function useChatStatus(sessionId: string): ChatState['status'] {
+ return useSyncExternalStore(
+ useCallback(listener => watch(sessionId, listener), [sessionId]),
+ useCallback(() => snapshotOf(sessionId).status, [sessionId])
+ );
+}
+
+/** Starts a chat and answers with the session to open. */
+export { startChat as newChat };
diff --git a/apps/mobile/src/lib/persist/encrypted-kv.ts b/apps/mobile/src/lib/persist/encrypted-kv.ts
index 05083b1800..46c0300f1f 100644
--- a/apps/mobile/src/lib/persist/encrypted-kv.ts
+++ b/apps/mobile/src/lib/persist/encrypted-kv.ts
@@ -244,6 +244,19 @@ export function resetEncryptedKvOpenForTests(): void {
openPromise = null;
}
+/**
+ * The encrypted database itself, for a caller that owns tables of its own.
+ *
+ * The chat store is the one: it hands this handle to the harness SDK, which
+ * keeps the conversations in tables of its own on the same file. One file
+ * means one key, one SQLCipher probe, and one delete-and-recreate recovery
+ * rather than a second copy of all three.
+ */
+export async function encryptedDatabase(): Promise {
+ const db = await openDatabase();
+ return db.$client;
+}
+
/** Reads one value; returns null when the key is absent. */
export async function getItem(scope: string, k: string): Promise {
validateItemKey(scope, k);
diff --git a/apps/mobile/src/lib/persist/schema.ts b/apps/mobile/src/lib/persist/schema.ts
index 7efcbbafde..843afc1943 100644
--- a/apps/mobile/src/lib/persist/schema.ts
+++ b/apps/mobile/src/lib/persist/schema.ts
@@ -1,4 +1,4 @@
-import { integer, primaryKey, sqliteTable, text } from 'drizzle-orm/sqlite-core';
+import { index, integer, primaryKey, sqliteTable, text } from 'drizzle-orm/sqlite-core';
/**
* The encrypted key-value table (DEC-01). Drizzle owns this schema: the
@@ -15,3 +15,24 @@ export const kv = sqliteTable(
},
table => [primaryKey({ columns: [table.scope, table.k] })]
);
+
+/**
+ * One row per chat, which is what the chat list is drawn from.
+ *
+ * The conversation itself is not here: the harness SDK keeps the turns in its
+ * own tables on this same database, and it knows nothing about who is signed in
+ * or which organization they are in. So the app keeps what the SDK has no
+ * business holding — the scope a chat belongs to, and when it last moved, which
+ * is the order a list of conversations is read in.
+ */
+export const chats = sqliteTable(
+ 'chats',
+ {
+ /** The harness session this chat is, at the moment. A model switch moves it. */
+ sessionId: text('session_id').primaryKey(),
+ /** The account and organization it belongs to. See `chatScope`. */
+ scope: text('scope').notNull(),
+ updatedAt: integer('updated_at').notNull(),
+ },
+ table => [index('chats_scope_updated_at').on(table.scope, table.updatedAt)]
+);
diff --git a/apps/mobile/src/lib/tab-bar-layout.test.ts b/apps/mobile/src/lib/tab-bar-layout.test.ts
index 590f4bf107..dd64707df1 100644
--- a/apps/mobile/src/lib/tab-bar-layout.test.ts
+++ b/apps/mobile/src/lib/tab-bar-layout.test.ts
@@ -123,14 +123,26 @@ describe('shouldShowTabLabel', () => {
describe('shouldHideTabBar', () => {
it('hides tabs for full-screen nested routes', () => {
- expect(shouldHideTabBar('/chat/sandbox-1/instance-picker')).toBe(true);
- expect(shouldHideTabBar('/security-agent/personal/filter')).toBe(true);
- expect(shouldHideTabBar('/security-agent/org-1/filter')).toBe(true);
+ expect(shouldHideTabBar('/chat/sandbox-1/instance-picker', [])).toBe(true);
+ expect(shouldHideTabBar('/security-agent/personal/filter', [])).toBe(true);
+ expect(shouldHideTabBar('/security-agent/org-1/filter', [])).toBe(true);
});
it('keeps tabs on normal tab screens', () => {
- expect(shouldHideTabBar('/security-agent/personal')).toBe(false);
- expect(shouldHideTabBar('/security-agent/personal/findings')).toBe(false);
+ expect(shouldHideTabBar('/security-agent/personal', [])).toBe(false);
+ expect(shouldHideTabBar('/security-agent/personal/findings', [])).toBe(false);
+ });
+
+ it('hides tabs inside a chat, whose composer sits where the bar would be', () => {
+ expect(shouldHideTabBar('/abc123', ['(app)', '(tabs)', '(4_chat)', '[id]'])).toBe(true);
+ });
+
+ it('keeps tabs on the chat list', () => {
+ expect(shouldHideTabBar('/', ['(app)', '(tabs)', '(4_chat)', 'index'])).toBe(false);
+ });
+
+ it('keeps tabs on a one-segment route outside the chat tab', () => {
+ expect(shouldHideTabBar('/abc123', ['(app)', '(tabs)', '(2_agents)', '[id]'])).toBe(false);
});
});
@@ -163,10 +175,10 @@ describe('visibleTabCount', () => {
});
describe('tabBarPosition', () => {
- const noFlags = { showKiloClaw: false, showQuickChat: false };
- const kiloclawOnly = { showKiloClaw: true, showQuickChat: false };
- const chatOnly = { showKiloClaw: false, showQuickChat: true };
- const both = { showKiloClaw: true, showQuickChat: true };
+ const noFlags = { showKiloClaw: false, showChat: false };
+ const kiloclawOnly = { showKiloClaw: true, showChat: false };
+ const chatOnly = { showKiloClaw: false, showChat: true };
+ const both = { showKiloClaw: true, showChat: true };
it('positions Home at 1 in every combination', () => {
expect(tabBarPosition('home', noFlags)).toBe(1);
diff --git a/apps/mobile/src/lib/tab-bar-layout.ts b/apps/mobile/src/lib/tab-bar-layout.ts
index d2af69c130..b59356a190 100644
--- a/apps/mobile/src/lib/tab-bar-layout.ts
+++ b/apps/mobile/src/lib/tab-bar-layout.ts
@@ -79,12 +79,23 @@ export function shouldShowTabLabel(fontScale = 1): boolean {
return fontScale < TAB_ICON_FORWARD_FONT_SCALE;
}
-export function shouldHideTabBar(pathname: string): boolean {
+/**
+ * The route group of the Chat tab, and the one screen in it that is not the
+ * list. A conversation puts its composer where the tab bar sits, so the bar
+ * goes while one is open. The group is read from the segments rather than the
+ * path, because a conversation's path is the session id and nothing else.
+ */
+const CHAT_TAB_GROUP = '(4_chat)';
+const CHAT_CONVERSATION = '[id]';
+
+export function shouldHideTabBar(pathname: string, segments: readonly string[]): boolean {
const parts = pathname.split('/').filter(Boolean);
const isKiloClawInstancePicker = parts[0] === 'chat' && parts.length === 3;
const isSecurityFindingFilter =
parts[0] === 'security-agent' && parts.length === 3 && parts[2] === 'filter';
- return isKiloClawInstancePicker || isSecurityFindingFilter;
+ const isChatConversation =
+ segments.includes(CHAT_TAB_GROUP) && segments.at(-1) === CHAT_CONVERSATION;
+ return isKiloClawInstancePicker || isSecurityFindingFilter || isChatConversation;
}
/** One tab bar entry, in render order. */
@@ -93,15 +104,15 @@ export type TabBarTab = 'home' | 'kiloclaw' | 'agents' | 'chat' | 'profile';
/** Flag state that changes which tabs render. */
export type TabBarTabFlags = {
showKiloClaw: boolean;
- showQuickChat: boolean;
+ showChat: boolean;
};
/**
* Number of rendered tabs. Base three (Home, Agents, Profile) plus the two
* flagged tabs when shown.
*/
-export function visibleTabCount(showKiloClaw: boolean, showQuickChat: boolean): number {
- return 3 + Number(showKiloClaw) + Number(showQuickChat);
+export function visibleTabCount(showKiloClaw: boolean, showChat: boolean): number {
+ return 3 + Number(showKiloClaw) + Number(showChat);
}
/**
@@ -121,10 +132,10 @@ export function tabBarPosition(tab: TabBarTab, flags: TabBarTabFlags): number |
return 2 + Number(flags.showKiloClaw);
}
case 'chat': {
- return flags.showQuickChat ? 3 + Number(flags.showKiloClaw) : null;
+ return flags.showChat ? 3 + Number(flags.showKiloClaw) : null;
}
case 'profile': {
- return visibleTabCount(flags.showKiloClaw, flags.showQuickChat);
+ return visibleTabCount(flags.showKiloClaw, flags.showChat);
}
default: {
// `TabBarTab` is a closed union; this branch is unreachable but keeps
diff --git a/apps/mobile/vitest.pure.config.ts b/apps/mobile/vitest.pure.config.ts
index a5e4a4a5f4..50c669fc10 100644
--- a/apps/mobile/vitest.pure.config.ts
+++ b/apps/mobile/vitest.pure.config.ts
@@ -24,6 +24,7 @@ export default defineProject({
'src/lib/agent-attachments/**/*.test.ts',
'src/lib/analytics/**/*.test.ts',
'src/lib/auth/**/*.test.ts',
+ 'src/lib/chat/**/*.test.ts',
'src/lib/auth/**/*.test.tsx',
'src/lib/apple-iap/**/*.test.ts',
'src/lib/apple-iap/**/*.test.tsx',
diff --git a/apps/web/src/lib/feature-detection.test.ts b/apps/web/src/lib/feature-detection.test.ts
index 03d41e77a0..9085be12cd 100644
--- a/apps/web/src/lib/feature-detection.test.ts
+++ b/apps/web/src/lib/feature-detection.test.ts
@@ -29,6 +29,7 @@ describe('validateFeatureHeader', () => {
'linear',
'scheduled',
'quick-chat',
+ 'mobile-chat',
])('accepts emitted feature %s', feature => {
expect(validateFeatureHeader(feature)).toBe(feature);
});
diff --git a/apps/web/src/lib/feature-detection.ts b/apps/web/src/lib/feature-detection.ts
index 3508461b45..2d8436da49 100644
--- a/apps/web/src/lib/feature-detection.ts
+++ b/apps/web/src/lib/feature-detection.ts
@@ -40,6 +40,7 @@ export const FEATURE_VALUES = [
'openclaw',
'direct-gateway',
'quick-chat',
+ 'mobile-chat',
'embeddings',
'kiloclaw-embedding',
'openclaw-embedding',
diff --git a/apps/web/src/lib/user/index.test.ts b/apps/web/src/lib/user/index.test.ts
index 29e7450930..8ff5c3c116 100644
--- a/apps/web/src/lib/user/index.test.ts
+++ b/apps/web/src/lib/user/index.test.ts
@@ -127,8 +127,6 @@ import {
user_moderation_blocks,
user_moderation_mutes,
user_terms_acceptances,
- quick_chat_threads,
- quick_chat_messages,
user_deletion_requests,
user_deletion_steps,
cloud_agent_pending_uploads,
@@ -309,8 +307,6 @@ describe('User', () => {
await db.delete(platform_oauth_credentials);
await db.delete(platform_access_token_credentials);
await db.delete(platform_integrations);
- await db.delete(quick_chat_messages);
- await db.delete(quick_chat_threads);
await db.delete(organizations);
await db.delete(kilocode_users);
});
@@ -1718,55 +1714,6 @@ describe('User', () => {
).toHaveLength(1);
});
- it('deletes quick chat threads and messages for the user and leaves other users intact', async () => {
- const user = await insertTestUser({ google_user_email: 'quick-chat-user@example.com' });
- const otherUser = await insertTestUser();
-
- const [thread] = await db
- .insert(quick_chat_threads)
- .values({ user_id: user.id, organization_id: null })
- .returning();
- const [otherThread] = await db
- .insert(quick_chat_threads)
- .values({ user_id: otherUser.id, organization_id: null })
- .returning();
- if (!thread || !otherThread) throw new Error('Failed to seed quick chat threads');
-
- const [message] = await db
- .insert(quick_chat_messages)
- .values({ thread_id: thread.id, role: 'user', content: 'hello' })
- .returning();
- const [otherMessage] = await db
- .insert(quick_chat_messages)
- .values({ thread_id: otherThread.id, role: 'user', content: 'keep me' })
- .returning();
- if (!message || !otherMessage) throw new Error('Failed to seed quick chat messages');
-
- await softDeleteUser(user.id);
-
- expect(
- await db
- .select()
- .from(quick_chat_messages)
- .where(eq(quick_chat_messages.thread_id, thread.id))
- ).toHaveLength(0);
- expect(
- await db.select().from(quick_chat_threads).where(eq(quick_chat_threads.user_id, user.id))
- ).toHaveLength(0);
- expect(
- await db
- .select()
- .from(quick_chat_threads)
- .where(eq(quick_chat_threads.user_id, otherUser.id))
- ).toHaveLength(1);
- expect(
- await db
- .select()
- .from(quick_chat_messages)
- .where(eq(quick_chat_messages.thread_id, otherThread.id))
- ).toHaveLength(1);
- });
-
it('deletes user data export state and dependent multipart and outbox rows', async () => {
const user = await insertTestUser();
const [exportJob] = await db
diff --git a/apps/web/src/lib/user/index.ts b/apps/web/src/lib/user/index.ts
index fcc5b18882..3e38582ce1 100644
--- a/apps/web/src/lib/user/index.ts
+++ b/apps/web/src/lib/user/index.ts
@@ -118,8 +118,6 @@ import {
user_moderation_blocks,
user_moderation_mutes,
user_terms_acceptances,
- quick_chat_threads,
- quick_chat_messages,
} from '@kilocode/db/schema';
import { eq, and, inArray, isNotNull, isNull, sql, or, gte, count, ne } from 'drizzle-orm';
import { allow_fake_login, IS_DEVELOPMENT } from '@/lib/constants';
@@ -1053,7 +1051,7 @@ export async function assertUserCanBeSoftDeleted(userId: string): Promise
* device_auth_requests, auto_top_up_configs,
* user_github_app_tokens, kiloclaw_instances/inbound_email_aliases/access_codes,
* user_period_cache, kilo_pass_scheduled_changes, coding_plan_availability_intents,
- * user_notification_preferences, quick_chat_threads, quick_chat_messages)
+ * user_notification_preferences)
* - operation_ledgers (keyed by kilo_user_id)
* - analytics_event_outbox (keyed by distinct_id: the user's email or, when the
* writer's email lookup failed, the user id)
@@ -1495,22 +1493,6 @@ export async function anonymizeCloudUserData(
await tx.delete(user_moderation_mutes).where(eq(user_moderation_mutes.blocker_user_id, userId));
await tx.delete(user_terms_acceptances).where(eq(user_terms_acceptances.kilo_user_id, userId));
- // Quick chat threads and messages are user-owned, so they are hard-deleted
- // with the account. Messages go first so the thread delete below cannot race
- // a cascade that would leave them behind.
- await tx
- .delete(quick_chat_messages)
- .where(
- inArray(
- quick_chat_messages.thread_id,
- tx
- .select({ id: quick_chat_threads.id })
- .from(quick_chat_threads)
- .where(eq(quick_chat_threads.user_id, userId))
- )
- );
- await tx.delete(quick_chat_threads).where(eq(quick_chat_threads.user_id, userId));
-
// Code indexing data
await tx.delete(source_embeddings).where(eq(source_embeddings.kilo_user_id, userId));
await tx.delete(code_indexing_search).where(eq(code_indexing_search.kilo_user_id, userId));
diff --git a/apps/web/src/routers/quick-chat-router.test.ts b/apps/web/src/routers/quick-chat-router.test.ts
deleted file mode 100644
index f19108e49f..0000000000
--- a/apps/web/src/routers/quick-chat-router.test.ts
+++ /dev/null
@@ -1,189 +0,0 @@
-import { beforeEach, describe, expect, it } from '@jest/globals';
-import { cleanupDbForTest, db } from '@/lib/drizzle';
-import { createCallerFactory, createTRPCRouter } from '@/lib/trpc/init';
-import { quickChatRouter } from '@/routers/quick-chat-router';
-import { insertTestUser } from '@/tests/helpers/user.helper';
-import { createTestOrganization } from '@/tests/helpers/organization.helper';
-import { quick_chat_messages, quick_chat_threads } from '@kilocode/db/schema';
-import { eq } from 'drizzle-orm';
-
-const createCaller = createCallerFactory(createTRPCRouter({ quickChat: quickChatRouter }));
-
-describe('quickChatRouter', () => {
- beforeEach(async () => {
- await cleanupDbForTest();
- });
-
- it('is idempotent for a personal null-org thread', async () => {
- const user = await insertTestUser();
- const caller = createCaller({ user });
-
- const first = await caller.quickChat.getOrCreateThread({ organizationId: null });
- const second = await caller.quickChat.getOrCreateThread({ organizationId: null });
-
- expect(second.id).toBe(first.id);
- expect(first.organizationId).toBeNull();
-
- const threads = await db
- .select()
- .from(quick_chat_threads)
- .where(eq(quick_chat_threads.user_id, user.id));
- expect(threads).toHaveLength(1);
- });
-
- it('keeps an organization thread separate from the personal thread', async () => {
- const user = await insertTestUser();
- const organization = await createTestOrganization('Quick Chat Org', user.id, 0);
- const caller = createCaller({ user });
-
- const personal = await caller.quickChat.getOrCreateThread({ organizationId: null });
- const orgThread = await caller.quickChat.getOrCreateThread({
- organizationId: organization.id,
- });
-
- expect(orgThread.id).not.toBe(personal.id);
- expect(orgThread.organizationId).toBe(organization.id);
-
- const threads = await db
- .select()
- .from(quick_chat_threads)
- .where(eq(quick_chat_threads.user_id, user.id));
- expect(threads).toHaveLength(2);
- });
-
- it('returns an empty list when the user has no thread', async () => {
- const user = await insertTestUser();
- const caller = createCaller({ user });
-
- const result = await caller.quickChat.listMessages({ organizationId: null });
-
- expect(result).toEqual({ messages: [], nextCursor: null });
- });
-
- it('returns appended messages from list', async () => {
- const user = await insertTestUser();
- const caller = createCaller({ user });
-
- await caller.quickChat.appendMessages({
- organizationId: null,
- messages: [
- { role: 'user', content: 'hello' },
- { role: 'assistant', content: 'hi', clientId: 'client-1' },
- ],
- });
-
- const result = await caller.quickChat.listMessages({ organizationId: null });
- expect(result.messages).toHaveLength(2);
- expect(result.messages.map(message => message.content)).toEqual(['hello', 'hi']);
- const roles: ('user' | 'assistant')[] = result.messages.map(message => message.role);
- expect(roles).toEqual(['user', 'assistant']);
- expect(result.messages[1]?.clientId).toBe('client-1');
- });
-
- it('rejects an invalid stored message role', async () => {
- const user = await insertTestUser();
- const caller = createCaller({ user });
- const thread = await caller.quickChat.getOrCreateThread({ organizationId: null });
- await db.insert(quick_chat_messages).values({
- thread_id: thread.id,
- role: 'tool',
- content: 'Invalid role',
- });
-
- await expect(caller.quickChat.listMessages({ organizationId: null })).rejects.toThrow();
- });
-
- it('pages older messages through nextCursor', async () => {
- const user = await insertTestUser();
- const caller = createCaller({ user });
-
- const thread = await caller.quickChat.getOrCreateThread({ organizationId: null });
- const base = Date.parse('2026-01-01T00:00:00.000Z');
- const times = Array.from({ length: 5 }, (_, i) => new Date(base + i * 1000).toISOString());
- for (let i = 0; i < times.length; i++) {
- await db.insert(quick_chat_messages).values({
- thread_id: thread.id,
- role: 'user',
- content: `msg-${i}`,
- created_at: times[i],
- });
- }
-
- const page1 = await caller.quickChat.listMessages({ organizationId: null, limit: 2 });
- expect(page1.messages.map(message => message.content)).toEqual(['msg-3', 'msg-4']);
- expect(page1.nextCursor).not.toBeNull();
- expect(page1.nextCursor).not.toBe(times[3]);
-
- const page2 = await caller.quickChat.listMessages({
- organizationId: null,
- limit: 2,
- cursor: page1.nextCursor!,
- });
- expect(page2.messages.map(message => message.content)).toEqual(['msg-1', 'msg-2']);
- expect(page2.nextCursor).not.toBeNull();
-
- const page3 = await caller.quickChat.listMessages({
- organizationId: null,
- limit: 2,
- cursor: page2.nextCursor!,
- });
- expect(page3.messages.map(message => message.content)).toEqual(['msg-0']);
- expect(page3.nextCursor).toBeNull();
- });
-
- it('pages two messages that share a created_at without skipping one', async () => {
- const user = await insertTestUser();
- const caller = createCaller({ user });
-
- const thread = await caller.quickChat.getOrCreateThread({ organizationId: null });
- const sharedTime = '2026-02-02T00:00:00.000Z';
- const ids = ['11111111-1111-4111-8111-111111111111', '22222222-2222-4222-8222-222222222222'];
- for (let i = 0; i < ids.length; i++) {
- await db.insert(quick_chat_messages).values({
- id: ids[i],
- thread_id: thread.id,
- role: 'user',
- content: `msg-${i}`,
- created_at: sharedTime,
- });
- }
-
- const page1 = await caller.quickChat.listMessages({ organizationId: null, limit: 1 });
- expect(page1.messages).toHaveLength(1);
- expect(page1.nextCursor).not.toBeNull();
-
- const page2 = await caller.quickChat.listMessages({
- organizationId: null,
- limit: 1,
- cursor: page1.nextCursor!,
- });
- expect(page2.messages).toHaveLength(1);
- expect(page2.nextCursor).toBeNull();
-
- const contents = [page1.messages[0]!.content, page2.messages[0]!.content].sort();
- expect(contents).toEqual(['msg-0', 'msg-1']);
- });
-
- it('does not let a second user read the first user thread', async () => {
- const user = await insertTestUser();
- const otherUser = await insertTestUser();
- const caller = createCaller({ user });
- const otherCaller = createCaller({ user: otherUser });
-
- await caller.quickChat.getOrCreateThread({ organizationId: null });
- await caller.quickChat.appendMessages({
- organizationId: null,
- messages: [{ role: 'user', content: 'secret' }],
- });
-
- const result = await otherCaller.quickChat.listMessages({ organizationId: null });
- expect(result.messages).toHaveLength(0);
-
- const otherThread = await otherCaller.quickChat.getOrCreateThread({ organizationId: null });
- const [firstThread] = await db
- .select()
- .from(quick_chat_threads)
- .where(eq(quick_chat_threads.user_id, user.id));
- expect(otherThread.id).not.toBe(firstThread.id);
- });
-});
diff --git a/apps/web/src/routers/quick-chat-router.ts b/apps/web/src/routers/quick-chat-router.ts
deleted file mode 100644
index d72e59cdb9..0000000000
--- a/apps/web/src/routers/quick-chat-router.ts
+++ /dev/null
@@ -1,215 +0,0 @@
-import 'server-only';
-
-import { TRPCError } from '@trpc/server';
-import { and, desc, eq, isNull, lt, or, type SQL } from 'drizzle-orm';
-import * as z from 'zod';
-import { db } from '@/lib/drizzle';
-import { baseProcedure, createTRPCRouter, type TRPCContext } from '@/lib/trpc/init';
-import { ensureOrganizationAccess } from '@/routers/organizations/utils';
-import {
- quick_chat_messages,
- quick_chat_threads,
- type QuickChatMessage,
- type QuickChatThread,
-} from '@kilocode/db/schema';
-
-const threadScopeInput = z.object({
- organizationId: z.uuid().nullable(),
-});
-
-const messageInput = z.object({
- role: z.enum(['user', 'assistant']),
- content: z.string().min(1),
- clientId: z.string().min(1).optional(),
-});
-
-const listMessagesInput = threadScopeInput.extend({
- cursor: z.string().min(1).optional(),
- limit: z.number().min(1).max(50).default(50),
-});
-
-const appendMessagesInput = threadScopeInput.extend({
- messages: z.array(messageInput).min(1),
-});
-
-function serializeThread(thread: QuickChatThread) {
- return {
- id: thread.id,
- organizationId: thread.organization_id,
- createdAt: new Date(thread.created_at).toISOString(),
- };
-}
-
-function serializeMessage(message: QuickChatMessage) {
- return {
- id: message.id,
- role: messageInput.shape.role.parse(message.role),
- content: message.content,
- clientId: message.client_id,
- createdAt: new Date(message.created_at).toISOString(),
- };
-}
-
-const messagesCursorSchema = z.object({
- createdAt: z.string().datetime(),
- id: z.string().uuid(),
-});
-
-/**
- * Encodes the last row of a page as an opaque keyset cursor. The `created_at`
- * value is normalized to UTC ISO so the cursor round-trips deterministically
- * through the client even though the stored column can be PostgreSQL-shaped
- * (e.g. `2026-04-29 01:16:12.945+00`).
- */
-function encodeMessagesCursor(row: { created_at: string; id: string }): string {
- return Buffer.from(
- JSON.stringify({ createdAt: new Date(row.created_at).toISOString(), id: row.id }),
- 'utf8'
- ).toString('base64url');
-}
-
-function decodeMessagesCursor(cursor: string): z.infer {
- try {
- return messagesCursorSchema.parse(
- JSON.parse(Buffer.from(cursor, 'base64url').toString('utf8'))
- );
- } catch {
- throw new TRPCError({ code: 'BAD_REQUEST', message: 'Invalid message cursor' });
- }
-}
-
-function isUniqueViolation(error: unknown): boolean {
- const pgCodeFrom = (e: unknown): string | undefined =>
- e && typeof e === 'object' && 'code' in e
- ? ((e as { code?: unknown }).code as string | undefined)
- : undefined;
- if (pgCodeFrom(error) === '23505') return true;
- const cause =
- error && typeof error === 'object' && 'cause' in error
- ? (error as { cause?: unknown }).cause
- : undefined;
- if (pgCodeFrom(cause) === '23505') return true;
- return false;
-}
-
-/**
- * Authorises an organization scope (when present) and returns the scope filter
- * for `quick_chat_threads`. A null scope is the caller's personal thread and
- * needs no membership check.
- */
-async function resolveThreadScope(ctx: TRPCContext, organizationId: string | null): Promise {
- if (organizationId !== null) {
- await ensureOrganizationAccess(ctx, organizationId);
- }
- return organizationId === null
- ? isNull(quick_chat_threads.organization_id)
- : eq(quick_chat_threads.organization_id, organizationId);
-}
-
-async function getOrCreateThread(
- ctx: TRPCContext,
- organizationId: string | null
-): Promise {
- const where = and(
- eq(quick_chat_threads.user_id, ctx.user.id),
- await resolveThreadScope(ctx, organizationId)
- );
-
- const [existing] = await db.select().from(quick_chat_threads).where(where).limit(1);
- if (existing) return existing;
-
- try {
- const [created] = await db
- .insert(quick_chat_threads)
- .values({ user_id: ctx.user.id, organization_id: organizationId })
- .returning();
- if (!created) {
- throw new TRPCError({
- code: 'INTERNAL_SERVER_ERROR',
- message: 'Failed to create quick chat thread',
- });
- }
- return created;
- } catch (error) {
- // A concurrent request created the same thread first; resolve it rather
- // than surfacing the unique-constraint violation.
- if (isUniqueViolation(error)) {
- const [raced] = await db.select().from(quick_chat_threads).where(where).limit(1);
- if (raced) return raced;
- }
- throw error;
- }
-}
-
-export const quickChatRouter = createTRPCRouter({
- getOrCreateThread: baseProcedure.input(threadScopeInput).mutation(async ({ ctx, input }) => {
- const thread = await getOrCreateThread(ctx, input.organizationId);
- return serializeThread(thread);
- }),
-
- listMessages: baseProcedure.input(listMessagesInput).query(async ({ ctx, input }) => {
- const cursor = input.cursor ? decodeMessagesCursor(input.cursor) : null;
- const where = and(
- eq(quick_chat_threads.user_id, ctx.user.id),
- await resolveThreadScope(ctx, input.organizationId)
- );
- const [thread] = await db
- .select({ id: quick_chat_threads.id })
- .from(quick_chat_threads)
- .where(where)
- .limit(1);
- if (!thread) return { messages: [], nextCursor: null };
-
- const pageFilters = [
- eq(quick_chat_messages.thread_id, thread.id),
- ...(cursor
- ? [
- or(
- lt(quick_chat_messages.created_at, cursor.createdAt),
- and(
- eq(quick_chat_messages.created_at, cursor.createdAt),
- lt(quick_chat_messages.id, cursor.id)
- )
- ),
- ]
- : []),
- ];
- const rows = await db
- .select()
- .from(quick_chat_messages)
- .where(and(...pageFilters))
- .orderBy(desc(quick_chat_messages.created_at), desc(quick_chat_messages.id))
- .limit(input.limit + 1);
-
- const hasMore = rows.length > input.limit;
- const page = rows.slice(0, input.limit);
- const nextCursor = hasMore ? encodeMessagesCursor(page[page.length - 1]) : null;
-
- return {
- messages: page.reverse().map(serializeMessage),
- nextCursor,
- };
- }),
-
- appendMessages: baseProcedure.input(appendMessagesInput).mutation(async ({ ctx, input }) => {
- const thread = await getOrCreateThread(ctx, input.organizationId);
- // A single INSERT assigns every row the same `now()`, so `listMessages`
- // would tie-break on the random `id` and return this batch in random order.
- // Give each row a strictly-increasing `created_at` so the append order is
- // deterministic.
- const base = Date.now();
- const inserted = await db
- .insert(quick_chat_messages)
- .values(
- input.messages.map((message, i) => ({
- thread_id: thread.id,
- role: message.role,
- content: message.content,
- client_id: message.clientId ?? null,
- created_at: new Date(base + i).toISOString(),
- }))
- )
- .returning();
- return inserted.map(serializeMessage);
- }),
-});
diff --git a/apps/web/src/routers/root-router.ts b/apps/web/src/routers/root-router.ts
index 4028e7c114..8eefce7240 100644
--- a/apps/web/src/routers/root-router.ts
+++ b/apps/web/src/routers/root-router.ts
@@ -48,7 +48,6 @@ import { modelPreferencesRouter } from '@/routers/model-preferences-router';
import { githubPrReviewRouter } from '@/routers/github-pr-review-router';
import { moderationRouter } from '@/routers/moderation-router';
import { userExportsRouter } from '@/routers/user-exports-router';
-import { quickChatRouter } from '@/routers/quick-chat-router';
export const rootRouter = createTRPCRouter({
test: testRouter,
organizations: organizationsRouter,
@@ -98,7 +97,6 @@ export const rootRouter = createTRPCRouter({
githubPrReview: githubPrReviewRouter,
moderation: moderationRouter,
userExports: userExportsRouter,
- quickChat: quickChatRouter,
});
// export type definition of API
export type RootRouter = typeof rootRouter;
diff --git a/dev/local/mobile-workflow.test.ts b/dev/local/mobile-workflow.test.ts
index d980772327..042e857507 100644
--- a/dev/local/mobile-workflow.test.ts
+++ b/dev/local/mobile-workflow.test.ts
@@ -5,7 +5,7 @@ import test from 'node:test';
test('tab layout derives accessibility labels from the visible tab count', () => {
const layout = fs.readFileSync('apps/mobile/src/app/(app)/(tabs)/_layout.tsx', 'utf8');
- assert.match(layout, /const tabCount = visibleTabCount\(showKiloClawTab, showQuickChatTab\);/);
+ assert.match(layout, /const tabCount = visibleTabCount\(showKiloClawTab, showChatTab\);/);
assert.match(
layout,
/tabBarAccessibilityLabel: tabAccessibilityLabel\(\s*t\('tabs\.home'\),\s*tabBarPosition\('home', tabFlags\) \?\? 1,\s*tabCount\s*\)/
diff --git a/packages/db/src/migrations/0238_drop_quick_chat.sql b/packages/db/src/migrations/0238_drop_quick_chat.sql
new file mode 100644
index 0000000000..87af85526f
--- /dev/null
+++ b/packages/db/src/migrations/0238_drop_quick_chat.sql
@@ -0,0 +1,2 @@
+DROP TABLE "quick_chat_messages" CASCADE;--> statement-breakpoint
+DROP TABLE "quick_chat_threads" CASCADE;
\ No newline at end of file
diff --git a/packages/db/src/migrations/meta/0238_snapshot.json b/packages/db/src/migrations/meta/0238_snapshot.json
new file mode 100644
index 0000000000..a561964093
--- /dev/null
+++ b/packages/db/src/migrations/meta/0238_snapshot.json
@@ -0,0 +1,39986 @@
+{
+ "id": "be52fe8b-33fc-46ad-9bd2-b41afbb04d9c",
+ "prevId": "5e69fda6-9d6d-4cfe-8e45-e92c22ce827b",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.agent_configs": {
+ "name": "agent_configs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_type": {
+ "name": "agent_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "is_enabled": {
+ "name": "is_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "runtime_state": {
+ "name": "runtime_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'::jsonb"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "config_revision": {
+ "name": "config_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ }
+ },
+ "indexes": {
+ "IDX_agent_configs_org_id": {
+ "name": "IDX_agent_configs_org_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_agent_configs_owned_by_user_id": {
+ "name": "IDX_agent_configs_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_agent_configs_agent_type": {
+ "name": "IDX_agent_configs_agent_type",
+ "columns": [
+ {
+ "expression": "agent_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_agent_configs_platform": {
+ "name": "IDX_agent_configs_platform",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_configs_owned_by_organization_id_organizations_id_fk": {
+ "name": "agent_configs_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "agent_configs",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_configs_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "agent_configs_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "agent_configs",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_agent_configs_org_agent_platform": {
+ "name": "UQ_agent_configs_org_agent_platform",
+ "nullsNotDistinct": false,
+ "columns": [
+ "owned_by_organization_id",
+ "agent_type",
+ "platform"
+ ]
+ },
+ "UQ_agent_configs_user_agent_platform": {
+ "name": "UQ_agent_configs_user_agent_platform",
+ "nullsNotDistinct": false,
+ "columns": [
+ "owned_by_user_id",
+ "agent_type",
+ "platform"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "agent_configs_owner_check": {
+ "name": "agent_configs_owner_check",
+ "value": "(\n (\"agent_configs\".\"owned_by_user_id\" IS NOT NULL AND \"agent_configs\".\"owned_by_organization_id\" IS NULL) OR\n (\"agent_configs\".\"owned_by_user_id\" IS NULL AND \"agent_configs\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ },
+ "agent_configs_agent_type_check": {
+ "name": "agent_configs_agent_type_check",
+ "value": "\"agent_configs\".\"agent_type\" IN ('code_review', 'auto_triage', 'auto_fix', 'security_scan')"
+ },
+ "agent_configs_config_revision_check": {
+ "name": "agent_configs_config_revision_check",
+ "value": "\"agent_configs\".\"config_revision\" >= 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_environment_profile_agents": {
+ "name": "agent_environment_profile_agents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_agent_env_profile_agents_profile_id": {
+ "name": "IDX_agent_env_profile_agents_profile_id",
+ "columns": [
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_environment_profile_agents_profile_id_agent_environment_profiles_id_fk": {
+ "name": "agent_environment_profile_agents_profile_id_agent_environment_profiles_id_fk",
+ "tableFrom": "agent_environment_profile_agents",
+ "tableTo": "agent_environment_profiles",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_agent_env_profile_agents_profile_slug": {
+ "name": "UQ_agent_env_profile_agents_profile_slug",
+ "nullsNotDistinct": false,
+ "columns": [
+ "profile_id",
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_environment_profile_commands": {
+ "name": "agent_environment_profile_commands",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "command": {
+ "name": "command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_agent_env_profile_commands_profile_id": {
+ "name": "IDX_agent_env_profile_commands_profile_id",
+ "columns": [
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_environment_profile_commands_profile_id_agent_environment_profiles_id_fk": {
+ "name": "agent_environment_profile_commands_profile_id_agent_environment_profiles_id_fk",
+ "tableFrom": "agent_environment_profile_commands",
+ "tableTo": "agent_environment_profiles",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_agent_env_profile_commands_profile_sequence": {
+ "name": "UQ_agent_env_profile_commands_profile_sequence",
+ "nullsNotDistinct": false,
+ "columns": [
+ "profile_id",
+ "sequence"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_environment_profile_kilo_commands": {
+ "name": "agent_environment_profile_kilo_commands",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "template": {
+ "name": "template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent": {
+ "name": "agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subtask": {
+ "name": "subtask",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_agent_env_profile_kilo_cmds_profile_id": {
+ "name": "IDX_agent_env_profile_kilo_cmds_profile_id",
+ "columns": [
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_environment_profile_kilo_commands_profile_id_agent_environment_profiles_id_fk": {
+ "name": "agent_environment_profile_kilo_commands_profile_id_agent_environment_profiles_id_fk",
+ "tableFrom": "agent_environment_profile_kilo_commands",
+ "tableTo": "agent_environment_profiles",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_agent_env_profile_kilo_cmds_profile_name": {
+ "name": "UQ_agent_env_profile_kilo_cmds_profile_name",
+ "nullsNotDistinct": false,
+ "columns": [
+ "profile_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_environment_profile_mcp_servers": {
+ "name": "agent_environment_profile_mcp_servers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "timeout": {
+ "name": "timeout",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_agent_env_profile_mcp_servers_profile_id": {
+ "name": "IDX_agent_env_profile_mcp_servers_profile_id",
+ "columns": [
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_environment_profile_mcp_servers_profile_id_agent_environment_profiles_id_fk": {
+ "name": "agent_environment_profile_mcp_servers_profile_id_agent_environment_profiles_id_fk",
+ "tableFrom": "agent_environment_profile_mcp_servers",
+ "tableTo": "agent_environment_profiles",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_agent_env_profile_mcp_servers_profile_name": {
+ "name": "UQ_agent_env_profile_mcp_servers_profile_name",
+ "nullsNotDistinct": false,
+ "columns": [
+ "profile_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_environment_profile_repo_bindings": {
+ "name": "agent_environment_profile_repo_bindings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'github'"
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_agent_env_profile_repo_bindings_user": {
+ "name": "UQ_agent_env_profile_repo_bindings_user",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"agent_environment_profile_repo_bindings\".\"owned_by_user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_agent_env_profile_repo_bindings_org": {
+ "name": "UQ_agent_env_profile_repo_bindings_org",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"agent_environment_profile_repo_bindings\".\"owned_by_organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_environment_profile_repo_bindings_profile_id_agent_environment_profiles_id_fk": {
+ "name": "agent_environment_profile_repo_bindings_profile_id_agent_environment_profiles_id_fk",
+ "tableFrom": "agent_environment_profile_repo_bindings",
+ "tableTo": "agent_environment_profiles",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_environment_profile_repo_bindings_owned_by_organization_id_organizations_id_fk": {
+ "name": "agent_environment_profile_repo_bindings_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "agent_environment_profile_repo_bindings",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_environment_profile_repo_bindings_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "agent_environment_profile_repo_bindings_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "agent_environment_profile_repo_bindings",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_env_profile_repo_bindings_owner_check": {
+ "name": "agent_env_profile_repo_bindings_owner_check",
+ "value": "(\n (\"agent_environment_profile_repo_bindings\".\"owned_by_user_id\" IS NOT NULL AND \"agent_environment_profile_repo_bindings\".\"owned_by_organization_id\" IS NULL) OR\n (\"agent_environment_profile_repo_bindings\".\"owned_by_user_id\" IS NULL AND \"agent_environment_profile_repo_bindings\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_environment_profile_skills": {
+ "name": "agent_environment_profile_skills",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_type": {
+ "name": "source_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_url": {
+ "name": "source_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "raw_markdown": {
+ "name": "raw_markdown",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "files": {
+ "name": "files",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_agent_env_profile_skills_profile_id": {
+ "name": "IDX_agent_env_profile_skills_profile_id",
+ "columns": [
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_environment_profile_skills_profile_id_agent_environment_profiles_id_fk": {
+ "name": "agent_environment_profile_skills_profile_id_agent_environment_profiles_id_fk",
+ "tableFrom": "agent_environment_profile_skills",
+ "tableTo": "agent_environment_profiles",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_agent_env_profile_skills_profile_name": {
+ "name": "UQ_agent_env_profile_skills_profile_name",
+ "nullsNotDistinct": false,
+ "columns": [
+ "profile_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_environment_profile_vars": {
+ "name": "agent_environment_profile_vars",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_secret": {
+ "name": "is_secret",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_agent_env_profile_vars_profile_id": {
+ "name": "IDX_agent_env_profile_vars_profile_id",
+ "columns": [
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_environment_profile_vars_profile_id_agent_environment_profiles_id_fk": {
+ "name": "agent_environment_profile_vars_profile_id_agent_environment_profiles_id_fk",
+ "tableFrom": "agent_environment_profile_vars",
+ "tableTo": "agent_environment_profiles",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_agent_env_profile_vars_profile_key": {
+ "name": "UQ_agent_env_profile_vars_profile_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "profile_id",
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_environment_profiles": {
+ "name": "agent_environment_profiles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_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
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_agent_env_profiles_org_name": {
+ "name": "UQ_agent_env_profiles_org_name",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"agent_environment_profiles\".\"owned_by_organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_agent_env_profiles_user_name": {
+ "name": "UQ_agent_env_profiles_user_name",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"agent_environment_profiles\".\"owned_by_user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_agent_env_profiles_org_default": {
+ "name": "UQ_agent_env_profiles_org_default",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"agent_environment_profiles\".\"is_default\" = true AND \"agent_environment_profiles\".\"owned_by_organization_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_agent_env_profiles_user_default": {
+ "name": "UQ_agent_env_profiles_user_default",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"agent_environment_profiles\".\"is_default\" = true AND \"agent_environment_profiles\".\"owned_by_user_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_agent_env_profiles_org_id": {
+ "name": "IDX_agent_env_profiles_org_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_agent_env_profiles_user_id": {
+ "name": "IDX_agent_env_profiles_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_agent_env_profiles_created_by_user_id": {
+ "name": "IDX_agent_env_profiles_created_by_user_id",
+ "columns": [
+ {
+ "expression": "created_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_environment_profiles_owned_by_organization_id_organizations_id_fk": {
+ "name": "agent_environment_profiles_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "agent_environment_profiles",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_environment_profiles_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "agent_environment_profiles_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "agent_environment_profiles",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_env_profiles_owner_check": {
+ "name": "agent_env_profiles_owner_check",
+ "value": "(\n (\"agent_environment_profiles\".\"owned_by_user_id\" IS NOT NULL AND \"agent_environment_profiles\".\"owned_by_organization_id\" IS NULL) OR\n (\"agent_environment_profiles\".\"owned_by_user_id\" IS NULL AND \"agent_environment_profiles\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.analytics_event_outbox": {
+ "name": "analytics_event_outbox",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "event_uuid": {
+ "name": "event_uuid",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_name": {
+ "name": "event_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "distinct_id": {
+ "name": "distinct_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "properties": {
+ "name": "properties",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "UQ_analytics_event_outbox_event_uuid": {
+ "name": "UQ_analytics_event_outbox_event_uuid",
+ "columns": [
+ {
+ "expression": "event_uuid",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_analytics_event_outbox_status_next_attempt_at": {
+ "name": "IDX_analytics_event_outbox_status_next_attempt_at",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.api_kind": {
+ "name": "api_kind",
+ "schema": "",
+ "columns": {
+ "api_kind_id": {
+ "name": "api_kind_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "api_kind": {
+ "name": "api_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_api_kind": {
+ "name": "UQ_api_kind",
+ "columns": [
+ {
+ "expression": "api_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.api_request_log": {
+ "name": "api_request_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vercel_request_id": {
+ "name": "vercel_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status_code": {
+ "name": "status_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request": {
+ "name": "request",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response": {
+ "name": "response",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_api_request_log_created_at": {
+ "name": "idx_api_request_log_created_at",
+ "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.app_builder_feedback": {
+ "name": "app_builder_feedback",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "preview_status": {
+ "name": "preview_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_streaming": {
+ "name": "is_streaming",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_count": {
+ "name": "message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "feedback_text": {
+ "name": "feedback_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recent_messages": {
+ "name": "recent_messages",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_app_builder_feedback_created_at": {
+ "name": "IDX_app_builder_feedback_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_app_builder_feedback_kilo_user_id": {
+ "name": "IDX_app_builder_feedback_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_app_builder_feedback_project_id": {
+ "name": "IDX_app_builder_feedback_project_id",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "app_builder_feedback_kilo_user_id_kilocode_users_id_fk": {
+ "name": "app_builder_feedback_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "app_builder_feedback",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "app_builder_feedback_project_id_app_builder_projects_id_fk": {
+ "name": "app_builder_feedback_project_id_app_builder_projects_id_fk",
+ "tableFrom": "app_builder_feedback",
+ "tableTo": "app_builder_projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_builder_project_sessions": {
+ "name": "app_builder_project_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "worker_version": {
+ "name": "worker_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'v2'"
+ }
+ },
+ "indexes": {
+ "IDX_app_builder_project_sessions_project_id": {
+ "name": "IDX_app_builder_project_sessions_project_id",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "app_builder_project_sessions_project_id_app_builder_projects_id_fk": {
+ "name": "app_builder_project_sessions_project_id_app_builder_projects_id_fk",
+ "tableFrom": "app_builder_project_sessions",
+ "tableTo": "app_builder_projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_app_builder_project_sessions_cloud_agent_session_id": {
+ "name": "UQ_app_builder_project_sessions_cloud_agent_session_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "cloud_agent_session_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_builder_projects": {
+ "name": "app_builder_projects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "template": {
+ "name": "template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_message_at": {
+ "name": "last_message_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "git_repo_full_name": {
+ "name": "git_repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "git_platform_integration_id": {
+ "name": "git_platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "migrated_at": {
+ "name": "migrated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_app_builder_projects_created_by_user_id": {
+ "name": "IDX_app_builder_projects_created_by_user_id",
+ "columns": [
+ {
+ "expression": "created_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_app_builder_projects_owned_by_user_id": {
+ "name": "IDX_app_builder_projects_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_app_builder_projects_owned_by_organization_id": {
+ "name": "IDX_app_builder_projects_owned_by_organization_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_app_builder_projects_created_at": {
+ "name": "IDX_app_builder_projects_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_app_builder_projects_last_message_at": {
+ "name": "IDX_app_builder_projects_last_message_at",
+ "columns": [
+ {
+ "expression": "last_message_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_app_builder_projects_git_repo_integration": {
+ "name": "IDX_app_builder_projects_git_repo_integration",
+ "columns": [
+ {
+ "expression": "git_repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "git_platform_integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"app_builder_projects\".\"git_repo_full_name\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "app_builder_projects_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "app_builder_projects_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "app_builder_projects",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "app_builder_projects_owned_by_organization_id_organizations_id_fk": {
+ "name": "app_builder_projects_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "app_builder_projects",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "app_builder_projects_deployment_id_deployments_id_fk": {
+ "name": "app_builder_projects_deployment_id_deployments_id_fk",
+ "tableFrom": "app_builder_projects",
+ "tableTo": "deployments",
+ "columnsFrom": [
+ "deployment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "app_builder_projects_git_platform_integration_id_platform_integrations_id_fk": {
+ "name": "app_builder_projects_git_platform_integration_id_platform_integrations_id_fk",
+ "tableFrom": "app_builder_projects",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "git_platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "app_builder_projects_owner_check": {
+ "name": "app_builder_projects_owner_check",
+ "value": "(\n (\"app_builder_projects\".\"owned_by_user_id\" IS NOT NULL AND \"app_builder_projects\".\"owned_by_organization_id\" IS NULL) OR\n (\"app_builder_projects\".\"owned_by_user_id\" IS NULL AND \"app_builder_projects\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.app_min_versions": {
+ "name": "app_min_versions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "ios_min_version": {
+ "name": "ios_min_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'1.0.0'"
+ },
+ "android_min_version": {
+ "name": "android_min_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'1.0.0'"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_reported_messages": {
+ "name": "app_reported_messages",
+ "schema": "",
+ "columns": {
+ "report_id": {
+ "name": "report_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "report_type": {
+ "name": "report_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "signature": {
+ "name": "signature",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "cli_session_id": {
+ "name": "cli_session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "app_reported_messages_cli_session_id_cli_sessions_session_id_fk": {
+ "name": "app_reported_messages_cli_session_id_cli_sessions_session_id_fk",
+ "tableFrom": "app_reported_messages",
+ "tableTo": "cli_sessions",
+ "columnsFrom": [
+ "cli_session_id"
+ ],
+ "columnsTo": [
+ "session_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.auto_fix_tickets": {
+ "name": "auto_fix_tickets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "triage_ticket_id": {
+ "name": "triage_ticket_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'github'"
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_number": {
+ "name": "issue_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_url": {
+ "name": "issue_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_title": {
+ "name": "issue_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_body": {
+ "name": "issue_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_author": {
+ "name": "issue_author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_labels": {
+ "name": "issue_labels",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "trigger_source": {
+ "name": "trigger_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'label'"
+ },
+ "review_comment_id": {
+ "name": "review_comment_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "review_comment_body": {
+ "name": "review_comment_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "line_number": {
+ "name": "line_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "diff_hunk": {
+ "name": "diff_hunk",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_head_ref": {
+ "name": "pr_head_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "classification": {
+ "name": "classification",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confidence": {
+ "name": "confidence",
+ "type": "numeric(3, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "intent_summary": {
+ "name": "intent_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "related_files": {
+ "name": "related_files",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cli_session_id": {
+ "name": "cli_session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_url": {
+ "name": "pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_branch": {
+ "name": "pr_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_auto_fix_tickets_repo_issue": {
+ "name": "UQ_auto_fix_tickets_repo_issue",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"auto_fix_tickets\".\"trigger_source\" = 'label'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_auto_fix_tickets_repo_review_comment": {
+ "name": "UQ_auto_fix_tickets_repo_review_comment",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "review_comment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"auto_fix_tickets\".\"review_comment_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_fix_tickets_owned_by_org": {
+ "name": "IDX_auto_fix_tickets_owned_by_org",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_fix_tickets_owned_by_user": {
+ "name": "IDX_auto_fix_tickets_owned_by_user",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_fix_tickets_status": {
+ "name": "IDX_auto_fix_tickets_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_fix_tickets_created_at": {
+ "name": "IDX_auto_fix_tickets_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_fix_tickets_triage_ticket_id": {
+ "name": "IDX_auto_fix_tickets_triage_ticket_id",
+ "columns": [
+ {
+ "expression": "triage_ticket_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_fix_tickets_session_id": {
+ "name": "IDX_auto_fix_tickets_session_id",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "auto_fix_tickets_owned_by_organization_id_organizations_id_fk": {
+ "name": "auto_fix_tickets_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "auto_fix_tickets",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "auto_fix_tickets_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "auto_fix_tickets_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "auto_fix_tickets",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "auto_fix_tickets_platform_integration_id_platform_integrations_id_fk": {
+ "name": "auto_fix_tickets_platform_integration_id_platform_integrations_id_fk",
+ "tableFrom": "auto_fix_tickets",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "auto_fix_tickets_triage_ticket_id_auto_triage_tickets_id_fk": {
+ "name": "auto_fix_tickets_triage_ticket_id_auto_triage_tickets_id_fk",
+ "tableFrom": "auto_fix_tickets",
+ "tableTo": "auto_triage_tickets",
+ "columnsFrom": [
+ "triage_ticket_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "auto_fix_tickets_cli_session_id_cli_sessions_session_id_fk": {
+ "name": "auto_fix_tickets_cli_session_id_cli_sessions_session_id_fk",
+ "tableFrom": "auto_fix_tickets",
+ "tableTo": "cli_sessions",
+ "columnsFrom": [
+ "cli_session_id"
+ ],
+ "columnsTo": [
+ "session_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "auto_fix_tickets_owner_check": {
+ "name": "auto_fix_tickets_owner_check",
+ "value": "(\n (\"auto_fix_tickets\".\"owned_by_user_id\" IS NOT NULL AND \"auto_fix_tickets\".\"owned_by_organization_id\" IS NULL) OR\n (\"auto_fix_tickets\".\"owned_by_user_id\" IS NULL AND \"auto_fix_tickets\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ },
+ "auto_fix_tickets_status_check": {
+ "name": "auto_fix_tickets_status_check",
+ "value": "\"auto_fix_tickets\".\"status\" IN ('pending', 'running', 'completed', 'failed', 'cancelled')"
+ },
+ "auto_fix_tickets_classification_check": {
+ "name": "auto_fix_tickets_classification_check",
+ "value": "\"auto_fix_tickets\".\"classification\" IN ('bug', 'feature', 'question', 'unclear')"
+ },
+ "auto_fix_tickets_confidence_check": {
+ "name": "auto_fix_tickets_confidence_check",
+ "value": "\"auto_fix_tickets\".\"confidence\" >= 0 AND \"auto_fix_tickets\".\"confidence\" <= 1"
+ },
+ "auto_fix_tickets_trigger_source_check": {
+ "name": "auto_fix_tickets_trigger_source_check",
+ "value": "\"auto_fix_tickets\".\"trigger_source\" IN ('label', 'review_comment')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.auto_model": {
+ "name": "auto_model",
+ "schema": "",
+ "columns": {
+ "auto_model_id": {
+ "name": "auto_model_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "auto_model": {
+ "name": "auto_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_auto_model": {
+ "name": "UQ_auto_model",
+ "columns": [
+ {
+ "expression": "auto_model",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.auto_top_up_configs": {
+ "name": "auto_top_up_configs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_payment_method_id": {
+ "name": "stripe_payment_method_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 5000
+ },
+ "last_auto_top_up_at": {
+ "name": "last_auto_top_up_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_started_at": {
+ "name": "attempt_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled_reason": {
+ "name": "disabled_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_auto_top_up_configs_owned_by_user_id": {
+ "name": "UQ_auto_top_up_configs_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"auto_top_up_configs\".\"owned_by_user_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_auto_top_up_configs_owned_by_organization_id": {
+ "name": "UQ_auto_top_up_configs_owned_by_organization_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"auto_top_up_configs\".\"owned_by_organization_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "auto_top_up_configs_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "auto_top_up_configs_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "auto_top_up_configs",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "auto_top_up_configs_owned_by_organization_id_organizations_id_fk": {
+ "name": "auto_top_up_configs_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "auto_top_up_configs",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "auto_top_up_configs_exactly_one_owner": {
+ "name": "auto_top_up_configs_exactly_one_owner",
+ "value": "(\"auto_top_up_configs\".\"owned_by_user_id\" IS NOT NULL AND \"auto_top_up_configs\".\"owned_by_organization_id\" IS NULL) OR (\"auto_top_up_configs\".\"owned_by_user_id\" IS NULL AND \"auto_top_up_configs\".\"owned_by_organization_id\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.auto_triage_tickets": {
+ "name": "auto_triage_tickets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'github'"
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_number": {
+ "name": "issue_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_url": {
+ "name": "issue_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_title": {
+ "name": "issue_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_body": {
+ "name": "issue_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_author": {
+ "name": "issue_author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_type": {
+ "name": "issue_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_labels": {
+ "name": "issue_labels",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "classification": {
+ "name": "classification",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confidence": {
+ "name": "confidence",
+ "type": "numeric(3, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "intent_summary": {
+ "name": "intent_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "related_files": {
+ "name": "related_files",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_duplicate": {
+ "name": "is_duplicate",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "duplicate_of_ticket_id": {
+ "name": "duplicate_of_ticket_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "similarity_score": {
+ "name": "similarity_score",
+ "type": "numeric(3, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "qdrant_point_id": {
+ "name": "qdrant_point_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "should_auto_fix": {
+ "name": "should_auto_fix",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "action_taken": {
+ "name": "action_taken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action_metadata": {
+ "name": "action_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_auto_triage_tickets_repo_issue": {
+ "name": "UQ_auto_triage_tickets_repo_issue",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_triage_tickets_owned_by_org": {
+ "name": "IDX_auto_triage_tickets_owned_by_org",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_triage_tickets_owned_by_user": {
+ "name": "IDX_auto_triage_tickets_owned_by_user",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_triage_tickets_status": {
+ "name": "IDX_auto_triage_tickets_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_triage_tickets_created_at": {
+ "name": "IDX_auto_triage_tickets_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_triage_tickets_qdrant_point_id": {
+ "name": "IDX_auto_triage_tickets_qdrant_point_id",
+ "columns": [
+ {
+ "expression": "qdrant_point_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_triage_tickets_owner_status_created": {
+ "name": "IDX_auto_triage_tickets_owner_status_created",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_triage_tickets_user_status_created": {
+ "name": "IDX_auto_triage_tickets_user_status_created",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_auto_triage_tickets_repo_classification": {
+ "name": "IDX_auto_triage_tickets_repo_classification",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "classification",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "auto_triage_tickets_owned_by_organization_id_organizations_id_fk": {
+ "name": "auto_triage_tickets_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "auto_triage_tickets",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "auto_triage_tickets_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "auto_triage_tickets_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "auto_triage_tickets",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "auto_triage_tickets_platform_integration_id_platform_integrations_id_fk": {
+ "name": "auto_triage_tickets_platform_integration_id_platform_integrations_id_fk",
+ "tableFrom": "auto_triage_tickets",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "auto_triage_tickets_duplicate_of_ticket_id_auto_triage_tickets_id_fk": {
+ "name": "auto_triage_tickets_duplicate_of_ticket_id_auto_triage_tickets_id_fk",
+ "tableFrom": "auto_triage_tickets",
+ "tableTo": "auto_triage_tickets",
+ "columnsFrom": [
+ "duplicate_of_ticket_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "auto_triage_tickets_owner_check": {
+ "name": "auto_triage_tickets_owner_check",
+ "value": "(\n (\"auto_triage_tickets\".\"owned_by_user_id\" IS NOT NULL AND \"auto_triage_tickets\".\"owned_by_organization_id\" IS NULL) OR\n (\"auto_triage_tickets\".\"owned_by_user_id\" IS NULL AND \"auto_triage_tickets\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ },
+ "auto_triage_tickets_issue_type_check": {
+ "name": "auto_triage_tickets_issue_type_check",
+ "value": "\"auto_triage_tickets\".\"issue_type\" IN ('issue', 'pull_request')"
+ },
+ "auto_triage_tickets_classification_check": {
+ "name": "auto_triage_tickets_classification_check",
+ "value": "\"auto_triage_tickets\".\"classification\" IN ('bug', 'feature', 'question', 'duplicate', 'unclear')"
+ },
+ "auto_triage_tickets_confidence_check": {
+ "name": "auto_triage_tickets_confidence_check",
+ "value": "\"auto_triage_tickets\".\"confidence\" >= 0 AND \"auto_triage_tickets\".\"confidence\" <= 1"
+ },
+ "auto_triage_tickets_similarity_score_check": {
+ "name": "auto_triage_tickets_similarity_score_check",
+ "value": "\"auto_triage_tickets\".\"similarity_score\" >= 0 AND \"auto_triage_tickets\".\"similarity_score\" <= 1"
+ },
+ "auto_triage_tickets_status_check": {
+ "name": "auto_triage_tickets_status_check",
+ "value": "\"auto_triage_tickets\".\"status\" IN ('pending', 'analyzing', 'actioned', 'failed', 'skipped')"
+ },
+ "auto_triage_tickets_action_taken_check": {
+ "name": "auto_triage_tickets_action_taken_check",
+ "value": "\"auto_triage_tickets\".\"action_taken\" IN ('pr_created', 'comment_posted', 'closed_duplicate', 'needs_clarification')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.bot_request_cloud_agent_sessions": {
+ "name": "bot_request_cloud_agent_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "bot_request_id": {
+ "name": "bot_request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "spawn_group_id": {
+ "name": "spawn_group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_session_id": {
+ "name": "kilo_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github_repo": {
+ "name": "github_repo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gitlab_project": {
+ "name": "gitlab_project",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "callback_step": {
+ "name": "callback_step",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "final_message": {
+ "name": "final_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "final_message_fetched_at": {
+ "name": "final_message_fetched_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "final_message_error": {
+ "name": "final_message_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "terminal_at": {
+ "name": "terminal_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "continuation_started_at": {
+ "name": "continuation_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_bot_request_cas_cloud_agent_session_id": {
+ "name": "UQ_bot_request_cas_cloud_agent_session_id",
+ "columns": [
+ {
+ "expression": "cloud_agent_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_bot_request_cas_bot_request_id": {
+ "name": "IDX_bot_request_cas_bot_request_id",
+ "columns": [
+ {
+ "expression": "bot_request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_bot_request_cas_bot_request_id_spawn_group_id": {
+ "name": "IDX_bot_request_cas_bot_request_id_spawn_group_id",
+ "columns": [
+ {
+ "expression": "bot_request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "spawn_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_bot_request_cas_bot_request_id_spawn_group_id_status": {
+ "name": "IDX_bot_request_cas_bot_request_id_spawn_group_id_status",
+ "columns": [
+ {
+ "expression": "bot_request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "spawn_group_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "bot_request_cloud_agent_sessions_bot_request_id_bot_requests_id_fk": {
+ "name": "bot_request_cloud_agent_sessions_bot_request_id_bot_requests_id_fk",
+ "tableFrom": "bot_request_cloud_agent_sessions",
+ "tableTo": "bot_requests",
+ "columnsFrom": [
+ "bot_request_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.bot_requests": {
+ "name": "bot_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform_thread_id": {
+ "name": "platform_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform_message_id": {
+ "name": "platform_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_message": {
+ "name": "user_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model_used": {
+ "name": "model_used",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "steps": {
+ "name": "steps",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_time_ms": {
+ "name": "response_time_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_bot_requests_created_at": {
+ "name": "IDX_bot_requests_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_bot_requests_created_by": {
+ "name": "IDX_bot_requests_created_by",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_bot_requests_organization_id": {
+ "name": "IDX_bot_requests_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_bot_requests_platform_integration_id": {
+ "name": "IDX_bot_requests_platform_integration_id",
+ "columns": [
+ {
+ "expression": "platform_integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_bot_requests_status": {
+ "name": "IDX_bot_requests_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "bot_requests_created_by_kilocode_users_id_fk": {
+ "name": "bot_requests_created_by_kilocode_users_id_fk",
+ "tableFrom": "bot_requests",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_requests_organization_id_organizations_id_fk": {
+ "name": "bot_requests_organization_id_organizations_id_fk",
+ "tableFrom": "bot_requests",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_requests_platform_integration_id_platform_integrations_id_fk": {
+ "name": "bot_requests_platform_integration_id_platform_integrations_id_fk",
+ "tableFrom": "bot_requests",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.byok_api_keys": {
+ "name": "byok_api_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_api_key": {
+ "name": "encrypted_api_key",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "management_source": {
+ "name": "management_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'user'"
+ },
+ "is_enabled": {
+ "name": "is_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "IDX_byok_api_keys_organization_id": {
+ "name": "IDX_byok_api_keys_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_byok_api_keys_kilo_user_id": {
+ "name": "IDX_byok_api_keys_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_byok_api_keys_provider_id": {
+ "name": "IDX_byok_api_keys_provider_id",
+ "columns": [
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "byok_api_keys_organization_id_organizations_id_fk": {
+ "name": "byok_api_keys_organization_id_organizations_id_fk",
+ "tableFrom": "byok_api_keys",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "byok_api_keys_kilo_user_id_kilocode_users_id_fk": {
+ "name": "byok_api_keys_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "byok_api_keys",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_byok_api_keys_org_provider": {
+ "name": "UQ_byok_api_keys_org_provider",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "provider_id"
+ ]
+ },
+ "UQ_byok_api_keys_user_provider": {
+ "name": "UQ_byok_api_keys_user_provider",
+ "nullsNotDistinct": false,
+ "columns": [
+ "kilo_user_id",
+ "provider_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "byok_api_keys_management_source_check": {
+ "name": "byok_api_keys_management_source_check",
+ "value": "\"byok_api_keys\".\"management_source\" IN ('user', 'coding_plan')"
+ },
+ "byok_api_keys_owner_check": {
+ "name": "byok_api_keys_owner_check",
+ "value": "(\n (\"byok_api_keys\".\"kilo_user_id\" IS NOT NULL AND \"byok_api_keys\".\"organization_id\" IS NULL) OR\n (\"byok_api_keys\".\"kilo_user_id\" IS NULL AND \"byok_api_keys\".\"organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cli_sessions": {
+ "name": "cli_sessions",
+ "schema": "",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_on_platform": {
+ "name": "created_on_platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "api_conversation_history_blob_url": {
+ "name": "api_conversation_history_blob_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "task_metadata_blob_url": {
+ "name": "task_metadata_blob_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ui_messages_blob_url": {
+ "name": "ui_messages_blob_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "git_state_blob_url": {
+ "name": "git_state_blob_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "git_url": {
+ "name": "git_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "forked_from": {
+ "name": "forked_from",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_mode": {
+ "name": "last_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_model": {
+ "name": "last_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_cli_sessions_kilo_user_id": {
+ "name": "IDX_cli_sessions_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cli_sessions_created_at": {
+ "name": "IDX_cli_sessions_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cli_sessions_updated_at": {
+ "name": "IDX_cli_sessions_updated_at",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cli_sessions_organization_id": {
+ "name": "IDX_cli_sessions_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cli_sessions_user_updated": {
+ "name": "IDX_cli_sessions_user_updated",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cli_sessions_kilo_user_id_kilocode_users_id_fk": {
+ "name": "cli_sessions_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "cli_sessions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "cli_sessions_forked_from_cli_sessions_session_id_fk": {
+ "name": "cli_sessions_forked_from_cli_sessions_session_id_fk",
+ "tableFrom": "cli_sessions",
+ "tableTo": "cli_sessions",
+ "columnsFrom": [
+ "forked_from"
+ ],
+ "columnsTo": [
+ "session_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "cli_sessions_parent_session_id_cli_sessions_session_id_fk": {
+ "name": "cli_sessions_parent_session_id_cli_sessions_session_id_fk",
+ "tableFrom": "cli_sessions",
+ "tableTo": "cli_sessions",
+ "columnsFrom": [
+ "parent_session_id"
+ ],
+ "columnsTo": [
+ "session_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "cli_sessions_organization_id_organizations_id_fk": {
+ "name": "cli_sessions_organization_id_organizations_id_fk",
+ "tableFrom": "cli_sessions",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "cli_sessions_cloud_agent_session_id_unique": {
+ "name": "cli_sessions_cloud_agent_session_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "cloud_agent_session_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cli_sessions_v2": {
+ "name": "cli_sessions_v2",
+ "schema": "",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_agent_session_scope_id": {
+ "name": "cloud_agent_session_scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_agent_worktree_id": {
+ "name": "cloud_agent_worktree_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_on_platform": {
+ "name": "created_on_platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "git_url": {
+ "name": "git_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "git_branch": {
+ "name": "git_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_url": {
+ "name": "pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status_updated_at": {
+ "name": "status_updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_activity_at": {
+ "name": "last_activity_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_cost_microdollars": {
+ "name": "total_cost_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_cli_sessions_v2_parent_session_id_kilo_user_id": {
+ "name": "IDX_cli_sessions_v2_parent_session_id_kilo_user_id",
+ "columns": [
+ {
+ "expression": "parent_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_cli_sessions_v2_public_id": {
+ "name": "UQ_cli_sessions_v2_public_id",
+ "columns": [
+ {
+ "expression": "public_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"cli_sessions_v2\".\"public_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_cli_sessions_v2_cloud_agent_session_id": {
+ "name": "UQ_cli_sessions_v2_cloud_agent_session_id",
+ "columns": [
+ {
+ "expression": "cloud_agent_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"cli_sessions_v2\".\"cloud_agent_session_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cli_sessions_v2_organization_id": {
+ "name": "IDX_cli_sessions_v2_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cli_sessions_v2_user_updated": {
+ "name": "IDX_cli_sessions_v2_user_updated",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cli_sessions_v2_user_created": {
+ "name": "IDX_cli_sessions_v2_user_created",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cli_sessions_v2_user_worktree_updated": {
+ "name": "IDX_cli_sessions_v2_user_worktree_updated",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cloud_agent_worktree_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cli_sessions_v2\".\"cloud_agent_worktree_id\" is not null",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "cli_sessions_v2_git_url_branch_idx": {
+ "name": "cli_sessions_v2_git_url_branch_idx",
+ "columns": [
+ {
+ "expression": "git_url",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "git_branch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cli_sessions_v2_kilo_user_id_kilocode_users_id_fk": {
+ "name": "cli_sessions_v2_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "cli_sessions_v2",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "cli_sessions_v2_organization_id_organizations_id_fk": {
+ "name": "cli_sessions_v2_organization_id_organizations_id_fk",
+ "tableFrom": "cli_sessions_v2",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "cli_sessions_v2_parent_session_id_kilo_user_id_fk": {
+ "name": "cli_sessions_v2_parent_session_id_kilo_user_id_fk",
+ "tableFrom": "cli_sessions_v2",
+ "tableTo": "cli_sessions_v2",
+ "columnsFrom": [
+ "parent_session_id",
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "session_id",
+ "kilo_user_id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "cli_sessions_v2_session_id_kilo_user_id_pk": {
+ "name": "cli_sessions_v2_session_id_kilo_user_id_pk",
+ "columns": [
+ "session_id",
+ "kilo_user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cloud_agent_code_review_attempts": {
+ "name": "cloud_agent_code_review_attempts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "code_review_id": {
+ "name": "code_review_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attempt_number": {
+ "name": "attempt_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "retry_of_attempt_id": {
+ "name": "retry_of_attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retry_reason": {
+ "name": "retry_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cli_session_id": {
+ "name": "cli_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "analytics_enabled_at_dispatch": {
+ "name": "analytics_enabled_at_dispatch",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "terminal_reason": {
+ "name": "terminal_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_cloud_agent_code_review_attempts_review_attempt_number": {
+ "name": "UQ_cloud_agent_code_review_attempts_review_attempt_number",
+ "columns": [
+ {
+ "expression": "code_review_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "attempt_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_review_attempts_code_review_id": {
+ "name": "idx_cloud_agent_code_review_attempts_code_review_id",
+ "columns": [
+ {
+ "expression": "code_review_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_review_attempts_session_id": {
+ "name": "idx_cloud_agent_code_review_attempts_session_id",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_review_attempts_cli_session_id": {
+ "name": "idx_cloud_agent_code_review_attempts_cli_session_id",
+ "columns": [
+ {
+ "expression": "cli_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_review_attempts_status": {
+ "name": "idx_cloud_agent_code_review_attempts_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_review_attempts_retry_reason": {
+ "name": "idx_cloud_agent_code_review_attempts_retry_reason",
+ "columns": [
+ {
+ "expression": "retry_reason",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cloud_agent_code_review_attempts_code_review_id_cloud_agent_code_reviews_id_fk": {
+ "name": "cloud_agent_code_review_attempts_code_review_id_cloud_agent_code_reviews_id_fk",
+ "tableFrom": "cloud_agent_code_review_attempts",
+ "tableTo": "cloud_agent_code_reviews",
+ "columnsFrom": [
+ "code_review_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cloud_agent_code_review_attempts_retry_of_attempt_id_cloud_agent_code_review_attempts_id_fk": {
+ "name": "cloud_agent_code_review_attempts_retry_of_attempt_id_cloud_agent_code_review_attempts_id_fk",
+ "tableFrom": "cloud_agent_code_review_attempts",
+ "tableTo": "cloud_agent_code_review_attempts",
+ "columnsFrom": [
+ "retry_of_attempt_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cloud_agent_code_review_attempts_attempt_number_check": {
+ "name": "cloud_agent_code_review_attempts_attempt_number_check",
+ "value": "\"cloud_agent_code_review_attempts\".\"attempt_number\" >= 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cloud_agent_code_reviews": {
+ "name": "cloud_agent_code_reviews",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manual_config": {
+ "name": "manual_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "review_type": {
+ "name": "review_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'standard'"
+ },
+ "trigger_source": {
+ "name": "trigger_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "council_result": {
+ "name": "council_result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "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
+ },
+ "pr_title": {
+ "name": "pr_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_author": {
+ "name": "pr_author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_author_github_id": {
+ "name": "pr_author_github_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "base_ref": {
+ "name": "base_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "head_ref": {
+ "name": "head_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'github'"
+ },
+ "platform_project_id": {
+ "name": "platform_project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cli_session_id": {
+ "name": "cli_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "dispatch_reservation_id": {
+ "name": "dispatch_reservation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "terminal_reason": {
+ "name": "terminal_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_version": {
+ "name": "agent_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'v1'"
+ },
+ "check_run_id": {
+ "name": "check_run_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_review_instructions_used": {
+ "name": "repository_review_instructions_used",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "repository_review_instructions_ref": {
+ "name": "repository_review_instructions_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_review_instructions_truncated": {
+ "name": "repository_review_instructions_truncated",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "previous_summary_body": {
+ "name": "previous_summary_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "previous_summary_head_sha": {
+ "name": "previous_summary_head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_tokens_in": {
+ "name": "total_tokens_in",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_tokens_out": {
+ "name": "total_tokens_out",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_cost_musd": {
+ "name": "total_cost_musd",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_cloud_agent_code_reviews_webhook_integration_repo_pr_sha": {
+ "name": "UQ_cloud_agent_code_reviews_webhook_integration_repo_pr_sha",
+ "columns": [
+ {
+ "expression": "platform_integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "head_sha",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"cloud_agent_code_reviews\".\"manual_config\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_cloud_agent_code_reviews_active_provider_publisher": {
+ "name": "UQ_cloud_agent_code_reviews_active_provider_publisher",
+ "columns": [
+ {
+ "expression": "platform_integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"cloud_agent_code_reviews\".\"platform_integration_id\" IS NOT NULL\n AND \"cloud_agent_code_reviews\".\"status\" IN ('pending', 'queued', 'running')\n AND (\"cloud_agent_code_reviews\".\"manual_config\" IS NULL OR \"cloud_agent_code_reviews\".\"manual_config\"->>'outputMode' = 'provider')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_reviews_owned_by_org_id": {
+ "name": "idx_cloud_agent_code_reviews_owned_by_org_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_reviews_owned_by_user_id": {
+ "name": "idx_cloud_agent_code_reviews_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_reviews_session_id": {
+ "name": "idx_cloud_agent_code_reviews_session_id",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_reviews_cli_session_id": {
+ "name": "idx_cloud_agent_code_reviews_cli_session_id",
+ "columns": [
+ {
+ "expression": "cli_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_reviews_status": {
+ "name": "idx_cloud_agent_code_reviews_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_reviews_repo": {
+ "name": "idx_cloud_agent_code_reviews_repo",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_reviews_pr_number": {
+ "name": "idx_cloud_agent_code_reviews_pr_number",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pr_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_reviews_created_at": {
+ "name": "idx_cloud_agent_code_reviews_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_cloud_agent_code_reviews_pr_author_github_id": {
+ "name": "idx_cloud_agent_code_reviews_pr_author_github_id",
+ "columns": [
+ {
+ "expression": "pr_author_github_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cloud_agent_code_reviews_owned_by_organization_id_organizations_id_fk": {
+ "name": "cloud_agent_code_reviews_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "cloud_agent_code_reviews",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cloud_agent_code_reviews_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "cloud_agent_code_reviews_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "cloud_agent_code_reviews",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cloud_agent_code_reviews_platform_integration_id_platform_integrations_id_fk": {
+ "name": "cloud_agent_code_reviews_platform_integration_id_platform_integrations_id_fk",
+ "tableFrom": "cloud_agent_code_reviews",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cloud_agent_code_reviews_owner_check": {
+ "name": "cloud_agent_code_reviews_owner_check",
+ "value": "(\n (\"cloud_agent_code_reviews\".\"owned_by_user_id\" IS NOT NULL AND \"cloud_agent_code_reviews\".\"owned_by_organization_id\" IS NULL) OR\n (\"cloud_agent_code_reviews\".\"owned_by_user_id\" IS NULL AND \"cloud_agent_code_reviews\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cloud_agent_feedback": {
+ "name": "cloud_agent_feedback",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_type": {
+ "name": "session_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_streaming": {
+ "name": "is_streaming",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_count": {
+ "name": "message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "feedback_text": {
+ "name": "feedback_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recent_messages": {
+ "name": "recent_messages",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_cloud_agent_feedback_created_at": {
+ "name": "IDX_cloud_agent_feedback_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_feedback_kilo_user_id": {
+ "name": "IDX_cloud_agent_feedback_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_feedback_cloud_agent_session_id": {
+ "name": "IDX_cloud_agent_feedback_cloud_agent_session_id",
+ "columns": [
+ {
+ "expression": "cloud_agent_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cloud_agent_feedback_kilo_user_id_kilocode_users_id_fk": {
+ "name": "cloud_agent_feedback_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "cloud_agent_feedback",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "cloud_agent_feedback_organization_id_organizations_id_fk": {
+ "name": "cloud_agent_feedback_organization_id_organizations_id_fk",
+ "tableFrom": "cloud_agent_feedback",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cloud_agent_pending_uploads": {
+ "name": "cloud_agent_pending_uploads",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "object_key": {
+ "name": "object_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message_uuid": {
+ "name": "message_uuid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_id": {
+ "name": "attachment_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "byte_size": {
+ "name": "byte_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "IDX_cloud_agent_pending_uploads_user_message_status": {
+ "name": "IDX_cloud_agent_pending_uploads_user_message_status",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "message_uuid",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_pending_uploads_expired": {
+ "name": "IDX_cloud_agent_pending_uploads_expired",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cloud_agent_pending_uploads\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "cloud_agent_pending_uploads_object_key_unique": {
+ "name": "cloud_agent_pending_uploads_object_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "object_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "cloud_agent_pending_uploads_status_check": {
+ "name": "cloud_agent_pending_uploads_status_check",
+ "value": "\"cloud_agent_pending_uploads\".\"status\" IN ('pending', 'linked', 'reaped')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cloud_agent_session_runs": {
+ "name": "cloud_agent_session_runs",
+ "schema": "",
+ "columns": {
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "wrapper_run_id": {
+ "name": "wrapper_run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "queued_at": {
+ "name": "queued_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dispatch_accepted_at": {
+ "name": "dispatch_accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_activity_observed_at": {
+ "name": "agent_activity_observed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "terminal_at": {
+ "name": "terminal_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_stage": {
+ "name": "failure_stage",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_responsibility": {
+ "name": "failure_responsibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message_redacted": {
+ "name": "error_message_redacted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_expires_at": {
+ "name": "error_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "IDX_cloud_agent_session_runs_wrapper_run_id": {
+ "name": "IDX_cloud_agent_session_runs_wrapper_run_id",
+ "columns": [
+ {
+ "expression": "wrapper_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cloud_agent_session_runs\".\"wrapper_run_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_session_runs_session_queued": {
+ "name": "IDX_cloud_agent_session_runs_session_queued",
+ "columns": [
+ {
+ "expression": "cloud_agent_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_session_runs_queued_at": {
+ "name": "IDX_cloud_agent_session_runs_queued_at",
+ "columns": [
+ {
+ "expression": "queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_session_runs_terminal_at": {
+ "name": "IDX_cloud_agent_session_runs_terminal_at",
+ "columns": [
+ {
+ "expression": "terminal_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_session_runs_status_terminal": {
+ "name": "IDX_cloud_agent_session_runs_status_terminal",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "terminal_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_session_runs_failure_terminal": {
+ "name": "IDX_cloud_agent_session_runs_failure_terminal",
+ "columns": [
+ {
+ "expression": "failure_stage",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "failure_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "terminal_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_session_runs_responsibility_reason_terminal": {
+ "name": "IDX_cloud_agent_session_runs_responsibility_reason_terminal",
+ "columns": [
+ {
+ "expression": "failure_responsibility",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "failure_reason",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "terminal_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cloud_agent_session_runs\".\"status\" = 'failed'",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_session_runs_error_expires_at": {
+ "name": "IDX_cloud_agent_session_runs_error_expires_at",
+ "columns": [
+ {
+ "expression": "error_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cloud_agent_session_runs\".\"error_expires_at\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cloud_agent_session_runs_cloud_agent_session_id_cloud_agent_sessions_cloud_agent_session_id_fk": {
+ "name": "cloud_agent_session_runs_cloud_agent_session_id_cloud_agent_sessions_cloud_agent_session_id_fk",
+ "tableFrom": "cloud_agent_session_runs",
+ "tableTo": "cloud_agent_sessions",
+ "columnsFrom": [
+ "cloud_agent_session_id"
+ ],
+ "columnsTo": [
+ "cloud_agent_session_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "cloud_agent_session_runs_cloud_agent_session_id_message_id_pk": {
+ "name": "cloud_agent_session_runs_cloud_agent_session_id_message_id_pk",
+ "columns": [
+ "cloud_agent_session_id",
+ "message_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cloud_agent_session_runs_status_check": {
+ "name": "cloud_agent_session_runs_status_check",
+ "value": "\"cloud_agent_session_runs\".\"status\" IN ('queued', 'accepted', 'completed', 'failed', 'interrupted')"
+ },
+ "cloud_agent_session_runs_error_message_bounded_check": {
+ "name": "cloud_agent_session_runs_error_message_bounded_check",
+ "value": "\"cloud_agent_session_runs\".\"error_message_redacted\" IS NULL OR char_length(\"cloud_agent_session_runs\".\"error_message_redacted\") <= 4096"
+ },
+ "cloud_agent_session_runs_error_expiry_check": {
+ "name": "cloud_agent_session_runs_error_expiry_check",
+ "value": "(\"cloud_agent_session_runs\".\"error_message_redacted\" IS NULL AND \"cloud_agent_session_runs\".\"error_expires_at\" IS NULL) OR\n (\"cloud_agent_session_runs\".\"error_message_redacted\" IS NOT NULL AND \"cloud_agent_session_runs\".\"error_expires_at\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cloud_agent_sessions": {
+ "name": "cloud_agent_sessions",
+ "schema": "",
+ "columns": {
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kilo_session_id": {
+ "name": "kilo_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "initial_message_id": {
+ "name": "initial_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sandbox_id": {
+ "name": "sandbox_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "failure_at": {
+ "name": "failure_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_stage": {
+ "name": "failure_stage",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_responsibility": {
+ "name": "failure_responsibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message_redacted": {
+ "name": "error_message_redacted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_expires_at": {
+ "name": "error_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "UQ_cloud_agent_sessions_kilo_session_id": {
+ "name": "UQ_cloud_agent_sessions_kilo_session_id",
+ "columns": [
+ {
+ "expression": "kilo_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_cloud_agent_sessions_initial_message_id": {
+ "name": "UQ_cloud_agent_sessions_initial_message_id",
+ "columns": [
+ {
+ "expression": "initial_message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_sessions_sandbox_id": {
+ "name": "IDX_cloud_agent_sessions_sandbox_id",
+ "columns": [
+ {
+ "expression": "sandbox_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cloud_agent_sessions\".\"sandbox_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_sessions_created_at": {
+ "name": "IDX_cloud_agent_sessions_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_sessions_failure_created": {
+ "name": "IDX_cloud_agent_sessions_failure_created",
+ "columns": [
+ {
+ "expression": "failure_stage",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "failure_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_sessions_failure_at": {
+ "name": "IDX_cloud_agent_sessions_failure_at",
+ "columns": [
+ {
+ "expression": "failure_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cloud_agent_sessions\".\"failure_at\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_sessions_failure_classification_at": {
+ "name": "IDX_cloud_agent_sessions_failure_classification_at",
+ "columns": [
+ {
+ "expression": "failure_stage",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "failure_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "failure_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cloud_agent_sessions\".\"failure_at\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_sessions_error_expires_at": {
+ "name": "IDX_cloud_agent_sessions_error_expires_at",
+ "columns": [
+ {
+ "expression": "error_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cloud_agent_sessions\".\"error_expires_at\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cloud_agent_sessions_failure_classification_check": {
+ "name": "cloud_agent_sessions_failure_classification_check",
+ "value": "(\"cloud_agent_sessions\".\"failure_at\" IS NULL AND \"cloud_agent_sessions\".\"failure_stage\" IS NULL AND \"cloud_agent_sessions\".\"failure_code\" IS NULL) OR\n (\"cloud_agent_sessions\".\"failure_at\" IS NOT NULL AND \"cloud_agent_sessions\".\"failure_stage\" = 'sandbox_identity' AND \"cloud_agent_sessions\".\"failure_code\" = 'sandbox_id_derivation_failed') OR\n (\"cloud_agent_sessions\".\"failure_at\" IS NOT NULL AND \"cloud_agent_sessions\".\"failure_stage\" = 'registration' AND \"cloud_agent_sessions\".\"failure_code\" = 'do_registration_rejected') OR\n (\"cloud_agent_sessions\".\"failure_at\" IS NOT NULL AND \"cloud_agent_sessions\".\"failure_stage\" = 'initial_admission' AND \"cloud_agent_sessions\".\"failure_code\" IN ('initial_admission_rejected', 'initial_queue_full', 'invalid_initial_intent')) OR\n (\"cloud_agent_sessions\".\"failure_at\" IS NOT NULL AND \"cloud_agent_sessions\".\"failure_stage\" = 'transport' AND \"cloud_agent_sessions\".\"failure_code\" = 'do_rpc_outcome_unknown')"
+ },
+ "cloud_agent_sessions_error_message_bounded_check": {
+ "name": "cloud_agent_sessions_error_message_bounded_check",
+ "value": "\"cloud_agent_sessions\".\"error_message_redacted\" IS NULL OR char_length(\"cloud_agent_sessions\".\"error_message_redacted\") <= 4096"
+ },
+ "cloud_agent_sessions_error_expiry_check": {
+ "name": "cloud_agent_sessions_error_expiry_check",
+ "value": "(\"cloud_agent_sessions\".\"error_message_redacted\" IS NULL AND \"cloud_agent_sessions\".\"error_expires_at\" IS NULL) OR\n (\"cloud_agent_sessions\".\"error_message_redacted\" IS NOT NULL AND \"cloud_agent_sessions\".\"error_expires_at\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cloud_agent_webhook_triggers": {
+ "name": "cloud_agent_webhook_triggers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "trigger_id": {
+ "name": "trigger_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_type": {
+ "name": "target_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'cloud_agent'"
+ },
+ "kiloclaw_instance_id": {
+ "name": "kiloclaw_instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activation_mode": {
+ "name": "activation_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'webhook'"
+ },
+ "cron_expression": {
+ "name": "cron_expression",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cron_timezone": {
+ "name": "cron_timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'UTC'"
+ },
+ "github_repo": {
+ "name": "github_repo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_cloud_agent_webhook_triggers_user_trigger": {
+ "name": "UQ_cloud_agent_webhook_triggers_user_trigger",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "trigger_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"cloud_agent_webhook_triggers\".\"user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_cloud_agent_webhook_triggers_org_trigger": {
+ "name": "UQ_cloud_agent_webhook_triggers_org_trigger",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "trigger_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"cloud_agent_webhook_triggers\".\"organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_webhook_triggers_user": {
+ "name": "IDX_cloud_agent_webhook_triggers_user",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_webhook_triggers_org": {
+ "name": "IDX_cloud_agent_webhook_triggers_org",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_webhook_triggers_active": {
+ "name": "IDX_cloud_agent_webhook_triggers_active",
+ "columns": [
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_cloud_agent_webhook_triggers_profile": {
+ "name": "IDX_cloud_agent_webhook_triggers_profile",
+ "columns": [
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cloud_agent_webhook_triggers_user_id_kilocode_users_id_fk": {
+ "name": "cloud_agent_webhook_triggers_user_id_kilocode_users_id_fk",
+ "tableFrom": "cloud_agent_webhook_triggers",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cloud_agent_webhook_triggers_organization_id_organizations_id_fk": {
+ "name": "cloud_agent_webhook_triggers_organization_id_organizations_id_fk",
+ "tableFrom": "cloud_agent_webhook_triggers",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cloud_agent_webhook_triggers_kiloclaw_instance_id_kiloclaw_instances_id_fk": {
+ "name": "cloud_agent_webhook_triggers_kiloclaw_instance_id_kiloclaw_instances_id_fk",
+ "tableFrom": "cloud_agent_webhook_triggers",
+ "tableTo": "kiloclaw_instances",
+ "columnsFrom": [
+ "kiloclaw_instance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "cloud_agent_webhook_triggers_profile_id_agent_environment_profiles_id_fk": {
+ "name": "cloud_agent_webhook_triggers_profile_id_agent_environment_profiles_id_fk",
+ "tableFrom": "cloud_agent_webhook_triggers",
+ "tableTo": "agent_environment_profiles",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "CHK_cloud_agent_webhook_triggers_owner": {
+ "name": "CHK_cloud_agent_webhook_triggers_owner",
+ "value": "(\n (\"cloud_agent_webhook_triggers\".\"user_id\" IS NOT NULL AND \"cloud_agent_webhook_triggers\".\"organization_id\" IS NULL) OR\n (\"cloud_agent_webhook_triggers\".\"user_id\" IS NULL AND \"cloud_agent_webhook_triggers\".\"organization_id\" IS NOT NULL)\n )"
+ },
+ "CHK_cloud_agent_webhook_triggers_cloud_agent_fields": {
+ "name": "CHK_cloud_agent_webhook_triggers_cloud_agent_fields",
+ "value": "(\n \"cloud_agent_webhook_triggers\".\"target_type\" != 'cloud_agent' OR\n (\"cloud_agent_webhook_triggers\".\"github_repo\" IS NOT NULL AND \"cloud_agent_webhook_triggers\".\"profile_id\" IS NOT NULL)\n )"
+ },
+ "CHK_cloud_agent_webhook_triggers_kiloclaw_fields": {
+ "name": "CHK_cloud_agent_webhook_triggers_kiloclaw_fields",
+ "value": "(\n \"cloud_agent_webhook_triggers\".\"target_type\" != 'kiloclaw_chat' OR\n \"cloud_agent_webhook_triggers\".\"kiloclaw_instance_id\" IS NOT NULL\n )"
+ },
+ "CHK_cloud_agent_webhook_triggers_scheduled_fields": {
+ "name": "CHK_cloud_agent_webhook_triggers_scheduled_fields",
+ "value": "(\n \"cloud_agent_webhook_triggers\".\"activation_mode\" != 'scheduled' OR\n \"cloud_agent_webhook_triggers\".\"cron_expression\" IS NOT NULL\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cloud_agent_worktrees": {
+ "name": "cloud_agent_worktrees",
+ "schema": "",
+ "columns": {
+ "worktree_id": {
+ "name": "worktree_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deletion_started_at": {
+ "name": "deletion_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deletion_completed_at": {
+ "name": "deletion_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_locations": {
+ "name": "runtime_locations",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "deletion_manifest": {
+ "name": "deletion_manifest",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_session_ids": {
+ "name": "deleted_session_ids",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::text[]"
+ }
+ },
+ "indexes": {
+ "IDX_cloud_agent_worktrees_owner_scope": {
+ "name": "IDX_cloud_agent_worktrees_owner_scope",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cloud_agent_worktrees_kilo_user_id_kilocode_users_id_fk": {
+ "name": "cloud_agent_worktrees_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "cloud_agent_worktrees",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "cloud_agent_worktrees_organization_id_organizations_id_fk": {
+ "name": "cloud_agent_worktrees_organization_id_organizations_id_fk",
+ "tableFrom": "cloud_agent_worktrees",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cloud_agent_worktrees_deletion_check": {
+ "name": "cloud_agent_worktrees_deletion_check",
+ "value": "\"cloud_agent_worktrees\".\"deletion_completed_at\" IS NULL OR (\"cloud_agent_worktrees\".\"deletion_started_at\" IS NOT NULL AND \"cloud_agent_worktrees\".\"name\" IS NULL AND \"cloud_agent_worktrees\".\"deletion_manifest\" IS NULL AND \"cloud_agent_worktrees\".\"runtime_locations\" = '[]'::jsonb)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cloud_billing_sku": {
+ "name": "cloud_billing_sku",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unit": {
+ "name": "unit",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rate_cents_per_unit": {
+ "name": "rate_cents_per_unit",
+ "type": "numeric(24, 12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accepts_new_usage": {
+ "name": "accepts_new_usage",
+ "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 with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "cloud_billing_sku_created_by_user_id_kilocode_users_id_fk": {
+ "name": "cloud_billing_sku_created_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "cloud_billing_sku",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cloud_billing_sku_id_format": {
+ "name": "cloud_billing_sku_id_format",
+ "value": "\"cloud_billing_sku\".\"id\" ~ '^[a-z0-9][a-z0-9-]{2,79}$'"
+ },
+ "cloud_billing_sku_name_nonempty": {
+ "name": "cloud_billing_sku_name_nonempty",
+ "value": "length(btrim(\"cloud_billing_sku\".\"name\")) > 0"
+ },
+ "cloud_billing_sku_rate_positive": {
+ "name": "cloud_billing_sku_rate_positive",
+ "value": "\"cloud_billing_sku\".\"rate_cents_per_unit\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.code_indexing_manifest": {
+ "name": "code_indexing_manifest",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "git_branch": {
+ "name": "git_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_hash": {
+ "name": "file_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "chunk_count": {
+ "name": "chunk_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total_lines": {
+ "name": "total_lines",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_ai_lines": {
+ "name": "total_ai_lines",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_code_indexing_manifest_organization_id": {
+ "name": "IDX_code_indexing_manifest_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_code_indexing_manifest_kilo_user_id": {
+ "name": "IDX_code_indexing_manifest_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_code_indexing_manifest_project_id": {
+ "name": "IDX_code_indexing_manifest_project_id",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_code_indexing_manifest_git_branch": {
+ "name": "IDX_code_indexing_manifest_git_branch",
+ "columns": [
+ {
+ "expression": "git_branch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_code_indexing_manifest_created_at": {
+ "name": "IDX_code_indexing_manifest_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "code_indexing_manifest_kilo_user_id_kilocode_users_id_fk": {
+ "name": "code_indexing_manifest_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "code_indexing_manifest",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_code_indexing_manifest_org_user_project_hash_branch": {
+ "name": "UQ_code_indexing_manifest_org_user_project_hash_branch",
+ "nullsNotDistinct": true,
+ "columns": [
+ "organization_id",
+ "kilo_user_id",
+ "project_id",
+ "file_path",
+ "git_branch"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.code_indexing_search": {
+ "name": "code_indexing_search",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "query": {
+ "name": "query",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_code_indexing_search_organization_id": {
+ "name": "IDX_code_indexing_search_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_code_indexing_search_kilo_user_id": {
+ "name": "IDX_code_indexing_search_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_code_indexing_search_project_id": {
+ "name": "IDX_code_indexing_search_project_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_code_indexing_search_created_at": {
+ "name": "IDX_code_indexing_search_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "code_indexing_search_kilo_user_id_kilocode_users_id_fk": {
+ "name": "code_indexing_search_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "code_indexing_search",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.code_review_analytics_findings": {
+ "name": "code_review_analytics_findings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "analytics_result_id": {
+ "name": "analytics_result_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ordinal": {
+ "name": "ordinal",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "severity": {
+ "name": "severity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "category": {
+ "name": "category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "security_class": {
+ "name": "security_class",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "code_review_analytics_findings_analytics_result_id_code_review_analytics_results_id_fk": {
+ "name": "code_review_analytics_findings_analytics_result_id_code_review_analytics_results_id_fk",
+ "tableFrom": "code_review_analytics_findings",
+ "tableTo": "code_review_analytics_results",
+ "columnsFrom": [
+ "analytics_result_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_code_review_analytics_findings_result_ordinal": {
+ "name": "UQ_code_review_analytics_findings_result_ordinal",
+ "nullsNotDistinct": false,
+ "columns": [
+ "analytics_result_id",
+ "ordinal"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "code_review_analytics_findings_severity_check": {
+ "name": "code_review_analytics_findings_severity_check",
+ "value": "\"code_review_analytics_findings\".\"severity\" IN ('critical', 'warning', 'suggestion')"
+ },
+ "code_review_analytics_findings_category_check": {
+ "name": "code_review_analytics_findings_category_check",
+ "value": "\"code_review_analytics_findings\".\"category\" IN ('security', 'correctness', 'reliability', 'data_integrity', 'performance', 'compatibility', 'maintainability', 'test_quality', 'documentation', 'accessibility', 'other')"
+ },
+ "code_review_analytics_findings_security_class_check": {
+ "name": "code_review_analytics_findings_security_class_check",
+ "value": "\"code_review_analytics_findings\".\"security_class\" IN ('auth_access', 'injection', 'data_protection', 'request_resource_boundary', 'deserialization_object_integrity', 'dependency_supply_chain', 'memory_safety', 'availability', 'concurrency', 'security_configuration', 'other')"
+ },
+ "code_review_analytics_findings_ordinal_check": {
+ "name": "code_review_analytics_findings_ordinal_check",
+ "value": "\"code_review_analytics_findings\".\"ordinal\" >= 0"
+ },
+ "code_review_analytics_findings_security_class_presence_check": {
+ "name": "code_review_analytics_findings_security_class_presence_check",
+ "value": "(\n (\"code_review_analytics_findings\".\"category\" = 'security' AND \"code_review_analytics_findings\".\"security_class\" IS NOT NULL) OR\n (\"code_review_analytics_findings\".\"category\" <> 'security' AND \"code_review_analytics_findings\".\"security_class\" IS NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.code_review_analytics_results": {
+ "name": "code_review_analytics_results",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "code_review_id": {
+ "name": "code_review_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_attempt_id": {
+ "name": "source_attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "capture_status": {
+ "name": "capture_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schema_version": {
+ "name": "schema_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "taxonomy_version": {
+ "name": "taxonomy_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "change_type": {
+ "name": "change_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "impact_level": {
+ "name": "impact_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "complexity_level": {
+ "name": "complexity_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "classification_confidence": {
+ "name": "classification_confidence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finalized_at": {
+ "name": "finalized_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_code_review_analytics_results_source_attempt_id": {
+ "name": "idx_code_review_analytics_results_source_attempt_id",
+ "columns": [
+ {
+ "expression": "source_attempt_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_code_review_analytics_results_finalized_at": {
+ "name": "idx_code_review_analytics_results_finalized_at",
+ "columns": [
+ {
+ "expression": "finalized_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "code_review_analytics_results_code_review_id_cloud_agent_code_reviews_id_fk": {
+ "name": "code_review_analytics_results_code_review_id_cloud_agent_code_reviews_id_fk",
+ "tableFrom": "code_review_analytics_results",
+ "tableTo": "cloud_agent_code_reviews",
+ "columnsFrom": [
+ "code_review_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "code_review_analytics_results_source_attempt_id_cloud_agent_code_review_attempts_id_fk": {
+ "name": "code_review_analytics_results_source_attempt_id_cloud_agent_code_review_attempts_id_fk",
+ "tableFrom": "code_review_analytics_results",
+ "tableTo": "cloud_agent_code_review_attempts",
+ "columnsFrom": [
+ "source_attempt_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_code_review_analytics_results_code_review_id": {
+ "name": "UQ_code_review_analytics_results_code_review_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "code_review_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "code_review_analytics_results_capture_status_check": {
+ "name": "code_review_analytics_results_capture_status_check",
+ "value": "\"code_review_analytics_results\".\"capture_status\" IN ('captured', 'missing', 'invalid', 'omitted')"
+ },
+ "code_review_analytics_results_change_type_check": {
+ "name": "code_review_analytics_results_change_type_check",
+ "value": "\"code_review_analytics_results\".\"change_type\" IN ('bug_fix', 'feature', 'refactor', 'maintenance', 'dependency', 'test', 'documentation', 'mixed', 'other')"
+ },
+ "code_review_analytics_results_impact_level_check": {
+ "name": "code_review_analytics_results_impact_level_check",
+ "value": "\"code_review_analytics_results\".\"impact_level\" IN ('low', 'medium', 'high')"
+ },
+ "code_review_analytics_results_complexity_level_check": {
+ "name": "code_review_analytics_results_complexity_level_check",
+ "value": "\"code_review_analytics_results\".\"complexity_level\" IN ('low', 'medium', 'high')"
+ },
+ "code_review_analytics_results_classification_confidence_check": {
+ "name": "code_review_analytics_results_classification_confidence_check",
+ "value": "\"code_review_analytics_results\".\"classification_confidence\" IN ('low', 'medium', 'high')"
+ },
+ "code_review_analytics_results_classification_presence_check": {
+ "name": "code_review_analytics_results_classification_presence_check",
+ "value": "(\n (\n \"code_review_analytics_results\".\"capture_status\" = 'captured'\n AND \"code_review_analytics_results\".\"change_type\" IS NOT NULL\n AND \"code_review_analytics_results\".\"impact_level\" IS NOT NULL\n AND \"code_review_analytics_results\".\"complexity_level\" IS NOT NULL\n AND \"code_review_analytics_results\".\"classification_confidence\" IS NOT NULL\n ) OR (\n \"code_review_analytics_results\".\"capture_status\" <> 'captured'\n AND \"code_review_analytics_results\".\"change_type\" IS NULL\n AND \"code_review_analytics_results\".\"impact_level\" IS NULL\n AND \"code_review_analytics_results\".\"complexity_level\" IS NULL\n AND \"code_review_analytics_results\".\"classification_confidence\" IS NULL\n )\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.code_review_feedback_events": {
+ "name": "code_review_feedback_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kilo_comment_id": {
+ "name": "kilo_comment_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reply_excerpt": {
+ "name": "reply_excerpt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_comment_excerpt": {
+ "name": "kilo_comment_excerpt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dedupe_hash": {
+ "name": "dedupe_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "occurred_at": {
+ "name": "occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_code_review_feedback_events_owned_by_org_id": {
+ "name": "idx_code_review_feedback_events_owned_by_org_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_code_review_feedback_events_owned_by_user_id": {
+ "name": "idx_code_review_feedback_events_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_code_review_feedback_events_platform_repo": {
+ "name": "idx_code_review_feedback_events_platform_repo",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_code_review_feedback_events_created_at": {
+ "name": "idx_code_review_feedback_events_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "code_review_feedback_events_owned_by_organization_id_organizations_id_fk": {
+ "name": "code_review_feedback_events_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "code_review_feedback_events",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "code_review_feedback_events_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "code_review_feedback_events_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "code_review_feedback_events",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_code_review_feedback_events_dedupe_hash": {
+ "name": "UQ_code_review_feedback_events_dedupe_hash",
+ "nullsNotDistinct": false,
+ "columns": [
+ "dedupe_hash"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "code_review_feedback_events_owner_check": {
+ "name": "code_review_feedback_events_owner_check",
+ "value": "(\n (\"code_review_feedback_events\".\"owned_by_user_id\" IS NOT NULL AND \"code_review_feedback_events\".\"owned_by_organization_id\" IS NULL) OR\n (\"code_review_feedback_events\".\"owned_by_user_id\" IS NULL AND \"code_review_feedback_events\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.code_review_memory_proposals": {
+ "name": "code_review_memory_proposals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rationale": {
+ "name": "rationale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "proposed_markdown": {
+ "name": "proposed_markdown",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "evidence": {
+ "name": "evidence",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "positive_count": {
+ "name": "positive_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "negative_count": {
+ "name": "negative_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "neutral_count": {
+ "name": "neutral_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "change_request_url": {
+ "name": "change_request_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_code_review_memory_proposals_owned_by_org_id": {
+ "name": "idx_code_review_memory_proposals_owned_by_org_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_code_review_memory_proposals_owned_by_user_id": {
+ "name": "idx_code_review_memory_proposals_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_code_review_memory_proposals_platform_repo_status": {
+ "name": "idx_code_review_memory_proposals_platform_repo_status",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_code_review_memory_proposals_updated_at": {
+ "name": "idx_code_review_memory_proposals_updated_at",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_code_review_memory_proposals_org_active_scope": {
+ "name": "UQ_code_review_memory_proposals_org_active_scope",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"code_review_memory_proposals\".\"owned_by_organization_id\" IS NOT NULL AND \"code_review_memory_proposals\".\"status\" IN ('open', 'edited', 'opening_change_request')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_code_review_memory_proposals_user_active_scope": {
+ "name": "UQ_code_review_memory_proposals_user_active_scope",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"code_review_memory_proposals\".\"owned_by_user_id\" IS NOT NULL AND \"code_review_memory_proposals\".\"status\" IN ('open', 'edited', 'opening_change_request')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "code_review_memory_proposals_owned_by_organization_id_organizations_id_fk": {
+ "name": "code_review_memory_proposals_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "code_review_memory_proposals",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "code_review_memory_proposals_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "code_review_memory_proposals_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "code_review_memory_proposals",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "code_review_memory_proposals_owner_check": {
+ "name": "code_review_memory_proposals_owner_check",
+ "value": "(\n (\"code_review_memory_proposals\".\"owned_by_user_id\" IS NOT NULL AND \"code_review_memory_proposals\".\"owned_by_organization_id\" IS NULL) OR\n (\"code_review_memory_proposals\".\"owned_by_user_id\" IS NULL AND \"code_review_memory_proposals\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.coding_plan_availability_intents": {
+ "name": "coding_plan_availability_intents",
+ "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
+ },
+ "plan_id": {
+ "name": "plan_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_coding_plan_availability_intents_user_plan": {
+ "name": "UQ_coding_plan_availability_intents_user_plan",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "plan_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_coding_plan_availability_intents_plan": {
+ "name": "IDX_coding_plan_availability_intents_plan",
+ "columns": [
+ {
+ "expression": "plan_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "coding_plan_availability_intents_user_id_kilocode_users_id_fk": {
+ "name": "coding_plan_availability_intents_user_id_kilocode_users_id_fk",
+ "tableFrom": "coding_plan_availability_intents",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.coding_plan_key_inventory": {
+ "name": "coding_plan_key_inventory",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plan_id": {
+ "name": "plan_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "upstream_plan_id": {
+ "name": "upstream_plan_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "upstream_usage_id": {
+ "name": "upstream_usage_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "encrypted_api_key": {
+ "name": "encrypted_api_key",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_fingerprint": {
+ "name": "credential_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'available'"
+ },
+ "assigned_to_user_id": {
+ "name": "assigned_to_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assigned_at": {
+ "name": "assigned_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revocation_requested_at": {
+ "name": "revocation_requested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revocation_attempt_count": {
+ "name": "revocation_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_revocation_error": {
+ "name": "last_revocation_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_coding_plan_key_inv_fingerprint": {
+ "name": "UQ_coding_plan_key_inv_fingerprint",
+ "columns": [
+ {
+ "expression": "credential_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_coding_plan_key_inv_provider_usage_id": {
+ "name": "UQ_coding_plan_key_inv_provider_usage_id",
+ "columns": [
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "upstream_usage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"coding_plan_key_inventory\".\"upstream_usage_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_coding_plan_key_inv_plan_status": {
+ "name": "IDX_coding_plan_key_inv_plan_status",
+ "columns": [
+ {
+ "expression": "plan_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_coding_plan_key_inv_available": {
+ "name": "IDX_coding_plan_key_inv_available",
+ "columns": [
+ {
+ "expression": "plan_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"coding_plan_key_inventory\".\"status\" = 'available'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "coding_plan_key_inventory_assigned_to_user_id_kilocode_users_id_fk": {
+ "name": "coding_plan_key_inventory_assigned_to_user_id_kilocode_users_id_fk",
+ "tableFrom": "coding_plan_key_inventory",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "assigned_to_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "coding_plan_key_inventory_status_check": {
+ "name": "coding_plan_key_inventory_status_check",
+ "value": "\"coding_plan_key_inventory\".\"status\" IN ('available', 'assigned', 'revocation_pending', 'revoked', 'revocation_failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.coding_plan_subscriptions": {
+ "name": "coding_plan_subscriptions",
+ "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
+ },
+ "plan_id": {
+ "name": "plan_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_inventory_id": {
+ "name": "key_inventory_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "installed_byok_key_id": {
+ "name": "installed_byok_key_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_microdollars": {
+ "name": "cost_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "billing_period_days": {
+ "name": "billing_period_days",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "current_period_start": {
+ "name": "current_period_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "current_period_end": {
+ "name": "current_period_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credit_renewal_at": {
+ "name": "credit_renewal_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cancel_at_period_end": {
+ "name": "cancel_at_period_end",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "past_due_started_at": {
+ "name": "past_due_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payment_grace_expires_at": {
+ "name": "payment_grace_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_top_up_attempted_for_due": {
+ "name": "auto_top_up_attempted_for_due",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canceled_at": {
+ "name": "canceled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancellation_reason": {
+ "name": "cancellation_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_coding_plan_sub_live_user_plan": {
+ "name": "UQ_coding_plan_sub_live_user_plan",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "plan_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"coding_plan_subscriptions\".\"status\" IN ('active', 'past_due')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_coding_plan_sub_live_user_provider": {
+ "name": "UQ_coding_plan_sub_live_user_provider",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"coding_plan_subscriptions\".\"status\" IN ('active', 'past_due')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_coding_plan_sub_status": {
+ "name": "IDX_coding_plan_sub_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_coding_plan_sub_renewal": {
+ "name": "IDX_coding_plan_sub_renewal",
+ "columns": [
+ {
+ "expression": "credit_renewal_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_coding_plan_sub_inventory": {
+ "name": "IDX_coding_plan_sub_inventory",
+ "columns": [
+ {
+ "expression": "key_inventory_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "coding_plan_subscriptions_user_id_kilocode_users_id_fk": {
+ "name": "coding_plan_subscriptions_user_id_kilocode_users_id_fk",
+ "tableFrom": "coding_plan_subscriptions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "coding_plan_subscriptions_key_inventory_id_coding_plan_key_inventory_id_fk": {
+ "name": "coding_plan_subscriptions_key_inventory_id_coding_plan_key_inventory_id_fk",
+ "tableFrom": "coding_plan_subscriptions",
+ "tableTo": "coding_plan_key_inventory",
+ "columnsFrom": [
+ "key_inventory_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "coding_plan_subscriptions_installed_byok_key_id_byok_api_keys_id_fk": {
+ "name": "coding_plan_subscriptions_installed_byok_key_id_byok_api_keys_id_fk",
+ "tableFrom": "coding_plan_subscriptions",
+ "tableTo": "byok_api_keys",
+ "columnsFrom": [
+ "installed_byok_key_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "coding_plan_subscriptions_status_check": {
+ "name": "coding_plan_subscriptions_status_check",
+ "value": "\"coding_plan_subscriptions\".\"status\" IN ('active', 'past_due', 'canceled')"
+ },
+ "coding_plan_subscriptions_live_access_check": {
+ "name": "coding_plan_subscriptions_live_access_check",
+ "value": "\"coding_plan_subscriptions\".\"status\" = 'canceled' OR \"coding_plan_subscriptions\".\"key_inventory_id\" IS NOT NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.coding_plan_terms": {
+ "name": "coding_plan_terms",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plan_id": {
+ "name": "plan_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_start": {
+ "name": "period_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_end": {
+ "name": "period_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_microdollars": {
+ "name": "cost_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credit_transaction_id": {
+ "name": "credit_transaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_coding_plan_terms_request": {
+ "name": "UQ_coding_plan_terms_request",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "plan_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_coding_plan_terms_subscription": {
+ "name": "IDX_coding_plan_terms_subscription",
+ "columns": [
+ {
+ "expression": "subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "coding_plan_terms_subscription_id_coding_plan_subscriptions_id_fk": {
+ "name": "coding_plan_terms_subscription_id_coding_plan_subscriptions_id_fk",
+ "tableFrom": "coding_plan_terms",
+ "tableTo": "coding_plan_subscriptions",
+ "columnsFrom": [
+ "subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "coding_plan_terms_user_id_kilocode_users_id_fk": {
+ "name": "coding_plan_terms_user_id_kilocode_users_id_fk",
+ "tableFrom": "coding_plan_terms",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "coding_plan_terms_credit_transaction_id_credit_transactions_id_fk": {
+ "name": "coding_plan_terms_credit_transaction_id_credit_transactions_id_fk",
+ "tableFrom": "coding_plan_terms",
+ "tableTo": "credit_transactions",
+ "columnsFrom": [
+ "credit_transaction_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "coding_plan_terms_kind_check": {
+ "name": "coding_plan_terms_kind_check",
+ "value": "\"coding_plan_terms\".\"kind\" IN ('activation', 'extension', 'renewal')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.compute_usage_charge": {
+ "name": "compute_usage_charge",
+ "schema": "",
+ "columns": {
+ "usage_source": {
+ "name": "usage_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usage_source_id": {
+ "name": "usage_source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_billing_sku_id": {
+ "name": "cloud_billing_sku_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "numeric(24, 12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "settled_quantity_after": {
+ "name": "settled_quantity_after",
+ "type": "numeric(24, 12)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rate_cents_per_unit": {
+ "name": "rate_cents_per_unit",
+ "type": "numeric(24, 12)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_microdollars": {
+ "name": "amount_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "IDX_compute_usage_charge_user_created": {
+ "name": "IDX_compute_usage_charge_user_created",
+ "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": {}
+ },
+ "IDX_compute_usage_charge_organization_created": {
+ "name": "IDX_compute_usage_charge_organization_created",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "compute_usage_charge_user_id_kilocode_users_id_fk": {
+ "name": "compute_usage_charge_user_id_kilocode_users_id_fk",
+ "tableFrom": "compute_usage_charge",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "compute_usage_charge_organization_id_organizations_id_fk": {
+ "name": "compute_usage_charge_organization_id_organizations_id_fk",
+ "tableFrom": "compute_usage_charge",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "compute_usage_charge_cloud_billing_sku_id_cloud_billing_sku_id_fk": {
+ "name": "compute_usage_charge_cloud_billing_sku_id_cloud_billing_sku_id_fk",
+ "tableFrom": "compute_usage_charge",
+ "tableTo": "cloud_billing_sku",
+ "columnsFrom": [
+ "cloud_billing_sku_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "compute_usage_charge_usage_source_usage_source_id_created_at_pk": {
+ "name": "compute_usage_charge_usage_source_usage_source_id_created_at_pk",
+ "columns": [
+ "usage_source",
+ "usage_source_id",
+ "created_at"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "compute_usage_charge_exactly_one_payer": {
+ "name": "compute_usage_charge_exactly_one_payer",
+ "value": "(\"compute_usage_charge\".\"user_id\" IS NULL) <> (\"compute_usage_charge\".\"organization_id\" IS NULL)"
+ },
+ "compute_usage_charge_quantity_positive": {
+ "name": "compute_usage_charge_quantity_positive",
+ "value": "\"compute_usage_charge\".\"quantity\" > 0"
+ },
+ "compute_usage_charge_settled_quantity_positive": {
+ "name": "compute_usage_charge_settled_quantity_positive",
+ "value": "\"compute_usage_charge\".\"settled_quantity_after\" IS NULL OR \"compute_usage_charge\".\"settled_quantity_after\" > 0"
+ },
+ "compute_usage_charge_rate_positive": {
+ "name": "compute_usage_charge_rate_positive",
+ "value": "\"compute_usage_charge\".\"rate_cents_per_unit\" > 0"
+ },
+ "compute_usage_charge_amount_positive": {
+ "name": "compute_usage_charge_amount_positive",
+ "value": "\"compute_usage_charge\".\"amount_microdollars\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.container_usage_interval": {
+ "name": "container_usage_interval",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "service": {
+ "name": "service",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "start_epoch_ms": {
+ "name": "start_epoch_ms",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cloud_billing_sku_id": {
+ "name": "cloud_billing_sku_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "context_fingerprint": {
+ "name": "context_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_heartbeat_seq": {
+ "name": "last_heartbeat_seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "confirmed_seconds": {
+ "name": "confirmed_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "billing_mode": {
+ "name": "billing_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'shadow'"
+ },
+ "rate_cents_per_unit": {
+ "name": "rate_cents_per_unit",
+ "type": "numeric(24, 12)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "settled_billable_seconds": {
+ "name": "settled_billable_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "stopped_at": {
+ "name": "stopped_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "close_reason": {
+ "name": "close_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "exit_code": {
+ "name": "exit_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "final_stop_seq": {
+ "name": "final_stop_seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "IDX_container_usage_interval_sweep": {
+ "name": "IDX_container_usage_interval_sweep",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_seen_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_container_usage_interval_subject_started": {
+ "name": "IDX_container_usage_interval_subject_started",
+ "columns": [
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_container_usage_interval_single_open": {
+ "name": "UQ_container_usage_interval_single_open",
+ "columns": [
+ {
+ "expression": "service",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"container_usage_interval\".\"status\" = 'open'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "container_usage_interval_cloud_billing_sku_id_cloud_billing_sku_id_fk": {
+ "name": "container_usage_interval_cloud_billing_sku_id_cloud_billing_sku_id_fk",
+ "tableFrom": "container_usage_interval",
+ "tableTo": "cloud_billing_sku",
+ "columnsFrom": [
+ "cloud_billing_sku_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "container_usage_interval_subject_type": {
+ "name": "container_usage_interval_subject_type",
+ "value": "\"container_usage_interval\".\"subject_type\" IN ('user', 'org')"
+ },
+ "container_usage_interval_actor_type": {
+ "name": "container_usage_interval_actor_type",
+ "value": "\"container_usage_interval\".\"actor_type\" IN ('user', 'bot')"
+ },
+ "container_usage_interval_context_fingerprint": {
+ "name": "container_usage_interval_context_fingerprint",
+ "value": "\"container_usage_interval\".\"context_fingerprint\" ~ '^[a-f0-9]{64}$'"
+ },
+ "container_usage_interval_attribution": {
+ "name": "container_usage_interval_attribution",
+ "value": "\"container_usage_interval\".\"actor_type\" = 'bot' OR (\"container_usage_interval\".\"actor_type\" = 'user' AND (\"container_usage_interval\".\"subject_type\" <> 'user' OR \"container_usage_interval\".\"actor_id\" = \"container_usage_interval\".\"subject_id\"))"
+ },
+ "container_usage_interval_status": {
+ "name": "container_usage_interval_status",
+ "value": "\"container_usage_interval\".\"status\" IN ('open', 'closed')"
+ },
+ "container_usage_interval_billing_mode": {
+ "name": "container_usage_interval_billing_mode",
+ "value": "\"container_usage_interval\".\"billing_mode\" IN ('shadow', 'paid')"
+ },
+ "container_usage_interval_paid_rate": {
+ "name": "container_usage_interval_paid_rate",
+ "value": "(\"container_usage_interval\".\"billing_mode\" = 'shadow' AND \"container_usage_interval\".\"rate_cents_per_unit\" IS NULL) OR (\"container_usage_interval\".\"billing_mode\" = 'paid' AND \"container_usage_interval\".\"rate_cents_per_unit\" > 0)"
+ },
+ "container_usage_interval_open_closed_shape": {
+ "name": "container_usage_interval_open_closed_shape",
+ "value": "(\"container_usage_interval\".\"status\" = 'open' AND \"container_usage_interval\".\"stopped_at\" IS NULL AND \"container_usage_interval\".\"close_reason\" IS NULL) OR (\"container_usage_interval\".\"status\" = 'closed' AND \"container_usage_interval\".\"stopped_at\" IS NOT NULL AND \"container_usage_interval\".\"close_reason\" IS NOT NULL)"
+ },
+ "container_usage_interval_time_order": {
+ "name": "container_usage_interval_time_order",
+ "value": "\"container_usage_interval\".\"last_seen_at\" >= \"container_usage_interval\".\"started_at\" AND (\"container_usage_interval\".\"stopped_at\" IS NULL OR (\"container_usage_interval\".\"stopped_at\" >= \"container_usage_interval\".\"started_at\" AND \"container_usage_interval\".\"stopped_at\" <= \"container_usage_interval\".\"last_seen_at\"))"
+ },
+ "container_usage_interval_last_heartbeat_seq_nonnegative": {
+ "name": "container_usage_interval_last_heartbeat_seq_nonnegative",
+ "value": "\"container_usage_interval\".\"last_heartbeat_seq\" >= 0"
+ },
+ "container_usage_interval_confirmed_seconds_nonnegative": {
+ "name": "container_usage_interval_confirmed_seconds_nonnegative",
+ "value": "\"container_usage_interval\".\"confirmed_seconds\" >= 0"
+ },
+ "container_usage_interval_settled_billable_seconds_nonnegative": {
+ "name": "container_usage_interval_settled_billable_seconds_nonnegative",
+ "value": "\"container_usage_interval\".\"settled_billable_seconds\" >= 0 AND \"container_usage_interval\".\"settled_billable_seconds\" <= \"container_usage_interval\".\"confirmed_seconds\""
+ },
+ "container_usage_interval_final_stop_seq_positive": {
+ "name": "container_usage_interval_final_stop_seq_positive",
+ "value": "\"container_usage_interval\".\"final_stop_seq\" IS NULL OR \"container_usage_interval\".\"final_stop_seq\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.container_usage_segment": {
+ "name": "container_usage_segment",
+ "schema": "",
+ "columns": {
+ "interval_id": {
+ "name": "interval_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "seq": {
+ "name": "seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reported_seconds": {
+ "name": "reported_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usage_seconds": {
+ "name": "usage_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "IDX_container_usage_segment_received": {
+ "name": "IDX_container_usage_segment_received",
+ "columns": [
+ {
+ "expression": "received_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "container_usage_segment_interval_id_container_usage_interval_id_fk": {
+ "name": "container_usage_segment_interval_id_container_usage_interval_id_fk",
+ "tableFrom": "container_usage_segment",
+ "tableTo": "container_usage_interval",
+ "columnsFrom": [
+ "interval_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "container_usage_segment_interval_id_seq_pk": {
+ "name": "container_usage_segment_interval_id_seq_pk",
+ "columns": [
+ "interval_id",
+ "seq"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "container_usage_segment_idempotency_key_unique": {
+ "name": "container_usage_segment_idempotency_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "idempotency_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "container_usage_segment_seq_positive": {
+ "name": "container_usage_segment_seq_positive",
+ "value": "\"container_usage_segment\".\"seq\" > 0"
+ },
+ "container_usage_segment_reported_seconds_nonnegative": {
+ "name": "container_usage_segment_reported_seconds_nonnegative",
+ "value": "\"container_usage_segment\".\"reported_seconds\" >= 0"
+ },
+ "container_usage_segment_usage_seconds_nonnegative": {
+ "name": "container_usage_segment_usage_seconds_nonnegative",
+ "value": "\"container_usage_segment\".\"usage_seconds\" >= 0"
+ },
+ "container_usage_segment_usage_within_reported": {
+ "name": "container_usage_segment_usage_within_reported",
+ "value": "\"container_usage_segment\".\"usage_seconds\" <= \"container_usage_segment\".\"reported_seconds\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.content_moderation_reports": {
+ "name": "content_moderation_reports",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "surface": {
+ "name": "surface",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_kind": {
+ "name": "target_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "context_json": {
+ "name": "context_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "receipt_id": {
+ "name": "receipt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "triage_status": {
+ "name": "triage_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'received'"
+ },
+ "appeal_status": {
+ "name": "appeal_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'none'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_content_moderation_reports_user_created": {
+ "name": "IDX_content_moderation_reports_user_created",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_content_moderation_reports_target": {
+ "name": "IDX_content_moderation_reports_target",
+ "columns": [
+ {
+ "expression": "target_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "content_moderation_reports_receipt_id_unique": {
+ "name": "content_moderation_reports_receipt_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "receipt_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contributor_champion_contributors": {
+ "name": "contributor_champion_contributors",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "github_login": {
+ "name": "github_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_profile_url": {
+ "name": "github_profile_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_user_id": {
+ "name": "github_user_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_contribution_at": {
+ "name": "first_contribution_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_contribution_at": {
+ "name": "last_contribution_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "all_time_contributions": {
+ "name": "all_time_contributions",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "manual_email": {
+ "name": "manual_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_contributor_champion_contributors_last_contribution_at": {
+ "name": "IDX_contributor_champion_contributors_last_contribution_at",
+ "columns": [
+ {
+ "expression": "last_contribution_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_contributor_champion_contributors_manual_email": {
+ "name": "IDX_contributor_champion_contributors_manual_email",
+ "columns": [
+ {
+ "expression": "manual_email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_contributor_champion_contributors_github_login": {
+ "name": "UQ_contributor_champion_contributors_github_login",
+ "nullsNotDistinct": false,
+ "columns": [
+ "github_login"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contributor_champion_events": {
+ "name": "contributor_champion_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "contributor_id": {
+ "name": "contributor_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_pr_number": {
+ "name": "github_pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_pr_url": {
+ "name": "github_pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_pr_title": {
+ "name": "github_pr_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_author_login": {
+ "name": "github_author_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_author_email": {
+ "name": "github_author_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "merged_at": {
+ "name": "merged_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_contributor_champion_events_contributor_id": {
+ "name": "IDX_contributor_champion_events_contributor_id",
+ "columns": [
+ {
+ "expression": "contributor_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_contributor_champion_events_merged_at": {
+ "name": "IDX_contributor_champion_events_merged_at",
+ "columns": [
+ {
+ "expression": "merged_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_contributor_champion_events_author_email": {
+ "name": "IDX_contributor_champion_events_author_email",
+ "columns": [
+ {
+ "expression": "github_author_email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "contributor_champion_events_contributor_id_contributor_champion_contributors_id_fk": {
+ "name": "contributor_champion_events_contributor_id_contributor_champion_contributors_id_fk",
+ "tableFrom": "contributor_champion_events",
+ "tableTo": "contributor_champion_contributors",
+ "columnsFrom": [
+ "contributor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_contributor_champion_events_repo_pr": {
+ "name": "UQ_contributor_champion_events_repo_pr",
+ "nullsNotDistinct": false,
+ "columns": [
+ "repo_full_name",
+ "github_pr_number"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contributor_champion_memberships": {
+ "name": "contributor_champion_memberships",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "contributor_id": {
+ "name": "contributor_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "selected_tier": {
+ "name": "selected_tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enrolled_tier": {
+ "name": "enrolled_tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enrolled_at": {
+ "name": "enrolled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_amount_microdollars": {
+ "name": "credit_amount_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "credits_last_granted_at": {
+ "name": "credits_last_granted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linked_kilo_user_id": {
+ "name": "linked_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_contributor_champion_memberships_credits_due": {
+ "name": "IDX_contributor_champion_memberships_credits_due",
+ "columns": [
+ {
+ "expression": "credits_last_granted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"contributor_champion_memberships\".\"enrolled_tier\" IS NOT NULL AND \"contributor_champion_memberships\".\"credit_amount_microdollars\" > 0",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_contributor_champion_memberships_linked_kilo_user_id": {
+ "name": "IDX_contributor_champion_memberships_linked_kilo_user_id",
+ "columns": [
+ {
+ "expression": "linked_kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "contributor_champion_memberships_contributor_id_contributor_champion_contributors_id_fk": {
+ "name": "contributor_champion_memberships_contributor_id_contributor_champion_contributors_id_fk",
+ "tableFrom": "contributor_champion_memberships",
+ "tableTo": "contributor_champion_contributors",
+ "columnsFrom": [
+ "contributor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "contributor_champion_memberships_linked_kilo_user_id_kilocode_users_id_fk": {
+ "name": "contributor_champion_memberships_linked_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "contributor_champion_memberships",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "linked_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_contributor_champion_memberships_contributor_id": {
+ "name": "UQ_contributor_champion_memberships_contributor_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "contributor_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "contributor_champion_memberships_selected_tier_check": {
+ "name": "contributor_champion_memberships_selected_tier_check",
+ "value": "\"contributor_champion_memberships\".\"selected_tier\" IS NULL OR \"contributor_champion_memberships\".\"selected_tier\" IN ('contributor', 'ambassador', 'champion')"
+ },
+ "contributor_champion_memberships_enrolled_tier_check": {
+ "name": "contributor_champion_memberships_enrolled_tier_check",
+ "value": "\"contributor_champion_memberships\".\"enrolled_tier\" IS NULL OR \"contributor_champion_memberships\".\"enrolled_tier\" IN ('contributor', 'ambassador', 'champion')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.contributor_champion_sync_state": {
+ "name": "contributor_champion_sync_state",
+ "schema": "",
+ "columns": {
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "last_merged_at": {
+ "name": "last_merged_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_synced_at": {
+ "name": "last_synced_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.credit_campaigns": {
+ "name": "credit_campaigns",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credit_category": {
+ "name": "credit_category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_microdollars": {
+ "name": "amount_microdollars",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credit_expiry_hours": {
+ "name": "credit_expiry_hours",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "campaign_ends_at": {
+ "name": "campaign_ends_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_redemptions_allowed": {
+ "name": "total_redemptions_allowed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active": {
+ "name": "active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_kilo_user_id": {
+ "name": "created_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_credit_campaigns_slug": {
+ "name": "UQ_credit_campaigns_slug",
+ "columns": [
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_credit_campaigns_credit_category": {
+ "name": "UQ_credit_campaigns_credit_category",
+ "columns": [
+ {
+ "expression": "credit_category",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "credit_campaigns_slug_format_check": {
+ "name": "credit_campaigns_slug_format_check",
+ "value": "\"credit_campaigns\".\"slug\" ~ '^[a-z0-9-]{5,40}$'"
+ },
+ "credit_campaigns_amount_positive_check": {
+ "name": "credit_campaigns_amount_positive_check",
+ "value": "\"credit_campaigns\".\"amount_microdollars\" > 0"
+ },
+ "credit_campaigns_credit_expiry_hours_positive_check": {
+ "name": "credit_campaigns_credit_expiry_hours_positive_check",
+ "value": "\"credit_campaigns\".\"credit_expiry_hours\" IS NULL OR \"credit_campaigns\".\"credit_expiry_hours\" > 0"
+ },
+ "credit_campaigns_total_redemptions_allowed_positive_check": {
+ "name": "credit_campaigns_total_redemptions_allowed_positive_check",
+ "value": "\"credit_campaigns\".\"total_redemptions_allowed\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.credit_transactions": {
+ "name": "credit_transactions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_microdollars": {
+ "name": "amount_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expiration_baseline_microdollars_used": {
+ "name": "expiration_baseline_microdollars_used",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "original_baseline_microdollars_used": {
+ "name": "original_baseline_microdollars_used",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_free": {
+ "name": "is_free",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "original_transaction_id": {
+ "name": "original_transaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_payment_id": {
+ "name": "stripe_payment_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "coinbase_credit_block_id": {
+ "name": "coinbase_credit_block_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_category": {
+ "name": "credit_category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiry_date": {
+ "name": "expiry_date",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_kilo_user_id": {
+ "name": "created_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "check_category_uniqueness": {
+ "name": "check_category_uniqueness",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "IDX_credit_transactions_created_at": {
+ "name": "IDX_credit_transactions_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_credit_transactions_is_free": {
+ "name": "IDX_credit_transactions_is_free",
+ "columns": [
+ {
+ "expression": "is_free",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_credit_transactions_kilo_user_id": {
+ "name": "IDX_credit_transactions_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_credit_transactions_credit_category": {
+ "name": "IDX_credit_transactions_credit_category",
+ "columns": [
+ {
+ "expression": "credit_category",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_credit_transactions_stripe_payment_id": {
+ "name": "IDX_credit_transactions_stripe_payment_id",
+ "columns": [
+ {
+ "expression": "stripe_payment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_credit_transactions_original_transaction_id": {
+ "name": "IDX_credit_transactions_original_transaction_id",
+ "columns": [
+ {
+ "expression": "original_transaction_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_credit_transactions_coinbase_credit_block_id": {
+ "name": "IDX_credit_transactions_coinbase_credit_block_id",
+ "columns": [
+ {
+ "expression": "coinbase_credit_block_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_credit_transactions_organization_id": {
+ "name": "IDX_credit_transactions_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_credit_transactions_unique_category": {
+ "name": "IDX_credit_transactions_unique_category",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "credit_category",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"credit_transactions\".\"check_category_uniqueness\" = TRUE",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "credit_transactions_created_by_kilo_user_id_kilocode_users_id_fk": {
+ "name": "credit_transactions_created_by_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "credit_transactions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_llm2": {
+ "name": "custom_llm2",
+ "schema": "",
+ "columns": {
+ "public_id": {
+ "name": "public_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "definition": {
+ "name": "definition",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_api_key": {
+ "name": "encrypted_api_key",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deleted_user_email_tombstones": {
+ "name": "deleted_user_email_tombstones",
+ "schema": "",
+ "columns": {
+ "normalized_email_hash": {
+ "name": "normalized_email_hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployment_builds": {
+ "name": "deployment_builds",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_deployment_builds_deployment_id": {
+ "name": "idx_deployment_builds_deployment_id",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_deployment_builds_status": {
+ "name": "idx_deployment_builds_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_builds_deployment_id_deployments_id_fk": {
+ "name": "deployment_builds_deployment_id_deployments_id_fk",
+ "tableFrom": "deployment_builds",
+ "tableTo": "deployments",
+ "columnsFrom": [
+ "deployment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployment_env_vars": {
+ "name": "deployment_env_vars",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_secret": {
+ "name": "is_secret",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_deployment_env_vars_deployment_id": {
+ "name": "idx_deployment_env_vars_deployment_id",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_env_vars_deployment_id_deployments_id_fk": {
+ "name": "deployment_env_vars_deployment_id_deployments_id_fk",
+ "tableFrom": "deployment_env_vars",
+ "tableTo": "deployments",
+ "columnsFrom": [
+ "deployment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_deployment_env_vars_deployment_key": {
+ "name": "UQ_deployment_env_vars_deployment_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "deployment_id",
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployment_events": {
+ "name": "deployment_events",
+ "schema": "",
+ "columns": {
+ "build_id": {
+ "name": "build_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'log'"
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "idx_deployment_events_build_id": {
+ "name": "idx_deployment_events_build_id",
+ "columns": [
+ {
+ "expression": "build_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_deployment_events_timestamp": {
+ "name": "idx_deployment_events_timestamp",
+ "columns": [
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_deployment_events_type": {
+ "name": "idx_deployment_events_type",
+ "columns": [
+ {
+ "expression": "event_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_events_build_id_deployment_builds_id_fk": {
+ "name": "deployment_events_build_id_deployment_builds_id_fk",
+ "tableFrom": "deployment_events",
+ "tableTo": "deployment_builds",
+ "columnsFrom": [
+ "build_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "deployment_events_build_id_event_id_pk": {
+ "name": "deployment_events_build_id_event_id_pk",
+ "columns": [
+ "build_id",
+ "event_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployment_threat_detections": {
+ "name": "deployment_threat_detections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "build_id": {
+ "name": "build_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "threat_type": {
+ "name": "threat_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_deployment_threat_detections_deployment_id": {
+ "name": "idx_deployment_threat_detections_deployment_id",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_deployment_threat_detections_created_at": {
+ "name": "idx_deployment_threat_detections_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_threat_detections_deployment_id_deployments_id_fk": {
+ "name": "deployment_threat_detections_deployment_id_deployments_id_fk",
+ "tableFrom": "deployment_threat_detections",
+ "tableTo": "deployments",
+ "columnsFrom": [
+ "deployment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "deployment_threat_detections_build_id_deployment_builds_id_fk": {
+ "name": "deployment_threat_detections_build_id_deployment_builds_id_fk",
+ "tableFrom": "deployment_threat_detections",
+ "tableTo": "deployment_builds",
+ "columnsFrom": [
+ "build_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployments": {
+ "name": "deployments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_slug": {
+ "name": "deployment_slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "internal_worker_name": {
+ "name": "internal_worker_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_source": {
+ "name": "repository_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "branch": {
+ "name": "branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_url": {
+ "name": "deployment_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_type": {
+ "name": "source_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'github'"
+ },
+ "git_auth_token": {
+ "name": "git_auth_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_deployed_at": {
+ "name": "last_deployed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_build_id": {
+ "name": "last_build_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "threat_status": {
+ "name": "threat_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_from": {
+ "name": "created_from",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_deployments_owned_by_user_id": {
+ "name": "idx_deployments_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_deployments_owned_by_organization_id": {
+ "name": "idx_deployments_owned_by_organization_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_deployments_platform_integration_id": {
+ "name": "idx_deployments_platform_integration_id",
+ "columns": [
+ {
+ "expression": "platform_integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_deployments_repository_source_branch": {
+ "name": "idx_deployments_repository_source_branch",
+ "columns": [
+ {
+ "expression": "repository_source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "branch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_deployments_threat_status_pending": {
+ "name": "idx_deployments_threat_status_pending",
+ "columns": [
+ {
+ "expression": "threat_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"deployments\".\"threat_status\" = 'pending_scan'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployments_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "deployments_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "deployments",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "deployments_owned_by_organization_id_organizations_id_fk": {
+ "name": "deployments_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "deployments",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_deployments_deployment_slug": {
+ "name": "UQ_deployments_deployment_slug",
+ "nullsNotDistinct": false,
+ "columns": [
+ "deployment_slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "deployments_owner_check": {
+ "name": "deployments_owner_check",
+ "value": "(\n (\"deployments\".\"owned_by_user_id\" IS NOT NULL AND \"deployments\".\"owned_by_organization_id\" IS NULL) OR\n (\"deployments\".\"owned_by_user_id\" IS NULL AND \"deployments\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ },
+ "deployments_source_type_check": {
+ "name": "deployments_source_type_check",
+ "value": "\"deployments\".\"source_type\" IN ('github', 'git', 'app-builder')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.deployments_ephemeral": {
+ "name": "deployments_ephemeral",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_type": {
+ "name": "source_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "internal_worker_name": {
+ "name": "internal_worker_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_slug": {
+ "name": "deployment_slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_cleanup_at": {
+ "name": "next_cleanup_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cleanup_claim_token": {
+ "name": "cleanup_claim_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cleanup_claimed_until": {
+ "name": "cleanup_claimed_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_deployments_ephemeral_owned_by_user_id": {
+ "name": "idx_deployments_ephemeral_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_deployments_ephemeral_next_cleanup_at": {
+ "name": "idx_deployments_ephemeral_next_cleanup_at",
+ "columns": [
+ {
+ "expression": "next_cleanup_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployments_ephemeral_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "deployments_ephemeral_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "deployments_ephemeral",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_deployments_ephemeral_internal_worker_name": {
+ "name": "UQ_deployments_ephemeral_internal_worker_name",
+ "nullsNotDistinct": false,
+ "columns": [
+ "internal_worker_name"
+ ]
+ },
+ "UQ_deployments_ephemeral_deployment_slug": {
+ "name": "UQ_deployments_ephemeral_deployment_slug",
+ "nullsNotDistinct": false,
+ "columns": [
+ "deployment_slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "deployments_ephemeral_source_type_check": {
+ "name": "deployments_ephemeral_source_type_check",
+ "value": "\"deployments_ephemeral\".\"source_type\" IN ('html')"
+ },
+ "deployments_ephemeral_status_check": {
+ "name": "deployments_ephemeral_status_check",
+ "value": "\"deployments_ephemeral\".\"status\" IN ('pending', 'active', 'cleanup_retry')"
+ },
+ "deployments_ephemeral_claim_fields_check": {
+ "name": "deployments_ephemeral_claim_fields_check",
+ "value": "(\"deployments_ephemeral\".\"cleanup_claim_token\" IS NULL) = (\"deployments_ephemeral\".\"cleanup_claimed_until\" IS NULL)"
+ },
+ "deployments_ephemeral_active_fields_check": {
+ "name": "deployments_ephemeral_active_fields_check",
+ "value": "\"deployments_ephemeral\".\"status\" <> 'active' OR (\"deployments_ephemeral\".\"deployment_slug\" IS NOT NULL AND \"deployments_ephemeral\".\"expires_at\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.device_auth_requests": {
+ "name": "device_auth_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "code": {
+ "name": "code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_code": {
+ "name": "user_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "device_code_hash": {
+ "name": "device_code_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_device_auth_requests_code": {
+ "name": "UQ_device_auth_requests_code",
+ "columns": [
+ {
+ "expression": "code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_device_auth_requests_status": {
+ "name": "IDX_device_auth_requests_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_device_auth_requests_expires_at": {
+ "name": "IDX_device_auth_requests_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_device_auth_requests_kilo_user_id": {
+ "name": "IDX_device_auth_requests_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_device_auth_requests_device_code_hash": {
+ "name": "UQ_device_auth_requests_device_code_hash",
+ "columns": [
+ {
+ "expression": "device_code_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"device_auth_requests\".\"device_code_hash\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_device_auth_requests_user_code": {
+ "name": "IDX_device_auth_requests_user_code",
+ "columns": [
+ {
+ "expression": "user_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"device_auth_requests\".\"user_code\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "device_auth_requests_kilo_user_id_kilocode_users_id_fk": {
+ "name": "device_auth_requests_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "device_auth_requests",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.device_refresh_tokens": {
+ "name": "device_refresh_tokens",
+ "schema": "",
+ "columns": {
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "device_session_id": {
+ "name": "device_session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_device_refresh_tokens_device_session_id": {
+ "name": "IDX_device_refresh_tokens_device_session_id",
+ "columns": [
+ {
+ "expression": "device_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_device_refresh_tokens_expires_at": {
+ "name": "IDX_device_refresh_tokens_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "device_refresh_tokens_device_session_id_device_sessions_id_fk": {
+ "name": "device_refresh_tokens_device_session_id_device_sessions_id_fk",
+ "tableFrom": "device_refresh_tokens",
+ "tableTo": "device_sessions",
+ "columnsFrom": [
+ "device_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.device_sessions": {
+ "name": "device_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "device_auth_request_id": {
+ "name": "device_auth_request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_reason": {
+ "name": "revoked_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "IDX_device_sessions_kilo_user_id": {
+ "name": "IDX_device_sessions_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_device_sessions_revoked_at": {
+ "name": "IDX_device_sessions_revoked_at",
+ "columns": [
+ {
+ "expression": "revoked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "device_sessions_kilo_user_id_kilocode_users_id_fk": {
+ "name": "device_sessions_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "device_sessions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.direct_byok_model_lists": {
+ "name": "direct_byok_model_lists",
+ "schema": "",
+ "columns": {
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "models": {
+ "name": "models",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "synced_at": {
+ "name": "synced_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.discord_gateway_listener": {
+ "name": "discord_gateway_listener",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "default": 1
+ },
+ "listener_id": {
+ "name": "listener_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.editor_name": {
+ "name": "editor_name",
+ "schema": "",
+ "columns": {
+ "editor_name_id": {
+ "name": "editor_name_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "editor_name": {
+ "name": "editor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_editor_name": {
+ "name": "UQ_editor_name",
+ "columns": [
+ {
+ "expression": "editor_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.enkrypt_sync_state": {
+ "name": "enkrypt_sync_state",
+ "schema": "",
+ "columns": {
+ "job_name": {
+ "name": "job_name",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "attempt_id": {
+ "name": "attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_completed_at": {
+ "name": "last_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_success_at": {
+ "name": "last_success_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_outcome": {
+ "name": "last_outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_failure_category": {
+ "name": "last_failure_category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_counts": {
+ "name": "last_counts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_success_counts": {
+ "name": "last_success_counts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "verified_models": {
+ "name": "verified_models",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "baseline_matched_count": {
+ "name": "baseline_matched_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "enkrypt_sync_state_singleton": {
+ "name": "enkrypt_sync_state_singleton",
+ "value": "\"enkrypt_sync_state\".\"job_name\" = 'enkrypt'"
+ },
+ "enkrypt_sync_state_outcome": {
+ "name": "enkrypt_sync_state_outcome",
+ "value": "\"enkrypt_sync_state\".\"last_outcome\" IN ('running', 'succeeded', 'failed')"
+ },
+ "enkrypt_sync_state_baseline": {
+ "name": "enkrypt_sync_state_baseline",
+ "value": "\"enkrypt_sync_state\".\"baseline_matched_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.enrichment_data": {
+ "name": "enrichment_data",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_enrichment_data": {
+ "name": "github_enrichment_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linkedin_enrichment_data": {
+ "name": "linkedin_enrichment_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "clay_enrichment_data": {
+ "name": "clay_enrichment_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_enrichment_data_user_id": {
+ "name": "IDX_enrichment_data_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "enrichment_data_user_id_kilocode_users_id_fk": {
+ "name": "enrichment_data_user_id_kilocode_users_id_fk",
+ "tableFrom": "enrichment_data",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_enrichment_data_user_id": {
+ "name": "UQ_enrichment_data_user_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.exa_monthly_usage": {
+ "name": "exa_monthly_usage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "month": {
+ "name": "month",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total_cost_microdollars": {
+ "name": "total_cost_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "total_charged_microdollars": {
+ "name": "total_charged_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "free_allowance_microdollars": {
+ "name": "free_allowance_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 10000000
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_exa_monthly_usage_personal": {
+ "name": "idx_exa_monthly_usage_personal",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "month",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"exa_monthly_usage\".\"organization_id\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_exa_monthly_usage_org": {
+ "name": "idx_exa_monthly_usage_org",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "month",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"exa_monthly_usage\".\"organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.exa_usage_log": {
+ "name": "exa_usage_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_microdollars": {
+ "name": "cost_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "charged_to_balance": {
+ "name": "charged_to_balance",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "feature_id": {
+ "name": "feature_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_exa_usage_log_user_created": {
+ "name": "idx_exa_usage_log_user_created",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "exa_usage_log_id_created_at_pk": {
+ "name": "exa_usage_log_id_created_at_pk",
+ "columns": [
+ "id",
+ "created_at"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.external_side_effect_outbox": {
+ "name": "external_side_effect_outbox",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "operation": {
+ "name": "operation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'send_org_invite_email'"
+ },
+ "invitation_id": {
+ "name": "invitation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "UQ_external_side_effect_outbox_invitation_id": {
+ "name": "UQ_external_side_effect_outbox_invitation_id",
+ "columns": [
+ {
+ "expression": "invitation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_external_side_effect_outbox_status_next_attempt_at": {
+ "name": "IDX_external_side_effect_outbox_status_next_attempt_at",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.feature": {
+ "name": "feature",
+ "schema": "",
+ "columns": {
+ "feature_id": {
+ "name": "feature_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "feature": {
+ "name": "feature",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_feature": {
+ "name": "UQ_feature",
+ "columns": [
+ {
+ "expression": "feature",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.finish_reason": {
+ "name": "finish_reason",
+ "schema": "",
+ "columns": {
+ "finish_reason_id": {
+ "name": "finish_reason_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "finish_reason": {
+ "name": "finish_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_finish_reason": {
+ "name": "UQ_finish_reason",
+ "columns": [
+ {
+ "expression": "finish_reason",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.free_model_usage": {
+ "name": "free_model_usage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_free_model_usage_ip_created_at": {
+ "name": "idx_free_model_usage_ip_created_at",
+ "columns": [
+ {
+ "expression": "ip_address",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_free_model_usage_created_at": {
+ "name": "idx_free_model_usage_created_at",
+ "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.github_branch_pull_requests": {
+ "name": "github_branch_pull_requests",
+ "schema": "",
+ "columns": {
+ "git_url": {
+ "name": "git_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "git_branch": {
+ "name": "git_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_url": {
+ "name": "pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_state": {
+ "name": "pr_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_title": {
+ "name": "pr_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_head_sha": {
+ "name": "pr_head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_review_decision": {
+ "name": "pr_review_decision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "review_decision_pending": {
+ "name": "review_decision_pending",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "review_decision_fetching_at": {
+ "name": "review_decision_fetching_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_last_synced_at": {
+ "name": "pr_last_synced_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_github_branch_prs_org": {
+ "name": "UQ_github_branch_prs_org",
+ "columns": [
+ {
+ "expression": "git_url",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "git_branch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"github_branch_pull_requests\".\"owned_by_organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_github_branch_prs_user": {
+ "name": "UQ_github_branch_prs_user",
+ "columns": [
+ {
+ "expression": "git_url",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "git_branch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"github_branch_pull_requests\".\"owned_by_user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_github_branch_prs_url_branch": {
+ "name": "IDX_github_branch_prs_url_branch",
+ "columns": [
+ {
+ "expression": "git_url",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "git_branch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "github_branch_pull_requests_owned_by_organization_id_organizations_id_fk": {
+ "name": "github_branch_pull_requests_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "github_branch_pull_requests",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "github_branch_pull_requests_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "github_branch_pull_requests_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "github_branch_pull_requests",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "github_branch_pull_requests_owner_check": {
+ "name": "github_branch_pull_requests_owner_check",
+ "value": "(\n (\"github_branch_pull_requests\".\"owned_by_organization_id\" IS NOT NULL AND \"github_branch_pull_requests\".\"owned_by_user_id\" IS NULL) OR\n (\"github_branch_pull_requests\".\"owned_by_organization_id\" IS NULL AND \"github_branch_pull_requests\".\"owned_by_user_id\" IS NOT NULL)\n )"
+ },
+ "github_branch_pull_requests_review_decision_check": {
+ "name": "github_branch_pull_requests_review_decision_check",
+ "value": "\"github_branch_pull_requests\".\"pr_review_decision\" IS NULL OR \"github_branch_pull_requests\".\"pr_review_decision\" IN ('approved', 'changes_requested', 'review_required')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.github_install_states": {
+ "name": "github_install_states",
+ "schema": "",
+ "columns": {
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_type": {
+ "name": "owner_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_app_type": {
+ "name": "github_app_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "return_to": {
+ "name": "return_to",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_github_install_states_expires_at": {
+ "name": "IDX_github_install_states_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "github_install_states_kilo_user_id_kilocode_users_id_fk": {
+ "name": "github_install_states_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "github_install_states",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "github_install_states_owner_type_check": {
+ "name": "github_install_states_owner_type_check",
+ "value": "\"github_install_states\".\"owner_type\" IN ('org', 'user')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.http_ip": {
+ "name": "http_ip",
+ "schema": "",
+ "columns": {
+ "http_ip_id": {
+ "name": "http_ip_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "http_ip": {
+ "name": "http_ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_http_ip": {
+ "name": "UQ_http_ip",
+ "columns": [
+ {
+ "expression": "http_ip",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.http_user_agent": {
+ "name": "http_user_agent",
+ "schema": "",
+ "columns": {
+ "http_user_agent_id": {
+ "name": "http_user_agent_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "http_user_agent": {
+ "name": "http_user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_http_user_agent": {
+ "name": "UQ_http_user_agent",
+ "columns": [
+ {
+ "expression": "http_user_agent",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.impact_advocate_participants": {
+ "name": "impact_advocate_participants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "program_key": {
+ "name": "program_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw'"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "advocate_id": {
+ "name": "advocate_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "advocate_account_id": {
+ "name": "advocate_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "opaque_referral_identifier": {
+ "name": "opaque_referral_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locale": {
+ "name": "locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country_code": {
+ "name": "country_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "registration_state": {
+ "name": "registration_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "registered_at": {
+ "name": "registered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_registration_attempt_at": {
+ "name": "last_registration_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_message": {
+ "name": "last_error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_impact_advocate_participants_program_referral_identifier": {
+ "name": "UQ_impact_advocate_participants_program_referral_identifier",
+ "columns": [
+ {
+ "expression": "program_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "opaque_referral_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"impact_advocate_participants\".\"opaque_referral_identifier\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_advocate_participants_registration_state": {
+ "name": "IDX_impact_advocate_participants_registration_state",
+ "columns": [
+ {
+ "expression": "registration_state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_advocate_participants_user_id_kilocode_users_id_fk": {
+ "name": "impact_advocate_participants_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_advocate_participants",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_impact_advocate_participants_program_user": {
+ "name": "UQ_impact_advocate_participants_program_user",
+ "nullsNotDistinct": false,
+ "columns": [
+ "program_key",
+ "user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "impact_advocate_participants_program_key_check": {
+ "name": "impact_advocate_participants_program_key_check",
+ "value": "\"impact_advocate_participants\".\"program_key\" IN ('kiloclaw', 'kilo_pass')"
+ },
+ "impact_advocate_participants_registration_state_check": {
+ "name": "impact_advocate_participants_registration_state_check",
+ "value": "\"impact_advocate_participants\".\"registration_state\" IN ('pending', 'retrying', 'registered', 'failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.impact_advocate_registration_attempts": {
+ "name": "impact_advocate_registration_attempts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "program_key": {
+ "name": "program_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw'"
+ },
+ "participant_id": {
+ "name": "participant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dedupe_key": {
+ "name": "dedupe_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "opaque_cookie_value": {
+ "name": "opaque_cookie_value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cookie_value_length": {
+ "name": "cookie_value_length",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivery_state": {
+ "name": "delivery_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "request_payload": {
+ "name": "request_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_payload": {
+ "name": "response_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_status_code": {
+ "name": "response_status_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_impact_advocate_registration_attempts_participant_id": {
+ "name": "IDX_impact_advocate_registration_attempts_participant_id",
+ "columns": [
+ {
+ "expression": "participant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_advocate_registration_attempts_delivery_state": {
+ "name": "IDX_impact_advocate_registration_attempts_delivery_state",
+ "columns": [
+ {
+ "expression": "delivery_state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_advocate_registration_attempts_participant_id_impact_advocate_participants_id_fk": {
+ "name": "impact_advocate_registration_attempts_participant_id_impact_advocate_participants_id_fk",
+ "tableFrom": "impact_advocate_registration_attempts",
+ "tableTo": "impact_advocate_participants",
+ "columnsFrom": [
+ "participant_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_impact_advocate_registration_attempts_dedupe_key": {
+ "name": "UQ_impact_advocate_registration_attempts_dedupe_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "dedupe_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "impact_advocate_registration_attempts_program_key_check": {
+ "name": "impact_advocate_registration_attempts_program_key_check",
+ "value": "\"impact_advocate_registration_attempts\".\"program_key\" IN ('kiloclaw', 'kilo_pass')"
+ },
+ "impact_advocate_registration_attempts_delivery_state_check": {
+ "name": "impact_advocate_registration_attempts_delivery_state_check",
+ "value": "\"impact_advocate_registration_attempts\".\"delivery_state\" IN ('queued', 'sending', 'succeeded', 'failed')"
+ },
+ "impact_advocate_registration_attempts_cookie_value_length_non_negative_check": {
+ "name": "impact_advocate_registration_attempts_cookie_value_length_non_negative_check",
+ "value": "\"impact_advocate_registration_attempts\".\"cookie_value_length\" >= 0"
+ },
+ "impact_advocate_registration_attempts_attempt_count_non_negative_check": {
+ "name": "impact_advocate_registration_attempts_attempt_count_non_negative_check",
+ "value": "\"impact_advocate_registration_attempts\".\"attempt_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.impact_advocate_reward_redemptions": {
+ "name": "impact_advocate_reward_redemptions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "reward_id": {
+ "name": "reward_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dedupe_key": {
+ "name": "dedupe_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "beneficiary_user_id": {
+ "name": "beneficiary_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "impact_reward_id": {
+ "name": "impact_reward_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_payload": {
+ "name": "request_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lookup_response_payload": {
+ "name": "lookup_response_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redeem_response_payload": {
+ "name": "redeem_response_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_status_code": {
+ "name": "response_status_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redeemed_at": {
+ "name": "redeemed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_impact_advocate_reward_redemptions_beneficiary_user_id": {
+ "name": "IDX_impact_advocate_reward_redemptions_beneficiary_user_id",
+ "columns": [
+ {
+ "expression": "beneficiary_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_advocate_reward_redemptions_state": {
+ "name": "IDX_impact_advocate_reward_redemptions_state",
+ "columns": [
+ {
+ "expression": "state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_advocate_reward_redemptions_reward_id_impact_referral_rewards_id_fk": {
+ "name": "impact_advocate_reward_redemptions_reward_id_impact_referral_rewards_id_fk",
+ "tableFrom": "impact_advocate_reward_redemptions",
+ "tableTo": "impact_referral_rewards",
+ "columnsFrom": [
+ "reward_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "impact_advocate_reward_redemptions_beneficiary_user_id_kilocode_users_id_fk": {
+ "name": "impact_advocate_reward_redemptions_beneficiary_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_advocate_reward_redemptions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "beneficiary_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_impact_advocate_reward_redemptions_reward_id": {
+ "name": "UQ_impact_advocate_reward_redemptions_reward_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "reward_id"
+ ]
+ },
+ "UQ_impact_advocate_reward_redemptions_dedupe_key": {
+ "name": "UQ_impact_advocate_reward_redemptions_dedupe_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "dedupe_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "impact_advocate_reward_redemptions_state_check": {
+ "name": "impact_advocate_reward_redemptions_state_check",
+ "value": "\"impact_advocate_reward_redemptions\".\"state\" IN ('queued', 'retrying', 'redeemed', 'failed')"
+ },
+ "impact_advocate_reward_redemptions_attempt_count_non_negative_check": {
+ "name": "impact_advocate_reward_redemptions_attempt_count_non_negative_check",
+ "value": "\"impact_advocate_reward_redemptions\".\"attempt_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.impact_attribution_touches": {
+ "name": "impact_attribution_touches",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "product": {
+ "name": "product",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw'"
+ },
+ "program_key": {
+ "name": "program_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'kiloclaw'"
+ },
+ "dedupe_key": {
+ "name": "dedupe_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "anonymous_id": {
+ "name": "anonymous_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "touch_type": {
+ "name": "touch_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "opaque_tracking_value": {
+ "name": "opaque_tracking_value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tracking_value_length": {
+ "name": "tracking_value_length",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_tracking_value_accepted": {
+ "name": "is_tracking_value_accepted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "rs_code": {
+ "name": "rs_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rs_share_medium": {
+ "name": "rs_share_medium",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rs_engagement_medium": {
+ "name": "rs_engagement_medium",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "im_ref": {
+ "name": "im_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "landing_path": {
+ "name": "landing_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "utm_source": {
+ "name": "utm_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "utm_medium": {
+ "name": "utm_medium",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "utm_campaign": {
+ "name": "utm_campaign",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "utm_term": {
+ "name": "utm_term",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "utm_content": {
+ "name": "utm_content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "touched_at": {
+ "name": "touched_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sale_attributed_at": {
+ "name": "sale_attributed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_impact_attribution_touches_product_user_id": {
+ "name": "IDX_impact_attribution_touches_product_user_id",
+ "columns": [
+ {
+ "expression": "product",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_attribution_touches_user_id": {
+ "name": "IDX_impact_attribution_touches_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_attribution_touches_anonymous_id": {
+ "name": "IDX_impact_attribution_touches_anonymous_id",
+ "columns": [
+ {
+ "expression": "anonymous_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_attribution_touches_expires_at": {
+ "name": "IDX_impact_attribution_touches_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_attribution_touches_sale_attributed_at": {
+ "name": "IDX_impact_attribution_touches_sale_attributed_at",
+ "columns": [
+ {
+ "expression": "sale_attributed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_attribution_touches_user_id_kilocode_users_id_fk": {
+ "name": "impact_attribution_touches_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_attribution_touches",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_impact_attribution_touches_dedupe_key": {
+ "name": "UQ_impact_attribution_touches_dedupe_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "dedupe_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "impact_attribution_touches_product_check": {
+ "name": "impact_attribution_touches_product_check",
+ "value": "\"impact_attribution_touches\".\"product\" IN ('kiloclaw', 'kilo_pass')"
+ },
+ "impact_attribution_touches_program_key_check": {
+ "name": "impact_attribution_touches_program_key_check",
+ "value": "\"impact_attribution_touches\".\"program_key\" IN ('kiloclaw', 'kilo_pass')"
+ },
+ "impact_attribution_touches_touch_type_check": {
+ "name": "impact_attribution_touches_touch_type_check",
+ "value": "\"impact_attribution_touches\".\"touch_type\" IN ('affiliate', 'referral')"
+ },
+ "impact_attribution_touches_provider_check": {
+ "name": "impact_attribution_touches_provider_check",
+ "value": "\"impact_attribution_touches\".\"provider\" IN ('impact_performance', 'impact_advocate')"
+ },
+ "impact_attribution_touches_tracking_value_length_non_negative_check": {
+ "name": "impact_attribution_touches_tracking_value_length_non_negative_check",
+ "value": "\"impact_attribution_touches\".\"tracking_value_length\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.impact_conversion_reports": {
+ "name": "impact_conversion_reports",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "conversion_id": {
+ "name": "conversion_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dedupe_key": {
+ "name": "dedupe_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action_tracker_id": {
+ "name": "action_tracker_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "order_id": {
+ "name": "order_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "request_payload": {
+ "name": "request_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_payload": {
+ "name": "response_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_status_code": {
+ "name": "response_status_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_impact_conversion_reports_conversion_id": {
+ "name": "IDX_impact_conversion_reports_conversion_id",
+ "columns": [
+ {
+ "expression": "conversion_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_conversion_reports_state": {
+ "name": "IDX_impact_conversion_reports_state",
+ "columns": [
+ {
+ "expression": "state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_conversion_reports_conversion_id_impact_referral_conversions_id_fk": {
+ "name": "impact_conversion_reports_conversion_id_impact_referral_conversions_id_fk",
+ "tableFrom": "impact_conversion_reports",
+ "tableTo": "impact_referral_conversions",
+ "columnsFrom": [
+ "conversion_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_impact_conversion_reports_dedupe_key": {
+ "name": "UQ_impact_conversion_reports_dedupe_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "dedupe_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "impact_conversion_reports_state_check": {
+ "name": "impact_conversion_reports_state_check",
+ "value": "\"impact_conversion_reports\".\"state\" IN ('queued', 'retrying', 'delivered', 'failed')"
+ },
+ "impact_conversion_reports_attempt_count_non_negative_check": {
+ "name": "impact_conversion_reports_attempt_count_non_negative_check",
+ "value": "\"impact_conversion_reports\".\"attempt_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.impact_referral_conversions": {
+ "name": "impact_referral_conversions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "product": {
+ "name": "product",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw'"
+ },
+ "referee_user_id": {
+ "name": "referee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "referrer_user_id": {
+ "name": "referrer_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_touch_id": {
+ "name": "source_touch_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "winning_touch_type": {
+ "name": "winning_touch_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payment_provider": {
+ "name": "payment_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'credits'"
+ },
+ "source_payment_id": {
+ "name": "source_payment_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "qualified": {
+ "name": "qualified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "disqualification_reason": {
+ "name": "disqualification_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "converted_at": {
+ "name": "converted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_impact_referral_conversions_referee_user_id": {
+ "name": "IDX_impact_referral_conversions_referee_user_id",
+ "columns": [
+ {
+ "expression": "referee_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_referral_conversions_referrer_user_id": {
+ "name": "IDX_impact_referral_conversions_referrer_user_id",
+ "columns": [
+ {
+ "expression": "referrer_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_referral_conversions_referee_user_id_kilocode_users_id_fk": {
+ "name": "impact_referral_conversions_referee_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_referral_conversions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "referee_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "impact_referral_conversions_referrer_user_id_kilocode_users_id_fk": {
+ "name": "impact_referral_conversions_referrer_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_referral_conversions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "referrer_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "impact_referral_conversions_source_touch_id_impact_attribution_touches_id_fk": {
+ "name": "impact_referral_conversions_source_touch_id_impact_attribution_touches_id_fk",
+ "tableFrom": "impact_referral_conversions",
+ "tableTo": "impact_attribution_touches",
+ "columnsFrom": [
+ "source_touch_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_impact_referral_conversions_product_payment_source": {
+ "name": "UQ_impact_referral_conversions_product_payment_source",
+ "nullsNotDistinct": false,
+ "columns": [
+ "product",
+ "payment_provider",
+ "source_payment_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "impact_referral_conversions_product_check": {
+ "name": "impact_referral_conversions_product_check",
+ "value": "\"impact_referral_conversions\".\"product\" IN ('kiloclaw', 'kilo_pass')"
+ },
+ "impact_referral_conversions_winning_touch_type_check": {
+ "name": "impact_referral_conversions_winning_touch_type_check",
+ "value": "\"impact_referral_conversions\".\"winning_touch_type\" IN ('referral', 'affiliate', 'none')"
+ },
+ "impact_referral_conversions_payment_provider_check": {
+ "name": "impact_referral_conversions_payment_provider_check",
+ "value": "\"impact_referral_conversions\".\"payment_provider\" IN ('stripe', 'credits', 'app_store', 'google_play')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.impact_referral_reward_applications": {
+ "name": "impact_referral_reward_applications",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "product": {
+ "name": "product",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw'"
+ },
+ "reward_id": {
+ "name": "reward_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "beneficiary_user_id": {
+ "name": "beneficiary_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "previous_renewal_boundary": {
+ "name": "previous_renewal_boundary",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "new_renewal_boundary": {
+ "name": "new_renewal_boundary",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "local_operation_id": {
+ "name": "local_operation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_operation_id": {
+ "name": "stripe_operation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_idempotency_key": {
+ "name": "stripe_idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_impact_referral_reward_applications_reward_id": {
+ "name": "IDX_impact_referral_reward_applications_reward_id",
+ "columns": [
+ {
+ "expression": "reward_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_referral_reward_applications_beneficiary_user_id": {
+ "name": "IDX_impact_referral_reward_applications_beneficiary_user_id",
+ "columns": [
+ {
+ "expression": "beneficiary_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_referral_reward_applications_reward_id_impact_referral_rewards_id_fk": {
+ "name": "impact_referral_reward_applications_reward_id_impact_referral_rewards_id_fk",
+ "tableFrom": "impact_referral_reward_applications",
+ "tableTo": "impact_referral_rewards",
+ "columnsFrom": [
+ "reward_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "impact_referral_reward_applications_beneficiary_user_id_kilocode_users_id_fk": {
+ "name": "impact_referral_reward_applications_beneficiary_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_referral_reward_applications",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "beneficiary_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "impact_referral_reward_applications_product_check": {
+ "name": "impact_referral_reward_applications_product_check",
+ "value": "\"impact_referral_reward_applications\".\"product\" IN ('kiloclaw', 'kilo_pass')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.impact_referral_reward_decisions": {
+ "name": "impact_referral_reward_decisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "product": {
+ "name": "product",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw'"
+ },
+ "conversion_id": {
+ "name": "conversion_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "beneficiary_user_id": {
+ "name": "beneficiary_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "beneficiary_role": {
+ "name": "beneficiary_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reward_kind": {
+ "name": "reward_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw_free_month'"
+ },
+ "months_granted": {
+ "name": "months_granted",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "reward_percent": {
+ "name": "reward_percent",
+ "type": "numeric(6, 4)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_tier": {
+ "name": "source_tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reward_amount_usd": {
+ "name": "reward_amount_usd",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_impact_referral_reward_decisions_beneficiary_user_id": {
+ "name": "IDX_impact_referral_reward_decisions_beneficiary_user_id",
+ "columns": [
+ {
+ "expression": "beneficiary_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_referral_reward_decisions_conversion_id_impact_referral_conversions_id_fk": {
+ "name": "impact_referral_reward_decisions_conversion_id_impact_referral_conversions_id_fk",
+ "tableFrom": "impact_referral_reward_decisions",
+ "tableTo": "impact_referral_conversions",
+ "columnsFrom": [
+ "conversion_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "impact_referral_reward_decisions_beneficiary_user_id_kilocode_users_id_fk": {
+ "name": "impact_referral_reward_decisions_beneficiary_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_referral_reward_decisions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "beneficiary_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_impact_referral_reward_decisions_conversion_role": {
+ "name": "UQ_impact_referral_reward_decisions_conversion_role",
+ "nullsNotDistinct": false,
+ "columns": [
+ "conversion_id",
+ "beneficiary_role"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "impact_referral_reward_decisions_product_check": {
+ "name": "impact_referral_reward_decisions_product_check",
+ "value": "\"impact_referral_reward_decisions\".\"product\" IN ('kiloclaw', 'kilo_pass')"
+ },
+ "impact_referral_reward_decisions_beneficiary_role_check": {
+ "name": "impact_referral_reward_decisions_beneficiary_role_check",
+ "value": "\"impact_referral_reward_decisions\".\"beneficiary_role\" IN ('referrer', 'referee')"
+ },
+ "impact_referral_reward_decisions_outcome_check": {
+ "name": "impact_referral_reward_decisions_outcome_check",
+ "value": "\"impact_referral_reward_decisions\".\"outcome\" IN ('granted', 'cap_limited', 'disqualified')"
+ },
+ "impact_referral_reward_decisions_reward_kind_check": {
+ "name": "impact_referral_reward_decisions_reward_kind_check",
+ "value": "\"impact_referral_reward_decisions\".\"reward_kind\" IN ('kiloclaw_free_month', 'kilo_pass_bonus')"
+ },
+ "impact_referral_reward_decisions_months_granted_non_negative_check": {
+ "name": "impact_referral_reward_decisions_months_granted_non_negative_check",
+ "value": "\"impact_referral_reward_decisions\".\"months_granted\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.impact_referral_rewards": {
+ "name": "impact_referral_rewards",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "product": {
+ "name": "product",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw'"
+ },
+ "conversion_id": {
+ "name": "conversion_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decision_id": {
+ "name": "decision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "beneficiary_user_id": {
+ "name": "beneficiary_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "beneficiary_role": {
+ "name": "beneficiary_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reward_kind": {
+ "name": "reward_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw_free_month'"
+ },
+ "months_granted": {
+ "name": "months_granted",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "reward_percent": {
+ "name": "reward_percent",
+ "type": "numeric(6, 4)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_tier": {
+ "name": "source_tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reward_amount_usd": {
+ "name": "reward_amount_usd",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "applies_to_subscription_id": {
+ "name": "applies_to_subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "applies_to_kilo_pass_subscription_id": {
+ "name": "applies_to_kilo_pass_subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consumed_kilo_pass_issuance_id": {
+ "name": "consumed_kilo_pass_issuance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consumed_kilo_pass_issuance_item_id": {
+ "name": "consumed_kilo_pass_issuance_item_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "earned_at": {
+ "name": "earned_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reversed_at": {
+ "name": "reversed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "review_reason": {
+ "name": "review_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_impact_referral_rewards_beneficiary_user_id": {
+ "name": "IDX_impact_referral_rewards_beneficiary_user_id",
+ "columns": [
+ {
+ "expression": "beneficiary_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_referral_rewards_status": {
+ "name": "IDX_impact_referral_rewards_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_referral_rewards_conversion_id_impact_referral_conversions_id_fk": {
+ "name": "impact_referral_rewards_conversion_id_impact_referral_conversions_id_fk",
+ "tableFrom": "impact_referral_rewards",
+ "tableTo": "impact_referral_conversions",
+ "columnsFrom": [
+ "conversion_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "impact_referral_rewards_decision_id_impact_referral_reward_decisions_id_fk": {
+ "name": "impact_referral_rewards_decision_id_impact_referral_reward_decisions_id_fk",
+ "tableFrom": "impact_referral_rewards",
+ "tableTo": "impact_referral_reward_decisions",
+ "columnsFrom": [
+ "decision_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "impact_referral_rewards_beneficiary_user_id_kilocode_users_id_fk": {
+ "name": "impact_referral_rewards_beneficiary_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_referral_rewards",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "beneficiary_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "FK_impact_referral_rewards_kilo_pass_subscription": {
+ "name": "FK_impact_referral_rewards_kilo_pass_subscription",
+ "tableFrom": "impact_referral_rewards",
+ "tableTo": "kilo_pass_subscriptions",
+ "columnsFrom": [
+ "applies_to_kilo_pass_subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "FK_impact_referral_rewards_kilo_pass_issuance": {
+ "name": "FK_impact_referral_rewards_kilo_pass_issuance",
+ "tableFrom": "impact_referral_rewards",
+ "tableTo": "kilo_pass_issuances",
+ "columnsFrom": [
+ "consumed_kilo_pass_issuance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "FK_impact_referral_rewards_kilo_pass_issuance_item": {
+ "name": "FK_impact_referral_rewards_kilo_pass_issuance_item",
+ "tableFrom": "impact_referral_rewards",
+ "tableTo": "kilo_pass_issuance_items",
+ "columnsFrom": [
+ "consumed_kilo_pass_issuance_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_impact_referral_rewards_conversion_role": {
+ "name": "UQ_impact_referral_rewards_conversion_role",
+ "nullsNotDistinct": false,
+ "columns": [
+ "conversion_id",
+ "beneficiary_role"
+ ]
+ },
+ "UQ_impact_referral_rewards_decision_id": {
+ "name": "UQ_impact_referral_rewards_decision_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "decision_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "impact_referral_rewards_product_check": {
+ "name": "impact_referral_rewards_product_check",
+ "value": "\"impact_referral_rewards\".\"product\" IN ('kiloclaw', 'kilo_pass')"
+ },
+ "impact_referral_rewards_beneficiary_role_check": {
+ "name": "impact_referral_rewards_beneficiary_role_check",
+ "value": "\"impact_referral_rewards\".\"beneficiary_role\" IN ('referrer', 'referee')"
+ },
+ "impact_referral_rewards_reward_kind_check": {
+ "name": "impact_referral_rewards_reward_kind_check",
+ "value": "\"impact_referral_rewards\".\"reward_kind\" IN ('kiloclaw_free_month', 'kilo_pass_bonus')"
+ },
+ "impact_referral_rewards_status_check": {
+ "name": "impact_referral_rewards_status_check",
+ "value": "\"impact_referral_rewards\".\"status\" IN ('pending', 'earned', 'applied', 'reversed', 'expired', 'canceled', 'review_required')"
+ },
+ "impact_referral_rewards_months_granted_non_negative_check": {
+ "name": "impact_referral_rewards_months_granted_non_negative_check",
+ "value": "\"impact_referral_rewards\".\"months_granted\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.impact_referrals": {
+ "name": "impact_referrals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "product": {
+ "name": "product",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kiloclaw'"
+ },
+ "referee_user_id": {
+ "name": "referee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "referrer_user_id": {
+ "name": "referrer_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_touch_id": {
+ "name": "source_touch_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "impact_referral_id": {
+ "name": "impact_referral_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_impact_referrals_referrer_user_id": {
+ "name": "IDX_impact_referrals_referrer_user_id",
+ "columns": [
+ {
+ "expression": "referrer_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_impact_referrals_source_touch_id": {
+ "name": "IDX_impact_referrals_source_touch_id",
+ "columns": [
+ {
+ "expression": "source_touch_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "impact_referrals_referee_user_id_kilocode_users_id_fk": {
+ "name": "impact_referrals_referee_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_referrals",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "referee_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "impact_referrals_referrer_user_id_kilocode_users_id_fk": {
+ "name": "impact_referrals_referrer_user_id_kilocode_users_id_fk",
+ "tableFrom": "impact_referrals",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "referrer_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "impact_referrals_source_touch_id_impact_attribution_touches_id_fk": {
+ "name": "impact_referrals_source_touch_id_impact_attribution_touches_id_fk",
+ "tableFrom": "impact_referrals",
+ "tableTo": "impact_attribution_touches",
+ "columnsFrom": [
+ "source_touch_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_impact_referrals_product_referee_user_id": {
+ "name": "UQ_impact_referrals_product_referee_user_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "product",
+ "referee_user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "impact_referrals_product_check": {
+ "name": "impact_referrals_product_check",
+ "value": "\"impact_referrals\".\"product\" IN ('kiloclaw', 'kilo_pass')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.ja4_digest": {
+ "name": "ja4_digest",
+ "schema": "",
+ "columns": {
+ "ja4_digest_id": {
+ "name": "ja4_digest_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ja4_digest": {
+ "name": "ja4_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_ja4_digest": {
+ "name": "UQ_ja4_digest",
+ "columns": [
+ {
+ "expression": "ja4_digest",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_audit_log": {
+ "name": "kilo_pass_audit_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kilo_pass_subscription_id": {
+ "name": "kilo_pass_subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "result": {
+ "name": "result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_event_id": {
+ "name": "stripe_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_invoice_id": {
+ "name": "stripe_invoice_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_subscription_id": {
+ "name": "stripe_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "related_credit_transaction_id": {
+ "name": "related_credit_transaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "related_monthly_issuance_id": {
+ "name": "related_monthly_issuance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ }
+ },
+ "indexes": {
+ "IDX_kilo_pass_audit_log_created_at": {
+ "name": "IDX_kilo_pass_audit_log_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_kilo_user_id": {
+ "name": "IDX_kilo_pass_audit_log_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_kilo_pass_subscription_id": {
+ "name": "IDX_kilo_pass_audit_log_kilo_pass_subscription_id",
+ "columns": [
+ {
+ "expression": "kilo_pass_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_action": {
+ "name": "IDX_kilo_pass_audit_log_action",
+ "columns": [
+ {
+ "expression": "action",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_result": {
+ "name": "IDX_kilo_pass_audit_log_result",
+ "columns": [
+ {
+ "expression": "result",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_idempotency_key": {
+ "name": "IDX_kilo_pass_audit_log_idempotency_key",
+ "columns": [
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_stripe_event_id": {
+ "name": "IDX_kilo_pass_audit_log_stripe_event_id",
+ "columns": [
+ {
+ "expression": "stripe_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_stripe_invoice_id": {
+ "name": "IDX_kilo_pass_audit_log_stripe_invoice_id",
+ "columns": [
+ {
+ "expression": "stripe_invoice_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_stripe_subscription_id": {
+ "name": "IDX_kilo_pass_audit_log_stripe_subscription_id",
+ "columns": [
+ {
+ "expression": "stripe_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_related_credit_transaction_id": {
+ "name": "IDX_kilo_pass_audit_log_related_credit_transaction_id",
+ "columns": [
+ {
+ "expression": "related_credit_transaction_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_audit_log_related_monthly_issuance_id": {
+ "name": "IDX_kilo_pass_audit_log_related_monthly_issuance_id",
+ "columns": [
+ {
+ "expression": "related_monthly_issuance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_audit_log_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kilo_pass_audit_log_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kilo_pass_audit_log",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_audit_log_kilo_pass_subscription_id_kilo_pass_subscriptions_id_fk": {
+ "name": "kilo_pass_audit_log_kilo_pass_subscription_id_kilo_pass_subscriptions_id_fk",
+ "tableFrom": "kilo_pass_audit_log",
+ "tableTo": "kilo_pass_subscriptions",
+ "columnsFrom": [
+ "kilo_pass_subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_audit_log_related_credit_transaction_id_credit_transactions_id_fk": {
+ "name": "kilo_pass_audit_log_related_credit_transaction_id_credit_transactions_id_fk",
+ "tableFrom": "kilo_pass_audit_log",
+ "tableTo": "credit_transactions",
+ "columnsFrom": [
+ "related_credit_transaction_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_audit_log_related_monthly_issuance_id_kilo_pass_issuances_id_fk": {
+ "name": "kilo_pass_audit_log_related_monthly_issuance_id_kilo_pass_issuances_id_fk",
+ "tableFrom": "kilo_pass_audit_log",
+ "tableTo": "kilo_pass_issuances",
+ "columnsFrom": [
+ "related_monthly_issuance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_audit_log_action_check": {
+ "name": "kilo_pass_audit_log_action_check",
+ "value": "\"kilo_pass_audit_log\".\"action\" IN ('stripe_webhook_received', 'kilo_pass_invoice_paid_handled', 'store_purchase_completed', 'store_notification_received', 'store_subscription_renewed', 'store_subscription_canceled', 'store_subscription_expired', 'store_subscription_refunded', 'base_credits_issued', 'bonus_credits_issued', 'bonus_credits_skipped_idempotent', 'first_month_50pct_promo_issued', 'yearly_monthly_base_cron_started', 'yearly_monthly_base_cron_completed', 'issue_yearly_remaining_credits', 'duplicate_card_subscription_canceled', 'yearly_monthly_bonus_cron_started', 'yearly_monthly_bonus_cron_completed')"
+ },
+ "kilo_pass_audit_log_result_check": {
+ "name": "kilo_pass_audit_log_result_check",
+ "value": "\"kilo_pass_audit_log\".\"result\" IN ('success', 'skipped_idempotent', 'failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_issuance_items": {
+ "name": "kilo_pass_issuance_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_pass_issuance_id": {
+ "name": "kilo_pass_issuance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credit_transaction_id": {
+ "name": "credit_transaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_usd": {
+ "name": "amount_usd",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bonus_percent_applied": {
+ "name": "bonus_percent_applied",
+ "type": "numeric(6, 4)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kilo_pass_issuance_items_issuance_id": {
+ "name": "IDX_kilo_pass_issuance_items_issuance_id",
+ "columns": [
+ {
+ "expression": "kilo_pass_issuance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_issuance_items_credit_transaction_id": {
+ "name": "IDX_kilo_pass_issuance_items_credit_transaction_id",
+ "columns": [
+ {
+ "expression": "credit_transaction_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_issuance_items_kilo_pass_issuance_id_kilo_pass_issuances_id_fk": {
+ "name": "kilo_pass_issuance_items_kilo_pass_issuance_id_kilo_pass_issuances_id_fk",
+ "tableFrom": "kilo_pass_issuance_items",
+ "tableTo": "kilo_pass_issuances",
+ "columnsFrom": [
+ "kilo_pass_issuance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_issuance_items_credit_transaction_id_credit_transactions_id_fk": {
+ "name": "kilo_pass_issuance_items_credit_transaction_id_credit_transactions_id_fk",
+ "tableFrom": "kilo_pass_issuance_items",
+ "tableTo": "credit_transactions",
+ "columnsFrom": [
+ "credit_transaction_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "kilo_pass_issuance_items_credit_transaction_id_unique": {
+ "name": "kilo_pass_issuance_items_credit_transaction_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "credit_transaction_id"
+ ]
+ },
+ "UQ_kilo_pass_issuance_items_issuance_kind": {
+ "name": "UQ_kilo_pass_issuance_items_issuance_kind",
+ "nullsNotDistinct": false,
+ "columns": [
+ "kilo_pass_issuance_id",
+ "kind"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_issuance_items_bonus_percent_applied_range_check": {
+ "name": "kilo_pass_issuance_items_bonus_percent_applied_range_check",
+ "value": "\"kilo_pass_issuance_items\".\"bonus_percent_applied\" IS NULL OR (\"kilo_pass_issuance_items\".\"bonus_percent_applied\" >= 0 AND \"kilo_pass_issuance_items\".\"bonus_percent_applied\" <= 1)"
+ },
+ "kilo_pass_issuance_items_amount_usd_non_negative_check": {
+ "name": "kilo_pass_issuance_items_amount_usd_non_negative_check",
+ "value": "\"kilo_pass_issuance_items\".\"amount_usd\" >= 0"
+ },
+ "kilo_pass_issuance_items_kind_check": {
+ "name": "kilo_pass_issuance_items_kind_check",
+ "value": "\"kilo_pass_issuance_items\".\"kind\" IN ('base', 'bonus', 'promo_first_month_50pct', 'referral_bonus')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_issuances": {
+ "name": "kilo_pass_issuances",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_pass_subscription_id": {
+ "name": "kilo_pass_subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_month": {
+ "name": "issue_month",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_invoice_id": {
+ "name": "stripe_invoice_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initial_welcome_promo_eligibility_reason": {
+ "name": "initial_welcome_promo_eligibility_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kilo_pass_issuances_stripe_invoice_id": {
+ "name": "UQ_kilo_pass_issuances_stripe_invoice_id",
+ "columns": [
+ {
+ "expression": "stripe_invoice_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_issuances\".\"stripe_invoice_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_issuances_subscription_id": {
+ "name": "IDX_kilo_pass_issuances_subscription_id",
+ "columns": [
+ {
+ "expression": "kilo_pass_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_issuances_issue_month": {
+ "name": "IDX_kilo_pass_issuances_issue_month",
+ "columns": [
+ {
+ "expression": "issue_month",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_issuances_kilo_pass_subscription_id_kilo_pass_subscriptions_id_fk": {
+ "name": "kilo_pass_issuances_kilo_pass_subscription_id_kilo_pass_subscriptions_id_fk",
+ "tableFrom": "kilo_pass_issuances",
+ "tableTo": "kilo_pass_subscriptions",
+ "columnsFrom": [
+ "kilo_pass_subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_issuances_subscription_issue_month": {
+ "name": "UQ_kilo_pass_issuances_subscription_issue_month",
+ "nullsNotDistinct": false,
+ "columns": [
+ "kilo_pass_subscription_id",
+ "issue_month"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_issuances_issue_month_day_one_check": {
+ "name": "kilo_pass_issuances_issue_month_day_one_check",
+ "value": "EXTRACT(DAY FROM \"kilo_pass_issuances\".\"issue_month\") = 1"
+ },
+ "kilo_pass_issuances_source_check": {
+ "name": "kilo_pass_issuances_source_check",
+ "value": "\"kilo_pass_issuances\".\"source\" IN ('stripe_invoice', 'app_store_transaction', 'google_play_transaction', 'cron')"
+ },
+ "kilo_pass_issuances_initial_welcome_promo_reason_check": {
+ "name": "kilo_pass_issuances_initial_welcome_promo_reason_check",
+ "value": "\"kilo_pass_issuances\".\"initial_welcome_promo_eligibility_reason\" IN ('first_payment_fingerprint_claim', 'fingerprint_previously_claimed', 'missing_fingerprint', 'no_supported_fingerprint', 'no_positive_settlement', 'settlement_unresolved')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_agreements": {
+ "name": "kilo_pass_org_agreements",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "parent_organization_id": {
+ "name": "parent_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "term_version_id": {
+ "name": "term_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "processing_condition": {
+ "name": "processing_condition",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ready'"
+ },
+ "purchase_channel": {
+ "name": "purchase_channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cadence": {
+ "name": "cadence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "purchased_pass_capacity": {
+ "name": "purchased_pass_capacity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "next_purchased_pass_capacity": {
+ "name": "next_purchased_pass_capacity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_capacity_effective_at": {
+ "name": "next_capacity_effective_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "paid_from": {
+ "name": "paid_from",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "paid_until": {
+ "name": "paid_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issuance_anchor_at": {
+ "name": "issuance_anchor_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_subscription_id": {
+ "name": "provider_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_seat_add_on_item_id": {
+ "name": "provider_seat_add_on_item_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activation_provider_event_id": {
+ "name": "activation_provider_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_contract_id": {
+ "name": "external_contract_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payment_review_required_at": {
+ "name": "payment_review_required_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancellation_effective_at": {
+ "name": "cancellation_effective_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manually_issued_through": {
+ "name": "manually_issued_through",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kilo_pass_org_agreements_one_non_ended_parent": {
+ "name": "UQ_kilo_pass_org_agreements_one_non_ended_parent",
+ "columns": [
+ {
+ "expression": "parent_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_org_agreements\".\"state\" <> 'ended'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilo_pass_org_agreements_provider_subscription": {
+ "name": "UQ_kilo_pass_org_agreements_provider_subscription",
+ "columns": [
+ {
+ "expression": "provider_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_org_agreements\".\"provider_subscription_id\" IS NOT NULL AND \"kilo_pass_org_agreements\".\"state\" <> 'ended'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilo_pass_org_agreements_provider_seat_add_on_item": {
+ "name": "UQ_kilo_pass_org_agreements_provider_seat_add_on_item",
+ "columns": [
+ {
+ "expression": "provider_seat_add_on_item_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_org_agreements\".\"provider_seat_add_on_item_id\" IS NOT NULL AND \"kilo_pass_org_agreements\".\"state\" <> 'ended'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilo_pass_org_agreements_external_contract": {
+ "name": "UQ_kilo_pass_org_agreements_external_contract",
+ "columns": [
+ {
+ "expression": "external_contract_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_org_agreements\".\"external_contract_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilo_pass_org_agreements_activation_provider_event": {
+ "name": "UQ_kilo_pass_org_agreements_activation_provider_event",
+ "columns": [
+ {
+ "expression": "activation_provider_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_org_agreements\".\"activation_provider_event_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_org_agreements_processing": {
+ "name": "IDX_kilo_pass_org_agreements_processing",
+ "columns": [
+ {
+ "expression": "processing_condition",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_org_agreements_parent_organization_id_organizations_id_fk": {
+ "name": "kilo_pass_org_agreements_parent_organization_id_organizations_id_fk",
+ "tableFrom": "kilo_pass_org_agreements",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "parent_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_agreements_term_version_id_kilo_pass_org_term_versions_id_fk": {
+ "name": "kilo_pass_org_agreements_term_version_id_kilo_pass_org_term_versions_id_fk",
+ "tableFrom": "kilo_pass_org_agreements",
+ "tableTo": "kilo_pass_org_term_versions",
+ "columnsFrom": [
+ "term_version_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_agreements_purchased_capacity_non_negative_check": {
+ "name": "kilo_pass_org_agreements_purchased_capacity_non_negative_check",
+ "value": "\"kilo_pass_org_agreements\".\"purchased_pass_capacity\" >= 0"
+ },
+ "kilo_pass_org_agreements_next_capacity_check": {
+ "name": "kilo_pass_org_agreements_next_capacity_check",
+ "value": "(\"kilo_pass_org_agreements\".\"next_purchased_pass_capacity\" IS NULL AND \"kilo_pass_org_agreements\".\"next_capacity_effective_at\" IS NULL) OR (\"kilo_pass_org_agreements\".\"next_purchased_pass_capacity\" >= 0 AND \"kilo_pass_org_agreements\".\"next_capacity_effective_at\" IS NOT NULL)"
+ },
+ "kilo_pass_org_agreements_paid_interval_check": {
+ "name": "kilo_pass_org_agreements_paid_interval_check",
+ "value": "(\"kilo_pass_org_agreements\".\"paid_from\" IS NULL AND \"kilo_pass_org_agreements\".\"paid_until\" IS NULL) OR (\"kilo_pass_org_agreements\".\"paid_from\" IS NOT NULL AND \"kilo_pass_org_agreements\".\"paid_until\" IS NOT NULL AND \"kilo_pass_org_agreements\".\"paid_from\" < \"kilo_pass_org_agreements\".\"paid_until\")"
+ },
+ "kilo_pass_org_agreements_state_check": {
+ "name": "kilo_pass_org_agreements_state_check",
+ "value": "\"kilo_pass_org_agreements\".\"state\" IN ('pending_payment', 'active', 'cancel_at_period_end', 'ended')"
+ },
+ "kilo_pass_org_agreements_processing_condition_check": {
+ "name": "kilo_pass_org_agreements_processing_condition_check",
+ "value": "\"kilo_pass_org_agreements\".\"processing_condition\" IN ('ready', 'manual', 'blocked', 'overallocated', 'failed', 'suspended_for_review')"
+ },
+ "kilo_pass_org_agreements_purchase_channel_check": {
+ "name": "kilo_pass_org_agreements_purchase_channel_check",
+ "value": "\"kilo_pass_org_agreements\".\"purchase_channel\" IN ('self_serve', 'manual')"
+ },
+ "kilo_pass_org_agreements_cadence_check": {
+ "name": "kilo_pass_org_agreements_cadence_check",
+ "value": "\"kilo_pass_org_agreements\".\"cadence\" IN ('monthly', 'yearly')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_allocation_plan_rows": {
+ "name": "kilo_pass_org_allocation_plan_rows",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "allocation_plan_id": {
+ "name": "allocation_plan_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "allocation_container_organization_id": {
+ "name": "allocation_container_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pass_capacity": {
+ "name": "pass_capacity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kilo_pass_org_allocation_plan_rows_positive_container": {
+ "name": "IDX_kilo_pass_org_allocation_plan_rows_positive_container",
+ "columns": [
+ {
+ "expression": "allocation_container_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kilo_pass_org_allocation_plan_rows\".\"pass_capacity\" > 0",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_org_allocation_plan_rows_allocation_plan_id_kilo_pass_org_allocation_plans_id_fk": {
+ "name": "kilo_pass_org_allocation_plan_rows_allocation_plan_id_kilo_pass_org_allocation_plans_id_fk",
+ "tableFrom": "kilo_pass_org_allocation_plan_rows",
+ "tableTo": "kilo_pass_org_allocation_plans",
+ "columnsFrom": [
+ "allocation_plan_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_allocation_plan_rows_allocation_container_organization_id_organizations_id_fk": {
+ "name": "kilo_pass_org_allocation_plan_rows_allocation_container_organization_id_organizations_id_fk",
+ "tableFrom": "kilo_pass_org_allocation_plan_rows",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "allocation_container_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_org_allocation_plan_rows_plan_container": {
+ "name": "UQ_kilo_pass_org_allocation_plan_rows_plan_container",
+ "nullsNotDistinct": false,
+ "columns": [
+ "allocation_plan_id",
+ "allocation_container_organization_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_allocation_plan_rows_capacity_non_negative_check": {
+ "name": "kilo_pass_org_allocation_plan_rows_capacity_non_negative_check",
+ "value": "\"kilo_pass_org_allocation_plan_rows\".\"pass_capacity\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_allocation_plans": {
+ "name": "kilo_pass_org_allocation_plans",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "agreement_id": {
+ "name": "agreement_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "effective_window_start": {
+ "name": "effective_window_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_kilo_user_id": {
+ "name": "created_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "kilo_pass_org_allocation_plans_agreement_id_kilo_pass_org_agreements_id_fk": {
+ "name": "kilo_pass_org_allocation_plans_agreement_id_kilo_pass_org_agreements_id_fk",
+ "tableFrom": "kilo_pass_org_allocation_plans",
+ "tableTo": "kilo_pass_org_agreements",
+ "columnsFrom": [
+ "agreement_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_allocation_plans_created_by_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kilo_pass_org_allocation_plans_created_by_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kilo_pass_org_allocation_plans",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_org_allocation_plans_agreement_window": {
+ "name": "UQ_kilo_pass_org_allocation_plans_agreement_window",
+ "nullsNotDistinct": false,
+ "columns": [
+ "agreement_id",
+ "effective_window_start"
+ ]
+ },
+ "UQ_kilo_pass_org_allocation_plans_agreement_version": {
+ "name": "UQ_kilo_pass_org_allocation_plans_agreement_version",
+ "nullsNotDistinct": false,
+ "columns": [
+ "agreement_id",
+ "version"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_allocation_plans_version_positive_check": {
+ "name": "kilo_pass_org_allocation_plans_version_positive_check",
+ "value": "\"kilo_pass_org_allocation_plans\".\"version\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_audit_records": {
+ "name": "kilo_pass_org_audit_records",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "agreement_id": {
+ "name": "agreement_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_kilo_user_id": {
+ "name": "actor_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "before_json": {
+ "name": "before_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "after_json": {
+ "name": "after_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kilo_pass_org_audit_records_idempotency": {
+ "name": "UQ_kilo_pass_org_audit_records_idempotency",
+ "columns": [
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_org_audit_records\".\"idempotency_key\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_org_audit_records_agreement_created": {
+ "name": "IDX_kilo_pass_org_audit_records_agreement_created",
+ "columns": [
+ {
+ "expression": "agreement_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_org_audit_records_agreement_id_kilo_pass_org_agreements_id_fk": {
+ "name": "kilo_pass_org_audit_records_agreement_id_kilo_pass_org_agreements_id_fk",
+ "tableFrom": "kilo_pass_org_audit_records",
+ "tableTo": "kilo_pass_org_agreements",
+ "columnsFrom": [
+ "agreement_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_audit_records_actor_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kilo_pass_org_audit_records_actor_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kilo_pass_org_audit_records",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "actor_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_issuance_snapshots": {
+ "name": "kilo_pass_org_issuance_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "agreement_id": {
+ "name": "agreement_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "processing_run_id": {
+ "name": "processing_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "allocation_plan_id": {
+ "name": "allocation_plan_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "term_version_id": {
+ "name": "term_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "allocation_container_organization_id": {
+ "name": "allocation_container_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_start": {
+ "name": "window_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_end": {
+ "name": "window_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "qualifying_spend_starts_at": {
+ "name": "qualifying_spend_starts_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tranche_key": {
+ "name": "tranche_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "allocated_pass_capacity": {
+ "name": "allocated_pass_capacity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "base_credit_microdollars": {
+ "name": "base_credit_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bonus_credit_microdollars": {
+ "name": "bonus_credit_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "unlock_spend_microdollars": {
+ "name": "unlock_spend_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "qualifying_spend_microdollars": {
+ "name": "qualifying_spend_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "bonus_mode": {
+ "name": "bonus_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bonus_unlocked_at": {
+ "name": "bonus_unlocked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repair_completed_at": {
+ "name": "repair_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bonus_credit_transaction_id": {
+ "name": "bonus_credit_transaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "base_credit_transaction_id": {
+ "name": "base_credit_transaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kilo_pass_org_issuance_snapshots_base_credit_transaction": {
+ "name": "UQ_kilo_pass_org_issuance_snapshots_base_credit_transaction",
+ "columns": [
+ {
+ "expression": "base_credit_transaction_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_org_issuance_snapshots\".\"base_credit_transaction_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilo_pass_org_issuance_snapshots_bonus_credit_transaction": {
+ "name": "UQ_kilo_pass_org_issuance_snapshots_bonus_credit_transaction",
+ "columns": [
+ {
+ "expression": "bonus_credit_transaction_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_org_issuance_snapshots\".\"bonus_credit_transaction_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_org_issuance_snapshots_window": {
+ "name": "IDX_kilo_pass_org_issuance_snapshots_window",
+ "columns": [
+ {
+ "expression": "agreement_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "window_start",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_org_issuance_snapshots_agreement_id_kilo_pass_org_agreements_id_fk": {
+ "name": "kilo_pass_org_issuance_snapshots_agreement_id_kilo_pass_org_agreements_id_fk",
+ "tableFrom": "kilo_pass_org_issuance_snapshots",
+ "tableTo": "kilo_pass_org_agreements",
+ "columnsFrom": [
+ "agreement_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_issuance_snapshots_processing_run_id_kilo_pass_org_processing_runs_id_fk": {
+ "name": "kilo_pass_org_issuance_snapshots_processing_run_id_kilo_pass_org_processing_runs_id_fk",
+ "tableFrom": "kilo_pass_org_issuance_snapshots",
+ "tableTo": "kilo_pass_org_processing_runs",
+ "columnsFrom": [
+ "processing_run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_issuance_snapshots_allocation_plan_id_kilo_pass_org_allocation_plans_id_fk": {
+ "name": "kilo_pass_org_issuance_snapshots_allocation_plan_id_kilo_pass_org_allocation_plans_id_fk",
+ "tableFrom": "kilo_pass_org_issuance_snapshots",
+ "tableTo": "kilo_pass_org_allocation_plans",
+ "columnsFrom": [
+ "allocation_plan_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_issuance_snapshots_term_version_id_kilo_pass_org_term_versions_id_fk": {
+ "name": "kilo_pass_org_issuance_snapshots_term_version_id_kilo_pass_org_term_versions_id_fk",
+ "tableFrom": "kilo_pass_org_issuance_snapshots",
+ "tableTo": "kilo_pass_org_term_versions",
+ "columnsFrom": [
+ "term_version_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_issuance_snapshots_allocation_container_organization_id_organizations_id_fk": {
+ "name": "kilo_pass_org_issuance_snapshots_allocation_container_organization_id_organizations_id_fk",
+ "tableFrom": "kilo_pass_org_issuance_snapshots",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "allocation_container_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_issuance_snapshots_bonus_credit_transaction_id_credit_transactions_id_fk": {
+ "name": "kilo_pass_org_issuance_snapshots_bonus_credit_transaction_id_credit_transactions_id_fk",
+ "tableFrom": "kilo_pass_org_issuance_snapshots",
+ "tableTo": "credit_transactions",
+ "columnsFrom": [
+ "bonus_credit_transaction_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_issuance_snapshots_base_credit_transaction_id_credit_transactions_id_fk": {
+ "name": "kilo_pass_org_issuance_snapshots_base_credit_transaction_id_credit_transactions_id_fk",
+ "tableFrom": "kilo_pass_org_issuance_snapshots",
+ "tableTo": "credit_transactions",
+ "columnsFrom": [
+ "base_credit_transaction_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_org_issuance_snapshots_container_window_tranche": {
+ "name": "UQ_kilo_pass_org_issuance_snapshots_container_window_tranche",
+ "nullsNotDistinct": false,
+ "columns": [
+ "agreement_id",
+ "allocation_container_organization_id",
+ "window_start",
+ "tranche_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_issuance_snapshots_window_check": {
+ "name": "kilo_pass_org_issuance_snapshots_window_check",
+ "value": "\"kilo_pass_org_issuance_snapshots\".\"window_start\" < \"kilo_pass_org_issuance_snapshots\".\"window_end\""
+ },
+ "kilo_pass_org_issuance_snapshots_qualifying_spend_window_check": {
+ "name": "kilo_pass_org_issuance_snapshots_qualifying_spend_window_check",
+ "value": "\"kilo_pass_org_issuance_snapshots\".\"window_start\" <= \"kilo_pass_org_issuance_snapshots\".\"qualifying_spend_starts_at\" AND \"kilo_pass_org_issuance_snapshots\".\"qualifying_spend_starts_at\" < \"kilo_pass_org_issuance_snapshots\".\"window_end\""
+ },
+ "kilo_pass_org_issuance_snapshots_values_non_negative_check": {
+ "name": "kilo_pass_org_issuance_snapshots_values_non_negative_check",
+ "value": "\"kilo_pass_org_issuance_snapshots\".\"allocated_pass_capacity\" >= 0 AND \"kilo_pass_org_issuance_snapshots\".\"base_credit_microdollars\" >= 0 AND \"kilo_pass_org_issuance_snapshots\".\"bonus_credit_microdollars\" >= 0 AND \"kilo_pass_org_issuance_snapshots\".\"unlock_spend_microdollars\" >= 0 AND \"kilo_pass_org_issuance_snapshots\".\"qualifying_spend_microdollars\" >= 0"
+ },
+ "kilo_pass_org_issuance_snapshots_kind_check": {
+ "name": "kilo_pass_org_issuance_snapshots_kind_check",
+ "value": "\"kilo_pass_org_issuance_snapshots\".\"kind\" IN ('regular', 'bridge', 'supplement')"
+ },
+ "kilo_pass_org_issuance_snapshots_bonus_mode_check": {
+ "name": "kilo_pass_org_issuance_snapshots_bonus_mode_check",
+ "value": "\"kilo_pass_org_issuance_snapshots\".\"bonus_mode\" IN ('after_base', 'upfront')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_notification_deliveries": {
+ "name": "kilo_pass_org_notification_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "processing_run_id": {
+ "name": "processing_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recipient_kilo_user_id": {
+ "name": "recipient_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kilo_pass_org_notification_deliveries_status": {
+ "name": "IDX_kilo_pass_org_notification_deliveries_status",
+ "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": {
+ "kilo_pass_org_notification_deliveries_processing_run_id_kilo_pass_org_processing_runs_id_fk": {
+ "name": "kilo_pass_org_notification_deliveries_processing_run_id_kilo_pass_org_processing_runs_id_fk",
+ "tableFrom": "kilo_pass_org_notification_deliveries",
+ "tableTo": "kilo_pass_org_processing_runs",
+ "columnsFrom": [
+ "processing_run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_notification_deliveries_recipient_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kilo_pass_org_notification_deliveries_recipient_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kilo_pass_org_notification_deliveries",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "recipient_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_org_notification_deliveries_run_recipient": {
+ "name": "UQ_kilo_pass_org_notification_deliveries_run_recipient",
+ "nullsNotDistinct": false,
+ "columns": [
+ "processing_run_id",
+ "recipient_kilo_user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_notification_deliveries_status_check": {
+ "name": "kilo_pass_org_notification_deliveries_status_check",
+ "value": "\"kilo_pass_org_notification_deliveries\".\"status\" IN ('pending', 'sending', 'sent', 'failed')"
+ },
+ "kilo_pass_org_notification_deliveries_attempt_count_check": {
+ "name": "kilo_pass_org_notification_deliveries_attempt_count_check",
+ "value": "\"kilo_pass_org_notification_deliveries\".\"attempt_count\" >= 0"
+ },
+ "kilo_pass_org_notification_deliveries_sent_check": {
+ "name": "kilo_pass_org_notification_deliveries_sent_check",
+ "value": "(\"kilo_pass_org_notification_deliveries\".\"status\" = 'sent' AND \"kilo_pass_org_notification_deliveries\".\"sent_at\" IS NOT NULL AND \"kilo_pass_org_notification_deliveries\".\"lease_expires_at\" IS NULL) OR (\"kilo_pass_org_notification_deliveries\".\"status\" = 'sending' AND \"kilo_pass_org_notification_deliveries\".\"sent_at\" IS NULL AND \"kilo_pass_org_notification_deliveries\".\"lease_expires_at\" IS NOT NULL) OR (\"kilo_pass_org_notification_deliveries\".\"status\" IN ('pending', 'failed') AND \"kilo_pass_org_notification_deliveries\".\"sent_at\" IS NULL AND \"kilo_pass_org_notification_deliveries\".\"lease_expires_at\" IS NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_processing_runs": {
+ "name": "kilo_pass_org_processing_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "agreement_id": {
+ "name": "agreement_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_start": {
+ "name": "window_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_end": {
+ "name": "window_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kilo_pass_org_processing_runs_state_lease": {
+ "name": "IDX_kilo_pass_org_processing_runs_state_lease",
+ "columns": [
+ {
+ "expression": "state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lease_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_org_processing_runs_agreement_id_kilo_pass_org_agreements_id_fk": {
+ "name": "kilo_pass_org_processing_runs_agreement_id_kilo_pass_org_agreements_id_fk",
+ "tableFrom": "kilo_pass_org_processing_runs",
+ "tableTo": "kilo_pass_org_agreements",
+ "columnsFrom": [
+ "agreement_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_org_processing_runs_agreement_window": {
+ "name": "UQ_kilo_pass_org_processing_runs_agreement_window",
+ "nullsNotDistinct": false,
+ "columns": [
+ "agreement_id",
+ "window_start"
+ ]
+ },
+ "UQ_kilo_pass_org_processing_runs_idempotency": {
+ "name": "UQ_kilo_pass_org_processing_runs_idempotency",
+ "nullsNotDistinct": false,
+ "columns": [
+ "idempotency_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_processing_runs_window_check": {
+ "name": "kilo_pass_org_processing_runs_window_check",
+ "value": "\"kilo_pass_org_processing_runs\".\"window_start\" < \"kilo_pass_org_processing_runs\".\"window_end\""
+ },
+ "kilo_pass_org_processing_runs_attempt_count_non_negative_check": {
+ "name": "kilo_pass_org_processing_runs_attempt_count_non_negative_check",
+ "value": "\"kilo_pass_org_processing_runs\".\"attempt_count\" >= 0"
+ },
+ "kilo_pass_org_processing_runs_state_check": {
+ "name": "kilo_pass_org_processing_runs_state_check",
+ "value": "\"kilo_pass_org_processing_runs\".\"state\" IN ('pending', 'running', 'succeeded', 'blocked', 'failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_qualifying_spend_events": {
+ "name": "kilo_pass_org_qualifying_spend_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "issuance_snapshot_id": {
+ "name": "issuance_snapshot_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "allocation_container_organization_id": {
+ "name": "allocation_container_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credit_transaction_id": {
+ "name": "credit_transaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "spent_microdollars": {
+ "name": "spent_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "occurred_at": {
+ "name": "occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kilo_pass_org_qualifying_spend_events_snapshot_occurred": {
+ "name": "IDX_kilo_pass_org_qualifying_spend_events_snapshot_occurred",
+ "columns": [
+ {
+ "expression": "issuance_snapshot_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_org_qualifying_spend_events_issuance_snapshot_id_kilo_pass_org_issuance_snapshots_id_fk": {
+ "name": "kilo_pass_org_qualifying_spend_events_issuance_snapshot_id_kilo_pass_org_issuance_snapshots_id_fk",
+ "tableFrom": "kilo_pass_org_qualifying_spend_events",
+ "tableTo": "kilo_pass_org_issuance_snapshots",
+ "columnsFrom": [
+ "issuance_snapshot_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_qualifying_spend_events_allocation_container_organization_id_organizations_id_fk": {
+ "name": "kilo_pass_org_qualifying_spend_events_allocation_container_organization_id_organizations_id_fk",
+ "tableFrom": "kilo_pass_org_qualifying_spend_events",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "allocation_container_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_qualifying_spend_events_credit_transaction_id_credit_transactions_id_fk": {
+ "name": "kilo_pass_org_qualifying_spend_events_credit_transaction_id_credit_transactions_id_fk",
+ "tableFrom": "kilo_pass_org_qualifying_spend_events",
+ "tableTo": "credit_transactions",
+ "columnsFrom": [
+ "credit_transaction_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_org_qualifying_spend_events_snapshot_credit_transaction": {
+ "name": "UQ_kilo_pass_org_qualifying_spend_events_snapshot_credit_transaction",
+ "nullsNotDistinct": false,
+ "columns": [
+ "issuance_snapshot_id",
+ "credit_transaction_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_qualifying_spend_events_amount_positive_check": {
+ "name": "kilo_pass_org_qualifying_spend_events_amount_positive_check",
+ "value": "\"kilo_pass_org_qualifying_spend_events\".\"spent_microdollars\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_supplements": {
+ "name": "kilo_pass_org_supplements",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "issuance_snapshot_id": {
+ "name": "issuance_snapshot_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_invoice_line_id": {
+ "name": "provider_invoice_line_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "remaining_service_numerator": {
+ "name": "remaining_service_numerator",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "remaining_service_denominator": {
+ "name": "remaining_service_denominator",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "kilo_pass_org_supplements_issuance_snapshot_id_kilo_pass_org_issuance_snapshots_id_fk": {
+ "name": "kilo_pass_org_supplements_issuance_snapshot_id_kilo_pass_org_issuance_snapshots_id_fk",
+ "tableFrom": "kilo_pass_org_supplements",
+ "tableTo": "kilo_pass_org_issuance_snapshots",
+ "columnsFrom": [
+ "issuance_snapshot_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_org_supplements_provider_invoice_line": {
+ "name": "UQ_kilo_pass_org_supplements_provider_invoice_line",
+ "nullsNotDistinct": false,
+ "columns": [
+ "provider_invoice_line_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_supplements_ratio_check": {
+ "name": "kilo_pass_org_supplements_ratio_check",
+ "value": "\"kilo_pass_org_supplements\".\"remaining_service_numerator\" > 0 AND \"kilo_pass_org_supplements\".\"remaining_service_denominator\" > 0 AND \"kilo_pass_org_supplements\".\"remaining_service_numerator\" <= \"kilo_pass_org_supplements\".\"remaining_service_denominator\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_term_transitions": {
+ "name": "kilo_pass_org_term_transitions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "agreement_id": {
+ "name": "agreement_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_term_version_id": {
+ "name": "from_term_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to_term_version_id": {
+ "name": "to_term_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "effective_at": {
+ "name": "effective_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_kilo_user_id": {
+ "name": "created_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "kilo_pass_org_term_transitions_agreement_id_kilo_pass_org_agreements_id_fk": {
+ "name": "kilo_pass_org_term_transitions_agreement_id_kilo_pass_org_agreements_id_fk",
+ "tableFrom": "kilo_pass_org_term_transitions",
+ "tableTo": "kilo_pass_org_agreements",
+ "columnsFrom": [
+ "agreement_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_term_transitions_from_term_version_id_kilo_pass_org_term_versions_id_fk": {
+ "name": "kilo_pass_org_term_transitions_from_term_version_id_kilo_pass_org_term_versions_id_fk",
+ "tableFrom": "kilo_pass_org_term_transitions",
+ "tableTo": "kilo_pass_org_term_versions",
+ "columnsFrom": [
+ "from_term_version_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_term_transitions_to_term_version_id_kilo_pass_org_term_versions_id_fk": {
+ "name": "kilo_pass_org_term_transitions_to_term_version_id_kilo_pass_org_term_versions_id_fk",
+ "tableFrom": "kilo_pass_org_term_transitions",
+ "tableTo": "kilo_pass_org_term_versions",
+ "columnsFrom": [
+ "to_term_version_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_org_term_transitions_created_by_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kilo_pass_org_term_transitions_created_by_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kilo_pass_org_term_transitions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_org_term_transitions_agreement_effective": {
+ "name": "UQ_kilo_pass_org_term_transitions_agreement_effective",
+ "nullsNotDistinct": false,
+ "columns": [
+ "agreement_id",
+ "effective_at"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_term_transitions_changes_version_check": {
+ "name": "kilo_pass_org_term_transitions_changes_version_check",
+ "value": "\"kilo_pass_org_term_transitions\".\"from_term_version_id\" <> \"kilo_pass_org_term_transitions\".\"to_term_version_id\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_org_term_versions": {
+ "name": "kilo_pass_org_term_versions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "version_key": {
+ "name": "version_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tier": {
+ "name": "tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cadence": {
+ "name": "cadence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "billing_price_microdollars_per_pass": {
+ "name": "billing_price_microdollars_per_pass",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "base_credit_microdollars_per_pass": {
+ "name": "base_credit_microdollars_per_pass",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bonus_credit_microdollars_per_pass": {
+ "name": "bonus_credit_microdollars_per_pass",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "unlock_spend_microdollars_per_pass": {
+ "name": "unlock_spend_microdollars_per_pass",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bonus_mode": {
+ "name": "bonus_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_kilo_user_id": {
+ "name": "created_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "kilo_pass_org_term_versions_created_by_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kilo_pass_org_term_versions_created_by_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kilo_pass_org_term_versions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_kilo_pass_org_term_versions_version_key": {
+ "name": "UQ_kilo_pass_org_term_versions_version_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "version_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_org_term_versions_amounts_non_negative_check": {
+ "name": "kilo_pass_org_term_versions_amounts_non_negative_check",
+ "value": "\"kilo_pass_org_term_versions\".\"billing_price_microdollars_per_pass\" >= 0 AND \"kilo_pass_org_term_versions\".\"base_credit_microdollars_per_pass\" >= 0 AND \"kilo_pass_org_term_versions\".\"bonus_credit_microdollars_per_pass\" >= 0 AND \"kilo_pass_org_term_versions\".\"unlock_spend_microdollars_per_pass\" >= 0"
+ },
+ "kilo_pass_org_term_versions_tier_check": {
+ "name": "kilo_pass_org_term_versions_tier_check",
+ "value": "\"kilo_pass_org_term_versions\".\"tier\" IN ('tier_19', 'tier_49', 'tier_199')"
+ },
+ "kilo_pass_org_term_versions_cadence_check": {
+ "name": "kilo_pass_org_term_versions_cadence_check",
+ "value": "\"kilo_pass_org_term_versions\".\"cadence\" IN ('monthly', 'yearly')"
+ },
+ "kilo_pass_org_term_versions_bonus_mode_check": {
+ "name": "kilo_pass_org_term_versions_bonus_mode_check",
+ "value": "\"kilo_pass_org_term_versions\".\"bonus_mode\" IN ('after_base', 'upfront')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_pause_events": {
+ "name": "kilo_pass_pause_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_pass_subscription_id": {
+ "name": "kilo_pass_subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "paused_at": {
+ "name": "paused_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resumes_at": {
+ "name": "resumes_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resumed_at": {
+ "name": "resumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kilo_pass_pause_events_subscription_id": {
+ "name": "IDX_kilo_pass_pause_events_subscription_id",
+ "columns": [
+ {
+ "expression": "kilo_pass_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilo_pass_pause_events_one_open_per_sub": {
+ "name": "UQ_kilo_pass_pause_events_one_open_per_sub",
+ "columns": [
+ {
+ "expression": "kilo_pass_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_pause_events\".\"resumed_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_pause_events_kilo_pass_subscription_id_kilo_pass_subscriptions_id_fk": {
+ "name": "kilo_pass_pause_events_kilo_pass_subscription_id_kilo_pass_subscriptions_id_fk",
+ "tableFrom": "kilo_pass_pause_events",
+ "tableTo": "kilo_pass_subscriptions",
+ "columnsFrom": [
+ "kilo_pass_subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_pause_events_resumed_at_after_paused_at_check": {
+ "name": "kilo_pass_pause_events_resumed_at_after_paused_at_check",
+ "value": "\"kilo_pass_pause_events\".\"resumed_at\" IS NULL OR \"kilo_pass_pause_events\".\"resumed_at\" >= \"kilo_pass_pause_events\".\"paused_at\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_scheduled_changes": {
+ "name": "kilo_pass_scheduled_changes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_subscription_id": {
+ "name": "stripe_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_tier": {
+ "name": "from_tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_cadence": {
+ "name": "from_cadence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to_tier": {
+ "name": "to_tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to_cadence": {
+ "name": "to_cadence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_schedule_id": {
+ "name": "stripe_schedule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "effective_at": {
+ "name": "effective_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kilo_pass_scheduled_changes_kilo_user_id": {
+ "name": "IDX_kilo_pass_scheduled_changes_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_scheduled_changes_status": {
+ "name": "IDX_kilo_pass_scheduled_changes_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_scheduled_changes_stripe_subscription_id": {
+ "name": "IDX_kilo_pass_scheduled_changes_stripe_subscription_id",
+ "columns": [
+ {
+ "expression": "stripe_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilo_pass_scheduled_changes_active_stripe_subscription_id": {
+ "name": "UQ_kilo_pass_scheduled_changes_active_stripe_subscription_id",
+ "columns": [
+ {
+ "expression": "stripe_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_scheduled_changes\".\"deleted_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_scheduled_changes_effective_at": {
+ "name": "IDX_kilo_pass_scheduled_changes_effective_at",
+ "columns": [
+ {
+ "expression": "effective_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_scheduled_changes_deleted_at": {
+ "name": "IDX_kilo_pass_scheduled_changes_deleted_at",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_scheduled_changes_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kilo_pass_scheduled_changes_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kilo_pass_scheduled_changes",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_scheduled_changes_stripe_subscription_id_kilo_pass_subscriptions_stripe_subscription_id_fk": {
+ "name": "kilo_pass_scheduled_changes_stripe_subscription_id_kilo_pass_subscriptions_stripe_subscription_id_fk",
+ "tableFrom": "kilo_pass_scheduled_changes",
+ "tableTo": "kilo_pass_subscriptions",
+ "columnsFrom": [
+ "stripe_subscription_id"
+ ],
+ "columnsTo": [
+ "stripe_subscription_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_scheduled_changes_from_tier_check": {
+ "name": "kilo_pass_scheduled_changes_from_tier_check",
+ "value": "\"kilo_pass_scheduled_changes\".\"from_tier\" IN ('tier_19', 'tier_49', 'tier_199')"
+ },
+ "kilo_pass_scheduled_changes_from_cadence_check": {
+ "name": "kilo_pass_scheduled_changes_from_cadence_check",
+ "value": "\"kilo_pass_scheduled_changes\".\"from_cadence\" IN ('monthly', 'yearly')"
+ },
+ "kilo_pass_scheduled_changes_to_tier_check": {
+ "name": "kilo_pass_scheduled_changes_to_tier_check",
+ "value": "\"kilo_pass_scheduled_changes\".\"to_tier\" IN ('tier_19', 'tier_49', 'tier_199')"
+ },
+ "kilo_pass_scheduled_changes_to_cadence_check": {
+ "name": "kilo_pass_scheduled_changes_to_cadence_check",
+ "value": "\"kilo_pass_scheduled_changes\".\"to_cadence\" IN ('monthly', 'yearly')"
+ },
+ "kilo_pass_scheduled_changes_status_check": {
+ "name": "kilo_pass_scheduled_changes_status_check",
+ "value": "\"kilo_pass_scheduled_changes\".\"status\" IN ('not_started', 'active', 'completed', 'released', 'canceled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_store_events": {
+ "name": "kilo_pass_store_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "payment_provider": {
+ "name": "payment_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_subscription_id": {
+ "name": "provider_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_transaction_id": {
+ "name": "provider_transaction_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "app_account_token": {
+ "name": "app_account_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "product_id": {
+ "name": "product_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment": {
+ "name": "environment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "processing_started_at": {
+ "name": "processing_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processed_at": {
+ "name": "processed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kilo_pass_store_events_provider_event": {
+ "name": "UQ_kilo_pass_store_events_provider_event",
+ "columns": [
+ {
+ "expression": "payment_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_store_events_provider_subscription": {
+ "name": "IDX_kilo_pass_store_events_provider_subscription",
+ "columns": [
+ {
+ "expression": "payment_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_store_events_app_account_token": {
+ "name": "IDX_kilo_pass_store_events_app_account_token",
+ "columns": [
+ {
+ "expression": "app_account_token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_store_events_payment_provider_check": {
+ "name": "kilo_pass_store_events_payment_provider_check",
+ "value": "\"kilo_pass_store_events\".\"payment_provider\" IN ('stripe', 'app_store', 'google_play')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_store_purchases": {
+ "name": "kilo_pass_store_purchases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_pass_subscription_id": {
+ "name": "kilo_pass_subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payment_provider": {
+ "name": "payment_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "product_id": {
+ "name": "product_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_subscription_id": {
+ "name": "provider_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_transaction_id": {
+ "name": "provider_transaction_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_original_transaction_id": {
+ "name": "provider_original_transaction_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "app_account_token": {
+ "name": "app_account_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "purchase_token": {
+ "name": "purchase_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "environment": {
+ "name": "environment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "purchased_at": {
+ "name": "purchased_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "raw_payload_json": {
+ "name": "raw_payload_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kilo_pass_store_purchases_provider_transaction": {
+ "name": "UQ_kilo_pass_store_purchases_provider_transaction",
+ "columns": [
+ {
+ "expression": "payment_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_transaction_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_store_purchases_subscription_id": {
+ "name": "IDX_kilo_pass_store_purchases_subscription_id",
+ "columns": [
+ {
+ "expression": "kilo_pass_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_store_purchases_user_id": {
+ "name": "IDX_kilo_pass_store_purchases_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_store_purchases_app_account_token": {
+ "name": "IDX_kilo_pass_store_purchases_app_account_token",
+ "columns": [
+ {
+ "expression": "app_account_token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_store_purchases_latest_subscription_purchase": {
+ "name": "IDX_kilo_pass_store_purchases_latest_subscription_purchase",
+ "columns": [
+ {
+ "expression": "payment_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "purchased_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_store_purchases_kilo_pass_subscription_id_kilo_pass_subscriptions_id_fk": {
+ "name": "kilo_pass_store_purchases_kilo_pass_subscription_id_kilo_pass_subscriptions_id_fk",
+ "tableFrom": "kilo_pass_store_purchases",
+ "tableTo": "kilo_pass_subscriptions",
+ "columnsFrom": [
+ "kilo_pass_subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "kilo_pass_store_purchases_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kilo_pass_store_purchases_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kilo_pass_store_purchases",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "FK_kilo_pass_store_purchases_subscription_owner_provider": {
+ "name": "FK_kilo_pass_store_purchases_subscription_owner_provider",
+ "tableFrom": "kilo_pass_store_purchases",
+ "tableTo": "kilo_pass_subscriptions",
+ "columnsFrom": [
+ "kilo_pass_subscription_id",
+ "kilo_user_id",
+ "payment_provider",
+ "provider_subscription_id"
+ ],
+ "columnsTo": [
+ "id",
+ "kilo_user_id",
+ "payment_provider",
+ "provider_subscription_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_store_purchases_store_provider_check": {
+ "name": "kilo_pass_store_purchases_store_provider_check",
+ "value": "\"kilo_pass_store_purchases\".\"payment_provider\" IN ('app_store', 'google_play')"
+ },
+ "kilo_pass_store_purchases_payment_provider_check": {
+ "name": "kilo_pass_store_purchases_payment_provider_check",
+ "value": "\"kilo_pass_store_purchases\".\"payment_provider\" IN ('stripe', 'app_store', 'google_play')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_subscriptions": {
+ "name": "kilo_pass_subscriptions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payment_provider": {
+ "name": "payment_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'stripe'"
+ },
+ "provider_subscription_id": {
+ "name": "provider_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_subscription_id": {
+ "name": "stripe_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tier": {
+ "name": "tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cadence": {
+ "name": "cadence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cancel_at_period_end": {
+ "name": "cancel_at_period_end",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "current_streak_months": {
+ "name": "current_streak_months",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_yearly_issue_at": {
+ "name": "next_yearly_issue_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kilo_pass_subscriptions_kilo_user_id": {
+ "name": "IDX_kilo_pass_subscriptions_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_subscriptions_payment_provider": {
+ "name": "IDX_kilo_pass_subscriptions_payment_provider",
+ "columns": [
+ {
+ "expression": "payment_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_subscriptions_status": {
+ "name": "IDX_kilo_pass_subscriptions_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilo_pass_subscriptions_cadence": {
+ "name": "IDX_kilo_pass_subscriptions_cadence",
+ "columns": [
+ {
+ "expression": "cadence",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilo_pass_subscriptions_provider_subscription": {
+ "name": "UQ_kilo_pass_subscriptions_provider_subscription",
+ "columns": [
+ {
+ "expression": "payment_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilo_pass_subscriptions\".\"provider_subscription_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilo_pass_subscriptions_store_purchase_reference": {
+ "name": "UQ_kilo_pass_subscriptions_store_purchase_reference",
+ "columns": [
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "payment_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kilo_pass_subscriptions_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kilo_pass_subscriptions_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kilo_pass_subscriptions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "kilo_pass_subscriptions_stripe_subscription_id_unique": {
+ "name": "kilo_pass_subscriptions_stripe_subscription_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_subscription_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_subscriptions_current_streak_months_non_negative_check": {
+ "name": "kilo_pass_subscriptions_current_streak_months_non_negative_check",
+ "value": "\"kilo_pass_subscriptions\".\"current_streak_months\" >= 0"
+ },
+ "kilo_pass_subscriptions_provider_ids_check": {
+ "name": "kilo_pass_subscriptions_provider_ids_check",
+ "value": "(\n \"kilo_pass_subscriptions\".\"payment_provider\" = 'stripe'\n AND \"kilo_pass_subscriptions\".\"provider_subscription_id\" IS NOT NULL\n AND \"kilo_pass_subscriptions\".\"stripe_subscription_id\" IS NOT NULL\n AND \"kilo_pass_subscriptions\".\"provider_subscription_id\" = \"kilo_pass_subscriptions\".\"stripe_subscription_id\"\n ) OR (\n \"kilo_pass_subscriptions\".\"payment_provider\" IN ('app_store', 'google_play')\n AND \"kilo_pass_subscriptions\".\"provider_subscription_id\" IS NOT NULL\n AND \"kilo_pass_subscriptions\".\"stripe_subscription_id\" IS NULL\n )"
+ },
+ "kilo_pass_subscriptions_payment_provider_check": {
+ "name": "kilo_pass_subscriptions_payment_provider_check",
+ "value": "\"kilo_pass_subscriptions\".\"payment_provider\" IN ('stripe', 'app_store', 'google_play')"
+ },
+ "kilo_pass_subscriptions_tier_check": {
+ "name": "kilo_pass_subscriptions_tier_check",
+ "value": "\"kilo_pass_subscriptions\".\"tier\" IN ('tier_19', 'tier_49', 'tier_199')"
+ },
+ "kilo_pass_subscriptions_cadence_check": {
+ "name": "kilo_pass_subscriptions_cadence_check",
+ "value": "\"kilo_pass_subscriptions\".\"cadence\" IN ('monthly', 'yearly')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kilo_pass_welcome_promo_payment_fingerprint_claims": {
+ "name": "kilo_pass_welcome_promo_payment_fingerprint_claims",
+ "schema": "",
+ "columns": {
+ "stripe_payment_method_type": {
+ "name": "stripe_payment_method_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_fingerprint": {
+ "name": "stripe_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_stripe_invoice_id": {
+ "name": "source_stripe_invoice_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "kilo_pass_welcome_promo_payment_fingerprint_claims_stripe_payment_method_type_stripe_fingerprint_pk": {
+ "name": "kilo_pass_welcome_promo_payment_fingerprint_claims_stripe_payment_method_type_stripe_fingerprint_pk",
+ "columns": [
+ "stripe_payment_method_type",
+ "stripe_fingerprint"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "UQ_kilo_pass_welcome_promo_payment_fingerprint_claims_source_invoice_id": {
+ "name": "UQ_kilo_pass_welcome_promo_payment_fingerprint_claims_source_invoice_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "source_stripe_invoice_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kilo_pass_welcome_promo_payment_fingerprint_claims_type_check": {
+ "name": "kilo_pass_welcome_promo_payment_fingerprint_claims_type_check",
+ "value": "\"kilo_pass_welcome_promo_payment_fingerprint_claims\".\"stripe_payment_method_type\" IN ('card', 'sepa_debit', 'us_bank_account', 'bacs_debit', 'au_becs_debit')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_access_codes": {
+ "name": "kiloclaw_access_codes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "code": {
+ "name": "code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redeemed_at": {
+ "name": "redeemed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kiloclaw_access_codes_code": {
+ "name": "UQ_kiloclaw_access_codes_code",
+ "columns": [
+ {
+ "expression": "code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_access_codes_user_status": {
+ "name": "IDX_kiloclaw_access_codes_user_status",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kiloclaw_access_codes_one_active_per_user": {
+ "name": "UQ_kiloclaw_access_codes_one_active_per_user",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "status = 'active'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_access_codes_kilo_user_id_kilocode_users_id_fk": {
+ "name": "kiloclaw_access_codes_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_access_codes",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_admin_audit_logs": {
+ "name": "kiloclaw_admin_audit_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_email": {
+ "name": "actor_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_user_id": {
+ "name": "target_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kiloclaw_admin_audit_logs_target_user_id": {
+ "name": "IDX_kiloclaw_admin_audit_logs_target_user_id",
+ "columns": [
+ {
+ "expression": "target_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_admin_audit_logs_action": {
+ "name": "IDX_kiloclaw_admin_audit_logs_action",
+ "columns": [
+ {
+ "expression": "action",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_admin_audit_logs_created_at": {
+ "name": "IDX_kiloclaw_admin_audit_logs_created_at",
+ "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.kiloclaw_cli_runs": {
+ "name": "kiloclaw_cli_runs",
+ "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
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiated_by_admin_id": {
+ "name": "initiated_by_admin_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "exit_code": {
+ "name": "exit_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output": {
+ "name": "output",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "IDX_kiloclaw_cli_runs_user_id": {
+ "name": "IDX_kiloclaw_cli_runs_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_cli_runs_started_at": {
+ "name": "IDX_kiloclaw_cli_runs_started_at",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_cli_runs_instance_id": {
+ "name": "IDX_kiloclaw_cli_runs_instance_id",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_cli_runs_user_id_kilocode_users_id_fk": {
+ "name": "kiloclaw_cli_runs_user_id_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_cli_runs",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_cli_runs_instance_id_kiloclaw_instances_id_fk": {
+ "name": "kiloclaw_cli_runs_instance_id_kiloclaw_instances_id_fk",
+ "tableFrom": "kiloclaw_cli_runs",
+ "tableTo": "kiloclaw_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_cli_runs_initiated_by_admin_id_kilocode_users_id_fk": {
+ "name": "kiloclaw_cli_runs_initiated_by_admin_id_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_cli_runs",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "initiated_by_admin_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_earlybird_purchases": {
+ "name": "kiloclaw_earlybird_purchases",
+ "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
+ },
+ "stripe_charge_id": {
+ "name": "stripe_charge_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manual_payment_id": {
+ "name": "manual_payment_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "kiloclaw_earlybird_purchases_user_id_kilocode_users_id_fk": {
+ "name": "kiloclaw_earlybird_purchases_user_id_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_earlybird_purchases",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "kiloclaw_earlybird_purchases_user_id_unique": {
+ "name": "kiloclaw_earlybird_purchases_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id"
+ ]
+ },
+ "kiloclaw_earlybird_purchases_stripe_charge_id_unique": {
+ "name": "kiloclaw_earlybird_purchases_stripe_charge_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_charge_id"
+ ]
+ },
+ "kiloclaw_earlybird_purchases_manual_payment_id_unique": {
+ "name": "kiloclaw_earlybird_purchases_manual_payment_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "manual_payment_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_email_log": {
+ "name": "kiloclaw_email_log",
+ "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
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_type": {
+ "name": "email_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_start": {
+ "name": "period_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'epoch'"
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kiloclaw_email_log_user_type_global": {
+ "name": "UQ_kiloclaw_email_log_user_type_global",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kiloclaw_email_log\".\"instance_id\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kiloclaw_email_log_user_instance_type_period": {
+ "name": "UQ_kiloclaw_email_log_user_instance_type_period",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "period_start",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kiloclaw_email_log\".\"instance_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_email_log_type_sent_instance": {
+ "name": "IDX_kiloclaw_email_log_type_sent_instance",
+ "columns": [
+ {
+ "expression": "email_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sent_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_email_log\".\"instance_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_email_log_user_id_kilocode_users_id_fk": {
+ "name": "kiloclaw_email_log_user_id_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_email_log",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_email_log_instance_id_kiloclaw_instances_id_fk": {
+ "name": "kiloclaw_email_log_instance_id_kiloclaw_instances_id_fk",
+ "tableFrom": "kiloclaw_email_log",
+ "tableTo": "kiloclaw_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_google_oauth_connections": {
+ "name": "kiloclaw_google_oauth_connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'google'"
+ },
+ "account_email": {
+ "name": "account_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_subject": {
+ "name": "account_subject",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oauth_client_id": {
+ "name": "oauth_client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oauth_client_secret_encrypted": {
+ "name": "oauth_client_secret_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_profile": {
+ "name": "credential_profile",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'kilo_owned'"
+ },
+ "refresh_token_encrypted": {
+ "name": "refresh_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::text[]"
+ },
+ "grants_by_source": {
+ "name": "grants_by_source",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "capabilities": {
+ "name": "capabilities",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::text[]"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_at": {
+ "name": "last_error_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connected_at": {
+ "name": "connected_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kiloclaw_google_oauth_connections_instance": {
+ "name": "UQ_kiloclaw_google_oauth_connections_instance",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_google_oauth_connections_status": {
+ "name": "IDX_kiloclaw_google_oauth_connections_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_google_oauth_connections_provider": {
+ "name": "IDX_kiloclaw_google_oauth_connections_provider",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_google_oauth_connections_instance_id_kiloclaw_instances_id_fk": {
+ "name": "kiloclaw_google_oauth_connections_instance_id_kiloclaw_instances_id_fk",
+ "tableFrom": "kiloclaw_google_oauth_connections",
+ "tableTo": "kiloclaw_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kiloclaw_google_oauth_connections_status_check": {
+ "name": "kiloclaw_google_oauth_connections_status_check",
+ "value": "\"kiloclaw_google_oauth_connections\".\"status\" IN ('active', 'action_required', 'disconnected')"
+ },
+ "kiloclaw_google_oauth_connections_credential_profile_check": {
+ "name": "kiloclaw_google_oauth_connections_credential_profile_check",
+ "value": "\"kiloclaw_google_oauth_connections\".\"credential_profile\" IN ('legacy', 'kilo_owned')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_image_catalog": {
+ "name": "kiloclaw_image_catalog",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "openclaw_version": {
+ "name": "openclaw_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "variant": {
+ "name": "variant",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "image_tag": {
+ "name": "image_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image_digest": {
+ "name": "image_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'available'"
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "published_at": {
+ "name": "published_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "synced_at": {
+ "name": "synced_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "rollout_percent": {
+ "name": "rollout_percent",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "is_latest": {
+ "name": "is_latest",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "IDX_kiloclaw_image_catalog_status": {
+ "name": "IDX_kiloclaw_image_catalog_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_image_catalog_variant": {
+ "name": "IDX_kiloclaw_image_catalog_variant",
+ "columns": [
+ {
+ "expression": "variant",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kiloclaw_image_catalog_one_latest_per_variant": {
+ "name": "UQ_kiloclaw_image_catalog_one_latest_per_variant",
+ "columns": [
+ {
+ "expression": "variant",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kiloclaw_image_catalog\".\"is_latest\" = true",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kiloclaw_image_catalog_one_candidate_per_variant": {
+ "name": "UQ_kiloclaw_image_catalog_one_candidate_per_variant",
+ "columns": [
+ {
+ "expression": "variant",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kiloclaw_image_catalog\".\"is_latest\" = false AND \"kiloclaw_image_catalog\".\"rollout_percent\" > 0 AND \"kiloclaw_image_catalog\".\"status\" = 'available'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "kiloclaw_image_catalog_image_tag_unique": {
+ "name": "kiloclaw_image_catalog_image_tag_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "image_tag"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_inbound_email_aliases": {
+ "name": "kiloclaw_inbound_email_aliases",
+ "schema": "",
+ "columns": {
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "retired_at": {
+ "name": "retired_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "IDX_kiloclaw_inbound_email_aliases_instance_id": {
+ "name": "IDX_kiloclaw_inbound_email_aliases_instance_id",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kiloclaw_inbound_email_aliases_active_instance": {
+ "name": "UQ_kiloclaw_inbound_email_aliases_active_instance",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kiloclaw_inbound_email_aliases\".\"retired_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_inbound_email_aliases_instance_id_kiloclaw_instances_id_fk": {
+ "name": "kiloclaw_inbound_email_aliases_instance_id_kiloclaw_instances_id_fk",
+ "tableFrom": "kiloclaw_inbound_email_aliases",
+ "tableTo": "kiloclaw_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_inbound_email_reserved_aliases": {
+ "name": "kiloclaw_inbound_email_reserved_aliases",
+ "schema": "",
+ "columns": {
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_instances": {
+ "name": "kiloclaw_instances",
+ "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
+ },
+ "sandbox_id": {
+ "name": "sandbox_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'fly'"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inbound_email_enabled": {
+ "name": "inbound_email_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "inactive_trial_stopped_at": {
+ "name": "inactive_trial_stopped_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "destroyed_at": {
+ "name": "destroyed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tracked_image_tag": {
+ "name": "tracked_image_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instance_type": {
+ "name": "instance_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "admin_size_override": {
+ "name": "admin_size_override",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "UQ_kiloclaw_instances_active": {
+ "name": "UQ_kiloclaw_instances_active",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sandbox_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kiloclaw_instances\".\"destroyed_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_instances_active_personal_by_user": {
+ "name": "IDX_kiloclaw_instances_active_personal_by_user",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_instances\".\"organization_id\" IS NULL AND \"kiloclaw_instances\".\"destroyed_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_instances_active_org_by_user_org": {
+ "name": "IDX_kiloclaw_instances_active_org_by_user_org",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_instances\".\"organization_id\" IS NOT NULL AND \"kiloclaw_instances\".\"destroyed_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_instances_active_org_by_org_created": {
+ "name": "IDX_kiloclaw_instances_active_org_by_org_created",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_instances\".\"organization_id\" IS NOT NULL AND \"kiloclaw_instances\".\"destroyed_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_instances_user_id_created_at": {
+ "name": "IDX_kiloclaw_instances_user_id_created_at",
+ "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": {}
+ },
+ "IDX_kiloclaw_instances_tracked_image_tag": {
+ "name": "IDX_kiloclaw_instances_tracked_image_tag",
+ "columns": [
+ {
+ "expression": "tracked_image_tag",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_instances\".\"destroyed_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_instances_instance_type": {
+ "name": "IDX_kiloclaw_instances_instance_type",
+ "columns": [
+ {
+ "expression": "instance_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_instances\".\"destroyed_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_instances_admin_size_override": {
+ "name": "IDX_kiloclaw_instances_admin_size_override",
+ "columns": [
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_instances\".\"admin_size_override\" IS NOT NULL AND \"kiloclaw_instances\".\"destroyed_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_instances_user_id_kilocode_users_id_fk": {
+ "name": "kiloclaw_instances_user_id_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_instances",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_instances_organization_id_organizations_id_fk": {
+ "name": "kiloclaw_instances_organization_id_organizations_id_fk",
+ "tableFrom": "kiloclaw_instances",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "CHK_kiloclaw_instances_instance_type": {
+ "name": "CHK_kiloclaw_instances_instance_type",
+ "value": "\"kiloclaw_instances\".\"instance_type\" IS NULL OR \"kiloclaw_instances\".\"instance_type\" IN ('perf-1-3', 'perf-4-8', 'perf-4-16', 'shared-2-3', 'shared-2-4', 'custom')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_morning_briefing_configs": {
+ "name": "kiloclaw_morning_briefing_configs",
+ "schema": "",
+ "columns": {
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "cron": {
+ "name": "cron",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0 7 * * *'"
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'UTC'"
+ },
+ "interest_topics": {
+ "name": "interest_topics",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::text[]"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kiloclaw_morning_briefing_configs_enabled": {
+ "name": "IDX_kiloclaw_morning_briefing_configs_enabled",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_morning_briefing_configs\".\"enabled\" = true",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_morning_briefing_configs_instance_id_kiloclaw_instances_id_fk": {
+ "name": "kiloclaw_morning_briefing_configs_instance_id_kiloclaw_instances_id_fk",
+ "tableFrom": "kiloclaw_morning_briefing_configs",
+ "tableTo": "kiloclaw_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_scheduled_action_notifications": {
+ "name": "kiloclaw_scheduled_action_notifications",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'notice'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "UQ_kiloclaw_scheduled_action_notifications_target_kind_channel": {
+ "name": "UQ_kiloclaw_scheduled_action_notifications_target_kind_channel",
+ "columns": [
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "channel",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_scheduled_action_notifications_pending": {
+ "name": "IDX_kiloclaw_scheduled_action_notifications_pending",
+ "columns": [
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_scheduled_action_notifications\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_scheduled_action_notifications_target_id_kiloclaw_scheduled_action_targets_id_fk": {
+ "name": "kiloclaw_scheduled_action_notifications_target_id_kiloclaw_scheduled_action_targets_id_fk",
+ "tableFrom": "kiloclaw_scheduled_action_notifications",
+ "tableTo": "kiloclaw_scheduled_action_targets",
+ "columnsFrom": [
+ "target_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_scheduled_action_stages": {
+ "name": "kiloclaw_scheduled_action_stages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "scheduled_action_id": {
+ "name": "scheduled_action_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_index": {
+ "name": "stage_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scheduled_at": {
+ "name": "scheduled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "notice_sent_at": {
+ "name": "notice_sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "applied_count": {
+ "name": "applied_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "skipped_count": {
+ "name": "skipped_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "failed_count": {
+ "name": "failed_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "UQ_kiloclaw_scheduled_action_stages_parent_index": {
+ "name": "UQ_kiloclaw_scheduled_action_stages_parent_index",
+ "columns": [
+ {
+ "expression": "scheduled_action_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "stage_index",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_scheduled_action_stages_notice_due": {
+ "name": "IDX_kiloclaw_scheduled_action_stages_notice_due",
+ "columns": [
+ {
+ "expression": "scheduled_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_scheduled_action_stages\".\"notice_sent_at\" IS NULL AND \"kiloclaw_scheduled_action_stages\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_scheduled_action_stages_scheduled_action_id_kiloclaw_scheduled_actions_id_fk": {
+ "name": "kiloclaw_scheduled_action_stages_scheduled_action_id_kiloclaw_scheduled_actions_id_fk",
+ "tableFrom": "kiloclaw_scheduled_action_stages",
+ "tableTo": "kiloclaw_scheduled_actions",
+ "columnsFrom": [
+ "scheduled_action_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_scheduled_action_targets": {
+ "name": "kiloclaw_scheduled_action_targets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "scheduled_action_id": {
+ "name": "scheduled_action_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_id": {
+ "name": "stage_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_image_tag": {
+ "name": "source_image_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_image_tag": {
+ "name": "target_image_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "skip_reason": {
+ "name": "skip_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "UQ_kiloclaw_scheduled_action_targets_parent_instance": {
+ "name": "UQ_kiloclaw_scheduled_action_targets_parent_instance",
+ "columns": [
+ {
+ "expression": "scheduled_action_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_scheduled_action_targets_stage": {
+ "name": "IDX_kiloclaw_scheduled_action_targets_stage",
+ "columns": [
+ {
+ "expression": "stage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_scheduled_action_targets_pending_by_instance": {
+ "name": "IDX_kiloclaw_scheduled_action_targets_pending_by_instance",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_scheduled_action_targets\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_scheduled_action_targets_scheduled_action_id_kiloclaw_scheduled_actions_id_fk": {
+ "name": "kiloclaw_scheduled_action_targets_scheduled_action_id_kiloclaw_scheduled_actions_id_fk",
+ "tableFrom": "kiloclaw_scheduled_action_targets",
+ "tableTo": "kiloclaw_scheduled_actions",
+ "columnsFrom": [
+ "scheduled_action_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_scheduled_action_targets_stage_id_kiloclaw_scheduled_action_stages_id_fk": {
+ "name": "kiloclaw_scheduled_action_targets_stage_id_kiloclaw_scheduled_action_stages_id_fk",
+ "tableFrom": "kiloclaw_scheduled_action_targets",
+ "tableTo": "kiloclaw_scheduled_action_stages",
+ "columnsFrom": [
+ "stage_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_scheduled_action_targets_instance_id_kiloclaw_instances_id_fk": {
+ "name": "kiloclaw_scheduled_action_targets_instance_id_kiloclaw_instances_id_fk",
+ "tableFrom": "kiloclaw_scheduled_action_targets",
+ "tableTo": "kiloclaw_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_scheduled_action_targets_user_id_kilocode_users_id_fk": {
+ "name": "kiloclaw_scheduled_action_targets_user_id_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_scheduled_action_targets",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_scheduled_actions": {
+ "name": "kiloclaw_scheduled_actions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "action_type": {
+ "name": "action_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_image_tag": {
+ "name": "target_image_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "override_pins": {
+ "name": "override_pins",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "notice_lead_hours": {
+ "name": "notice_lead_hours",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 24
+ },
+ "notice_subject": {
+ "name": "notice_subject",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "notice_body": {
+ "name": "notice_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'scheduled'"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancelled_at": {
+ "name": "cancelled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_count": {
+ "name": "total_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "applied_count": {
+ "name": "applied_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "skipped_count": {
+ "name": "skipped_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "failed_count": {
+ "name": "failed_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "IDX_kiloclaw_scheduled_actions_status": {
+ "name": "IDX_kiloclaw_scheduled_actions_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_scheduled_actions_action_type": {
+ "name": "IDX_kiloclaw_scheduled_actions_action_type",
+ "columns": [
+ {
+ "expression": "action_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_scheduled_actions_created_by": {
+ "name": "IDX_kiloclaw_scheduled_actions_created_by",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_scheduled_actions_target_image_tag_kiloclaw_image_catalog_image_tag_fk": {
+ "name": "kiloclaw_scheduled_actions_target_image_tag_kiloclaw_image_catalog_image_tag_fk",
+ "tableFrom": "kiloclaw_scheduled_actions",
+ "tableTo": "kiloclaw_image_catalog",
+ "columnsFrom": [
+ "target_image_tag"
+ ],
+ "columnsTo": [
+ "image_tag"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_scheduled_actions_created_by_kilocode_users_id_fk": {
+ "name": "kiloclaw_scheduled_actions_created_by_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_scheduled_actions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_subscription_change_log": {
+ "name": "kiloclaw_subscription_change_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "before_state": {
+ "name": "before_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "after_state": {
+ "name": "after_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "IDX_kiloclaw_subscription_change_log_subscription_created_at": {
+ "name": "IDX_kiloclaw_subscription_change_log_subscription_created_at",
+ "columns": [
+ {
+ "expression": "subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_subscription_change_log_created_at": {
+ "name": "IDX_kiloclaw_subscription_change_log_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_subscription_change_log_subscription_id_kiloclaw_subscriptions_id_fk": {
+ "name": "kiloclaw_subscription_change_log_subscription_id_kiloclaw_subscriptions_id_fk",
+ "tableFrom": "kiloclaw_subscription_change_log",
+ "tableTo": "kiloclaw_subscriptions",
+ "columnsFrom": [
+ "subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kiloclaw_subscription_change_log_actor_type_check": {
+ "name": "kiloclaw_subscription_change_log_actor_type_check",
+ "value": "\"kiloclaw_subscription_change_log\".\"actor_type\" IN ('user', 'system')"
+ },
+ "kiloclaw_subscription_change_log_action_check": {
+ "name": "kiloclaw_subscription_change_log_action_check",
+ "value": "\"kiloclaw_subscription_change_log\".\"action\" IN ('created', 'status_changed', 'plan_switched', 'period_advanced', 'canceled', 'reactivated', 'suspended', 'destruction_scheduled', 'reassigned', 'backfilled', 'payment_source_changed', 'schedule_changed', 'admin_override')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_subscriptions": {
+ "name": "kiloclaw_subscriptions",
+ "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
+ },
+ "stripe_subscription_id": {
+ "name": "stripe_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_schedule_id": {
+ "name": "stripe_schedule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transferred_to_subscription_id": {
+ "name": "transferred_to_subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_origin": {
+ "name": "access_origin",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payment_source": {
+ "name": "payment_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kiloclaw_price_version": {
+ "name": "kiloclaw_price_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plan": {
+ "name": "plan",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scheduled_plan": {
+ "name": "scheduled_plan",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scheduled_by": {
+ "name": "scheduled_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cancel_at_period_end": {
+ "name": "cancel_at_period_end",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "pending_conversion": {
+ "name": "pending_conversion",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trial_started_at": {
+ "name": "trial_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trial_ends_at": {
+ "name": "trial_ends_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "current_period_start": {
+ "name": "current_period_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "current_period_end": {
+ "name": "current_period_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_renewal_at": {
+ "name": "credit_renewal_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commit_ends_at": {
+ "name": "commit_ends_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "past_due_since": {
+ "name": "past_due_since",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspended_at": {
+ "name": "suspended_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "destruction_deadline": {
+ "name": "destruction_deadline",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_resume_requested_at": {
+ "name": "auto_resume_requested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_resume_retry_after": {
+ "name": "auto_resume_retry_after",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_resume_attempt_count": {
+ "name": "auto_resume_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "auto_top_up_triggered_for_period": {
+ "name": "auto_top_up_triggered_for_period",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_kiloclaw_subscriptions_status": {
+ "name": "IDX_kiloclaw_subscriptions_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_subscriptions_user_id": {
+ "name": "IDX_kiloclaw_subscriptions_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_subscriptions_user_status": {
+ "name": "IDX_kiloclaw_subscriptions_user_status",
+ "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": {}
+ },
+ "IDX_kiloclaw_subscriptions_price_version": {
+ "name": "IDX_kiloclaw_subscriptions_price_version",
+ "columns": [
+ {
+ "expression": "kiloclaw_price_version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_subscriptions_transferred_to": {
+ "name": "IDX_kiloclaw_subscriptions_transferred_to",
+ "columns": [
+ {
+ "expression": "transferred_to_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_subscriptions_stripe_schedule_id": {
+ "name": "IDX_kiloclaw_subscriptions_stripe_schedule_id",
+ "columns": [
+ {
+ "expression": "stripe_schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_subscriptions_auto_resume_retry_after": {
+ "name": "IDX_kiloclaw_subscriptions_auto_resume_retry_after",
+ "columns": [
+ {
+ "expression": "auto_resume_retry_after",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kiloclaw_subscriptions_instance": {
+ "name": "UQ_kiloclaw_subscriptions_instance",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kiloclaw_subscriptions\".\"instance_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kiloclaw_subscriptions_transferred_to": {
+ "name": "UQ_kiloclaw_subscriptions_transferred_to",
+ "columns": [
+ {
+ "expression": "transferred_to_subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kiloclaw_subscriptions\".\"transferred_to_subscription_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_subscriptions_earlybird_origin": {
+ "name": "IDX_kiloclaw_subscriptions_earlybird_origin",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "access_origin",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_subscriptions\".\"access_origin\" = 'earlybird'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_subscriptions_user_id_kilocode_users_id_fk": {
+ "name": "kiloclaw_subscriptions_user_id_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_subscriptions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_subscriptions_transferred_to_subscription_id_kiloclaw_subscriptions_id_fk": {
+ "name": "kiloclaw_subscriptions_transferred_to_subscription_id_kiloclaw_subscriptions_id_fk",
+ "tableFrom": "kiloclaw_subscriptions",
+ "tableTo": "kiloclaw_subscriptions",
+ "columnsFrom": [
+ "transferred_to_subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_subscriptions_instance_id_kiloclaw_instances_id_fk": {
+ "name": "kiloclaw_subscriptions_instance_id_kiloclaw_instances_id_fk",
+ "tableFrom": "kiloclaw_subscriptions",
+ "tableTo": "kiloclaw_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "kiloclaw_subscriptions_stripe_subscription_id_unique": {
+ "name": "kiloclaw_subscriptions_stripe_subscription_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_subscription_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "kiloclaw_subscriptions_price_version_check": {
+ "name": "kiloclaw_subscriptions_price_version_check",
+ "value": "\"kiloclaw_subscriptions\".\"kiloclaw_price_version\" IN ('2026-03-19', '2026-05-10')"
+ },
+ "kiloclaw_subscriptions_plan_check": {
+ "name": "kiloclaw_subscriptions_plan_check",
+ "value": "\"kiloclaw_subscriptions\".\"plan\" IN ('trial', 'commit', 'standard')"
+ },
+ "kiloclaw_subscriptions_scheduled_plan_check": {
+ "name": "kiloclaw_subscriptions_scheduled_plan_check",
+ "value": "\"kiloclaw_subscriptions\".\"scheduled_plan\" IN ('commit', 'standard')"
+ },
+ "kiloclaw_subscriptions_scheduled_by_check": {
+ "name": "kiloclaw_subscriptions_scheduled_by_check",
+ "value": "\"kiloclaw_subscriptions\".\"scheduled_by\" IN ('auto', 'user')"
+ },
+ "kiloclaw_subscriptions_status_check": {
+ "name": "kiloclaw_subscriptions_status_check",
+ "value": "\"kiloclaw_subscriptions\".\"status\" IN ('trialing', 'active', 'past_due', 'canceled', 'unpaid')"
+ },
+ "kiloclaw_subscriptions_access_origin_check": {
+ "name": "kiloclaw_subscriptions_access_origin_check",
+ "value": "\"kiloclaw_subscriptions\".\"access_origin\" IN ('earlybird')"
+ },
+ "kiloclaw_subscriptions_payment_source_check": {
+ "name": "kiloclaw_subscriptions_payment_source_check",
+ "value": "\"kiloclaw_subscriptions\".\"payment_source\" IN ('stripe', 'credits')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_terminal_renewal_failures": {
+ "name": "kiloclaw_terminal_renewal_failures",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "renewal_boundary": {
+ "name": "renewal_boundary",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unresolved'"
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "first_failure_at": {
+ "name": "first_failure_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_failure_at": {
+ "name": "last_failure_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_failure_code": {
+ "name": "last_failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_failure_message": {
+ "name": "last_failure_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolution_actor_type": {
+ "name": "resolution_actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolution_actor_id": {
+ "name": "resolution_actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolution_at": {
+ "name": "resolution_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolution_reason": {
+ "name": "resolution_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_kiloclaw_terminal_renewal_failures_subscription_boundary": {
+ "name": "UQ_kiloclaw_terminal_renewal_failures_subscription_boundary",
+ "columns": [
+ {
+ "expression": "subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "renewal_boundary",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_terminal_renewal_failures_unresolved": {
+ "name": "IDX_kiloclaw_terminal_renewal_failures_unresolved",
+ "columns": [
+ {
+ "expression": "subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "renewal_boundary",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"kiloclaw_terminal_renewal_failures\".\"status\" = 'unresolved'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kiloclaw_terminal_renewal_failures_status_last_failure_at": {
+ "name": "IDX_kiloclaw_terminal_renewal_failures_status_last_failure_at",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_failure_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "kiloclaw_terminal_renewal_failures_subscription_id_kiloclaw_subscriptions_id_fk": {
+ "name": "kiloclaw_terminal_renewal_failures_subscription_id_kiloclaw_subscriptions_id_fk",
+ "tableFrom": "kiloclaw_terminal_renewal_failures",
+ "tableTo": "kiloclaw_subscriptions",
+ "columnsFrom": [
+ "subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "kiloclaw_terminal_renewal_failures_status_check": {
+ "name": "kiloclaw_terminal_renewal_failures_status_check",
+ "value": "\"kiloclaw_terminal_renewal_failures\".\"status\" IN ('unresolved', 'resolved', 'waived', 'superseded')"
+ },
+ "kiloclaw_terminal_renewal_failures_last_failure_code_check": {
+ "name": "kiloclaw_terminal_renewal_failures_last_failure_code_check",
+ "value": "\"kiloclaw_terminal_renewal_failures\".\"last_failure_code\" IN ('credit_balance_read_failed', 'renewal_transaction_failed', 'auto_top_up_marker_write_failed', 'worker_timeout', 'poison_payload', 'queue_delivery_exhausted')"
+ },
+ "kiloclaw_terminal_renewal_failures_resolution_actor_type_check": {
+ "name": "kiloclaw_terminal_renewal_failures_resolution_actor_type_check",
+ "value": "\"kiloclaw_terminal_renewal_failures\".\"resolution_actor_type\" IN ('operator', 'system')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.kiloclaw_version_pins": {
+ "name": "kiloclaw_version_pins",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image_tag": {
+ "name": "image_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pinned_by": {
+ "name": "pinned_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "kiloclaw_version_pins_instance_id_kiloclaw_instances_id_fk": {
+ "name": "kiloclaw_version_pins_instance_id_kiloclaw_instances_id_fk",
+ "tableFrom": "kiloclaw_version_pins",
+ "tableTo": "kiloclaw_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_version_pins_image_tag_kiloclaw_image_catalog_image_tag_fk": {
+ "name": "kiloclaw_version_pins_image_tag_kiloclaw_image_catalog_image_tag_fk",
+ "tableFrom": "kiloclaw_version_pins",
+ "tableTo": "kiloclaw_image_catalog",
+ "columnsFrom": [
+ "image_tag"
+ ],
+ "columnsTo": [
+ "image_tag"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "kiloclaw_version_pins_pinned_by_kilocode_users_id_fk": {
+ "name": "kiloclaw_version_pins_pinned_by_kilocode_users_id_fk",
+ "tableFrom": "kiloclaw_version_pins",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "pinned_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "kiloclaw_version_pins_instance_id_unique": {
+ "name": "kiloclaw_version_pins_instance_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "instance_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.kilocode_users": {
+ "name": "kilocode_users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "google_user_email": {
+ "name": "google_user_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "google_user_name": {
+ "name": "google_user_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "google_user_image_url": {
+ "name": "google_user_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "hosted_domain": {
+ "name": "hosted_domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "microdollars_used": {
+ "name": "microdollars_used",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "kilo_pass_threshold": {
+ "name": "kilo_pass_threshold",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_store_account_token": {
+ "name": "app_store_account_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "is_admin": {
+ "name": "is_admin",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_super_admin": {
+ "name": "is_super_admin",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "can_view_sessions": {
+ "name": "can_view_sessions",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "can_manage_credits": {
+ "name": "can_manage_credits",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "total_microdollars_acquired": {
+ "name": "total_microdollars_acquired",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "next_credit_expiration_at": {
+ "name": "next_credit_expiration_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_validation_stytch": {
+ "name": "has_validation_stytch",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_validation_novel_card_with_hold": {
+ "name": "has_validation_novel_card_with_hold",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "blocked_reason": {
+ "name": "blocked_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blocked_at": {
+ "name": "blocked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blocked_by_kilo_user_id": {
+ "name": "blocked_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_token_pepper": {
+ "name": "api_token_pepper",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "web_session_pepper": {
+ "name": "web_session_pepper",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_top_up_enabled": {
+ "name": "auto_top_up_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_bot": {
+ "name": "is_bot",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "kiloclaw_early_access": {
+ "name": "kiloclaw_early_access",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "default_model": {
+ "name": "default_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cohorts": {
+ "name": "cohorts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "completed_welcome_form": {
+ "name": "completed_welcome_form",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "linkedin_url": {
+ "name": "linkedin_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github_url": {
+ "name": "github_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discord_server_membership_verified_at": {
+ "name": "discord_server_membership_verified_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "openrouter_upstream_safety_identifier": {
+ "name": "openrouter_upstream_safety_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "openrouter_downstream_safety_identifier": {
+ "name": "openrouter_downstream_safety_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vercel_downstream_safety_identifier": {
+ "name": "vercel_downstream_safety_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "customer_source": {
+ "name": "customer_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signup_ip": {
+ "name": "signup_ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "account_deletion_requested_at": {
+ "name": "account_deletion_requested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "normalized_email": {
+ "name": "normalized_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_domain": {
+ "name": "email_domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "personal_account_disabled": {
+ "name": "personal_account_disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "IDX_kilocode_users_signup_ip_created_at": {
+ "name": "IDX_kilocode_users_signup_ip_created_at",
+ "columns": [
+ {
+ "expression": "signup_ip",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilocode_users_blocked_at": {
+ "name": "IDX_kilocode_users_blocked_at",
+ "columns": [
+ {
+ "expression": "blocked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilocode_users_blocked_by_kilo_user_id": {
+ "name": "IDX_kilocode_users_blocked_by_kilo_user_id",
+ "columns": [
+ {
+ "expression": "blocked_by_kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilocode_users_openrouter_upstream_safety_identifier": {
+ "name": "UQ_kilocode_users_openrouter_upstream_safety_identifier",
+ "columns": [
+ {
+ "expression": "openrouter_upstream_safety_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilocode_users\".\"openrouter_upstream_safety_identifier\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilocode_users_openrouter_downstream_safety_identifier": {
+ "name": "UQ_kilocode_users_openrouter_downstream_safety_identifier",
+ "columns": [
+ {
+ "expression": "openrouter_downstream_safety_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilocode_users\".\"openrouter_downstream_safety_identifier\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_kilocode_users_vercel_downstream_safety_identifier": {
+ "name": "UQ_kilocode_users_vercel_downstream_safety_identifier",
+ "columns": [
+ {
+ "expression": "vercel_downstream_safety_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"kilocode_users\".\"vercel_downstream_safety_identifier\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilocode_users_normalized_email": {
+ "name": "IDX_kilocode_users_normalized_email",
+ "columns": [
+ {
+ "expression": "normalized_email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_kilocode_users_email_domain": {
+ "name": "IDX_kilocode_users_email_domain",
+ "columns": [
+ {
+ "expression": "email_domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "kilocode_users_app_store_account_token_unique": {
+ "name": "kilocode_users_app_store_account_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "app_store_account_token"
+ ]
+ },
+ "UQ_b1afacbcf43f2c7c4cb9f7e7faa": {
+ "name": "UQ_b1afacbcf43f2c7c4cb9f7e7faa",
+ "nullsNotDistinct": false,
+ "columns": [
+ "google_user_email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "blocked_reason_not_empty": {
+ "name": "blocked_reason_not_empty",
+ "value": "length(blocked_reason) > 0"
+ },
+ "kilocode_users_is_super_admin_requires_admin_check": {
+ "name": "kilocode_users_is_super_admin_requires_admin_check",
+ "value": "NOT \"kilocode_users\".\"is_super_admin\" OR \"kilocode_users\".\"is_admin\""
+ },
+ "kilocode_users_can_view_sessions_requires_admin_check": {
+ "name": "kilocode_users_can_view_sessions_requires_admin_check",
+ "value": "NOT \"kilocode_users\".\"can_view_sessions\" OR \"kilocode_users\".\"is_admin\""
+ },
+ "kilocode_users_can_manage_credits_requires_admin_check": {
+ "name": "kilocode_users_can_manage_credits_requires_admin_check",
+ "value": "NOT \"kilocode_users\".\"can_manage_credits\" OR \"kilocode_users\".\"is_admin\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.magic_link_tokens": {
+ "name": "magic_link_tokens",
+ "schema": "",
+ "columns": {
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "reserved_until": {
+ "name": "reserved_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "purpose": {
+ "name": "purpose",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'magic_link'"
+ },
+ "challenge_id": {
+ "name": "challenge_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_magic_link_tokens_email": {
+ "name": "idx_magic_link_tokens_email",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_magic_link_tokens_expires_at": {
+ "name": "idx_magic_link_tokens_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_magic_link_tokens_challenge_id": {
+ "name": "UQ_magic_link_tokens_challenge_id",
+ "columns": [
+ {
+ "expression": "challenge_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"magic_link_tokens\".\"challenge_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "check_expires_at_future": {
+ "name": "check_expires_at_future",
+ "value": "\"magic_link_tokens\".\"expires_at\" > \"magic_link_tokens\".\"created_at\""
+ },
+ "check_magic_link_tokens_purpose": {
+ "name": "check_magic_link_tokens_purpose",
+ "value": "\"magic_link_tokens\".\"purpose\" IN ('magic_link', 'sign_in_code', 'data_export_download')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_assignments": {
+ "name": "mcp_gateway_assignments",
+ "schema": "",
+ "columns": {
+ "assignment_id": {
+ "name": "assignment_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assigned_by_kilo_user_id": {
+ "name": "assigned_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "single_user_slot": {
+ "name": "single_user_slot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_assignments_active": {
+ "name": "UQ_mcp_gateway_assignments_active",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"mcp_gateway_assignments\".\"revoked_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_mcp_gateway_assignments_single_user_slot": {
+ "name": "UQ_mcp_gateway_assignments_single_user_slot",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "single_user_slot",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"mcp_gateway_assignments\".\"revoked_at\" is null and \"mcp_gateway_assignments\".\"single_user_slot\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_assignments_config": {
+ "name": "IDX_mcp_gateway_assignments_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_assignments_user": {
+ "name": "IDX_mcp_gateway_assignments_user",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_assignments_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_assignments_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_assignments",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_assignments_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_assignments_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_assignments",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_assignments_assigned_by_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_assignments_assigned_by_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_assignments",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "assigned_by_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_audit_events": {
+ "name": "mcp_gateway_audit_events",
+ "schema": "",
+ "columns": {
+ "audit_event_id": {
+ "name": "audit_event_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "actor_kilo_user_id": {
+ "name": "actor_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_scope": {
+ "name": "owner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connect_resource_id": {
+ "name": "connect_resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_grant_id": {
+ "name": "oauth_grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "correlation_metadata": {
+ "name": "correlation_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_mcp_gateway_audit_events_config": {
+ "name": "IDX_mcp_gateway_audit_events_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_audit_events_grant": {
+ "name": "IDX_mcp_gateway_audit_events_grant",
+ "columns": [
+ {
+ "expression": "oauth_grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"mcp_gateway_audit_events\".\"oauth_grant_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_audit_events_owner": {
+ "name": "IDX_mcp_gateway_audit_events_owner",
+ "columns": [
+ {
+ "expression": "owner_scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_audit_events_created_at": {
+ "name": "IDX_mcp_gateway_audit_events_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_audit_events_actor_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_audit_events_actor_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_audit_events",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "actor_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_audit_events_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_audit_events_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_audit_events",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_audit_events_connect_resource_id_mcp_gateway_connect_resources_connect_resource_id_fk": {
+ "name": "mcp_gateway_audit_events_connect_resource_id_mcp_gateway_connect_resources_connect_resource_id_fk",
+ "tableFrom": "mcp_gateway_audit_events",
+ "tableTo": "mcp_gateway_connect_resources",
+ "columnsFrom": [
+ "connect_resource_id"
+ ],
+ "columnsTo": [
+ "connect_resource_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_audit_events_instance_id_mcp_gateway_connection_instances_instance_id_fk": {
+ "name": "mcp_gateway_audit_events_instance_id_mcp_gateway_connection_instances_instance_id_fk",
+ "tableFrom": "mcp_gateway_audit_events",
+ "tableTo": "mcp_gateway_connection_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "instance_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_audit_events_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk": {
+ "name": "mcp_gateway_audit_events_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk",
+ "tableFrom": "mcp_gateway_audit_events",
+ "tableTo": "mcp_gateway_oauth_grants",
+ "columnsFrom": [
+ "oauth_grant_id"
+ ],
+ "columnsTo": [
+ "oauth_grant_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_audit_events_owner_scope": {
+ "name": "mcp_gateway_audit_events_owner_scope",
+ "value": "\"mcp_gateway_audit_events\".\"owner_scope\" IN ('personal', 'organization')"
+ },
+ "mcp_gateway_audit_events_outcome": {
+ "name": "mcp_gateway_audit_events_outcome",
+ "value": "\"mcp_gateway_audit_events\".\"outcome\" IN ('success', 'failure', 'blocked')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_authorization_codes": {
+ "name": "mcp_gateway_authorization_codes",
+ "schema": "",
+ "columns": {
+ "authorization_code_id": {
+ "name": "authorization_code_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "code_hash": {
+ "name": "code_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "authorization_request_id": {
+ "name": "authorization_request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oauth_client_id": {
+ "name": "oauth_client_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oauth_grant_id": {
+ "name": "oauth_grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_scope": {
+ "name": "owner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "route_key": {
+ "name": "route_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canonical_resource_url": {
+ "name": "canonical_resource_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redirect_uri": {
+ "name": "redirect_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted_scopes": {
+ "name": "granted_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code_challenge": {
+ "name": "code_challenge",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "code_challenge_method": {
+ "name": "code_challenge_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'S256'"
+ },
+ "execution_context": {
+ "name": "execution_context",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_authorization_codes_code_hash": {
+ "name": "UQ_mcp_gateway_authorization_codes_code_hash",
+ "columns": [
+ {
+ "expression": "code_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_authorization_codes_expires_at": {
+ "name": "IDX_mcp_gateway_authorization_codes_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_authorization_codes_client": {
+ "name": "IDX_mcp_gateway_authorization_codes_client",
+ "columns": [
+ {
+ "expression": "oauth_client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_authorization_codes_grant": {
+ "name": "IDX_mcp_gateway_authorization_codes_grant",
+ "columns": [
+ {
+ "expression": "oauth_grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"mcp_gateway_authorization_codes\".\"oauth_grant_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_authorization_codes_authorization_request_id_mcp_gateway_authorization_requests_authorization_request_id_fk": {
+ "name": "mcp_gateway_authorization_codes_authorization_request_id_mcp_gateway_authorization_requests_authorization_request_id_fk",
+ "tableFrom": "mcp_gateway_authorization_codes",
+ "tableTo": "mcp_gateway_authorization_requests",
+ "columnsFrom": [
+ "authorization_request_id"
+ ],
+ "columnsTo": [
+ "authorization_request_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_authorization_codes_oauth_client_id_mcp_gateway_oauth_clients_oauth_client_id_fk": {
+ "name": "mcp_gateway_authorization_codes_oauth_client_id_mcp_gateway_oauth_clients_oauth_client_id_fk",
+ "tableFrom": "mcp_gateway_authorization_codes",
+ "tableTo": "mcp_gateway_oauth_clients",
+ "columnsFrom": [
+ "oauth_client_id"
+ ],
+ "columnsTo": [
+ "oauth_client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_authorization_codes_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk": {
+ "name": "mcp_gateway_authorization_codes_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk",
+ "tableFrom": "mcp_gateway_authorization_codes",
+ "tableTo": "mcp_gateway_oauth_grants",
+ "columnsFrom": [
+ "oauth_grant_id"
+ ],
+ "columnsTo": [
+ "oauth_grant_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_authorization_codes_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_authorization_codes_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_authorization_codes",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_authorization_codes_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_authorization_codes_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_authorization_codes",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_authorization_codes_instance_id_mcp_gateway_connection_instances_instance_id_fk": {
+ "name": "mcp_gateway_authorization_codes_instance_id_mcp_gateway_connection_instances_instance_id_fk",
+ "tableFrom": "mcp_gateway_authorization_codes",
+ "tableTo": "mcp_gateway_connection_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "instance_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_authorization_codes_owner_scope": {
+ "name": "mcp_gateway_authorization_codes_owner_scope",
+ "value": "\"mcp_gateway_authorization_codes\".\"owner_scope\" IN ('personal', 'organization')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_authorization_requests": {
+ "name": "mcp_gateway_authorization_requests",
+ "schema": "",
+ "columns": {
+ "authorization_request_id": {
+ "name": "authorization_request_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "request_state_hash": {
+ "name": "request_state_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oauth_client_id": {
+ "name": "oauth_client_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oauth_grant_id": {
+ "name": "oauth_grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_scope": {
+ "name": "owner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "route_key": {
+ "name": "route_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canonical_resource_url": {
+ "name": "canonical_resource_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redirect_uri": {
+ "name": "redirect_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_scopes": {
+ "name": "requested_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted_scopes": {
+ "name": "granted_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oauth_state": {
+ "name": "oauth_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "code_challenge": {
+ "name": "code_challenge",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "code_challenge_method": {
+ "name": "code_challenge_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'S256'"
+ },
+ "execution_context": {
+ "name": "execution_context",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_status": {
+ "name": "request_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_authorization_requests_state_hash": {
+ "name": "UQ_mcp_gateway_authorization_requests_state_hash",
+ "columns": [
+ {
+ "expression": "request_state_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_authorization_requests_config": {
+ "name": "IDX_mcp_gateway_authorization_requests_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_authorization_requests_grant": {
+ "name": "IDX_mcp_gateway_authorization_requests_grant",
+ "columns": [
+ {
+ "expression": "oauth_grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"mcp_gateway_authorization_requests\".\"oauth_grant_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_authorization_requests_user": {
+ "name": "IDX_mcp_gateway_authorization_requests_user",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_authorization_requests_expires_at": {
+ "name": "IDX_mcp_gateway_authorization_requests_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_authorization_requests_oauth_client_id_mcp_gateway_oauth_clients_oauth_client_id_fk": {
+ "name": "mcp_gateway_authorization_requests_oauth_client_id_mcp_gateway_oauth_clients_oauth_client_id_fk",
+ "tableFrom": "mcp_gateway_authorization_requests",
+ "tableTo": "mcp_gateway_oauth_clients",
+ "columnsFrom": [
+ "oauth_client_id"
+ ],
+ "columnsTo": [
+ "oauth_client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_authorization_requests_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk": {
+ "name": "mcp_gateway_authorization_requests_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk",
+ "tableFrom": "mcp_gateway_authorization_requests",
+ "tableTo": "mcp_gateway_oauth_grants",
+ "columnsFrom": [
+ "oauth_grant_id"
+ ],
+ "columnsTo": [
+ "oauth_grant_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_authorization_requests_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_authorization_requests_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_authorization_requests",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_authorization_requests_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_authorization_requests_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_authorization_requests",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_authorization_requests_instance_id_mcp_gateway_connection_instances_instance_id_fk": {
+ "name": "mcp_gateway_authorization_requests_instance_id_mcp_gateway_connection_instances_instance_id_fk",
+ "tableFrom": "mcp_gateway_authorization_requests",
+ "tableTo": "mcp_gateway_connection_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "instance_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_authorization_requests_owner_scope": {
+ "name": "mcp_gateway_authorization_requests_owner_scope",
+ "value": "\"mcp_gateway_authorization_requests\".\"owner_scope\" IN ('personal', 'organization')"
+ },
+ "mcp_gateway_authorization_requests_status": {
+ "name": "mcp_gateway_authorization_requests_status",
+ "value": "\"mcp_gateway_authorization_requests\".\"request_status\" IN ('pending', 'completed', 'error')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_config_secrets": {
+ "name": "mcp_gateway_config_secrets",
+ "schema": "",
+ "columns": {
+ "config_secret_id": {
+ "name": "config_secret_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_kind": {
+ "name": "secret_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_secret": {
+ "name": "encrypted_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_version": {
+ "name": "secret_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_config_secrets_active_kind": {
+ "name": "UQ_mcp_gateway_config_secrets_active_kind",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "secret_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"mcp_gateway_config_secrets\".\"revoked_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_config_secrets_config": {
+ "name": "IDX_mcp_gateway_config_secrets_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_config_secrets_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_config_secrets_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_config_secrets",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_config_secrets_version_positive": {
+ "name": "mcp_gateway_config_secrets_version_positive",
+ "value": "\"mcp_gateway_config_secrets\".\"secret_version\" > 0"
+ },
+ "mcp_gateway_config_secrets_kind": {
+ "name": "mcp_gateway_config_secrets_kind",
+ "value": "\"mcp_gateway_config_secrets\".\"secret_kind\" IN ('static_provider_credentials', 'dynamic_registration', 'static_headers')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_configs": {
+ "name": "mcp_gateway_configs",
+ "schema": "",
+ "columns": {
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owner_scope": {
+ "name": "owner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "remote_url": {
+ "name": "remote_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_mode": {
+ "name": "auth_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sharing_mode": {
+ "name": "sharing_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_scopes": {
+ "name": "provider_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_scope_source": {
+ "name": "provider_scope_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'none'"
+ },
+ "provider_resource": {
+ "name": "provider_resource",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "path_passthrough": {
+ "name": "path_passthrough",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "config_version": {
+ "name": "config_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "discovered_provider_metadata": {
+ "name": "discovered_provider_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "registry_metadata": {
+ "name": "registry_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "auxiliary_headers": {
+ "name": "auxiliary_headers",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_by_kilo_user_id": {
+ "name": "created_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_mcp_gateway_configs_owner": {
+ "name": "IDX_mcp_gateway_configs_owner",
+ "columns": [
+ {
+ "expression": "owner_scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_configs_enabled": {
+ "name": "IDX_mcp_gateway_configs_enabled",
+ "columns": [
+ {
+ "expression": "enabled",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_configs_remote_url": {
+ "name": "IDX_mcp_gateway_configs_remote_url",
+ "columns": [
+ {
+ "expression": "remote_url",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_configs_created_by_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_configs_created_by_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_configs",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_configs_name_not_empty": {
+ "name": "mcp_gateway_configs_name_not_empty",
+ "value": "length(trim(\"mcp_gateway_configs\".\"name\")) > 0"
+ },
+ "mcp_gateway_configs_config_version_positive": {
+ "name": "mcp_gateway_configs_config_version_positive",
+ "value": "\"mcp_gateway_configs\".\"config_version\" > 0"
+ },
+ "mcp_gateway_configs_personal_single_user": {
+ "name": "mcp_gateway_configs_personal_single_user",
+ "value": "\"mcp_gateway_configs\".\"owner_scope\" <> 'personal' OR \"mcp_gateway_configs\".\"sharing_mode\" = 'single_user'"
+ },
+ "mcp_gateway_configs_owner_scope": {
+ "name": "mcp_gateway_configs_owner_scope",
+ "value": "\"mcp_gateway_configs\".\"owner_scope\" IN ('personal', 'organization')"
+ },
+ "mcp_gateway_configs_auth_mode": {
+ "name": "mcp_gateway_configs_auth_mode",
+ "value": "\"mcp_gateway_configs\".\"auth_mode\" IN ('none', 'static_headers', 'oauth_dynamic', 'oauth_static')"
+ },
+ "mcp_gateway_configs_sharing_mode": {
+ "name": "mcp_gateway_configs_sharing_mode",
+ "value": "\"mcp_gateway_configs\".\"sharing_mode\" IN ('single_user', 'multi_user')"
+ },
+ "mcp_gateway_configs_provider_scope_source": {
+ "name": "mcp_gateway_configs_provider_scope_source",
+ "value": "\"mcp_gateway_configs\".\"provider_scope_source\" IN ('none', 'discovered', 'override')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_connect_resources": {
+ "name": "mcp_gateway_connect_resources",
+ "schema": "",
+ "columns": {
+ "connect_resource_id": {
+ "name": "connect_resource_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_scope": {
+ "name": "owner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "route_key": {
+ "name": "route_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canonical_url": {
+ "name": "canonical_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "route_status": {
+ "name": "route_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "route_version": {
+ "name": "route_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "rotated_at": {
+ "name": "rotated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_connect_resources_route_key": {
+ "name": "UQ_mcp_gateway_connect_resources_route_key",
+ "columns": [
+ {
+ "expression": "route_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_mcp_gateway_connect_resources_active_config": {
+ "name": "UQ_mcp_gateway_connect_resources_active_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"mcp_gateway_connect_resources\".\"route_status\" = 'active'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_connect_resources_config": {
+ "name": "IDX_mcp_gateway_connect_resources_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_connect_resources_canonical_url": {
+ "name": "IDX_mcp_gateway_connect_resources_canonical_url",
+ "columns": [
+ {
+ "expression": "canonical_url",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_connect_resources_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_connect_resources_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_connect_resources",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_connect_resources_route_key_format": {
+ "name": "mcp_gateway_connect_resources_route_key_format",
+ "value": "\"mcp_gateway_connect_resources\".\"route_key\" ~ '^[A-Za-z0-9_-]{32,}$'"
+ },
+ "mcp_gateway_connect_resources_route_version_positive": {
+ "name": "mcp_gateway_connect_resources_route_version_positive",
+ "value": "\"mcp_gateway_connect_resources\".\"route_version\" > 0"
+ },
+ "mcp_gateway_connect_resources_owner_scope": {
+ "name": "mcp_gateway_connect_resources_owner_scope",
+ "value": "\"mcp_gateway_connect_resources\".\"owner_scope\" IN ('personal', 'organization')"
+ },
+ "mcp_gateway_connect_resources_route_status": {
+ "name": "mcp_gateway_connect_resources_route_status",
+ "value": "\"mcp_gateway_connect_resources\".\"route_status\" IN ('active', 'rotated', 'revoked')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_connection_instances": {
+ "name": "mcp_gateway_connection_instances",
+ "schema": "",
+ "columns": {
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_scope": {
+ "name": "owner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "instance_status": {
+ "name": "instance_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "instance_version": {
+ "name": "instance_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "removed_at": {
+ "name": "removed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_connection_instances_non_terminal": {
+ "name": "UQ_mcp_gateway_connection_instances_non_terminal",
+ "columns": [
+ {
+ "expression": "owner_scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"mcp_gateway_connection_instances\".\"instance_status\" IN ('active', 'needs_reauth')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_connection_instances_config": {
+ "name": "IDX_mcp_gateway_connection_instances_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_connection_instances_user": {
+ "name": "IDX_mcp_gateway_connection_instances_user",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_connection_instances_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_connection_instances_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_connection_instances",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_connection_instances_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_connection_instances_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_connection_instances",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_connection_instances_version_positive": {
+ "name": "mcp_gateway_connection_instances_version_positive",
+ "value": "\"mcp_gateway_connection_instances\".\"instance_version\" > 0"
+ },
+ "mcp_gateway_connection_instances_owner_scope": {
+ "name": "mcp_gateway_connection_instances_owner_scope",
+ "value": "\"mcp_gateway_connection_instances\".\"owner_scope\" IN ('personal', 'organization')"
+ },
+ "mcp_gateway_connection_instances_status": {
+ "name": "mcp_gateway_connection_instances_status",
+ "value": "\"mcp_gateway_connection_instances\".\"instance_status\" IN ('active', 'needs_reauth', 'revoked', 'removed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_oauth_clients": {
+ "name": "mcp_gateway_oauth_clients",
+ "schema": "",
+ "columns": {
+ "oauth_client_id": {
+ "name": "oauth_client_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_name": {
+ "name": "client_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "registration_token_hash": {
+ "name": "registration_token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_secret_hash": {
+ "name": "client_secret_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_endpoint_auth_method": {
+ "name": "token_endpoint_auth_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redirect_uris": {
+ "name": "redirect_uris",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_types": {
+ "name": "grant_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_types": {
+ "name": "response_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "declared_scopes": {
+ "name": "declared_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "registration_access_token_expires_at": {
+ "name": "registration_access_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_oauth_clients_client_id": {
+ "name": "UQ_mcp_gateway_oauth_clients_client_id",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_mcp_gateway_oauth_clients_registration_token_hash": {
+ "name": "UQ_mcp_gateway_oauth_clients_registration_token_hash",
+ "columns": [
+ {
+ "expression": "registration_token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_oauth_clients_deleted_at": {
+ "name": "IDX_mcp_gateway_oauth_clients_deleted_at",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_oauth_clients_client_id_format": {
+ "name": "mcp_gateway_oauth_clients_client_id_format",
+ "value": "\"mcp_gateway_oauth_clients\".\"client_id\" ~ '^[A-Za-z0-9._-]+:[A-Za-z0-9._-]+$'"
+ },
+ "mcp_gateway_oauth_clients_auth_method": {
+ "name": "mcp_gateway_oauth_clients_auth_method",
+ "value": "\"mcp_gateway_oauth_clients\".\"token_endpoint_auth_method\" IN ('none', 'client_secret_post', 'client_secret_basic')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_oauth_grants": {
+ "name": "mcp_gateway_oauth_grants",
+ "schema": "",
+ "columns": {
+ "oauth_grant_id": {
+ "name": "oauth_grant_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "oauth_client_id": {
+ "name": "oauth_client_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_scope": {
+ "name": "owner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connect_resource_id": {
+ "name": "connect_resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redirect_uri": {
+ "name": "redirect_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted_scopes": {
+ "name": "granted_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_context": {
+ "name": "execution_context",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_version": {
+ "name": "config_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_status": {
+ "name": "grant_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revocation_reason": {
+ "name": "revocation_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_oauth_grants_active_binding": {
+ "name": "UQ_mcp_gateway_oauth_grants_active_binding",
+ "columns": [
+ {
+ "expression": "oauth_client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connect_resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "redirect_uri",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"mcp_gateway_oauth_grants\".\"revoked_at\" is null and \"mcp_gateway_oauth_grants\".\"grant_status\" in ('pending', 'active')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_oauth_grants_client": {
+ "name": "IDX_mcp_gateway_oauth_grants_client",
+ "columns": [
+ {
+ "expression": "oauth_client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_oauth_grants_user": {
+ "name": "IDX_mcp_gateway_oauth_grants_user",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_oauth_grants_config": {
+ "name": "IDX_mcp_gateway_oauth_grants_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_oauth_grants_owner": {
+ "name": "IDX_mcp_gateway_oauth_grants_owner",
+ "columns": [
+ {
+ "expression": "owner_scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_oauth_grants_resource": {
+ "name": "IDX_mcp_gateway_oauth_grants_resource",
+ "columns": [
+ {
+ "expression": "connect_resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_oauth_grants_instance": {
+ "name": "IDX_mcp_gateway_oauth_grants_instance",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_oauth_grants_revoked_at": {
+ "name": "IDX_mcp_gateway_oauth_grants_revoked_at",
+ "columns": [
+ {
+ "expression": "revoked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_oauth_grants_oauth_client_id_mcp_gateway_oauth_clients_oauth_client_id_fk": {
+ "name": "mcp_gateway_oauth_grants_oauth_client_id_mcp_gateway_oauth_clients_oauth_client_id_fk",
+ "tableFrom": "mcp_gateway_oauth_grants",
+ "tableTo": "mcp_gateway_oauth_clients",
+ "columnsFrom": [
+ "oauth_client_id"
+ ],
+ "columnsTo": [
+ "oauth_client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_oauth_grants_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_oauth_grants_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_oauth_grants",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_oauth_grants_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_oauth_grants_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_oauth_grants",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_oauth_grants_connect_resource_id_mcp_gateway_connect_resources_connect_resource_id_fk": {
+ "name": "mcp_gateway_oauth_grants_connect_resource_id_mcp_gateway_connect_resources_connect_resource_id_fk",
+ "tableFrom": "mcp_gateway_oauth_grants",
+ "tableTo": "mcp_gateway_connect_resources",
+ "columnsFrom": [
+ "connect_resource_id"
+ ],
+ "columnsTo": [
+ "connect_resource_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_oauth_grants_instance_id_mcp_gateway_connection_instances_instance_id_fk": {
+ "name": "mcp_gateway_oauth_grants_instance_id_mcp_gateway_connection_instances_instance_id_fk",
+ "tableFrom": "mcp_gateway_oauth_grants",
+ "tableTo": "mcp_gateway_connection_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "instance_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_oauth_grants_config_version_positive": {
+ "name": "mcp_gateway_oauth_grants_config_version_positive",
+ "value": "\"mcp_gateway_oauth_grants\".\"config_version\" > 0"
+ },
+ "mcp_gateway_oauth_grants_owner_scope": {
+ "name": "mcp_gateway_oauth_grants_owner_scope",
+ "value": "\"mcp_gateway_oauth_grants\".\"owner_scope\" IN ('personal', 'organization')"
+ },
+ "mcp_gateway_oauth_grants_status": {
+ "name": "mcp_gateway_oauth_grants_status",
+ "value": "\"mcp_gateway_oauth_grants\".\"grant_status\" IN ('pending', 'active', 'revoked')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_pending_provider_authorizations": {
+ "name": "mcp_gateway_pending_provider_authorizations",
+ "schema": "",
+ "columns": {
+ "pending_provider_authorization_id": {
+ "name": "pending_provider_authorization_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "state_hash": {
+ "name": "state_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "authorization_request_id": {
+ "name": "authorization_request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_grant_id": {
+ "name": "oauth_grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_scope": {
+ "name": "owner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "route_key": {
+ "name": "route_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canonical_resource_url": {
+ "name": "canonical_resource_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "remote_url": {
+ "name": "remote_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_mode": {
+ "name": "auth_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_authorization_endpoint": {
+ "name": "provider_authorization_endpoint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_token_endpoint": {
+ "name": "provider_token_endpoint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_state": {
+ "name": "encrypted_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_context": {
+ "name": "execution_context",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_version": {
+ "name": "config_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pending_status": {
+ "name": "pending_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_pending_provider_authorizations_state_hash": {
+ "name": "UQ_mcp_gateway_pending_provider_authorizations_state_hash",
+ "columns": [
+ {
+ "expression": "state_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_pending_provider_authorizations_config": {
+ "name": "IDX_mcp_gateway_pending_provider_authorizations_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_pending_provider_authorizations_grant": {
+ "name": "IDX_mcp_gateway_pending_provider_authorizations_grant",
+ "columns": [
+ {
+ "expression": "oauth_grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"mcp_gateway_pending_provider_authorizations\".\"oauth_grant_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_pending_provider_authorizations_expires_at": {
+ "name": "IDX_mcp_gateway_pending_provider_authorizations_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_pending_provider_authorizations_authorization_request_id_mcp_gateway_authorization_requests_authorization_request_id_fk": {
+ "name": "mcp_gateway_pending_provider_authorizations_authorization_request_id_mcp_gateway_authorization_requests_authorization_request_id_fk",
+ "tableFrom": "mcp_gateway_pending_provider_authorizations",
+ "tableTo": "mcp_gateway_authorization_requests",
+ "columnsFrom": [
+ "authorization_request_id"
+ ],
+ "columnsTo": [
+ "authorization_request_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_pending_provider_authorizations_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk": {
+ "name": "mcp_gateway_pending_provider_authorizations_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk",
+ "tableFrom": "mcp_gateway_pending_provider_authorizations",
+ "tableTo": "mcp_gateway_oauth_grants",
+ "columnsFrom": [
+ "oauth_grant_id"
+ ],
+ "columnsTo": [
+ "oauth_grant_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_pending_provider_authorizations_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_pending_provider_authorizations_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_pending_provider_authorizations",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_pending_provider_authorizations_instance_id_mcp_gateway_connection_instances_instance_id_fk": {
+ "name": "mcp_gateway_pending_provider_authorizations_instance_id_mcp_gateway_connection_instances_instance_id_fk",
+ "tableFrom": "mcp_gateway_pending_provider_authorizations",
+ "tableTo": "mcp_gateway_connection_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "instance_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_pending_provider_authorizations_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_pending_provider_authorizations_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_pending_provider_authorizations",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_pending_provider_authorizations_config_version_positive": {
+ "name": "mcp_gateway_pending_provider_authorizations_config_version_positive",
+ "value": "\"mcp_gateway_pending_provider_authorizations\".\"config_version\" > 0"
+ },
+ "mcp_gateway_pending_provider_authorizations_owner_scope": {
+ "name": "mcp_gateway_pending_provider_authorizations_owner_scope",
+ "value": "\"mcp_gateway_pending_provider_authorizations\".\"owner_scope\" IN ('personal', 'organization')"
+ },
+ "mcp_gateway_pending_provider_authorizations_auth_mode": {
+ "name": "mcp_gateway_pending_provider_authorizations_auth_mode",
+ "value": "\"mcp_gateway_pending_provider_authorizations\".\"auth_mode\" IN ('none', 'static_headers', 'oauth_dynamic', 'oauth_static')"
+ },
+ "mcp_gateway_pending_provider_authorizations_status": {
+ "name": "mcp_gateway_pending_provider_authorizations_status",
+ "value": "\"mcp_gateway_pending_provider_authorizations\".\"pending_status\" IN ('pending', 'completed', 'error')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_provider_grants": {
+ "name": "mcp_gateway_provider_grants",
+ "schema": "",
+ "columns": {
+ "provider_grant_id": {
+ "name": "provider_grant_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_grant": {
+ "name": "encrypted_grant",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_subject": {
+ "name": "provider_subject",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_scope": {
+ "name": "grant_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_status": {
+ "name": "grant_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "grant_version": {
+ "name": "grant_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_provider_grants_active_instance": {
+ "name": "UQ_mcp_gateway_provider_grants_active_instance",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"mcp_gateway_provider_grants\".\"grant_status\" = 'active'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_provider_grants_instance": {
+ "name": "IDX_mcp_gateway_provider_grants_instance",
+ "columns": [
+ {
+ "expression": "instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_provider_grants_instance_id_mcp_gateway_connection_instances_instance_id_fk": {
+ "name": "mcp_gateway_provider_grants_instance_id_mcp_gateway_connection_instances_instance_id_fk",
+ "tableFrom": "mcp_gateway_provider_grants",
+ "tableTo": "mcp_gateway_connection_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "instance_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_provider_grants_version_positive": {
+ "name": "mcp_gateway_provider_grants_version_positive",
+ "value": "\"mcp_gateway_provider_grants\".\"grant_version\" > 0"
+ },
+ "mcp_gateway_provider_grants_status": {
+ "name": "mcp_gateway_provider_grants_status",
+ "value": "\"mcp_gateway_provider_grants\".\"grant_status\" IN ('active', 'revoked')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_rate_limit_windows": {
+ "name": "mcp_gateway_rate_limit_windows",
+ "schema": "",
+ "columns": {
+ "rate_limit_window_id": {
+ "name": "rate_limit_window_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "ip_hash": {
+ "name": "ip_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_started_at": {
+ "name": "window_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_rate_limit_windows_ip_window": {
+ "name": "UQ_mcp_gateway_rate_limit_windows_ip_window",
+ "columns": [
+ {
+ "expression": "ip_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "window_started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_rate_limit_windows_window": {
+ "name": "IDX_mcp_gateway_rate_limit_windows_window",
+ "columns": [
+ {
+ "expression": "window_started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_rate_limit_windows_attempt_count_non_negative": {
+ "name": "mcp_gateway_rate_limit_windows_attempt_count_non_negative",
+ "value": "\"mcp_gateway_rate_limit_windows\".\"attempt_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_gateway_refresh_tokens": {
+ "name": "mcp_gateway_refresh_tokens",
+ "schema": "",
+ "columns": {
+ "refresh_token_id": {
+ "name": "refresh_token_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rotated_from_refresh_token_id": {
+ "name": "rotated_from_refresh_token_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_client_id": {
+ "name": "oauth_client_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "oauth_grant_id": {
+ "name": "oauth_grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_scope": {
+ "name": "owner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "route_key": {
+ "name": "route_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canonical_resource_url": {
+ "name": "canonical_resource_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted_scopes": {
+ "name": "granted_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_context": {
+ "name": "execution_context",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_mcp_gateway_refresh_tokens_token_hash": {
+ "name": "UQ_mcp_gateway_refresh_tokens_token_hash",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_refresh_tokens_user": {
+ "name": "IDX_mcp_gateway_refresh_tokens_user",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_refresh_tokens_grant": {
+ "name": "IDX_mcp_gateway_refresh_tokens_grant",
+ "columns": [
+ {
+ "expression": "oauth_grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"mcp_gateway_refresh_tokens\".\"oauth_grant_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_refresh_tokens_config": {
+ "name": "IDX_mcp_gateway_refresh_tokens_config",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_mcp_gateway_refresh_tokens_consumed_at": {
+ "name": "IDX_mcp_gateway_refresh_tokens_consumed_at",
+ "columns": [
+ {
+ "expression": "consumed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_gateway_refresh_tokens_oauth_client_id_mcp_gateway_oauth_clients_oauth_client_id_fk": {
+ "name": "mcp_gateway_refresh_tokens_oauth_client_id_mcp_gateway_oauth_clients_oauth_client_id_fk",
+ "tableFrom": "mcp_gateway_refresh_tokens",
+ "tableTo": "mcp_gateway_oauth_clients",
+ "columnsFrom": [
+ "oauth_client_id"
+ ],
+ "columnsTo": [
+ "oauth_client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_refresh_tokens_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk": {
+ "name": "mcp_gateway_refresh_tokens_oauth_grant_id_mcp_gateway_oauth_grants_oauth_grant_id_fk",
+ "tableFrom": "mcp_gateway_refresh_tokens",
+ "tableTo": "mcp_gateway_oauth_grants",
+ "columnsFrom": [
+ "oauth_grant_id"
+ ],
+ "columnsTo": [
+ "oauth_grant_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_refresh_tokens_config_id_mcp_gateway_configs_config_id_fk": {
+ "name": "mcp_gateway_refresh_tokens_config_id_mcp_gateway_configs_config_id_fk",
+ "tableFrom": "mcp_gateway_refresh_tokens",
+ "tableTo": "mcp_gateway_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "config_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_refresh_tokens_kilo_user_id_kilocode_users_id_fk": {
+ "name": "mcp_gateway_refresh_tokens_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "mcp_gateway_refresh_tokens",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_gateway_refresh_tokens_instance_id_mcp_gateway_connection_instances_instance_id_fk": {
+ "name": "mcp_gateway_refresh_tokens_instance_id_mcp_gateway_connection_instances_instance_id_fk",
+ "tableFrom": "mcp_gateway_refresh_tokens",
+ "tableTo": "mcp_gateway_connection_instances",
+ "columnsFrom": [
+ "instance_id"
+ ],
+ "columnsTo": [
+ "instance_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "mcp_gateway_refresh_tokens_owner_scope": {
+ "name": "mcp_gateway_refresh_tokens_owner_scope",
+ "value": "\"mcp_gateway_refresh_tokens\".\"owner_scope\" IN ('personal', 'organization')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.microdollar_usage": {
+ "name": "microdollar_usage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost": {
+ "name": "cost",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cache_write_tokens": {
+ "name": "cache_write_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cache_hit_tokens": {
+ "name": "cache_hit_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_model": {
+ "name": "requested_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cache_discount": {
+ "name": "cache_discount",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_error": {
+ "name": "has_error",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "abuse_classification": {
+ "name": "abuse_classification",
+ "type": "smallint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inference_provider": {
+ "name": "inference_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_created_at": {
+ "name": "idx_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_abuse_classification": {
+ "name": "idx_abuse_classification",
+ "columns": [
+ {
+ "expression": "abuse_classification",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_kilo_user_id_created_at2": {
+ "name": "idx_kilo_user_id_created_at2",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_microdollar_usage_organization_id": {
+ "name": "idx_microdollar_usage_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"microdollar_usage\".\"organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.microdollar_usage_daily": {
+ "name": "microdollar_usage_daily",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "usage_date": {
+ "name": "usage_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total_cost_microdollars": {
+ "name": "total_cost_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_microdollar_usage_daily_personal": {
+ "name": "idx_microdollar_usage_daily_personal",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "usage_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"microdollar_usage_daily\".\"organization_id\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_microdollar_usage_daily_org": {
+ "name": "idx_microdollar_usage_daily_org",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "usage_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"microdollar_usage_daily\".\"organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.microdollar_usage_daily_repairs": {
+ "name": "microdollar_usage_daily_repairs",
+ "schema": "",
+ "columns": {
+ "usage_id": {
+ "name": "usage_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "usage_date": {
+ "name": "usage_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claim_token": {
+ "name": "claim_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_error_redacted": {
+ "name": "last_error_redacted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_microdollar_usage_daily_repairs_claim": {
+ "name": "IDX_microdollar_usage_daily_repairs_claim",
+ "columns": [
+ {
+ "expression": "attempt_count",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "claimed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "usage_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "usage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "microdollar_usage_daily_repairs_usage_id_microdollar_usage_id_fk": {
+ "name": "microdollar_usage_daily_repairs_usage_id_microdollar_usage_id_fk",
+ "tableFrom": "microdollar_usage_daily_repairs",
+ "tableTo": "microdollar_usage",
+ "columnsFrom": [
+ "usage_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "microdollar_usage_daily_repairs_attempt_count_check": {
+ "name": "microdollar_usage_daily_repairs_attempt_count_check",
+ "value": "\"microdollar_usage_daily_repairs\".\"attempt_count\" >= 0"
+ },
+ "microdollar_usage_daily_repairs_claim_token_check": {
+ "name": "microdollar_usage_daily_repairs_claim_token_check",
+ "value": "(\"microdollar_usage_daily_repairs\".\"claimed_at\" IS NULL AND \"microdollar_usage_daily_repairs\".\"claim_token\" IS NULL) OR (\"microdollar_usage_daily_repairs\".\"claimed_at\" IS NOT NULL AND \"microdollar_usage_daily_repairs\".\"claim_token\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.microdollar_usage_metadata": {
+ "name": "microdollar_usage_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "http_user_agent_id": {
+ "name": "http_user_agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_ip_id": {
+ "name": "http_ip_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vercel_ip_city_id": {
+ "name": "vercel_ip_city_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vercel_ip_country_id": {
+ "name": "vercel_ip_country_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vercel_ip_latitude": {
+ "name": "vercel_ip_latitude",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vercel_ip_longitude": {
+ "name": "vercel_ip_longitude",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ja4_digest_id": {
+ "name": "ja4_digest_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_prompt_prefix": {
+ "name": "user_prompt_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_prompt_prefix_id": {
+ "name": "system_prompt_prefix_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_prompt_length": {
+ "name": "system_prompt_length",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_tokens": {
+ "name": "max_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_middle_out_transform": {
+ "name": "has_middle_out_transform",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status_code": {
+ "name": "status_code",
+ "type": "smallint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "upstream_id": {
+ "name": "upstream_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finish_reason_id": {
+ "name": "finish_reason_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latency": {
+ "name": "latency",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "moderation_latency": {
+ "name": "moderation_latency",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "generation_time": {
+ "name": "generation_time",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_byok": {
+ "name": "is_byok",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_user_byok": {
+ "name": "is_user_byok",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "streamed": {
+ "name": "streamed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancelled": {
+ "name": "cancelled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "editor_name_id": {
+ "name": "editor_name_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_kind_id": {
+ "name": "api_kind_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_tools": {
+ "name": "has_tools",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "machine_id": {
+ "name": "machine_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "feature_id": {
+ "name": "feature_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mode_id": {
+ "name": "mode_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_model_id": {
+ "name": "auto_model_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "market_cost": {
+ "name": "market_cost",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_free": {
+ "name": "is_free",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "abuse_delay": {
+ "name": "abuse_delay",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "abuse_downgraded_from": {
+ "name": "abuse_downgraded_from",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_microdollar_usage_metadata_created_at": {
+ "name": "idx_microdollar_usage_metadata_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_microdollar_usage_metadata_session_id": {
+ "name": "idx_microdollar_usage_metadata_session_id",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"microdollar_usage_metadata\".\"session_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "microdollar_usage_metadata_http_user_agent_id_http_user_agent_http_user_agent_id_fk": {
+ "name": "microdollar_usage_metadata_http_user_agent_id_http_user_agent_http_user_agent_id_fk",
+ "tableFrom": "microdollar_usage_metadata",
+ "tableTo": "http_user_agent",
+ "columnsFrom": [
+ "http_user_agent_id"
+ ],
+ "columnsTo": [
+ "http_user_agent_id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "microdollar_usage_metadata_http_ip_id_http_ip_http_ip_id_fk": {
+ "name": "microdollar_usage_metadata_http_ip_id_http_ip_http_ip_id_fk",
+ "tableFrom": "microdollar_usage_metadata",
+ "tableTo": "http_ip",
+ "columnsFrom": [
+ "http_ip_id"
+ ],
+ "columnsTo": [
+ "http_ip_id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "microdollar_usage_metadata_vercel_ip_city_id_vercel_ip_city_vercel_ip_city_id_fk": {
+ "name": "microdollar_usage_metadata_vercel_ip_city_id_vercel_ip_city_vercel_ip_city_id_fk",
+ "tableFrom": "microdollar_usage_metadata",
+ "tableTo": "vercel_ip_city",
+ "columnsFrom": [
+ "vercel_ip_city_id"
+ ],
+ "columnsTo": [
+ "vercel_ip_city_id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "microdollar_usage_metadata_vercel_ip_country_id_vercel_ip_country_vercel_ip_country_id_fk": {
+ "name": "microdollar_usage_metadata_vercel_ip_country_id_vercel_ip_country_vercel_ip_country_id_fk",
+ "tableFrom": "microdollar_usage_metadata",
+ "tableTo": "vercel_ip_country",
+ "columnsFrom": [
+ "vercel_ip_country_id"
+ ],
+ "columnsTo": [
+ "vercel_ip_country_id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "microdollar_usage_metadata_ja4_digest_id_ja4_digest_ja4_digest_id_fk": {
+ "name": "microdollar_usage_metadata_ja4_digest_id_ja4_digest_ja4_digest_id_fk",
+ "tableFrom": "microdollar_usage_metadata",
+ "tableTo": "ja4_digest",
+ "columnsFrom": [
+ "ja4_digest_id"
+ ],
+ "columnsTo": [
+ "ja4_digest_id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "microdollar_usage_metadata_system_prompt_prefix_id_system_prompt_prefix_system_prompt_prefix_id_fk": {
+ "name": "microdollar_usage_metadata_system_prompt_prefix_id_system_prompt_prefix_system_prompt_prefix_id_fk",
+ "tableFrom": "microdollar_usage_metadata",
+ "tableTo": "system_prompt_prefix",
+ "columnsFrom": [
+ "system_prompt_prefix_id"
+ ],
+ "columnsTo": [
+ "system_prompt_prefix_id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mode": {
+ "name": "mode",
+ "schema": "",
+ "columns": {
+ "mode_id": {
+ "name": "mode_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_mode": {
+ "name": "UQ_mode",
+ "columns": [
+ {
+ "expression": "mode",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.model_stats": {
+ "name": "model_stats",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "is_featured": {
+ "name": "is_featured",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_stealth": {
+ "name": "is_stealth",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_recommended": {
+ "name": "is_recommended",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "openrouter_id": {
+ "name": "openrouter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aa_slug": {
+ "name": "aa_slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model_creator": {
+ "name": "model_creator",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "creator_slug": {
+ "name": "creator_slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "release_date": {
+ "name": "release_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "price_input": {
+ "name": "price_input",
+ "type": "numeric(10, 6)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "price_output": {
+ "name": "price_output",
+ "type": "numeric(10, 6)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "coding_index": {
+ "name": "coding_index",
+ "type": "numeric(5, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "speed_tokens_per_sec": {
+ "name": "speed_tokens_per_sec",
+ "type": "numeric(8, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "context_length": {
+ "name": "context_length",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_output_tokens": {
+ "name": "max_output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_modalities": {
+ "name": "input_modalities",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "openrouter_data": {
+ "name": "openrouter_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "benchmarks": {
+ "name": "benchmarks",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "chart_data": {
+ "name": "chart_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_model_stats_openrouter_id": {
+ "name": "IDX_model_stats_openrouter_id",
+ "columns": [
+ {
+ "expression": "openrouter_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_stats_slug": {
+ "name": "IDX_model_stats_slug",
+ "columns": [
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_stats_is_active": {
+ "name": "IDX_model_stats_is_active",
+ "columns": [
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_stats_creator_slug": {
+ "name": "IDX_model_stats_creator_slug",
+ "columns": [
+ {
+ "expression": "creator_slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_stats_price_input": {
+ "name": "IDX_model_stats_price_input",
+ "columns": [
+ {
+ "expression": "price_input",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_stats_coding_index": {
+ "name": "IDX_model_stats_coding_index",
+ "columns": [
+ {
+ "expression": "coding_index",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_stats_context_length": {
+ "name": "IDX_model_stats_context_length",
+ "columns": [
+ {
+ "expression": "context_length",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "model_stats_openrouter_id_unique": {
+ "name": "model_stats_openrouter_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "openrouter_id"
+ ]
+ },
+ "model_stats_slug_unique": {
+ "name": "model_stats_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.model_eval_ingestions": {
+ "name": "model_eval_ingestions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "bench_eval_name": {
+ "name": "bench_eval_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bench_eval_url": {
+ "name": "bench_eval_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model_stats_id": {
+ "name": "model_stats_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "variant": {
+ "name": "variant",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "task_source": {
+ "name": "task_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "n_total_trials": {
+ "name": "n_total_trials",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "n_attempts": {
+ "name": "n_attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_score": {
+ "name": "total_score",
+ "type": "numeric(14, 6)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "overall_score": {
+ "name": "overall_score",
+ "type": "numeric(12, 8)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "n_errored": {
+ "name": "n_errored",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "avg_cost_microdollars": {
+ "name": "avg_cost_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_cost_microdollars": {
+ "name": "total_cost_microdollars",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "avg_input_tokens": {
+ "name": "avg_input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_input_tokens": {
+ "name": "total_input_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "avg_output_tokens": {
+ "name": "avg_output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_output_tokens": {
+ "name": "total_output_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "avg_cache_read_tokens": {
+ "name": "avg_cache_read_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_cache_read_tokens": {
+ "name": "total_cache_read_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "avg_execution_ms": {
+ "name": "avg_execution_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "promoted_at": {
+ "name": "promoted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "promoted_by_email": {
+ "name": "promoted_by_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "promotion_note": {
+ "name": "promotion_note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_model_eval_ingestions_lookup": {
+ "name": "IDX_model_eval_ingestions_lookup",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "model",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "variant",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "task_source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "promoted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_eval_ingestions_model_stats": {
+ "name": "IDX_model_eval_ingestions_model_stats",
+ "columns": [
+ {
+ "expression": "model_stats_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_eval_ingestions_promoted_by_email_lower": {
+ "name": "IDX_model_eval_ingestions_promoted_by_email_lower",
+ "columns": [
+ {
+ "expression": "LOWER(\"promoted_by_email\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "model_eval_ingestions_model_stats_id_model_stats_id_fk": {
+ "name": "model_eval_ingestions_model_stats_id_model_stats_id_fk",
+ "tableFrom": "model_eval_ingestions",
+ "tableTo": "model_stats",
+ "columnsFrom": [
+ "model_stats_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "model_eval_ingestions_bench_eval_name_unique": {
+ "name": "model_eval_ingestions_bench_eval_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "bench_eval_name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.model_experiment": {
+ "name": "model_experiment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "public_model_id": {
+ "name": "public_model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'draft'"
+ },
+ "is_archived": {
+ "name": "is_archived",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "UQ_model_experiment_public_model_id_routing": {
+ "name": "UQ_model_experiment_public_model_id_routing",
+ "columns": [
+ {
+ "expression": "public_model_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"model_experiment\".\"status\" IN ('active', 'paused')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_experiment_status": {
+ "name": "IDX_model_experiment_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "model_experiment_created_by_user_id_kilocode_users_id_fk": {
+ "name": "model_experiment_created_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "model_experiment",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "model_experiment_status_valid": {
+ "name": "model_experiment_status_valid",
+ "value": "\"model_experiment\".\"status\" IN ('draft', 'active', 'paused', 'completed')"
+ },
+ "model_experiment_active_not_archived": {
+ "name": "model_experiment_active_not_archived",
+ "value": "\"model_experiment\".\"status\" <> 'active' OR \"model_experiment\".\"is_archived\" = false"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.model_experiment_request": {
+ "name": "model_experiment_request",
+ "schema": "",
+ "columns": {
+ "usage_id": {
+ "name": "usage_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "variant_version_id": {
+ "name": "variant_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "allocation_subject": {
+ "name": "allocation_subject",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_request_id": {
+ "name": "client_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_kind": {
+ "name": "request_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_body_sha256": {
+ "name": "request_body_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "was_truncated": {
+ "name": "was_truncated",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_model_experiment_request_variant_version_created_at": {
+ "name": "IDX_model_experiment_request_variant_version_created_at",
+ "columns": [
+ {
+ "expression": "variant_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_model_experiment_request_client_request_id": {
+ "name": "IDX_model_experiment_request_client_request_id",
+ "columns": [
+ {
+ "expression": "client_request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"model_experiment_request\".\"client_request_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "model_experiment_request_usage_id_microdollar_usage_id_fk": {
+ "name": "model_experiment_request_usage_id_microdollar_usage_id_fk",
+ "tableFrom": "model_experiment_request",
+ "tableTo": "microdollar_usage",
+ "columnsFrom": [
+ "usage_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "model_experiment_request_variant_version_id_model_experiment_variant_version_id_fk": {
+ "name": "model_experiment_request_variant_version_id_model_experiment_variant_version_id_fk",
+ "tableFrom": "model_experiment_request",
+ "tableTo": "model_experiment_variant_version",
+ "columnsFrom": [
+ "variant_version_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "model_experiment_request_usage_id_created_at_pk": {
+ "name": "model_experiment_request_usage_id_created_at_pk",
+ "columns": [
+ "usage_id",
+ "created_at"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "model_experiment_request_allocation_subject_valid": {
+ "name": "model_experiment_request_allocation_subject_valid",
+ "value": "\"model_experiment_request\".\"allocation_subject\" IN ('user', 'machine', 'ip')"
+ },
+ "model_experiment_request_request_kind_valid": {
+ "name": "model_experiment_request_request_kind_valid",
+ "value": "\"model_experiment_request\".\"request_kind\" IN ('chat_completions', 'messages', 'responses')"
+ },
+ "model_experiment_request_request_body_sha256_format": {
+ "name": "model_experiment_request_request_body_sha256_format",
+ "value": "\"model_experiment_request\".\"request_body_sha256\" ~ '^[0-9a-f]{64}$' OR \"model_experiment_request\".\"request_body_sha256\" IN ('__failed__', '__deleted__')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.model_experiment_variant": {
+ "name": "model_experiment_variant",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "experiment_id": {
+ "name": "experiment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "weight": {
+ "name": "weight",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_model_experiment_variant_experiment_id": {
+ "name": "IDX_model_experiment_variant_experiment_id",
+ "columns": [
+ {
+ "expression": "experiment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "model_experiment_variant_experiment_id_model_experiment_id_fk": {
+ "name": "model_experiment_variant_experiment_id_model_experiment_id_fk",
+ "tableFrom": "model_experiment_variant",
+ "tableTo": "model_experiment",
+ "columnsFrom": [
+ "experiment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_model_experiment_variant_experiment_label": {
+ "name": "UQ_model_experiment_variant_experiment_label",
+ "nullsNotDistinct": false,
+ "columns": [
+ "experiment_id",
+ "label"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "model_experiment_variant_weight_positive": {
+ "name": "model_experiment_variant_weight_positive",
+ "value": "\"model_experiment_variant\".\"weight\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.model_experiment_variant_version": {
+ "name": "model_experiment_variant_version",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "variant_id": {
+ "name": "variant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "upstream": {
+ "name": "upstream",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "encrypted_api_key": {
+ "name": "encrypted_api_key",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "effective_at": {
+ "name": "effective_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_model_experiment_variant_version_variant_effective": {
+ "name": "IDX_model_experiment_variant_version_variant_effective",
+ "columns": [
+ {
+ "expression": "variant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "effective_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "model_experiment_variant_version_variant_id_model_experiment_variant_id_fk": {
+ "name": "model_experiment_variant_version_variant_id_model_experiment_variant_id_fk",
+ "tableFrom": "model_experiment_variant_version",
+ "tableTo": "model_experiment_variant",
+ "columnsFrom": [
+ "variant_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "model_experiment_variant_version_created_by_kilocode_users_id_fk": {
+ "name": "model_experiment_variant_version_created_by_kilocode_users_id_fk",
+ "tableFrom": "model_experiment_variant_version",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.models_by_provider": {
+ "name": "models_by_provider",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "openrouter": {
+ "name": "openrouter",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vercel": {
+ "name": "vercel",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.native_admission_challenges": {
+ "name": "native_admission_challenges",
+ "schema": "",
+ "columns": {
+ "challenge": {
+ "name": "challenge",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_native_admission_challenges_expires_at": {
+ "name": "IDX_native_admission_challenges_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.native_attested_keys": {
+ "name": "native_attested_keys",
+ "schema": "",
+ "columns": {
+ "key_id": {
+ "name": "key_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "public_key": {
+ "name": "public_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sign_count": {
+ "name": "sign_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attested_at": {
+ "name": "attested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_native_attested_keys_kilo_user_id": {
+ "name": "IDX_native_attested_keys_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "native_attested_keys_kilo_user_id_kilocode_users_id_fk": {
+ "name": "native_attested_keys_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "native_attested_keys",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "native_attested_keys_platform_check": {
+ "name": "native_attested_keys_platform_check",
+ "value": "\"native_attested_keys\".\"platform\" IN ('ios', 'android')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.operation_ledgers": {
+ "name": "operation_ledgers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "operation_key": {
+ "name": "operation_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "intent": {
+ "name": "intent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_key": {
+ "name": "resource_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_ref": {
+ "name": "provider_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "taxonomy": {
+ "name": "taxonomy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'admitted'"
+ },
+ "outcome_code": {
+ "name": "outcome_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canonical_result": {
+ "name": "canonical_result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "admitted_at": {
+ "name": "admitted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "settled_at": {
+ "name": "settled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_operation_ledgers_kilo_user_id_domain_operation_key": {
+ "name": "UQ_operation_ledgers_kilo_user_id_domain_operation_key",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "operation_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_operation_ledgers_status_expires_at": {
+ "name": "IDX_operation_ledgers_status_expires_at",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_operation_ledgers_provider_ref": {
+ "name": "IDX_operation_ledgers_provider_ref",
+ "columns": [
+ {
+ "expression": "provider_ref",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"operation_ledgers\".\"provider_ref\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_audit_logs": {
+ "name": "organization_audit_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_email": {
+ "name": "actor_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_organization_audit_logs_organization_id": {
+ "name": "IDX_organization_audit_logs_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_audit_logs_action": {
+ "name": "IDX_organization_audit_logs_action",
+ "columns": [
+ {
+ "expression": "action",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_audit_logs_actor_id": {
+ "name": "IDX_organization_audit_logs_actor_id",
+ "columns": [
+ {
+ "expression": "actor_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_audit_logs_created_at": {
+ "name": "IDX_organization_audit_logs_created_at",
+ "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.organization_domain_claims": {
+ "name": "organization_domain_claims",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "workos_organization_id": {
+ "name": "workos_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workos_domain_id": {
+ "name": "workos_domain_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "verified_at": {
+ "name": "verified_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_organization_domain_claims_verified_domain": {
+ "name": "UQ_organization_domain_claims_verified_domain",
+ "columns": [
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"organization_domain_claims\".\"status\" = 'verified'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_organization_domain_claims_workos_domain_id": {
+ "name": "UQ_organization_domain_claims_workos_domain_id",
+ "columns": [
+ {
+ "expression": "workos_domain_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"organization_domain_claims\".\"workos_domain_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_domain_claims_organization_id": {
+ "name": "IDX_organization_domain_claims_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "organization_domain_claims_organization_id_organizations_id_fk": {
+ "name": "organization_domain_claims_organization_id_organizations_id_fk",
+ "tableFrom": "organization_domain_claims",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_organization_domain_claims_organization_domain": {
+ "name": "UQ_organization_domain_claims_organization_domain",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "domain"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "organization_domain_claims_canonical_domain_check": {
+ "name": "organization_domain_claims_canonical_domain_check",
+ "value": "length(\"organization_domain_claims\".\"domain\") BETWEEN 1 AND 253 AND \"organization_domain_claims\".\"domain\" = lower(btrim(\"organization_domain_claims\".\"domain\"))"
+ },
+ "organization_domain_claims_status_check": {
+ "name": "organization_domain_claims_status_check",
+ "value": "\"organization_domain_claims\".\"status\" IN ('pending', 'verified')"
+ },
+ "organization_domain_claims_verification_shape_check": {
+ "name": "organization_domain_claims_verification_shape_check",
+ "value": "(\"organization_domain_claims\".\"status\" = 'pending' AND \"organization_domain_claims\".\"verified_at\" IS NULL)\n OR (\"organization_domain_claims\".\"status\" = 'verified' AND \"organization_domain_claims\".\"verified_at\" IS NOT NULL AND \"organization_domain_claims\".\"workos_organization_id\" IS NOT NULL AND \"organization_domain_claims\".\"workos_domain_id\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.organization_group_memberships": {
+ "name": "organization_group_memberships",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assigned_by_kilo_user_id": {
+ "name": "assigned_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_organization_group_memberships_organization_user": {
+ "name": "IDX_organization_group_memberships_organization_user",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "FK_organization_group_memberships_group": {
+ "name": "FK_organization_group_memberships_group",
+ "tableFrom": "organization_group_memberships",
+ "tableTo": "organization_groups",
+ "columnsFrom": [
+ "organization_id",
+ "group_id"
+ ],
+ "columnsTo": [
+ "organization_id",
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "FK_organization_group_memberships_member": {
+ "name": "FK_organization_group_memberships_member",
+ "tableFrom": "organization_group_memberships",
+ "tableTo": "organization_memberships",
+ "columnsFrom": [
+ "organization_id",
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "organization_id",
+ "kilo_user_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "PK_organization_group_memberships": {
+ "name": "PK_organization_group_memberships",
+ "columns": [
+ "organization_id",
+ "group_id",
+ "kilo_user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_group_policy_settings": {
+ "name": "organization_group_policy_settings",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "default_policies": {
+ "name": "default_policies",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[{\"type\":\"model_access\",\"data\":{\"mode\":\"all\"}}]'::jsonb"
+ },
+ "policy_revision": {
+ "name": "policy_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "updated_by_kilo_user_id": {
+ "name": "updated_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_group_policy_settings_organization_id_organizations_id_fk": {
+ "name": "organization_group_policy_settings_organization_id_organizations_id_fk",
+ "tableFrom": "organization_group_policy_settings",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "organization_group_policy_settings_revision_check": {
+ "name": "organization_group_policy_settings_revision_check",
+ "value": "\"organization_group_policy_settings\".\"policy_revision\" >= 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.organization_groups": {
+ "name": "organization_groups",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policies": {
+ "name": "policies",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_by_kilo_user_id": {
+ "name": "created_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_organization_groups_organization_id_canonical_name": {
+ "name": "UQ_organization_groups_organization_id_canonical_name",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(btrim(\"name\"))",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_groups_organization_id": {
+ "name": "IDX_organization_groups_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "organization_groups_organization_id_organizations_id_fk": {
+ "name": "organization_groups_organization_id_organizations_id_fk",
+ "tableFrom": "organization_groups",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_organization_groups_organization_id_id": {
+ "name": "UQ_organization_groups_organization_id_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "organization_groups_name_check": {
+ "name": "organization_groups_name_check",
+ "value": "char_length(btrim(\"organization_groups\".\"name\")) BETWEEN 1 AND 80"
+ },
+ "organization_groups_description_check": {
+ "name": "organization_groups_description_check",
+ "value": "\"organization_groups\".\"description\" IS NULL OR char_length(\"organization_groups\".\"description\") <= 500"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.organization_invitations": {
+ "name": "organization_invitations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invited_by": {
+ "name": "invited_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authentication_requirement": {
+ "name": "authentication_requirement",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "sso_source_organization_id": {
+ "name": "sso_source_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_organization_invitations_token": {
+ "name": "UQ_organization_invitations_token",
+ "columns": [
+ {
+ "expression": "token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_invitations_org_id": {
+ "name": "IDX_organization_invitations_org_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_invitations_email": {
+ "name": "IDX_organization_invitations_email",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_invitations_expires_at": {
+ "name": "IDX_organization_invitations_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "organization_invitations_sso_source_organization_id_organizations_id_fk": {
+ "name": "organization_invitations_sso_source_organization_id_organizations_id_fk",
+ "tableFrom": "organization_invitations",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "sso_source_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_membership_removals": {
+ "name": "organization_membership_removals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "removed_at": {
+ "name": "removed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "removed_by": {
+ "name": "removed_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "previous_role": {
+ "name": "previous_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "IDX_org_membership_removals_org_id": {
+ "name": "IDX_org_membership_removals_org_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_org_membership_removals_user_id": {
+ "name": "IDX_org_membership_removals_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_org_membership_removals_org_user": {
+ "name": "UQ_org_membership_removals_org_user",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "kilo_user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_memberships": {
+ "name": "organization_memberships",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "invited_by": {
+ "name": "invited_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_organization_memberships_org_id": {
+ "name": "IDX_organization_memberships_org_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_memberships_user_id": {
+ "name": "IDX_organization_memberships_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_organization_memberships_org_user": {
+ "name": "UQ_organization_memberships_org_user",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "kilo_user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_recommendation_dismissals": {
+ "name": "organization_recommendation_dismissals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recommendation_key": {
+ "name": "recommendation_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dismissed_by_user_id": {
+ "name": "dismissed_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dismissed_at": {
+ "name": "dismissed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_recommendation_dismissals_owned_by_organization_id_organizations_id_fk": {
+ "name": "organization_recommendation_dismissals_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "organization_recommendation_dismissals",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "organization_recommendation_dismissals_dismissed_by_user_id_kilocode_users_id_fk": {
+ "name": "organization_recommendation_dismissals_dismissed_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "organization_recommendation_dismissals",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "dismissed_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_org_recommendation_dismissals_org_key": {
+ "name": "UQ_org_recommendation_dismissals_org_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "owned_by_organization_id",
+ "recommendation_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_seats_purchases": {
+ "name": "organization_seats_purchases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subscription_stripe_id": {
+ "name": "subscription_stripe_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "seat_count": {
+ "name": "seat_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_usd": {
+ "name": "amount_usd",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "subscription_status": {
+ "name": "subscription_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "starts_at": {
+ "name": "starts_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "billing_cycle": {
+ "name": "billing_cycle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'monthly'"
+ }
+ },
+ "indexes": {
+ "IDX_organization_seats_org_id": {
+ "name": "IDX_organization_seats_org_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_seats_expires_at": {
+ "name": "IDX_organization_seats_expires_at",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_seats_created_at": {
+ "name": "IDX_organization_seats_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_seats_updated_at": {
+ "name": "IDX_organization_seats_updated_at",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_seats_starts_at": {
+ "name": "IDX_organization_seats_starts_at",
+ "columns": [
+ {
+ "expression": "starts_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_organization_seats_idempotency_key": {
+ "name": "UQ_organization_seats_idempotency_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "idempotency_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_user_limits": {
+ "name": "organization_user_limits",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "limit_type": {
+ "name": "limit_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "microdollar_limit": {
+ "name": "microdollar_limit",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_organization_user_limits_org_id": {
+ "name": "IDX_organization_user_limits_org_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_user_limits_user_id": {
+ "name": "IDX_organization_user_limits_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_organization_user_limits_org_user": {
+ "name": "UQ_organization_user_limits_org_user",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "kilo_user_id",
+ "limit_type"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_user_usage": {
+ "name": "organization_user_usage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usage_date": {
+ "name": "usage_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "limit_type": {
+ "name": "limit_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "microdollar_usage": {
+ "name": "microdollar_usage",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_organization_user_daily_usage_org_id": {
+ "name": "IDX_organization_user_daily_usage_org_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organization_user_daily_usage_user_id": {
+ "name": "IDX_organization_user_daily_usage_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_organization_user_daily_usage_org_user_date": {
+ "name": "UQ_organization_user_daily_usage_org_user_date",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "kilo_user_id",
+ "limit_type",
+ "usage_date"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organizations": {
+ "name": "organizations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "microdollars_used": {
+ "name": "microdollars_used",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "microdollars_balance": {
+ "name": "microdollars_balance",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "total_microdollars_acquired": {
+ "name": "total_microdollars_acquired",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "next_credit_expiration_at": {
+ "name": "next_credit_expiration_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_top_up_enabled": {
+ "name": "auto_top_up_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "settings": {
+ "name": "settings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "seat_count": {
+ "name": "seat_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "require_seats": {
+ "name": "require_seats",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_by_kilo_user_id": {
+ "name": "created_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sso_domain": {
+ "name": "sso_domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_organization_id": {
+ "name": "parent_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "plan": {
+ "name": "plan",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'teams'"
+ },
+ "free_trial_end_at": {
+ "name": "free_trial_end_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "company_domain": {
+ "name": "company_domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "IDX_organizations_sso_domain": {
+ "name": "IDX_organizations_sso_domain",
+ "columns": [
+ {
+ "expression": "sso_domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_organizations_parent_organization_id": {
+ "name": "IDX_organizations_parent_organization_id",
+ "columns": [
+ {
+ "expression": "parent_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_organizations_live_sales_demo_per_owner": {
+ "name": "UQ_organizations_live_sales_demo_per_owner",
+ "columns": [
+ {
+ "expression": "created_by_kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "(\"organizations\".\"settings\"->>'is_sales_demo')::boolean = true AND \"organizations\".\"deleted_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "organizations_parent_organization_id_organizations_id_fk": {
+ "name": "organizations_parent_organization_id_organizations_id_fk",
+ "tableFrom": "organizations",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "parent_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "organizations_name_not_empty_check": {
+ "name": "organizations_name_not_empty_check",
+ "value": "length(trim(\"organizations\".\"name\")) > 0"
+ },
+ "organizations_not_parented_by_self_check": {
+ "name": "organizations_not_parented_by_self_check",
+ "value": "\"organizations\".\"parent_organization_id\" IS NULL OR \"organizations\".\"parent_organization_id\" <> \"organizations\".\"id\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.organization_modes": {
+ "name": "organization_modes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ }
+ },
+ "indexes": {
+ "IDX_organization_modes_organization_id": {
+ "name": "IDX_organization_modes_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_organization_modes_org_id_slug": {
+ "name": "UQ_organization_modes_org_id_slug",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.payment_methods": {
+ "name": "payment_methods",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "stripe_fingerprint": {
+ "name": "stripe_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_id": {
+ "name": "stripe_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last4": {
+ "name": "last4",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "brand": {
+ "name": "brand",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "address_line1": {
+ "name": "address_line1",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "address_line2": {
+ "name": "address_line2",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "address_city": {
+ "name": "address_city",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "address_state": {
+ "name": "address_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "address_zip": {
+ "name": "address_zip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "address_country": {
+ "name": "address_country",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "three_d_secure_supported": {
+ "name": "three_d_secure_supported",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "funding": {
+ "name": "funding",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "regulated_status": {
+ "name": "regulated_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "address_line1_check_status": {
+ "name": "address_line1_check_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "postal_code_check_status": {
+ "name": "postal_code_check_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_forwarded_for": {
+ "name": "http_x_forwarded_for",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_city": {
+ "name": "http_x_vercel_ip_city",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_country": {
+ "name": "http_x_vercel_ip_country",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_latitude": {
+ "name": "http_x_vercel_ip_latitude",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_longitude": {
+ "name": "http_x_vercel_ip_longitude",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ja4_digest": {
+ "name": "http_x_vercel_ja4_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "eligible_for_free_credits": {
+ "name": "eligible_for_free_credits",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_data": {
+ "name": "stripe_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "IDX_d7d7fb15569674aaadcfbc0428": {
+ "name": "IDX_d7d7fb15569674aaadcfbc0428",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_e1feb919d0ab8a36381d5d5138": {
+ "name": "IDX_e1feb919d0ab8a36381d5d5138",
+ "columns": [
+ {
+ "expression": "stripe_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_payment_methods_organization_id": {
+ "name": "IDX_payment_methods_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_29df1b0403df5792c96bbbfdbe6": {
+ "name": "UQ_29df1b0403df5792c96bbbfdbe6",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id",
+ "stripe_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pending_impact_sale_reversals": {
+ "name": "pending_impact_sale_reversals",
+ "schema": "",
+ "columns": {
+ "stripe_charge_id": {
+ "name": "stripe_charge_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "dispute_id": {
+ "name": "dispute_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount": {
+ "name": "amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_date": {
+ "name": "event_date",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pending_impact_sale_reversals_attempt_count_non_negative_check": {
+ "name": "pending_impact_sale_reversals_attempt_count_non_negative_check",
+ "value": "\"pending_impact_sale_reversals\".\"attempt_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.platform_access_token_credentials": {
+ "name": "platform_access_token_credentials",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "integration_type": {
+ "name": "integration_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_encrypted": {
+ "name": "token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_credential_type": {
+ "name": "provider_credential_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_resource_id": {
+ "name": "provider_resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_base_url": {
+ "name": "provider_base_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorized_by_user_id": {
+ "name": "authorized_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_metadata": {
+ "name": "provider_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_scopes": {
+ "name": "provider_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_verified_at": {
+ "name": "provider_verified_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_version": {
+ "name": "credential_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "last_validated_at": {
+ "name": "last_validated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_platform_access_token_credentials_integration_level": {
+ "name": "UQ_platform_access_token_credentials_integration_level",
+ "columns": [
+ {
+ "expression": "platform_integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_access_token_credentials\".\"provider_resource_id\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_platform_access_token_credentials_resource": {
+ "name": "UQ_platform_access_token_credentials_resource",
+ "columns": [
+ {
+ "expression": "platform_integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_credential_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_access_token_credentials\".\"provider_resource_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_access_token_credentials_authorized_by_user_id": {
+ "name": "IDX_platform_access_token_credentials_authorized_by_user_id",
+ "columns": [
+ {
+ "expression": "authorized_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "platform_access_token_credentials_authorized_by_user_id_kilocode_users_id_fk": {
+ "name": "platform_access_token_credentials_authorized_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "platform_access_token_credentials",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "authorized_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "FK_platform_access_token_credentials_parent": {
+ "name": "FK_platform_access_token_credentials_parent",
+ "tableFrom": "platform_access_token_credentials",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "platform_access_token_credentials_credential_version_check": {
+ "name": "platform_access_token_credentials_credential_version_check",
+ "value": "\"platform_access_token_credentials\".\"credential_version\" > 0"
+ },
+ "platform_access_token_credentials_resource_id_check": {
+ "name": "platform_access_token_credentials_resource_id_check",
+ "value": "\"platform_access_token_credentials\".\"provider_resource_id\" IS NULL OR \"platform_access_token_credentials\".\"provider_resource_id\" <> ''"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.platform_integrations": {
+ "name": "platform_integrations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_type": {
+ "name": "integration_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform_installation_id": {
+ "name": "platform_installation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform_account_id": {
+ "name": "platform_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform_account_login": {
+ "name": "platform_account_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_access": {
+ "name": "repository_access",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repositories": {
+ "name": "repositories",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repositories_synced_at": {
+ "name": "repositories_synced_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_invalid_at": {
+ "name": "auth_invalid_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_invalid_reason": {
+ "name": "auth_invalid_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kilo_requester_user_id": {
+ "name": "kilo_requester_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform_requester_account_id": {
+ "name": "platform_requester_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "integration_status": {
+ "name": "integration_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspended_at": {
+ "name": "suspended_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspended_by": {
+ "name": "suspended_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github_app_type": {
+ "name": "github_app_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'standard'"
+ },
+ "installed_at": {
+ "name": "installed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_platform_integrations_owned_by_org_platform_inst": {
+ "name": "UQ_platform_integrations_owned_by_org_platform_inst",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform_installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_integrations\".\"owned_by_organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_platform_integrations_owned_by_user_platform_inst": {
+ "name": "UQ_platform_integrations_owned_by_user_platform_inst",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform_installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_integrations\".\"owned_by_user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_platform_integrations_slack_platform_inst": {
+ "name": "UQ_platform_integrations_slack_platform_inst",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform_installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_integrations\".\"platform\" = 'slack' AND \"platform_integrations\".\"platform_installation_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_platform_integrations_linear_platform_inst": {
+ "name": "UQ_platform_integrations_linear_platform_inst",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform_installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_integrations\".\"platform\" = 'linear' AND \"platform_integrations\".\"platform_installation_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_platform_integrations_github_platform_inst": {
+ "name": "UQ_platform_integrations_github_platform_inst",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "github_app_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform_installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_integrations\".\"platform\" = 'github' AND \"platform_integrations\".\"platform_installation_id\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_platform_integrations_github_pending_target": {
+ "name": "UQ_platform_integrations_github_pending_target",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "github_app_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_integrations\".\"platform\" = 'github' AND \"platform_integrations\".\"integration_status\" = 'pending' AND \"platform_integrations\".\"platform_installation_id\" IS NULL AND \"platform_integrations\".\"platform_account_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_platform_integrations_user_bitbucket": {
+ "name": "UQ_platform_integrations_user_bitbucket",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_integrations\".\"platform\" = 'bitbucket' AND \"platform_integrations\".\"owned_by_user_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_platform_integrations_org_bitbucket": {
+ "name": "UQ_platform_integrations_org_bitbucket",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"platform_integrations\".\"platform\" = 'bitbucket' AND \"platform_integrations\".\"owned_by_organization_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_integrations_owned_by_org_id": {
+ "name": "IDX_platform_integrations_owned_by_org_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_integrations_owned_by_user_id": {
+ "name": "IDX_platform_integrations_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_integrations_platform_inst_id": {
+ "name": "IDX_platform_integrations_platform_inst_id",
+ "columns": [
+ {
+ "expression": "platform_installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_integrations_platform": {
+ "name": "IDX_platform_integrations_platform",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_integrations_owned_by_org_platform": {
+ "name": "IDX_platform_integrations_owned_by_org_platform",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_integrations_owned_by_user_platform": {
+ "name": "IDX_platform_integrations_owned_by_user_platform",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_integrations_integration_status": {
+ "name": "IDX_platform_integrations_integration_status",
+ "columns": [
+ {
+ "expression": "integration_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_integrations_kilo_requester": {
+ "name": "IDX_platform_integrations_kilo_requester",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kilo_requester_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "integration_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_integrations_platform_requester": {
+ "name": "IDX_platform_integrations_platform_requester",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "platform_requester_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "integration_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "platform_integrations_owned_by_organization_id_organizations_id_fk": {
+ "name": "platform_integrations_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "platform_integrations",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "platform_integrations_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "platform_integrations_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "platform_integrations",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "platform_integrations_owner_check": {
+ "name": "platform_integrations_owner_check",
+ "value": "(\n (\"platform_integrations\".\"owned_by_user_id\" IS NOT NULL AND \"platform_integrations\".\"owned_by_organization_id\" IS NULL) OR\n (\"platform_integrations\".\"owned_by_user_id\" IS NULL AND \"platform_integrations\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.platform_oauth_credentials": {
+ "name": "platform_oauth_credentials",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorized_by_user_id": {
+ "name": "authorized_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_subject_id": {
+ "name": "provider_subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_subject_login": {
+ "name": "provider_subject_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_base_url": {
+ "name": "provider_base_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_encrypted": {
+ "name": "access_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_encrypted": {
+ "name": "refresh_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "oauth_client_secret_encrypted": {
+ "name": "oauth_client_secret_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_version": {
+ "name": "credential_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revocation_reason": {
+ "name": "revocation_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_platform_oauth_credentials_platform_integration_id": {
+ "name": "UQ_platform_oauth_credentials_platform_integration_id",
+ "columns": [
+ {
+ "expression": "platform_integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_platform_oauth_credentials_authorized_by_user_id": {
+ "name": "IDX_platform_oauth_credentials_authorized_by_user_id",
+ "columns": [
+ {
+ "expression": "authorized_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "platform_oauth_credentials_platform_integration_id_platform_integrations_id_fk": {
+ "name": "platform_oauth_credentials_platform_integration_id_platform_integrations_id_fk",
+ "tableFrom": "platform_oauth_credentials",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "platform_oauth_credentials_authorized_by_user_id_kilocode_users_id_fk": {
+ "name": "platform_oauth_credentials_authorized_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "platform_oauth_credentials",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "authorized_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "platform_oauth_credentials_credential_version_check": {
+ "name": "platform_oauth_credentials_credential_version_check",
+ "value": "\"platform_oauth_credentials\".\"credential_version\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.referral_code_usages": {
+ "name": "referral_code_usages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "referring_kilo_user_id": {
+ "name": "referring_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redeeming_kilo_user_id": {
+ "name": "redeeming_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_usd": {
+ "name": "amount_usd",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "paid_at": {
+ "name": "paid_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_referral_code_usages_redeeming_kilo_user_id": {
+ "name": "IDX_referral_code_usages_redeeming_kilo_user_id",
+ "columns": [
+ {
+ "expression": "redeeming_kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_referral_code_usages_redeeming_user_id_code": {
+ "name": "UQ_referral_code_usages_redeeming_user_id_code",
+ "nullsNotDistinct": false,
+ "columns": [
+ "redeeming_kilo_user_id",
+ "referring_kilo_user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.referral_codes": {
+ "name": "referral_codes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "max_redemptions": {
+ "name": "max_redemptions",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 10
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_referral_codes_kilo_user_id": {
+ "name": "UQ_referral_codes_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_referral_codes_code": {
+ "name": "IDX_referral_codes_code",
+ "columns": [
+ {
+ "expression": "code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sales_demo_spend_ledger": {
+ "name": "sales_demo_spend_ledger",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_kilo_user_id": {
+ "name": "owner_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "period_start": {
+ "name": "period_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_end": {
+ "name": "period_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "microdollars_used": {
+ "name": "microdollars_used",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "sales_demo_spend_ledger_organization_id_organizations_id_fk": {
+ "name": "sales_demo_spend_ledger_organization_id_organizations_id_fk",
+ "tableFrom": "sales_demo_spend_ledger",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "sales_demo_spend_ledger_spend_positive": {
+ "name": "sales_demo_spend_ledger_spend_positive",
+ "value": "\"sales_demo_spend_ledger\".\"microdollars_used\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_advisor_check_catalog": {
+ "name": "security_advisor_check_catalog",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "check_id": {
+ "name": "check_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "severity": {
+ "name": "severity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "explanation": {
+ "name": "explanation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "risk": {
+ "name": "risk",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "security_advisor_check_catalog_check_id_unique": {
+ "name": "security_advisor_check_catalog_check_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "check_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "security_advisor_check_catalog_severity_check": {
+ "name": "security_advisor_check_catalog_severity_check",
+ "value": "\"security_advisor_check_catalog\".\"severity\" in ('critical', 'warn', 'info')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_advisor_content": {
+ "name": "security_advisor_content",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "security_advisor_content_key_unique": {
+ "name": "security_advisor_content_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.security_advisor_kiloclaw_coverage": {
+ "name": "security_advisor_kiloclaw_coverage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "area": {
+ "name": "area",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "detail": {
+ "name": "detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "match_check_ids": {
+ "name": "match_check_ids",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::text[]"
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "security_advisor_kiloclaw_coverage_area_unique": {
+ "name": "security_advisor_kiloclaw_coverage_area_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "area"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.security_advisor_scans": {
+ "name": "security_advisor_scans",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_platform": {
+ "name": "source_platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_method": {
+ "name": "source_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_version": {
+ "name": "plugin_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "openclaw_version": {
+ "name": "openclaw_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public_ip": {
+ "name": "public_ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "findings_critical": {
+ "name": "findings_critical",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "findings_warn": {
+ "name": "findings_warn",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "findings_info": {
+ "name": "findings_info",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_security_advisor_scans_user_created_at": {
+ "name": "idx_security_advisor_scans_user_created_at",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_advisor_scans_created_at": {
+ "name": "idx_security_advisor_scans_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_advisor_scans_platform": {
+ "name": "idx_security_advisor_scans_platform",
+ "columns": [
+ {
+ "expression": "source_platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.security_agent_commands": {
+ "name": "security_agent_commands",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "command_type": {
+ "name": "command_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin": {
+ "name": "origin",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finding_id": {
+ "name": "finding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "operation_key": {
+ "name": "operation_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'accepted'"
+ },
+ "result_code": {
+ "name": "result_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_metadata": {
+ "name": "result_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_redacted": {
+ "name": "last_error_redacted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_security_agent_commands_org_created": {
+ "name": "idx_security_agent_commands_org_created",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_agent_commands_user_created": {
+ "name": "idx_security_agent_commands_user_created",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_agent_commands_status_updated": {
+ "name": "idx_security_agent_commands_status_updated",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_agent_commands_finding_created": {
+ "name": "idx_security_agent_commands_finding_created",
+ "columns": [
+ {
+ "expression": "finding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_security_agent_commands_org_operation_key": {
+ "name": "UQ_security_agent_commands_org_operation_key",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "operation_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_agent_commands\".\"owned_by_organization_id\" IS NOT NULL AND \"security_agent_commands\".\"operation_key\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_security_agent_commands_user_operation_key": {
+ "name": "UQ_security_agent_commands_user_operation_key",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "operation_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_agent_commands\".\"owned_by_user_id\" IS NOT NULL AND \"security_agent_commands\".\"operation_key\" IS NOT NULL",
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_agent_commands_owned_by_organization_id_organizations_id_fk": {
+ "name": "security_agent_commands_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "security_agent_commands",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_agent_commands_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "security_agent_commands_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_agent_commands",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_agent_commands_finding_id_security_findings_id_fk": {
+ "name": "security_agent_commands_finding_id_security_findings_id_fk",
+ "tableFrom": "security_agent_commands",
+ "tableTo": "security_findings",
+ "columnsFrom": [
+ "finding_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "security_agent_commands_owner_check": {
+ "name": "security_agent_commands_owner_check",
+ "value": "(\n (\"security_agent_commands\".\"owned_by_user_id\" IS NOT NULL AND \"security_agent_commands\".\"owned_by_organization_id\" IS NULL) OR\n (\"security_agent_commands\".\"owned_by_user_id\" IS NULL AND \"security_agent_commands\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ },
+ "security_agent_commands_type_check": {
+ "name": "security_agent_commands_type_check",
+ "value": "\"security_agent_commands\".\"command_type\" IN ('sync', 'dismiss_finding', 'start_analysis', 'apply_auto_remediation')"
+ },
+ "security_agent_commands_origin_check": {
+ "name": "security_agent_commands_origin_check",
+ "value": "\"security_agent_commands\".\"origin\" IN ('manual', 'dashboard_refresh', 'enable_initial_sync', 'settings_include_existing')"
+ },
+ "security_agent_commands_status_check": {
+ "name": "security_agent_commands_status_check",
+ "value": "\"security_agent_commands\".\"status\" IN ('accepted', 'running', 'succeeded', 'failed', 'no_op')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_agent_repository_sync_state": {
+ "name": "security_agent_repository_sync_state",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_attempted_at": {
+ "name": "last_attempted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_succeeded_at": {
+ "name": "last_succeeded_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_failure_code": {
+ "name": "last_failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_security_agent_repository_sync_state_org_repo": {
+ "name": "UQ_security_agent_repository_sync_state_org_repo",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_agent_repository_sync_state\".\"owned_by_organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_security_agent_repository_sync_state_user_repo": {
+ "name": "UQ_security_agent_repository_sync_state_user_repo",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_agent_repository_sync_state\".\"owned_by_user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_agent_repository_sync_state_owned_by_organization_id_organizations_id_fk": {
+ "name": "security_agent_repository_sync_state_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "security_agent_repository_sync_state",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_agent_repository_sync_state_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "security_agent_repository_sync_state_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_agent_repository_sync_state",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "security_agent_repository_sync_state_owner_check": {
+ "name": "security_agent_repository_sync_state_owner_check",
+ "value": "(\n (\"security_agent_repository_sync_state\".\"owned_by_user_id\" IS NOT NULL AND \"security_agent_repository_sync_state\".\"owned_by_organization_id\" IS NULL) OR\n (\"security_agent_repository_sync_state\".\"owned_by_user_id\" IS NULL AND \"security_agent_repository_sync_state\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_analysis_owner_state": {
+ "name": "security_analysis_owner_state",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_analysis_enabled_at": {
+ "name": "auto_analysis_enabled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blocked_until": {
+ "name": "blocked_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "block_reason": {
+ "name": "block_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consecutive_actor_resolution_failures": {
+ "name": "consecutive_actor_resolution_failures",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_actor_resolution_failure_at": {
+ "name": "last_actor_resolution_failure_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_security_analysis_owner_state_org_owner": {
+ "name": "UQ_security_analysis_owner_state_org_owner",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_analysis_owner_state\".\"owned_by_organization_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_security_analysis_owner_state_user_owner": {
+ "name": "UQ_security_analysis_owner_state_user_owner",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_analysis_owner_state\".\"owned_by_user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_analysis_owner_state_owned_by_organization_id_organizations_id_fk": {
+ "name": "security_analysis_owner_state_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "security_analysis_owner_state",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_analysis_owner_state_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "security_analysis_owner_state_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_analysis_owner_state",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "security_analysis_owner_state_owner_check": {
+ "name": "security_analysis_owner_state_owner_check",
+ "value": "(\n (\"security_analysis_owner_state\".\"owned_by_user_id\" IS NOT NULL AND \"security_analysis_owner_state\".\"owned_by_organization_id\" IS NULL) OR\n (\"security_analysis_owner_state\".\"owned_by_user_id\" IS NULL AND \"security_analysis_owner_state\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ },
+ "security_analysis_owner_state_block_reason_check": {
+ "name": "security_analysis_owner_state_block_reason_check",
+ "value": "\"security_analysis_owner_state\".\"block_reason\" IS NULL OR \"security_analysis_owner_state\".\"block_reason\" IN ('INSUFFICIENT_CREDITS', 'ACTOR_RESOLUTION_FAILED', 'OPERATOR_PAUSE')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_analysis_queue": {
+ "name": "security_analysis_queue",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "finding_id": {
+ "name": "finding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "queue_status": {
+ "name": "queue_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "severity_rank": {
+ "name": "severity_rank",
+ "type": "smallint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "admitted_config_revision": {
+ "name": "admitted_config_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "queued_at": {
+ "name": "queued_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_by_job_id": {
+ "name": "claimed_by_job_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claim_token": {
+ "name": "claim_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "reopen_requeue_count": {
+ "name": "reopen_requeue_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_redacted": {
+ "name": "last_error_redacted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_security_analysis_queue_finding_id": {
+ "name": "UQ_security_analysis_queue_finding_id",
+ "columns": [
+ {
+ "expression": "finding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_analysis_queue_claim_path_org": {
+ "name": "idx_security_analysis_queue_claim_path_org",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"next_retry_at\", '-infinity'::timestamptz)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "severity_rank",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_analysis_queue\".\"queue_status\" = 'queued'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_analysis_queue_claim_path_user": {
+ "name": "idx_security_analysis_queue_claim_path_user",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"next_retry_at\", '-infinity'::timestamptz)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "severity_rank",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_analysis_queue\".\"queue_status\" = 'queued'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_analysis_queue_in_flight_org": {
+ "name": "idx_security_analysis_queue_in_flight_org",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "queue_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "claimed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_analysis_queue\".\"queue_status\" IN ('pending', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_analysis_queue_in_flight_user": {
+ "name": "idx_security_analysis_queue_in_flight_user",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "queue_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "claimed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_analysis_queue\".\"queue_status\" IN ('pending', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_analysis_queue_lag_dashboards": {
+ "name": "idx_security_analysis_queue_lag_dashboards",
+ "columns": [
+ {
+ "expression": "queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_analysis_queue\".\"queue_status\" = 'queued'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_analysis_queue_pending_reconciliation": {
+ "name": "idx_security_analysis_queue_pending_reconciliation",
+ "columns": [
+ {
+ "expression": "claimed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_analysis_queue\".\"queue_status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_analysis_queue_running_reconciliation": {
+ "name": "idx_security_analysis_queue_running_reconciliation",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_analysis_queue\".\"queue_status\" = 'running'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_analysis_queue_failure_trend": {
+ "name": "idx_security_analysis_queue_failure_trend",
+ "columns": [
+ {
+ "expression": "failure_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_analysis_queue\".\"failure_code\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_analysis_queue_finding_id_security_findings_id_fk": {
+ "name": "security_analysis_queue_finding_id_security_findings_id_fk",
+ "tableFrom": "security_analysis_queue",
+ "tableTo": "security_findings",
+ "columnsFrom": [
+ "finding_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_analysis_queue_owned_by_organization_id_organizations_id_fk": {
+ "name": "security_analysis_queue_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "security_analysis_queue",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_analysis_queue_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "security_analysis_queue_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_analysis_queue",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "security_analysis_queue_owner_check": {
+ "name": "security_analysis_queue_owner_check",
+ "value": "(\n (\"security_analysis_queue\".\"owned_by_user_id\" IS NOT NULL AND \"security_analysis_queue\".\"owned_by_organization_id\" IS NULL) OR\n (\"security_analysis_queue\".\"owned_by_user_id\" IS NULL AND \"security_analysis_queue\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ },
+ "security_analysis_queue_status_check": {
+ "name": "security_analysis_queue_status_check",
+ "value": "\"security_analysis_queue\".\"queue_status\" IN ('queued', 'pending', 'running', 'failed', 'completed')"
+ },
+ "security_analysis_queue_claim_token_required_check": {
+ "name": "security_analysis_queue_claim_token_required_check",
+ "value": "\"security_analysis_queue\".\"queue_status\" NOT IN ('pending', 'running') OR \"security_analysis_queue\".\"claim_token\" IS NOT NULL"
+ },
+ "security_analysis_queue_attempt_count_non_negative_check": {
+ "name": "security_analysis_queue_attempt_count_non_negative_check",
+ "value": "\"security_analysis_queue\".\"attempt_count\" >= 0"
+ },
+ "security_analysis_queue_reopen_requeue_count_non_negative_check": {
+ "name": "security_analysis_queue_reopen_requeue_count_non_negative_check",
+ "value": "\"security_analysis_queue\".\"reopen_requeue_count\" >= 0"
+ },
+ "security_analysis_queue_severity_rank_check": {
+ "name": "security_analysis_queue_severity_rank_check",
+ "value": "\"security_analysis_queue\".\"severity_rank\" IN (0, 1, 2, 3)"
+ },
+ "security_analysis_queue_failure_code_check": {
+ "name": "security_analysis_queue_failure_code_check",
+ "value": "\"security_analysis_queue\".\"failure_code\" IS NULL OR \"security_analysis_queue\".\"failure_code\" IN (\n 'NETWORK_TIMEOUT',\n 'UPSTREAM_5XX',\n 'TEMP_TOKEN_FAILURE',\n 'START_CALL_AMBIGUOUS',\n 'REQUEUE_TEMPORARY_PRECONDITION',\n 'ACTOR_RESOLUTION_FAILED',\n 'GITHUB_TOKEN_UNAVAILABLE',\n 'INVALID_CONFIG',\n 'MISSING_OWNERSHIP',\n 'PERMISSION_DENIED_PERMANENT',\n 'UNSUPPORTED_SEVERITY',\n 'INSUFFICIENT_CREDITS',\n 'STATE_GUARD_REJECTED',\n 'SKIPPED_ALREADY_IN_PROGRESS',\n 'SKIPPED_NO_LONGER_ELIGIBLE',\n 'REOPEN_LOOP_GUARD',\n 'RUN_LOST'\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_audit_log": {
+ "name": "security_audit_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_email": {
+ "name": "actor_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "before_state": {
+ "name": "before_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "after_state": {
+ "name": "after_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finding_id": {
+ "name": "finding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "occurred_at": {
+ "name": "occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_occurred_at": {
+ "name": "source_occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_key": {
+ "name": "event_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "schema_version": {
+ "name": "schema_version",
+ "type": "smallint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finding_snapshot": {
+ "name": "finding_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_context": {
+ "name": "source_context",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_security_audit_log_org_created": {
+ "name": "IDX_security_audit_log_org_created",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_security_audit_log_user_created": {
+ "name": "IDX_security_audit_log_user_created",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_security_audit_log_resource": {
+ "name": "IDX_security_audit_log_resource",
+ "columns": [
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_security_audit_log_actor": {
+ "name": "IDX_security_audit_log_actor",
+ "columns": [
+ {
+ "expression": "actor_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_security_audit_log_action": {
+ "name": "IDX_security_audit_log_action",
+ "columns": [
+ {
+ "expression": "action",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_security_audit_log_org_event_key": {
+ "name": "UQ_security_audit_log_org_event_key",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "event_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_audit_log\".\"owned_by_organization_id\" IS NOT NULL AND \"security_audit_log\".\"event_key\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_security_audit_log_user_event_key": {
+ "name": "UQ_security_audit_log_user_event_key",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "event_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_audit_log\".\"owned_by_user_id\" IS NOT NULL AND \"security_audit_log\".\"event_key\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_security_audit_log_org_occurred": {
+ "name": "IDX_security_audit_log_org_occurred",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_audit_log\".\"owned_by_organization_id\" IS NOT NULL AND \"security_audit_log\".\"occurred_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_security_audit_log_user_occurred": {
+ "name": "IDX_security_audit_log_user_occurred",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_audit_log\".\"owned_by_user_id\" IS NOT NULL AND \"security_audit_log\".\"occurred_at\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_audit_log_owned_by_organization_id_organizations_id_fk": {
+ "name": "security_audit_log_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "security_audit_log",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_audit_log_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "security_audit_log_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_audit_log",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "security_audit_log_owner_check": {
+ "name": "security_audit_log_owner_check",
+ "value": "(\"security_audit_log\".\"owned_by_user_id\" IS NOT NULL AND \"security_audit_log\".\"owned_by_organization_id\" IS NULL) OR (\"security_audit_log\".\"owned_by_user_id\" IS NULL AND \"security_audit_log\".\"owned_by_organization_id\" IS NOT NULL)"
+ },
+ "security_audit_log_action_check": {
+ "name": "security_audit_log_action_check",
+ "value": "\"security_audit_log\".\"action\" IN ('security.finding.created', 'security.finding.severity_changed', 'security.finding.status_change', 'security.finding.dismissed', 'security.finding.auto_dismissed', 'security.finding.superseded', 'security.finding.analysis_started', 'security.finding.analysis_completed', 'security.finding.analysis_failed', 'security.remediation.queued', 'security.remediation.started', 'security.remediation.pr_opened', 'security.remediation.failed', 'security.remediation.blocked', 'security.remediation.no_changes_needed', 'security.remediation.cancelled', 'security.remediation.retried', 'security.finding.deleted', 'security.config.enabled', 'security.config.disabled', 'security.config.updated', 'security.sync.triggered', 'security.sync.completed', 'security.audit_log.exported', 'security.audit_report.generated')"
+ },
+ "security_audit_log_actor_type_check": {
+ "name": "security_audit_log_actor_type_check",
+ "value": "\"security_audit_log\".\"actor_type\" IN ('customer_user', 'kilo_admin', 'system')"
+ },
+ "security_audit_log_source_context_check": {
+ "name": "security_audit_log_source_context_check",
+ "value": "\"security_audit_log\".\"source_context\" IN ('security_sync', 'web', 'analysis_worker', 'remediation_callback', 'rollout_baseline')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_finding_notifications": {
+ "name": "security_finding_notifications",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "finding_id": {
+ "name": "finding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recipient_user_id": {
+ "name": "recipient_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'staged'"
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "uq_security_finding_notifications_finding_recipient_kind": {
+ "name": "uq_security_finding_notifications_finding_recipient_kind",
+ "columns": [
+ {
+ "expression": "finding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "recipient_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_finding_notifications_pending": {
+ "name": "idx_security_finding_notifications_pending",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_finding_notifications\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_finding_notifications_staged": {
+ "name": "idx_security_finding_notifications_staged",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_finding_notifications\".\"status\" = 'staged'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_finding_notifications_finding_id": {
+ "name": "idx_security_finding_notifications_finding_id",
+ "columns": [
+ {
+ "expression": "finding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_finding_notifications_recipient_user_id": {
+ "name": "idx_security_finding_notifications_recipient_user_id",
+ "columns": [
+ {
+ "expression": "recipient_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_finding_notifications_finding_fk": {
+ "name": "security_finding_notifications_finding_fk",
+ "tableFrom": "security_finding_notifications",
+ "tableTo": "security_findings",
+ "columnsFrom": [
+ "finding_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_finding_notifications_recipient_fk": {
+ "name": "security_finding_notifications_recipient_fk",
+ "tableFrom": "security_finding_notifications",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "recipient_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "security_finding_notifications_kind_check": {
+ "name": "security_finding_notifications_kind_check",
+ "value": "\"security_finding_notifications\".\"kind\" IN ('new_finding', 'sla_warning', 'sla_breach')"
+ },
+ "security_finding_notifications_status_check": {
+ "name": "security_finding_notifications_status_check",
+ "value": "\"security_finding_notifications\".\"status\" IN ('staged', 'pending', 'sending', 'sent', 'failed', 'cancelled')"
+ },
+ "security_finding_notifications_attempt_count_check": {
+ "name": "security_finding_notifications_attempt_count_check",
+ "value": "\"security_finding_notifications\".\"attempt_count\" >= 0"
+ },
+ "security_finding_notifications_claimed_at_check": {
+ "name": "security_finding_notifications_claimed_at_check",
+ "value": "(\n (\"security_finding_notifications\".\"status\" = 'sending' AND \"security_finding_notifications\".\"claimed_at\" IS NOT NULL) OR\n (\"security_finding_notifications\".\"status\" <> 'sending' AND \"security_finding_notifications\".\"claimed_at\" IS NULL)\n )"
+ },
+ "security_finding_notifications_sent_at_check": {
+ "name": "security_finding_notifications_sent_at_check",
+ "value": "(\n (\"security_finding_notifications\".\"status\" = 'sent' AND \"security_finding_notifications\".\"sent_at\" IS NOT NULL) OR\n (\"security_finding_notifications\".\"status\" <> 'sent' AND \"security_finding_notifications\".\"sent_at\" IS NULL)\n )"
+ },
+ "security_finding_notifications_error_message_length_check": {
+ "name": "security_finding_notifications_error_message_length_check",
+ "value": "\"security_finding_notifications\".\"error_message\" IS NULL OR length(\"security_finding_notifications\".\"error_message\") <= 500"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_findings": {
+ "name": "security_findings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "severity": {
+ "name": "severity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ghsa_id": {
+ "name": "ghsa_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cve_id": {
+ "name": "cve_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "package_name": {
+ "name": "package_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "package_ecosystem": {
+ "name": "package_ecosystem",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vulnerable_version_range": {
+ "name": "vulnerable_version_range",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "patched_version": {
+ "name": "patched_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manifest_path": {
+ "name": "manifest_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "ignored_reason": {
+ "name": "ignored_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ignored_by": {
+ "name": "ignored_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fixed_at": {
+ "name": "fixed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sla_due_at": {
+ "name": "sla_due_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dependabot_html_url": {
+ "name": "dependabot_html_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cwe_ids": {
+ "name": "cwe_ids",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cvss_score": {
+ "name": "cvss_score",
+ "type": "numeric(3, 1)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dependency_scope": {
+ "name": "dependency_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cli_session_id": {
+ "name": "cli_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "analysis_status": {
+ "name": "analysis_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "analysis_started_at": {
+ "name": "analysis_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "analysis_completed_at": {
+ "name": "analysis_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "analysis_error": {
+ "name": "analysis_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "analysis": {
+ "name": "analysis",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "raw_data": {
+ "name": "raw_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_detected_at": {
+ "name": "first_detected_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_synced_at": {
+ "name": "last_synced_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "uq_security_findings_user_source": {
+ "name": "uq_security_findings_user_source",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_findings\".\"owned_by_user_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "uq_security_findings_org_source": {
+ "name": "uq_security_findings_org_source",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_findings\".\"owned_by_organization_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_org_id": {
+ "name": "idx_security_findings_org_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_user_id": {
+ "name": "idx_security_findings_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_repo": {
+ "name": "idx_security_findings_repo",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_severity": {
+ "name": "idx_security_findings_severity",
+ "columns": [
+ {
+ "expression": "severity",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_status": {
+ "name": "idx_security_findings_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_package": {
+ "name": "idx_security_findings_package",
+ "columns": [
+ {
+ "expression": "package_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_sla_due_at": {
+ "name": "idx_security_findings_sla_due_at",
+ "columns": [
+ {
+ "expression": "sla_due_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_session_id": {
+ "name": "idx_security_findings_session_id",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_cli_session_id": {
+ "name": "idx_security_findings_cli_session_id",
+ "columns": [
+ {
+ "expression": "cli_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_analysis_status": {
+ "name": "idx_security_findings_analysis_status",
+ "columns": [
+ {
+ "expression": "analysis_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_org_analysis_in_flight": {
+ "name": "idx_security_findings_org_analysis_in_flight",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "analysis_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_findings\".\"analysis_status\" IN ('pending', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_findings_user_analysis_in_flight": {
+ "name": "idx_security_findings_user_analysis_in_flight",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "analysis_status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_findings\".\"analysis_status\" IN ('pending', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_findings_owned_by_organization_id_organizations_id_fk": {
+ "name": "security_findings_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "security_findings",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_findings_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "security_findings_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_findings",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_findings_platform_integration_id_platform_integrations_id_fk": {
+ "name": "security_findings_platform_integration_id_platform_integrations_id_fk",
+ "tableFrom": "security_findings",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "security_findings_owner_check": {
+ "name": "security_findings_owner_check",
+ "value": "(\n (\"security_findings\".\"owned_by_user_id\" IS NOT NULL AND \"security_findings\".\"owned_by_organization_id\" IS NULL) OR\n (\"security_findings\".\"owned_by_user_id\" IS NULL AND \"security_findings\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_remediation_attempts": {
+ "name": "security_remediation_attempts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "remediation_id": {
+ "name": "remediation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "finding_id": {
+ "name": "finding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin": {
+ "name": "origin",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "attempt_number": {
+ "name": "attempt_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "retry_of_attempt_id": {
+ "name": "retry_of_attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by_user_id": {
+ "name": "requested_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "analysis_fingerprint": {
+ "name": "analysis_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "analysis_completed_at": {
+ "name": "analysis_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "remediation_model_slug": {
+ "name": "remediation_model_slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "branch_name": {
+ "name": "branch_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kilo_session_id": {
+ "name": "kilo_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "smallint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 50
+ },
+ "claim_token": {
+ "name": "claim_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_by_job_id": {
+ "name": "claimed_by_job_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "launch_attempt_count": {
+ "name": "launch_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "callback_attempt_token_hash": {
+ "name": "callback_attempt_token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blocked_reason": {
+ "name": "blocked_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_redacted": {
+ "name": "last_error_redacted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "structured_result": {
+ "name": "structured_result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "final_assistant_message": {
+ "name": "final_assistant_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "validation_evidence": {
+ "name": "validation_evidence",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "risk_notes": {
+ "name": "risk_notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "draft_reason": {
+ "name": "draft_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_url": {
+ "name": "pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_draft": {
+ "name": "pr_draft",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_head_branch": {
+ "name": "pr_head_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_base_branch": {
+ "name": "pr_base_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancellation_requested_at": {
+ "name": "cancellation_requested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancellation_requested_by_user_id": {
+ "name": "cancellation_requested_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "queued_at": {
+ "name": "queued_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "launched_at": {
+ "name": "launched_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_security_remediation_attempts_number": {
+ "name": "UQ_security_remediation_attempts_number",
+ "columns": [
+ {
+ "expression": "remediation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "attempt_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_security_remediation_attempts_active_finding": {
+ "name": "UQ_security_remediation_attempts_active_finding",
+ "columns": [
+ {
+ "expression": "finding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_remediation_attempts\".\"status\" IN ('queued', 'launching', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_security_remediation_attempts_active_remediation": {
+ "name": "UQ_security_remediation_attempts_active_remediation",
+ "columns": [
+ {
+ "expression": "remediation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_remediation_attempts\".\"status\" IN ('queued', 'launching', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_security_remediation_attempts_finding_fingerprint_terminal": {
+ "name": "UQ_security_remediation_attempts_finding_fingerprint_terminal",
+ "columns": [
+ {
+ "expression": "finding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "analysis_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"security_remediation_attempts\".\"status\" IN ('queued', 'launching', 'running', 'pr_opened')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediation_attempts_org_claim": {
+ "name": "idx_security_remediation_attempts_org_claim",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"next_retry_at\", '-infinity'::timestamptz)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "priority",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_remediation_attempts\".\"status\" = 'queued'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediation_attempts_user_claim": {
+ "name": "idx_security_remediation_attempts_user_claim",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"next_retry_at\", '-infinity'::timestamptz)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "priority",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_remediation_attempts\".\"status\" = 'queued'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediation_attempts_repo_claim": {
+ "name": "idx_security_remediation_attempts_repo_claim",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"next_retry_at\", '-infinity'::timestamptz)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "priority",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "queued_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_remediation_attempts\".\"status\" = 'queued'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediation_attempts_org_inflight": {
+ "name": "idx_security_remediation_attempts_org_inflight",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "claimed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_remediation_attempts\".\"status\" IN ('launching', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediation_attempts_user_inflight": {
+ "name": "idx_security_remediation_attempts_user_inflight",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "claimed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_remediation_attempts\".\"status\" IN ('launching', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediation_attempts_repo_inflight": {
+ "name": "idx_security_remediation_attempts_repo_inflight",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "claimed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"security_remediation_attempts\".\"status\" IN ('launching', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediation_attempts_cloud_agent_session": {
+ "name": "idx_security_remediation_attempts_cloud_agent_session",
+ "columns": [
+ {
+ "expression": "cloud_agent_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediation_attempts_finding_fingerprint": {
+ "name": "idx_security_remediation_attempts_finding_fingerprint",
+ "columns": [
+ {
+ "expression": "finding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "analysis_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_remediation_attempts_remediation_id_security_remediations_id_fk": {
+ "name": "security_remediation_attempts_remediation_id_security_remediations_id_fk",
+ "tableFrom": "security_remediation_attempts",
+ "tableTo": "security_remediations",
+ "columnsFrom": [
+ "remediation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_remediation_attempts_finding_id_security_findings_id_fk": {
+ "name": "security_remediation_attempts_finding_id_security_findings_id_fk",
+ "tableFrom": "security_remediation_attempts",
+ "tableTo": "security_findings",
+ "columnsFrom": [
+ "finding_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_remediation_attempts_owned_by_organization_id_organizations_id_fk": {
+ "name": "security_remediation_attempts_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "security_remediation_attempts",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_remediation_attempts_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "security_remediation_attempts_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_remediation_attempts",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_remediation_attempts_requested_by_user_id_kilocode_users_id_fk": {
+ "name": "security_remediation_attempts_requested_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_remediation_attempts",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "requested_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "security_remediation_attempts_cancellation_requested_by_user_id_kilocode_users_id_fk": {
+ "name": "security_remediation_attempts_cancellation_requested_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_remediation_attempts",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "cancellation_requested_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "security_remediation_attempts_owner_check": {
+ "name": "security_remediation_attempts_owner_check",
+ "value": "(\n (\"security_remediation_attempts\".\"owned_by_user_id\" IS NOT NULL AND \"security_remediation_attempts\".\"owned_by_organization_id\" IS NULL) OR\n (\"security_remediation_attempts\".\"owned_by_user_id\" IS NULL AND \"security_remediation_attempts\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ },
+ "security_remediation_attempts_status_check": {
+ "name": "security_remediation_attempts_status_check",
+ "value": "\"security_remediation_attempts\".\"status\" IN ('queued', 'launching', 'running', 'pr_opened', 'failed', 'blocked', 'no_changes_needed', 'cancelled')"
+ },
+ "security_remediation_attempts_origin_check": {
+ "name": "security_remediation_attempts_origin_check",
+ "value": "\"security_remediation_attempts\".\"origin\" IN ('auto_policy', 'bulk_existing', 'manual')"
+ },
+ "security_remediation_attempts_attempt_number_check": {
+ "name": "security_remediation_attempts_attempt_number_check",
+ "value": "\"security_remediation_attempts\".\"attempt_number\" >= 1"
+ },
+ "security_remediation_attempts_launch_attempt_count_check": {
+ "name": "security_remediation_attempts_launch_attempt_count_check",
+ "value": "\"security_remediation_attempts\".\"launch_attempt_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.security_remediations": {
+ "name": "security_remediations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finding_id": {
+ "name": "finding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repo_full_name": {
+ "name": "repo_full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "latest_attempt_id": {
+ "name": "latest_attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_analysis_fingerprint": {
+ "name": "latest_analysis_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_analysis_completed_at": {
+ "name": "latest_analysis_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_url": {
+ "name": "pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_draft": {
+ "name": "pr_draft",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_head_branch": {
+ "name": "pr_head_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_base_branch": {
+ "name": "pr_base_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blocked_reason": {
+ "name": "blocked_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome_summary": {
+ "name": "outcome_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_security_remediations_finding_id": {
+ "name": "UQ_security_remediations_finding_id",
+ "columns": [
+ {
+ "expression": "finding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediations_org_status": {
+ "name": "idx_security_remediations_org_status",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediations_user_status": {
+ "name": "idx_security_remediations_user_status",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediations_repo_status": {
+ "name": "idx_security_remediations_repo_status",
+ "columns": [
+ {
+ "expression": "repo_full_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_security_remediations_latest_attempt": {
+ "name": "idx_security_remediations_latest_attempt",
+ "columns": [
+ {
+ "expression": "latest_attempt_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "security_remediations_owned_by_organization_id_organizations_id_fk": {
+ "name": "security_remediations_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "security_remediations",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_remediations_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "security_remediations_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "security_remediations",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "security_remediations_finding_id_security_findings_id_fk": {
+ "name": "security_remediations_finding_id_security_findings_id_fk",
+ "tableFrom": "security_remediations",
+ "tableTo": "security_findings",
+ "columnsFrom": [
+ "finding_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "security_remediations_owner_check": {
+ "name": "security_remediations_owner_check",
+ "value": "(\n (\"security_remediations\".\"owned_by_user_id\" IS NOT NULL AND \"security_remediations\".\"owned_by_organization_id\" IS NULL) OR\n (\"security_remediations\".\"owned_by_user_id\" IS NULL AND \"security_remediations\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ },
+ "security_remediations_status_check": {
+ "name": "security_remediations_status_check",
+ "value": "\"security_remediations\".\"status\" IN ('queued', 'running', 'pr_opened', 'failed', 'blocked', 'no_changes_needed', 'cancelled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.shared_cli_sessions": {
+ "name": "shared_cli_sessions",
+ "schema": "",
+ "columns": {
+ "share_id": {
+ "name": "share_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "shared_state": {
+ "name": "shared_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'public'"
+ },
+ "api_conversation_history_blob_url": {
+ "name": "api_conversation_history_blob_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "task_metadata_blob_url": {
+ "name": "task_metadata_blob_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ui_messages_blob_url": {
+ "name": "ui_messages_blob_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "git_state_blob_url": {
+ "name": "git_state_blob_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_shared_cli_sessions_session_id": {
+ "name": "IDX_shared_cli_sessions_session_id",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_shared_cli_sessions_created_at": {
+ "name": "IDX_shared_cli_sessions_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "shared_cli_sessions_session_id_cli_sessions_session_id_fk": {
+ "name": "shared_cli_sessions_session_id_cli_sessions_session_id_fk",
+ "tableFrom": "shared_cli_sessions",
+ "tableTo": "cli_sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "session_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "shared_cli_sessions_kilo_user_id_kilocode_users_id_fk": {
+ "name": "shared_cli_sessions_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "shared_cli_sessions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "shared_cli_sessions_shared_state_check": {
+ "name": "shared_cli_sessions_shared_state_check",
+ "value": "\"shared_cli_sessions\".\"shared_state\" IN ('public', 'organization')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.slack_bot_requests": {
+ "name": "slack_bot_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_team_id": {
+ "name": "slack_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_team_name": {
+ "name": "slack_team_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slack_channel_id": {
+ "name": "slack_channel_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_user_id": {
+ "name": "slack_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_thread_ts": {
+ "name": "slack_thread_ts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_message": {
+ "name": "user_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_message_truncated": {
+ "name": "user_message_truncated",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_time_ms": {
+ "name": "response_time_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model_used": {
+ "name": "model_used",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_calls_made": {
+ "name": "tool_calls_made",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_agent_session_id": {
+ "name": "cloud_agent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "idx_slack_bot_requests_created_at": {
+ "name": "idx_slack_bot_requests_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_slack_bot_requests_slack_team_id": {
+ "name": "idx_slack_bot_requests_slack_team_id",
+ "columns": [
+ {
+ "expression": "slack_team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_slack_bot_requests_owned_by_org_id": {
+ "name": "idx_slack_bot_requests_owned_by_org_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_slack_bot_requests_owned_by_user_id": {
+ "name": "idx_slack_bot_requests_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_slack_bot_requests_status": {
+ "name": "idx_slack_bot_requests_status",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_slack_bot_requests_event_type": {
+ "name": "idx_slack_bot_requests_event_type",
+ "columns": [
+ {
+ "expression": "event_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_slack_bot_requests_team_created": {
+ "name": "idx_slack_bot_requests_team_created",
+ "columns": [
+ {
+ "expression": "slack_team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "slack_bot_requests_owned_by_organization_id_organizations_id_fk": {
+ "name": "slack_bot_requests_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "slack_bot_requests",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "slack_bot_requests_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "slack_bot_requests_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "slack_bot_requests",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "slack_bot_requests_platform_integration_id_platform_integrations_id_fk": {
+ "name": "slack_bot_requests_platform_integration_id_platform_integrations_id_fk",
+ "tableFrom": "slack_bot_requests",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "slack_bot_requests_owner_check": {
+ "name": "slack_bot_requests_owner_check",
+ "value": "(\n (\"slack_bot_requests\".\"owned_by_user_id\" IS NOT NULL AND \"slack_bot_requests\".\"owned_by_organization_id\" IS NULL) OR\n (\"slack_bot_requests\".\"owned_by_user_id\" IS NULL AND \"slack_bot_requests\".\"owned_by_organization_id\" IS NOT NULL) OR\n (\"slack_bot_requests\".\"owned_by_user_id\" IS NULL AND \"slack_bot_requests\".\"owned_by_organization_id\" IS NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.slack_oauth_credentials": {
+ "name": "slack_oauth_credentials",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "platform_integration_id": {
+ "name": "platform_integration_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_team_id": {
+ "name": "slack_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slack_enterprise_id": {
+ "name": "slack_enterprise_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_enterprise_install": {
+ "name": "is_enterprise_install",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "bot_user_id": {
+ "name": "bot_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_encrypted": {
+ "name": "access_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_encrypted": {
+ "name": "refresh_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "granted_scopes": {
+ "name": "granted_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_version": {
+ "name": "credential_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "refresh_claimed_at": {
+ "name": "refresh_claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_attempt_count": {
+ "name": "refresh_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_refresh_attempt_at": {
+ "name": "next_refresh_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refreshed_at": {
+ "name": "last_refreshed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revocation_reason": {
+ "name": "revocation_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_slack_oauth_credentials_platform_integration_id": {
+ "name": "UQ_slack_oauth_credentials_platform_integration_id",
+ "columns": [
+ {
+ "expression": "platform_integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_slack_oauth_credentials_slack_team_id": {
+ "name": "IDX_slack_oauth_credentials_slack_team_id",
+ "columns": [
+ {
+ "expression": "slack_team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_slack_oauth_credentials_refresh_due": {
+ "name": "IDX_slack_oauth_credentials_refresh_due",
+ "columns": [
+ {
+ "expression": "access_token_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"slack_oauth_credentials\".\"revoked_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "slack_oauth_credentials_platform_integration_id_platform_integrations_id_fk": {
+ "name": "slack_oauth_credentials_platform_integration_id_platform_integrations_id_fk",
+ "tableFrom": "slack_oauth_credentials",
+ "tableTo": "platform_integrations",
+ "columnsFrom": [
+ "platform_integration_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "slack_oauth_credentials_credential_version_check": {
+ "name": "slack_oauth_credentials_credential_version_check",
+ "value": "\"slack_oauth_credentials\".\"credential_version\" > 0"
+ },
+ "slack_oauth_credentials_refresh_attempt_count_check": {
+ "name": "slack_oauth_credentials_refresh_attempt_count_check",
+ "value": "\"slack_oauth_credentials\".\"refresh_attempt_count\" >= 0"
+ },
+ "slack_oauth_credentials_slack_team_id_check": {
+ "name": "slack_oauth_credentials_slack_team_id_check",
+ "value": "\"slack_oauth_credentials\".\"slack_team_id\" <> ''"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.source_embeddings": {
+ "name": "source_embeddings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "embedding": {
+ "name": "embedding",
+ "type": "vector(1536)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_hash": {
+ "name": "file_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_line": {
+ "name": "start_line",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_line": {
+ "name": "end_line",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "git_branch": {
+ "name": "git_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'main'"
+ },
+ "is_base_branch": {
+ "name": "is_base_branch",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_source_embeddings_organization_id": {
+ "name": "IDX_source_embeddings_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_source_embeddings_kilo_user_id": {
+ "name": "IDX_source_embeddings_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_source_embeddings_project_id": {
+ "name": "IDX_source_embeddings_project_id",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_source_embeddings_created_at": {
+ "name": "IDX_source_embeddings_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_source_embeddings_updated_at": {
+ "name": "IDX_source_embeddings_updated_at",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_source_embeddings_file_path_lower": {
+ "name": "IDX_source_embeddings_file_path_lower",
+ "columns": [
+ {
+ "expression": "LOWER(\"file_path\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_source_embeddings_git_branch": {
+ "name": "IDX_source_embeddings_git_branch",
+ "columns": [
+ {
+ "expression": "git_branch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_source_embeddings_org_project_branch": {
+ "name": "IDX_source_embeddings_org_project_branch",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "git_branch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "source_embeddings_organization_id_organizations_id_fk": {
+ "name": "source_embeddings_organization_id_organizations_id_fk",
+ "tableFrom": "source_embeddings",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "source_embeddings_kilo_user_id_kilocode_users_id_fk": {
+ "name": "source_embeddings_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "source_embeddings",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_source_embeddings_org_project_branch_file_lines": {
+ "name": "UQ_source_embeddings_org_project_branch_file_lines",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "project_id",
+ "git_branch",
+ "file_path",
+ "start_line",
+ "end_line"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.stripe_dispute_actions": {
+ "name": "stripe_dispute_actions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action_type": {
+ "name": "action_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_key": {
+ "name": "target_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "terminal_at": {
+ "name": "terminal_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_code": {
+ "name": "result_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_reference_id": {
+ "name": "result_reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_context": {
+ "name": "failure_context",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_stripe_dispute_actions_case_id": {
+ "name": "IDX_stripe_dispute_actions_case_id",
+ "columns": [
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_dispute_actions_claim_path": {
+ "name": "IDX_stripe_dispute_actions_claim_path",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"next_retry_at\", '-infinity'::timestamptz)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "stripe_dispute_actions_case_id_stripe_dispute_cases_id_fk": {
+ "name": "stripe_dispute_actions_case_id_stripe_dispute_cases_id_fk",
+ "tableFrom": "stripe_dispute_actions",
+ "tableTo": "stripe_dispute_cases",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_stripe_dispute_actions_case_type_target": {
+ "name": "UQ_stripe_dispute_actions_case_type_target",
+ "nullsNotDistinct": false,
+ "columns": [
+ "case_id",
+ "action_type",
+ "target_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "stripe_dispute_actions_action_type_check": {
+ "name": "stripe_dispute_actions_action_type_check",
+ "value": "\"stripe_dispute_actions\".\"action_type\" IN ('stripe_acceptance', 'user_block', 'auto_top_up_disable', 'credit_balance_reset', 'subscription_cancellation', 'access_termination', 'kiloclaw_suspension')"
+ },
+ "stripe_dispute_actions_status_check": {
+ "name": "stripe_dispute_actions_status_check",
+ "value": "\"stripe_dispute_actions\".\"status\" IN ('queued', 'processing', 'completed', 'failed', 'skipped')"
+ },
+ "stripe_dispute_actions_attempt_count_non_negative_check": {
+ "name": "stripe_dispute_actions_attempt_count_non_negative_check",
+ "value": "\"stripe_dispute_actions\".\"attempt_count\" >= 0"
+ },
+ "stripe_dispute_actions_target_key_not_empty_check": {
+ "name": "stripe_dispute_actions_target_key_not_empty_check",
+ "value": "length(\"stripe_dispute_actions\".\"target_key\") > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.stripe_dispute_cases": {
+ "name": "stripe_dispute_cases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "stripe_dispute_id": {
+ "name": "stripe_dispute_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_event_id": {
+ "name": "stripe_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_event_created_at": {
+ "name": "stripe_event_created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_charge_id": {
+ "name": "stripe_charge_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_payment_intent_id": {
+ "name": "stripe_payment_intent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "amount_minor_units": {
+ "name": "amount_minor_units",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dispute_reason": {
+ "name": "dispute_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_status": {
+ "name": "stripe_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_classification": {
+ "name": "owner_classification",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'needs_action'"
+ },
+ "status_reason": {
+ "name": "status_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_context": {
+ "name": "failure_context",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_created_at": {
+ "name": "stripe_created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "evidence_due_by": {
+ "name": "evidence_due_by",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "synced_at": {
+ "name": "synced_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_by_kilo_user_id": {
+ "name": "accepted_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acceptance_started_at": {
+ "name": "acceptance_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enforcement_completed_at": {
+ "name": "enforcement_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "review_required_at": {
+ "name": "review_required_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "closed_at": {
+ "name": "closed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_stripe_dispute_cases_event_id": {
+ "name": "IDX_stripe_dispute_cases_event_id",
+ "columns": [
+ {
+ "expression": "stripe_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_dispute_cases_charge_id": {
+ "name": "IDX_stripe_dispute_cases_charge_id",
+ "columns": [
+ {
+ "expression": "stripe_charge_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_dispute_cases_payment_intent_id": {
+ "name": "IDX_stripe_dispute_cases_payment_intent_id",
+ "columns": [
+ {
+ "expression": "stripe_payment_intent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_dispute_cases_customer_id": {
+ "name": "IDX_stripe_dispute_cases_customer_id",
+ "columns": [
+ {
+ "expression": "stripe_customer_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_dispute_cases_kilo_user_id": {
+ "name": "IDX_stripe_dispute_cases_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_dispute_cases_organization_id": {
+ "name": "IDX_stripe_dispute_cases_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_dispute_cases_status_due_by": {
+ "name": "IDX_stripe_dispute_cases_status_due_by",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "evidence_due_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "stripe_created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "stripe_dispute_cases_kilo_user_id_kilocode_users_id_fk": {
+ "name": "stripe_dispute_cases_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "stripe_dispute_cases",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "stripe_dispute_cases_organization_id_organizations_id_fk": {
+ "name": "stripe_dispute_cases_organization_id_organizations_id_fk",
+ "tableFrom": "stripe_dispute_cases",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "stripe_dispute_cases_accepted_by_kilo_user_id_kilocode_users_id_fk": {
+ "name": "stripe_dispute_cases_accepted_by_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "stripe_dispute_cases",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "accepted_by_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_stripe_dispute_cases_dispute_id": {
+ "name": "UQ_stripe_dispute_cases_dispute_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_dispute_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "stripe_dispute_cases_owner_classification_check": {
+ "name": "stripe_dispute_cases_owner_classification_check",
+ "value": "\"stripe_dispute_cases\".\"owner_classification\" IN ('personal', 'organization', 'ambiguous', 'unmatched')"
+ },
+ "stripe_dispute_cases_status_check": {
+ "name": "stripe_dispute_cases_status_check",
+ "value": "\"stripe_dispute_cases\".\"status\" IN ('needs_action', 'processing', 'accepted', 'acceptance_failed', 'enforcement_failed', 'review_required', 'closed')"
+ },
+ "stripe_dispute_cases_amount_minor_units_non_negative_check": {
+ "name": "stripe_dispute_cases_amount_minor_units_non_negative_check",
+ "value": "\"stripe_dispute_cases\".\"amount_minor_units\" IS NULL OR \"stripe_dispute_cases\".\"amount_minor_units\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.stripe_early_fraud_warning_actions": {
+ "name": "stripe_early_fraud_warning_actions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action_type": {
+ "name": "action_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_key": {
+ "name": "target_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "terminal_at": {
+ "name": "terminal_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_code": {
+ "name": "result_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_reference_id": {
+ "name": "result_reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_context": {
+ "name": "failure_context",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_stripe_early_fraud_warning_actions_case_id": {
+ "name": "IDX_stripe_early_fraud_warning_actions_case_id",
+ "columns": [
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_early_fraud_warning_actions_claim_path": {
+ "name": "IDX_stripe_early_fraud_warning_actions_claim_path",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"next_retry_at\", '-infinity'::timestamptz)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "stripe_early_fraud_warning_actions_case_id_stripe_early_fraud_warning_cases_id_fk": {
+ "name": "stripe_early_fraud_warning_actions_case_id_stripe_early_fraud_warning_cases_id_fk",
+ "tableFrom": "stripe_early_fraud_warning_actions",
+ "tableTo": "stripe_early_fraud_warning_cases",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_stripe_early_fraud_warning_actions_case_type_target": {
+ "name": "UQ_stripe_early_fraud_warning_actions_case_type_target",
+ "nullsNotDistinct": false,
+ "columns": [
+ "case_id",
+ "action_type",
+ "target_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "stripe_early_fraud_warning_actions_action_type_check": {
+ "name": "stripe_early_fraud_warning_actions_action_type_check",
+ "value": "\"stripe_early_fraud_warning_actions\".\"action_type\" IN ('containment', 'refund', 'payment_value_clawback', 'subscription_termination', 'access_termination', 'kiloclaw_suspension', 'affiliate_payout_reversal', 'referral_reward_reversal', 'user_notice')"
+ },
+ "stripe_early_fraud_warning_actions_status_check": {
+ "name": "stripe_early_fraud_warning_actions_status_check",
+ "value": "\"stripe_early_fraud_warning_actions\".\"status\" IN ('queued', 'processing', 'completed', 'failed', 'review_required', 'dismissed')"
+ },
+ "stripe_early_fraud_warning_actions_attempt_count_non_negative_check": {
+ "name": "stripe_early_fraud_warning_actions_attempt_count_non_negative_check",
+ "value": "\"stripe_early_fraud_warning_actions\".\"attempt_count\" >= 0"
+ },
+ "stripe_early_fraud_warning_actions_target_key_not_empty_check": {
+ "name": "stripe_early_fraud_warning_actions_target_key_not_empty_check",
+ "value": "length(\"stripe_early_fraud_warning_actions\".\"target_key\") > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.stripe_early_fraud_warning_cases": {
+ "name": "stripe_early_fraud_warning_cases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "stripe_early_fraud_warning_id": {
+ "name": "stripe_early_fraud_warning_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_event_id": {
+ "name": "stripe_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_charge_id": {
+ "name": "stripe_charge_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_payment_intent_id": {
+ "name": "stripe_payment_intent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "amount_minor_units": {
+ "name": "amount_minor_units",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_classification": {
+ "name": "owner_classification",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_context": {
+ "name": "failure_context",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "warning_created_at": {
+ "name": "warning_created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contained_at": {
+ "name": "contained_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processing_started_at": {
+ "name": "processing_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "review_required_at": {
+ "name": "review_required_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remediated_at": {
+ "name": "remediated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dismissed_at": {
+ "name": "dismissed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_stripe_early_fraud_warning_cases_event_id": {
+ "name": "IDX_stripe_early_fraud_warning_cases_event_id",
+ "columns": [
+ {
+ "expression": "stripe_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_early_fraud_warning_cases_charge_id": {
+ "name": "IDX_stripe_early_fraud_warning_cases_charge_id",
+ "columns": [
+ {
+ "expression": "stripe_charge_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_early_fraud_warning_cases_payment_intent_id": {
+ "name": "IDX_stripe_early_fraud_warning_cases_payment_intent_id",
+ "columns": [
+ {
+ "expression": "stripe_payment_intent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_early_fraud_warning_cases_customer_id": {
+ "name": "IDX_stripe_early_fraud_warning_cases_customer_id",
+ "columns": [
+ {
+ "expression": "stripe_customer_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_early_fraud_warning_cases_kilo_user_id": {
+ "name": "IDX_stripe_early_fraud_warning_cases_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_early_fraud_warning_cases_organization_id": {
+ "name": "IDX_stripe_early_fraud_warning_cases_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_stripe_early_fraud_warning_cases_status_created_at": {
+ "name": "IDX_stripe_early_fraud_warning_cases_status_created_at",
+ "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": {
+ "stripe_early_fraud_warning_cases_kilo_user_id_kilocode_users_id_fk": {
+ "name": "stripe_early_fraud_warning_cases_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "stripe_early_fraud_warning_cases",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ },
+ "stripe_early_fraud_warning_cases_organization_id_organizations_id_fk": {
+ "name": "stripe_early_fraud_warning_cases_organization_id_organizations_id_fk",
+ "tableFrom": "stripe_early_fraud_warning_cases",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_stripe_early_fraud_warning_cases_warning_id": {
+ "name": "UQ_stripe_early_fraud_warning_cases_warning_id",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_early_fraud_warning_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "stripe_early_fraud_warning_cases_owner_classification_check": {
+ "name": "stripe_early_fraud_warning_cases_owner_classification_check",
+ "value": "\"stripe_early_fraud_warning_cases\".\"owner_classification\" IN ('personal', 'organization', 'ambiguous', 'unmatched')"
+ },
+ "stripe_early_fraud_warning_cases_status_check": {
+ "name": "stripe_early_fraud_warning_cases_status_check",
+ "value": "\"stripe_early_fraud_warning_cases\".\"status\" IN ('queued', 'contained', 'processing', 'completed', 'review_required', 'failed', 'remediated', 'dismissed')"
+ },
+ "stripe_early_fraud_warning_cases_amount_minor_units_non_negative_check": {
+ "name": "stripe_early_fraud_warning_cases_amount_minor_units_non_negative_check",
+ "value": "\"stripe_early_fraud_warning_cases\".\"amount_minor_units\" IS NULL OR \"stripe_early_fraud_warning_cases\".\"amount_minor_units\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.stytch_fingerprints": {
+ "name": "stytch_fingerprints",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "visitor_fingerprint": {
+ "name": "visitor_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "browser_fingerprint": {
+ "name": "browser_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "browser_id": {
+ "name": "browser_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "hardware_fingerprint": {
+ "name": "hardware_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "network_fingerprint": {
+ "name": "network_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "visitor_id": {
+ "name": "visitor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "verdict_action": {
+ "name": "verdict_action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "detected_device_type": {
+ "name": "detected_device_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_authentic_device": {
+ "name": "is_authentic_device",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reasons": {
+ "name": "reasons",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"\"}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "status_code": {
+ "name": "status_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "fingerprint_data": {
+ "name": "fingerprint_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_free_tier_allowed": {
+ "name": "kilo_free_tier_allowed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "http_x_forwarded_for": {
+ "name": "http_x_forwarded_for",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_city": {
+ "name": "http_x_vercel_ip_city",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_country": {
+ "name": "http_x_vercel_ip_country",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_latitude": {
+ "name": "http_x_vercel_ip_latitude",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_longitude": {
+ "name": "http_x_vercel_ip_longitude",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ja4_digest": {
+ "name": "http_x_vercel_ja4_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_user_agent": {
+ "name": "http_user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "idx_hardware_fingerprint": {
+ "name": "idx_hardware_fingerprint",
+ "columns": [
+ {
+ "expression": "hardware_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_kilo_user_id": {
+ "name": "idx_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_stytch_fingerprints_reasons_gin": {
+ "name": "idx_stytch_fingerprints_reasons_gin",
+ "columns": [
+ {
+ "expression": "reasons",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "gin",
+ "with": {}
+ },
+ "idx_verdict_action": {
+ "name": "idx_verdict_action",
+ "columns": [
+ {
+ "expression": "verdict_action",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "idx_visitor_fingerprint": {
+ "name": "idx_visitor_fingerprint",
+ "columns": [
+ {
+ "expression": "visitor_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.system_prompt_prefix": {
+ "name": "system_prompt_prefix",
+ "schema": "",
+ "columns": {
+ "system_prompt_prefix_id": {
+ "name": "system_prompt_prefix_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "system_prompt_prefix": {
+ "name": "system_prompt_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_system_prompt_prefix": {
+ "name": "UQ_system_prompt_prefix",
+ "columns": [
+ {
+ "expression": "system_prompt_prefix",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.transactional_email_log": {
+ "name": "transactional_email_log",
+ "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
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_type": {
+ "name": "email_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_transactional_email_log_type_idempotency_key": {
+ "name": "UQ_transactional_email_log_type_idempotency_key",
+ "columns": [
+ {
+ "expression": "email_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_transactional_email_log_user_id": {
+ "name": "IDX_transactional_email_log_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_transactional_email_log_organization_id": {
+ "name": "IDX_transactional_email_log_organization_id",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "transactional_email_log_user_id_kilocode_users_id_fk": {
+ "name": "transactional_email_log_user_id_kilocode_users_id_fk",
+ "tableFrom": "transactional_email_log",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "transactional_email_log_organization_id_organizations_id_fk": {
+ "name": "transactional_email_log_organization_id_organizations_id_fk",
+ "tableFrom": "transactional_email_log",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "CHK_transactional_email_log_owner": {
+ "name": "CHK_transactional_email_log_owner",
+ "value": "\"transactional_email_log\".\"user_id\" IS NOT NULL OR \"transactional_email_log\".\"organization_id\" IS NOT NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_activity_tokens": {
+ "name": "user_activity_tokens",
+ "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
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_user_activity_tokens_token": {
+ "name": "UQ_user_activity_tokens_token",
+ "columns": [
+ {
+ "expression": "token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_activity_tokens_user_org": {
+ "name": "IDX_user_activity_tokens_user_org",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_activity_tokens_user_id_kilocode_users_id_fk": {
+ "name": "user_activity_tokens_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_activity_tokens",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_admin_notes": {
+ "name": "user_admin_notes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "note_content": {
+ "name": "note_content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "admin_kilo_user_id": {
+ "name": "admin_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_34517df0b385234babc38fe81b": {
+ "name": "IDX_34517df0b385234babc38fe81b",
+ "columns": [
+ {
+ "expression": "admin_kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_ccbde98c4c14046daa5682ec4f": {
+ "name": "IDX_ccbde98c4c14046daa5682ec4f",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_d0270eb24ef6442d65a0b7853c": {
+ "name": "IDX_d0270eb24ef6442d65a0b7853c",
+ "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.user_affiliate_attributions": {
+ "name": "user_affiliate_attributions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tracking_id": {
+ "name": "tracking_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_user_affiliate_attributions_user_id": {
+ "name": "IDX_user_affiliate_attributions_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_affiliate_attributions_user_id_kilocode_users_id_fk": {
+ "name": "user_affiliate_attributions_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_affiliate_attributions",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_user_affiliate_attributions_user_provider": {
+ "name": "UQ_user_affiliate_attributions_user_provider",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id",
+ "provider"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "user_affiliate_attributions_provider_check": {
+ "name": "user_affiliate_attributions_provider_check",
+ "value": "\"user_affiliate_attributions\".\"provider\" IN ('impact')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_affiliate_events": {
+ "name": "user_affiliate_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dedupe_key": {
+ "name": "dedupe_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_event_id": {
+ "name": "parent_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_state": {
+ "name": "delivery_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_charge_id": {
+ "name": "stripe_charge_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "impact_action_id": {
+ "name": "impact_action_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "impact_submission_uri": {
+ "name": "impact_submission_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_user_affiliate_events_claim_path": {
+ "name": "IDX_user_affiliate_events_claim_path",
+ "columns": [
+ {
+ "expression": "delivery_state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "coalesce(\"next_retry_at\", '-infinity'::timestamptz)",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_affiliate_events_parent_event_id": {
+ "name": "IDX_user_affiliate_events_parent_event_id",
+ "columns": [
+ {
+ "expression": "parent_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_affiliate_events_provider_event_type_charge": {
+ "name": "IDX_user_affiliate_events_provider_event_type_charge",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "event_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "stripe_charge_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_affiliate_events_user_id_kilocode_users_id_fk": {
+ "name": "user_affiliate_events_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_affiliate_events",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "user_affiliate_events_parent_event_id_fk": {
+ "name": "user_affiliate_events_parent_event_id_fk",
+ "tableFrom": "user_affiliate_events",
+ "tableTo": "user_affiliate_events",
+ "columnsFrom": [
+ "parent_event_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_user_affiliate_events_dedupe_key": {
+ "name": "UQ_user_affiliate_events_dedupe_key",
+ "nullsNotDistinct": false,
+ "columns": [
+ "dedupe_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "user_affiliate_events_provider_check": {
+ "name": "user_affiliate_events_provider_check",
+ "value": "\"user_affiliate_events\".\"provider\" IN ('impact')"
+ },
+ "user_affiliate_events_event_type_check": {
+ "name": "user_affiliate_events_event_type_check",
+ "value": "\"user_affiliate_events\".\"event_type\" IN ('signup', 'trial_start', 'trial_end', 'sale', 'sale_reversal')"
+ },
+ "user_affiliate_events_delivery_state_check": {
+ "name": "user_affiliate_events_delivery_state_check",
+ "value": "\"user_affiliate_events\".\"delivery_state\" IN ('queued', 'blocked', 'sending', 'delivered', 'failed')"
+ },
+ "user_affiliate_events_attempt_count_non_negative_check": {
+ "name": "user_affiliate_events_attempt_count_non_negative_check",
+ "value": "\"user_affiliate_events\".\"attempt_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_auth_provider": {
+ "name": "user_auth_provider",
+ "schema": "",
+ "columns": {
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_account_id": {
+ "name": "provider_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "avatar_url": {
+ "name": "avatar_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "hosted_domain": {
+ "name": "hosted_domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_user_auth_provider_kilo_user_id": {
+ "name": "IDX_user_auth_provider_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_auth_provider_hosted_domain": {
+ "name": "IDX_user_auth_provider_hosted_domain",
+ "columns": [
+ {
+ "expression": "hosted_domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_auth_provider_lower_email": {
+ "name": "IDX_user_auth_provider_lower_email",
+ "columns": [
+ {
+ "expression": "lower(\"email\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": true,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "user_auth_provider_provider_provider_account_id_pk": {
+ "name": "user_auth_provider_provider_provider_account_id_pk",
+ "columns": [
+ "provider",
+ "provider_account_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_data_export_object_deletions": {
+ "name": "user_data_export_object_deletions",
+ "schema": "",
+ "columns": {
+ "object_key": {
+ "name": "object_key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "multipart_upload_id": {
+ "name": "multipart_upload_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'account_deletion'"
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "available_at": {
+ "name": "available_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_user_data_export_object_deletions_ready": {
+ "name": "IDX_user_data_export_object_deletions_ready",
+ "columns": [
+ {
+ "expression": "available_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "object_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_data_export_object_deletions_reason_check": {
+ "name": "user_data_export_object_deletions_reason_check",
+ "value": "\"user_data_export_object_deletions\".\"reason\" IN ('account_deletion', 'admin_cancel', 'admin_replace')"
+ },
+ "user_data_export_object_deletions_attempt_count_nonnegative": {
+ "name": "user_data_export_object_deletions_attempt_count_nonnegative",
+ "value": "\"user_data_export_object_deletions\".\"attempt_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_data_export_outbox": {
+ "name": "user_data_export_outbox",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "export_id": {
+ "name": "export_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "generation": {
+ "name": "generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "operation": {
+ "name": "operation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'generate'"
+ },
+ "available_at": {
+ "name": "available_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_user_data_export_outbox_pending": {
+ "name": "IDX_user_data_export_outbox_pending",
+ "columns": [
+ {
+ "expression": "available_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_data_export_outbox\".\"sent_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_data_export_outbox_export_id_user_data_exports_id_fk": {
+ "name": "user_data_export_outbox_export_id_user_data_exports_id_fk",
+ "tableFrom": "user_data_export_outbox",
+ "tableTo": "user_data_exports",
+ "columnsFrom": [
+ "export_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_user_data_export_outbox_generation_operation": {
+ "name": "UQ_user_data_export_outbox_generation_operation",
+ "nullsNotDistinct": false,
+ "columns": [
+ "export_id",
+ "generation",
+ "operation"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "user_data_export_outbox_operation_check": {
+ "name": "user_data_export_outbox_operation_check",
+ "value": "\"user_data_export_outbox\".\"operation\" = 'generate'"
+ },
+ "user_data_export_outbox_generation_nonnegative": {
+ "name": "user_data_export_outbox_generation_nonnegative",
+ "value": "\"user_data_export_outbox\".\"generation\" >= 0"
+ },
+ "user_data_export_outbox_attempt_count_nonnegative": {
+ "name": "user_data_export_outbox_attempt_count_nonnegative",
+ "value": "\"user_data_export_outbox\".\"attempt_count\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_data_export_parts": {
+ "name": "user_data_export_parts",
+ "schema": "",
+ "columns": {
+ "export_id": {
+ "name": "export_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "part_number": {
+ "name": "part_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "etag": {
+ "name": "etag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_data_export_parts_export_id_user_data_exports_id_fk": {
+ "name": "user_data_export_parts_export_id_user_data_exports_id_fk",
+ "tableFrom": "user_data_export_parts",
+ "tableTo": "user_data_exports",
+ "columnsFrom": [
+ "export_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "user_data_export_parts_export_id_part_number_pk": {
+ "name": "user_data_export_parts_export_id_part_number_pk",
+ "columns": [
+ "export_id",
+ "part_number"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_data_export_parts_part_number_positive": {
+ "name": "user_data_export_parts_part_number_positive",
+ "value": "\"user_data_export_parts\".\"part_number\" > 0"
+ },
+ "user_data_export_parts_size_bytes_nonnegative": {
+ "name": "user_data_export_parts_size_bytes_nonnegative",
+ "value": "\"user_data_export_parts\".\"size_bytes\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_data_exports": {
+ "name": "user_data_exports",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'user'"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "schema_version": {
+ "name": "schema_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "snapshot_at": {
+ "name": "snapshot_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "current_source": {
+ "name": "current_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_cursor": {
+ "name": "source_cursor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "multipart_upload_id": {
+ "name": "multipart_upload_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_part_number": {
+ "name": "next_part_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "dispatch_generation": {
+ "name": "dispatch_generation",
+ "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 with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "row_count": {
+ "name": "row_count",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "r2_object_key": {
+ "name": "r2_object_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "r2_etag": {
+ "name": "r2_etag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_redacted": {
+ "name": "last_error_redacted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_at": {
+ "name": "requested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_status": {
+ "name": "email_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "email_attempt_count": {
+ "name": "email_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "email_lease_token": {
+ "name": "email_lease_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_lease_expires_at": {
+ "name": "email_lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_sent_at": {
+ "name": "email_sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_user_data_exports_single_active": {
+ "name": "UQ_user_data_exports_single_active",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_data_exports\".\"status\" IN ('queued', 'processing', 'finalizing') AND \"user_data_exports\".\"subject_type\" = 'user'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_user_data_exports_single_active_org": {
+ "name": "UQ_user_data_exports_single_active_org",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_data_exports\".\"status\" IN ('queued', 'processing', 'finalizing') AND \"user_data_exports\".\"subject_type\" = 'organization'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_data_exports_user_created": {
+ "name": "IDX_user_data_exports_user_created",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_data_exports_org_created": {
+ "name": "IDX_user_data_exports_org_created",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_data_exports\".\"organization_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_data_exports_lease_expiry": {
+ "name": "IDX_user_data_exports_lease_expiry",
+ "columns": [
+ {
+ "expression": "lease_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_data_exports\".\"status\" IN ('processing', 'finalizing')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_data_exports_ready_expiry": {
+ "name": "IDX_user_data_exports_ready_expiry",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_data_exports\".\"status\" = 'ready'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_data_exports_failed_multipart": {
+ "name": "IDX_user_data_exports_failed_multipart",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_data_exports\".\"status\" = 'failed' AND \"user_data_exports\".\"multipart_upload_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_data_exports_email_lease_expiry": {
+ "name": "IDX_user_data_exports_email_lease_expiry",
+ "columns": [
+ {
+ "expression": "email_lease_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_data_exports\".\"email_status\" = 'sending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_data_exports_kilo_user_id_kilocode_users_id_fk": {
+ "name": "user_data_exports_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_data_exports",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ },
+ "user_data_exports_organization_id_organizations_id_fk": {
+ "name": "user_data_exports_organization_id_organizations_id_fk",
+ "tableFrom": "user_data_exports",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "restrict",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_data_exports_status_check": {
+ "name": "user_data_exports_status_check",
+ "value": "\"user_data_exports\".\"status\" IN ('queued', 'processing', 'finalizing', 'ready', 'failed', 'expired')"
+ },
+ "user_data_exports_subject_type_check": {
+ "name": "user_data_exports_subject_type_check",
+ "value": "\"user_data_exports\".\"subject_type\" IN ('user', 'organization')"
+ },
+ "user_data_exports_subject_shape": {
+ "name": "user_data_exports_subject_shape",
+ "value": "(\"user_data_exports\".\"subject_type\" = 'user' AND \"user_data_exports\".\"organization_id\" IS NULL)\n OR (\"user_data_exports\".\"subject_type\" = 'organization' AND \"user_data_exports\".\"organization_id\" IS NOT NULL)"
+ },
+ "user_data_exports_schema_version_positive": {
+ "name": "user_data_exports_schema_version_positive",
+ "value": "\"user_data_exports\".\"schema_version\" > 0"
+ },
+ "user_data_exports_next_part_number_positive": {
+ "name": "user_data_exports_next_part_number_positive",
+ "value": "\"user_data_exports\".\"next_part_number\" > 0"
+ },
+ "user_data_exports_dispatch_generation_nonnegative": {
+ "name": "user_data_exports_dispatch_generation_nonnegative",
+ "value": "\"user_data_exports\".\"dispatch_generation\" >= 0"
+ },
+ "user_data_exports_attempt_count_nonnegative": {
+ "name": "user_data_exports_attempt_count_nonnegative",
+ "value": "\"user_data_exports\".\"attempt_count\" >= 0"
+ },
+ "user_data_exports_row_count_nonnegative": {
+ "name": "user_data_exports_row_count_nonnegative",
+ "value": "\"user_data_exports\".\"row_count\" >= 0"
+ },
+ "user_data_exports_size_bytes_nonnegative": {
+ "name": "user_data_exports_size_bytes_nonnegative",
+ "value": "\"user_data_exports\".\"size_bytes\" IS NULL OR \"user_data_exports\".\"size_bytes\" >= 0"
+ },
+ "user_data_exports_lease_shape": {
+ "name": "user_data_exports_lease_shape",
+ "value": "(\"user_data_exports\".\"lease_token\" IS NULL) = (\"user_data_exports\".\"lease_expires_at\" IS NULL)"
+ },
+ "user_data_exports_ready_shape": {
+ "name": "user_data_exports_ready_shape",
+ "value": "\"user_data_exports\".\"status\" <> 'ready' OR (\"user_data_exports\".\"r2_object_key\" IS NOT NULL AND \"user_data_exports\".\"size_bytes\" IS NOT NULL AND \"user_data_exports\".\"completed_at\" IS NOT NULL AND \"user_data_exports\".\"expires_at\" IS NOT NULL)"
+ },
+ "user_data_exports_last_error_redacted_length": {
+ "name": "user_data_exports_last_error_redacted_length",
+ "value": "\"user_data_exports\".\"last_error_redacted\" IS NULL OR length(\"user_data_exports\".\"last_error_redacted\") <= 500"
+ },
+ "user_data_exports_email_attempt_count_nonnegative": {
+ "name": "user_data_exports_email_attempt_count_nonnegative",
+ "value": "\"user_data_exports\".\"email_attempt_count\" >= 0"
+ },
+ "user_data_exports_email_status_check": {
+ "name": "user_data_exports_email_status_check",
+ "value": "\"user_data_exports\".\"email_status\" IN ('pending', 'sending', 'sent', 'failed')"
+ },
+ "user_data_exports_email_lease_shape": {
+ "name": "user_data_exports_email_lease_shape",
+ "value": "(\"user_data_exports\".\"email_status\" = 'sending') = (\"user_data_exports\".\"email_lease_token\" IS NOT NULL AND \"user_data_exports\".\"email_lease_expires_at\" IS NOT NULL)"
+ },
+ "user_data_exports_email_sent_shape": {
+ "name": "user_data_exports_email_sent_shape",
+ "value": "(\"user_data_exports\".\"email_status\" = 'sent') = (\"user_data_exports\".\"email_sent_at\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_deletion_activity": {
+ "name": "user_deletion_activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "step_key": {
+ "name": "step_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "details_json": {
+ "name": "details_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_user_deletion_activity_request_created": {
+ "name": "IDX_user_deletion_activity_request_created",
+ "columns": [
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_deletion_activity_request_id_user_deletion_requests_id_fk": {
+ "name": "user_deletion_activity_request_id_user_deletion_requests_id_fk",
+ "tableFrom": "user_deletion_activity",
+ "tableTo": "user_deletion_requests",
+ "columnsFrom": [
+ "request_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_deletion_audit_events": {
+ "name": "user_deletion_audit_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_kilo_user_id": {
+ "name": "actor_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_email_hmac": {
+ "name": "target_email_hmac",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_key": {
+ "name": "subject_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "details_json": {
+ "name": "details_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_user_deletion_audit_events_idempotent": {
+ "name": "UQ_user_deletion_audit_events_idempotent",
+ "columns": [
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "event_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_deletion_audit_events\".\"request_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_deletion_audit_events_request_id": {
+ "name": "IDX_user_deletion_audit_events_request_id",
+ "columns": [
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_deletion_audit_events_hmac": {
+ "name": "IDX_user_deletion_audit_events_hmac",
+ "columns": [
+ {
+ "expression": "target_email_hmac",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_deletion_audit_events_request_id_user_deletion_requests_id_fk": {
+ "name": "user_deletion_audit_events_request_id_user_deletion_requests_id_fk",
+ "tableFrom": "user_deletion_audit_events",
+ "tableTo": "user_deletion_requests",
+ "columnsFrom": [
+ "request_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_deletion_audit_events_event_type_check": {
+ "name": "user_deletion_audit_events_event_type_check",
+ "value": "\"user_deletion_audit_events\".\"event_type\" IN ('request_created', 'intake_refused', 'access_disabled', 'access_absent', 'preflight_disposition', 'task_disposition', 'manual_retry', 'manual_action', 'anonymized', 'deletion_ready_for_customer_reply', 'cancelled', 'completed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_deletion_provider_credentials": {
+ "name": "user_deletion_provider_credentials",
+ "schema": "",
+ "columns": {
+ "provider_scope": {
+ "name": "provider_scope",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "encrypted_material": {
+ "name": "encrypted_material",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_by_kilo_user_id": {
+ "name": "updated_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_deletion_provider_credentials_updated_by_kilo_user_id_kilocode_users_id_fk": {
+ "name": "user_deletion_provider_credentials_updated_by_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_deletion_provider_credentials",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "updated_by_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_deletion_provider_credentials_scope_check": {
+ "name": "user_deletion_provider_credentials_scope_check",
+ "value": "\"user_deletion_provider_credentials\".\"provider_scope\" IN ('kiloclaw', 'customerio', 'cloud_storage', 'session_ingest', 'posthog', 'substack', 'pylon', 'csa')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_deletion_requests": {
+ "name": "user_deletion_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "catalog_version": {
+ "name": "catalog_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "requested_by_kilo_user_id": {
+ "name": "requested_by_kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by_email": {
+ "name": "requested_by_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_email": {
+ "name": "target_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_email_hmac": {
+ "name": "target_email_hmac",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pylon_ticket_ref": {
+ "name": "pylon_ticket_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cloud_subject_resolution": {
+ "name": "cloud_subject_resolution",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cloud_subject_proof_ref": {
+ "name": "cloud_subject_proof_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "preflight_attention_code": {
+ "name": "preflight_attention_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_progress_at": {
+ "name": "last_progress_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "anonymized_at": {
+ "name": "anonymized_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancelled_at": {
+ "name": "cancelled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "UQ_user_deletion_requests_active_email_hmac": {
+ "name": "UQ_user_deletion_requests_active_email_hmac",
+ "columns": [
+ {
+ "expression": "target_email_hmac",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_deletion_requests\".\"target_email_hmac\" IS NOT NULL AND \"user_deletion_requests\".\"status\" IN ('pending', 'in_progress', 'finalizing')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_user_deletion_requests_active_user_id": {
+ "name": "UQ_user_deletion_requests_active_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_deletion_requests\".\"user_id\" IS NOT NULL AND \"user_deletion_requests\".\"status\" IN ('pending', 'in_progress', 'finalizing')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_user_deletion_requests_active_pylon_ticket": {
+ "name": "UQ_user_deletion_requests_active_pylon_ticket",
+ "columns": [
+ {
+ "expression": "regexp_replace(\"pylon_ticket_ref\", '^#', '')",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_deletion_requests\".\"pylon_ticket_ref\" IS NOT NULL AND \"user_deletion_requests\".\"status\" IN ('pending', 'in_progress', 'finalizing')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_deletion_requests_fairness": {
+ "name": "IDX_user_deletion_requests_fairness",
+ "columns": [
+ {
+ "expression": "last_progress_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_deletion_requests\".\"status\" IN ('pending', 'in_progress', 'finalizing')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_deletion_requests_email_hmac": {
+ "name": "IDX_user_deletion_requests_email_hmac",
+ "columns": [
+ {
+ "expression": "target_email_hmac",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_deletion_requests_user_id": {
+ "name": "IDX_user_deletion_requests_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_deletion_requests_user_id_kilocode_users_id_fk": {
+ "name": "user_deletion_requests_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_deletion_requests",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "user_deletion_requests_requested_by_kilo_user_id_kilocode_users_id_fk": {
+ "name": "user_deletion_requests_requested_by_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_deletion_requests",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "requested_by_kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_deletion_requests_status_check": {
+ "name": "user_deletion_requests_status_check",
+ "value": "\"user_deletion_requests\".\"status\" IN ('pending', 'in_progress', 'finalizing', 'completed', 'cancelled')"
+ },
+ "user_deletion_requests_cloud_subject_resolution_check": {
+ "name": "user_deletion_requests_cloud_subject_resolution_check",
+ "value": "\"user_deletion_requests\".\"cloud_subject_resolution\" IN ('current_user', 'authoritative_absence', 'prior_queue_cleanup', 'legacy_identity_unresolved', 'unresolved')"
+ },
+ "user_deletion_requests_catalog_version_positive": {
+ "name": "user_deletion_requests_catalog_version_positive",
+ "value": "\"user_deletion_requests\".\"catalog_version\" >= 1"
+ },
+ "user_deletion_requests_completed_at_check": {
+ "name": "user_deletion_requests_completed_at_check",
+ "value": "(\"user_deletion_requests\".\"status\" = 'completed') = (\"user_deletion_requests\".\"completed_at\" IS NOT NULL)"
+ },
+ "user_deletion_requests_cancelled_at_check": {
+ "name": "user_deletion_requests_cancelled_at_check",
+ "value": "(\"user_deletion_requests\".\"status\" = 'cancelled') = (\"user_deletion_requests\".\"cancelled_at\" IS NOT NULL)"
+ },
+ "user_deletion_requests_active_email_check": {
+ "name": "user_deletion_requests_active_email_check",
+ "value": "(\"user_deletion_requests\".\"status\" NOT IN ('in_progress', 'finalizing') OR \"user_deletion_requests\".\"target_email\" IS NOT NULL) AND (\"user_deletion_requests\".\"status\" NOT IN ('completed', 'cancelled') OR \"user_deletion_requests\".\"target_email\" IS NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_deletion_steps": {
+ "name": "user_deletion_steps",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "step_key": {
+ "name": "step_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "available_at": {
+ "name": "available_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "claim_token": {
+ "name": "claim_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_until": {
+ "name": "claimed_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "window_attempt_count": {
+ "name": "window_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lifetime_attempt_count": {
+ "name": "lifetime_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "progress_json": {
+ "name": "progress_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rate_limited_since": {
+ "name": "rate_limited_since",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manual_evidence_json": {
+ "name": "manual_evidence_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_user_deletion_steps_due": {
+ "name": "IDX_user_deletion_steps_due",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "available_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"user_deletion_steps\".\"status\" IN ('pending', 'retry_wait', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_deletion_steps_request_id": {
+ "name": "IDX_user_deletion_steps_request_id",
+ "columns": [
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_deletion_steps_request_id_user_deletion_requests_id_fk": {
+ "name": "user_deletion_steps_request_id_user_deletion_requests_id_fk",
+ "tableFrom": "user_deletion_steps",
+ "tableTo": "user_deletion_requests",
+ "columnsFrom": [
+ "request_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_user_deletion_steps_request_step": {
+ "name": "UQ_user_deletion_steps_request_step",
+ "nullsNotDistinct": false,
+ "columns": [
+ "request_id",
+ "step_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "user_deletion_steps_step_key_check": {
+ "name": "user_deletion_steps_step_key_check",
+ "value": "\"user_deletion_steps\".\"step_key\" IN ('kiloclaw_destroy', 'customerio', 'cli_v1_blobs', 'cli_v2_sessions', 'usage_prompt_prefixes', 'posthog', 'substack', 'anonymize', 'pylon_reply', 'pylon_finalize', 'completion_email', 'pylon_contact', 'csa_support_db')"
+ },
+ "user_deletion_steps_status_check": {
+ "name": "user_deletion_steps_status_check",
+ "value": "\"user_deletion_steps\".\"status\" IN ('pending', 'running', 'retry_wait', 'needs_attention', 'manual_action_required', 'succeeded', 'not_applicable', 'manually_verified')"
+ },
+ "user_deletion_steps_window_attempt_count_nonnegative": {
+ "name": "user_deletion_steps_window_attempt_count_nonnegative",
+ "value": "\"user_deletion_steps\".\"window_attempt_count\" >= 0"
+ },
+ "user_deletion_steps_lifetime_attempt_count_nonnegative": {
+ "name": "user_deletion_steps_lifetime_attempt_count_nonnegative",
+ "value": "\"user_deletion_steps\".\"lifetime_attempt_count\" >= 0"
+ },
+ "user_deletion_steps_claim_fields_check": {
+ "name": "user_deletion_steps_claim_fields_check",
+ "value": "(\"user_deletion_steps\".\"claim_token\" IS NULL) = (\"user_deletion_steps\".\"claimed_until\" IS NULL)"
+ },
+ "user_deletion_steps_manual_evidence_check": {
+ "name": "user_deletion_steps_manual_evidence_check",
+ "value": "(\"user_deletion_steps\".\"status\" = 'manually_verified') = (\"user_deletion_steps\".\"manual_evidence_json\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_feedback": {
+ "name": "user_feedback",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "feedback_text": {
+ "name": "feedback_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback_for": {
+ "name": "feedback_for",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "feedback_batch": {
+ "name": "feedback_batch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "context_json": {
+ "name": "context_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_user_feedback_created_at": {
+ "name": "IDX_user_feedback_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_feedback_kilo_user_id": {
+ "name": "IDX_user_feedback_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_feedback_feedback_for": {
+ "name": "IDX_user_feedback_feedback_for",
+ "columns": [
+ {
+ "expression": "feedback_for",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_feedback_feedback_batch": {
+ "name": "IDX_user_feedback_feedback_batch",
+ "columns": [
+ {
+ "expression": "feedback_batch",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_feedback_source": {
+ "name": "IDX_user_feedback_source",
+ "columns": [
+ {
+ "expression": "source",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_feedback_kilo_user_id_kilocode_users_id_fk": {
+ "name": "user_feedback_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_feedback",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_github_app_tokens": {
+ "name": "user_github_app_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_app_type": {
+ "name": "github_app_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'standard'"
+ },
+ "github_user_id": {
+ "name": "github_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_login": {
+ "name": "github_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_encrypted": {
+ "name": "access_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refresh_token_encrypted": {
+ "name": "refresh_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_version": {
+ "name": "credential_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revocation_reason": {
+ "name": "revocation_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_user_github_app_tokens_user_app": {
+ "name": "UQ_user_github_app_tokens_user_app",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "github_app_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_user_github_app_tokens_github_user_app": {
+ "name": "UQ_user_github_app_tokens_github_user_app",
+ "columns": [
+ {
+ "expression": "github_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "github_app_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_github_app_tokens_kilo_user_id_kilocode_users_id_fk": {
+ "name": "user_github_app_tokens_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_github_app_tokens",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_github_app_tokens_app_type_check": {
+ "name": "user_github_app_tokens_app_type_check",
+ "value": "\"user_github_app_tokens\".\"github_app_type\" IN ('standard', 'lite')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_model_preferences": {
+ "name": "user_model_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "favorites": {
+ "name": "favorites",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "last_selected": {
+ "name": "last_selected",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_user_model_preferences_user_id": {
+ "name": "UQ_user_model_preferences_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_model_preferences_user_id_kilocode_users_id_fk": {
+ "name": "user_model_preferences_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_model_preferences",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_moderation_blocks": {
+ "name": "user_moderation_blocks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "blocker_user_id": {
+ "name": "blocker_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "blocked_github_login": {
+ "name": "blocked_github_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_user_moderation_blocks_blocker_login": {
+ "name": "UQ_user_moderation_blocks_blocker_login",
+ "columns": [
+ {
+ "expression": "blocker_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "blocked_github_login",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_moderation_mutes": {
+ "name": "user_moderation_mutes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "blocker_user_id": {
+ "name": "blocker_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "muted_github_login": {
+ "name": "muted_github_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_user_moderation_mutes_blocker_login": {
+ "name": "UQ_user_moderation_mutes_blocker_login",
+ "columns": [
+ {
+ "expression": "blocker_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "muted_github_login",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_preferences": {
+ "name": "user_notification_preferences",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_push_enabled": {
+ "name": "agent_push_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "chat_messages_enabled": {
+ "name": "chat_messages_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "agent_attention_enabled": {
+ "name": "agent_attention_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "session_status_enabled": {
+ "name": "session_status_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "kiloclaw_activity_enabled": {
+ "name": "kiloclaw_activity_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "balance_alerts_enabled": {
+ "name": "balance_alerts_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "security_findings_enabled": {
+ "name": "security_findings_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "notification_previews": {
+ "name": "notification_previews",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'generic'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_notification_preferences_user_id_kilocode_users_id_fk": {
+ "name": "user_notification_preferences_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_notification_preferences",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_period_cache": {
+ "name": "user_period_cache",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cache_type": {
+ "name": "cache_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_type": {
+ "name": "period_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_key": {
+ "name": "period_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "computed_at": {
+ "name": "computed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "shared_url_token": {
+ "name": "shared_url_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shared_at": {
+ "name": "shared_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "IDX_user_period_cache_kilo_user_id": {
+ "name": "IDX_user_period_cache_kilo_user_id",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_user_period_cache": {
+ "name": "UQ_user_period_cache",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cache_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "period_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "period_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_period_cache_lookup": {
+ "name": "IDX_user_period_cache_lookup",
+ "columns": [
+ {
+ "expression": "cache_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "period_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "period_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "UQ_user_period_cache_share_token": {
+ "name": "UQ_user_period_cache_share_token",
+ "columns": [
+ {
+ "expression": "shared_url_token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_period_cache\".\"shared_url_token\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_period_cache_kilo_user_id_kilocode_users_id_fk": {
+ "name": "user_period_cache_kilo_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_period_cache",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "kilo_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_period_cache_period_type_check": {
+ "name": "user_period_cache_period_type_check",
+ "value": "\"user_period_cache\".\"period_type\" IN ('year', 'quarter', 'month', 'week', 'custom')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_push_tokens": {
+ "name": "user_push_tokens",
+ "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
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_version": {
+ "name": "app_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locale": {
+ "name": "locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_user_push_tokens_token": {
+ "name": "UQ_user_push_tokens_token",
+ "columns": [
+ {
+ "expression": "token",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_user_push_tokens_user_id": {
+ "name": "IDX_user_push_tokens_user_id",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_push_tokens_user_id_kilocode_users_id_fk": {
+ "name": "user_push_tokens_user_id_kilocode_users_id_fk",
+ "tableFrom": "user_push_tokens",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_terms_acceptances": {
+ "name": "user_terms_acceptances",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "terms_version": {
+ "name": "terms_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "age_posture": {
+ "name": "age_posture",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'13_plus'"
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "UQ_user_terms_acceptances_user_version": {
+ "name": "UQ_user_terms_acceptances_user_version",
+ "columns": [
+ {
+ "expression": "kilo_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "terms_version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vercel_ip_city": {
+ "name": "vercel_ip_city",
+ "schema": "",
+ "columns": {
+ "vercel_ip_city_id": {
+ "name": "vercel_ip_city_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vercel_ip_city": {
+ "name": "vercel_ip_city",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_vercel_ip_city": {
+ "name": "UQ_vercel_ip_city",
+ "columns": [
+ {
+ "expression": "vercel_ip_city",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vercel_ip_country": {
+ "name": "vercel_ip_country",
+ "schema": "",
+ "columns": {
+ "vercel_ip_country_id": {
+ "name": "vercel_ip_country_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vercel_ip_country": {
+ "name": "vercel_ip_country",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "UQ_vercel_ip_country": {
+ "name": "UQ_vercel_ip_country",
+ "columns": [
+ {
+ "expression": "vercel_ip_country",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook_events": {
+ "name": "webhook_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "pg_catalog.gen_random_uuid()"
+ },
+ "owned_by_organization_id": {
+ "name": "owned_by_organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_by_user_id": {
+ "name": "owned_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "platform": {
+ "name": "platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_action": {
+ "name": "event_action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "headers": {
+ "name": "headers",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "processed": {
+ "name": "processed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "processed_at": {
+ "name": "processed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "handlers_triggered": {
+ "name": "handlers_triggered",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "errors": {
+ "name": "errors",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_signature": {
+ "name": "event_signature",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "IDX_webhook_events_owned_by_org_id": {
+ "name": "IDX_webhook_events_owned_by_org_id",
+ "columns": [
+ {
+ "expression": "owned_by_organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_webhook_events_owned_by_user_id": {
+ "name": "IDX_webhook_events_owned_by_user_id",
+ "columns": [
+ {
+ "expression": "owned_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_webhook_events_platform": {
+ "name": "IDX_webhook_events_platform",
+ "columns": [
+ {
+ "expression": "platform",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_webhook_events_event_type": {
+ "name": "IDX_webhook_events_event_type",
+ "columns": [
+ {
+ "expression": "event_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "IDX_webhook_events_created_at": {
+ "name": "IDX_webhook_events_created_at",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_events_owned_by_organization_id_organizations_id_fk": {
+ "name": "webhook_events_owned_by_organization_id_organizations_id_fk",
+ "tableFrom": "webhook_events",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "owned_by_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "webhook_events_owned_by_user_id_kilocode_users_id_fk": {
+ "name": "webhook_events_owned_by_user_id_kilocode_users_id_fk",
+ "tableFrom": "webhook_events",
+ "tableTo": "kilocode_users",
+ "columnsFrom": [
+ "owned_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "UQ_webhook_events_signature": {
+ "name": "UQ_webhook_events_signature",
+ "nullsNotDistinct": false,
+ "columns": [
+ "event_signature"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "webhook_events_owner_check": {
+ "name": "webhook_events_owner_check",
+ "value": "(\n (\"webhook_events\".\"owned_by_user_id\" IS NOT NULL AND \"webhook_events\".\"owned_by_organization_id\" IS NULL) OR\n (\"webhook_events\".\"owned_by_user_id\" IS NULL AND \"webhook_events\".\"owned_by_organization_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {
+ "public.microdollar_usage_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kilo_user_id": {
+ "name": "kilo_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost": {
+ "name": "cost",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cache_write_tokens": {
+ "name": "cache_write_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cache_hit_tokens": {
+ "name": "cache_hit_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "http_x_forwarded_for": {
+ "name": "http_x_forwarded_for",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_city": {
+ "name": "http_x_vercel_ip_city",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_country": {
+ "name": "http_x_vercel_ip_country",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_latitude": {
+ "name": "http_x_vercel_ip_latitude",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ip_longitude": {
+ "name": "http_x_vercel_ip_longitude",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_x_vercel_ja4_digest": {
+ "name": "http_x_vercel_ja4_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_model": {
+ "name": "requested_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_prompt_prefix": {
+ "name": "user_prompt_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_prompt_prefix": {
+ "name": "system_prompt_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_prompt_length": {
+ "name": "system_prompt_length",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "http_user_agent": {
+ "name": "http_user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cache_discount": {
+ "name": "cache_discount",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_tokens": {
+ "name": "max_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_middle_out_transform": {
+ "name": "has_middle_out_transform",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_error": {
+ "name": "has_error",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "abuse_classification": {
+ "name": "abuse_classification",
+ "type": "smallint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inference_provider": {
+ "name": "inference_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status_code": {
+ "name": "status_code",
+ "type": "smallint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "upstream_id": {
+ "name": "upstream_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finish_reason": {
+ "name": "finish_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latency": {
+ "name": "latency",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "moderation_latency": {
+ "name": "moderation_latency",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "generation_time": {
+ "name": "generation_time",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_byok": {
+ "name": "is_byok",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_user_byok": {
+ "name": "is_user_byok",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "streamed": {
+ "name": "streamed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancelled": {
+ "name": "cancelled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "editor_name": {
+ "name": "editor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_kind": {
+ "name": "api_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_tools": {
+ "name": "has_tools",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "machine_id": {
+ "name": "machine_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "feature": {
+ "name": "feature",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_model": {
+ "name": "auto_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "market_cost": {
+ "name": "market_cost",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_free": {
+ "name": "is_free",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "abuse_delay": {
+ "name": "abuse_delay",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "abuse_downgraded_from": {
+ "name": "abuse_downgraded_from",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "definition": "\n SELECT\n mu.id,\n mu.kilo_user_id,\n meta.message_id,\n mu.cost,\n mu.input_tokens,\n mu.output_tokens,\n mu.cache_write_tokens,\n mu.cache_hit_tokens,\n mu.created_at,\n ip.http_ip AS http_x_forwarded_for,\n city.vercel_ip_city AS http_x_vercel_ip_city,\n country.vercel_ip_country AS http_x_vercel_ip_country,\n meta.vercel_ip_latitude AS http_x_vercel_ip_latitude,\n meta.vercel_ip_longitude AS http_x_vercel_ip_longitude,\n ja4.ja4_digest AS http_x_vercel_ja4_digest,\n mu.provider,\n mu.model,\n mu.requested_model,\n meta.user_prompt_prefix,\n spp.system_prompt_prefix,\n meta.system_prompt_length,\n ua.http_user_agent,\n mu.cache_discount,\n meta.max_tokens,\n meta.has_middle_out_transform,\n mu.has_error,\n mu.abuse_classification,\n mu.organization_id,\n mu.inference_provider,\n mu.project_id,\n meta.status_code,\n meta.upstream_id,\n frfr.finish_reason,\n meta.latency,\n meta.moderation_latency,\n meta.generation_time,\n meta.is_byok,\n meta.is_user_byok,\n meta.streamed,\n meta.cancelled,\n edit.editor_name,\n ak.api_kind,\n meta.has_tools,\n meta.machine_id,\n feat.feature,\n meta.session_id,\n md.mode,\n am.auto_model,\n meta.market_cost,\n meta.is_free,\n meta.abuse_delay,\n meta.abuse_downgraded_from\n FROM \"microdollar_usage\" mu\n LEFT JOIN \"microdollar_usage_metadata\" meta ON mu.id = meta.id\n LEFT JOIN \"http_ip\" ip ON meta.http_ip_id = ip.http_ip_id\n LEFT JOIN \"vercel_ip_city\" city ON meta.vercel_ip_city_id = city.vercel_ip_city_id\n LEFT JOIN \"vercel_ip_country\" country ON meta.vercel_ip_country_id = country.vercel_ip_country_id\n LEFT JOIN \"ja4_digest\" ja4 ON meta.ja4_digest_id = ja4.ja4_digest_id\n LEFT JOIN \"system_prompt_prefix\" spp ON meta.system_prompt_prefix_id = spp.system_prompt_prefix_id\n LEFT JOIN \"http_user_agent\" ua ON meta.http_user_agent_id = ua.http_user_agent_id\n LEFT JOIN \"finish_reason\" frfr ON meta.finish_reason_id = frfr.finish_reason_id\n LEFT JOIN \"editor_name\" edit ON meta.editor_name_id = edit.editor_name_id\n LEFT JOIN \"api_kind\" ak ON meta.api_kind_id = ak.api_kind_id\n LEFT JOIN \"feature\" feat ON meta.feature_id = feat.feature_id\n LEFT JOIN \"mode\" md ON meta.mode_id = md.mode_id\n LEFT JOIN \"auto_model\" am ON meta.auto_model_id = am.auto_model_id\n",
+ "name": "microdollar_usage_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ }
+ },
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/src/migrations/meta/_journal.json b/packages/db/src/migrations/meta/_journal.json
index d84d5a768b..93f7074655 100644
--- a/packages/db/src/migrations/meta/_journal.json
+++ b/packages/db/src/migrations/meta/_journal.json
@@ -1667,6 +1667,13 @@
"when": 1788477158434,
"tag": "0237_enkrypt_sync_state",
"breakpoints": true
+ },
+ {
+ "idx": 238,
+ "version": "7",
+ "when": 1788661121580,
+ "tag": "0238_drop_quick_chat",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts
index 47176e08db..b93cf7e6da 100644
--- a/packages/db/src/schema.ts
+++ b/packages/db/src/schema.ts
@@ -11195,56 +11195,3 @@ export const user_terms_acceptances = pgTable(
export type UserTermsAcceptance = typeof user_terms_acceptances.$inferSelect;
export type NewUserTermsAcceptance = typeof user_terms_acceptances.$inferInsert;
-
-export const quick_chat_threads = pgTable(
- 'quick_chat_threads',
- {
- id: uuid()
- .default(sql`pg_catalog.gen_random_uuid()`)
- .primaryKey()
- .notNull(),
- user_id: text()
- .notNull()
- .references(() => kilocode_users.id, { onDelete: 'restrict' }),
- organization_id: uuid().references(() => organizations.id, { onDelete: 'cascade' }),
- created_at: timestamp({ withTimezone: true, mode: 'string' }).defaultNow().notNull(),
- updated_at: timestamp({ withTimezone: true, mode: 'string' })
- .defaultNow()
- .notNull()
- .$onUpdateFn(() => sql`now()`),
- },
- table => [
- uniqueIndex('quick_chat_threads_user_personal_uidx')
- .on(table.user_id)
- .where(sql`${table.organization_id} IS NULL`),
- uniqueIndex('quick_chat_threads_user_org_uidx')
- .on(table.user_id, table.organization_id)
- .where(sql`${table.organization_id} IS NOT NULL`),
- ]
-);
-
-export type QuickChatThread = typeof quick_chat_threads.$inferSelect;
-export type NewQuickChatThread = typeof quick_chat_threads.$inferInsert;
-
-export const quick_chat_messages = pgTable(
- 'quick_chat_messages',
- {
- id: uuid()
- .default(sql`pg_catalog.gen_random_uuid()`)
- .primaryKey()
- .notNull(),
- thread_id: uuid()
- .notNull()
- .references(() => quick_chat_threads.id, { onDelete: 'cascade' }),
- role: text().notNull(),
- content: text().notNull(),
- client_id: text(),
- created_at: timestamp({ withTimezone: true, mode: 'string' }).defaultNow().notNull(),
- },
- table => [
- index('IDX_quick_chat_messages_thread_created_at').on(table.thread_id, table.created_at),
- ]
-);
-
-export type QuickChatMessage = typeof quick_chat_messages.$inferSelect;
-export type NewQuickChatMessage = typeof quick_chat_messages.$inferInsert;
diff --git a/packages/trpc/src/mobile.ts b/packages/trpc/src/mobile.ts
index 1e4b38a503..03d66bf950 100644
--- a/packages/trpc/src/mobile.ts
+++ b/packages/trpc/src/mobile.ts
@@ -17,7 +17,6 @@ import { modelPreferencesRouter } from '@/routers/model-preferences-router';
import { githubPrReviewRouter } from '@/routers/github-pr-review-router';
import { moderationRouter } from '@/routers/moderation-router';
import { kiloChatRouter } from '@/routers/kilo-chat-router';
-import { quickChatRouter } from '@/routers/quick-chat-router';
import { agentProfilesMobileRouter } from './agent-profiles-mobile';
/**
@@ -44,7 +43,6 @@ const mobileRouter = createTRPCRouter({
githubPrReview: githubPrReviewRouter,
moderation: moderationRouter,
kiloChat: kiloChatRouter,
- quickChat: quickChatRouter,
agentProfiles: agentProfilesMobileRouter,
});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1dc9d0431b..715899253d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -378,6 +378,9 @@ importers:
'@kilocode/event-service':
specifier: workspace:*
version: link:../../packages/event-service
+ '@kilocode/harness-sdk':
+ specifier: workspace:*
+ version: link:../../packages/harness-sdk
'@kilocode/kilo-chat':
specifier: workspace:*
version: link:../../packages/kilo-chat
@@ -438,6 +441,9 @@ importers:
drizzle-orm:
specifier: 0.45.2
version: 0.45.2(@cloudflare/workers-types@4.20260605.1)(@opentelemetry/api@1.9.1)(@types/pg@8.18.0)(@upstash/redis@1.38.0)(bun-types@1.3.14)(expo-sqlite@57.0.1(expo@57.0.15)(react-native@0.86.2(@types/react@19.2.14)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3))(kysely@0.29.2)(pg@8.20.0)
+ effect:
+ specifier: 3.22.1
+ version: 3.22.1
expo:
specifier: ~57.0.15
version: 57.0.15(@babel/core@7.29.7)(@expo/metro-runtime@57.0.12)(bufferutil@4.1.0)(expo-router@57.0.15)(expo-widgets@57.0.11)(react-dom@19.2.6(react@19.2.3))(react-native-worklets@0.10.1(@babel/core@7.29.7)(react-native@0.86.2(@types/react@19.2.14)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3))(react-native@0.86.2(@types/react@19.2.14)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3)(typescript@6.0.3)(utf-8-validate@6.0.6)
diff --git a/scripts/typecheck-all.sh b/scripts/typecheck-all.sh
index 412881e6a7..8110bc56a6 100755
--- a/scripts/typecheck-all.sh
+++ b/scripts/typecheck-all.sh
@@ -42,6 +42,19 @@ else
pnpm --filter @kilocode/trpc run build
fi
+# 1b. Build the harness SDK, which apps/mobile typechecks against (same rule as trpc)
+if $changes_only; then
+ harness_changed=$(git diff --name-only "$base" -- 'packages/harness-sdk/src/**' 'packages/harness-sdk/tsconfig.json' 'packages/harness-sdk/package.json' | head -1 || true)
+ if [ -n "$harness_changed" ]; then
+ echo "[typecheck] harness-sdk source changed, rebuilding"
+ pnpm --filter @kilocode/harness-sdk run build
+ else
+ echo "[typecheck] harness-sdk source unchanged, skipping build"
+ fi
+else
+ pnpm --filter @kilocode/harness-sdk run build
+fi
+
# 2. Root typechecks (always — they are fast with incremental tsgo)
tsgo --noEmit -p apps/web/tsconfig.json
tsgo --noEmit -p scripts/web-env/tsconfig.json
@@ -59,6 +72,7 @@ fi
if git diff --name-only "$base" -- pnpm-workspace.yaml | grep -q .; then
echo "[typecheck] pnpm-workspace.yaml changed, rebuilding trpc and running full workspace typecheck"
pnpm --filter @kilocode/trpc run build
+ pnpm --filter @kilocode/harness-sdk run build
pnpm -r "${workspace_typecheck_filters[@]}" run typecheck
exit 0
fi