import { __exportAll } from "../../_virtual/rolldown_runtime.js";
import { account, deviceCode, invitation, jwks, member, oauthAccessToken, oauthClient, oauthConsent, oauthRefreshToken, organization, session, ssoProvider, user, verification } from "../../auth/auth-schema.js";
import { USAGE_GENERATION_TYPES } from "../../constants/otel-attributes.js";
import { relations, sql } from "drizzle-orm";
import { boolean, check, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, unique, uniqueIndex, varchar } from "drizzle-orm/pg-core";

//#region src/db/runtime/runtime-schema.ts
var runtime_schema_exports = /* @__PURE__ */ __exportAll({
	USAGE_GENERATION_TYPES: () => USAGE_GENERATION_TYPES,
	account: () => account,
	apiKeys: () => apiKeys,
	apps: () => apps,
	coPilotRuns: () => coPilotRuns,
	contextCache: () => contextCache,
	conversations: () => conversations,
	conversationsRelations: () => conversationsRelations,
	datasetRun: () => datasetRun,
	datasetRunConversationRelations: () => datasetRunConversationRelations,
	deviceCode: () => deviceCode,
	evaluationResult: () => evaluationResult,
	evaluationRun: () => evaluationRun,
	events: () => events,
	feedback: () => feedback,
	feedbackRelations: () => feedbackRelations,
	invitation: () => invitation,
	invitationProjectAssignment: () => invitationProjectAssignment,
	jwks: () => jwks,
	ledgerArtifacts: () => ledgerArtifacts,
	ledgerArtifactsRelations: () => ledgerArtifactsRelations,
	member: () => member,
	messages: () => messages,
	messagesRelations: () => messagesRelations,
	oauthAccessToken: () => oauthAccessToken,
	oauthClient: () => oauthClient,
	oauthConsent: () => oauthConsent,
	oauthRefreshToken: () => oauthRefreshToken,
	orgEntitlement: () => orgEntitlement,
	organization: () => organization,
	projectMetadata: () => projectMetadata,
	scheduledTriggerInvocations: () => scheduledTriggerInvocations,
	scheduledTriggerUsers: () => scheduledTriggerUsers,
	scheduledTriggers: () => scheduledTriggers,
	schedulerState: () => schedulerState,
	session: () => session,
	ssoProvider: () => ssoProvider,
	streamChunks: () => streamChunks,
	taskRelations: () => taskRelations,
	taskRelationsRelations: () => taskRelationsRelations,
	tasks: () => tasks,
	tasksRelations: () => tasksRelations,
	toolApprovalDecisions: () => toolApprovalDecisions,
	triggerInvocations: () => triggerInvocations,
	user: () => user,
	userProfile: () => userProfile,
	userProfileRelations: () => userProfileRelations,
	verification: () => verification,
	workAppGitHubInstallations: () => workAppGitHubInstallations,
	workAppGitHubInstallationsRelations: () => workAppGitHubInstallationsRelations,
	workAppGitHubMcpToolAccessMode: () => workAppGitHubMcpToolAccessMode,
	workAppGitHubMcpToolRepositoryAccess: () => workAppGitHubMcpToolRepositoryAccess,
	workAppGitHubMcpToolRepositoryAccessRelations: () => workAppGitHubMcpToolRepositoryAccessRelations,
	workAppGitHubProjectAccessMode: () => workAppGitHubProjectAccessMode,
	workAppGitHubProjectRepositoryAccess: () => workAppGitHubProjectRepositoryAccess,
	workAppGitHubProjectRepositoryAccessRelations: () => workAppGitHubProjectRepositoryAccessRelations,
	workAppGitHubRepositories: () => workAppGitHubRepositories,
	workAppGitHubRepositoriesRelations: () => workAppGitHubRepositoriesRelations,
	workAppSlackChannelAgentConfigs: () => workAppSlackChannelAgentConfigs,
	workAppSlackMcpToolAccessConfig: () => workAppSlackMcpToolAccessConfig,
	workAppSlackUserMappings: () => workAppSlackUserMappings,
	workAppSlackWorkspaces: () => workAppSlackWorkspaces,
	workflowExecutions: () => workflowExecutions
});
const tenantScoped = {
	tenantId: varchar("tenant_id", { length: 256 }).notNull(),
	id: varchar("id", { length: 256 }).notNull()
};
const projectScoped = {
	...tenantScoped,
	projectId: varchar("project_id", { length: 256 }).notNull()
};
const agentScoped = {
	...projectScoped,
	agentId: varchar("agent_id", { length: 256 }).notNull()
};
const subAgentScoped = {
	...agentScoped,
	subAgentId: varchar("sub_agent_id", { length: 256 }).notNull()
};
const timestamps = {
	createdAt: timestamp("created_at", { mode: "string" }).notNull().defaultNow(),
	updatedAt: timestamp("updated_at", { mode: "string" }).notNull().defaultNow()
};
/**
* Runtime projects table - source of truth for which projects exist in a tenant.
* This is NOT versioned - project existence is tracked here while
* project configuration/content lives in the versioned config DB.
*
* Named 'project_metadata' to avoid conflict with the manage-schema 'projects' table.
*/
const projectMetadata = pgTable("project_metadata", {
	id: varchar("id", { length: 256 }).notNull(),
	tenantId: varchar("tenant_id", { length: 256 }).notNull(),
	createdAt: timestamp("created_at", { mode: "string" }).notNull().defaultNow(),
	createdBy: varchar("created_by", { length: 256 }),
	mainBranchName: varchar("main_branch_name", { length: 512 }).notNull()
}, (table) => [
	primaryKey({ columns: [table.tenantId, table.id] }),
	index("project_metadata_tenant_idx").on(table.tenantId),
	index("project_metadata_main_branch_idx").on(table.mainBranchName),
	foreignKey({
		columns: [table.tenantId],
		foreignColumns: [organization.id],
		name: "project_metadata_organization_fk"
	}).onDelete("cascade")
]);
const conversations = pgTable("conversations", {
	...projectScoped,
	userId: varchar("user_id", { length: 256 }),
	agentId: varchar("agent_id", { length: 256 }),
	activeSubAgentId: varchar("active_sub_agent_id", { length: 256 }).notNull(),
	ref: jsonb("ref").$type(),
	title: text("title"),
	lastContextResolution: timestamp("last_context_resolution", { mode: "string" }),
	metadata: jsonb("metadata").$type(),
	userProperties: jsonb("user_properties").$type(),
	properties: jsonb("properties").$type(),
	...timestamps
}, (table) => [primaryKey({ columns: [
	table.tenantId,
	table.projectId,
	table.id
] })]);
const tasks = pgTable("tasks", {
	...subAgentScoped,
	contextId: varchar("context_id", { length: 256 }).notNull(),
	ref: jsonb("ref").$type(),
	status: varchar("status", { length: 256 }).notNull(),
	metadata: jsonb("metadata").$type(),
	...timestamps
}, (table) => [primaryKey({ columns: [
	table.tenantId,
	table.projectId,
	table.id
] })]);
const workflowExecutions = pgTable("workflow_executions", {
	...projectScoped,
	agentId: varchar("agent_id", { length: 256 }).notNull(),
	conversationId: varchar("conversation_id", { length: 256 }).notNull(),
	requestId: varchar("request_id", { length: 256 }),
	status: varchar("status", { length: 50 }).notNull().default("running"),
	metadata: jsonb("metadata").$type(),
	...timestamps
}, (table) => [primaryKey({ columns: [
	table.tenantId,
	table.projectId,
	table.id
] }), index("workflow_executions_conversation_idx").on(table.tenantId, table.projectId, table.conversationId)]);
const streamChunks = pgTable("stream_chunks", {
	tenantId: varchar("tenant_id", { length: 256 }).notNull(),
	projectId: varchar("project_id", { length: 256 }).notNull(),
	conversationId: varchar("conversation_id", { length: 256 }).notNull(),
	idx: integer("idx").notNull(),
	data: text("data").notNull(),
	isFinal: boolean("is_final").notNull().default(false),
	createdAt: timestamp("created_at", { mode: "string" }).notNull().defaultNow()
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.conversationId,
		table.idx
	] }),
	index("stream_chunks_cleanup_idx").on(table.createdAt),
	index("stream_chunks_conversation_idx").on(table.tenantId, table.projectId, table.conversationId, table.idx)
]);
/**
* Pending tool-approval decisions for the classic (non-durable) execution path.
*
* Classic execution keeps the pending approval in the memory of the single
* server instance running the agent. When the user's approval request is
* load-balanced to a *different* instance, that instance has no in-memory entry
* and the approval is otherwise lost (the agent waits out its timeout). To make
* delivery cross-instance, the receiving instance records the decision here and
* the instance awaiting the approval polls and consumes it.
*
* Rows are short-lived: consumed on pickup, or swept by a periodic cleanup job
* (see cleanupExpiredToolApprovalDecisions). A residual row means the waiting
* instance went away before consuming it. Mirrors the stream_chunks pattern.
*/
const toolApprovalDecisions = pgTable("tool_approval_decisions", {
	tenantId: varchar("tenant_id", { length: 256 }).notNull(),
	projectId: varchar("project_id", { length: 256 }).notNull(),
	conversationId: varchar("conversation_id", { length: 256 }).notNull(),
	toolCallId: varchar("tool_call_id", { length: 256 }).notNull(),
	approved: boolean("approved").notNull(),
	reason: text("reason"),
	createdAt: timestamp("created_at", { mode: "string" }).notNull().defaultNow()
}, (table) => [primaryKey({ columns: [
	table.tenantId,
	table.projectId,
	table.conversationId,
	table.toolCallId
] }), index("tool_approval_decisions_cleanup_idx").on(table.createdAt)]);
const apiKeys = pgTable("api_keys", {
	...projectScoped,
	agentId: varchar("agent_id", { length: 256 }).notNull(),
	publicId: varchar("public_id", { length: 256 }).notNull().unique(),
	keyHash: varchar("key_hash", { length: 256 }).notNull(),
	keyPrefix: varchar("key_prefix", { length: 256 }).notNull(),
	name: varchar("name", { length: 256 }),
	lastUsedAt: timestamp("last_used_at", { mode: "string" }),
	expiresAt: timestamp("expires_at", { mode: "string" }),
	...timestamps
}, (t) => [
	foreignKey({
		columns: [t.tenantId],
		foreignColumns: [organization.id],
		name: "api_keys_organization_fk"
	}).onDelete("cascade"),
	index("api_keys_tenant_agent_idx").on(t.tenantId, t.agentId),
	index("api_keys_prefix_idx").on(t.keyPrefix),
	index("api_keys_public_id_idx").on(t.publicId)
]);
const apps = pgTable("apps", {
	id: varchar("id", { length: 256 }).primaryKey(),
	tenantId: varchar("tenant_id", { length: 256 }),
	projectId: varchar("project_id", { length: 256 }),
	name: varchar("name", { length: 256 }).notNull(),
	description: text("description"),
	type: varchar("type", { length: 64 }).$type().notNull(),
	defaultProjectId: varchar("default_project_id", { length: 256 }),
	defaultAgentId: varchar("default_agent_id", { length: 256 }),
	prompt: text("prompt"),
	enabled: boolean("enabled").notNull().default(true),
	config: jsonb("config").$type().notNull(),
	lastUsedAt: timestamp("last_used_at", { mode: "string" }),
	...timestamps
}, (t) => [index("apps_tenant_project_idx").on(t.tenantId, t.projectId)]);
/**
* Trigger invocations - records each time a webhook trigger is invoked.
* This is runtime data (transactional) so it lives in PostgreSQL, not DoltGres.
* NOTE: No FK to triggers table since triggers is in a different database (DoltGres).
* Application code must enforce referential integrity for triggerId.
* Can optionally link to conversations when the trigger creates one.
*/
const triggerInvocations = pgTable("trigger_invocations", {
	...agentScoped,
	triggerId: varchar("trigger_id", { length: 256 }).notNull(),
	conversationId: varchar("conversation_id", { length: 256 }),
	runAsUserId: varchar("run_as_user_id", { length: 256 }),
	batchId: varchar("batch_id", { length: 256 }),
	ref: jsonb("ref").$type(),
	status: varchar("status", { length: 20 }).notNull().default("pending"),
	requestPayload: jsonb("request_payload").notNull(),
	transformedPayload: jsonb("transformed_payload"),
	errorMessage: text("error_message"),
	createdAt: timestamp("created_at", { mode: "string" }).notNull().defaultNow()
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.agentId,
		table.id
	] }),
	index("trigger_invocations_trigger_idx").on(table.triggerId, table.createdAt),
	index("trigger_invocations_status_idx").on(table.triggerId, table.status),
	index("trigger_invocations_batch_idx").on(table.triggerId, table.batchId)
]);
/**
* Slack workspace installations - records each Slack workspace installation.
* Enforces workspace -> tenant uniqueness and provides audit trail.
* Stores reference to Nango connection for token retrieval.
*/
const workAppSlackWorkspaces = pgTable("work_app_slack_workspaces", {
	id: varchar("id", { length: 256 }).primaryKey(),
	tenantId: varchar("tenant_id", { length: 256 }).notNull().references(() => organization.id, { onDelete: "cascade" }),
	slackTeamId: varchar("slack_team_id", { length: 256 }).notNull(),
	slackEnterpriseId: varchar("slack_enterprise_id", { length: 256 }),
	slackAppId: varchar("slack_app_id", { length: 256 }),
	slackTeamName: varchar("slack_team_name", { length: 512 }),
	nangoProviderConfigKey: varchar("nango_provider_config_key", { length: 256 }).notNull().default("work-apps-slack"),
	nangoConnectionId: varchar("nango_connection_id", { length: 256 }).notNull(),
	status: varchar("status", { length: 20 }).notNull().default("active"),
	installedByUserId: text("installed_by_user_id").references(() => user.id, { onDelete: "set null" }),
	shouldAllowJoinFromWorkspace: boolean("should_allow_join_from_workspace").notNull().default(false),
	defaultAgentId: varchar("default_agent_id", { length: 256 }),
	defaultProjectId: varchar("default_project_id", { length: 256 }),
	defaultGrantAccessToMembers: boolean("default_grant_access_to_members").default(true),
	...timestamps
}, (table) => [
	unique("work_app_slack_workspaces_tenant_team_unique").on(table.tenantId, table.slackTeamId),
	unique("work_app_slack_workspaces_nango_connection_unique").on(table.nangoConnectionId),
	index("work_app_slack_workspaces_tenant_idx").on(table.tenantId),
	index("work_app_slack_workspaces_team_idx").on(table.slackTeamId),
	index("work_app_slack_workspaces_defaults_idx").on(table.tenantId, table.defaultProjectId, table.defaultAgentId)
]);
/**
* Slack user mappings - maps Slack users to Inkeep users.
* Enables Slack users to trigger agents after linking their accounts.
* Unique per tenant + clientId + slackTeamId + slackUserId.
*/
const workAppSlackUserMappings = pgTable("work_app_slack_user_mappings", {
	id: varchar("id", { length: 256 }).primaryKey(),
	tenantId: varchar("tenant_id", { length: 256 }).notNull().references(() => organization.id, { onDelete: "cascade" }),
	clientId: varchar("client_id", { length: 256 }).notNull().default("work-apps-slack"),
	slackUserId: varchar("slack_user_id", { length: 256 }).notNull(),
	slackTeamId: varchar("slack_team_id", { length: 256 }).notNull(),
	slackEnterpriseId: varchar("slack_enterprise_id", { length: 256 }),
	inkeepUserId: text("inkeep_user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
	slackUsername: varchar("slack_username", { length: 256 }),
	slackEmail: varchar("slack_email", { length: 256 }),
	linkedAt: timestamp("linked_at", { mode: "string" }).notNull().defaultNow(),
	lastUsedAt: timestamp("last_used_at", { mode: "string" }),
	...timestamps
}, (table) => [
	unique("work_app_slack_user_mappings_unique").on(table.tenantId, table.clientId, table.slackTeamId, table.slackUserId),
	index("work_app_slack_user_mappings_tenant_idx").on(table.tenantId),
	index("work_app_slack_user_mappings_user_idx").on(table.inkeepUserId),
	index("work_app_slack_user_mappings_team_idx").on(table.slackTeamId),
	index("work_app_slack_user_mappings_slack_user_idx").on(table.slackUserId),
	index("work_app_slack_user_mappings_tenant_team_idx").on(table.tenantId, table.slackTeamId),
	index("work_app_slack_user_mappings_lookup_idx").on(table.clientId, table.slackTeamId, table.slackUserId)
]);
/**
* Slack channel agent configurations - maps Slack channels to default agents.
* Allows admins to set channel-specific agent defaults that override workspace defaults.
* Unique per tenant + slackTeamId + slackChannelId.
*/
const workAppSlackChannelAgentConfigs = pgTable("work_app_slack_channel_agent_configs", {
	id: varchar("id", { length: 256 }).primaryKey(),
	tenantId: varchar("tenant_id", { length: 256 }).notNull().references(() => organization.id, { onDelete: "cascade" }),
	slackTeamId: varchar("slack_team_id", { length: 256 }).notNull(),
	slackChannelId: varchar("slack_channel_id", { length: 256 }).notNull(),
	slackChannelName: varchar("slack_channel_name", { length: 256 }),
	slackChannelType: varchar("slack_channel_type", { length: 50 }),
	projectId: varchar("project_id", { length: 256 }).notNull(),
	agentId: varchar("agent_id", { length: 256 }).notNull(),
	configuredByUserId: text("configured_by_user_id").references(() => user.id, { onDelete: "set null" }),
	enabled: boolean("enabled").notNull().default(true),
	grantAccessToMembers: boolean("grant_access_to_members").notNull().default(true),
	...timestamps
}, (table) => [
	unique("work_app_slack_channel_agent_configs_unique").on(table.tenantId, table.slackTeamId, table.slackChannelId),
	index("work_app_slack_channel_agent_configs_tenant_idx").on(table.tenantId),
	index("work_app_slack_channel_agent_configs_team_idx").on(table.slackTeamId),
	index("work_app_slack_channel_agent_configs_channel_idx").on(table.slackChannelId),
	index("work_app_slack_channel_agent_configs_tenant_team_idx").on(table.tenantId, table.slackTeamId),
	index("work_app_slack_channel_agent_configs_agent_idx").on(table.tenantId, table.projectId, table.agentId),
	index("work_app_slack_channel_agent_configs_project_idx").on(table.tenantId, table.projectId)
]);
const scheduledTriggers = pgTable("scheduled_triggers", {
	...projectScoped,
	agentId: varchar("agent_id", { length: 256 }),
	name: varchar("name", { length: 256 }).notNull(),
	description: text("description"),
	enabled: boolean("enabled").notNull().default(true),
	cronExpression: varchar("cron_expression", { length: 256 }),
	cronTimezone: varchar("cron_timezone", { length: 64 }).default("UTC"),
	runAt: timestamp("run_at", {
		withTimezone: true,
		mode: "string"
	}),
	payload: jsonb("payload").$type(),
	messageTemplate: text("message_template"),
	maxRetries: integer("max_retries").notNull().default(1),
	retryDelaySeconds: integer("retry_delay_seconds").notNull().default(60),
	timeoutSeconds: integer("timeout_seconds").notNull().default(780),
	runAsUserId: varchar("run_as_user_id", { length: 256 }).references(() => user.id, { onDelete: "cascade" }),
	createdBy: varchar("created_by", { length: 256 }),
	nextRunAt: timestamp("next_run_at", {
		withTimezone: true,
		mode: "string"
	}),
	ref: varchar("ref", { length: 256 }).notNull().default("main"),
	dispatchDelayMs: integer("dispatch_delay_ms"),
	datasetRunConfigId: varchar("dataset_run_config_id", { length: 256 }),
	...timestamps
}, (table) => [
	primaryKey({ columns: [table.tenantId, table.id] }),
	index("scheduled_triggers_agent_idx").on(table.tenantId, table.projectId, table.agentId),
	index("scheduled_triggers_ref_idx").on(table.ref),
	index("scheduled_triggers_next_run_at_idx").on(table.enabled, table.nextRunAt)
]);
const scheduledTriggerInvocations = pgTable("scheduled_trigger_invocations", {
	...agentScoped,
	scheduledTriggerId: varchar("scheduled_trigger_id", { length: 256 }).notNull(),
	ref: jsonb("ref").$type(),
	status: varchar("status", { length: 50 }).notNull().$type(),
	scheduledFor: timestamp("scheduled_for", {
		withTimezone: true,
		mode: "string"
	}).notNull(),
	startedAt: timestamp("started_at", {
		withTimezone: true,
		mode: "string"
	}),
	completedAt: timestamp("completed_at", {
		withTimezone: true,
		mode: "string"
	}),
	resolvedPayload: jsonb("resolved_payload").$type(),
	conversationIds: jsonb("conversation_ids").$type().default([]),
	attemptNumber: integer("attempt_number").notNull().default(1),
	idempotencyKey: varchar("idempotency_key", { length: 256 }).notNull(),
	runAsUserId: varchar("run_as_user_id", { length: 256 }),
	createdAt: timestamp("created_at", {
		withTimezone: true,
		mode: "string"
	}).notNull().defaultNow()
}, (table) => [
	primaryKey({ columns: [table.tenantId, table.id] }),
	uniqueIndex("sched_invocations_idempotency_idx").on(table.idempotencyKey),
	index("sched_invocations_trigger_scheduled_for_idx").on(table.tenantId, table.projectId, table.agentId, table.scheduledTriggerId, table.scheduledFor),
	index("sched_invocations_trigger_user_scheduled_for_idx").on(table.tenantId, table.projectId, table.agentId, table.scheduledTriggerId, table.runAsUserId, table.scheduledFor),
	index("sched_invocations_status_scheduled_for_idx").on(table.tenantId, table.projectId, table.agentId, table.status, table.scheduledFor)
]);
const scheduledTriggerUsers = pgTable("scheduled_trigger_users", {
	tenantId: varchar("tenant_id", { length: 256 }).notNull(),
	scheduledTriggerId: varchar("scheduled_trigger_id", { length: 256 }).notNull(),
	userId: varchar("user_id", { length: 256 }).notNull().references(() => user.id, { onDelete: "cascade" }),
	createdAt: timestamp("created_at", {
		withTimezone: true,
		mode: "string"
	}).notNull().defaultNow()
}, (table) => [
	primaryKey({
		columns: [
			table.tenantId,
			table.scheduledTriggerId,
			table.userId
		],
		name: "sched_trigger_users_pk"
	}),
	foreignKey({
		columns: [table.tenantId, table.scheduledTriggerId],
		foreignColumns: [scheduledTriggers.tenantId, scheduledTriggers.id],
		name: "sched_trigger_users_trigger_fk"
	}).onDelete("cascade"),
	index("sched_trigger_users_user_idx").on(table.userId),
	index("sched_trigger_users_trigger_idx").on(table.tenantId, table.scheduledTriggerId)
]);
const schedulerState = pgTable("scheduler_state", {
	id: varchar("id", { length: 256 }).primaryKey(),
	currentRunId: varchar("current_run_id", { length: 256 }),
	...timestamps
});
const messages = pgTable("messages", {
	...projectScoped,
	conversationId: varchar("conversation_id", { length: 256 }).notNull(),
	role: varchar("role", { length: 256 }).notNull(),
	fromSubAgentId: varchar("from_sub_agent_id", { length: 256 }),
	toSubAgentId: varchar("to_sub_agent_id", { length: 256 }),
	fromExternalAgentId: varchar("from_external_sub_agent_id", { length: 256 }),
	toExternalAgentId: varchar("to_external_sub_agent_id", { length: 256 }),
	fromTeamAgentId: varchar("from_team_agent_id", { length: 256 }),
	toTeamAgentId: varchar("to_team_agent_id", { length: 256 }),
	content: jsonb("content").$type().notNull(),
	visibility: varchar("visibility", { length: 256 }).notNull().default("user-facing"),
	messageType: varchar("message_type", { length: 256 }).notNull().default("chat"),
	taskId: varchar("task_id", { length: 256 }),
	parentMessageId: varchar("parent_message_id", { length: 256 }),
	a2aTaskId: varchar("a2a_task_id", { length: 256 }),
	a2aSessionId: varchar("a2a_session_id", { length: 256 }),
	metadata: jsonb("metadata").$type(),
	userProperties: jsonb("user_properties").$type(),
	properties: jsonb("properties").$type(),
	...timestamps
}, (table) => [primaryKey({ columns: [
	table.tenantId,
	table.projectId,
	table.id
] }), foreignKey({
	columns: [
		table.tenantId,
		table.projectId,
		table.conversationId
	],
	foreignColumns: [
		conversations.tenantId,
		conversations.projectId,
		conversations.id
	],
	name: "messages_conversation_fk"
}).onDelete("cascade")]);
const feedback = pgTable("feedback", {
	...projectScoped,
	conversationId: varchar("conversation_id", { length: 256 }).notNull(),
	messageId: varchar("message_id", { length: 256 }),
	type: varchar("type", { length: 20 }).$type().notNull(),
	details: text("details"),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.id
	] }),
	index("feedback_conversation_id_idx").on(table.tenantId, table.projectId, table.conversationId),
	index("feedback_message_id_idx").on(table.tenantId, table.projectId, table.messageId),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.conversationId
		],
		foreignColumns: [
			conversations.tenantId,
			conversations.projectId,
			conversations.id
		],
		name: "feedback_conversation_fk"
	}).onDelete("cascade"),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.messageId
		],
		foreignColumns: [
			messages.tenantId,
			messages.projectId,
			messages.id
		],
		name: "feedback_message_fk"
	}).onDelete("cascade")
]);
const events = pgTable("events", {
	...projectScoped,
	type: varchar("type", { length: 256 }).notNull(),
	agentId: varchar("agent_id", { length: 256 }),
	conversationId: varchar("conversation_id", { length: 256 }),
	messageId: varchar("message_id", { length: 256 }),
	properties: jsonb("properties").$type(),
	userProperties: jsonb("user_properties").$type(),
	metadata: jsonb("metadata").$type(),
	serverMetadata: jsonb("server_metadata").$type(),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.id
	] }),
	index("events_created_at_idx").on(table.tenantId, table.projectId, table.createdAt.desc()),
	index("events_conversation_id_idx").on(table.tenantId, table.projectId, table.conversationId, table.createdAt.desc())
]);
const coPilotRuns = pgTable("copilot_runs", {
	...projectScoped,
	ref: jsonb("ref").$type(),
	conversationId: varchar("conversation_id", { length: 256 }).notNull(),
	feedbackIds: jsonb("feedback_ids").$type(),
	status: varchar("status", { length: 50 }).$type().notNull(),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.id
	] }),
	index("copilot_runs_status_idx").on(table.tenantId, table.projectId, table.status),
	uniqueIndex("copilot_runs_conversation_id_idx").on(table.conversationId)
]);
const taskRelations = pgTable("task_relations", {
	...projectScoped,
	parentTaskId: varchar("parent_task_id", { length: 256 }).notNull(),
	childTaskId: varchar("child_task_id", { length: 256 }).notNull(),
	relationType: varchar("relation_type", { length: 256 }).default("parent_child"),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.id
	] }),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.parentTaskId
		],
		foreignColumns: [
			tasks.tenantId,
			tasks.projectId,
			tasks.id
		],
		name: "task_relations_parent_fk"
	}).onDelete("cascade"),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.childTaskId
		],
		foreignColumns: [
			tasks.tenantId,
			tasks.projectId,
			tasks.id
		],
		name: "task_relations_child_fk"
	}).onDelete("cascade")
]);
const ledgerArtifacts = pgTable("ledger_artifacts", {
	...projectScoped,
	taskId: varchar("task_id", { length: 256 }).notNull(),
	toolCallId: varchar("tool_call_id", { length: 256 }),
	contextId: varchar("context_id", { length: 256 }).notNull(),
	type: varchar("type", { length: 256 }).notNull().default("source"),
	name: varchar("name", { length: 256 }),
	description: text("description"),
	parts: jsonb("parts").$type(),
	metadata: jsonb("metadata").$type(),
	summary: text("summary"),
	mime: jsonb("mime").$type(),
	visibility: varchar("visibility", { length: 256 }).default("context"),
	allowedAgents: jsonb("allowed_agents").$type(),
	derivedFrom: varchar("derived_from", { length: 256 }),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.id,
		table.taskId
	] }),
	index("ledger_artifacts_task_id_idx").on(table.taskId),
	index("ledger_artifacts_tool_call_id_idx").on(table.toolCallId),
	index("ledger_artifacts_context_id_idx").on(table.contextId),
	unique("ledger_artifacts_task_context_name_unique").on(table.taskId, table.contextId, table.name),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.contextId
		],
		foreignColumns: [
			conversations.tenantId,
			conversations.projectId,
			conversations.id
		],
		name: "ledger_artifacts_conversation_fk"
	}).onDelete("cascade")
]);
const contextCache = pgTable("context_cache", {
	...projectScoped,
	conversationId: varchar("conversation_id", { length: 256 }).notNull(),
	contextConfigId: varchar("context_config_id", { length: 256 }).notNull(),
	contextVariableKey: varchar("context_variable_key", { length: 256 }).notNull(),
	ref: jsonb("ref").$type(),
	value: jsonb("value").$type().notNull(),
	requestHash: varchar("request_hash", { length: 256 }),
	fetchedAt: timestamp("fetched_at", { mode: "string" }).notNull().defaultNow(),
	fetchSource: varchar("fetch_source", { length: 256 }),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.id
	] }),
	index("context_cache_lookup_idx").on(table.conversationId, table.contextConfigId, table.contextVariableKey),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.conversationId
		],
		foreignColumns: [
			conversations.tenantId,
			conversations.projectId,
			conversations.id
		],
		name: "context_cache_conversation_fk"
	}).onDelete("cascade")
]);
/**
* Execution of a suite of items from a dataset. Represents a batch run that
* processes dataset items and creates conversations (basically a batch run of conversations). Tracks the execution
* status and links to conversations created during the run via
* datasetRunConversationRelations join table.
*
* When evaluators are specified, an evaluation job is automatically created after the run completes,
* and the evaluationJobConfigId links to that job.
*
* Includes: datasetId (which dataset to run),
* datasetRunConfigId (optional: if created from a config),
* evaluationJobConfigId (optional: links to evaluation job created for this run), and timestamps
*/
const datasetRun = pgTable("dataset_run", {
	...projectScoped,
	datasetId: text("dataset_id").notNull(),
	datasetRunConfigId: text("dataset_run_config_id"),
	evaluationJobConfigId: text("evaluation_job_config_id"),
	ref: jsonb("ref").$type(),
	...timestamps
}, (table) => [primaryKey({ columns: [
	table.tenantId,
	table.projectId,
	table.id
] })]);
/**
* Links conversations created during a dataset run execution. One-to-many
* relationship where one datasetRun can create many conversations, but each
* conversation belongs to exactly one datasetRun. Used to track which
* conversations were generated from which dataset run.
*
* Includes: datasetRunId (composite FK to datasetRun), conversationId (composite FK to conversations),
* datasetItemId (composite FK to datasetItem) to directly link conversations to their source dataset items,
* unique constraint on (datasetRunId, conversationId) ensures one conversation per datasetRun,
* and timestamps
*/
const datasetRunConversationRelations = pgTable("dataset_run_conversation_relations", {
	...projectScoped,
	datasetRunId: text("dataset_run_id").notNull(),
	conversationId: text("conversation_id").notNull(),
	datasetItemId: text("dataset_item_id").notNull(),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.id
	] }),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.datasetRunId
		],
		foreignColumns: [
			datasetRun.tenantId,
			datasetRun.projectId,
			datasetRun.id
		],
		name: "dataset_run_conversation_relations_run_fk"
	}).onDelete("cascade"),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.conversationId
		],
		foreignColumns: [
			conversations.tenantId,
			conversations.projectId,
			conversations.id
		],
		name: "dataset_run_conversation_relations_conversation_fk"
	}).onDelete("cascade"),
	unique("dataset_run_conversation_relations_unique").on(table.datasetRunId, table.conversationId)
]);
/**
* Record created when an evaluation job config or evaluation run config is triggered.
* Represents a completed evaluation run. Links to the evaluationJobConfig (if created from a job)
* or evaluationRunConfig (if created from a run config).
* Results are stored in evaluationResult table.
* one to many relationship with evaluationResult
*
* Includes: evaluationJobConfigId (optional: if created from a job),
* evaluationRunConfigId (optional: if created from a run config),
* and timestamps
*/
const evaluationRun = pgTable("evaluation_run", {
	...projectScoped,
	evaluationJobConfigId: text("evaluation_job_config_id"),
	evaluationRunConfigId: text("evaluation_run_config_id"),
	ref: jsonb("ref").$type(),
	...timestamps
}, (table) => [primaryKey({ columns: [
	table.tenantId,
	table.projectId,
	table.id
] })]);
/**
* Stores the result of evaluating a conversation with a specific evaluator.
* Contains the evaluation output. Linked to an evaluation run.
* Each result represents one evaluator's assessment of one conversation.
*
* Includes: conversationId (required), evaluatorId (required),
* evaluationRunId (optional, links to evaluationRun),
* output (evaluation result as MessageContent), and timestamps
*/
const evaluationResult = pgTable("evaluation_result", {
	...projectScoped,
	conversationId: text("conversation_id").notNull(),
	evaluatorId: text("evaluator_id").notNull(),
	evaluationRunId: text("evaluation_run_id"),
	output: jsonb("output").$type(),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.id
	] }),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.conversationId
		],
		foreignColumns: [
			conversations.tenantId,
			conversations.projectId,
			conversations.id
		],
		name: "evaluation_result_conversation_fk"
	}).onDelete("cascade"),
	foreignKey({
		columns: [
			table.tenantId,
			table.projectId,
			table.evaluationRunId
		],
		foreignColumns: [
			evaluationRun.tenantId,
			evaluationRun.projectId,
			evaluationRun.id
		],
		name: "evaluation_result_evaluation_run_fk"
	}).onDelete("cascade")
]);
const userProfile = pgTable("user_profile", {
	id: text("id").primaryKey(),
	userId: text("user_id").notNull().unique().references(() => user.id, { onDelete: "cascade" }),
	timezone: text("timezone"),
	attributes: jsonb("attributes").$type().default({}),
	...timestamps
});
const userProfileRelations = relations(userProfile, ({ one }) => ({ user: one(user, {
	fields: [userProfile.userId],
	references: [user.id]
}) }));
const conversationsRelations = relations(conversations, ({ many }) => ({ messages: many(messages) }));
const messagesRelations = relations(messages, ({ one, many }) => ({
	conversation: one(conversations, {
		fields: [messages.conversationId],
		references: [conversations.id]
	}),
	task: one(tasks, {
		fields: [messages.taskId],
		references: [tasks.id]
	}),
	parentMessage: one(messages, {
		fields: [messages.parentMessageId],
		references: [messages.id],
		relationName: "parentChild"
	}),
	childMessages: many(messages, { relationName: "parentChild" }),
	feedback: many(feedback)
}));
const feedbackRelations = relations(feedback, ({ one }) => ({
	conversation: one(conversations, {
		fields: [
			feedback.tenantId,
			feedback.projectId,
			feedback.conversationId
		],
		references: [
			conversations.tenantId,
			conversations.projectId,
			conversations.id
		]
	}),
	message: one(messages, {
		fields: [
			feedback.tenantId,
			feedback.projectId,
			feedback.messageId
		],
		references: [
			messages.tenantId,
			messages.projectId,
			messages.id
		]
	})
}));
const tasksRelations = relations(tasks, ({ many }) => ({
	messages: many(messages),
	ledgerArtifacts: many(ledgerArtifacts),
	parentRelations: many(taskRelations, { relationName: "childTask" }),
	childRelations: many(taskRelations, { relationName: "parentTask" })
}));
const taskRelationsRelations = relations(taskRelations, ({ one }) => ({
	parentTask: one(tasks, {
		fields: [taskRelations.parentTaskId],
		references: [tasks.id],
		relationName: "parentTask"
	}),
	childTask: one(tasks, {
		fields: [taskRelations.childTaskId],
		references: [tasks.id],
		relationName: "childTask"
	})
}));
const ledgerArtifactsRelations = relations(ledgerArtifacts, ({ one }) => ({ task: one(tasks, {
	fields: [ledgerArtifacts.taskId],
	references: [tasks.id]
}) }));
/**
* Tracks GitHub App installations linked to tenants.
* One tenant can have multiple installations (e.g., multiple orgs).
* The installation_id is the GitHub-assigned ID, unique across all GitHub.
*/
const workAppGitHubInstallations = pgTable("work_app_github_installations", {
	...tenantScoped,
	installationId: text("installation_id").notNull().unique(),
	accountLogin: varchar("account_login", { length: 256 }).notNull(),
	accountId: text("account_id").notNull(),
	accountType: varchar("account_type", { length: 20 }).$type().notNull(),
	status: varchar("status", { length: 20 }).$type().notNull().default("active"),
	...timestamps
}, (table) => [
	index("work_app_github_installations_tenant_idx").on(table.tenantId),
	index("work_app_github_installations_installation_id_idx").on(table.installationId),
	foreignKey({
		columns: [table.tenantId],
		foreignColumns: [organization.id],
		name: "work_app_github_installations_organization_fk"
	}).onDelete("cascade")
]);
/**
* Repositories accessible through a GitHub App installation.
* These are synced from GitHub when the app is installed or updated.
* The repository_id is the GitHub-assigned ID, unique across all GitHub.
*/
const workAppGitHubRepositories = pgTable("work_app_github_repositories", {
	id: varchar("id", { length: 256 }).primaryKey(),
	installationDbId: varchar("installation_db_id", { length: 256 }).notNull(),
	repositoryId: text("repository_id").notNull(),
	repositoryName: varchar("repository_name", { length: 256 }).notNull(),
	repositoryFullName: varchar("repository_full_name", { length: 512 }).notNull(),
	private: boolean("private").notNull().default(false),
	...timestamps
}, (table) => [
	index("work_app_github_repositories_installation_idx").on(table.installationDbId),
	index("work_app_github_repositories_full_name_idx").on(table.repositoryFullName),
	unique("work_app_github_repositories_repo_installation_unique").on(table.installationDbId, table.repositoryId),
	foreignKey({
		columns: [table.installationDbId],
		foreignColumns: [workAppGitHubInstallations.id],
		name: "work_app_github_repositories_installation_fk"
	}).onDelete("cascade")
]);
/**
* Links projects to specific GitHub repositories for fine-grained access control.
* When a project has entries here, only the listed repositories are accessible.
* When no entries exist for a project, all tenant repositories are accessible (mode='all').
* The tenant_id and project_id reference the projects table in the manage schema
* (cross-schema, no FK constraint for project). tenant_id is included because
* project IDs are only unique within a tenant.
*/
const workAppGitHubProjectRepositoryAccess = pgTable("work_app_github_project_repository_access", {
	...projectScoped,
	repositoryDbId: varchar("repository_db_id", { length: 256 }).notNull(),
	...timestamps
}, (table) => [
	index("work_app_github_project_repository_access_tenant_idx").on(table.tenantId),
	index("work_app_github_project_repository_access_project_idx").on(table.projectId),
	unique("work_app_github_project_repository_access_unique").on(table.tenantId, table.projectId, table.repositoryDbId),
	foreignKey({
		columns: [table.tenantId],
		foreignColumns: [organization.id],
		name: "work_app_github_project_repository_access_tenant_fk"
	}).onDelete("cascade"),
	foreignKey({
		columns: [table.repositoryDbId],
		foreignColumns: [workAppGitHubRepositories.id],
		name: "work_app_github_project_repository_access_repo_fk"
	}).onDelete("cascade")
]);
/**
* Links MCP tools to specific GitHub repositories for repository-scoped access.
* When an MCP tool has entries here, only the listed repositories are accessible to that tool.
* The tool_id, tenant_id, and project_id reference the tools table in the manage schema
* (cross-schema, no FK constraint). These are denormalized here so all GitHub access
* info can be queried from PostgreSQL alone.
*/
const workAppGitHubMcpToolRepositoryAccess = pgTable("work_app_github_mcp_tool_repository_access", {
	...projectScoped,
	toolId: varchar("tool_id", { length: 256 }).notNull(),
	repositoryDbId: varchar("repository_db_id", { length: 256 }).notNull(),
	...timestamps
}, (table) => [
	index("work_app_github_mcp_tool_repository_access_tool_idx").on(table.toolId),
	index("work_app_github_mcp_tool_repository_access_tenant_idx").on(table.tenantId),
	index("work_app_github_mcp_tool_repository_access_project_idx").on(table.projectId),
	unique("work_app_github_mcp_tool_repository_access_unique").on(table.toolId, table.repositoryDbId),
	foreignKey({
		columns: [table.tenantId],
		foreignColumns: [organization.id],
		name: "work_app_github_mcp_tool_repository_access_tenant_fk"
	}).onDelete("cascade"),
	foreignKey({
		columns: [table.repositoryDbId],
		foreignColumns: [workAppGitHubRepositories.id],
		name: "work_app_github_mcp_tool_repository_access_repo_fk"
	}).onDelete("cascade")
]);
/**
* Stores the explicit access mode for project-level GitHub repository access.
* - 'all': Project has access to all repositories from tenant GitHub installations
* - 'selected': Project only has access to repositories listed in work_app_github_project_repository_access
* If no row exists for a project, defaults to 'selected' (fail-safe: no access unless explicitly granted).
*/
const workAppGitHubProjectAccessMode = pgTable("work_app_github_project_access_mode", {
	tenantId: varchar("tenant_id", { length: 256 }).notNull(),
	projectId: varchar("project_id", { length: 256 }).notNull(),
	mode: varchar("mode", { length: 20 }).$type().notNull(),
	...timestamps
}, (table) => [primaryKey({ columns: [table.tenantId, table.projectId] }), foreignKey({
	columns: [table.tenantId],
	foreignColumns: [organization.id],
	name: "work_app_github_project_access_mode_tenant_fk"
}).onDelete("cascade")]);
/**
* Stores the explicit access mode for MCP tool-level GitHub repository access.
* - 'all': Tool has access to all repositories the project has access to
* - 'selected': Tool only has access to repositories listed in work_app_github_mcp_tool_repository_access
* If no row exists for a tool, defaults to 'selected' (fail-safe: no access unless explicitly granted).
*/
const workAppGitHubMcpToolAccessMode = pgTable("work_app_github_mcp_tool_access_mode", {
	toolId: varchar("tool_id", { length: 256 }).notNull(),
	tenantId: varchar("tenant_id", { length: 256 }).notNull(),
	projectId: varchar("project_id", { length: 256 }).notNull(),
	mode: varchar("mode", { length: 20 }).$type().notNull(),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.toolId
	] }),
	index("work_app_github_mcp_tool_access_mode_tenant_idx").on(table.tenantId),
	index("work_app_github_mcp_tool_access_mode_project_idx").on(table.projectId),
	foreignKey({
		columns: [table.tenantId],
		foreignColumns: [organization.id],
		name: "work_app_github_mcp_tool_access_mode_tenant_fk"
	}).onDelete("cascade")
]);
const workAppGitHubInstallationsRelations = relations(workAppGitHubInstallations, ({ many }) => ({ repositories: many(workAppGitHubRepositories) }));
const workAppGitHubRepositoriesRelations = relations(workAppGitHubRepositories, ({ one, many }) => ({
	installation: one(workAppGitHubInstallations, {
		fields: [workAppGitHubRepositories.installationDbId],
		references: [workAppGitHubInstallations.id]
	}),
	projectAccess: many(workAppGitHubProjectRepositoryAccess),
	mcpToolAccess: many(workAppGitHubMcpToolRepositoryAccess)
}));
const workAppGitHubProjectRepositoryAccessRelations = relations(workAppGitHubProjectRepositoryAccess, ({ one }) => ({ repository: one(workAppGitHubRepositories, {
	fields: [workAppGitHubProjectRepositoryAccess.repositoryDbId],
	references: [workAppGitHubRepositories.id]
}) }));
const workAppGitHubMcpToolRepositoryAccessRelations = relations(workAppGitHubMcpToolRepositoryAccess, ({ one }) => ({ repository: one(workAppGitHubRepositories, {
	fields: [workAppGitHubMcpToolRepositoryAccess.repositoryDbId],
	references: [workAppGitHubRepositories.id]
}) }));
const workAppSlackMcpToolAccessConfig = pgTable("work_app_slack_mcp_tool_access_config", {
	toolId: varchar("tool_id", { length: 256 }).notNull(),
	tenantId: varchar("tenant_id", { length: 256 }).notNull(),
	projectId: varchar("project_id", { length: 256 }).notNull(),
	channelAccessMode: varchar("channel_access_mode", { length: 20 }).$type().notNull(),
	dmEnabled: boolean("dm_enabled").notNull().default(false),
	channelIds: jsonb("channel_ids").$type().notNull().default([]),
	...timestamps
}, (table) => [
	primaryKey({ columns: [
		table.tenantId,
		table.projectId,
		table.toolId
	] }),
	index("work_app_slack_mcp_tool_access_config_tenant_idx").on(table.tenantId),
	index("work_app_slack_mcp_tool_access_config_project_idx").on(table.projectId),
	foreignKey({
		columns: [table.tenantId],
		foreignColumns: [organization.id],
		name: "work_app_slack_mcp_tool_access_config_tenant_fk"
	}).onDelete("cascade")
]);
const invitationProjectAssignment = pgTable("invitation_project_assignment", {
	id: text("id").primaryKey(),
	invitationId: text("invitation_id").notNull(),
	projectId: text("project_id").notNull(),
	projectRole: text("project_role").notNull().default("project_member"),
	createdAt: timestamp("created_at").notNull().defaultNow()
}, (table) => [index("invitation_project_assignment_invitation_idx").on(table.invitationId), foreignKey({
	columns: [table.invitationId],
	foreignColumns: [invitation.id],
	name: "invitation_project_assignment_invitation_fk"
}).onDelete("cascade")]);
const orgEntitlement = pgTable("org_entitlement", {
	id: varchar("id", { length: 256 }).primaryKey(),
	organizationId: varchar("organization_id", { length: 256 }).notNull(),
	resourceType: text("resource_type").notNull(),
	maxValue: integer("max_value").notNull(),
	...timestamps
}, (table) => [
	unique("org_entitlement_org_resource_unique").on(table.organizationId, table.resourceType),
	index("org_entitlement_org_idx").on(table.organizationId),
	foreignKey({
		columns: [table.organizationId],
		foreignColumns: [organization.id],
		name: "org_entitlement_organization_fk"
	}).onDelete("cascade"),
	check("org_entitlement_resource_type_format", sql`resource_type ~ '^[a-z]+:[a-z][a-z0-9_]*$'`)
]);

//#endregion
export { USAGE_GENERATION_TYPES, account, apiKeys, apps, coPilotRuns, contextCache, conversations, conversationsRelations, datasetRun, datasetRunConversationRelations, deviceCode, evaluationResult, evaluationRun, events, feedback, feedbackRelations, invitation, invitationProjectAssignment, jwks, ledgerArtifacts, ledgerArtifactsRelations, member, messages, messagesRelations, oauthAccessToken, oauthClient, oauthConsent, oauthRefreshToken, orgEntitlement, organization, projectMetadata, runtime_schema_exports, scheduledTriggerInvocations, scheduledTriggerUsers, scheduledTriggers, schedulerState, session, ssoProvider, streamChunks, taskRelations, taskRelationsRelations, tasks, tasksRelations, toolApprovalDecisions, triggerInvocations, user, userProfile, userProfileRelations, verification, workAppGitHubInstallations, workAppGitHubInstallationsRelations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubMcpToolRepositoryAccessRelations, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess, workAppGitHubProjectRepositoryAccessRelations, workAppGitHubRepositories, workAppGitHubRepositoriesRelations, workAppSlackChannelAgentConfigs, workAppSlackMcpToolAccessConfig, workAppSlackUserMappings, workAppSlackWorkspaces, workflowExecutions };