Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat: inspect issue agent runs and show the runner queue (#586)

I'm Groot 🌳e203f539c11a
diff --git a/apps/api/AGENTS.md b/apps/api/AGENTS.md
index ac6b3cf3..c1c1281c 100644
--- a/apps/api/AGENTS.md
+++ b/apps/api/AGENTS.md
@@ -412,6 +412,28 @@ channel and is read only for a claim, not for authentication. Both funnel into
gets — a name missing from a later sync is never removed by this path, only by an explicit
`PATCH /Groups/:id` or an unmapping in the workspace settings.
+## Issue agent runs
+
+`GET /issues/:issueId/agent-runs` reads triggered runs with cursor pagination. Both
+`work_items read` and `ai_agents read` in the issue's current project are required.
+Runs keep their original project, so a moved issue does not expose its former project's
+prompts or traces. `/issues/:issueId/agent-runs/:runId/trace` reads the latest recorded
+attempt of that run, or the one named by `traceId`. Each trace links to the previous recorded
+attempt. A missing latest trace returns null; an unknown or unrelated `traceId` returns 404.
+Both permission checks and the read use the same resolved project id. Other people's chat
+traces stay private.
+External runners reporting run events also retain messages, tool inputs/results and a
+local Codex session link per attempt. `GET /agent-runs/:runId/trace?attempt=N` uses
+both read permissions in the original project and excludes moved issues. It also
+serves scheduled/manual runs without an issue. The latest recorded attempt is the default. The runner queue lists active and past external runs; `runId` narrows it to one authorized run for the detail pane. External transcripts follow the instance trace retention window after the run finishes; pending runs and final results are retained.
+`POST /agent-runs/:runId/events` accepts only the calling agent's current executing,
+unexpired attempt. Event offsets deduplicate retries and reject gaps. Transcripts
+stop recording after 2,000 events or 1 MB; acknowledgements continue so the runner
+can report its final result. A Codex UUID forms the local `codex://threads/` link;
+no supplied URL is accepted. The event-capable runner also sends the attempt number
+on heartbeat and result calls, so a reclaimed attempt rejects the old process.
+Legacy clients may omit this field for compatibility.
+
## Security
- **`GET /attachments/:publicId/raw` is public and unauthenticated** (used in
@@ -479,3 +501,21 @@ directly). Helpers in `src/__tests__/helpers/`: `api` (anonymous client), `authe
- swagger `/docs` (planner) is separate from better-auth's `/api/auth/reference`; both
stay reachable without a session.
- Dev: `bun run dev`. Prod: the Dockerfile migrates, then starts the server; the compose files and the Helm chart run the migrations as a separate step and start only the server.
+
+## Runner queue and execution state
+
+`GET /agent-runs/queue` pages external runs across the caller's readable projects,
+including archived projects. Both `work_items read` and `ai_agents read` are required
+in each project. Moved issues do not expose their original project's prompt.
+
+The stored `status` keeps the runner protocol's `pending` value. `executionState`
+is `running` only after admission succeeds and while its lease is valid; it is
+`queued` during delays, retry backoff and after lease expiry. Terminal states retain
+their names. `execution_started_at` is cleared on claim, defer, retry and completion,
+and set before execution is handed out. A heartbeat can restore the marker for a
+claimed external run that was already in flight when this column was added.
+
+`runnerQueue:1` is a user-scoped sync marker. It combines the visible projects'
+`runner-queue:` revisions with lease expiry and runner presence, so time-based state
+changes are visible without a write. The queue and issue run panel share this scope.
+A runner being online is separate from a run holding an execution lease.
diff --git a/apps/api/src/modules/agents/chat/model.ts b/apps/api/src/modules/agents/chat/model.ts
index 4a6b0f9b..5d7197b9 100644
--- a/apps/api/src/modules/agents/chat/model.ts
+++ b/apps/api/src/modules/agents/chat/model.ts
@@ -1,99 +1,10 @@
import { t } from 'elysia';
-import { contextUsageBody } from '../model';
+import { contextUsageBody, AgUiEvent } from '../model';
export { projectAgentParams } from '../model';
-// A chat with an external agent is carried by AG-UI events (https://docs.ag-ui.com):
-// the runner reports what its coding agent produces as this event stream, and the
-// browser is served the same events. The schemas below are the subset the chat needs,
-// with the field names the protocol defines, so a runner that already speaks AG-UI
-// needs no translation. Lifecycle ids are optional here because the server knows the
-// thread and the answer they belong to; everything else is required as specified.
-
-// The longest text delta accepted in one event. A runner buffers its output rather
-// than sending a request per token, and this bounds how much one event may carry.
-const DELTA_LIMIT = 12_000;
-
-// The longest arguments or result accepted for one tool call. A runner reports each of
-// them whole, and cutting one breaks the JSON the chat indents and highlights.
-const TOOL_TEXT_LIMIT = 32_000;
-
-const RunStartedEvent = t.Object({
- type: t.Literal('RUN_STARTED'),
- threadId: t.Optional(t.String()),
- runId: t.Optional(t.String()),
-});
-
-const RunFinishedEvent = t.Object({
- type: t.Literal('RUN_FINISHED'),
- threadId: t.Optional(t.String()),
- runId: t.Optional(t.String()),
-});
-
-const RunErrorEvent = t.Object({
- type: t.Literal('RUN_ERROR'),
- message: t.String({ maxLength: 2000 }),
- code: t.Optional(t.String({ maxLength: 200 })),
-});
-
-const TextMessageStartEvent = t.Object({
- type: t.Literal('TEXT_MESSAGE_START'),
- messageId: t.String({ maxLength: 200 }),
- role: t.Literal('assistant'),
-});
-
-const TextMessageContentEvent = t.Object({
- type: t.Literal('TEXT_MESSAGE_CONTENT'),
- messageId: t.String({ maxLength: 200 }),
- delta: t.String({ maxLength: DELTA_LIMIT }),
-});
-
-const TextMessageEndEvent = t.Object({
- type: t.Literal('TEXT_MESSAGE_END'),
- messageId: t.String({ maxLength: 200 }),
-});
-
-const ToolCallStartEvent = t.Object({
- type: t.Literal('TOOL_CALL_START'),
- toolCallId: t.String({ maxLength: 200 }),
- toolCallName: t.String({ maxLength: 200 }),
- parentMessageId: t.Optional(t.String({ maxLength: 200 })),
-});
-
-const ToolCallArgsEvent = t.Object({
- type: t.Literal('TOOL_CALL_ARGS'),
- toolCallId: t.String({ maxLength: 200 }),
- delta: t.String({ maxLength: TOOL_TEXT_LIMIT }),
-});
-
-const ToolCallEndEvent = t.Object({
- type: t.Literal('TOOL_CALL_END'),
- toolCallId: t.String({ maxLength: 200 }),
-});
-
-const ToolCallResultEvent = t.Object({
- type: t.Literal('TOOL_CALL_RESULT'),
- messageId: t.String({ maxLength: 200 }),
- toolCallId: t.String({ maxLength: 200 }),
- content: t.String({ maxLength: TOOL_TEXT_LIMIT }),
- role: t.Optional(t.Literal('tool')),
-});
-
-export const AgUiEvent = t.Union([
- RunStartedEvent,
- RunFinishedEvent,
- RunErrorEvent,
- TextMessageStartEvent,
- TextMessageContentEvent,
- TextMessageEndEvent,
- ToolCallStartEvent,
- ToolCallArgsEvent,
- ToolCallEndEvent,
- ToolCallResultEvent,
-]);
-
-export type AgUiEventBody = typeof AgUiEvent.static;
+export { AgUiEvent, type AgUiEventBody } from '../model';
export const chatMessageParams = t.Object({
projectKey: t.String(),
diff --git a/apps/api/src/modules/agents/core/__tests__/integration/agent-traces.test.ts b/apps/api/src/modules/agents/core/__tests__/integration/agent-traces.test.ts
index 4d13e6fd..69527247 100644
--- a/apps/api/src/modules/agents/core/__tests__/integration/agent-traces.test.ts
+++ b/apps/api/src/modules/agents/core/__tests__/integration/agent-traces.test.ts
@@ -1,4 +1,5 @@
import { describe, it, expect, beforeEach } from 'bun:test';
+import { db, agentRun, agentRunTrace } from '@repo/db';
import { SpanType } from '@mastra/core/observability';
import { authedApi, type Api, createProject } from '#tests/helpers/app';
import { signUpTestUser } from '#tests/helpers/auth';
@@ -249,6 +250,74 @@ describe('agent trace retention', () => {
expect(await traceIds(asOwner, teamId, agent.id)).toEqual(['trace-recent', 'trace-old']);
});
+ it('prunes expired external transcripts without deleting results or pending attempts', async () => {
+ const { asOwner } = await setup();
+ const created = await createAgent(asOwner, 'MKT', {
+ name: 'Runner',
+ username: 'runner',
+ kind: 'external',
+ });
+ const projectId = await projectIdOf(asOwner, 'MKT');
+ const rows = await db
+ .insert(agentRun)
+ .values([
+ {
+ agentId: created.data!.agent.id,
+ projectId,
+ prompt: 'Old',
+ status: 'success',
+ output: 'Kept result',
+ createdAt: daysAgo(50),
+ finishedAt: daysAgo(40),
+ },
+ {
+ agentId: created.data!.agent.id,
+ projectId,
+ prompt: 'Recent',
+ status: 'failed',
+ createdAt: daysAgo(50),
+ finishedAt: daysAgo(5),
+ },
+ {
+ agentId: created.data!.agent.id,
+ projectId,
+ prompt: 'Active',
+ status: 'pending',
+ createdAt: daysAgo(50),
+ },
+ {
+ agentId: created.data!.agent.id,
+ projectId,
+ prompt: 'Canceled',
+ status: 'canceled',
+ createdAt: daysAgo(40),
+ },
+ ])
+ .returning();
+ await db.insert(agentRunTrace).values(
+ rows.flatMap((run) =>
+ [1, 2].map((attempt) => ({
+ runId: run.id,
+ attempt,
+ sessionId: 'local-session',
+ events: [{ private: 'trace' }],
+ createdAt: daysAgo(50),
+ })),
+ ),
+ );
+ await setAgentSettings({ traceRetentionDays: 0 });
+ await pruneAgentTraces();
+ expect(await db.select().from(agentRunTrace)).toHaveLength(8);
+ await setAgentSettings({ traceRetentionDays: 30 });
+ await pruneAgentTraces();
+ const kept = await db.select().from(agentRunTrace);
+ expect(kept).toHaveLength(4);
+ expect(kept.every((trace) => [rows[1].id, rows[2].id].includes(trace.runId))).toBe(true);
+ const runs = await db.select().from(agentRun);
+ expect(runs).toHaveLength(4);
+ expect(runs.find((run) => run.id === rows[0].id)?.output).toBe('Kept result');
+ });
+
it('drops the traces of a team that no longer exists', async () => {
const { asOwner, teamId } = await setup();
const agent = await createInternalAgent(asOwner, 'Scout', 'scout');
diff --git a/apps/api/src/modules/agents/core/model.ts b/apps/api/src/modules/agents/core/model.ts
index 4cfd238e..d0528302 100644
--- a/apps/api/src/modules/agents/core/model.ts
+++ b/apps/api/src/modules/agents/core/model.ts
@@ -1,7 +1,7 @@
import { t } from 'elysia';
import { pageQueryFields, pageResponse } from '#shared/pagination';
-import { agentRunTrigger, runContextTokens } from '../model';
+import { agentRunTrigger, agentExecutionState, runContextTokens } from '../model';
export { agentParams, projectAgentParams } from '../model';
@@ -185,6 +185,7 @@ export const RunAgentResponse = t.Object({
export const AgentRunResponse = t.Object({
id: t.Number(),
status: t.String(),
+ executionState: agentExecutionState,
trigger: agentRunTrigger,
issueId: t.Nullable(t.Number()),
issueIdentifier: t.Nullable(t.String()),
diff --git a/apps/api/src/modules/agents/core/run-poller.ts b/apps/api/src/modules/agents/core/run-poller.ts
index 5c355f31..4e95ffd3 100644
--- a/apps/api/src/modules/agents/core/run-poller.ts
+++ b/apps/api/src/modules/agents/core/run-poller.ts
@@ -12,6 +12,7 @@ import {
countRunsAhead,
deferRun,
markRunFailed,
+ markRunExecuting,
markRunSuccess,
runRetryDelayMs,
scheduleRunRetry,
@@ -64,6 +65,7 @@ async function processRun(run: ClaimedRun): Promise<void> {
const timeoutMs = runTimeoutMs(maxRunSeconds);
try {
await agentRunStarted(run);
+ if (!(await markRunExecuting(run.id, run.attempts))) return;
const result = await runAgent(run.agentId, run.projectId, framePrompt(run), {
callerUserId: run.agentUserId,
threadId: runThreadId(run),
diff --git a/apps/api/src/modules/agents/core/run-queue.ts b/apps/api/src/modules/agents/core/run-queue.ts
index e5ad794f..b4995ba6 100644
--- a/apps/api/src/modules/agents/core/run-queue.ts
+++ b/apps/api/src/modules/agents/core/run-queue.ts
@@ -137,6 +137,7 @@ export async function claimDueRuns(): Promise<ClaimedRun[]> {
UPDATE agent_run r
SET attempts = r.attempts + 1,
started_at = coalesce(r.started_at, now()),
+ execution_started_at = NULL,
next_attempt_at = now() + make_interval(secs => ${leaseSeconds})
WHERE r.id IN (
SELECT id FROM agent_run q
@@ -226,6 +227,7 @@ export async function markRunSuccess(
.update(agentRun)
.set({
status: 'success',
+ executionStartedAt: null,
output,
lastError: null,
inputTokens: usage?.inputTokens ?? null,
@@ -241,6 +243,7 @@ export async function scheduleRunRetry(id: number, delayMs: number, error: strin
.update(agentRun)
.set({
status: 'pending',
+ executionStartedAt: null,
nextAttemptAt: sql`now() + make_interval(secs => ${delaySeconds})`,
lastError: error.slice(0, 500),
})
@@ -250,7 +253,12 @@ export async function scheduleRunRetry(id: number, delayMs: number, error: strin
export async function markRunFailed(id: number, error: string): Promise<void> {
await db
.update(agentRun)
- .set({ status: 'failed', lastError: error.slice(0, 500), finishedAt: new Date() })
+ .set({
+ status: 'failed',
+ executionStartedAt: null,
+ lastError: error.slice(0, 500),
+ finishedAt: new Date(),
+ })
.where(and(eq(agentRun.id, id), eq(agentRun.status, 'pending')));
}
@@ -263,6 +271,7 @@ export async function deferRun(id: number, delaySeconds: number): Promise<void>
await db
.update(agentRun)
.set({
+ executionStartedAt: null,
attempts: sql`${agentRun.attempts} - 1`,
startedAt: sql`CASE WHEN ${agentRun.attempts} = 1 THEN NULL ELSE ${agentRun.startedAt} END`,
nextAttemptAt: sql`now() + make_interval(secs => ${delaySeconds})`,
@@ -270,11 +279,32 @@ export async function deferRun(id: number, delaySeconds: number): Promise<void>
.where(and(eq(agentRun.id, id), eq(agentRun.status, 'pending')));
}
-// One row of an agent's run history, for the runs sidebar. The issue is joined for
-// its human key and title.
+export const executionState = sql<'queued' | 'running' | 'success' | 'failed' | 'canceled'>`
+ CASE WHEN ${agentRun.status} <> 'pending' THEN ${agentRun.status}
+ WHEN ${agentRun.executionStartedAt} IS NOT NULL AND ${agentRun.nextAttemptAt} > now()
+ THEN 'running'
+ ELSE 'queued' END`;
+
+export async function markRunExecuting(id: number, attempts: number): Promise<boolean> {
+ const rows = await db
+ .update(agentRun)
+ .set({ executionStartedAt: new Date() })
+ .where(
+ and(
+ eq(agentRun.id, id),
+ eq(agentRun.status, 'pending'),
+ eq(agentRun.attempts, attempts),
+ gt(agentRun.nextAttemptAt, sql`now()`),
+ ),
+ )
+ .returning({ id: agentRun.id });
+ return rows.length > 0;
+}
+
export interface AgentRunRow {
id: number;
status: string;
+ executionState: 'queued' | 'running' | 'success' | 'failed' | 'canceled';
trigger: AgentRunTrigger;
issueId: number | null;
issueIdentifier: string | null;
@@ -323,6 +353,7 @@ export async function listAgentRuns(
.select({
id: agentRun.id,
status: agentRun.status,
+ executionState,
trigger: agentRun.trigger,
issueId: agentRun.issueId,
prompt: agentRun.prompt,
@@ -355,6 +386,7 @@ export async function listAgentRuns(
items: page.map((r) => ({
id: r.id,
status: r.status,
+ executionState: r.executionState,
trigger: r.trigger as AgentRunTrigger,
issueId: r.issueId,
issueIdentifier: r.projectKey && r.issueSeq != null ? `${r.projectKey}-${r.issueSeq}` : null,
diff --git a/apps/api/src/modules/agents/core/runtime/trace-retention.ts b/apps/api/src/modules/agents/core/runtime/trace-retention.ts
index 3f4a9954..9f8acc09 100644
--- a/apps/api/src/modules/agents/core/runtime/trace-retention.ts
+++ b/apps/api/src/modules/agents/core/runtime/trace-retention.ts
@@ -1,17 +1,9 @@
-import { db, team } from '@repo/db';
+import { db, team, agentRun, agentRunTrace } from '@repo/db';
import { sql, type SQL } from 'drizzle-orm';
import { getAgentSettings } from '#modules/settings/service';
import { spansTableExists } from './store';
-// The sweep that drops old run traces, run by the api's background loop. The window is
-// the instance setting; 0 days keeps every trace.
-//
-// A window applies to a run, not to each of its spans: the sweep finds the root spans
-// past it and deletes every span of their traces, so a trace is never left half removed.
-
-// Traces deleted per statement, which bounds how long one delete holds its locks.
const BATCH = 200;
-// Batches one sweep runs per condition before it leaves the rest to the next one.
const MAX_BATCHES = 50;
async function deleteBatch(where: SQL): Promise<number> {
@@ -40,12 +32,28 @@ async function deleteUntilDone(where: SQL): Promise<number> {
// other, so a value that is not a number is left for the orphan sweep rather than cast.
const traceTeamId = sql`(CASE WHEN metadata->>'teamId' ~ '^[0-9]+$' THEN (metadata->>'teamId')::int END)`;
-// Deletes every trace past the window and every trace whose team is gone. Returns how
-// many spans it removed.
+// Zero days keeps all traces. Pending external runs are never pruned.
export async function pruneAgentTraces(): Promise<number> {
- if (!(await spansTableExists())) return 0;
const { traceRetentionDays } = await getAgentSettings();
let deleted = 0;
+ if (traceRetentionDays > 0) {
+ for (let batch = 0; batch < MAX_BATCHES; batch++) {
+ const removed = await db.execute(sql`
+ DELETE FROM ${agentRunTrace}
+ WHERE (run_id, attempt) IN (
+ SELECT t.run_id, t.attempt FROM ${agentRunTrace} t
+ INNER JOIN ${agentRun} r ON r.id = t.run_id
+ WHERE r.status <> 'pending'
+ AND coalesce(r.finished_at, r.created_at) < now() - make_interval(days => ${traceRetentionDays})
+ LIMIT ${BATCH}
+ )
+ `);
+ const count = (removed as unknown as { count?: number }).count ?? 0;
+ deleted += count;
+ if (count === 0) break;
+ }
+ }
+ if (!(await spansTableExists())) return deleted;
if (traceRetentionDays > 0) {
deleted += await deleteUntilDone(
sql`"startedAtZ" < now() - make_interval(days => ${traceRetentionDays})`,
diff --git a/apps/api/src/modules/agents/core/runtime/traces.ts b/apps/api/src/modules/agents/core/runtime/traces.ts
index 6301bbd0..944a8484 100644
--- a/apps/api/src/modules/agents/core/runtime/traces.ts
+++ b/apps/api/src/modules/agents/core/runtime/traces.ts
@@ -1,6 +1,6 @@
import { db } from '@repo/db';
import { sql } from 'drizzle-orm';
-import { getStore } from './store';
+import { getStore, spansTableExists } from './store';
import { toIso } from '../helpers/dates';
import type { AgentRunTrigger } from '../../model';
@@ -161,3 +161,41 @@ export async function getAgentTrace(
}));
return { trace: toSummary(root), spans };
}
+
+// Retries share a queued run id. Each trace links to the previous recorded attempt.
+export async function getRunTrace(
+ agentId: number,
+ runId: number,
+ projectId: number,
+ issueId: number,
+ viewerId: string,
+ traceId?: string,
+) {
+ if (!(await spansTableExists())) return traceId == null ? null : undefined;
+ const where = sql`r."parentSpanId" IS NULL
+ AND r.metadata->>'agentId' = ${String(agentId)}
+ AND r.metadata->>'runId' = ${String(runId)}
+ AND r.metadata->>'projectId' = ${String(projectId)}
+ AND r.metadata->>'issueId' = ${String(issueId)}
+ AND (r.metadata->>'userId' IS NULL OR r.metadata->>'userId' = ${viewerId})`;
+ const rows = await db.execute<{ traceId: string }>(sql`
+ SELECT r."traceId" FROM mastra_ai_spans r
+ WHERE ${where}
+ ${traceId == null ? sql`` : sql`AND r."traceId" = ${traceId}`}
+ ORDER BY r."startedAtZ" DESC, r."traceId" DESC
+ LIMIT 1`);
+ if (!rows[0]) return traceId == null ? null : undefined;
+ const detail = await getAgentTrace(agentId, rows[0].traceId, viewerId);
+ if (!detail) return traceId == null ? null : undefined;
+ const older = await db.execute<{ traceId: string }>(sql`
+ SELECT r."traceId" FROM mastra_ai_spans r
+ WHERE ${where}
+ AND (r."startedAtZ", r."traceId") < (
+ SELECT anchor."startedAtZ", anchor."traceId" FROM mastra_ai_spans anchor
+ WHERE anchor."traceId" = ${detail.trace.traceId} AND anchor."parentSpanId" IS NULL
+ LIMIT 1
+ )
+ ORDER BY r."startedAtZ" DESC, r."traceId" DESC
+ LIMIT 1`);
+ return { ...detail, previousTraceId: older[0]?.traceId ?? null };
+}
diff --git a/apps/api/src/modules/agents/model.ts b/apps/api/src/modules/agents/model.ts
index 1eca255f..1cd0c14e 100644
--- a/apps/api/src/modules/agents/model.ts
+++ b/apps/api/src/modules/agents/model.ts
@@ -109,3 +109,102 @@ export type ChatThreadPage = {
items: ChatThreadSummary[];
nextPage: number | null;
};
+
+export const agentExecutionState = t.Union([
+ t.Literal('queued'),
+ t.Literal('running'),
+ t.Literal('success'),
+ t.Literal('failed'),
+ t.Literal('canceled'),
+]);
+
+// External agent runs and chats are carried by AG-UI events (https://docs.ag-ui.com):
+// the runner reports what its coding agent produces as this event stream, and the
+// browser is served the same events. The schemas below are the subset the UI needs,
+// with the field names the protocol defines, so a runner that already speaks AG-UI
+// needs no translation. Lifecycle ids are optional here because the server knows the
+// thread and the answer they belong to; everything else is required as specified.
+
+// The longest text delta accepted in one event. A runner buffers its output rather
+// than sending a request per token, and this bounds how much one event may carry.
+const DELTA_LIMIT = 12_000;
+
+// The longest arguments or result accepted for one tool call. A runner reports each of
+// them whole, and cutting one breaks the JSON the chat indents and highlights.
+const TOOL_TEXT_LIMIT = 32_000;
+
+const RunStartedEvent = t.Object({
+ type: t.Literal('RUN_STARTED'),
+ threadId: t.Optional(t.String()),
+ runId: t.Optional(t.String()),
+});
+
+const RunFinishedEvent = t.Object({
+ type: t.Literal('RUN_FINISHED'),
+ threadId: t.Optional(t.String()),
+ runId: t.Optional(t.String()),
+});
+
+const RunErrorEvent = t.Object({
+ type: t.Literal('RUN_ERROR'),
+ message: t.String({ maxLength: 2000 }),
+ code: t.Optional(t.String({ maxLength: 200 })),
+});
+
+const TextMessageStartEvent = t.Object({
+ type: t.Literal('TEXT_MESSAGE_START'),
+ messageId: t.String({ maxLength: 200 }),
+ role: t.Literal('assistant'),
+});
+
+const TextMessageContentEvent = t.Object({
+ type: t.Literal('TEXT_MESSAGE_CONTENT'),
+ messageId: t.String({ maxLength: 200 }),
+ delta: t.String({ maxLength: DELTA_LIMIT }),
+});
+
+const TextMessageEndEvent = t.Object({
+ type: t.Literal('TEXT_MESSAGE_END'),
+ messageId: t.String({ maxLength: 200 }),
+});
+
+const ToolCallStartEvent = t.Object({
+ type: t.Literal('TOOL_CALL_START'),
+ toolCallId: t.String({ maxLength: 200 }),
+ toolCallName: t.String({ maxLength: 200 }),
+ parentMessageId: t.Optional(t.String({ maxLength: 200 })),
+});
+
+const ToolCallArgsEvent = t.Object({
+ type: t.Literal('TOOL_CALL_ARGS'),
+ toolCallId: t.String({ maxLength: 200 }),
+ delta: t.String({ maxLength: TOOL_TEXT_LIMIT }),
+});
+
+const ToolCallEndEvent = t.Object({
+ type: t.Literal('TOOL_CALL_END'),
+ toolCallId: t.String({ maxLength: 200 }),
+});
+
+const ToolCallResultEvent = t.Object({
+ type: t.Literal('TOOL_CALL_RESULT'),
+ messageId: t.String({ maxLength: 200 }),
+ toolCallId: t.String({ maxLength: 200 }),
+ content: t.String({ maxLength: TOOL_TEXT_LIMIT }),
+ role: t.Optional(t.Literal('tool')),
+});
+
+export const AgUiEvent = t.Union([
+ RunStartedEvent,
+ RunFinishedEvent,
+ RunErrorEvent,
+ TextMessageStartEvent,
+ TextMessageContentEvent,
+ TextMessageEndEvent,
+ ToolCallStartEvent,
+ ToolCallArgsEvent,
+ ToolCallEndEvent,
+ ToolCallResultEvent,
+]);
+
+export type AgUiEventBody = typeof AgUiEvent.static;
diff --git a/apps/api/src/modules/agents/queue/__tests__/integration/runner-queue.test.ts b/apps/api/src/modules/agents/queue/__tests__/integration/runner-queue.test.ts
new file mode 100644
index 00000000..690c8396
--- /dev/null
+++ b/apps/api/src/modules/agents/queue/__tests__/integration/runner-queue.test.ts
@@ -0,0 +1,256 @@
+import { afterEach, beforeEach, describe, expect, it } from 'bun:test';
+import { db, agentRun } from '@repo/db';
+import { eq } from 'drizzle-orm';
+import { apiKeyApi, authedApi, createProject } from '#tests/helpers/app';
+import { signUpTestUser } from '#tests/helpers/auth';
+import { resetDb } from '#tests/helpers/db';
+import { createAgent, teamOf } from '#tests/helpers/agents';
+import { createRole } from '#tests/helpers/roles';
+import { addProjectMember } from '#tests/helpers/members';
+import { setRunAdmission } from '../../../core/run-admission';
+import { scheduleRunRetry } from '../../../core/run-queue';
+
+async function setup() {
+ const owner = await signUpTestUser();
+ const api = authedApi(owner.cookie);
+ const project = (await createProject(api, { key: 'RUN', name: 'Runs' })).data!;
+ const view = (await api.projects({ projectKey: 'RUN' }).get()).data!;
+ const created = await createAgent(api, 'RUN', {
+ name: 'Runner',
+ username: 'runner',
+ kind: 'external',
+ triggerOnMention: true,
+ });
+ const issue = (
+ await api.projects({ projectKey: 'RUN' }).issues.post({
+ title: 'Run this',
+ columnId: view.columns[0].id,
+ })
+ ).data!;
+ await api.issues({ issueId: issue.id }).comments.post({ body: '@runner start' });
+ return {
+ api,
+ project,
+ issue,
+ agent: created.data!.agent,
+ runner: apiKeyApi(created.data!.apiKey!),
+ };
+}
+
+const scopes = { query: { scopes: 'runnerQueue:1' } };
+
+describe('runner queue', () => {
+ beforeEach(resetDb);
+ afterEach(() => setRunAdmission());
+
+ it('separates waiting, executing and finished runs without changing pending status', async () => {
+ const { api, runner, issue } = await setup();
+ const queued = await api['agent-runs'].queue.get();
+ expect(queued.status).toBe(200);
+ expect(queued.data).toMatchObject({ total: 1, queued: 1, running: 0 });
+ expect(queued.data!.items[0]).toMatchObject({
+ status: 'pending',
+ executionState: 'queued',
+ runnerState: 'never',
+ });
+ const before = (await api.sync.rev.get(scopes)).data!.revs['runnerQueue:1'];
+ const claimed = (await runner['agent-runs'].claim.post()).data!.run!;
+ const running = await api['agent-runs'].queue.get();
+ expect(running.data).toMatchObject({ total: 1, queued: 0, running: 1 });
+ expect(running.data!.items[0]).toMatchObject({
+ id: claimed.id,
+ status: 'pending',
+ executionState: 'running',
+ runnerState: 'online',
+ });
+ expect((await api.sync.rev.get(scopes)).data!.revs['runnerQueue:1']).not.toBe(before);
+ expect(
+ (await api.issues({ issueId: issue.id })['agent-runs'].get()).data!.items[0].executionState,
+ ).toBe('running');
+ await runner['agent-runs']({ runId: claimed.id }).heartbeat.post();
+ expect((await api['agent-runs'].queue.get()).data!.running).toBe(1);
+ await runner['agent-runs']({ runId: claimed.id }).result.post({
+ status: 'success',
+ output: 'Done',
+ });
+ expect((await api['agent-runs'].queue.get()).data).toMatchObject({
+ total: 1,
+ running: 0,
+ queued: 0,
+ });
+ expect(
+ (await api['agent-runs'].queue.get({ query: { runId: claimed.id } })).data!.items[0],
+ ).toMatchObject({
+ id: claimed.id,
+ executionState: 'success',
+ output: 'Done',
+ });
+ expect(
+ (await api.issues({ issueId: issue.id })['agent-runs'].get()).data!.items[0].executionState,
+ ).toBe('success');
+ });
+
+ it('keeps admission delays and retry backoff in the waiting state', async () => {
+ const { api, runner } = await setup();
+ setRunAdmission(async () => 60);
+ expect((await runner['agent-runs'].claim.post()).data!.run).toBeNull();
+ const queued = (await api['agent-runs'].queue.get()).data!.items[0];
+ expect(queued).toMatchObject({ executionState: 'queued', attempts: 0 });
+ expect((await runner['agent-runs']({ runId: queued.id }).heartbeat.post()).status).toBe(404);
+ setRunAdmission();
+ // Move the admission deadline forward without sleeping through a real minute.
+ await db
+ .update(agentRun)
+ .set({ nextAttemptAt: new Date(0) })
+ .where(eq(agentRun.id, queued.id));
+ const claimed = (await runner['agent-runs'].claim.post()).data!.run!;
+ await scheduleRunRetry(claimed.id, 60_000, 'Temporary failure');
+ expect((await runner['agent-runs']({ runId: claimed.id }).heartbeat.post()).status).toBe(404);
+ expect((await api['agent-runs'].queue.get()).data!.items[0]).toMatchObject({
+ executionState: 'queued',
+ lastError: 'Temporary failure',
+ });
+ setRunAdmission(async () => 60);
+ await db
+ .update(agentRun)
+ .set({ nextAttemptAt: new Date(0) })
+ .where(eq(agentRun.id, claimed.id));
+ expect((await runner['agent-runs'].claim.post()).data!.run).toBeNull();
+ expect((await api['agent-runs'].queue.get()).data!.items[0]).toMatchObject({
+ executionState: 'queued',
+ attempts: 1,
+ });
+ });
+
+ it('shows an expired execution lease as waiting', async () => {
+ const { api, runner } = await setup();
+ const run = (await runner['agent-runs'].claim.post()).data!.run!;
+ await db
+ .update(agentRun)
+ .set({ nextAttemptAt: new Date(0) })
+ .where(eq(agentRun.id, run.id));
+ expect((await api['agent-runs'].queue.get()).data).toMatchObject({ queued: 1, running: 0 });
+ const reclaimed = (await runner['agent-runs'].claim.post()).data!.run!;
+ expect(reclaimed).toMatchObject({ id: run.id, attempts: 2 });
+ expect((await api['agent-runs'].queue.get()).data!.items[0].executionState).toBe('running');
+ });
+
+ it('filters projects, counts and markers by both read permissions', async () => {
+ const { api, project, agent } = await setup();
+ const other = (
+ await api.teams({ teamId: project.teamId }).projects.post({ key: 'HID', name: 'Hidden' })
+ ).data!;
+ await api
+ .teams({ teamId: project.teamId })
+ ['ai-agents']({ agentId: agent.id })
+ .projects.put({ projectIds: [project.id, other.id] });
+ const columnId = (await api.projects({ projectKey: 'HID' }).get()).data!.columns[0].id;
+ const issue = (
+ await api.projects({ projectKey: 'HID' }).issues.post({ columnId, title: 'Secret' })
+ ).data!;
+ await api.issues({ issueId: issue.id }).comments.post({ body: '@runner hidden work' });
+ const role = (
+ await createRole(api, 'RUN', {
+ name: 'Run reader',
+ permissions: { work_items: { read: true }, ai_agents: { read: true } },
+ })
+ ).data!;
+ const reader = await addProjectMember(api, 'RUN', role.id);
+ expect((await api['agent-runs'].queue.get()).data!.total).toBe(2);
+ const mine = (await reader['agent-runs'].queue.get()).data!;
+ expect(mine.total).toBe(1);
+ expect(mine.items[0].issueTitle).toBe('Run this');
+ const marker = (await reader.sync.rev.get(scopes)).data!.revs['runnerQueue:1'];
+ await api.issues({ issueId: issue.id }).comments.post({ body: '@runner more hidden work' });
+ expect((await reader.sync.rev.get(scopes)).data!.revs['runnerQueue:1']).toBe(marker);
+ for (const permissions of [{ work_items: { read: true } }, { ai_agents: { read: true } }]) {
+ const restricted = (
+ await createRole(api, 'RUN', {
+ name: JSON.stringify(permissions),
+ permissions,
+ })
+ ).data!;
+ const denied = await addProjectMember(api, 'RUN', restricted.id);
+ expect((await denied['agent-runs'].queue.get()).data).toMatchObject({ items: [], total: 0 });
+ expect(
+ (await denied['agent-runs'].queue.get({ query: { runId: mine.items[0].id } })).data,
+ ).toMatchObject({ items: [], total: 0 });
+ expect((await denied.sync.rev.get(scopes)).data!.revs['runnerQueue:1']).toBe('0');
+ }
+ });
+
+ it('paginates with stable id ordering and excludes internal agents', async () => {
+ const { api, issue, runner } = await setup();
+ await api.issues({ issueId: issue.id }).comments.post({ body: '@runner second run' });
+ await createAgent(api, 'RUN', { name: 'Internal', username: 'internal', kind: 'internal' });
+ await api
+ .issues({ issueId: issue.id })
+ .comments.post({ body: '@internal private internal work' });
+ const first = (await api['agent-runs'].queue.get({ query: { page: 1, pageSize: 1 } })).data!;
+ const second = (await api['agent-runs'].queue.get({ query: { page: 2, pageSize: 1 } })).data!;
+ expect(first.total).toBe(2);
+ expect(second.total).toBe(2);
+ expect(first.items[0].id).not.toBe(second.items[0].id);
+ const claimed = (await runner['agent-runs'].claim.post()).data!.run!;
+ const activeFirst = (await api['agent-runs'].queue.get({ query: { pageSize: 1 } })).data!;
+ expect(activeFirst.items[0]).toMatchObject({ id: claimed.id, executionState: 'running' });
+ expect((await api['agent-runs'].queue.get({ query: { page: 1.5 } })).status).toBe(400);
+ expect((await api['agent-runs'].queue.get({ query: { pageSize: 101 } })).status).toBe(400);
+ });
+
+ it('includes a scheduled manual run that has no issue', async () => {
+ const { api, agent } = await setup();
+ const schedule = await api.projects({ projectKey: 'RUN' })['agent-schedules'].post({
+ agentId: agent.id,
+ name: 'Daily',
+ cron: '0 9 * * *',
+ prompt: 'Daily work',
+ });
+ expect(schedule.status).toBe(201);
+ const queued = await api
+ .projects({ projectKey: 'RUN' })
+ ['agent-schedules']({ scheduleId: schedule.data!.id })
+ .run.post();
+ expect(queued.status).toBe(202);
+ const queue = (await api['agent-runs'].queue.get()).data!;
+ expect(queue.items).toContainEqual(
+ expect.objectContaining({
+ id: queued.data!.runId,
+ issueId: null,
+ scheduleName: 'Daily',
+ trigger: 'manual',
+ executionState: 'queued',
+ }),
+ );
+ });
+
+ it('reports an agent with an invocation URL as push instead of runner presence', async () => {
+ const { api, agent } = await setup();
+ // The SSRF guard refuses a loopback URL under NODE_ENV=test.
+ const environment = process.env.NODE_ENV;
+ process.env.NODE_ENV = 'development';
+ try {
+ const patched = await api
+ .teams({ teamId: await teamOf(api, 'RUN') })
+ ['ai-agents']({ agentId: agent.id })
+ .patch({ invocationUrl: 'http://127.0.0.1:9/agent' });
+ expect(patched.status).toBe(200);
+ } finally {
+ process.env.NODE_ENV = environment;
+ }
+ expect((await api['agent-runs'].queue.get()).data!.items[0]).toMatchObject({
+ executionState: 'queued',
+ runnerState: 'push',
+ });
+ });
+
+ it('removes canceled runs after their issue moves', async () => {
+ const { api, project, issue } = await setup();
+ const other = (
+ await api.teams({ teamId: project.teamId }).projects.post({ key: 'NEXT', name: 'Next' })
+ ).data!;
+ const moved = await api.issues({ issueId: issue.id }).move.post({ projectId: other.id });
+ expect(moved.status).toBe(200);
+ expect((await api['agent-runs'].queue.get()).data!.total).toBe(0);
+ });
+});
diff --git a/apps/api/src/modules/agents/queue/index.ts b/apps/api/src/modules/agents/queue/index.ts
new file mode 100644
index 00000000..77c9b8a4
--- /dev/null
+++ b/apps/api/src/modules/agents/queue/index.ts
@@ -0,0 +1,79 @@
+import { assertMcpAllowed, requiresPermission } from '#shared/guards';
+import { HttpError } from '#shared/lib';
+import { externalTraceQuery, ExternalTraceResponse, runParams } from '../runner/model';
+import { runProjectId, readRunTrace } from '../runner/run-events';
+import { Elysia, type DocumentDecoration } from 'elysia';
+import { authContext } from '#shared/auth-context';
+import { assertPermission, requireUser } from '#shared/access';
+import { commonErrors } from '#shared/responses';
+import { paginate } from '#shared/pagination';
+import { isMcpRequest } from '#shared/mcp-request';
+import { queueQuery, RunnerQueueResponse } from './model';
+import { listRunnerQueue } from './service';
+
+export const runnerQueueRoutes = new Elysia({
+ name: 'runner-queue',
+ detail: { tags: ['Agent Runner'] },
+})
+ .use(authContext)
+ .macro({
+ runTrace(_enabled: boolean) {
+ return {
+ detail: requiresPermission(['ai_agents', 'read']) as DocumentDecoration,
+ async resolve({ params, user, request }) {
+ const projectId = await runProjectId(Number((params as { runId: string }).runId));
+ if (projectId == null) throw new HttpError(404, 'Run not found');
+ await assertPermission(projectId, user, 'work_items', 'read');
+ await assertPermission(projectId, user, 'ai_agents', 'read');
+ await assertMcpAllowed(projectId, request.headers);
+ return { projectId };
+ },
+ };
+ },
+ })
+ .get(
+ '/agent-runs/:runId/trace',
+ async ({ params, query, projectId }) => {
+ const trace = await readRunTrace(projectId, params.runId, query.attempt);
+ if (trace === undefined) throw new HttpError(404, 'Run attempt not found');
+ return Response.json(trace);
+ },
+ {
+ runTrace: true,
+ params: runParams,
+ query: externalTraceQuery,
+ response: { 200: ExternalTraceResponse, ...commonErrors },
+ detail: {
+ summary: 'Read an external run transcript',
+ description:
+ 'Recorded events and local Codex session of the selected or latest attempt. Requires both agent and work item read permission in the original project.',
+ },
+ },
+ )
+ .get(
+ '/agent-runs/queue',
+ async ({ user, query, request }) => {
+ let counts = { queued: 0, running: 0 };
+ const page = await paginate(query, async (window) => {
+ const result = await listRunnerQueue(
+ requireUser(user).id,
+ window,
+ isMcpRequest(request.headers),
+ query.runId,
+ );
+ counts = { queued: result.queued, running: result.running };
+ return result;
+ });
+ return { ...page, ...counts };
+ },
+ {
+ query: queueQuery,
+ response: { 200: RunnerQueueResponse, ...commonErrors },
+ detail: {
+ summary: 'Read the runner queue',
+ description:
+ 'Active and past external runs across projects where the caller may read both ' +
+ 'work items and agents. Running leases first, waiting runs by due time, then newest past runs.',
+ },
+ },
+ );
diff --git a/apps/api/src/modules/agents/queue/model.ts b/apps/api/src/modules/agents/queue/model.ts
new file mode 100644
index 00000000..427607dc
--- /dev/null
+++ b/apps/api/src/modules/agents/queue/model.ts
@@ -0,0 +1,31 @@
+import { t } from 'elysia';
+import { pageQueryFields, pageResponse } from '#shared/pagination';
+import { IssueAgentRunPageResponse } from '#modules/issues/model';
+
+export const queueQuery = t.Object({
+ ...pageQueryFields,
+ runId: t.Optional(t.Numeric({ minimum: 1, multipleOf: 1 })),
+ page: t.Optional(t.Numeric({ minimum: 1, multipleOf: 1 })),
+ pageSize: t.Optional(t.Numeric({ minimum: 1, maximum: 100, multipleOf: 1 })),
+});
+const run = IssueAgentRunPageResponse.properties.items.items;
+export const RunnerQueueResponse = t.Object({
+ ...pageResponse(
+ t.Object({
+ ...run.properties,
+ issueId: t.Nullable(t.Number()),
+ sequenceNumber: t.Nullable(t.Number()),
+ issueTitle: t.Nullable(t.String()),
+ scheduleName: t.Nullable(t.String()),
+ projectRef: t.String(),
+ runnerState: t.Union([
+ t.Literal('push'),
+ t.Literal('online'),
+ t.Literal('offline'),
+ t.Literal('never'),
+ ]),
+ }),
+ ).properties,
+ queued: t.Number(),
+ running: t.Number(),
+});
diff --git a/apps/api/src/modules/agents/queue/service.ts b/apps/api/src/modules/agents/queue/service.ts
new file mode 100644
index 00000000..322960e6
--- /dev/null
+++ b/apps/api/src/modules/agents/queue/service.ts
@@ -0,0 +1,199 @@
+import {
+ db,
+ agentRun,
+ agentSchedule,
+ aiAgent,
+ project,
+ projectMember,
+ team,
+ teamRole,
+ issue,
+ revision,
+} from '@repo/db';
+import { and, desc, eq, inArray, isNotNull, isNull, or, sql } from 'drizzle-orm';
+import { workspaceGrants } from '#modules/workspaces/service';
+import { toMemberContext, type MemberRole } from '#modules/members/service';
+import { projectAccess } from '#shared/workspace-roles';
+import { hasPermission } from '#shared/permissions';
+import { iso } from '#shared/lib';
+import { executionState, contextTokensOf } from '../core/run-queue';
+
+// An agent with an invocation URL is sent its work and only calls back while it has
+// some, so its last contact says nothing about whether the endpoint is up.
+const runnerPresence = sql<'push' | 'online' | 'offline' | 'never'>`CASE
+ WHEN ${aiAgent.invocationUrl} IS NOT NULL THEN 'push'
+ WHEN ${aiAgent.lastSeenAt} IS NULL THEN 'never'
+ WHEN ${aiAgent.lastSeenAt} > now() - interval '90 seconds' THEN 'online'
+ ELSE 'offline' END`;
+
+async function queueProjectIds(userId: string, mcpOnly = false) {
+ const grants = await workspaceGrants(userId);
+ const grantedTeams = [...grants.keys()];
+ const rows = await db
+ .select({
+ id: project.id,
+ teamId: project.teamId,
+ role: projectMember.role,
+ permissions: teamRole.permissions,
+ })
+ .from(project)
+ .innerJoin(team, eq(team.id, project.teamId))
+ .leftJoin(
+ projectMember,
+ and(eq(projectMember.projectId, project.id), eq(projectMember.userId, userId)),
+ )
+ .leftJoin(teamRole, eq(teamRole.id, projectMember.roleId))
+ .where(
+ and(
+ mcpOnly ? and(eq(project.mcpEnabled, true), eq(team.mcpEnabled, true)) : undefined,
+ or(
+ isNotNull(projectMember.userId),
+ grantedTeams.length ? inArray(project.teamId, grantedTeams) : undefined,
+ ),
+ ),
+ );
+ return rows
+ .filter((row) => {
+ const member = row.role ? toMemberContext(row.role as MemberRole, row.permissions) : null;
+ const access = projectAccess(member, grants.get(row.teamId) ?? null);
+ return (
+ access &&
+ hasPermission(access.permissions, 'work_items', 'read') &&
+ hasPermission(access.permissions, 'ai_agents', 'read')
+ );
+ })
+ .map((row) => row.id)
+ .sort((a, b) => a - b);
+}
+
+export async function listRunnerQueue(
+ userId: string,
+ window: { limit: number; offset: number },
+ mcpOnly = false,
+ runId?: number,
+) {
+ const ids = await queueProjectIds(userId, mcpOnly);
+ if (!ids.length) return { items: [], total: 0, queued: 0, running: 0 };
+ const where = and(
+ inArray(agentRun.projectId, ids),
+ runId == null ? undefined : eq(agentRun.id, runId),
+ eq(aiAgent.kind, 'external'),
+ or(isNull(agentRun.issueId), eq(issue.projectId, agentRun.projectId)),
+ );
+ const [rows, counted] = await Promise.all([
+ db
+ .select({
+ id: agentRun.id,
+ agentId: agentRun.agentId,
+ username: aiAgent.username,
+ kind: aiAgent.kind,
+ status: agentRun.status,
+ executionState,
+ trigger: agentRun.trigger,
+ prompt: agentRun.prompt,
+ output: agentRun.output,
+ attempts: agentRun.attempts,
+ lastError: agentRun.lastError,
+ inputTokens: agentRun.inputTokens,
+ outputTokens: agentRun.outputTokens,
+ createdAt: agentRun.createdAt,
+ startedAt: agentRun.startedAt,
+ finishedAt: agentRun.finishedAt,
+ nextAttemptAt: agentRun.nextAttemptAt,
+ runnerState: runnerPresence,
+ issueId: agentRun.issueId,
+ sequenceNumber: issue.sequenceNumber,
+ issueTitle: issue.title,
+ scheduleName: agentSchedule.name,
+ projectKey: project.key,
+ teamRef: sql<string>`coalesce(${team.slug}, ${team.id}::text)`,
+ })
+ .from(agentRun)
+ .innerJoin(aiAgent, eq(aiAgent.id, agentRun.agentId))
+ .innerJoin(project, eq(project.id, agentRun.projectId))
+ .innerJoin(team, eq(team.id, project.teamId))
+ .leftJoin(issue, eq(issue.id, agentRun.issueId))
+ .leftJoin(agentSchedule, eq(agentSchedule.id, agentRun.scheduleId))
+ .where(where)
+ .orderBy(
+ sql`CASE WHEN ${executionState} = 'running' THEN 0 WHEN ${agentRun.status} = 'pending' THEN 1 ELSE 2 END`,
+ sql`CASE WHEN ${agentRun.status} = 'pending' THEN ${agentRun.nextAttemptAt} END ASC`,
+ desc(agentRun.createdAt),
+ desc(agentRun.id),
+ )
+ .limit(window.limit)
+ .offset(window.offset),
+ db
+ .select({
+ total: sql<number>`count(*)::int`,
+ queued: sql<number>`count(*) FILTER (WHERE ${executionState} = 'queued')::int`,
+ running: sql<number>`count(*) FILTER (WHERE ${executionState} = 'running')::int`,
+ })
+ .from(agentRun)
+ .innerJoin(aiAgent, eq(aiAgent.id, agentRun.agentId))
+ .leftJoin(issue, eq(issue.id, agentRun.issueId))
+ .where(where),
+ ]);
+ const total = counted[0]?.total ?? 0;
+ const running = counted[0]?.running ?? 0;
+ return {
+ items: rows.map(({ inputTokens, outputTokens, teamRef, projectKey, ...row }) => ({
+ ...row,
+ projectRef: `${teamRef}.${projectKey}`,
+ ...contextTokensOf({ inputTokens, outputTokens }),
+ createdAt: iso(row.createdAt),
+ nextAttemptAt: iso(row.nextAttemptAt),
+ startedAt: row.startedAt ? iso(row.startedAt) : null,
+ finishedAt: row.finishedAt ? iso(row.finishedAt) : null,
+ })),
+ total,
+ queued: counted[0]?.queued ?? 0,
+ running,
+ };
+}
+
+export async function runnerQueueRevision(userId: string, mcpOnly = false) {
+ const ids = await queueProjectIds(userId, mcpOnly);
+ if (!ids.length) return '0';
+ const [rows, expiredRows, presence] = await Promise.all([
+ db
+ .select({ scope: revision.scope, rev: revision.rev })
+ .from(revision)
+ .where(
+ inArray(
+ revision.scope,
+ ids.map((id) => `runner-queue:${id}`),
+ ),
+ )
+ .orderBy(revision.scope),
+ db
+ .select({ total: sql<number>`count(*)::int` })
+ .from(agentRun)
+ .where(
+ and(
+ inArray(agentRun.projectId, ids),
+ eq(agentRun.status, 'pending'),
+ isNotNull(agentRun.executionStartedAt),
+ sql`${agentRun.nextAttemptAt} <= now()`,
+ ),
+ ),
+ db
+ .selectDistinct({ id: aiAgent.id, state: runnerPresence })
+ .from(aiAgent)
+ .innerJoin(agentRun, eq(agentRun.agentId, aiAgent.id))
+ .where(
+ and(
+ inArray(agentRun.projectId, ids),
+ eq(agentRun.status, 'pending'),
+ eq(aiAgent.kind, 'external'),
+ ),
+ )
+ .orderBy(aiAgent.id),
+ ]);
+ return [
+ ids.join(','),
+ rows.map((row) => `${row.scope}=${row.rev}`).join(','),
+ expiredRows[0]?.total ?? 0,
+ presence.map((row) => `${row.id}=${row.state}`).join(','),
+ ].join(':');
+}
diff --git a/apps/api/src/modules/agents/runner/__tests__/integration/run-events.test.ts b/apps/api/src/modules/agents/runner/__tests__/integration/run-events.test.ts
new file mode 100644
index 00000000..a9ec41de
--- /dev/null
+++ b/apps/api/src/modules/agents/runner/__tests__/integration/run-events.test.ts
@@ -0,0 +1,202 @@
+import { beforeEach, describe, expect, it } from 'bun:test';
+import { db, agentRun } from '@repo/db';
+import { eq } from 'drizzle-orm';
+import { authedApi, apiKeyApi, createProject } from '#tests/helpers/app';
+import { signUpTestUser } from '#tests/helpers/auth';
+import { resetDb } from '#tests/helpers/db';
+import { createAgent } from '#tests/helpers/agents';
+import { createRole } from '#tests/helpers/roles';
+import { addProjectMember } from '#tests/helpers/members';
+
+const sessionId = '0199a213-81c0-7800-8aa1-bbab2a035a53';
+const events = [
+ { type: 'TOOL_CALL_START' as const, toolCallId: 'tool-1', toolCallName: 'shell' },
+ { type: 'TOOL_CALL_ARGS' as const, toolCallId: 'tool-1', delta: 'ls' },
+ { type: 'TOOL_CALL_RESULT' as const, toolCallId: 'tool-1', messageId: 'm', content: 'README.md' },
+];
+async function setup() {
+ const user = await signUpTestUser();
+ const api = authedApi(user.cookie);
+ await createProject(api, { key: 'RUN', name: 'Runs' });
+ const project = (await api.projects({ projectKey: 'RUN' }).get()).data!;
+ const created = (
+ await createAgent(api, 'RUN', {
+ name: 'Runner',
+ username: 'runner',
+ kind: 'external',
+ triggerOnMention: true,
+ })
+ ).data!;
+ const runner = apiKeyApi(created.apiKey!);
+ const issue = (
+ await api
+ .projects({ projectKey: 'RUN' })
+ .issues.post({ title: 'Record tools', columnId: project.columns[0].id })
+ ).data!;
+ await api.issues({ issueId: issue.id }).comments.post({ body: '@runner inspect' });
+ const run = (await runner['agent-runs'].claim.post()).data!.run!;
+ return { api, runner, run, issue, project, created };
+}
+
+describe('external run events', () => {
+ beforeEach(resetDb);
+
+ it('records live events and a Codex link, and retains them after completion', async () => {
+ const { api, runner, run } = await setup();
+ const route = api['agent-runs']({ runId: run.id }).trace;
+ expect((await route.get()).data).toBeNull();
+ const marker = (await api.sync.rev.get({ query: { scopes: 'runnerQueue:1' } })).data!.revs[
+ 'runnerQueue:1'
+ ];
+ const write = await runner['agent-runs']({ runId: run.id }).events.post({
+ attempt: 1,
+ offset: 0,
+ events,
+ sessionId,
+ });
+ expect(write.status).toBe(200);
+ expect(write.data).toEqual({ nextOffset: 3, truncated: false });
+ expect(
+ (await api.sync.rev.get({ query: { scopes: 'runnerQueue:1' } })).data!.revs['runnerQueue:1'],
+ ).not.toBe(marker);
+ const trace = (await route.get()).data!;
+ expect(trace.sessionUrl).toBe(`codex://threads/${sessionId}`);
+ expect(trace.events.map((e) => e.event)).toEqual(events);
+ await runner['agent-runs']({ runId: run.id }).result.post({ status: 'success' });
+ expect((await route.get()).data).toEqual(trace);
+ expect(
+ (await runner['agent-runs']({ runId: run.id }).events.post({ attempt: 1, offset: 3, events }))
+ .status,
+ ).toBe(404);
+ }, 20_000);
+
+ it('deduplicates accepted batches and rejects gaps and changed session ids', async () => {
+ const { api, runner, run } = await setup();
+ const route = runner['agent-runs']({ runId: run.id }).events;
+ const batch = { attempt: 1, offset: 0, events, sessionId };
+ await route.post(batch);
+ expect((await route.post(batch)).data).toEqual({ nextOffset: 3, truncated: false });
+ expect((await route.post({ ...batch, offset: 5 })).status).toBe(409);
+ expect(
+ (await route.post({ ...batch, offset: 3, sessionId: '0199a213-81c0-7800-8aa1-bbab2a035a54' }))
+ .status,
+ ).toBe(409);
+ expect(
+ (await route.post({ ...batch, offset: 3, sessionId: 'javascript:alert(1)' })).status,
+ ).toBe(400);
+ expect((await api['agent-runs']({ runId: run.id }).trace.get()).data!.events).toHaveLength(3);
+ }, 20_000);
+
+ it('separates retries and refuses events from an expired or older attempt', async () => {
+ const { api, runner, run } = await setup();
+ const write = runner['agent-runs']({ runId: run.id }).events;
+ await write.post({ attempt: 1, offset: 0, events, sessionId });
+ await db
+ .update(agentRun)
+ .set({ nextAttemptAt: new Date(0) })
+ .where(eq(agentRun.id, run.id));
+ expect((await write.post({ attempt: 1, offset: 3, events })).status).toBe(404);
+ expect((await runner['agent-runs'].claim.post()).data!.run!.attempts).toBe(2);
+ expect((await write.post({ attempt: 1, offset: 3, events })).status).toBe(404);
+ expect(
+ (await runner['agent-runs']({ runId: run.id }).heartbeat.post({ attempt: 1 })).status,
+ ).toBe(404);
+ expect(
+ (await runner['agent-runs']({ runId: run.id }).result.post({ status: 'success', attempt: 1 }))
+ .status,
+ ).toBe(404);
+ expect(
+ (await runner['agent-runs']({ runId: run.id }).heartbeat.post({ attempt: 2 })).status,
+ ).toBe(204);
+ await write.post({ attempt: 2, offset: 0, events });
+ const route = api['agent-runs']({ runId: run.id }).trace;
+ expect((await route.get()).data).toMatchObject({
+ attempt: 2,
+ previousAttempt: 1,
+ sessionId: null,
+ });
+ expect((await route.get({ query: { attempt: 1 } })).data!.sessionId).toBe(sessionId);
+ expect((await route.get({ query: { attempt: 3 } })).status).toBe(404);
+ }, 20_000);
+
+ it('requires both read permissions and hides traces after an issue moves', async () => {
+ const { api, runner, run, issue } = await setup();
+ await runner['agent-runs']({ runId: run.id }).events.post({ attempt: 1, offset: 0, events });
+ for (const permissions of [{ work_items: { read: true } }, { ai_agents: { read: true } }]) {
+ const role = (
+ await createRole(api, 'RUN', { name: JSON.stringify(permissions), permissions })
+ ).data!;
+ const member = await addProjectMember(api, 'RUN', role.id);
+ expect((await member['agent-runs']({ runId: run.id }).trace.get()).status).toBe(403);
+ }
+ const other = (await createProject(api, { key: 'NEXT', name: 'Next' })).data!;
+ await api.issues({ issueId: issue.id }).move.post({ projectId: other.id });
+ expect((await api['agent-runs']({ runId: run.id }).trace.get()).status).toBe(404);
+ }, 20_000);
+
+ it('refuses another runner and bounds stored events without stopping the run', async () => {
+ const { api, runner, run } = await setup();
+ const other = (
+ await createAgent(api, 'RUN', { name: 'Other', username: 'other', kind: 'external' })
+ ).data!;
+ expect(
+ (
+ await apiKeyApi(other.apiKey!)
+ ['agent-runs']({ runId: run.id })
+ .events.post({ attempt: 1, offset: 0, events })
+ ).status,
+ ).toBe(404);
+ const large = Array.from({ length: 40 }, () => ({
+ type: 'TOOL_CALL_ARGS' as const,
+ toolCallId: 'tool',
+ delta: 'x'.repeat(32000),
+ }));
+ const ack = await runner['agent-runs']({ runId: run.id }).events.post({
+ attempt: 1,
+ offset: 0,
+ events: large,
+ });
+ expect(ack.data).toEqual({ nextOffset: 40, truncated: true });
+ const trace = (await api['agent-runs']({ runId: run.id }).trace.get()).data!;
+ expect(JSON.stringify(trace.events).length).toBeLessThan(1_000_000);
+ expect(
+ (await runner['agent-runs']({ runId: run.id }).result.post({ status: 'success' })).status,
+ ).toBe(204);
+ }, 20_000);
+
+ it('retains the trace of a manual scheduled run without an issue', async () => {
+ const { api, runner, run, created } = await setup();
+ await runner['agent-runs']({ runId: run.id }).result.post({ status: 'success' });
+ const schedule = (
+ await api.projects({ projectKey: 'RUN' })['agent-schedules'].post({
+ agentId: created.agent.id,
+ name: 'Manual',
+ cron: '0 9 * * *',
+ prompt: 'Inspect files',
+ })
+ ).data!;
+ await api
+ .projects({ projectKey: 'RUN' })
+ ['agent-schedules']({ scheduleId: schedule.id })
+ .run.post();
+ const manual = (await runner['agent-runs'].claim.post()).data!.run!;
+ expect(manual.issueId).toBeNull();
+ await runner['agent-runs']({ runId: manual.id }).events.post({
+ attempt: 1,
+ offset: 0,
+ events,
+ sessionId,
+ });
+ await runner['agent-runs']({ runId: manual.id }).result.post({ status: 'success' });
+ expect((await api['agent-runs']({ runId: manual.id }).trace.get()).data!.sessionId).toBe(
+ sessionId,
+ );
+ const history = (
+ await api
+ .projects({ projectKey: 'RUN' })
+ ['agent-schedules']({ scheduleId: schedule.id })
+ .runs.get()
+ ).data!;
+ expect(history[0].kind).toBe('external');
+ }, 20_000);
+});
diff --git a/apps/api/src/modules/agents/runner/index.ts b/apps/api/src/modules/agents/runner/index.ts
index 570a1a01..50c5eaf5 100644
--- a/apps/api/src/modules/agents/runner/index.ts
+++ b/apps/api/src/modules/agents/runner/index.ts
@@ -3,8 +3,16 @@ import { noContent } from '#shared/http';
import { HttpError } from '#shared/lib';
import { commonErrors, errors } from '#shared/responses';
import { runnerAuth } from '../runner-auth';
-import { ClaimResponse, resultBody, runParams } from './model';
+import {
+ ClaimResponse,
+ heartbeatBody,
+ resultBody,
+ runParams,
+ runEventsBody,
+ RunEventsAck,
+} from './model';
import { claimRunnerRun, finishRun, heartbeatRun } from './service';
+import { appendRunEvents } from './run-events';
// The queue an external agent's runner drains, authenticated with the agent's own
// API key.
@@ -28,14 +36,15 @@ export const agentRunnerRoutes = new Elysia({
.post(
'/agent-runs/:runId/heartbeat',
- async ({ agent, params }) => {
- const ok = await heartbeatRun(agent.id, params.runId);
+ async ({ agent, params, body }) => {
+ const ok = await heartbeatRun(agent.id, params.runId, body?.attempt);
if (!ok) throw new HttpError(404, 'Run not found');
return noContent();
},
{
runnerAgent: true,
params: runParams,
+ body: heartbeatBody,
response: { 204: t.Void(), ...commonErrors },
detail: {
summary: 'Extend a run lease',
@@ -44,6 +53,22 @@ export const agentRunnerRoutes = new Elysia({
},
)
+ .post(
+ '/agent-runs/:runId/events',
+ ({ agent, params, body }) => appendRunEvents(agent.id, params.runId, body),
+ {
+ runnerAgent: true,
+ params: runParams,
+ body: runEventsBody,
+ response: { 200: RunEventsAck, ...commonErrors, ...errors(409) },
+ detail: {
+ summary: 'Append external run events',
+ description:
+ 'Ordered, idempotent event batches for the current leased attempt. Session ids name local Codex threads.',
+ },
+ },
+ )
+
.post(
'/agent-runs/:runId/result',
async ({ agent, params, body }) => {
diff --git a/apps/api/src/modules/agents/runner/model.ts b/apps/api/src/modules/agents/runner/model.ts
index f05b200b..7376d3dc 100644
--- a/apps/api/src/modules/agents/runner/model.ts
+++ b/apps/api/src/modules/agents/runner/model.ts
@@ -1,5 +1,5 @@
import { t } from 'elysia';
-import { agentRunTrigger, contextUsageBody } from '../model';
+import { agentRunTrigger, contextUsageBody, AgUiEvent } from '../model';
// The run handed to a runner (RunnerRun from the service). `prompt` is the framed
// task, `systemPrompt` the instructions about the run itself; a runner passes the
@@ -10,6 +10,7 @@ export const RunnerRunResponse = t.Object({
prompt: t.String(),
systemPrompt: t.String(),
attempts: t.Number(),
+ traceEvents: t.Boolean(),
issueId: t.Nullable(t.Number()),
issueIdentifier: t.Nullable(t.String()),
});
@@ -20,7 +21,12 @@ export const ClaimResponse = t.Object({ run: t.Nullable(RunnerRunResponse) });
export const runParams = t.Object({ runId: t.Numeric() });
+export const heartbeatBody = t.Optional(
+ t.Object({ attempt: t.Optional(t.Integer({ minimum: 1 })) }),
+);
+
export const resultBody = t.Object({
+ attempt: t.Optional(t.Integer({ minimum: 1 })),
status: t.Union([t.Literal('success'), t.Literal('failed')], {
description: 'Whether the run completed or failed.',
}),
@@ -28,3 +34,25 @@ export const resultBody = t.Object({
error: t.Optional(t.Nullable(t.String({ description: 'Why the run failed.' }))),
usage: contextUsageBody,
});
+
+export const runEventsBody = t.Object({
+ attempt: t.Integer({ minimum: 1 }),
+ offset: t.Integer({ minimum: 0 }),
+ events: t.Array(AgUiEvent, { minItems: 1, maxItems: 200 }),
+ sessionId: t.Optional(t.String({ format: 'uuid' })),
+});
+export const RunEventsAck = t.Object({ nextOffset: t.Number(), truncated: t.Boolean() });
+
+export const externalTraceQuery = t.Object({
+ attempt: t.Optional(t.Numeric({ minimum: 1, multipleOf: 1 })),
+});
+export const ExternalTraceResponse = t.Nullable(
+ t.Object({
+ attempt: t.Number(),
+ previousAttempt: t.Nullable(t.Number()),
+ sessionId: t.Nullable(t.String()),
+ sessionUrl: t.Nullable(t.String()),
+ truncated: t.Boolean(),
+ events: t.Array(t.Object({ event: AgUiEvent, receivedAt: t.String() })),
+ }),
+);
diff --git a/apps/api/src/modules/agents/runner/run-events.ts b/apps/api/src/modules/agents/runner/run-events.ts
new file mode 100644
index 00000000..0c7fef3e
--- /dev/null
+++ b/apps/api/src/modules/agents/runner/run-events.ts
@@ -0,0 +1,119 @@
+import { db, agentRun, agentRunTrace, issue } from '@repo/db';
+import { and, desc, eq, isNull, lt, or, sql } from 'drizzle-orm';
+import { HttpError } from '#shared/lib';
+import type { AgUiEventBody } from '../model';
+
+const MAX_EVENTS = 2000;
+const MAX_BYTES = 1_000_000;
+
+export async function appendRunEvents(
+ agentId: number,
+ runId: number,
+ input: {
+ attempt: number;
+ offset: number;
+ events: AgUiEventBody[];
+ sessionId?: string;
+ },
+) {
+ return db.transaction(async (tx) => {
+ const [run] = await tx
+ .select()
+ .from(agentRun)
+ .where(
+ and(
+ eq(agentRun.id, runId),
+ eq(agentRun.agentId, agentId),
+ eq(agentRun.status, 'pending'),
+ eq(agentRun.attempts, input.attempt),
+ sql`${agentRun.executionStartedAt} IS NOT NULL AND ${agentRun.nextAttemptAt} > now()`,
+ ),
+ )
+ .for('update');
+ if (!run) throw new HttpError(404, 'Active run attempt not found');
+ await tx.insert(agentRunTrace).values({ runId, attempt: input.attempt }).onConflictDoNothing();
+ const key = and(eq(agentRunTrace.runId, runId), eq(agentRunTrace.attempt, input.attempt));
+ const [trace] = await tx.select().from(agentRunTrace).where(key);
+ if (input.offset < trace.nextOffset && input.offset + input.events.length <= trace.nextOffset) {
+ return { nextOffset: trace.nextOffset, truncated: trace.truncated };
+ }
+ if (input.offset !== trace.nextOffset) throw new HttpError(409, 'Unexpected trace offset');
+ if (trace.sessionId && input.sessionId && trace.sessionId !== input.sessionId) {
+ throw new HttpError(409, 'Session is already bound to this attempt');
+ }
+ const events = trace.events as { event: AgUiEventBody; receivedAt: string }[];
+ let bytes = Buffer.byteLength(JSON.stringify(events));
+ let truncated = trace.truncated;
+ const receivedAt = new Date().toISOString();
+ for (const event of input.events) {
+ const stored = { event, receivedAt };
+ const size = Buffer.byteLength(JSON.stringify(stored)) + 1;
+ if (truncated || events.length >= MAX_EVENTS || bytes + size > MAX_BYTES) {
+ truncated = true;
+ continue;
+ }
+ events.push(stored);
+ bytes += size;
+ }
+ const nextOffset = input.offset + input.events.length;
+ await tx
+ .update(agentRunTrace)
+ .set({
+ events,
+ nextOffset,
+ truncated,
+ sessionId: trace.sessionId ?? input.sessionId ?? null,
+ })
+ .where(key);
+ await tx.execute(sql`SELECT bump_rev(${'runner-queue:' + run.projectId}, ${run.projectId})`);
+ return { nextOffset, truncated };
+ });
+}
+
+export async function runProjectId(runId: number) {
+ const [row] = await db
+ .select({ projectId: agentRun.projectId })
+ .from(agentRun)
+ .leftJoin(issue, eq(issue.id, agentRun.issueId))
+ .where(
+ and(
+ eq(agentRun.id, runId),
+ or(isNull(agentRun.issueId), eq(issue.projectId, agentRun.projectId)),
+ ),
+ );
+ return row?.projectId;
+}
+
+export async function readRunTrace(projectId: number, runId: number, attempt?: number) {
+ const [row] = await db
+ .select({ trace: agentRunTrace })
+ .from(agentRunTrace)
+ .innerJoin(agentRun, eq(agentRun.id, agentRunTrace.runId))
+ .leftJoin(issue, eq(issue.id, agentRun.issueId))
+ .where(
+ and(
+ eq(agentRun.id, runId),
+ eq(agentRun.projectId, projectId),
+ or(isNull(agentRun.issueId), eq(issue.projectId, projectId)),
+ attempt == null ? undefined : eq(agentRunTrace.attempt, attempt),
+ ),
+ )
+ .orderBy(desc(agentRunTrace.attempt))
+ .limit(1);
+ if (!row) return attempt == null ? null : undefined;
+ const trace = row.trace;
+ const [previous] = await db
+ .select({ attempt: agentRunTrace.attempt })
+ .from(agentRunTrace)
+ .where(and(eq(agentRunTrace.runId, runId), lt(agentRunTrace.attempt, trace.attempt)))
+ .orderBy(desc(agentRunTrace.attempt))
+ .limit(1);
+ return {
+ attempt: trace.attempt,
+ previousAttempt: previous?.attempt ?? null,
+ sessionId: trace.sessionId,
+ sessionUrl: trace.sessionId ? `codex://threads/${trace.sessionId}` : null,
+ truncated: trace.truncated,
+ events: trace.events,
+ };
+}
diff --git a/apps/api/src/modules/agents/runner/service.ts b/apps/api/src/modules/agents/runner/service.ts
index e890aa3a..80a31ede 100644
--- a/apps/api/src/modules/agents/runner/service.ts
+++ b/apps/api/src/modules/agents/runner/service.ts
@@ -1,5 +1,5 @@
import { db, aiAgent, agentRun, project, projectMember } from '@repo/db';
-import { and, eq, sql } from 'drizzle-orm';
+import { and, eq, isNotNull, isNull, or, sql } from 'drizzle-orm';
import { HttpError } from '#shared/lib';
import { type ContextUsage } from '../chat-usage';
import {
@@ -7,6 +7,7 @@ import {
deferRun,
issueRunTurn,
loadThreadContext,
+ markRunExecuting,
runRetryDelayMs,
scheduleRunRetry,
} from '../core/run-queue';
@@ -83,6 +84,7 @@ export async function getRunnerAgent(userId: string): Promise<RunnerAgent | null
}
export interface RunnerRun {
+ traceEvents: boolean;
id: number;
trigger: AgentRunTrigger;
// The task as the agent should read it: the trigger text framed with what started
@@ -100,7 +102,7 @@ export interface RunnerRun {
// The claim's raw row, before framing. The extra people columns exist only to build
// the prompts and are not handed to the runner.
-type ClaimedRow = Omit<RunnerRun, 'systemPrompt'> & {
+type ClaimedRow = Omit<RunnerRun, 'systemPrompt' | 'traceEvents'> & {
// The project the run works in, which is what its system prompt names.
projectId: number;
projectKey: string;
@@ -128,7 +130,12 @@ export async function touchRunner(agentId: number): Promise<void> {
async function expireExhaustedRuns(agent: RunnerAgent): Promise<void> {
const rows = await db
.update(agentRun)
- .set({ status: 'failed', lastError: 'Runner did not report a result', finishedAt: new Date() })
+ .set({
+ status: 'failed',
+ executionStartedAt: null,
+ lastError: 'Runner did not report a result',
+ finishedAt: new Date(),
+ })
.where(
and(
eq(agentRun.agentId, agent.id),
@@ -166,6 +173,7 @@ export async function takeNextRun(agent: RunnerAgent): Promise<RunnerRun | null>
UPDATE agent_run r
SET attempts = r.attempts + 1,
started_at = coalesce(r.started_at, now()),
+ execution_started_at = NULL,
next_attempt_at = now() + make_interval(secs => ${agentRunConfig.leaseSeconds()})
WHERE r.id = (
SELECT id FROM agent_run q
@@ -226,7 +234,8 @@ export async function takeNextRun(agent: RunnerAgent): Promise<RunnerRun | null>
await scheduleRunRetry(row.id, runRetryDelayMs(row.attempts), message);
return null;
}
- return {
+ const result = {
+ traceEvents: true,
id: row.id,
trigger: row.trigger,
prompt: framePrompt(forPrompt),
@@ -239,6 +248,8 @@ export async function takeNextRun(agent: RunnerAgent): Promise<RunnerRun | null>
issueId: row.issueId,
issueIdentifier: row.issueIdentifier,
};
+ if (!(await markRunExecuting(row.id, row.attempts))) return null;
+ return result;
}
// What the agent is told about the run before the task itself: the project the run
@@ -259,13 +270,27 @@ function buildSystemPrompt(agent: RunnerAgent, project: RunnerProject, run: RunF
// can outlive the lease by far, so the runner sends this periodically; without it the
// run would be handed to another runner mid-flight. False when the run is not this
// agent's, or is already finished.
-export async function heartbeatRun(agentId: number, runId: number): Promise<boolean> {
+export async function heartbeatRun(
+ agentId: number,
+ runId: number,
+ attempt?: number,
+): Promise<boolean> {
await touchRunner(agentId);
const rows = await db
.update(agentRun)
- .set({ nextAttemptAt: sql`now() + make_interval(secs => ${agentRunConfig.leaseSeconds()})` })
+ .set({
+ executionStartedAt: sql`coalesce(${agentRun.executionStartedAt}, now())`,
+ nextAttemptAt: sql`now() + make_interval(secs => ${agentRunConfig.leaseSeconds()})`,
+ })
.where(
- and(eq(agentRun.id, runId), eq(agentRun.agentId, agentId), eq(agentRun.status, 'pending')),
+ and(
+ eq(agentRun.id, runId),
+ eq(agentRun.agentId, agentId),
+ eq(agentRun.status, 'pending'),
+ attempt == null ? undefined : eq(agentRun.attempts, attempt),
+ isNotNull(agentRun.startedAt),
+ or(isNotNull(agentRun.executionStartedAt), isNull(agentRun.lastError)),
+ ),
)
.returning({ id: agentRun.id });
return rows.length > 0;
@@ -279,6 +304,7 @@ export async function finishRun(
runId: number,
result: {
status: 'success' | 'failed';
+ attempt?: number;
output?: string | null;
error?: string | null;
usage?: ContextUsage | null;
@@ -289,6 +315,7 @@ export async function finishRun(
.update(agentRun)
.set({
status: result.status,
+ executionStartedAt: null,
output: result.output?.slice(0, 10_000) ?? null,
lastError: result.status === 'failed' ? (result.error?.slice(0, 500) ?? 'Run failed') : null,
inputTokens: result.usage?.inputTokens ?? null,
@@ -296,7 +323,12 @@ export async function finishRun(
finishedAt: new Date(),
})
.where(
- and(eq(agentRun.id, runId), eq(agentRun.agentId, agent.id), eq(agentRun.status, 'pending')),
+ and(
+ eq(agentRun.id, runId),
+ eq(agentRun.agentId, agent.id),
+ eq(agentRun.status, 'pending'),
+ result.attempt == null ? undefined : eq(agentRun.attempts, result.attempt),
+ ),
)
.returning({ issueId: agentRun.issueId });
const row = rows[0];
diff --git a/apps/api/src/modules/agents/schedules/issue-runs.ts b/apps/api/src/modules/agents/schedules/issue-runs.ts
index 32376805..986ceb8c 100644
--- a/apps/api/src/modules/agents/schedules/issue-runs.ts
+++ b/apps/api/src/modules/agents/schedules/issue-runs.ts
@@ -43,7 +43,7 @@ export async function queueStatusRuns(
if (issueIds.length === 0) return;
await db
.update(agentRun)
- .set({ status: 'canceled', finishedAt: new Date() })
+ .set({ status: 'canceled', executionStartedAt: null, finishedAt: new Date() })
.where(
and(
inArray(agentRun.issueId, issueIds),
diff --git a/apps/api/src/modules/agents/schedules/model.ts b/apps/api/src/modules/agents/schedules/model.ts
index 1e2c10cc..a37f2bd8 100644
--- a/apps/api/src/modules/agents/schedules/model.ts
+++ b/apps/api/src/modules/agents/schedules/model.ts
@@ -1,7 +1,7 @@
import { t } from 'elysia';
import { pageQueryFields, pageResponse } from '#shared/pagination';
-import { runContextTokens } from '../model';
+import { runContextTokens, agentExecutionState } from '../model';
export const scheduleParams = t.Object({
projectKey: t.String(),
@@ -119,7 +119,9 @@ export const agentSchedulePageQuery = t.Object(pageQueryFields);
// `output` once the run has finished.
export const ScheduleRunResponse = t.Object({
id: t.Number(),
+ kind: t.String(),
status: t.String(),
+ executionState: agentExecutionState,
trigger: t.String(),
prompt: t.String(),
attempts: t.Number(),
diff --git a/apps/api/src/modules/agents/schedules/service.ts b/apps/api/src/modules/agents/schedules/service.ts
index c820a66c..a375836a 100644
--- a/apps/api/src/modules/agents/schedules/service.ts
+++ b/apps/api/src/modules/agents/schedules/service.ts
@@ -1,11 +1,11 @@
import { db, agentRun, agentSchedule, aiAgent, projectColumn, user } from '@repo/db';
-import { and, desc, eq, isNull, sql } from 'drizzle-orm';
+import { and, desc, eq, getTableColumns, isNull, sql } from 'drizzle-orm';
import { HttpError, iso, rethrowDuplicate } from '#shared/lib';
import { getTeamLimits } from '#shared/limits';
import { minCronIntervalSeconds, nextCronRun } from './cron';
import { isScheduleSupported, type ScheduleOptions } from './extension';
import { agentWorksInProject, canTriggerAgent, isTriggerableBy } from '../core/service';
-import { contextTokensOf } from '../core/run-queue';
+import { contextTokensOf, executionState } from '../core/run-queue';
import { deleteThreadsWhere } from '../core/runtime/memory';
export type AgentScheduleStatus = 'active' | 'paused';
@@ -360,7 +360,7 @@ export async function cancelPendingScheduleRuns(
await assertTriggerable(schedule.agentId, actorUserId);
const rows = await db
.update(agentRun)
- .set({ status: 'canceled', finishedAt: new Date() })
+ .set({ status: 'canceled', executionStartedAt: null, finishedAt: new Date() })
.where(
and(
eq(agentRun.scheduleId, scheduleId),
@@ -374,8 +374,10 @@ export async function cancelPendingScheduleRuns(
}
export interface ScheduleRunRow {
+ kind: string;
id: number;
status: string;
+ executionState: 'queued' | 'running' | 'success' | 'failed' | 'canceled';
trigger: string;
prompt: string;
attempts: number;
@@ -398,14 +400,17 @@ export async function listScheduleRuns(
const schedule = await getAgentSchedule(projectId, scheduleId, actorUserId);
if (!schedule) return null;
const rows = await db
- .select()
+ .select({ ...getTableColumns(agentRun), executionState, kind: aiAgent.kind })
.from(agentRun)
+ .innerJoin(aiAgent, eq(aiAgent.id, agentRun.agentId))
.where(eq(agentRun.scheduleId, scheduleId))
.orderBy(desc(agentRun.id))
.limit(50);
return rows.map((row) => ({
id: row.id,
+ kind: row.kind,
status: row.status,
+ executionState: row.executionState,
trigger: row.trigger,
prompt: row.prompt,
attempts: row.attempts,
diff --git a/apps/api/src/modules/issues/__tests__/integration/agent-runs.test.ts b/apps/api/src/modules/issues/__tests__/integration/agent-runs.test.ts
new file mode 100644
index 00000000..08ffc17f
--- /dev/null
+++ b/apps/api/src/modules/issues/__tests__/integration/agent-runs.test.ts
@@ -0,0 +1,271 @@
+import { beforeEach, describe, expect, it } from 'bun:test';
+import { SpanType } from '@mastra/core/observability';
+import { apiKeyApi, authedApi, createProject } from '#tests/helpers/app';
+import { signUpTestUser } from '#tests/helpers/auth';
+import { resetDb } from '#tests/helpers/db';
+import { createAgent } from '#tests/helpers/agents';
+import { createRole } from '#tests/helpers/roles';
+import { addProjectMember } from '#tests/helpers/members';
+import { getStore } from '#modules/agents/core/runtime/store';
+
+async function setup() {
+ const owner = await signUpTestUser();
+ const api = authedApi(owner.cookie);
+ await createProject(api, { key: 'RUN', name: 'Runs' });
+ const project = (await api.projects({ projectKey: 'RUN' }).get()).data!;
+ const agent = (
+ await createAgent(api, 'RUN', {
+ name: 'Reviewer',
+ username: 'reviewer',
+ kind: 'internal',
+ })
+ ).data!.agent;
+ const issue = (
+ await api.projects({ projectKey: 'RUN' }).issues.post({
+ title: 'Review this',
+ columnId: project.columns[0].id,
+ })
+ ).data!;
+ await api.issues({ issueId: issue.id }).comments.post({ body: '@reviewer review this' });
+ return { api, issue, agent };
+}
+
+async function seedTrace(traceId: string, metadata: Record<string, unknown>, startedAt: Date) {
+ await getStore().init();
+ const store = (await getStore().getStore('observability'))!;
+ await store.createSpan({
+ span: {
+ traceId,
+ spanId: `${traceId}-root`,
+ name: 'Review',
+ spanType: SpanType.AGENT_RUN,
+ isEvent: false,
+ startedAt,
+ endedAt: new Date(startedAt.getTime() + 100),
+ input: 'Review this',
+ output: 'Reviewed',
+ metadata,
+ },
+ });
+ await store.createSpan({
+ span: {
+ traceId,
+ spanId: `${traceId}-tool`,
+ parentSpanId: `${traceId}-root`,
+ name: 'get_issue',
+ spanType: SpanType.TOOL_CALL,
+ isEvent: false,
+ startedAt,
+ endedAt: new Date(startedAt.getTime() + 50),
+ input: { issueId: metadata.issueId },
+ output: { title: 'Review this' },
+ },
+ });
+}
+
+describe('issue agent runs', () => {
+ beforeEach(resetDb);
+
+ it('pages only the requested issue, newest first', async () => {
+ const { api, issue, agent } = await setup();
+ await api.issues({ issueId: issue.id }).comments.post({ body: '@reviewer another review' });
+ const project = (await api.projects({ projectKey: 'RUN' }).get()).data!;
+ const other = (
+ await api.projects({ projectKey: 'RUN' }).issues.post({
+ title: 'Other',
+ columnId: project.columns[0].id,
+ })
+ ).data!;
+ await api.issues({ issueId: other.id }).comments.post({ body: '@reviewer unrelated' });
+ const route = api.issues({ issueId: issue.id })['agent-runs'];
+ const first = await route.get({ query: { limit: 1 } });
+ expect(first.status).toBe(200);
+ expect(first.data!.items).toHaveLength(1);
+ expect(first.data!.items[0]).toMatchObject({
+ agentId: agent.id,
+ username: 'reviewer',
+ status: 'pending',
+ attempts: 0,
+ output: null,
+ lastError: null,
+ startedAt: null,
+ finishedAt: null,
+ });
+ expect(first.data!.items[0].prompt).toContain('another review');
+ const second = await route.get({ query: { limit: 1, before: first.data!.nextCursor! } });
+ expect(second.data!.items).toHaveLength(1);
+ expect(second.data!.items[0].prompt).toContain('review this');
+ expect(second.data!.items[0].id).toBeLessThan(first.data!.items[0].id);
+ expect(second.data!.nextCursor).toBeNull();
+ });
+
+ it('requires both work item and agent read access', async () => {
+ const { api, issue } = await setup();
+ const run = (await api.issues({ issueId: issue.id })['agent-runs'].get()).data!.items[0];
+ for (const permissions of [{ work_items: { read: true } }, { ai_agents: { read: true } }]) {
+ const role = await createRole(api, 'RUN', { name: JSON.stringify(permissions), permissions });
+ const member = await addProjectMember(api, 'RUN', role.data!.id);
+ expect((await member.issues({ issueId: issue.id })['agent-runs'].get()).status).toBe(403);
+ const trace = await member
+ .issues({ issueId: issue.id })
+ ['agent-runs']({ runId: run.id })
+ .trace.get();
+ expect(trace.status).toBe(403);
+ }
+ const role = await createRole(api, 'RUN', {
+ name: 'Run reader',
+ permissions: { work_items: { read: true }, ai_agents: { read: true } },
+ });
+ const member = await addProjectMember(api, 'RUN', role.data!.id);
+ expect((await member.issues({ issueId: issue.id })['agent-runs'].get()).status).toBe(200);
+ });
+
+ it('rejects missing issues and invalid page bounds', async () => {
+ const { api, issue } = await setup();
+ expect((await api.issues({ issueId: issue.id + 1000 })['agent-runs'].get()).status).toBe(404);
+ for (const limit of [0, 51, 1.5]) {
+ const response = await api
+ .issues({ issueId: issue.id })
+ ['agent-runs'].get({ query: { limit } });
+ expect(response.status).toBe(400);
+ }
+ });
+
+ it('does not show prompts from the former project of a moved issue', async () => {
+ const { api, issue } = await setup();
+ const run = (await api.issues({ issueId: issue.id })['agent-runs'].get()).data!.items[0];
+ const target = (await createProject(api, { key: 'NEXT', name: 'Next' })).data!;
+ const moved = await api.issues({ issueId: issue.id }).move.post({ projectId: target.id });
+ expect(moved.status).toBe(200);
+ const route = api.issues({ issueId: issue.id })['agent-runs'];
+ expect((await route.get()).data).toEqual({ items: [], nextCursor: null });
+ expect((await route({ runId: run.id }).trace.get()).status).toBe(404);
+ });
+
+ it('returns no trace before one is recorded and rejects an unrelated run', async () => {
+ const { api, issue } = await setup();
+ const route = api.issues({ issueId: issue.id })['agent-runs'];
+ const run = (await route.get()).data!.items[0];
+ const trace = await route({ runId: run.id }).trace.get();
+ expect(trace.status).toBe(200);
+ expect(trace.data).toBeNull();
+ expect((await route({ runId: run.id + 1000 }).trace.get()).status).toBe(404);
+ });
+
+ it('opens the latest recorded attempt with its tool input and output', async () => {
+ const { api, issue, agent } = await setup();
+ const route = api.issues({ issueId: issue.id })['agent-runs'];
+ const run = (await route.get()).data!.items[0];
+ const metadata = {
+ agentId: agent.id,
+ runId: run.id,
+ issueId: issue.id,
+ projectId: issue.projectId,
+ };
+ await seedTrace('issue-run-old', metadata, new Date('2026-01-01T00:00:00Z'));
+ await seedTrace('issue-run-latest', metadata, new Date('2026-01-02T00:00:00Z'));
+ await seedTrace(
+ 'issue-run-private',
+ { ...metadata, userId: 'another-person' },
+ new Date('2026-01-03T00:00:00Z'),
+ );
+ const trace = await route({ runId: run.id }).trace.get();
+ expect(trace.status).toBe(200);
+ expect(trace.data!.trace.traceId).toBe('issue-run-latest');
+ expect(trace.data!.previousTraceId).toBe('issue-run-old');
+ const earlier = await route({ runId: run.id }).trace.get({
+ query: { traceId: trace.data!.previousTraceId! },
+ });
+ expect(earlier.data!.trace.traceId).toBe('issue-run-old');
+ expect(earlier.data!.previousTraceId).toBeNull();
+ const privateTrace = await route({ runId: run.id }).trace.get({
+ query: { traceId: 'issue-run-private' },
+ });
+ expect(privateTrace.status).toBe(404);
+ const missingTrace = await route({ runId: run.id }).trace.get({
+ query: { traceId: 'missing' },
+ });
+ expect(missingTrace.status).toBe(404);
+ expect(trace.data!.spans).toContainEqual(
+ expect.objectContaining({
+ name: 'get_issue',
+ input: { issueId: issue.id },
+ output: { title: 'Review this' },
+ }),
+ );
+ });
+
+ it('rejects traces of another issue, project or run', async () => {
+ const { api, issue, agent } = await setup();
+ const route = api.issues({ issueId: issue.id })['agent-runs'];
+ const run = (await route.get()).data!.items[0];
+ const metadata = {
+ agentId: agent.id,
+ runId: run.id,
+ issueId: issue.id,
+ projectId: issue.projectId,
+ };
+ for (const [traceId, otherScope] of [
+ ['other-issue', { issueId: issue.id + 1000 }],
+ ['other-project', { projectId: issue.projectId + 1000 }],
+ ['other-run', { runId: run.id + 1000 }],
+ ] as const) {
+ await seedTrace(traceId, { ...metadata, ...otherScope }, new Date());
+ const trace = await route({ runId: run.id }).trace.get({ query: { traceId } });
+ expect(trace.status).toBe(404);
+ }
+ expect((await route({ runId: run.id }).trace.get()).data).toBeNull();
+ });
+
+ it('orders attempts with equal start times without repeating the cursor', async () => {
+ const { api, issue, agent } = await setup();
+ const route = api.issues({ issueId: issue.id })['agent-runs'];
+ const run = (await route.get()).data!.items[0];
+ const metadata = {
+ agentId: agent.id,
+ runId: run.id,
+ issueId: issue.id,
+ projectId: issue.projectId,
+ };
+ const startedAt = new Date('2026-01-01T00:00:00Z');
+ await seedTrace('attempt-a', metadata, startedAt);
+ await seedTrace('attempt-z', metadata, startedAt);
+ const latest = await route({ runId: run.id }).trace.get();
+ expect(latest.data!.trace.traceId).toBe('attempt-z');
+ expect(latest.data!.previousTraceId).toBe('attempt-a');
+ const previous = await route({ runId: run.id }).trace.get({ query: { traceId: 'attempt-a' } });
+ expect(previous.data!.trace.traceId).toBe('attempt-a');
+ expect(previous.data!.previousTraceId).toBeNull();
+ });
+
+ it('shows the output and error reported by an external runner', async () => {
+ const { api, issue } = await setup();
+ const created = await createAgent(api, 'RUN', {
+ name: 'External',
+ username: 'external',
+ kind: 'external',
+ triggerOnMention: true,
+ });
+ const runner = apiKeyApi(created.data!.apiKey!);
+ for (const status of ['success', 'failed'] as const) {
+ await api.issues({ issueId: issue.id }).comments.post({ body: '@external review this' });
+ const run = (await runner['agent-runs'].claim.post()).data!.run!;
+ await runner['agent-runs']({ runId: run.id }).result.post({
+ status,
+ output: 'Review output',
+ error: status === 'failed' ? 'Command exited with 1' : undefined,
+ });
+ const history = (await api.issues({ issueId: issue.id })['agent-runs'].get()).data!;
+ expect(history.items[0]).toMatchObject({
+ id: run.id,
+ kind: 'external',
+ status,
+ output: 'Review output',
+ lastError: status === 'failed' ? 'Command exited with 1' : null,
+ attempts: 1,
+ });
+ expect(history.items[0].startedAt).not.toBeNull();
+ expect(history.items[0].finishedAt).not.toBeNull();
+ }
+ });
+});
diff --git a/apps/api/src/modules/issues/agent-runs.ts b/apps/api/src/modules/issues/agent-runs.ts
new file mode 100644
index 00000000..08e395d8
--- /dev/null
+++ b/apps/api/src/modules/issues/agent-runs.ts
@@ -0,0 +1,83 @@
+import { db, agentRun, aiAgent, issue } from '@repo/db';
+import { and, desc, eq, lt } from 'drizzle-orm';
+import { iso } from '#shared/lib';
+import { contextTokensOf, executionState } from '#modules/agents/core/run-queue';
+import { getRunTrace } from '#modules/agents/core/runtime/traces';
+
+export async function listIssueAgentRuns(
+ projectId: number,
+ issueId: number,
+ before?: number,
+ limit = 25,
+) {
+ const rows = await db
+ .select({
+ id: agentRun.id,
+ agentId: agentRun.agentId,
+ username: aiAgent.username,
+ kind: aiAgent.kind,
+ status: agentRun.status,
+ executionState,
+ trigger: agentRun.trigger,
+ prompt: agentRun.prompt,
+ output: agentRun.output,
+ attempts: agentRun.attempts,
+ lastError: agentRun.lastError,
+ inputTokens: agentRun.inputTokens,
+ outputTokens: agentRun.outputTokens,
+ createdAt: agentRun.createdAt,
+ startedAt: agentRun.startedAt,
+ finishedAt: agentRun.finishedAt,
+ nextAttemptAt: agentRun.nextAttemptAt,
+ })
+ .from(agentRun)
+ .innerJoin(aiAgent, eq(aiAgent.id, agentRun.agentId))
+ .innerJoin(issue, eq(issue.id, agentRun.issueId))
+ .where(
+ and(
+ eq(issue.id, issueId),
+ // A moved issue does not grant access to prompts from its former project.
+ eq(agentRun.projectId, projectId),
+ eq(issue.projectId, projectId),
+ before == null ? undefined : lt(agentRun.id, before),
+ ),
+ )
+ .orderBy(desc(agentRun.id))
+ .limit(limit + 1);
+ const hasMore = rows.length > limit;
+ const page = rows.slice(0, limit);
+ return {
+ items: page.map(({ inputTokens, outputTokens, ...row }) => ({
+ ...row,
+ ...contextTokensOf({ inputTokens, outputTokens }),
+ createdAt: iso(row.createdAt),
+ startedAt: row.startedAt ? iso(row.startedAt) : null,
+ finishedAt: row.finishedAt ? iso(row.finishedAt) : null,
+ nextAttemptAt: iso(row.nextAttemptAt),
+ })),
+ nextCursor: hasMore ? page[page.length - 1].id : null,
+ };
+}
+
+export async function getIssueAgentRunTrace(
+ projectId: number,
+ issueId: number,
+ runId: number,
+ viewerId: string,
+ traceId?: string,
+) {
+ const [run] = await db
+ .select({ agentId: agentRun.agentId })
+ .from(agentRun)
+ .innerJoin(issue, eq(issue.id, agentRun.issueId))
+ .where(
+ and(
+ eq(agentRun.id, runId),
+ eq(issue.id, issueId),
+ eq(agentRun.projectId, projectId),
+ eq(issue.projectId, projectId),
+ ),
+ );
+ if (!run) return undefined;
+ return getRunTrace(run.agentId, runId, projectId, issueId, viewerId, traceId);
+}
diff --git a/apps/api/src/modules/issues/index.ts b/apps/api/src/modules/issues/index.ts
index 5676b989..4f51276e 100644
--- a/apps/api/src/modules/issues/index.ts
+++ b/apps/api/src/modules/issues/index.ts
@@ -1,4 +1,5 @@
-import { Elysia, t } from 'elysia';
+import { Elysia, t, type DocumentDecoration } from 'elysia';
+import { listIssueAgentRuns, getIssueAgentRunTrace } from './agent-runs';
import { mcpTool } from '#mcp/generate';
import { noContent } from '#shared/http';
import { guards, entityGuard, assertMcpAllowed, requiresPermission } from '#shared/guards';
@@ -93,6 +94,11 @@ import {
import {
issueParams,
+ issueAgentRunsQuery,
+ issueAgentRunParams,
+ IssueAgentRunPageResponse,
+ IssueAgentRunTraceResponse,
+ issueAgentTraceQuery,
issueDevelopmentLinkParams,
issueDevelopmentRepositoryParams,
issueDevelopmentListQuery,
@@ -198,6 +204,21 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues
// entry and a comment belong to the issue that carries them, so they all resolve
// to the same work_items permission.
.macro({
+ issueAgentRuns(_enabled: boolean) {
+ return {
+ detail: requiresPermission(['ai_agents', 'read']) as DocumentDecoration,
+ async resolve({ params, user, request }) {
+ const projectId = await getIssueProjectId(
+ Number((params as { issueId: string }).issueId),
+ );
+ if (projectId == null) throw new HttpError(404, 'Issue not found');
+ await assertPermission(projectId, user, 'work_items', 'read');
+ await assertPermission(projectId, user, 'ai_agents', 'read');
+ await assertMcpAllowed(projectId, request.headers);
+ return { projectId };
+ },
+ };
+ },
workItem: entityGuard('work_items', 'Issue not found', (p) =>
getIssueProjectId(Number(p.issueId)),
),
@@ -1104,6 +1125,53 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues
},
)
+ .get(
+ '/issues/:issueId/agent-runs',
+ async ({ params, query, projectId }) =>
+ listIssueAgentRuns(projectId, params.issueId, query.before, query.limit),
+ {
+ params: issueParams,
+ query: issueAgentRunsQuery,
+ issueAgentRuns: true,
+ response: { 200: IssueAgentRunPageResponse, ...commonErrors },
+ detail: {
+ summary: "List an issue's agent runs",
+ description:
+ 'Triggered runs in the current project, newest first, including the prompt, result and error.',
+ },
+ },
+ )
+
+ .get(
+ '/issues/:issueId/agent-runs/:runId/trace',
+ async ({ params, user, query, projectId }) => {
+ const trace = await getIssueAgentRunTrace(
+ projectId,
+ params.issueId,
+ params.runId,
+ requireUser(user).id,
+ query.traceId,
+ );
+ if (trace === undefined) throw new HttpError(404, 'Run not found');
+ return Response.json(trace);
+ },
+ {
+ params: issueAgentRunParams,
+ query: issueAgentTraceQuery,
+ issueAgentRuns: true,
+ response: {
+ 200: IssueAgentRunTraceResponse,
+ ...commonErrors,
+ },
+ detail: {
+ summary: "Read an issue run's trace",
+ description:
+ 'The selected or latest recorded attempt, with a link to the previous one. ' +
+ 'Null when no latest trace is available.',
+ },
+ },
+ )
+
// The time logged on the issue. The entries are their own read: the issue payload
// carries their sum, which is what a board and the Time property show, and only
// the section that lists them needs the entries themselves.
diff --git a/apps/api/src/modules/issues/model.ts b/apps/api/src/modules/issues/model.ts
index 0cf8cc7a..4eeabcdc 100644
--- a/apps/api/src/modules/issues/model.ts
+++ b/apps/api/src/modules/issues/model.ts
@@ -1,6 +1,8 @@
import { t } from 'elysia';
+import { agentExecutionState } from '#modules/agents/model';
import { ActivityPayloadResponse } from '#shared/activity';
import { DevelopmentLinkResponse } from '#modules/git/model';
+import { AgentTraceDetailResponse } from '#modules/agents/core/model';
import { isoDate } from '#shared/schemas';
// Ceiling of every markdown text written on an issue: the description, a comment
@@ -690,3 +692,48 @@ export const BulkDeletedResponse = t.Object({ deleted: t.Number() });
export const BoardResponse = t.Object({ issues: t.Array(BoardIssueResponse) });
export const WatchStateResponse = t.Object({ ok: t.Boolean() });
+
+export const issueAgentRunsQuery = t.Object({
+ before: t.Optional(t.Numeric({ minimum: 1, multipleOf: 1 })),
+ limit: t.Optional(t.Numeric({ minimum: 1, maximum: 50, multipleOf: 1, default: 25 })),
+});
+
+export const issueAgentRunParams = t.Object({
+ issueId: t.Numeric(),
+ runId: t.Numeric(),
+});
+
+export const IssueAgentRunPageResponse = t.Object({
+ items: t.Array(
+ t.Object({
+ id: t.Number(),
+ agentId: t.Number(),
+ username: t.String(),
+ kind: t.String(),
+ status: t.String(),
+ executionState: agentExecutionState,
+ trigger: t.String(),
+ prompt: t.String(),
+ output: t.Nullable(t.String()),
+ attempts: t.Number(),
+ lastError: t.Nullable(t.String()),
+ contextTokens: t.Optional(t.Number()),
+ createdAt: t.String(),
+ startedAt: t.Nullable(t.String()),
+ finishedAt: t.Nullable(t.String()),
+ nextAttemptAt: t.String(),
+ }),
+ ),
+ nextCursor: t.Nullable(t.Number()),
+});
+
+export const issueAgentTraceQuery = t.Object({
+ traceId: t.Optional(t.String({ minLength: 1, maxLength: 128 })),
+});
+
+export const IssueAgentRunTraceResponse = t.Nullable(
+ t.Object({
+ ...AgentTraceDetailResponse.properties,
+ previousTraceId: t.Nullable(t.String()),
+ }),
+);
diff --git a/apps/api/src/modules/issues/move.ts b/apps/api/src/modules/issues/move.ts
index 61670a9f..8cd105ee 100644
--- a/apps/api/src/modules/issues/move.ts
+++ b/apps/api/src/modules/issues/move.ts
@@ -211,7 +211,7 @@ export async function moveIssue(
);
await tx
.update(agentRun)
- .set({ status: 'canceled', finishedAt: sql`now()` })
+ .set({ status: 'canceled', executionStartedAt: null, finishedAt: sql`now()` })
.where(and(inArray(agentRun.issueId, movedIds), eq(agentRun.status, 'pending')));
});
diff --git a/apps/api/src/modules/sync/index.ts b/apps/api/src/modules/sync/index.ts
index f4e2cda1..70b3715c 100644
--- a/apps/api/src/modules/sync/index.ts
+++ b/apps/api/src/modules/sync/index.ts
@@ -1,3 +1,5 @@
+import { isMcpRequest } from '#shared/mcp-request';
+import { runnerQueueRevision } from '#modules/agents/queue/service';
import { Elysia } from 'elysia';
import { authContext } from '#shared/auth-context';
import { requireUser } from '#shared/access';
@@ -17,7 +19,7 @@ export const syncRoutes = new Elysia({ name: 'sync', detail: { tags: ['Sync'] }
.get(
'/sync/rev',
- async ({ user, query }) => {
+ async ({ user, query, request }) => {
const userId = requireUser(user).id;
const requested = query.scopes
.split(',')
@@ -31,6 +33,7 @@ export const syncRoutes = new Elysia({ name: 'sync', detail: { tags: ['Sync'] }
// knowing how a scope is stored.
const reads = new Map<string, ScopeRead>();
for (const scope of requested) {
+ if (scope === 'runnerQueue:1') continue;
const [kind, rawId] = scope.split(':');
// Own properties only: an inherited name like '__proto__' is not a kind.
const spec = kind && Object.hasOwn(scopeKind, kind) ? scopeKind[kind] : undefined;
@@ -42,11 +45,13 @@ export const syncRoutes = new Elysia({ name: 'sync', detail: { tags: ['Sync'] }
}
const found = await readRevs([...reads.values()], userId);
- return {
- revs: Object.fromEntries(
- [...reads].map(([scope, read]) => [scope, found[read.key] ?? NO_REV]),
- ),
- };
+ const revs = Object.fromEntries(
+ [...reads].map(([scope, read]) => [scope, found[read.key] ?? NO_REV]),
+ );
+ if (requested.includes('runnerQueue:1')) {
+ revs['runnerQueue:1'] = await runnerQueueRevision(userId, isMcpRequest(request.headers));
+ }
+ return { revs };
},
{
query: revQuery,
diff --git a/apps/api/src/planner.ts b/apps/api/src/planner.ts
index 31d7d489..a69db694 100644
--- a/apps/api/src/planner.ts
+++ b/apps/api/src/planner.ts
@@ -38,6 +38,7 @@ import { settingsRoutes } from './modules/settings';
import { godRoutes } from './modules/god';
import { agentScheduleRoutes } from './modules/agents/schedules';
import { modelPriceRoutes } from './modules/agents/prices';
+import { runnerQueueRoutes } from './modules/agents/queue';
import { agentRunnerRoutes } from './modules/agents/runner';
import { agentChatRoutes } from './modules/agents/chat';
import { agentInvocationRoutes } from './modules/agents/invocation';
@@ -100,6 +101,7 @@ export const planner = new Elysia({ name: 'planner' })
.use(agentScheduleRoutes)
.use(modelPriceRoutes)
.use(agentRunnerRoutes)
+ .use(runnerQueueRoutes)
.use(agentChatRoutes)
.use(agentInvocationRoutes)
.use(dashboardRoutes)
diff --git a/apps/web/messages/ar/issue.json b/apps/web/messages/ar/issue.json
index ec354534..9bcace10 100644
--- a/apps/web/messages/ar/issue.json
+++ b/apps/web/messages/ar/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "بلا مسؤول",
"noType": "بلا نوع",
"noLabels": "لا شيء"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/ar/sections.json b/apps/web/messages/ar/sections.json
index 3b25deeb..0cdda7a0 100644
--- a/apps/web/messages/ar/sections.json
+++ b/apps/web/messages/ar/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "وكلاء الذكاء الاصطناعي",
"description": "وكلاء الذكاء الاصطناعي العاملون في هذا المشروع."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/en/issue.json b/apps/web/messages/en/issue.json
index e2a5f805..dc0c92ec 100644
--- a/apps/web/messages/en/issue.json
+++ b/apps/web/messages/en/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "No assignee",
"noType": "No type",
"noLabels": "None"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/en/sections.json b/apps/web/messages/en/sections.json
index 4b43f348..e71f28e7 100644
--- a/apps/web/messages/en/sections.json
+++ b/apps/web/messages/en/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "AI Agents",
"description": "AI agents working in this project."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/es-ES/issue.json b/apps/web/messages/es-ES/issue.json
index cf802e28..6faa3ead 100644
--- a/apps/web/messages/es-ES/issue.json
+++ b/apps/web/messages/es-ES/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "Sin asignar",
"noType": "Sin tipo",
"noLabels": "Ninguna"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/es-ES/sections.json b/apps/web/messages/es-ES/sections.json
index bbb84984..a4aa6569 100644
--- a/apps/web/messages/es-ES/sections.json
+++ b/apps/web/messages/es-ES/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "Agentes de IA",
"description": "Agentes de IA que trabajan en este proyecto."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/fa/issue.json b/apps/web/messages/fa/issue.json
index 8fcef423..5ce2b5a5 100644
--- a/apps/web/messages/fa/issue.json
+++ b/apps/web/messages/fa/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "بدون مسئول",
"noType": "بدون نوع",
"noLabels": "هیچ‌کدام"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/fa/sections.json b/apps/web/messages/fa/sections.json
index b30787a0..1b42c401 100644
--- a/apps/web/messages/fa/sections.json
+++ b/apps/web/messages/fa/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "ایجنت‌های AI",
"description": "ایجنت‌های AI که در این پروژه کار می‌کنند."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/fr/issue.json b/apps/web/messages/fr/issue.json
index 5f4e3912..a2942e16 100644
--- a/apps/web/messages/fr/issue.json
+++ b/apps/web/messages/fr/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "Aucun responsable",
"noType": "Aucun type",
"noLabels": "Aucune"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/fr/sections.json b/apps/web/messages/fr/sections.json
index ac4c1347..d279b51a 100644
--- a/apps/web/messages/fr/sections.json
+++ b/apps/web/messages/fr/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "Agents",
"description": "Des comptes bots auxquels vous pouvez déléguer des tickets."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/id/issue.json b/apps/web/messages/id/issue.json
index 9b380352..f10db3af 100644
--- a/apps/web/messages/id/issue.json
+++ b/apps/web/messages/id/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "Tanpa penerima tugas",
"noType": "Tanpa tipe",
"noLabels": "Tidak ada"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/id/sections.json b/apps/web/messages/id/sections.json
index b0dbfab8..8942187d 100644
--- a/apps/web/messages/id/sections.json
+++ b/apps/web/messages/id/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "Agen AI",
"description": "Agen AI yang bekerja dalam proyek ini."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/ko/issue.json b/apps/web/messages/ko/issue.json
index 3bb34578..0a634a51 100644
--- a/apps/web/messages/ko/issue.json
+++ b/apps/web/messages/ko/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "담당자 없음",
"noType": "유형 없음",
"noLabels": "없음"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/ko/sections.json b/apps/web/messages/ko/sections.json
index 08206c86..480cda93 100644
--- a/apps/web/messages/ko/sections.json
+++ b/apps/web/messages/ko/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "AI 에이전트",
"description": "이 프로젝트에서 작업하는 AI 에이전트를 관리합니다."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/pt-BR/issue.json b/apps/web/messages/pt-BR/issue.json
index 558f4db7..069573b0 100644
--- a/apps/web/messages/pt-BR/issue.json
+++ b/apps/web/messages/pt-BR/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "Sem responsável",
"noType": "Sem tipo",
"noLabels": "Nenhum"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/pt-BR/sections.json b/apps/web/messages/pt-BR/sections.json
index 4024539f..487908b2 100644
--- a/apps/web/messages/pt-BR/sections.json
+++ b/apps/web/messages/pt-BR/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "Agentes de IA",
"description": "Agentes de IA trabalhando neste projeto."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/ru/issue.json b/apps/web/messages/ru/issue.json
index 9b547b0d..3bbb3709 100644
--- a/apps/web/messages/ru/issue.json
+++ b/apps/web/messages/ru/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "Без исполнителя",
"noType": "Без типа",
"noLabels": "Нет"
+ },
+ "agentRuns": {
+ "title": "Запуски агентов",
+ "refresh": "Обновить",
+ "loading": "Загружаем запуски…",
+ "loadError": "Не удалось загрузить историю. Попробуйте обновить.",
+ "empty": "У этой задачи пока нет запусков агентов.",
+ "loadMore": "Загрузить предыдущие запуски",
+ "pending": "В ожидании или работе",
+ "success": "Завершён",
+ "failed": "Ошибка",
+ "canceled": "Отменён",
+ "attempts": "Попытки: {count}",
+ "started": "Первый запуск: {date}",
+ "finished": "Завершён: {date}",
+ "pendingHint": "Запуск ожидает выполнения или выполняется. Обновите, чтобы увидеть актуальное состояние.",
+ "task": "Задание",
+ "error": "Последняя ошибка",
+ "result": "Результат",
+ "input": "Входные данные",
+ "trace": "Последняя записанная попытка",
+ "noTrace": "Шаги выполнения ещё не записаны. Они могут появиться после сохранения трассировки.",
+ "externalHint": "История выполнения не записана. Нужна версия runner с поддержкой событий запуска.",
+ "attributes": "Атрибуты",
+ "recordedAttempt": "Записанная попытка",
+ "latestAttempt": "Последняя попытка",
+ "previousAttempt": "Предыдущая попытка",
+ "attemptStarted": "Начало попытки: {date}",
+ "duration": "{milliseconds, number} мс",
+ "triggers": {
+ "mention": "Упоминание",
+ "delegation": "Делегирование",
+ "field": "Поле участника",
+ "schedule": "Расписание",
+ "manual": "Вручную",
+ "status": "Смена статуса",
+ "event": "Событие"
+ },
+ "queued": "Ожидает",
+ "running": "Выполняется",
+ "queuedHint": "Ожидает runner, повторной попытки или запланированного времени.",
+ "queueTitle": "Очередь runner",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "В работе",
+ "historySection": "История",
+ "waitingForRunner": "Ждёт runner",
+ "offlineHint": "Ожидающие запуски начнутся, когда runner подключится.",
+ "retryAt": "Повтор в {time}",
+ "startsAt": "Старт в {time}",
+ "inDuration": "за {duration}",
+ "afterAttempts": "после {count, plural, one {# попытки} few {# попыток} many {# попыток} other {# попытки}}",
+ "startedAgo": "начат {time}",
+ "stepsSection": "Что делал агент",
+ "outputTail": "Вывод длинный: runner прислал только его конец.",
+ "openWorkItem": "Открыть задачу",
+ "scheduleRun": "Расписание: {name}",
+ "facts": {
+ "agent": "Агент",
+ "trigger": "Триггер",
+ "started": "Начат",
+ "finished": "Завершён",
+ "attempts": "Попытки",
+ "runner": "Runner",
+ "delivery": "Доставка",
+ "context": "Контекст",
+ "run": "Запуск"
+ },
+ "connection": {
+ "push": "URL вызова",
+ "online": "Онлайн",
+ "offline": "Офлайн",
+ "never": "Не подключён"
+ },
+ "presence": {
+ "offline": "Runner офлайн",
+ "never": "Runner не подключён"
+ },
+ "externalAttempt": "Попытка {attempt}",
+ "openCodex": "Открыть в Codex",
+ "sessionHint": "Открывает локальное приложение Codex. Сессия должна быть доступна на этом компьютере или подключённом хосте.",
+ "traceTruncated": "Достигнут лимит записи. Последующие события пропущены; итоговый результат запуска остаётся доступен.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "Этого запуска нет в очереди или к нему нет доступа.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/ru/sections.json b/apps/web/messages/ru/sections.json
index 68067513..94c27231 100644
--- a/apps/web/messages/ru/sections.json
+++ b/apps/web/messages/ru/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "ИИ-агенты",
"description": "ИИ-агенты, которые работают в этом проекте."
+ },
+ "queue": {
+ "label": "Очередь runner",
+ "description": "Задания внешних runner во всех доступных проектах. Сначала выполняющиеся, затем ожидающие по времени запуска."
}
},
"previews": {
diff --git a/apps/web/messages/tr/issue.json b/apps/web/messages/tr/issue.json
index 5dccce41..5152c8c6 100644
--- a/apps/web/messages/tr/issue.json
+++ b/apps/web/messages/tr/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "Sorumlu atanmamış",
"noType": "Tür yok",
"noLabels": "Yok"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/tr/sections.json b/apps/web/messages/tr/sections.json
index fd393006..e558f4a8 100644
--- a/apps/web/messages/tr/sections.json
+++ b/apps/web/messages/tr/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "Yapay Zekâ Ajanları",
"description": "Bu projede çalışan yapay zekâ ajanları."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/uk/issue.json b/apps/web/messages/uk/issue.json
index 442f45e5..e396c370 100644
--- a/apps/web/messages/uk/issue.json
+++ b/apps/web/messages/uk/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "Без виконавця",
"noType": "Без типу",
"noLabels": "Немає"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/uk/sections.json b/apps/web/messages/uk/sections.json
index 4b6476c5..54eb92a6 100644
--- a/apps/web/messages/uk/sections.json
+++ b/apps/web/messages/uk/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "ШІ-агенти",
"description": "ШІ-агенти, які працюють у цьому проєкті."
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/messages/zh-CN/issue.json b/apps/web/messages/zh-CN/issue.json
index ab6ff522..f0d7d721 100644
--- a/apps/web/messages/zh-CN/issue.json
+++ b/apps/web/messages/zh-CN/issue.json
@@ -474,5 +474,89 @@
"noAssignee": "无负责人",
"noType": "无类型",
"noLabels": "无标签"
+ },
+ "agentRuns": {
+ "title": "Agent runs",
+ "refresh": "Refresh",
+ "loading": "Loading runs…",
+ "loadError": "Could not load run history. Try refreshing.",
+ "empty": "No agent runs for this issue.",
+ "loadMore": "Load older runs",
+ "pending": "Pending",
+ "success": "Succeeded",
+ "failed": "Failed",
+ "canceled": "Canceled",
+ "attempts": "Attempts: {count}",
+ "started": "First started: {date}",
+ "finished": "Finished: {date}",
+ "pendingHint": "This run is waiting or executing. Refresh to read its latest state.",
+ "task": "Task",
+ "error": "Last error",
+ "result": "Result",
+ "input": "Input",
+ "trace": "Latest recorded attempt",
+ "noTrace": "No execution steps have been recorded yet. Steps may appear after the trace is saved.",
+ "externalHint": "No execution transcript was recorded. Use a runner version that reports run events.",
+ "attributes": "Attributes",
+ "recordedAttempt": "Recorded attempt",
+ "latestAttempt": "Latest attempt",
+ "previousAttempt": "Previous attempt",
+ "attemptStarted": "Attempt started: {date}",
+ "duration": "{milliseconds, number} ms",
+ "triggers": {
+ "mention": "Mention",
+ "delegation": "Delegation",
+ "field": "Member field",
+ "schedule": "Schedule",
+ "manual": "Manual",
+ "status": "Status change",
+ "event": "Event"
+ },
+ "queued": "Waiting",
+ "running": "Running",
+ "queuedHint": "Waiting for a runner, a retry or its scheduled start.",
+ "queueTitle": "Runner queue",
+ "queueEmpty": "No runs yet.",
+ "activeSection": "In progress",
+ "historySection": "History",
+ "waitingForRunner": "Waiting for runner",
+ "offlineHint": "Waiting runs start when the runner connects.",
+ "retryAt": "Retry at {time}",
+ "startsAt": "Starts at {time}",
+ "inDuration": "in {duration}",
+ "afterAttempts": "after {count, plural, one {# attempt} other {# attempts}}",
+ "startedAgo": "started {time}",
+ "stepsSection": "What the agent did",
+ "outputTail": "The output is long: the runner sent only its end.",
+ "openWorkItem": "Open work item",
+ "scheduleRun": "Schedule: {name}",
+ "facts": {
+ "agent": "Agent",
+ "trigger": "Trigger",
+ "started": "Started",
+ "finished": "Finished",
+ "attempts": "Attempts",
+ "runner": "Runner",
+ "delivery": "Delivery",
+ "context": "Context",
+ "run": "Run"
+ },
+ "connection": {
+ "push": "Invocation URL",
+ "online": "Online",
+ "offline": "Offline",
+ "never": "Not connected"
+ },
+ "presence": {
+ "offline": "Runner offline",
+ "never": "Runner not connected"
+ },
+ "externalAttempt": "Recorded attempt {attempt}",
+ "openCodex": "Open in Codex",
+ "sessionHint": "Opens the local Codex app. The session must be available on this computer or its connected host.",
+ "traceTruncated": "The recording limit was reached. Later events are omitted; the final run result is still available.",
+ "selectRun": "Select a run to see its details",
+ "runNotFound": "This run is not in your queue, or you cannot read it.",
+ "backToRuns": "Back to runs"
}
}
diff --git a/apps/web/messages/zh-CN/sections.json b/apps/web/messages/zh-CN/sections.json
index 5459449d..7b4b6712 100644
--- a/apps/web/messages/zh-CN/sections.json
+++ b/apps/web/messages/zh-CN/sections.json
@@ -113,6 +113,10 @@
"ai-agents": {
"label": "AI 代理",
"description": "在该项目中工作的 AI 代理。"
+ },
+ "queue": {
+ "label": "Runner queue",
+ "description": "External runner tasks across all projects you can read. Running leases first; waiting tasks by due time."
}
},
"previews": {
diff --git a/apps/web/src/app/[teamRef]/(shell)/[projectKey]/agents/queue/[runId]/page.tsx b/apps/web/src/app/[teamRef]/(shell)/[projectKey]/agents/queue/[runId]/page.tsx
new file mode 100644
index 00000000..63a1e726
--- /dev/null
+++ b/apps/web/src/app/[teamRef]/(shell)/[projectKey]/agents/queue/[runId]/page.tsx
@@ -0,0 +1,15 @@
+import { redirect } from 'next/navigation';
+import RunnerQueueRunPage from '@/features/runner-queue/RunnerQueueRunPage';
+import { projectRefOf, runnerQueuePath } from '@/utils/paths';
+
+export default async function Page({
+ params,
+}: {
+ params: Promise<{ teamRef: string; projectKey: string; runId: string }>;
+}) {
+ const { teamRef, projectKey, runId } = await params;
+ const queuePath = runnerQueuePath(projectRefOf(teamRef, projectKey));
+ const id = Number(runId);
+ if (!Number.isInteger(id) || id <= 0) redirect(queuePath);
+ return <RunnerQueueRunPage runId={id} queuePath={queuePath} />;
+}
diff --git a/apps/web/src/app/[teamRef]/(shell)/[projectKey]/agents/queue/layout.tsx b/apps/web/src/app/[teamRef]/(shell)/[projectKey]/agents/queue/layout.tsx
new file mode 100644
index 00000000..0bc31e3f
--- /dev/null
+++ b/apps/web/src/app/[teamRef]/(shell)/[projectKey]/agents/queue/layout.tsx
@@ -0,0 +1,8 @@
+import type { ReactNode } from 'react';
+import RunnerQueuePage from '@/features/runner-queue/RunnerQueuePage';
+
+// The run list is the layout, so it keeps its scroll and loaded pages while the open run
+// changes beside it.
+export default function Layout({ children }: { children: ReactNode }) {
+ return <RunnerQueuePage>{children}</RunnerQueuePage>;
+}
diff --git a/apps/web/src/app/[teamRef]/(shell)/[projectKey]/agents/queue/page.tsx b/apps/web/src/app/[teamRef]/(shell)/[projectKey]/agents/queue/page.tsx
new file mode 100644
index 00000000..94d791d2
--- /dev/null
+++ b/apps/web/src/app/[teamRef]/(shell)/[projectKey]/agents/queue/page.tsx
@@ -0,0 +1,3 @@
+import RunnerQueueNoRun from '@/features/runner-queue/components/RunnerQueueNoRun';
+
+export default RunnerQueueNoRun;
diff --git a/apps/web/src/components/common/agent-runs/AgentRunBlock.tsx b/apps/web/src/components/common/agent-runs/AgentRunBlock.tsx
new file mode 100644
index 00000000..5e1d07ce
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/AgentRunBlock.tsx
@@ -0,0 +1,15 @@
+export default function AgentRunBlock({ label, value }: { label: string; value: unknown }) {
+ if (value == null) return null;
+ const text = typeof value === 'string' ? value : JSON.stringify(value, null, 2);
+ return (
+ <div className="space-y-1">
+ <p className="text-xs font-medium text-muted-foreground">{label}</p>
+ <pre
+ dir="auto"
+ className="max-h-64 overflow-auto rounded-md bg-muted/50 p-3 text-xs break-words whitespace-pre-wrap"
+ >
+ {text}
+ </pre>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/common/agent-runs/AgentRunExternalTrace.test.tsx b/apps/web/src/components/common/agent-runs/AgentRunExternalTrace.test.tsx
new file mode 100644
index 00000000..e142aa45
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/AgentRunExternalTrace.test.tsx
@@ -0,0 +1,60 @@
+import assert from 'node:assert/strict';
+import { it } from 'node:test';
+import { renderToStaticMarkup } from 'react-dom/server';
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+import { NextIntlClientProvider } from 'next-intl';
+import { SyncProvider } from '@/context/syncContext';
+import { qk } from '@/services/queryKeys';
+import issue from '../../../../messages/en/issue.json';
+import common from '../../../../messages/en/common.json';
+import AgentRunExternalTrace from './AgentRunExternalTrace';
+
+function markup(denied = false) {
+ const client = new QueryClient({
+ defaultOptions: { queries: { staleTime: Infinity, retry: false } },
+ });
+ const key = [...qk.externalRunTrace(1), null];
+ client.setQueryData(key, {
+ attempt: 1,
+ previousAttempt: null,
+ sessionId: '0199a213-81c0-7800-8aa1-bbab2a035a53',
+ sessionUrl: 'codex://threads/0199a213-81c0-7800-8aa1-bbab2a035a53',
+ truncated: true,
+ events: [
+ {
+ receivedAt: '2026-01-01T00:00:00Z',
+ event: { type: 'TEXT_MESSAGE_CONTENT', delta: 'Private trace <script>alert(1)</script>' },
+ },
+ ],
+ });
+ if (denied)
+ client
+ .getQueryCache()
+ .find({ queryKey: key })!
+ .setState({ status: 'error', error: new Error('Access denied') });
+ const html = renderToStaticMarkup(
+ <QueryClientProvider client={client}>
+ <SyncProvider>
+ <NextIntlClientProvider locale="en" timeZone="UTC" messages={{ issue, common }}>
+ <AgentRunExternalTrace runId={1} />
+ </NextIntlClientProvider>
+ </SyncProvider>
+ </QueryClientProvider>,
+ );
+ client.clear();
+ return html;
+}
+
+it('renders the local session link and truncation notice while sanitizing event text', () => {
+ const html = markup();
+ assert.match(html, /href="codex:\/\/threads\/0199a213-81c0-7800-8aa1-bbab2a035a53"/);
+ assert.match(html, /recording limit/);
+ assert.match(html, /Private trace/);
+ assert.doesNotMatch(html, /<script|alert\(1\)/);
+});
+
+it('hides cached external events and session links when access is denied', () => {
+ const html = markup(true);
+ assert.match(html, /role="alert"/);
+ assert.doesNotMatch(html, /Private trace|codex:\/\/threads/);
+});
diff --git a/apps/web/src/components/common/agent-runs/AgentRunExternalTrace.tsx b/apps/web/src/components/common/agent-runs/AgentRunExternalTrace.tsx
new file mode 100644
index 00000000..79fb4a92
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/AgentRunExternalTrace.tsx
@@ -0,0 +1,80 @@
+import { useState } from 'react';
+import { ChevronLeft } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import { Button } from '@/components/ui/button';
+import { useExternalRunTraceQuery } from '@/services/runnerQueue.service';
+import { useLiveRefresh } from '@/hooks/useLiveRefresh';
+import { qk } from '@/services/queryKeys';
+import { revScope } from '@/utils/revScopes';
+import { externalTraceParts } from './externalTraceParts';
+import AgentRunStep from './AgentRunStep';
+
+export default function AgentRunExternalTrace({ runId }: { runId: number }) {
+ const t = useTranslations('issue.agentRuns');
+ const [attempt, setAttempt] = useState<number>();
+ const query = useExternalRunTraceQuery(runId, attempt);
+ useLiveRefresh({ scope: revScope.runnerQueue, targets: [qk.externalRunTrace(runId)] });
+ const trace = query.isError ? null : query.data;
+ return (
+ <div className="space-y-2">
+ {query.isLoading && <p className="text-xs text-muted-foreground">{t('loading')}</p>}
+ {query.isError && (
+ <p role="alert" className="text-xs text-destructive">
+ {t('loadError')}
+ </p>
+ )}
+ {query.isSuccess && !trace && (
+ <p className="text-sm text-muted-foreground">{t('externalHint')}</p>
+ )}
+ {trace && (
+ <>
+ <div className="flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
+ <span>{t('externalAttempt', { attempt: trace.attempt })}</span>
+ {trace.previousAttempt != null && (
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-7 px-2 text-xs"
+ onClick={() => setAttempt(trace.previousAttempt ?? undefined)}
+ >
+ <ChevronLeft />
+ {t('previousAttempt')}
+ </Button>
+ )}
+ {attempt != null && (
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-7 px-2 text-xs"
+ onClick={() => setAttempt(undefined)}
+ >
+ {t('latestAttempt')}
+ </Button>
+ )}
+ {trace.sessionUrl && (
+ <a
+ className="ms-auto text-primary underline"
+ href={trace.sessionUrl}
+ title={t('sessionHint')}
+ >
+ {t('openCodex')}
+ </a>
+ )}
+ </div>
+ {trace.truncated && (
+ <p role="status" className="text-xs text-muted-foreground">
+ {t('traceTruncated')}
+ </p>
+ )}
+ <ol>
+ {externalTraceParts(trace.events).map((part, index) => (
+ <li key={index}>
+ <AgentRunStep part={part} />
+ </li>
+ ))}
+ </ol>
+ </>
+ )}
+ </div>
+ );
+}
diff --git a/apps/web/src/components/common/agent-runs/AgentRunItem.test.tsx b/apps/web/src/components/common/agent-runs/AgentRunItem.test.tsx
new file mode 100644
index 00000000..bdf17803
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/AgentRunItem.test.tsx
@@ -0,0 +1,50 @@
+import assert from 'node:assert/strict';
+import { it } from 'node:test';
+import { renderToStaticMarkup } from 'react-dom/server';
+import { NextIntlClientProvider } from 'next-intl';
+import { RelativeTimeProvider } from '@/context/relativeTimeContext';
+import type { IssueAgentRun } from '@/lib/api/endpoints/issues';
+import issue from '../../../../messages/en/issue.json';
+import AgentRunItem from './AgentRunItem';
+
+const run: IssueAgentRun = {
+ id: 1,
+ agentId: 2,
+ username: 'runner',
+ kind: 'external',
+ status: 'pending',
+ executionState: 'queued',
+ trigger: 'mention',
+ prompt: 'Task',
+ output: null,
+ attempts: 0,
+ lastError: null,
+ createdAt: '2026-01-01T00:00:00Z',
+ startedAt: null,
+ finishedAt: null,
+ nextAttemptAt: '2026-01-01T00:00:00Z',
+};
+
+function markup(executionState: 'queued' | 'running') {
+ return renderToStaticMarkup(
+ <NextIntlClientProvider
+ locale="en"
+ messages={{ issue }}
+ timeZone="UTC"
+ now={new Date('2026-01-01T00:00:00Z')}
+ >
+ <RelativeTimeProvider>
+ <AgentRunItem issueId={null} run={{ ...run, executionState }} />
+ </RelativeTimeProvider>
+ </NextIntlClientProvider>,
+ );
+}
+
+it('distinguishes waiting and running while the runner protocol status stays pending', () => {
+ const queued = markup('queued');
+ const running = markup('running');
+ assert.match(queued, /Waiting/);
+ assert.doesNotMatch(queued, />Running</);
+ assert.match(running, /Running/);
+ assert.doesNotMatch(running, />Waiting</);
+});
diff --git a/apps/web/src/components/common/agent-runs/AgentRunItem.tsx b/apps/web/src/components/common/agent-runs/AgentRunItem.tsx
new file mode 100644
index 00000000..26b4ba23
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/AgentRunItem.tsx
@@ -0,0 +1,81 @@
+import { useState } from 'react';
+import { ChevronDown, ChevronRight } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import type { IssueAgentRun } from '@/lib/api/endpoints/issues';
+import { useRelativeTime } from '@/context/relativeTimeContext';
+import { formatDateTime } from '@/utils/dates';
+import { Badge } from '@/components/ui/badge';
+import { AgentContextSize } from '@/components/common/agent-chat/AgentContextSize';
+import AgentRunBlock from './AgentRunBlock';
+import AgentRunTrace from './AgentRunTrace';
+import AgentRunExternalTrace from './AgentRunExternalTrace';
+
+export default function AgentRunItem({
+ issueId,
+ run,
+ defaultOpen = false,
+}: {
+ issueId: number | null;
+ run: IssueAgentRun;
+ defaultOpen?: boolean;
+}) {
+ const t = useTranslations('issue.agentRuns');
+ const relativeTime = useRelativeTime();
+ const [open, setOpen] = useState(defaultOpen);
+ const Chevron = open ? ChevronDown : ChevronRight;
+ return (
+ <div className="border-b last:border-b-0">
+ <button
+ type="button"
+ aria-expanded={open}
+ onClick={() => setOpen((value) => !value)}
+ className="flex w-full flex-wrap items-center gap-2 py-3 text-start text-xs hover:bg-accent/50"
+ >
+ <Chevron className="size-3.5 shrink-0" />
+ <span className="font-medium">@{run.username}</span>
+ <Badge variant={run.status === 'failed' ? 'destructive' : 'outline'}>
+ {t(run.executionState)}
+ </Badge>
+ <span className="text-muted-foreground">
+ #{run.id} · {t(`triggers.${run.trigger}`)}
+ </span>
+ {run.contextTokens != null && <AgentContextSize tokens={run.contextTokens} />}
+ <time
+ className="ms-auto text-muted-foreground"
+ dateTime={run.createdAt}
+ title={formatDateTime(run.createdAt)}
+ >
+ {relativeTime(run.createdAt)}
+ </time>
+ </button>
+ {open && (
+ <div className="space-y-3 pb-4">
+ <p className="text-xs text-muted-foreground">{t('attempts', { count: run.attempts })}</p>
+ {run.startedAt && (
+ <p className="text-xs text-muted-foreground">
+ {t('started', { date: formatDateTime(run.startedAt) })}
+ </p>
+ )}
+ {run.finishedAt && (
+ <p className="text-xs text-muted-foreground">
+ {t('finished', { date: formatDateTime(run.finishedAt) })}
+ </p>
+ )}
+ {run.executionState === 'queued' && (
+ <p className="text-xs text-muted-foreground">{t('queuedHint')}</p>
+ )}
+ <AgentRunBlock label={t('task')} value={run.prompt} />
+ <AgentRunBlock label={t('error')} value={run.lastError} />
+ <AgentRunBlock label={t('result')} value={run.output} />
+ {run.kind === 'internal' && issueId != null ? (
+ <AgentRunTrace issueId={issueId} runId={run.id} />
+ ) : null}
+ {run.kind === 'external' && <AgentRunExternalTrace runId={run.id} />}
+ {issueId == null && run.kind !== 'external' && (
+ <p className="text-xs text-muted-foreground">{t('externalHint')}</p>
+ )}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/apps/web/src/components/common/agent-runs/AgentRunStep.tsx b/apps/web/src/components/common/agent-runs/AgentRunStep.tsx
new file mode 100644
index 00000000..2e8ef25e
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/AgentRunStep.tsx
@@ -0,0 +1,70 @@
+import { ChevronRight } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import { formatDateTime, formatTime } from '@/utils/dates';
+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
+import AgentChatToolBlock from '@/components/common/agent-chat/AgentChatToolBlock';
+import Markdown from '@/components/common/Markdown';
+import type { ExternalTracePart } from './externalTraceParts';
+
+// An MCP tool reaches the agent as `mcp__<server>__<tool>`; the server adds nothing here.
+function toolLabel(name: string): string {
+ if (!name.startsWith('mcp__')) return name;
+ const end = name.indexOf('__', 5);
+ return end === -1 ? name : name.slice(end + 2);
+}
+
+export default function AgentRunStep({ part }: { part: ExternalTracePart }) {
+ const t = useTranslations('common.agentChat');
+ const time = (
+ <time
+ className="w-20 shrink-0 pt-0.5 font-mono text-xs whitespace-nowrap text-muted-foreground"
+ dateTime={part.receivedAt}
+ title={formatDateTime(part.receivedAt)}
+ >
+ {formatTime(part.receivedAt, { seconds: true })}
+ </time>
+ );
+ if (part.type === 'text') {
+ return (
+ <div className="flex gap-3 py-1.5">
+ {time}
+ <div className="min-w-0 flex-1 ps-5.5 text-sm">
+ <Markdown>{part.text}</Markdown>
+ </div>
+ </div>
+ );
+ }
+ const label = (
+ <>
+ <span className="shrink-0 font-medium">{toolLabel(part.toolName)}</span>
+ {part.args && (
+ <span className="truncate font-mono text-xs text-muted-foreground" dir="ltr">
+ {part.args}
+ </span>
+ )}
+ </>
+ );
+ if (!part.args && !part.result) {
+ return (
+ <div className="flex gap-3 py-1.5">
+ {time}
+ <span className="flex min-w-0 items-baseline gap-2 ps-5.5 text-sm">{label}</span>
+ </div>
+ );
+ }
+ return (
+ <Collapsible className="flex gap-3 py-1.5">
+ {time}
+ <div className="min-w-0 flex-1">
+ <CollapsibleTrigger className="group flex w-full min-w-0 items-baseline gap-2 rounded-sm text-start text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50">
+ <ChevronRight className="size-3.5 shrink-0 self-center text-muted-foreground transition-transform duration-150 group-data-[state=open]:rotate-90 rtl:group-data-[state=closed]:rotate-180" />
+ {label}
+ </CollapsibleTrigger>
+ <CollapsibleContent className="space-y-2 ps-5.5 pt-2">
+ {part.args && <AgentChatToolBlock label={t('toolInput')} text={part.args} />}
+ {part.result && <AgentChatToolBlock label={t('toolOutput')} text={part.result} />}
+ </CollapsibleContent>
+ </div>
+ </Collapsible>
+ );
+}
diff --git a/apps/web/src/components/common/agent-runs/AgentRunTrace.test.tsx b/apps/web/src/components/common/agent-runs/AgentRunTrace.test.tsx
new file mode 100644
index 00000000..7255d2d8
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/AgentRunTrace.test.tsx
@@ -0,0 +1,128 @@
+import assert from 'node:assert/strict';
+import { afterEach, beforeEach, it } from 'node:test';
+import { act } from 'react';
+import type { Root } from 'react-dom/client';
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+import { NextIntlClientProvider } from 'next-intl';
+import { JSDOM } from 'jsdom';
+import type { IssueAgentRunTrace as Trace } from '@/lib/api/endpoints/issues';
+import { qk } from '@/services/queryKeys';
+import issue from '../../../../messages/en/issue.json';
+import AgentRunTrace from './AgentRunTrace';
+
+let root: Root;
+let dom: JSDOM;
+let client: QueryClient;
+let descriptors: Map<string, PropertyDescriptor | undefined>;
+const latest: Trace = {
+ previousTraceId: 'old',
+ trace: {
+ traceId: 'new',
+ status: 'success',
+ startedAt: '2026-01-02T00:00:00Z',
+ endedAt: '2026-01-02T00:00:01Z',
+ },
+ spans: [
+ {
+ spanId: 'tool-new',
+ parentSpanId: 'root-new',
+ name: 'get_issue',
+ type: 'tool_call',
+ status: 'success',
+ startedAt: '2026-01-02T00:00:00Z',
+ endedAt: '2026-01-02T00:00:00.050Z',
+ durationMs: 50,
+ input: 'Private tool input',
+ output: 'Latest result',
+ error: null,
+ attributes: null,
+ },
+ ],
+};
+const earlier: Trace = {
+ previousTraceId: null,
+ trace: { ...latest.trace, traceId: 'old', startedAt: '2026-01-01T00:00:00Z' },
+ spans: [{ ...latest.spans[0], spanId: 'tool-old', output: 'Earlier result' }],
+};
+
+beforeEach(async () => {
+ descriptors = new Map(
+ ['window', 'document', 'navigator', 'IS_REACT_ACT_ENVIRONMENT', 'fetch'].map((name) => [
+ name,
+ Object.getOwnPropertyDescriptor(globalThis, name),
+ ]),
+ );
+ dom = new JSDOM('<div id="root"></div>');
+ Object.defineProperties(globalThis, {
+ window: { configurable: true, value: dom.window },
+ document: { configurable: true, value: dom.window.document },
+ navigator: { configurable: true, value: dom.window.navigator },
+ IS_REACT_ACT_ENVIRONMENT: { configurable: true, value: true },
+ fetch: {
+ configurable: true,
+ value: async () => Response.json({ error: 'Access denied' }, { status: 403 }),
+ },
+ });
+ client = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: Infinity } },
+ });
+ client.setQueryData(qk.issueAgentRunTrace(1, 2), latest);
+ client.setQueryData(qk.issueAgentRunTrace(1, 2, 'old'), earlier);
+ const { createRoot } = await import('react-dom/client');
+ root = createRoot(document.getElementById('root')!);
+ act(() =>
+ root.render(
+ <QueryClientProvider client={client}>
+ <NextIntlClientProvider locale="en" messages={{ issue }} timeZone="UTC">
+ <AgentRunTrace issueId={1} runId={2} />
+ </NextIntlClientProvider>
+ </QueryClientProvider>,
+ ),
+ );
+});
+
+afterEach(() => {
+ act(() => root.unmount());
+ client.clear();
+ dom.window.close();
+ for (const [name, descriptor] of descriptors) {
+ if (descriptor) Object.defineProperty(globalThis, name, descriptor);
+ else Reflect.deleteProperty(globalThis, name);
+ }
+});
+
+function click(label: string) {
+ const button = [...document.querySelectorAll('button')].find(
+ (item) => item.textContent === label,
+ );
+ assert.ok(button);
+ act(() => button.click());
+}
+
+it('opens an earlier attempt and returns to the latest, keeping their outputs separate', () => {
+ assert.ok(document.body.textContent?.includes('Latest result'));
+ assert.ok(document.body.textContent?.includes('50 ms'));
+ click(issue.agentRuns.previousAttempt);
+ assert.ok(document.body.textContent?.includes('Earlier result'));
+ assert.ok(!document.body.textContent?.includes('Latest result'));
+ assert.ok(
+ ![...document.querySelectorAll('button')].some(
+ (button) => button.textContent === issue.agentRuns.previousAttempt,
+ ),
+ );
+ click(issue.agentRuns.latestAttempt);
+ assert.ok(document.body.textContent?.includes('Latest result'));
+ assert.ok(!document.body.textContent?.includes('Earlier result'));
+});
+
+it('hides cached trace content after a refetch denies access', async () => {
+ assert.ok(document.body.textContent?.includes('Private tool input'));
+ await act(async () => {
+ await client.invalidateQueries({ queryKey: qk.issueAgentRunTrace(1, 2), exact: true });
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ });
+ assert.ok(document.querySelector('[role="alert"]'));
+ assert.ok(!document.body.textContent?.includes('Private tool input'));
+ assert.ok(!document.body.textContent?.includes('Latest result'));
+ assert.equal(document.querySelectorAll('details').length, 0);
+});
diff --git a/apps/web/src/components/common/agent-runs/AgentRunTrace.tsx b/apps/web/src/components/common/agent-runs/AgentRunTrace.tsx
new file mode 100644
index 00000000..249e84cb
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/AgentRunTrace.tsx
@@ -0,0 +1,69 @@
+import { useState } from 'react';
+import { useTranslations } from 'next-intl';
+import { Button } from '@/components/ui/button';
+import { useIssueAgentRunTraceQuery } from '@/services/issues.service';
+import { formatDateTime } from '@/utils/dates';
+import AgentRunBlock from './AgentRunBlock';
+
+export default function AgentRunTrace({ issueId, runId }: { issueId: number; runId: number }) {
+ const t = useTranslations('issue.agentRuns');
+ const [traceId, setTraceId] = useState<string>();
+ const query = useIssueAgentRunTraceQuery(issueId, runId, traceId);
+ const detail = query.isError ? null : query.data;
+ const previousTraceId = detail?.previousTraceId;
+ return (
+ <div className="space-y-3">
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <p className="text-xs font-medium">{t(traceId == null ? 'trace' : 'recordedAttempt')}</p>
+ <div className="flex items-center gap-2">
+ {traceId != null && (
+ <Button size="sm" variant="ghost" onClick={() => setTraceId(undefined)}>
+ {t('latestAttempt')}
+ </Button>
+ )}
+ {previousTraceId && (
+ <Button size="sm" variant="ghost" onClick={() => setTraceId(previousTraceId)}>
+ {t('previousAttempt')}
+ </Button>
+ )}
+ <Button
+ size="sm"
+ variant="ghost"
+ disabled={query.isFetching}
+ onClick={() => void query.refetch()}
+ >
+ {t('refresh')}
+ </Button>
+ </div>
+ </div>
+ {query.isLoading && <p className="text-xs text-muted-foreground">{t('loading')}</p>}
+ {query.isError && (
+ <p role="alert" className="text-xs text-destructive">
+ {t('loadError')}
+ </p>
+ )}
+ {query.isSuccess && detail == null && (
+ <p className="text-xs text-muted-foreground">{t('noTrace')}</p>
+ )}
+ {detail && (
+ <p className="text-xs text-muted-foreground">
+ {t('attemptStarted', { date: formatDateTime(detail.trace.startedAt) })}
+ </p>
+ )}
+ {detail?.spans.map((span) => (
+ <details key={span.spanId} className="rounded-md border p-3">
+ <summary className="cursor-pointer text-xs">
+ <span dir="auto">{span.name}</span> · {span.type} · {span.status}
+ {span.durationMs != null && <> · {t('duration', { milliseconds: span.durationMs })}</>}
+ </summary>
+ <div className="mt-3 space-y-3">
+ <AgentRunBlock label={t('input')} value={span.input} />
+ <AgentRunBlock label={t('result')} value={span.output} />
+ <AgentRunBlock label={t('error')} value={span.error} />
+ <AgentRunBlock label={t('attributes')} value={span.attributes} />
+ </div>
+ </details>
+ ))}
+ </div>
+ );
+}
diff --git a/apps/web/src/components/common/agent-runs/externalTraceParts.test.ts b/apps/web/src/components/common/agent-runs/externalTraceParts.test.ts
new file mode 100644
index 00000000..9d3929b1
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/externalTraceParts.test.ts
@@ -0,0 +1,28 @@
+import assert from 'node:assert/strict';
+import { it } from 'node:test';
+import { externalTraceParts } from './externalTraceParts';
+
+it('keeps messages in order and joins each tool input and result by its id', () => {
+ const receivedAt = '2026-01-01T00:00:00Z';
+ const events = [
+ { type: 'TEXT_MESSAGE_CONTENT', delta: 'Looking ' },
+ { type: 'TEXT_MESSAGE_CONTENT', delta: 'up' },
+ { type: 'TOOL_CALL_START', toolCallId: 't1', toolCallName: 'get_issue' },
+ { type: 'TOOL_CALL_ARGS', toolCallId: 't1', delta: '{"id":' },
+ { type: 'TOOL_CALL_ARGS', toolCallId: 't1', delta: '1}' },
+ { type: 'TOOL_CALL_RESULT', toolCallId: 't1', content: 'Found' },
+ { type: 'TEXT_MESSAGE_CONTENT', delta: 'Done' },
+ ].map((event) => ({ event, receivedAt }));
+ assert.deepEqual(externalTraceParts(events), [
+ { type: 'text', text: 'Looking up', receivedAt },
+ {
+ type: 'tool',
+ toolCallId: 't1',
+ toolName: 'get_issue',
+ args: '{"id":1}',
+ result: 'Found',
+ receivedAt,
+ },
+ { type: 'text', text: 'Done', receivedAt },
+ ]);
+});
diff --git a/apps/web/src/components/common/agent-runs/externalTraceParts.ts b/apps/web/src/components/common/agent-runs/externalTraceParts.ts
new file mode 100644
index 00000000..29e8008d
--- /dev/null
+++ b/apps/web/src/components/common/agent-runs/externalTraceParts.ts
@@ -0,0 +1,34 @@
+import type { AiChatPart, AiChatToolPart } from '@/lib/api/endpoints/agentChat';
+import type { ExternalRunTrace } from '@/lib/api/endpoints/agents';
+
+export type ExternalTracePart = AiChatPart & { receivedAt: string };
+
+export function externalTraceParts(events: ExternalRunTrace['events']) {
+ const parts: ExternalTracePart[] = [];
+ const tools = new Map<string, AiChatToolPart>();
+ for (const { event, receivedAt } of events) {
+ if (event.type === 'TOOL_CALL_START' && event.toolCallId) {
+ const tool = {
+ type: 'tool' as const,
+ toolCallId: event.toolCallId,
+ toolName: event.toolCallName ?? '',
+ args: '',
+ receivedAt,
+ };
+ tools.set(event.toolCallId, tool);
+ parts.push(tool);
+ } else if (event.type === 'TOOL_CALL_ARGS') {
+ const tool = tools.get(event.toolCallId ?? '');
+ if (tool) tool.args = (tool.args ?? '') + (event.delta ?? '');
+ } else if (event.type === 'TOOL_CALL_RESULT') {
+ const tool = tools.get(event.toolCallId ?? '');
+ if (tool) tool.result = event.content ?? '';
+ } else if (event.type === 'TEXT_MESSAGE_CONTENT' || event.type === 'RUN_ERROR') {
+ const text = event.delta ?? event.message ?? '';
+ const previous = parts[parts.length - 1];
+ if (previous?.type === 'text') previous.text += text;
+ else parts.push({ type: 'text', text, receivedAt });
+ }
+ }
+ return parts;
+}
diff --git a/apps/web/src/components/layout/SidebarAiTeamNav.tsx b/apps/web/src/components/layout/SidebarAiTeamNav.tsx
index 64e0fdfe..7153748b 100644
--- a/apps/web/src/components/layout/SidebarAiTeamNav.tsx
+++ b/apps/web/src/components/layout/SidebarAiTeamNav.tsx
@@ -3,6 +3,7 @@ import { useTranslations } from 'next-intl';
import { aiAgentsPath, aiTeamPath } from '@/utils/paths';
import { AI_AGENTS_SECTION, AI_TEAM_SECTIONS } from '@/utils/settingsSections';
import { usePermissions } from '@/hooks/usePermissions';
+import { useShellRoute } from '@/hooks/useShellRoute';
import { useSettingsSectionText } from '@/hooks/useSectionLabels';
import {
SidebarGroup,
@@ -18,6 +19,7 @@ export default function SidebarAiTeamNav({ projectKey }: { projectKey: string |
const t = useTranslations('nav');
const sectionText = useSettingsSectionText();
const pathname = usePathname();
+ const { aiTeamSection } = useShellRoute();
const { can } = usePermissions();
const disabled = !projectKey;
@@ -36,7 +38,7 @@ export default function SidebarAiTeamNav({ projectKey }: { projectKey: string |
href={projectKey ? aiTeamPath(projectKey, s.slug) : '#'}
icon={s.icon}
label={sectionText(s.slug).label}
- active={pathname.endsWith(`/agents/${s.slug}`)}
+ active={aiTeamSection === s.slug}
disabled={disabled}
/>
))}
diff --git a/apps/web/src/features/issue/components/detail/IssueActivityFeed.tsx b/apps/web/src/features/issue/components/detail/IssueActivityFeed.tsx
index 7160c14b..d975c8df 100644
--- a/apps/web/src/features/issue/components/detail/IssueActivityFeed.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueActivityFeed.tsx
@@ -8,16 +8,14 @@ import CommentComposer, { type ComposerContext } from './CommentComposer';
import IssueActivityToolbar from './IssueActivityToolbar';
import IssueFeedList from './IssueFeedList';
import IssueGroupedFeed from './IssueGroupedFeed';
-
-// The issue's activity log: a comment composer over the entries, which the tabs narrow
-// to comments, the change log or the work log. Grouping by status and the order apply
-// to every tab. Both shapes page 25 at a time.
+import IssueAgentRunsPanel from './IssueAgentRunsPanel';
const EMPTY_TEXT = {
all: 'noActivity',
comments: 'noComments',
history: 'noHistory',
worklog: 'noWorklog',
+ agentRuns: 'agentRuns.empty',
} as const satisfies Record<ActivityTab, string>;
export default function IssueActivityFeed({
@@ -26,12 +24,14 @@ export default function IssueActivityFeed({
columns,
imageByUserId,
view,
+ canReadAgentRuns,
}: {
issueId: number;
assignees: Assignee[];
columns: Column[];
imageByUserId: Map<string, string | null>;
view: ActivityFeedView;
+ canReadAgentRuns: boolean;
}) {
const tIssue = useTranslations('issue');
const t = useTranslations('issue.comments');
@@ -46,6 +46,32 @@ export default function IssueActivityFeed({
};
const emptyText = tIssue(EMPTY_TEXT[view.tab]);
+ let content;
+ if (view.tab === 'agentRuns') {
+ content = <IssueAgentRunsPanel issueId={issueId} canRead={canReadAgentRuns} />;
+ } else if (view.grouped) {
+ content = (
+ <IssueGroupedFeed
+ issueId={issueId}
+ slice={view.slice}
+ columns={columns}
+ imageByUserId={imageByUserId}
+ composer={composer}
+ emptyText={emptyText}
+ />
+ );
+ } else {
+ content = (
+ <IssueFeedList
+ issueId={issueId}
+ slice={view.slice}
+ imageByUserId={imageByUserId}
+ composer={composer}
+ emptyText={emptyText}
+ />
+ );
+ }
+
return (
<div className="mt-6 border-t pt-5">
<h3 className="mb-4 text-xs font-medium tracking-wide text-muted-foreground uppercase">
@@ -60,27 +86,8 @@ export default function IssueActivityFeed({
onValueChange={(value) => view.setTab(value as ActivityTab)}
className="mt-5 gap-3"
>
- <IssueActivityToolbar issueId={issueId} view={view} />
- <TabsContent value={view.tab}>
- {view.grouped ? (
- <IssueGroupedFeed
- issueId={issueId}
- slice={view.slice}
- columns={columns}
- imageByUserId={imageByUserId}
- composer={composer}
- emptyText={emptyText}
- />
- ) : (
- <IssueFeedList
- issueId={issueId}
- slice={view.slice}
- imageByUserId={imageByUserId}
- composer={composer}
- emptyText={emptyText}
- />
- )}
- </TabsContent>
+ <IssueActivityToolbar issueId={issueId} view={view} canReadAgentRuns={canReadAgentRuns} />
+ <TabsContent value={view.tab}>{content}</TabsContent>
</Tabs>
)}
</div>
diff --git a/apps/web/src/features/issue/components/detail/IssueActivityToolbar.tsx b/apps/web/src/features/issue/components/detail/IssueActivityToolbar.tsx
index 9f785fcd..c45f50cf 100644
--- a/apps/web/src/features/issue/components/detail/IssueActivityToolbar.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueActivityToolbar.tsx
@@ -5,9 +5,6 @@ import { TabsList, TabsTrigger } from '@/components/ui/tabs';
import { useFeedCountsQuery } from '../../services/comments.service';
import type { ActivityFeedView, ActivityTab } from '../../hooks/useActivityFeedView';
-// The row over the activity log: its tabs with how many entries each holds, and the
-// switches for grouping by status and for the order.
-
const TABS = [
{ tab: 'all', label: 'feedTabAll' },
{ tab: 'comments', label: 'feedTabComments' },
@@ -18,9 +15,11 @@ const TABS = [
export default function IssueActivityToolbar({
issueId,
view,
+ canReadAgentRuns,
}: {
issueId: number;
view: ActivityFeedView;
+ canReadAgentRuns: boolean;
}) {
const t = useTranslations('issue');
const counts = useFeedCountsQuery(issueId).data;
@@ -38,28 +37,37 @@ export default function IssueActivityToolbar({
)}
</TabsTrigger>
))}
+ {canReadAgentRuns && (
+ <TabsTrigger value="agentRuns" className="text-[13px]">
+ {t('agentRuns.title')}
+ </TabsTrigger>
+ )}
</TabsList>
- <Button
- variant="ghost"
- size="sm"
- aria-pressed={view.grouped}
- title={t('feedGroupByStatus')}
- onClick={() => view.setGrouped(!view.grouped)}
- className="h-7 gap-1.5 px-2 text-xs text-muted-foreground aria-pressed:bg-accent aria-pressed:text-foreground"
- >
- <Layers className="size-3.5" />
- {t('feedStatus')}
- </Button>
- <Button
- variant="ghost"
- size="sm"
- title={t('feedChangeOrder')}
- onClick={() => view.setOrder(view.order === 'desc' ? 'asc' : 'desc')}
- className="h-7 gap-1.5 px-2 text-xs text-muted-foreground"
- >
- <ArrowDownUp className="size-3.5" />
- {t(view.order === 'desc' ? 'feedNewest' : 'feedOldest')}
- </Button>
+ {view.tab !== 'agentRuns' && (
+ <>
+ <Button
+ variant="ghost"
+ size="sm"
+ aria-pressed={view.grouped}
+ title={t('feedGroupByStatus')}
+ onClick={() => view.setGrouped(!view.grouped)}
+ className="h-7 gap-1.5 px-2 text-xs text-muted-foreground aria-pressed:bg-accent aria-pressed:text-foreground"
+ >
+ <Layers className="size-3.5" />
+ {t('feedStatus')}
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
+ title={t('feedChangeOrder')}
+ onClick={() => view.setOrder(view.order === 'desc' ? 'asc' : 'desc')}
+ className="h-7 gap-1.5 px-2 text-xs text-muted-foreground"
+ >
+ <ArrowDownUp className="size-3.5" />
+ {t(view.order === 'desc' ? 'feedNewest' : 'feedOldest')}
+ </Button>
+ </>
+ )}
</div>
);
}
diff --git a/apps/web/src/features/issue/components/detail/IssueAgentRunsPanel.tsx b/apps/web/src/features/issue/components/detail/IssueAgentRunsPanel.tsx
new file mode 100644
index 00000000..11c30286
--- /dev/null
+++ b/apps/web/src/features/issue/components/detail/IssueAgentRunsPanel.tsx
@@ -0,0 +1,69 @@
+import { useTranslations } from 'next-intl';
+import { Button } from '@/components/ui/button';
+import { useLiveRefresh } from '@/hooks/useLiveRefresh';
+import { useIssueAgentRunsQuery } from '@/services/issues.service';
+import { qk } from '@/services/queryKeys';
+import { revScope } from '@/utils/revScopes';
+import AgentRunItem from '@/components/common/agent-runs/AgentRunItem';
+
+export default function IssueAgentRunsPanel({
+ issueId,
+ canRead,
+}: {
+ issueId: number;
+ canRead: boolean;
+}) {
+ const t = useTranslations('issue.agentRuns');
+ const query = useIssueAgentRunsQuery(issueId, canRead);
+ useLiveRefresh({
+ scope: revScope.issue(issueId),
+ targets: [qk.issueAgentRuns(issueId)],
+ enabled: canRead,
+ });
+ useLiveRefresh({
+ scope: revScope.runnerQueue,
+ targets: [qk.issueAgentRuns(issueId)],
+ enabled: canRead,
+ });
+ if (!canRead) return null;
+ const runs = query.isError ? [] : (query.data?.pages.flatMap((page) => page.items) ?? []);
+ return (
+ <section>
+ <div className="flex justify-end">
+ <Button
+ variant="ghost"
+ size="sm"
+ disabled={query.isFetching}
+ onClick={() => void query.refetch()}
+ >
+ {t('refresh')}
+ </Button>
+ </div>
+ <div>
+ {query.isLoading && <p className="text-xs text-muted-foreground">{t('loading')}</p>}
+ {query.isError && (
+ <p role="alert" className="text-xs text-destructive">
+ {t('loadError')}
+ </p>
+ )}
+ {query.isSuccess && runs.length === 0 && (
+ <p className="text-xs text-muted-foreground">{t('empty')}</p>
+ )}
+ {runs.map((run) => (
+ <AgentRunItem key={run.id} issueId={issueId} run={run} />
+ ))}
+ {!query.isError && query.hasNextPage && (
+ <Button
+ variant="outline"
+ size="sm"
+ className="mt-3"
+ disabled={query.isFetchingNextPage}
+ onClick={() => void query.fetchNextPage()}
+ >
+ {t('loadMore')}
+ </Button>
+ )}
+ </div>
+ </section>
+ );
+}
diff --git a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
index d61bed0c..5c6b020a 100644
--- a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx
@@ -76,6 +76,12 @@ export default function IssueDetailContent({
activityView,
} = useIssueDetail(project, issueId, onIssueLoaded);
const permissions = usePermissions(project);
+ const canReadAgentRuns =
+ permissions.can('ai_agents', 'read') && permissions.can('work_items', 'read');
+ const effectiveActivityView =
+ activityView.tab === 'agentRuns' && !canReadAgentRuns
+ ? { ...activityView, tab: 'all' as const }
+ : activityView;
const canEdit = permissions.can('work_items', 'edit');
const canManageDevelopment = permissions.can('repositories', 'edit');
const canReadDocuments = permissions.can('documents', 'read');
@@ -271,7 +277,8 @@ export default function IssueDetailContent({
assignees={project.assignees}
columns={project.columns}
imageByUserId={imageByUserId}
- view={activityView}
+ view={effectiveActivityView}
+ canReadAgentRuns={canReadAgentRuns}
/>
</div>
<LastCommentBubble
@@ -279,7 +286,7 @@ export default function IssueDetailContent({
issueId={issue.id}
feedRef={feedRef}
imageByUserId={imageByUserId}
- view={activityView}
+ view={effectiveActivityView}
/>
</>
);
diff --git a/apps/web/src/features/issue/hooks/useActivityFeedView.ts b/apps/web/src/features/issue/hooks/useActivityFeedView.ts
index 6ba06193..73fc60f8 100644
--- a/apps/web/src/features/issue/hooks/useActivityFeedView.ts
+++ b/apps/web/src/features/issue/hooks/useActivityFeedView.ts
@@ -6,9 +6,9 @@ import {
} from '@/services/preferences.service';
import type { FeedSlice } from '../services/comments.service';
-export type ActivityTab = 'all' | FeedFilter;
+export type ActivityTab = 'all' | 'agentRuns' | FeedFilter;
-const TABS: ActivityTab[] = ['all', 'comments', 'history', 'worklog'];
+const TABS: ActivityTab[] = ['all', 'comments', 'history', 'worklog', 'agentRuns'];
const TAB_KEY = 'issue-activity-tab';
const ORDER_KEY = 'issue-activity-order';
@@ -50,7 +50,7 @@ export function useActivityFeedView() {
const tab = stored?.tab ?? 'all';
const order = stored?.order ?? 'desc';
- const slice: FeedSlice = { filter: tab === 'all' ? null : tab, order };
+ const slice: FeedSlice = { filter: tab === 'all' || tab === 'agentRuns' ? null : tab, order };
return {
ready: stored != null && preference != null,
tab,
diff --git a/apps/web/src/features/issue/hooks/useLastComment.ts b/apps/web/src/features/issue/hooks/useLastComment.ts
index be6e887c..208196db 100644
--- a/apps/web/src/features/issue/hooks/useLastComment.ts
+++ b/apps/web/src/features/issue/hooks/useLastComment.ts
@@ -11,7 +11,7 @@ export function useLastComment(issueId: number, view: ActivityFeedView): FeedIte
const flatFeed = useFeedQuery(issueId, view.slice, false);
const groupedFeed = useGroupedFeedQuery(issueId, view.slice, false);
- if (view.order === 'asc') return undefined;
+ if (view.tab === 'agentRuns' || view.order === 'asc') return undefined;
const items = view.grouped
? (groupedFeed.data?.pages ?? []).flatMap((page) => page.groups.flatMap((g) => g.items))
: (flatFeed.data?.pages ?? []).flatMap((page) => page.items);
diff --git a/apps/web/src/features/runner-queue/RunnerQueuePage.tsx b/apps/web/src/features/runner-queue/RunnerQueuePage.tsx
new file mode 100644
index 00000000..72144f6f
--- /dev/null
+++ b/apps/web/src/features/runner-queue/RunnerQueuePage.tsx
@@ -0,0 +1,117 @@
+'use client';
+
+import type { ReactNode } from 'react';
+import { useParams } from 'next/navigation';
+import { RefreshCw } from 'lucide-react';
+import { cn } from '@/lib/utils';
+import { useTranslations } from 'next-intl';
+import { useLiveRefresh } from '@/hooks/useLiveRefresh';
+import { useShellRoute } from '@/hooks/useShellRoute';
+import { useRunnerQueueQuery } from '@/services/runnerQueue.service';
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import { qk } from '@/services/queryKeys';
+import { revScope } from '@/utils/revScopes';
+import { runnerQueueRunPath } from '@/utils/paths';
+import { Button } from '@/components/ui/button';
+import RunnerQueueActiveCard from './components/RunnerQueueActiveCard';
+import RunnerQueueHistoryRow from './components/RunnerQueueHistoryRow';
+import RunnerQueueOfflineNotice from './components/RunnerQueueOfflineNotice';
+
+const isActive = (run: RunnerQueueRun) =>
+ run.executionState === 'queued' || run.executionState === 'running';
+
+export default function RunnerQueuePage({ children }: { children: ReactNode }) {
+ const params = useParams<{ runId?: string }>();
+ const selectedId = params.runId ? Number(params.runId) : null;
+ const projectKey = useShellRoute().projectKey ?? '';
+ const t = useTranslations('issue.agentRuns');
+ const query = useRunnerQueueQuery();
+ useLiveRefresh({ scope: revScope.runnerQueue, targets: [qk.runnerQueue] });
+ const pages = query.isError ? undefined : query.data?.pages;
+ const data = pages?.[0];
+ const runs = pages?.flatMap((page) => page.items) ?? [];
+ const active = runs.filter(isActive);
+ const history = runs.filter((run) => !isActive(run));
+ return (
+ <div className="flex h-full min-h-0">
+ <div
+ className={cn(
+ 'flex w-full min-w-0 flex-col md:max-w-sm md:border-e',
+ selectedId != null && 'hidden md:flex',
+ )}
+ >
+ <div className="flex items-center justify-between gap-2 p-4 pb-3">
+ <h1 className="text-base font-semibold">{t('queueTitle')}</h1>
+ <Button
+ variant="outline"
+ size="icon-sm"
+ aria-label={t('refresh')}
+ disabled={query.isFetching}
+ onClick={() => void query.refetch()}
+ >
+ <RefreshCw />
+ </Button>
+ </div>
+ <div className="min-h-0 flex-1 overflow-y-auto pb-4">
+ {query.isLoading && <p className="px-4 text-sm text-muted-foreground">{t('loading')}</p>}
+ {query.isError && (
+ <p role="alert" className="px-4 text-sm text-destructive">
+ {t('loadError')}
+ </p>
+ )}
+ {data && data.total === 0 && (
+ <p className="px-4 text-sm text-muted-foreground">{t('queueEmpty')}</p>
+ )}
+ <RunnerQueueOfflineNotice runs={active} />
+ {data && active.length > 0 && (
+ <section>
+ <h2 className="flex justify-between px-4 pt-3 pb-2 text-xs font-semibold text-muted-foreground">
+ {t('activeSection')}
+ <span className="font-normal">{data.queued + data.running}</span>
+ </h2>
+ <div className="space-y-2 px-4">
+ {active.map((run) => (
+ <RunnerQueueActiveCard
+ key={run.id}
+ run={run}
+ href={runnerQueueRunPath(projectKey, run.id)}
+ selected={run.id === selectedId}
+ />
+ ))}
+ </div>
+ </section>
+ )}
+ {history.length > 0 && (
+ <section>
+ <h2 className="px-4 pt-5 pb-1.5 text-xs font-semibold text-muted-foreground">
+ {t('historySection')}
+ </h2>
+ {history.map((run) => (
+ <RunnerQueueHistoryRow
+ key={run.id}
+ run={run}
+ href={runnerQueueRunPath(projectKey, run.id)}
+ selected={run.id === selectedId}
+ />
+ ))}
+ </section>
+ )}
+ {query.hasNextPage && (
+ <div className="px-4 pt-3">
+ <Button
+ variant="outline"
+ size="sm"
+ className="w-full"
+ disabled={query.isFetchingNextPage}
+ onClick={() => void query.fetchNextPage()}
+ >
+ {t('loadMore')}
+ </Button>
+ </div>
+ )}
+ </div>
+ </div>
+ {children}
+ </div>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/RunnerQueueRunPage.test.tsx b/apps/web/src/features/runner-queue/RunnerQueueRunPage.test.tsx
new file mode 100644
index 00000000..3ea9965f
--- /dev/null
+++ b/apps/web/src/features/runner-queue/RunnerQueueRunPage.test.tsx
@@ -0,0 +1,144 @@
+import assert from 'node:assert/strict';
+import { it } from 'node:test';
+import { act } from 'react';
+import { JSDOM } from 'jsdom';
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+import { NextIntlClientProvider } from 'next-intl';
+import { SyncProvider } from '@/context/syncContext';
+import { RelativeTimeProvider } from '@/context/relativeTimeContext';
+import { qk } from '@/services/queryKeys';
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import issue from '../../../messages/en/issue.json';
+import common from '../../../messages/en/common.json';
+
+it('shows the run its URL names and hides it after access denial', async () => {
+ const names = [
+ 'window',
+ 'document',
+ 'navigator',
+ 'Node',
+ 'NodeFilter',
+ 'DocumentFragment',
+ 'Element',
+ 'HTMLElement',
+ 'HTMLInputElement',
+ 'HTMLFormElement',
+ 'HTMLSelectElement',
+ 'SVGElement',
+ 'ShadowRoot',
+ 'Event',
+ 'CustomEvent',
+ 'MutationObserver',
+ 'getComputedStyle',
+ 'requestAnimationFrame',
+ 'cancelAnimationFrame',
+ 'ResizeObserver',
+ 'fetch',
+ 'IS_REACT_ACT_ENVIRONMENT',
+ ] as const;
+ const descriptors = new Map(
+ names.map((name) => [name, Object.getOwnPropertyDescriptor(globalThis, name)]),
+ );
+ const dom = new JSDOM('<div id="root"></div>', {
+ url: 'http://localhost',
+ pretendToBeVisual: true,
+ });
+ const run: RunnerQueueRun = {
+ id: 1,
+ agentId: 1,
+ username: 'runner',
+ kind: 'external',
+ status: 'success',
+ executionState: 'success',
+ trigger: 'manual',
+ prompt: 'Inspect task',
+ output: 'Selected result',
+ attempts: 1,
+ lastError: null,
+ createdAt: '2026-01-01T00:00:00Z',
+ startedAt: null,
+ finishedAt: null,
+ nextAttemptAt: '2026-01-01T00:00:00Z',
+ issueId: null,
+ sequenceNumber: null,
+ issueTitle: null,
+ scheduleName: null,
+ projectRef: 'team.RUN',
+ runnerState: 'online',
+ };
+ Object.defineProperties(globalThis, {
+ window: { configurable: true, value: dom.window },
+ document: { configurable: true, value: dom.window.document },
+ navigator: { configurable: true, value: dom.window.navigator },
+ IS_REACT_ACT_ENVIRONMENT: { configurable: true, value: true },
+ fetch: { configurable: true, value: async () => Response.json(null) },
+ });
+ for (const name of names) {
+ if (name in dom.window)
+ Object.defineProperty(globalThis, name, {
+ configurable: true,
+ value: dom.window[name as keyof typeof dom.window],
+ });
+ }
+ Object.defineProperties(globalThis, {
+ getComputedStyle: { configurable: true, value: dom.window.getComputedStyle.bind(dom.window) },
+ requestAnimationFrame: {
+ configurable: true,
+ value: dom.window.requestAnimationFrame.bind(dom.window),
+ },
+ cancelAnimationFrame: {
+ configurable: true,
+ value: dom.window.cancelAnimationFrame.bind(dom.window),
+ },
+ ResizeObserver: {
+ configurable: true,
+ value: class {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+ },
+ },
+ });
+ const client = new QueryClient({
+ defaultOptions: { queries: { staleTime: Infinity, retry: false } },
+ });
+ const detailKey = [...qk.runnerQueue, { page: 1, pageSize: 1, runId: 1 }];
+ const page = { items: [run], total: 1, page: 1, pageSize: 10, queued: 0, running: 0 };
+ client.setQueryData(detailKey, page);
+ client.setQueryData([...qk.externalRunTrace(1), null], null);
+ const { default: RunnerQueueRunPage } = await import('./RunnerQueueRunPage');
+ const { createRoot } = await import('react-dom/client');
+ const root = createRoot(document.getElementById('root')!);
+ try {
+ await act(async () =>
+ root.render(
+ <QueryClientProvider client={client}>
+ <SyncProvider>
+ <NextIntlClientProvider locale="en" timeZone="UTC" messages={{ issue, common }}>
+ <RelativeTimeProvider>
+ <RunnerQueueRunPage runId={1} queuePath="/team/RUN/agents/queue" />
+ </RelativeTimeProvider>
+ </NextIntlClientProvider>
+ </SyncProvider>
+ </QueryClientProvider>,
+ ),
+ );
+ assert.ok(document.body.textContent?.includes('Selected result'));
+ await act(async () => {
+ client
+ .getQueryCache()
+ .find({ queryKey: detailKey })!
+ .setState({ status: 'error', error: new Error('Denied') });
+ await new Promise((resolve) => setTimeout(resolve, 10));
+ });
+ assert.ok(!document.body.textContent?.includes('Selected result'));
+ } finally {
+ await act(async () => root.unmount());
+ client.clear();
+ dom.window.close();
+ for (const [name, descriptor] of descriptors) {
+ if (descriptor) Object.defineProperty(globalThis, name, descriptor);
+ else Reflect.deleteProperty(globalThis, name);
+ }
+ }
+});
diff --git a/apps/web/src/features/runner-queue/RunnerQueueRunPage.tsx b/apps/web/src/features/runner-queue/RunnerQueueRunPage.tsx
new file mode 100644
index 00000000..9d3e88b8
--- /dev/null
+++ b/apps/web/src/features/runner-queue/RunnerQueueRunPage.tsx
@@ -0,0 +1,37 @@
+'use client';
+
+import Link from 'next/link';
+import { useTranslations } from 'next-intl';
+import { useRunnerQueueRunQuery } from '@/services/runnerQueue.service';
+import { titlePath, useDocumentTitle } from '@/hooks/useDocumentTitle';
+import { Button } from '@/components/ui/button';
+import RunnerQueueRunDetail from './components/RunnerQueueRunDetail';
+
+export default function RunnerQueueRunPage({
+ runId,
+ queuePath,
+}: {
+ runId: number;
+ queuePath: string;
+}) {
+ const t = useTranslations('issue.agentRuns');
+ const query = useRunnerQueueRunQuery(runId);
+ const run = query.isError ? null : query.data?.items[0];
+ useDocumentTitle(
+ titlePath(t('queueTitle'), run && (run.issueTitle ?? run.scheduleName ?? `#${run.id}`)),
+ );
+ return (
+ <div className="min-w-0 flex-1 overflow-y-auto px-4 py-6 md:px-10 md:py-8">
+ <Button asChild variant="ghost" className="mb-3 md:hidden">
+ <Link href={queuePath}>{t('backToRuns')}</Link>
+ </Button>
+ {query.isLoading && <p className="text-sm text-muted-foreground">{t('loading')}</p>}
+ {(query.isError || (query.isSuccess && !run)) && (
+ <p role="alert" className="text-sm text-muted-foreground">
+ {t('runNotFound')}
+ </p>
+ )}
+ {run && <RunnerQueueRunDetail key={run.id} run={run} />}
+ </div>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueActiveCard.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueActiveCard.tsx
new file mode 100644
index 00000000..e2e2cdb0
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueActiveCard.tsx
@@ -0,0 +1,77 @@
+import Link from 'next/link';
+import { useTranslations } from 'next-intl';
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import { cn } from '@/lib/utils';
+import { useRelativeTime } from '@/context/relativeTimeContext';
+import { formatTime } from '@/utils/dates';
+import { runIssueKey } from '../utils/runIssueKey';
+import { waitsForRunner } from '../utils/waitsForRunner';
+import RunnerQueueStateIcon from './RunnerQueueStateIcon';
+
+type Translate = ReturnType<typeof useTranslations<'issue.agentRuns'>>;
+
+// What the run waits on, and when that changes. A push agent's presence is unknown, so
+// only the endpoint's last refusal is shown for it.
+function runStatus(
+ run: RunnerQueueRun,
+ t: Translate,
+ relativeTime: (value: string) => string,
+): [label: string, aside: string | null] {
+ if (run.executionState === 'running') {
+ return [t('running'), relativeTime(run.startedAt ?? run.createdAt)];
+ }
+ const due = new Date(run.nextAttemptAt) > new Date();
+ const time = formatTime(run.nextAttemptAt);
+ if (run.lastError) return [run.lastError, due ? t('retryAt', { time }) : null];
+ if (waitsForRunner(run)) return [t('waitingForRunner'), relativeTime(run.createdAt)];
+ return [t('queued'), due ? t('startsAt', { time }) : relativeTime(run.createdAt)];
+}
+
+export default function RunnerQueueActiveCard({
+ run,
+ href,
+ selected,
+}: {
+ run: RunnerQueueRun;
+ href: string;
+ selected: boolean;
+}) {
+ const t = useTranslations('issue.agentRuns');
+ const relativeTime = useRelativeTime();
+ const [label, aside] = runStatus(run, t, relativeTime);
+ const meta = [
+ runIssueKey(run),
+ `@${run.username}`,
+ t(`triggers.${run.trigger}`),
+ run.attempts > 1 ? t('attempts', { count: run.attempts }) : null,
+ ]
+ .filter(Boolean)
+ .join(' · ');
+ return (
+ <Link
+ href={href}
+ aria-current={selected ? 'page' : undefined}
+ className={cn(
+ 'flex w-full flex-col gap-1.5 rounded-lg border bg-card p-3 text-start hover:bg-accent/50',
+ selected && 'bg-accent',
+ )}
+ >
+ <span
+ className={cn(
+ 'flex w-full items-center gap-1.5 text-xs font-medium',
+ run.executionState === 'queued' && 'text-warning',
+ )}
+ >
+ <RunnerQueueStateIcon run={run} className="size-3.5" />
+ <span className="truncate">{label}</span>
+ {aside && (
+ <span className="ms-auto shrink-0 font-normal text-muted-foreground">{aside}</span>
+ )}
+ </span>
+ <span className="line-clamp-2 text-sm font-medium" dir="auto">
+ {run.issueTitle ?? run.scheduleName ?? run.prompt}
+ </span>
+ <span className="text-xs text-muted-foreground">{meta}</span>
+ </Link>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueHistoryRow.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueHistoryRow.tsx
new file mode 100644
index 00000000..e16493bc
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueHistoryRow.tsx
@@ -0,0 +1,46 @@
+import Link from 'next/link';
+import { useTranslations } from 'next-intl';
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import { cn } from '@/lib/utils';
+import { useRelativeTime } from '@/context/relativeTimeContext';
+import { formatDateTime } from '@/utils/dates';
+import { runIssueKey } from '../utils/runIssueKey';
+import RunnerQueueStateIcon from './RunnerQueueStateIcon';
+
+export default function RunnerQueueHistoryRow({
+ run,
+ href,
+ selected,
+}: {
+ run: RunnerQueueRun;
+ href: string;
+ selected: boolean;
+}) {
+ const t = useTranslations('issue.agentRuns');
+ const relativeTime = useRelativeTime();
+ const issueKey = runIssueKey(run);
+ return (
+ <Link
+ href={href}
+ aria-current={selected ? 'page' : undefined}
+ className={cn(
+ 'flex h-10 w-full items-center gap-2.5 px-4 text-start hover:bg-accent/50',
+ selected && 'bg-accent',
+ )}
+ >
+ <RunnerQueueStateIcon run={run} className="size-3.5" />
+ <span className="sr-only">{t(run.executionState)}</span>
+ <span className="truncate text-sm font-medium" dir="auto">
+ {run.issueTitle ?? run.scheduleName ?? run.prompt}
+ </span>
+ {issueKey && <span className="shrink-0 text-xs text-muted-foreground">{issueKey}</span>}
+ <time
+ className="ms-auto shrink-0 text-xs text-muted-foreground"
+ dateTime={run.createdAt}
+ title={formatDateTime(run.createdAt)}
+ >
+ {relativeTime(run.createdAt)}
+ </time>
+ </Link>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueNoRun.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueNoRun.tsx
new file mode 100644
index 00000000..5a03de7e
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueNoRun.tsx
@@ -0,0 +1,12 @@
+'use client';
+
+import { useTranslations } from 'next-intl';
+
+export default function RunnerQueueNoRun() {
+ const t = useTranslations('issue.agentRuns');
+ return (
+ <p className="hidden flex-1 items-center justify-center p-6 text-sm text-muted-foreground md:flex">
+ {t('selectRun')}
+ </p>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueOfflineNotice.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueOfflineNotice.tsx
new file mode 100644
index 00000000..93803ac4
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueOfflineNotice.tsx
@@ -0,0 +1,36 @@
+import { CircleAlert } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import { waitsForRunner } from '../utils/waitsForRunner';
+
+// One notice per pull agent with waiting runs and no runner connected. A push agent is
+// left out: whether its endpoint is up is not known.
+export default function RunnerQueueOfflineNotice({ runs }: { runs: RunnerQueueRun[] }) {
+ const t = useTranslations('issue.agentRuns');
+ const agents = new Map<number, { username: string; state: 'offline' | 'never' }>();
+ for (const run of runs) {
+ if (waitsForRunner(run)) {
+ agents.set(run.agentId, { username: run.username, state: run.runnerState });
+ }
+ }
+ if (agents.size === 0) return null;
+ return (
+ <div className="space-y-2 px-4 pb-1">
+ {[...agents].map(([agentId, agent]) => (
+ <div
+ key={agentId}
+ role="status"
+ className="flex gap-2.5 rounded-lg border border-warning/35 bg-warning/10 px-3 py-2.5 text-sm"
+ >
+ <CircleAlert aria-hidden className="mt-0.5 size-4 shrink-0 text-warning" />
+ <div>
+ <p className="font-semibold">
+ @{agent.username} · {t(`presence.${agent.state}`)}
+ </p>
+ <p className="text-muted-foreground">{t('offlineHint')}</p>
+ </div>
+ </div>
+ ))}
+ </div>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueRunDetail.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueRunDetail.tsx
new file mode 100644
index 00000000..4e53a10f
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueRunDetail.tsx
@@ -0,0 +1,36 @@
+import { useTranslations } from 'next-intl';
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import AgentRunExternalTrace from '@/components/common/agent-runs/AgentRunExternalTrace';
+import RunnerQueueRunHeader from './RunnerQueueRunHeader';
+import RunnerQueueRunFacts from './RunnerQueueRunFacts';
+import RunnerQueueRunResult from './RunnerQueueRunResult';
+import RunnerQueueRunSection from './RunnerQueueRunSection';
+
+export default function RunnerQueueRunDetail({ run }: { run: RunnerQueueRun }) {
+ const t = useTranslations('issue.agentRuns');
+ const failing = run.executionState === 'failed' || run.executionState === 'queued';
+ return (
+ <article className="max-w-3xl space-y-8">
+ <div className="space-y-6">
+ <RunnerQueueRunHeader run={run} />
+ <RunnerQueueRunFacts run={run} />
+ </div>
+ {failing && run.lastError && (
+ <RunnerQueueRunSection title={t('error')}>
+ <p className="text-[15px] whitespace-pre-wrap text-destructive" dir="auto">
+ {run.lastError}
+ </p>
+ </RunnerQueueRunSection>
+ )}
+ {run.output && <RunnerQueueRunResult output={run.output} />}
+ <RunnerQueueRunSection title={t('task')}>
+ <p className="text-sm whitespace-pre-wrap text-muted-foreground" dir="auto">
+ {run.prompt}
+ </p>
+ </RunnerQueueRunSection>
+ <RunnerQueueRunSection title={t('stepsSection')}>
+ <AgentRunExternalTrace runId={run.id} />
+ </RunnerQueueRunSection>
+ </article>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueRunFacts.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueRunFacts.tsx
new file mode 100644
index 00000000..8404a6ed
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueRunFacts.tsx
@@ -0,0 +1,36 @@
+import type { ReactNode } from 'react';
+import { useTranslations } from 'next-intl';
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import { formatDateTime } from '@/utils/dates';
+import { AgentContextSize } from '@/components/common/agent-chat/AgentContextSize';
+
+export default function RunnerQueueRunFacts({ run }: { run: RunnerQueueRun }) {
+ const t = useTranslations('issue.agentRuns');
+ const facts: [string, ReactNode][] = [
+ [t('facts.agent'), `@${run.username}`],
+ [t('facts.trigger'), t(`triggers.${run.trigger}`)],
+ ];
+ if (run.startedAt) facts.push([t('facts.started'), formatDateTime(run.startedAt)]);
+ if (run.finishedAt) facts.push([t('facts.finished'), formatDateTime(run.finishedAt)]);
+ facts.push(
+ [t('facts.attempts'), run.attempts],
+ [
+ run.runnerState === 'push' ? t('facts.delivery') : t('facts.runner'),
+ t(`connection.${run.runnerState}`),
+ ],
+ );
+ if (run.contextTokens != null) {
+ facts.push([t('facts.context'), <AgentContextSize key="context" tokens={run.contextTokens} />]);
+ }
+ facts.push([t('facts.run'), `#${run.id}`]);
+ return (
+ <dl className="flex flex-wrap gap-x-9 gap-y-4">
+ {facts.map(([label, value]) => (
+ <div key={label} className="space-y-1">
+ <dt className="text-xs text-muted-foreground">{label}</dt>
+ <dd className="text-sm">{value}</dd>
+ </div>
+ ))}
+ </dl>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueRunHeader.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueRunHeader.tsx
new file mode 100644
index 00000000..065c2ae1
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueRunHeader.tsx
@@ -0,0 +1,96 @@
+import Link from 'next/link';
+import { ArrowUpRight, Ban, Check, Clock, LoaderCircle, Send, X } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import { cn } from '@/lib/utils';
+import { useRelativeTime } from '@/context/relativeTimeContext';
+import { formatTime } from '@/utils/dates';
+import { issuePath } from '@/utils/paths';
+import { Button } from '@/components/ui/button';
+import { formatRunDuration } from '../utils/formatRunDuration';
+import { runIssueKey } from '../utils/runIssueKey';
+import { waitsForRunner } from '../utils/waitsForRunner';
+
+type Translate = ReturnType<typeof useTranslations<'issue.agentRuns'>>;
+
+const OUTCOME = {
+ success: [Check, 'bg-muted'],
+ failed: [X, 'bg-destructive/15 text-destructive'],
+ running: [LoaderCircle, 'bg-muted [&>svg]:animate-spin'],
+ queued: [Clock, 'bg-warning/15 text-warning'],
+ canceled: [Ban, 'bg-muted text-muted-foreground'],
+} as const;
+
+// How long a finished run took, or when a waiting one moves next. A run that was retried
+// counts its attempts instead: its time includes the waits between them.
+function outcomeDetail(
+ run: RunnerQueueRun,
+ t: Translate,
+ relativeTime: (value: string) => string,
+): string | null {
+ if (run.executionState === 'running') {
+ return run.startedAt ? t('startedAgo', { time: relativeTime(run.startedAt) }) : null;
+ }
+ if (run.executionState === 'queued') {
+ if (new Date(run.nextAttemptAt) <= new Date()) return null;
+ const time = formatTime(run.nextAttemptAt);
+ return run.lastError ? t('retryAt', { time }) : t('startsAt', { time });
+ }
+ if (run.executionState === 'canceled') return null;
+ if (run.attempts > 1) return t('afterAttempts', { count: run.attempts });
+ if (!run.startedAt || !run.finishedAt) return null;
+ const took = Date.parse(run.finishedAt) - Date.parse(run.startedAt);
+ return t('inDuration', { duration: formatRunDuration(took) });
+}
+
+export default function RunnerQueueRunHeader({ run }: { run: RunnerQueueRun }) {
+ const t = useTranslations('issue.agentRuns');
+ const relativeTime = useRelativeTime();
+ const [StateIcon, tone] = OUTCOME[run.executionState];
+ const Icon = run.executionState === 'queued' && run.runnerState === 'push' ? Send : StateIcon;
+ const detail = outcomeDetail(run, t, relativeTime);
+ const issueKey = runIssueKey(run);
+ const href = run.sequenceNumber == null ? null : issuePath(run.projectRef, run.sequenceNumber);
+ return (
+ <header className="flex flex-wrap items-start justify-between gap-4">
+ <div className="flex min-w-0 items-center gap-4">
+ <span
+ className={cn('flex size-12 shrink-0 items-center justify-center rounded-full', tone)}
+ >
+ <Icon aria-hidden className="size-5" />
+ </span>
+ <div className="min-w-0 space-y-1">
+ <h2 className="text-xl font-semibold">
+ {waitsForRunner(run) ? t('waitingForRunner') : t(run.executionState)}
+ {detail && <span className="font-normal text-muted-foreground"> {detail}</span>}
+ </h2>
+ <p className="truncate text-sm text-muted-foreground">
+ {href ? (
+ <Link
+ href={href}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="font-medium text-foreground hover:underline"
+ dir="auto"
+ >
+ {issueKey} {run.issueTitle}
+ </Link>
+ ) : (
+ run.scheduleName && t('scheduleRun', { name: run.scheduleName })
+ )}
+ {(href || run.scheduleName) && ' · '}
+ {run.projectRef}
+ </p>
+ </div>
+ </div>
+ {href && (
+ <Button asChild variant="secondary" size="sm">
+ <Link href={href} target="_blank" rel="noopener noreferrer">
+ {t('openWorkItem')}
+ <ArrowUpRight />
+ </Link>
+ </Button>
+ )}
+ </header>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueRunResult.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueRunResult.tsx
new file mode 100644
index 00000000..f9fe9b61
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueRunResult.tsx
@@ -0,0 +1,67 @@
+import { useEffect, useRef, useState } from 'react';
+import { Check, Copy } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import { cn } from '@/lib/utils';
+import { Button } from '@/components/ui/button';
+import Markdown from '@/components/common/Markdown';
+import RunnerQueueRunSection from './RunnerQueueRunSection';
+
+export default function RunnerQueueRunResult({ output }: { output: string }) {
+ const t = useTranslations('issue.agentRuns');
+ const tCommon = useTranslations('common');
+ const [copied, setCopied] = useState(false);
+ const [expanded, setExpanded] = useState(false);
+ const [overflows, setOverflows] = useState(false);
+ const body = useRef<HTMLDivElement>(null);
+
+ useEffect(() => {
+ const el = body.current;
+ if (el) setOverflows(el.scrollHeight > el.clientHeight);
+ }, [output]);
+
+ async function copy() {
+ try {
+ await navigator.clipboard.writeText(output);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 1500);
+ } catch {
+ // Clipboard can be blocked (no permission / insecure origin); ignore.
+ }
+ }
+
+ const folded = !expanded && overflows;
+ return (
+ <RunnerQueueRunSection
+ title={t('result')}
+ actions={
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ aria-label={copied ? tCommon('copied') : tCommon('copy')}
+ onClick={() => void copy()}
+ >
+ {copied ? <Check /> : <Copy />}
+ </Button>
+ }
+ >
+ {output.startsWith('…') && <p className="text-xs text-muted-foreground">{t('outputTail')}</p>}
+ <div
+ ref={body}
+ className={cn(
+ 'relative text-[15px] leading-relaxed',
+ !expanded && 'max-h-72 overflow-hidden',
+ )}
+ >
+ <Markdown>{output}</Markdown>
+ {folded && (
+ <div className="pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-linear-to-t from-background" />
+ )}
+ </div>
+ {folded && (
+ <Button variant="ghost" size="sm" className="-ms-3" onClick={() => setExpanded(true)}>
+ {tCommon('showMore')}
+ </Button>
+ )}
+ </RunnerQueueRunSection>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueRunSection.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueRunSection.tsx
new file mode 100644
index 00000000..b02d41d3
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueRunSection.tsx
@@ -0,0 +1,23 @@
+import type { ReactNode } from 'react';
+
+export default function RunnerQueueRunSection({
+ title,
+ actions,
+ children,
+}: {
+ title: string;
+ actions?: ReactNode;
+ children: ReactNode;
+}) {
+ return (
+ <section className="space-y-3">
+ <div className="flex min-h-7 items-center justify-between gap-2">
+ <h3 className="text-xs font-semibold tracking-wider text-muted-foreground uppercase">
+ {title}
+ </h3>
+ {actions}
+ </div>
+ {children}
+ </section>
+ );
+}
diff --git a/apps/web/src/features/runner-queue/components/RunnerQueueStateIcon.tsx b/apps/web/src/features/runner-queue/components/RunnerQueueStateIcon.tsx
new file mode 100644
index 00000000..604a489e
--- /dev/null
+++ b/apps/web/src/features/runner-queue/components/RunnerQueueStateIcon.tsx
@@ -0,0 +1,23 @@
+import { Ban, CircleCheck, CircleX, Clock, LoaderCircle, Send } from 'lucide-react';
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import { cn } from '@/lib/utils';
+
+const STATE_ICON = {
+ running: [LoaderCircle, 'animate-spin'],
+ queued: [Clock, 'text-warning'],
+ success: [CircleCheck, 'text-muted-foreground'],
+ failed: [CircleX, 'text-destructive'],
+ canceled: [Ban, 'text-muted-foreground'],
+} as const;
+
+export default function RunnerQueueStateIcon({
+ run,
+ className,
+}: {
+ run: RunnerQueueRun;
+ className?: string;
+}) {
+ const [StateIcon, tone] = STATE_ICON[run.executionState];
+ const Icon = run.executionState === 'queued' && run.runnerState === 'push' ? Send : StateIcon;
+ return <Icon aria-hidden className={cn('shrink-0', tone, className)} />;
+}
diff --git a/apps/web/src/features/runner-queue/utils/formatRunDuration.test.ts b/apps/web/src/features/runner-queue/utils/formatRunDuration.test.ts
new file mode 100644
index 00000000..77e90eb7
--- /dev/null
+++ b/apps/web/src/features/runner-queue/utils/formatRunDuration.test.ts
@@ -0,0 +1,10 @@
+import assert from 'node:assert/strict';
+import { it } from 'node:test';
+import { formatRunDuration } from './formatRunDuration';
+
+it('formats a run duration in its two largest units', () => {
+ assert.equal(formatRunDuration(48_200), '48s');
+ assert.equal(formatRunDuration(66_743), '1m 07s');
+ assert.equal(formatRunDuration(7_500_000), '2h 05m');
+ assert.equal(formatRunDuration(-5), '0s');
+});
diff --git a/apps/web/src/features/runner-queue/utils/formatRunDuration.ts b/apps/web/src/features/runner-queue/utils/formatRunDuration.ts
new file mode 100644
index 00000000..9649c454
--- /dev/null
+++ b/apps/web/src/features/runner-queue/utils/formatRunDuration.ts
@@ -0,0 +1,8 @@
+// A run takes seconds to hours: "48s", "1m 07s", "2h 05m".
+export function formatRunDuration(ms: number): string {
+ const seconds = Math.max(0, Math.round(ms / 1000));
+ if (seconds < 60) return `${seconds}s`;
+ const minutes = Math.floor(seconds / 60);
+ if (minutes < 60) return `${minutes}m ${String(seconds % 60).padStart(2, '0')}s`;
+ return `${Math.floor(minutes / 60)}h ${String(minutes % 60).padStart(2, '0')}m`;
+}
diff --git a/apps/web/src/features/runner-queue/utils/runIssueKey.ts b/apps/web/src/features/runner-queue/utils/runIssueKey.ts
new file mode 100644
index 00000000..4f5a79d8
--- /dev/null
+++ b/apps/web/src/features/runner-queue/utils/runIssueKey.ts
@@ -0,0 +1,7 @@
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+import { splitProjectRef } from '@/utils/paths';
+
+export function runIssueKey(run: RunnerQueueRun): string | null {
+ if (run.sequenceNumber == null) return null;
+ return `${splitProjectRef(run.projectRef).key}-${run.sequenceNumber}`;
+}
diff --git a/apps/web/src/features/runner-queue/utils/waitsForRunner.ts b/apps/web/src/features/runner-queue/utils/waitsForRunner.ts
new file mode 100644
index 00000000..838d9e38
--- /dev/null
+++ b/apps/web/src/features/runner-queue/utils/waitsForRunner.ts
@@ -0,0 +1,10 @@
+import type { RunnerQueueRun } from '@/lib/api/endpoints/runnerQueue';
+
+export function waitsForRunner(
+ run: RunnerQueueRun,
+): run is RunnerQueueRun & { runnerState: 'offline' | 'never' } {
+ return (
+ run.executionState === 'queued' &&
+ (run.runnerState === 'offline' || run.runnerState === 'never')
+ );
+}
diff --git a/apps/web/src/features/settings/components/schedules/SettingsScheduleRunRow.tsx b/apps/web/src/features/settings/components/schedules/SettingsScheduleRunRow.tsx
index 9bc21ba3..0a7e3a01 100644
--- a/apps/web/src/features/settings/components/schedules/SettingsScheduleRunRow.tsx
+++ b/apps/web/src/features/settings/components/schedules/SettingsScheduleRunRow.tsx
@@ -1,3 +1,4 @@
+import AgentRunExternalTrace from '@/components/common/agent-runs/AgentRunExternalTrace';
import { useId, useState } from 'react';
import { Ban, ChevronDown, ChevronRight } from 'lucide-react';
import type { AgentScheduleRun } from '@/lib/api/endpoints/agentSchedules';
@@ -20,7 +21,7 @@ export function SettingsScheduleRunRow({
const t = useTranslations('settings.schedules');
const [open, setOpen] = useState(false);
const contentId = useId();
- const running = run.status === 'pending' && run.startedAt != null;
+ const tRun = useTranslations('issue.agentRuns');
return (
<div>
<div className="flex items-center gap-2 pe-2 hover:bg-accent/50">
@@ -36,9 +37,7 @@ export function SettingsScheduleRunRow({
) : (
<ChevronRight className="size-3.5 shrink-0" />
)}
- <Badge variant={statusVariant(run.status)}>
- {running ? t('runStatus.running') : t(`runStatus.${run.status}`)}
- </Badge>
+ <Badge variant={statusVariant(run.status)}>{tRun(run.executionState)}</Badge>
<span className="capitalize">{run.trigger}</span>
<span className="ms-auto flex shrink-0 items-center gap-4">
<span className="w-12 text-end">
@@ -70,6 +69,7 @@ export function SettingsScheduleRunRow({
label={run.lastError ? t('error') : t('result')}
value={run.lastError ?? run.output ?? t('noOutput')}
/>
+ {run.kind === 'external' && <AgentRunExternalTrace runId={run.id} />}
</div>
)}
</div>
diff --git a/apps/web/src/features/settings/components/schedules/SettingsScheduleRunsList.tsx b/apps/web/src/features/settings/components/schedules/SettingsScheduleRunsList.tsx
new file mode 100644
index 00000000..3fcae69a
--- /dev/null
+++ b/apps/web/src/features/settings/components/schedules/SettingsScheduleRunsList.tsx
@@ -0,0 +1,82 @@
+import { useTranslations } from 'next-intl';
+import type { AgentScheduleRun } from '@/lib/api/endpoints/agentSchedules';
+import { Button } from '@/components/ui/button';
+import { SettingsScheduleRunRow } from './SettingsScheduleRunRow';
+
+export default function SettingsScheduleRunsList({
+ runs,
+ canCancel,
+ canceling,
+ onCancel,
+}: {
+ runs: AgentScheduleRun[];
+ canCancel: boolean;
+ canceling: boolean;
+ onCancel: (runId?: number) => void;
+}) {
+ const t = useTranslations('settings.schedules');
+ const groups = [
+ {
+ key: 'pending',
+ title: t('pendingGroup'),
+ runs: runs.filter((run) => run.executionState === 'queued'),
+ },
+ {
+ key: 'running',
+ title: t('runningGroup'),
+ runs: runs.filter((run) => run.executionState === 'running'),
+ },
+ {
+ key: 'completed',
+ title: t('completedGroup'),
+ runs: runs.filter((run) => run.status !== 'pending'),
+ },
+ ].filter((group) => group.runs.length > 0);
+ if (!groups.length) return <p className="p-4 text-sm text-muted-foreground">{t('noRuns')}</p>;
+ return (
+ <>
+ {groups.map((group) => {
+ // Cancellation is limited to runs that have never been claimed.
+ const cancelable = group.runs.filter((run) => !run.startedAt).length;
+ return (
+ <div key={group.key}>
+ <div className="flex items-center gap-2 bg-muted/50 px-4 py-1.5">
+ <p className="text-[10px] font-medium tracking-wide text-muted-foreground uppercase">
+ {group.title}
+ </p>
+ {group.key === 'pending' && canCancel && cancelable > 0 && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ className="ms-auto h-6 text-xs"
+ disabled={canceling}
+ onClick={() => onCancel()}
+ >
+ <span>
+ {t('stopAllPending')}
+ <sup className="ms-0.5 text-[9px] tabular-nums">{cancelable}</sup>
+ </span>
+ </Button>
+ )}
+ </div>
+ <div className="divide-y divide-border/50">
+ {group.runs.map((run) => (
+ <SettingsScheduleRunRow
+ key={run.id}
+ run={run}
+ canceling={canceling}
+ onCancel={
+ group.key === 'pending' && !run.startedAt && canCancel
+ ? () => onCancel(run.id)
+ : undefined
+ }
+ />
+ ))}
+ </div>
+ </div>
+ );
+ })}
+ </>
+ );
+}
diff --git a/apps/web/src/features/settings/components/schedules/SettingsScheduleRunsSheet.tsx b/apps/web/src/features/settings/components/schedules/SettingsScheduleRunsSheet.tsx
index 0c7a9432..1d7fa18a 100644
--- a/apps/web/src/features/settings/components/schedules/SettingsScheduleRunsSheet.tsx
+++ b/apps/web/src/features/settings/components/schedules/SettingsScheduleRunsSheet.tsx
@@ -16,7 +16,7 @@ import {
import { useSettingsCan } from '../../context/settingsPermission';
import { useScheduleTypeName } from '../../hooks/useScheduleTypeName';
import { formatUtc, parseScheduleInput } from '../../utils/cronSchedule';
-import { SettingsScheduleRunRow } from './SettingsScheduleRunRow';
+import SettingsScheduleRunsList from './SettingsScheduleRunsList';
import { useTranslations } from 'next-intl';
export function SettingsScheduleRunsSheet({
@@ -31,11 +31,12 @@ export function SettingsScheduleRunsSheet({
onClose: () => void;
}) {
const t = useTranslations('settings.schedules');
+ const tRun = useTranslations('issue.agentRuns');
const can = useSettingsCan();
const query = useAgentScheduleRuns(projectKey, schedule?.id ?? null);
const cancelRuns = useCancelAgentScheduleRuns(projectKey);
const canCancel = can('edit') && schedule?.canTrigger === true;
- const runs = query.data ?? [];
+ const runs = query.isError ? [] : (query.data ?? []);
const typeName = useScheduleTypeName();
// A type the hosted build added, which starts when its trigger fires.
const addedType = schedule && !schedule.cron && schedule.type !== 'status' ? schedule.type : null;
@@ -56,24 +57,6 @@ export function SettingsScheduleRunsSheet({
if (schedule) cancelRuns.mutate({ scheduleId: schedule.id, runId });
}
- // A claim stamps startedAt, so a started run can no longer be canceled.
- const groups = [
- {
- key: 'pending',
- title: t('pendingGroup'),
- runs: runs.filter((r) => r.status === 'pending' && !r.startedAt),
- },
- {
- key: 'running',
- title: t('runningGroup'),
- runs: runs.filter((r) => r.status === 'pending' && r.startedAt),
- },
- {
- key: 'completed',
- title: t('completedGroup'),
- runs: runs.filter((r) => r.status !== 'pending'),
- },
- ].filter((group) => group.runs.length > 0);
return (
<Sheet open={schedule != null} onOpenChange={(open) => !open && onClose()}>
<SheetContent side="right" className="w-full gap-0 p-0 sm:max-w-xl">
@@ -94,47 +77,24 @@ export function SettingsScheduleRunsSheet({
</SheetDescription>
</SheetHeader>
<div className="min-h-0 flex-1 overflow-y-auto">
- {query.isLoading ? (
- <ListSkeleton rows={4} className="p-4" rowClassName="h-12" />
- ) : groups.length ? (
- groups.map((group) => (
- <div key={group.key}>
- <div className="flex items-center gap-2 bg-muted/50 px-4 py-1.5">
- <p className="text-[10px] font-medium tracking-wide text-muted-foreground uppercase">
- {group.title}
- </p>
- {group.key === 'pending' && canCancel && (
- <Button
- type="button"
- variant="ghost"
- size="sm"
- className="ms-auto h-6 text-xs"
- disabled={cancelRuns.isPending}
- onClick={() => cancel()}
- >
- <span>
- {t('stopAllPending')}
- <sup className="ms-0.5 text-[9px] tabular-nums">{group.runs.length}</sup>
- </span>
- </Button>
- )}
- </div>
- <div className="divide-y divide-border/50">
- {group.runs.map((run) => (
- <SettingsScheduleRunRow
- key={run.id}
- run={run}
- canceling={cancelRuns.isPending && cancelRuns.variables?.runId === run.id}
- onCancel={
- group.key === 'pending' && canCancel ? () => cancel(run.id) : undefined
- }
- />
- ))}
- </div>
- </div>
- ))
- ) : (
- <p className="p-4 text-sm text-muted-foreground">{t('noRuns')}</p>
+ {query.isLoading && <ListSkeleton rows={4} className="p-4" rowClassName="h-12" />}
+ {query.isError && (
+ <div className="space-y-2 p-4">
+ <p role="alert" className="text-xs text-destructive">
+ {tRun('loadError')}
+ </p>
+ <Button variant="ghost" onClick={() => void query.refetch()}>
+ {tRun('refresh')}
+ </Button>
+ </div>
+ )}
+ {query.isSuccess && (
+ <SettingsScheduleRunsList
+ runs={runs}
+ canCancel={canCancel}
+ canceling={cancelRuns.isPending}
+ onCancel={cancel}
+ />
)}
</div>
</SheetContent>
diff --git a/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunItem.tsx b/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunItem.tsx
new file mode 100644
index 00000000..8888da13
--- /dev/null
+++ b/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunItem.tsx
@@ -0,0 +1,80 @@
+import AgentRunExternalTrace from '@/components/common/agent-runs/AgentRunExternalTrace';
+import { useState } from 'react';
+import { ChevronDown, ChevronRight } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import type { AgentRun } from '@/lib/api/endpoints/agents';
+import { useRelativeTime } from '@/context/relativeTimeContext';
+import { formatDateTime } from '@/utils/dates';
+import { AgentContextSize } from '@/components/common/agent-chat/AgentContextSize';
+import AgentRunBlock from '@/components/common/agent-runs/AgentRunBlock';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
+import TeamAiAgentRunStatus from './TeamAiAgentRunStatus';
+
+function runSubject(r: AgentRun, t: ReturnType<typeof useTranslations<'teams.agents'>>): string {
+ if (r.issueId == null) return r.trigger === 'manual' ? t('manualTask') : t('scheduledTask');
+ if (!r.issueIdentifier) return `issue #${r.issueId}`;
+ return `${r.issueIdentifier}${r.issueTitle ? ` · ${r.issueTitle}` : ''}`;
+}
+
+export default function TeamAiAgentRunItem({
+ run: r,
+ external,
+}: {
+ run: AgentRun;
+ external: boolean;
+}) {
+ const t = useTranslations('teams.agents');
+ const relativeTime = useRelativeTime();
+ const [open, setOpen] = useState(false);
+ const subject = runSubject(r, t);
+ const outcome = r.status === 'failed' ? (r.lastError ?? t('failed')) : '';
+ return (
+ <div>
+ <button
+ type="button"
+ className="flex w-full items-center gap-2 px-4 py-2.5 text-start text-xs hover:bg-accent/50"
+ onClick={() => setOpen((v) => !v)}
+ >
+ {open ? (
+ <ChevronDown className="size-3.5 shrink-0" />
+ ) : (
+ <ChevronRight className="size-3.5 shrink-0" />
+ )}
+ <TeamAiAgentRunStatus status={r.executionState} />
+ <span className="shrink-0 text-muted-foreground capitalize">{r.trigger}</span>
+ <span className="truncate font-medium">{subject}</span>
+ {r.attempts > 1 && (
+ <span className="shrink-0 text-muted-foreground">·{r.attempts} attempts</span>
+ )}
+ <span className="ms-auto flex shrink-0 items-center gap-4">
+ <span className="w-12 text-end">
+ {r.contextTokens !== undefined && <AgentContextSize tokens={r.contextTokens} />}
+ </span>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span className="text-muted-foreground">{relativeTime(r.createdAt)}</span>
+ </TooltipTrigger>
+ <TooltipContent>{formatDateTime(r.createdAt)}</TooltipContent>
+ </Tooltip>
+ </span>
+ </button>
+ {open && (
+ <div className="space-y-3 px-4 pb-3">
+ <AgentRunBlock label={t('task')} value={r.prompt} />
+ {r.status === 'failed' && r.lastError && (
+ <AgentRunBlock label={t('error')} value={r.lastError} />
+ )}
+ {r.output && <AgentRunBlock label={t('result')} value={r.output} />}
+ {r.executionState === 'queued' && (
+ <AgentRunBlock
+ label={t('queue')}
+ value={`Attempts: ${r.attempts}. Next attempt: ${formatDateTime(r.nextAttemptAt)}.`}
+ />
+ )}
+ {external && <AgentRunExternalTrace runId={r.id} />}
+ {outcome && <p className="text-xs text-muted-foreground">{outcome}</p>}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunStatus.tsx b/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunStatus.tsx
new file mode 100644
index 00000000..a9bd3604
--- /dev/null
+++ b/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunStatus.tsx
@@ -0,0 +1,22 @@
+import { useTranslations } from 'next-intl';
+import type { AgentRun } from '@/lib/api/endpoints/agents';
+import { Badge } from '@/components/ui/badge';
+
+const STATUS_VARIANT: Record<AgentRun['executionState'], 'secondary' | 'destructive' | 'outline'> =
+ {
+ success: 'secondary',
+ failed: 'destructive',
+ queued: 'outline',
+ running: 'secondary',
+ canceled: 'outline',
+ };
+
+export default function TeamAiAgentRunStatus({ status }: { status: AgentRun['executionState'] }) {
+ const variant = STATUS_VARIANT[status];
+ const t = useTranslations('issue.agentRuns');
+ return (
+ <Badge variant={variant} className="shrink-0 capitalize">
+ {t(status)}
+ </Badge>
+ );
+}
diff --git a/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunsList.tsx b/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunsList.tsx
new file mode 100644
index 00000000..a3b74b09
--- /dev/null
+++ b/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunsList.tsx
@@ -0,0 +1,69 @@
+import { useTranslations } from 'next-intl';
+import { Button } from '@/components/ui/button';
+import ListSkeleton from '@/components/common/skeleton/ListSkeleton';
+import { useAgentRuns } from '@/services/aiAgents.service';
+import { useLiveRefresh } from '@/hooks/useLiveRefresh';
+import { revScope } from '@/utils/revScopes';
+import { qk } from '@/services/queryKeys';
+import { useAgentSection } from '../../context/agentSection';
+import TeamAiAgentRunItem from './TeamAiAgentRunItem';
+
+export default function TeamAiAgentRunsList({
+ agentId,
+ external,
+}: {
+ agentId: number;
+ external: boolean;
+}) {
+ const t = useTranslations('teams.agents');
+ const tCommon = useTranslations('common');
+ const tRuns = useTranslations('issue.agentRuns');
+ const teamId = useAgentSection().teamId;
+ const query = useAgentRuns(teamId, agentId);
+ useLiveRefresh({ scope: revScope.runnerQueue, targets: [qk.agentRuns(teamId ?? 0, agentId)] });
+ const runs = query.isError ? [] : (query.data?.pages.flatMap((p) => p.items) ?? []);
+ if (query.isError) {
+ return (
+ <div className="space-y-2 p-4">
+ <p role="alert" className="text-xs text-destructive">
+ {tRuns('loadError')}
+ </p>
+ <Button variant="ghost" onClick={() => void query.refetch()}>
+ {tRuns('refresh')}
+ </Button>
+ </div>
+ );
+ }
+
+ if (query.isLoading) {
+ return <ListSkeleton rows={4} className="p-4" rowClassName="h-12" />;
+ }
+ if (runs.length === 0) {
+ return <p className="p-4 text-sm text-muted-foreground">{t('noRuns')}</p>;
+ }
+
+ return (
+ <div className="min-h-0 flex-1 overflow-y-auto">
+ <div className="divide-y divide-border/50">
+ {runs.map((r) => (
+ <TeamAiAgentRunItem key={r.id} run={r} external={external} />
+ ))}
+ </div>
+ <div className="p-4">
+ {query.hasNextPage ? (
+ <Button
+ variant="outline"
+ size="sm"
+ className="w-full"
+ disabled={query.isFetchingNextPage}
+ onClick={() => query.fetchNextPage()}
+ >
+ {query.isFetchingNextPage ? tCommon('loading') : t('loadMore')}
+ </Button>
+ ) : (
+ <p className="text-center text-xs text-muted-foreground">{t('endOfHistory')}</p>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunsSheet.tsx b/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunsSheet.tsx
index 07966ce8..db9f63ea 100644
--- a/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunsSheet.tsx
+++ b/apps/web/src/features/teams/components/ai-agents/TeamAiAgentRunsSheet.tsx
@@ -1,13 +1,5 @@
-import { useState } from 'react';
-import { ChevronDown, ChevronRight } from 'lucide-react';
-import type { AgentRun, AiAgent } from '@/lib/api/endpoints/agents';
-import { useRelativeTime } from '@/context/relativeTimeContext';
-import { formatDateTime } from '@/utils/dates';
-import { useAgentRuns } from '@/services/aiAgents.service';
-import { AgentContextSize } from '@/components/common/agent-chat/AgentContextSize';
-import ListSkeleton from '@/components/common/skeleton/ListSkeleton';
-import { Badge } from '@/components/ui/badge';
-import { Button } from '@/components/ui/button';
+import type { AiAgent } from '@/lib/api/endpoints/agents';
+import { useTranslations } from 'next-intl';
import {
Sheet,
SheetContent,
@@ -15,14 +7,8 @@ import {
SheetHeader,
SheetTitle,
} from '@/components/ui/sheet';
-import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
-import { useAgentSection } from '../../context/agentSection';
-import { useTranslations } from 'next-intl';
+import TeamAiAgentRunsList from './TeamAiAgentRunsList';
-// Run history for an agent, in a right-side sidebar. Shows the triggered runs (a
-// mention, a delegation, or a member field) queued for the agent, newest first, 25 at
-// a time. Each run expands to show the task it was given and, if it failed, the
-// error. Test-chat runs are not recorded, so they never appear here.
export function TeamAiAgentRunsSheet({
agent,
onClose,
@@ -40,140 +26,8 @@ export function TeamAiAgentRunsSheet({
{agent ? t('runsSubtitle', { username: agent.username }) : ''}
</SheetDescription>
</SheetHeader>
- {agent && <RunsList agentId={agent.id} />}
+ {agent && <TeamAiAgentRunsList agentId={agent.id} external={agent.kind === 'external'} />}
</SheetContent>
</Sheet>
);
}
-
-function RunsList({ agentId }: { agentId: number }) {
- const t = useTranslations('teams.agents');
- const tCommon = useTranslations('common');
- const query = useAgentRuns(useAgentSection().teamId, agentId);
- const runs = query.data?.pages.flatMap((p) => p.items) ?? [];
-
- if (query.isLoading) {
- return <ListSkeleton rows={4} className="p-4" rowClassName="h-12" />;
- }
- if (runs.length === 0) {
- return <p className="p-4 text-sm text-muted-foreground">{t('noRuns')}</p>;
- }
-
- return (
- <div className="min-h-0 flex-1 overflow-y-auto">
- <div className="divide-y divide-border/50">
- {runs.map((r) => (
- <RunItem key={r.id} run={r} />
- ))}
- </div>
- <div className="p-4">
- {query.hasNextPage ? (
- <Button
- variant="outline"
- size="sm"
- className="w-full"
- disabled={query.isFetchingNextPage}
- onClick={() => query.fetchNextPage()}
- >
- {query.isFetchingNextPage ? tCommon('loading') : t('loadMore')}
- </Button>
- ) : (
- <p className="text-center text-xs text-muted-foreground">{t('endOfHistory')}</p>
- )}
- </div>
- </div>
- );
-}
-
-// What the run was about: the issue it targeted, or how it was started when it
-// targeted none.
-function runSubject(r: AgentRun, t: ReturnType<typeof useTranslations<'teams.agents'>>): string {
- if (r.issueId == null) return r.trigger === 'manual' ? t('manualTask') : t('scheduledTask');
- if (!r.issueIdentifier) return `issue #${r.issueId}`;
- return `${r.issueIdentifier}${r.issueTitle ? ` · ${r.issueTitle}` : ''}`;
-}
-
-function RunItem({ run: r }: { run: AgentRun }) {
- const t = useTranslations('teams.agents');
- const relativeTime = useRelativeTime();
- const [open, setOpen] = useState(false);
- const subject = runSubject(r, t);
- const outcome = r.status === 'failed' ? (r.lastError ?? t('failed')) : '';
- return (
- <div>
- <button
- type="button"
- className="flex w-full items-center gap-2 px-4 py-2.5 text-start text-xs hover:bg-accent/50"
- onClick={() => setOpen((v) => !v)}
- >
- {open ? (
- <ChevronDown className="size-3.5 shrink-0" />
- ) : (
- <ChevronRight className="size-3.5 shrink-0" />
- )}
- <StatusBadge status={r.status} />
- <span className="shrink-0 text-muted-foreground capitalize">{r.trigger}</span>
- <span className="truncate font-medium">{subject}</span>
- {r.attempts > 1 && (
- <span className="shrink-0 text-muted-foreground">·{r.attempts} attempts</span>
- )}
- <span className="ms-auto flex shrink-0 items-center gap-4">
- <span className="w-12 text-end">
- {r.contextTokens !== undefined && <AgentContextSize tokens={r.contextTokens} />}
- </span>
- <Tooltip>
- <TooltipTrigger asChild>
- <span className="text-muted-foreground">{relativeTime(r.createdAt)}</span>
- </TooltipTrigger>
- <TooltipContent>{formatDateTime(r.createdAt)}</TooltipContent>
- </Tooltip>
- </span>
- </button>
- {open && (
- <div className="space-y-3 px-4 pb-3">
- <DetailBlock label={t('task')} value={r.prompt} />
- {r.status === 'failed' && r.lastError && (
- <DetailBlock label={t('error')} value={r.lastError} />
- )}
- {r.output && <DetailBlock label={t('result')} value={r.output} />}
- {r.status === 'pending' && (
- <DetailBlock
- label={t('queue')}
- value={`Attempts: ${r.attempts}. Next attempt: ${formatDateTime(r.nextAttemptAt)}.`}
- />
- )}
- {outcome && <p className="text-xs text-muted-foreground">{outcome}</p>}
- </div>
- )}
- </div>
- );
-}
-
-function DetailBlock({ label, value }: { label: string; value: string }) {
- return (
- <div className="space-y-1">
- <div className="text-[10px] font-medium tracking-wide text-muted-foreground uppercase">
- {label}
- </div>
- <pre className="max-h-64 overflow-auto rounded-md bg-muted/50 p-2.5 text-xs whitespace-pre-wrap">
- {value}
- </pre>
- </div>
- );
-}
-
-const STATUS_VARIANT: Record<AgentRun['status'], 'secondary' | 'destructive' | 'outline'> = {
- success: 'secondary',
- failed: 'destructive',
- pending: 'outline',
- canceled: 'outline',
-};
-
-function StatusBadge({ status }: { status: AgentRun['status'] }) {
- const variant = STATUS_VARIANT[status];
- return (
- <Badge variant={variant} className="shrink-0 capitalize">
- {status === 'pending' ? 'queued' : status}
- </Badge>
- );
-}
diff --git a/apps/web/src/lib/api/endpoints/agentSchedules.ts b/apps/web/src/lib/api/endpoints/agentSchedules.ts
index a9645123..694aaeb3 100644
--- a/apps/web/src/lib/api/endpoints/agentSchedules.ts
+++ b/apps/web/src/lib/api/endpoints/agentSchedules.ts
@@ -1,5 +1,5 @@
import { request } from '@/lib/api/core/client';
-import type { AgentRunStatus } from '@/lib/api/endpoints/agents';
+import type { AgentRun, AgentRunStatus } from '@/lib/api/endpoints/agents';
import { pageQuery, type Page, type PageParams } from '@/lib/api/core/paging';
// 'cron' runs on its cron; 'status' runs on an issue each time one enters its column.
@@ -53,8 +53,10 @@ export interface AgentScheduleInput {
}
export interface AgentScheduleRun {
+ kind: string;
id: number;
status: AgentRunStatus;
+ executionState: AgentRun['executionState'];
trigger: 'schedule' | 'manual' | 'status' | 'event';
prompt: string;
attempts: number;
diff --git a/apps/web/src/lib/api/endpoints/agents.ts b/apps/web/src/lib/api/endpoints/agents.ts
index 45e568f3..ebd223c5 100644
--- a/apps/web/src/lib/api/endpoints/agents.ts
+++ b/apps/web/src/lib/api/endpoints/agents.ts
@@ -91,6 +91,7 @@ export type AgentRunTrigger =
export interface AgentRun {
id: number;
status: AgentRunStatus;
+ executionState: 'queued' | 'running' | 'success' | 'failed' | 'canceled';
trigger: AgentRunTrigger;
issueId: number | null;
issueIdentifier: string | null;
@@ -244,3 +245,24 @@ export const listAgentRuns = (teamId: number, agentId: number, before?: number)
request<AgentRunPage>(
`/teams/${teamId}/ai-agents/${agentId}/runs?limit=25${before ? `&before=${before}` : ''}`,
);
+
+export interface ExternalRunEvent {
+ type: string;
+ toolCallId?: string;
+ toolCallName?: string;
+ delta?: string;
+ content?: string;
+ message?: string;
+}
+export interface ExternalRunTrace {
+ attempt: number;
+ previousAttempt: number | null;
+ sessionId: string | null;
+ sessionUrl: string | null;
+ truncated: boolean;
+ events: { event: ExternalRunEvent; receivedAt: string }[];
+}
+export const getExternalRunTrace = (runId: number, attempt?: number) =>
+ request<ExternalRunTrace | null>(
+ `/agent-runs/${runId}/trace${attempt == null ? '' : `?attempt=${attempt}`}`,
+ );
diff --git a/apps/web/src/lib/api/endpoints/issues.ts b/apps/web/src/lib/api/endpoints/issues.ts
index b727391d..68be9864 100644
--- a/apps/web/src/lib/api/endpoints/issues.ts
+++ b/apps/web/src/lib/api/endpoints/issues.ts
@@ -1,6 +1,7 @@
import type { CycleStatus } from '@/lib/api/endpoints/cycles';
import type { InitiativeStatus } from '@/lib/api/endpoints/initiatives';
import { request } from '@/lib/api/core/client';
+import type { AgentRunTrigger } from '@/lib/api/endpoints/agents';
import type { Checklist } from '@/lib/api/endpoints/checklists';
import type { CustomFieldType } from '@/lib/api/endpoints/customFields';
import type { DevelopmentLink } from '@/lib/api/endpoints/git';
@@ -408,3 +409,53 @@ export const setFieldValue = (issueId: number, fieldId: number, input: IssueFiel
method: 'PUT',
body: JSON.stringify(input),
});
+
+export interface IssueAgentRun {
+ id: number;
+ agentId: number;
+ username: string;
+ kind: string;
+ status: 'pending' | 'success' | 'failed' | 'canceled';
+ executionState: 'queued' | 'running' | 'success' | 'failed' | 'canceled';
+ trigger: AgentRunTrigger;
+ prompt: string;
+ output: string | null;
+ attempts: number;
+ lastError: string | null;
+ contextTokens?: number;
+ createdAt: string;
+ startedAt: string | null;
+ finishedAt: string | null;
+ nextAttemptAt: string;
+}
+
+export interface IssueAgentTraceSpan {
+ spanId: string;
+ parentSpanId: string | null;
+ name: string;
+ type: string;
+ status: string;
+ startedAt: string;
+ endedAt: string | null;
+ durationMs: number | null;
+ input: unknown;
+ output: unknown;
+ error: unknown;
+ attributes: unknown;
+}
+
+export interface IssueAgentRunTrace {
+ previousTraceId: string | null;
+ trace: { traceId: string; status: string; startedAt: string; endedAt: string | null };
+ spans: IssueAgentTraceSpan[];
+}
+
+export const listIssueAgentRuns = (issueId: number, before?: number) =>
+ request<{ items: IssueAgentRun[]; nextCursor: number | null }>(
+ `/issues/${issueId}/agent-runs${before == null ? '' : `?before=${before}`}`,
+ );
+
+export const getIssueAgentRunTrace = (issueId: number, runId: number, traceId?: string) =>
+ request<IssueAgentRunTrace | null>(
+ `/issues/${issueId}/agent-runs/${runId}/trace${traceId == null ? '' : `?traceId=${encodeURIComponent(traceId)}`}`,
+ );
diff --git a/apps/web/src/lib/api/endpoints/runnerQueue.test.ts b/apps/web/src/lib/api/endpoints/runnerQueue.test.ts
new file mode 100644
index 00000000..6a48a8f7
--- /dev/null
+++ b/apps/web/src/lib/api/endpoints/runnerQueue.test.ts
@@ -0,0 +1,22 @@
+import assert from 'node:assert/strict';
+import { it } from 'node:test';
+import { getRunnerQueue } from './runnerQueue';
+
+it('sends queue pagination as a single query string', async () => {
+ const original = globalThis.fetch;
+ let requested = '';
+ globalThis.fetch = (async (input) => {
+ requested = String(input);
+ return Response.json({ items: [], total: 0, page: 2, pageSize: 10, queued: 0, running: 0 });
+ }) as typeof fetch;
+ try {
+ await getRunnerQueue({ page: 2, pageSize: 10 });
+ const url = new URL(requested);
+ assert.equal(url.pathname, '/agent-runs/queue');
+ assert.equal(url.searchParams.get('page'), '2');
+ assert.equal(url.searchParams.get('pageSize'), '10');
+ assert.equal(url.searchParams.has('?page'), false);
+ } finally {
+ globalThis.fetch = original;
+ }
+});
diff --git a/apps/web/src/lib/api/endpoints/runnerQueue.ts b/apps/web/src/lib/api/endpoints/runnerQueue.ts
new file mode 100644
index 00000000..cc906776
--- /dev/null
+++ b/apps/web/src/lib/api/endpoints/runnerQueue.ts
@@ -0,0 +1,18 @@
+import { request } from '@/lib/api/core/client';
+import { pageQuery, type Page, type PageParams } from '@/lib/api/core/paging';
+import type { IssueAgentRun } from './issues';
+
+export interface RunnerQueueRun extends IssueAgentRun {
+ issueId: number | null;
+ sequenceNumber: number | null;
+ issueTitle: string | null;
+ scheduleName: string | null;
+ projectRef: string;
+ runnerState: 'push' | 'online' | 'offline' | 'never';
+}
+
+export type RunnerQueuePage = Page<RunnerQueueRun> & { queued: number; running: number };
+export const getRunnerQueue = (params: PageParams & { runId?: number }) =>
+ request<RunnerQueuePage>(
+ `/agent-runs/queue${pageQuery(params, { runId: params.runId?.toString() })}`,
+ );
diff --git a/apps/web/src/services/agentSchedules.service.ts b/apps/web/src/services/agentSchedules.service.ts
index a8818f85..ce712aa3 100644
--- a/apps/web/src/services/agentSchedules.service.ts
+++ b/apps/web/src/services/agentSchedules.service.ts
@@ -10,6 +10,8 @@ import {
} from '@/lib/api/endpoints/agentSchedules';
import type { PageParams } from '@/lib/api/core/paging';
import { qk } from '@/services/queryKeys';
+import { useLiveRefresh } from '@/hooks/useLiveRefresh';
+import { revScope } from '@/utils/revScopes';
// One page of the project's schedules. A page with a run still going is polled, so the
// row's status catches up on its own.
@@ -26,12 +28,14 @@ export function useAgentSchedules(projectKey: string, params: PageParams) {
}
export function useAgentScheduleRuns(projectKey: string, scheduleId: number | null) {
+ useLiveRefresh({
+ scope: scheduleId == null ? null : revScope.runnerQueue,
+ targets: [qk.agentScheduleRuns(projectKey, scheduleId ?? 0)],
+ });
return useQuery({
queryKey: qk.agentScheduleRuns(projectKey, scheduleId ?? 0),
queryFn: () => listAgentScheduleRuns(projectKey, scheduleId!),
enabled: scheduleId != null,
- refetchInterval: (query) =>
- query.state.data?.some((run) => run.status === 'pending') ? 2000 : false,
});
}
diff --git a/apps/web/src/services/issues.service.ts b/apps/web/src/services/issues.service.ts
index a6d2b76f..ae502c94 100644
--- a/apps/web/src/services/issues.service.ts
+++ b/apps/web/src/services/issues.service.ts
@@ -23,6 +23,8 @@ import {
type BoardIssues,
type SubtaskDisposition,
getIssue,
+ listIssueAgentRuns,
+ getIssueAgentRunTrace,
listIssueCycles,
getIssueBySeq,
searchIssues,
@@ -475,3 +477,20 @@ export function useCreateIssue() {
},
});
}
+
+export function useIssueAgentRunsQuery(issueId: number, enabled: boolean) {
+ return useInfiniteQuery({
+ queryKey: qk.issueAgentRuns(issueId),
+ queryFn: ({ pageParam }) => listIssueAgentRuns(issueId, pageParam),
+ initialPageParam: undefined as number | undefined,
+ getNextPageParam: (last) => last.nextCursor ?? undefined,
+ enabled,
+ });
+}
+
+export function useIssueAgentRunTraceQuery(issueId: number, runId: number, traceId?: string) {
+ return useQuery({
+ queryKey: qk.issueAgentRunTrace(issueId, runId, traceId),
+ queryFn: () => getIssueAgentRunTrace(issueId, runId, traceId),
+ });
+}
diff --git a/apps/web/src/services/queryKeys.ts b/apps/web/src/services/queryKeys.ts
index a1a97b3a..6a328111 100644
--- a/apps/web/src/services/queryKeys.ts
+++ b/apps/web/src/services/queryKeys.ts
@@ -7,6 +7,11 @@ const scimKey = (workspaceId: number | null) =>
// or key scopes its entry. Kept in one registry so a mutation in one service can
// invalidate another service's queries by the same key.
export const qk = {
+ externalRunTrace: (runId: number) => ['externalRunTrace', runId] as const,
+ runnerQueue: ['runnerQueue'] as const,
+ issueAgentRuns: (issueId: number) => ['issueAgentRuns', issueId] as const,
+ issueAgentRunTrace: (issueId: number, runId: number, traceId?: string) =>
+ ['issueAgentRuns', issueId, 'trace', runId, traceId ?? null] as const,
projects: ['projects'] as const,
// Under projects, so what refreshes the project list refreshes every search with it.
projectSearch: (filters: unknown) => ['projects', 'search', filters] as const,
diff --git a/apps/web/src/services/runnerQueue.service.ts b/apps/web/src/services/runnerQueue.service.ts
new file mode 100644
index 00000000..7b78439c
--- /dev/null
+++ b/apps/web/src/services/runnerQueue.service.ts
@@ -0,0 +1,27 @@
+import { getExternalRunTrace } from '@/lib/api/endpoints/agents';
+import { useInfiniteQuery, useQuery } from '@tanstack/react-query';
+import { nextPageParam } from '@/lib/api/core/paging';
+import { DEFAULT_PAGE_SIZE } from '@/hooks/usePaging';
+import { getRunnerQueue } from '@/lib/api/endpoints/runnerQueue';
+import { qk } from './queryKeys';
+
+export function useRunnerQueueQuery() {
+ return useInfiniteQuery({
+ queryKey: [...qk.runnerQueue, 'list'],
+ queryFn: ({ pageParam }) => getRunnerQueue({ page: pageParam, pageSize: DEFAULT_PAGE_SIZE }),
+ initialPageParam: 1,
+ getNextPageParam: nextPageParam,
+ });
+}
+
+export function useRunnerQueueRunQuery(runId: number) {
+ const params = { page: 1, pageSize: 1, runId };
+ return useQuery({ queryKey: [...qk.runnerQueue, params], queryFn: () => getRunnerQueue(params) });
+}
+
+export function useExternalRunTraceQuery(runId: number, attempt?: number) {
+ return useQuery({
+ queryKey: [...qk.externalRunTrace(runId), attempt ?? null],
+ queryFn: () => getExternalRunTrace(runId, attempt),
+ });
+}
diff --git a/apps/web/src/utils/dates.ts b/apps/web/src/utils/dates.ts
index 5d20f0d0..6e4ec2f6 100644
--- a/apps/web/src/utils/dates.ts
+++ b/apps/web/src/utils/dates.ts
@@ -189,13 +189,14 @@ export function formatLongDate(value: string): string {
});
}
-// "2:05 PM" for a moment in time, rendered in the user's zone.
-export function formatTime(value: string): string {
+// "2:05 PM" for a moment in time, rendered in the user's zone; "2:05:09 PM" with seconds.
+export function formatTime(value: string, { seconds = false } = {}): string {
const date = new Date(value);
if (Number.isNaN(date.getTime())) return value;
return date.toLocaleTimeString(getIntlLocale(), {
hour: 'numeric',
minute: '2-digit',
+ ...(seconds && { second: '2-digit' }),
...zoneOption(),
});
}
diff --git a/apps/web/src/utils/paths.ts b/apps/web/src/utils/paths.ts
index 61477b95..17da949f 100644
--- a/apps/web/src/utils/paths.ts
+++ b/apps/web/src/utils/paths.ts
@@ -50,6 +50,11 @@ export const settingsPath = (ref: string, section: string) =>
// The AI Team destinations listed in the main sidebar (see AI_TEAM_SECTIONS).
export const aiTeamPath = (ref: string, section: string) => `${projectPath(ref)}/agents/${section}`;
+export const runnerQueuePath = (ref: string) => aiTeamPath(ref, 'queue');
+
+export const runnerQueueRunPath = (ref: string, runId: number) =>
+ `${runnerQueuePath(ref)}/${runId}`;
+
export const inboxPath = (ref: string) => `${projectPath(ref)}/inbox`;
// The member's own notification preferences (which events, by which channel, their
diff --git a/apps/web/src/utils/revScopes.ts b/apps/web/src/utils/revScopes.ts
index dc2a340b..960d6354 100644
--- a/apps/web/src/utils/revScopes.ts
+++ b/apps/web/src/utils/revScopes.ts
@@ -2,6 +2,7 @@
// API accepts on GET /sync/rev. The inbox is asked for by project — the server
// answers with the session user's own, so the user id never appears here.
export const revScope = {
+ runnerQueue: 'runnerQueue:1',
board: (projectId: number) => `board:${projectId}`,
issue: (issueId: number) => `issue:${issueId}`,
initiative: (initiativeId: number) => `initiative:${initiativeId}`,
diff --git a/apps/web/src/utils/settingsSections.ts b/apps/web/src/utils/settingsSections.ts
index 909a902d..5d821b27 100644
--- a/apps/web/src/utils/settingsSections.ts
+++ b/apps/web/src/utils/settingsSections.ts
@@ -87,6 +87,12 @@ export const SETTINGS_SECTIONS: SettingsSection[] = [
resource: 'actions',
group: 'automation',
},
+ {
+ slug: 'queue',
+ icon: Clock3,
+ resource: 'ai_agents',
+ group: 'ai-team',
+ },
{
slug: 'schedules',
icon: Clock3,
diff --git a/bun.lock b/bun.lock
index 8bf09005..9c87cbb2 100644
--- a/bun.lock
+++ b/bun.lock
@@ -2207,7 +2207,7 @@
"mammoth": ["[email protected]", "", { "dependencies": { "@xmldom/xmldom": "^0.8.6", "argparse": "~1.0.3", "base64-js": "^1.5.1", "dingbat-to-unicode": "^1.0.1", "jszip": "^3.7.1", "lop": "^0.4.2", "underscore": "^1.13.1", "xmlbuilder": "^10.0.0" }, "bin": { "mammoth": "bin/mammoth" } }, "sha512-2cawcYFcP7ISfXbBcL9lmVgTNWo88v/52ND1gnywHtVT/pX0//puPnf0iMPV9ZgmuvNOE+zkIhDgZ9M2c2dDDg=="],
- "markdown-it": ["[email protected]", "", { "dependencies": { "argparse": "^2.0.1", "entities": "^4.5.0", "linkify-it": "^5.0.2", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" } }, "sha512-sHHjZ5fJKlgrG4qns2YwVcdNep35h5fERrfkD2YNsb9UFk0UIHarbiTaHKVMlPuWAoiilyK8Fv/jAm11slsY7Q=="],
+ "markdown-it": ["[email protected]", "", { "dependencies": { "argparse": "^2.0.1", "entities": "^4.5.0", "linkify-it": "^5.0.2", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" } }, "sha512-L//tDAkjTjJCU6pBUSBTgs3Kg4InVaZuUZog/b6V12UKhcDQ7S78877ibbCanRExwPuYP1CZD7Gd2dxSy1GXRg=="],
"markdown-it-task-lists": ["[email protected]", "", {}, "sha512-TxFAc76Jnhb2OUu+n3yz9RMu4CwGfaT788br6HhEDlvWfdeJcLUsxk1Hgw2yJio0OXsxv7pyIPmvECY7bMbluA=="],
diff --git a/packages/db/AGENTS.md b/packages/db/AGENTS.md
index 08313d1a..fa982e31 100644
--- a/packages/db/AGENTS.md
+++ b/packages/db/AGENTS.md
@@ -89,3 +89,8 @@ the resource a watcher must be allowed to read — and the mirror in
- Explicit snake_case column names (`text("created_at")`) — matches the generated auth schema; no `casing` option.
- FKs use `.references(() => other.id, { onDelete: "cascade" })`.
- `drizzle.config.ts` loads the root `.env` via `dotenv` — needs a valid `DATABASE_URL`.
+
+`0152_agent_execution_state.sql` adds the current execution marker to `agent_run`.
+Its trigger bumps `runner-queue:<projectId>` on queue writes. It does not write the
+issue scope: the issue run panel watches the user-scoped runner queue marker too,
+which avoids introducing a queue/issue revision lock ordering dependency.
diff --git a/packages/db/drizzle/0152_agent_execution_state.sql b/packages/db/drizzle/0152_agent_execution_state.sql
new file mode 100644
index 00000000..be13b411
--- /dev/null
+++ b/packages/db/drizzle/0152_agent_execution_state.sql
@@ -0,0 +1,15 @@
+ALTER TABLE "agent_run" ADD COLUMN "execution_started_at" timestamp with time zone;
+--> statement-breakpoint
+CREATE FUNCTION rev_agent_run() RETURNS trigger AS $$
+DECLARE r agent_run%ROWTYPE;
+BEGIN
+ IF TG_OP = 'DELETE' THEN r := OLD; ELSE r := NEW; END IF;
+ IF EXISTS (SELECT 1 FROM project WHERE id = r.project_id) THEN
+ PERFORM bump_rev('runner-queue:' || r.project_id, r.project_id);
+ END IF;
+ RETURN NULL;
+END;
+$$ LANGUAGE plpgsql;
+--> statement-breakpoint
+CREATE TRIGGER agent_run_rev AFTER INSERT OR UPDATE OR DELETE ON agent_run
+ FOR EACH ROW EXECUTE FUNCTION rev_agent_run();
diff --git a/packages/db/drizzle/0153_external_run_traces.sql b/packages/db/drizzle/0153_external_run_traces.sql
new file mode 100644
index 00000000..3ba9bfeb
--- /dev/null
+++ b/packages/db/drizzle/0153_external_run_traces.sql
@@ -0,0 +1,12 @@
+CREATE TABLE "agent_run_trace" (
+ "run_id" integer NOT NULL,
+ "attempt" integer NOT NULL,
+ "session_id" text,
+ "events" jsonb DEFAULT '[]'::jsonb NOT NULL,
+ "next_offset" integer DEFAULT 0 NOT NULL,
+ "truncated" boolean DEFAULT false NOT NULL,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "agent_run_trace_run_id_attempt_pk" PRIMARY KEY("run_id","attempt")
+);
+--> statement-breakpoint
+ALTER TABLE "agent_run_trace" ADD CONSTRAINT "agent_run_trace_run_id_agent_run_id_fk" FOREIGN KEY ("run_id") REFERENCES "public"."agent_run"("id") ON DELETE cascade ON UPDATE no action;
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0152_snapshot.json b/packages/db/drizzle/meta/0152_snapshot.json
new file mode 100644
index 00000000..9391df0e
--- /dev/null
+++ b/packages/db/drizzle/meta/0152_snapshot.json
@@ -0,0 +1,12409 @@
+{
+ "id": "ee04d68c-123a-4cbf-bc84-0ba3f9b76253",
+ "prevId": "17a18039-6e6c-432b-86df-fafcf1d9c744",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_event": {
+ "name": "agent_chat_event",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_chat_event_message_idx": {
+ "name": "agent_chat_event_message_idx",
+ "columns": [
+ {
+ "expression": "message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_event_message_id_agent_chat_message_id_fk": {
+ "name": "agent_chat_event_message_id_agent_chat_message_id_fk",
+ "tableFrom": "agent_chat_event",
+ "tableTo": "agent_chat_message",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_favorite": {
+ "name": "agent_chat_favorite",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_chat_favorite_user_id_user_id_fk": {
+ "name": "agent_chat_favorite_user_id_user_id_fk",
+ "tableFrom": "agent_chat_favorite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_chat_favorite_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_favorite_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_favorite",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_chat_favorite_user_id_thread_id_pk": {
+ "name": "agent_chat_favorite_user_id_thread_id_pk",
+ "columns": [
+ "user_id",
+ "thread_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_message": {
+ "name": "agent_chat_message",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_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": {
+ "agent_chat_message_thread_idx": {
+ "name": "agent_chat_message_thread_idx",
+ "columns": [
+ {
+ "expression": "thread_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_chat_message_due_idx": {
+ "name": "agent_chat_message_due_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_message_thread_id_agent_chat_thread_id_fk": {
+ "name": "agent_chat_message_thread_id_agent_chat_thread_id_fk",
+ "tableFrom": "agent_chat_message",
+ "tableTo": "agent_chat_thread",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_chat_message_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_message_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_message",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_chat_message_role_check": {
+ "name": "agent_chat_message_role_check",
+ "value": "\"agent_chat_message\".\"role\" IN ('user', 'assistant')"
+ },
+ "agent_chat_message_status_check": {
+ "name": "agent_chat_message_status_check",
+ "value": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming', 'success', 'failed', 'canceled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_thread": {
+ "name": "agent_chat_thread",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cli_session_id": {
+ "name": "cli_session_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": {
+ "agent_chat_thread_agent_user_idx": {
+ "name": "agent_chat_thread_agent_user_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_thread_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_thread_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_thread",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_chat_thread_user_id_user_id_fk": {
+ "name": "agent_chat_thread_user_id_user_id_fk",
+ "tableFrom": "agent_chat_thread",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_usage": {
+ "name": "agent_chat_usage",
+ "schema": "",
+ "columns": {
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_chat_usage_agent_idx": {
+ "name": "agent_chat_usage_agent_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_usage_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_usage_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_usage",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_field_trigger": {
+ "name": "agent_field_trigger",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delay_sec": {
+ "name": "delay_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 120
+ }
+ },
+ "indexes": {
+ "agent_field_trigger_field_idx": {
+ "name": "agent_field_trigger_field_idx",
+ "columns": [
+ {
+ "expression": "field_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_field_trigger_agent_id_ai_agent_id_fk": {
+ "name": "agent_field_trigger_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_field_trigger",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_field_trigger_field_id_custom_field_id_fk": {
+ "name": "agent_field_trigger_field_id_custom_field_id_fk",
+ "tableFrom": "agent_field_trigger",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_field_trigger_agent_id_field_id_pk": {
+ "name": "agent_field_trigger_agent_id_field_id_pk",
+ "columns": [
+ "agent_id",
+ "field_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_field_trigger_delay_check": {
+ "name": "agent_field_trigger_delay_check",
+ "value": "\"agent_field_trigger\".\"delay_sec\" >= 0 AND \"agent_field_trigger\".\"delay_sec\" <= 86400"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_run": {
+ "name": "agent_run",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "schedule_id": {
+ "name": "schedule_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'delegation'"
+ },
+ "scheduled_for": {
+ "name": "scheduled_for",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_activity_id": {
+ "name": "source_activity_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output": {
+ "name": "output",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_started_at": {
+ "name": "execution_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_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": {
+ "agent_run_schedule_fire_uq": {
+ "name": "agent_run_schedule_fire_uq",
+ "columns": [
+ {
+ "expression": "schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scheduled_for",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_due_idx": {
+ "name": "agent_run_due_idx",
+ "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": {}
+ },
+ "agent_run_schedule_idx": {
+ "name": "agent_run_schedule_idx",
+ "columns": [
+ {
+ "expression": "schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_project_idx": {
+ "name": "agent_run_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_run_agent_id_ai_agent_id_fk": {
+ "name": "agent_run_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_project_id_project_id_fk": {
+ "name": "agent_run_project_id_project_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_issue_id_issue_id_fk": {
+ "name": "agent_run_issue_id_issue_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_schedule_id_agent_schedule_id_fk": {
+ "name": "agent_run_schedule_id_agent_schedule_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "agent_schedule",
+ "columnsFrom": [
+ "schedule_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_source_activity_id_issue_activity_id_fk": {
+ "name": "agent_run_source_activity_id_issue_activity_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "source_activity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_run_status_check": {
+ "name": "agent_run_status_check",
+ "value": "\"agent_run\".\"status\" IN ('pending', 'success', 'failed', 'canceled')"
+ },
+ "agent_run_trigger_check": {
+ "name": "agent_run_trigger_check",
+ "value": "\"agent_run\".\"trigger\" IN ('mention', 'delegation', 'field', 'schedule', 'manual', 'status', 'event')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_schedule": {
+ "name": "agent_schedule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'cron'"
+ },
+ "cron": {
+ "name": "cron",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "next_run_at": {
+ "name": "next_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delay_sec": {
+ "name": "delay_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "options": {
+ "name": "options",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "last_run_at": {
+ "name": "last_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_schedule_due_idx": {
+ "name": "agent_schedule_due_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_agent_idx": {
+ "name": "agent_schedule_agent_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_project_idx": {
+ "name": "agent_schedule_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_column_idx": {
+ "name": "agent_schedule_column_idx",
+ "columns": [
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_schedule_agent_id_ai_agent_id_fk": {
+ "name": "agent_schedule_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_schedule_project_id_project_id_fk": {
+ "name": "agent_schedule_project_id_project_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_schedule_column_id_project_column_id_fk": {
+ "name": "agent_schedule_column_id_project_column_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_schedule_project_id_agent_id_name_unique": {
+ "name": "agent_schedule_project_id_agent_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "agent_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "agent_schedule_status_check": {
+ "name": "agent_schedule_status_check",
+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"
+ },
+ "agent_schedule_type_check": {
+ "name": "agent_schedule_type_check",
+ "value": "(\"agent_schedule\".\"type\" = 'cron' AND \"agent_schedule\".\"cron\" IS NOT NULL AND \"agent_schedule\".\"next_run_at\" IS NOT NULL AND \"agent_schedule\".\"column_id\" IS NULL)\n OR (\"agent_schedule\".\"type\" = 'status' AND \"agent_schedule\".\"column_id\" IS NOT NULL AND \"agent_schedule\".\"cron\" IS NULL AND \"agent_schedule\".\"next_run_at\" IS NULL)\n OR (\"agent_schedule\".\"type\" NOT IN ('cron', 'status') AND \"agent_schedule\".\"cron\" IS NULL AND \"agent_schedule\".\"next_run_at\" IS NULL AND \"agent_schedule\".\"column_id\" IS NULL)"
+ },
+ "agent_schedule_delay_check": {
+ "name": "agent_schedule_delay_check",
+ "value": "\"agent_schedule\".\"delay_sec\" >= 0 AND \"agent_schedule\".\"delay_sec\" <= 86400"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_skill": {
+ "name": "agent_skill",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_url": {
+ "name": "source_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_prefix": {
+ "name": "s3_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "files": {
+ "name": "files",
+ "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": {
+ "agent_skill_team_idx": {
+ "name": "agent_skill_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_skill_team_id_team_id_fk": {
+ "name": "agent_skill_team_id_team_id_fk",
+ "tableFrom": "agent_skill",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_skill_team_id_name_unique": {
+ "name": "agent_skill_team_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "agent_skill_source_check": {
+ "name": "agent_skill_source_check",
+ "value": "\"agent_skill\".\"source\" IN ('upload', 'inline', 'github')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_skill_link": {
+ "name": "agent_skill_link",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "skill_id": {
+ "name": "skill_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "agent_skill_link_skill_idx": {
+ "name": "agent_skill_link_skill_idx",
+ "columns": [
+ {
+ "expression": "skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_skill_link_agent_id_ai_agent_id_fk": {
+ "name": "agent_skill_link_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_skill_link",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_skill_link_skill_id_agent_skill_id_fk": {
+ "name": "agent_skill_link_skill_id_agent_skill_id_fk",
+ "tableFrom": "agent_skill_link",
+ "tableTo": "agent_skill",
+ "columnsFrom": [
+ "skill_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_skill_link_agent_id_skill_id_pk": {
+ "name": "agent_skill_link_agent_id_skill_id_pk",
+ "columns": [
+ "agent_id",
+ "skill_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_tool": {
+ "name": "agent_tool",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_key": {
+ "name": "tool_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_tool_team_idx": {
+ "name": "agent_tool_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_tool_credential_idx": {
+ "name": "agent_tool_credential_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_tool_team_id_team_id_fk": {
+ "name": "agent_tool_team_id_team_id_fk",
+ "tableFrom": "agent_tool",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_tool_credential_id_integration_credential_id_fk": {
+ "name": "agent_tool_credential_id_integration_credential_id_fk",
+ "tableFrom": "agent_tool",
+ "tableTo": "integration_credential",
+ "columnsFrom": [
+ "credential_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_tool_team_id_tool_key_credential_id_unique": {
+ "name": "agent_tool_team_id_tool_key_credential_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "tool_key",
+ "credential_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_tool_link": {
+ "name": "agent_tool_link",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_tool_id": {
+ "name": "agent_tool_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "agent_tool_link_tool_idx": {
+ "name": "agent_tool_link_tool_idx",
+ "columns": [
+ {
+ "expression": "agent_tool_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_tool_link_agent_id_ai_agent_id_fk": {
+ "name": "agent_tool_link_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_tool_link",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_tool_link_agent_tool_id_agent_tool_id_fk": {
+ "name": "agent_tool_link_agent_tool_id_agent_tool_id_fk",
+ "tableFrom": "agent_tool_link",
+ "tableTo": "agent_tool",
+ "columnsFrom": [
+ "agent_tool_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_tool_link_agent_id_agent_tool_id_pk": {
+ "name": "agent_tool_link_agent_id_agent_tool_id_pk",
+ "columns": [
+ "agent_id",
+ "agent_tool_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ai_agent": {
+ "name": "ai_agent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model_credential_id": {
+ "name": "model_credential_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instructions": {
+ "name": "instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tools": {
+ "name": "tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "temperature": {
+ "name": "temperature",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reasoning_effort": {
+ "name": "reasoning_effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_steps": {
+ "name": "max_steps",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_on_mention": {
+ "name": "trigger_on_mention",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "trigger_on_assign": {
+ "name": "trigger_on_assign",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "delegation_delay_sec": {
+ "name": "delegation_delay_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 120
+ },
+ "api_key_ciphertext": {
+ "name": "api_key_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_key_iv": {
+ "name": "api_key_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_key_auth_tag": {
+ "name": "api_key_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_enabled": {
+ "name": "memory_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "memory_last_messages": {
+ "name": "memory_last_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runner_scope": {
+ "name": "runner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'team'"
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_url": {
+ "name": "invocation_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_secret_ciphertext": {
+ "name": "invocation_secret_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_secret_iv": {
+ "name": "invocation_secret_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_secret_auth_tag": {
+ "name": "invocation_secret_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "ai_agent_team_username_uq": {
+ "name": "ai_agent_team_username_uq",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"username\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ai_agent_team_idx": {
+ "name": "ai_agent_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "ai_agent_team_id_team_id_fk": {
+ "name": "ai_agent_team_id_team_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ai_agent_user_id_user_id_fk": {
+ "name": "ai_agent_user_id_user_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ai_agent_model_credential_id_integration_credential_id_fk": {
+ "name": "ai_agent_model_credential_id_integration_credential_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "integration_credential",
+ "columnsFrom": [
+ "model_credential_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "ai_agent_owner_user_id_user_id_fk": {
+ "name": "ai_agent_owner_user_id_user_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "ai_agent_user_id_unique": {
+ "name": "ai_agent_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "ai_agent_kind_check": {
+ "name": "ai_agent_kind_check",
+ "value": "\"ai_agent\".\"kind\" IN ('external', 'internal')"
+ },
+ "ai_agent_runner_scope_check": {
+ "name": "ai_agent_runner_scope_check",
+ "value": "\"ai_agent\".\"runner_scope\" IN ('owner', 'team')"
+ },
+ "ai_agent_reasoning_effort_check": {
+ "name": "ai_agent_reasoning_effort_check",
+ "value": "\"ai_agent\".\"reasoning_effort\" IN ('low', 'medium', 'high')"
+ },
+ "ai_agent_delegation_delay_check": {
+ "name": "ai_agent_delegation_delay_check",
+ "value": "\"ai_agent\".\"delegation_delay_sec\" >= 0 AND \"ai_agent\".\"delegation_delay_sec\" <= 86400"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 100
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "apikey_configId_idx": {
+ "name": "apikey_configId_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_referenceId_idx": {
+ "name": "apikey_referenceId_idx",
+ "columns": [
+ {
+ "expression": "reference_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_secret": {
+ "name": "app_secret",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_setting": {
+ "name": "app_setting",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat_attachment": {
+ "name": "chat_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploaded_by_user_id": {
+ "name": "uploaded_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "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": {
+ "chat_attachment_project_idx": {
+ "name": "chat_attachment_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "chat_attachment_project_id_project_id_fk": {
+ "name": "chat_attachment_project_id_project_id_fk",
+ "tableFrom": "chat_attachment",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "chat_attachment_uploaded_by_user_id_user_id_fk": {
+ "name": "chat_attachment_uploaded_by_user_id_user_id_fk",
+ "tableFrom": "chat_attachment",
+ "tableTo": "user",
+ "columnsFrom": [
+ "uploaded_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "chat_attachment_public_id_unique": {
+ "name": "chat_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_field": {
+ "name": "custom_field",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_type_id": {
+ "name": "issue_type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_type": {
+ "name": "field_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "member_scope": {
+ "name": "member_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "show_in_body": {
+ "name": "show_in_body",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "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": {},
+ "foreignKeys": {
+ "custom_field_project_id_project_id_fk": {
+ "name": "custom_field_project_id_project_id_fk",
+ "tableFrom": "custom_field",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "custom_field_issue_type_id_issue_type_id_fk": {
+ "name": "custom_field_issue_type_id_issue_type_id_fk",
+ "tableFrom": "custom_field",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "issue_type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "custom_field_field_type_check": {
+ "name": "custom_field_field_type_check",
+ "value": "\"custom_field\".\"field_type\" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select', 'member')"
+ },
+ "custom_field_member_scope_check": {
+ "name": "custom_field_member_scope_check",
+ "value": "(\"custom_field\".\"field_type\" = 'member') = (\"custom_field\".\"member_scope\" IS NOT NULL) AND (\"custom_field\".\"member_scope\" IS NULL OR \"custom_field\".\"member_scope\" IN ('all', 'humans', 'agents'))"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.custom_field_option": {
+ "name": "custom_field_option",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "custom_field_option_field_id_custom_field_id_fk": {
+ "name": "custom_field_option_field_id_custom_field_id_fk",
+ "tableFrom": "custom_field_option",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "custom_field_option_field_id_value_unique": {
+ "name": "custom_field_option_field_id_value_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "field_id",
+ "value"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cycle": {
+ "name": "cycle",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "goal": {
+ "name": "goal",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_date": {
+ "name": "end_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "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": {
+ "cycle_project_idx": {
+ "name": "cycle_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "start_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cycle_project_id_project_id_fk": {
+ "name": "cycle_project_id_project_id_fk",
+ "tableFrom": "cycle",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cycle_dates_check": {
+ "name": "cycle_dates_check",
+ "value": "\"cycle\".\"end_date\" >= \"cycle\".\"start_date\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.document_asset": {
+ "name": "document_asset",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploaded_by_user_id": {
+ "name": "uploaded_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "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": {
+ "document_asset_document_idx": {
+ "name": "document_asset_document_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "document_asset_document_id_project_document_id_fk": {
+ "name": "document_asset_document_id_project_document_id_fk",
+ "tableFrom": "document_asset",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_asset_uploaded_by_user_id_user_id_fk": {
+ "name": "document_asset_uploaded_by_user_id_user_id_fk",
+ "tableFrom": "document_asset",
+ "tableTo": "user",
+ "columnsFrom": [
+ "uploaded_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "document_asset_public_id_unique": {
+ "name": "document_asset_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_collaboration": {
+ "name": "document_collaboration",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "epoch": {
+ "name": "epoch",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "content_json": {
+ "name": "content_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "document_collaboration_document_id_project_document_id_fk": {
+ "name": "document_collaboration_document_id_project_document_id_fk",
+ "tableFrom": "document_collaboration",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_comment": {
+ "name": "document_comment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_id": {
+ "name": "author_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "quote": {
+ "name": "quote",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "selection_from": {
+ "name": "selection_from",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "selection_to": {
+ "name": "selection_to",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "orphaned": {
+ "name": "orphaned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "resolved_at": {
+ "name": "resolved_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": {
+ "document_comment_document_idx": {
+ "name": "document_comment_document_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "document_comment_document_id_project_document_id_fk": {
+ "name": "document_comment_document_id_project_document_id_fk",
+ "tableFrom": "document_comment",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_comment_parent_id_document_comment_id_fk": {
+ "name": "document_comment_parent_id_document_comment_id_fk",
+ "tableFrom": "document_comment",
+ "tableTo": "document_comment",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_comment_author_id_user_id_fk": {
+ "name": "document_comment_author_id_user_id_fk",
+ "tableFrom": "document_comment",
+ "tableTo": "user",
+ "columnsFrom": [
+ "author_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_step": {
+ "name": "document_step",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "step": {
+ "name": "step",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "document_step_document_id_project_document_id_fk": {
+ "name": "document_step_document_id_project_document_id_fk",
+ "tableFrom": "document_step",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "document_step_document_id_version_pk": {
+ "name": "document_step_document_id_version_pk",
+ "columns": [
+ "document_id",
+ "version"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.git_managed_repository": {
+ "name": "git_managed_repository",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "full_name": {
+ "name": "full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "web_url": {
+ "name": "web_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "webhook_external_id": {
+ "name": "webhook_external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'connected'"
+ },
+ "last_error": {
+ "name": "last_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": {
+ "git_managed_repository_project_connection_idx": {
+ "name": "git_managed_repository_project_connection_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "git_managed_repository_project_id_project_id_fk": {
+ "name": "git_managed_repository_project_id_project_id_fk",
+ "tableFrom": "git_managed_repository",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "git_managed_repository_connection_id_git_provider_connection_id_fk": {
+ "name": "git_managed_repository_connection_id_git_provider_connection_id_fk",
+ "tableFrom": "git_managed_repository",
+ "tableTo": "git_provider_connection",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "git_managed_repository_project_connection_external_unique": {
+ "name": "git_managed_repository_project_connection_external_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "connection_id",
+ "external_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.git_provider_connection": {
+ "name": "git_provider_connection",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "base_url": {
+ "name": "base_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_login": {
+ "name": "account_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "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": {
+ "git_provider_connection_team_idx": {
+ "name": "git_provider_connection_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "git_provider_connection_team_id_team_id_fk": {
+ "name": "git_provider_connection_team_id_team_id_fk",
+ "tableFrom": "git_provider_connection",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.import_job": {
+ "name": "import_job",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'discover'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "cursor": {
+ "name": "cursor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "credential_ciphertext": {
+ "name": "credential_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_iv": {
+ "name": "credential_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_auth_tag": {
+ "name": "credential_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_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": {
+ "import_job_project_idx": {
+ "name": "import_job_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "import_job_due_idx": {
+ "name": "import_job_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"import_job\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "import_job_project_id_project_id_fk": {
+ "name": "import_job_project_id_project_id_fk",
+ "tableFrom": "import_job",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "import_job_created_by_user_id_user_id_fk": {
+ "name": "import_job_created_by_user_id_user_id_fk",
+ "tableFrom": "import_job",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "import_job_source_check": {
+ "name": "import_job_source_check",
+ "value": "\"import_job\".\"source\" IN ('plane', 'linear')"
+ },
+ "import_job_phase_check": {
+ "name": "import_job_phase_check",
+ "value": "\"import_job\".\"phase\" IN ('discover', 'create', 'link', 'rewrite', 'attachments', 'done')"
+ },
+ "import_job_status_check": {
+ "name": "import_job_status_check",
+ "value": "\"import_job\".\"status\" IN ('pending', 'running', 'paused', 'completed', 'failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.import_record": {
+ "name": "import_record",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "import_job_id": {
+ "name": "import_job_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_entity_type": {
+ "name": "source_entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_display_id": {
+ "name": "source_display_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "local_entity_type": {
+ "name": "local_entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "local_id": {
+ "name": "local_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "import_record_job_source_uq": {
+ "name": "import_record_job_source_uq",
+ "columns": [
+ {
+ "expression": "import_job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "import_record_job_local_idx": {
+ "name": "import_record_job_local_idx",
+ "columns": [
+ {
+ "expression": "import_job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "local_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "local_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "import_record_job_display_idx": {
+ "name": "import_record_job_display_idx",
+ "columns": [
+ {
+ "expression": "import_job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_display_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "import_record_import_job_id_import_job_id_fk": {
+ "name": "import_record_import_job_id_import_job_id_fk",
+ "tableFrom": "import_record",
+ "tableTo": "import_job",
+ "columnsFrom": [
+ "import_job_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "import_record_source_entity_type_check": {
+ "name": "import_record_source_entity_type_check",
+ "value": "\"import_record\".\"source_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment')"
+ },
+ "import_record_local_entity_type_check": {
+ "name": "import_record_local_entity_type_check",
+ "value": "\"import_record\".\"local_entity_type\" IS NULL OR \"import_record\".\"local_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.initiative": {
+ "name": "initiative",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'planned'"
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_date": {
+ "name": "target_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "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": {
+ "initiative_project_idx": {
+ "name": "initiative_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "initiative_project_id_project_id_fk": {
+ "name": "initiative_project_id_project_id_fk",
+ "tableFrom": "initiative",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "initiative_owner_user_id_user_id_fk": {
+ "name": "initiative_owner_user_id_user_id_fk",
+ "tableFrom": "initiative",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "initiative_status_check": {
+ "name": "initiative_status_check",
+ "value": "\"initiative\".\"status\" IN ('proposed', 'planned', 'active', 'completed', 'canceled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.initiative_attachment": {
+ "name": "initiative_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "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": {
+ "initiative_attachment_initiative_idx": {
+ "name": "initiative_attachment_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "initiative_attachment_initiative_id_initiative_id_fk": {
+ "name": "initiative_attachment_initiative_id_initiative_id_fk",
+ "tableFrom": "initiative_attachment",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "initiative_attachment_public_id_unique": {
+ "name": "initiative_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.initiative_label": {
+ "name": "initiative_label",
+ "schema": "",
+ "columns": {
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "initiative_label_initiative_id_initiative_id_fk": {
+ "name": "initiative_label_initiative_id_initiative_id_fk",
+ "tableFrom": "initiative_label",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "initiative_label_label_id_label_id_fk": {
+ "name": "initiative_label_label_id_label_id_fk",
+ "tableFrom": "initiative_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "initiative_label_initiative_id_label_id_pk": {
+ "name": "initiative_label_initiative_id_label_id_pk",
+ "columns": [
+ "initiative_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.integration_credential": {
+ "name": "integration_credential",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_key": {
+ "name": "integration_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "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": {
+ "integration_credential_team_idx": {
+ "name": "integration_credential_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_credential_team_id_team_id_fk": {
+ "name": "integration_credential_team_id_team_id_fk",
+ "tableFrom": "integration_credential",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue": {
+ "name": "issue",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence_number": {
+ "name": "sequence_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type_id": {
+ "name": "type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cycle_id": {
+ "name": "cycle_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_user_id": {
+ "name": "assignee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delegate_user_id": {
+ "name": "delegate_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimate_points": {
+ "name": "estimate_points",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimate_minutes": {
+ "name": "estimate_minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_token": {
+ "name": "share_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_extended": {
+ "name": "share_extended",
+ "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": {
+ "issue_project_active_idx": {
+ "name": "issue_project_active_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_project_title_idx": {
+ "name": "issue_project_title_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(btrim(\"title\"))",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_parent_idx": {
+ "name": "issue_parent_idx",
+ "columns": [
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"parent_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_idx": {
+ "name": "issue_cycle_idx",
+ "columns": [
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"cycle_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_project_id_project_id_fk": {
+ "name": "issue_project_id_project_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_type_id_issue_type_id_fk": {
+ "name": "issue_type_id_issue_type_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_initiative_id_initiative_id_fk": {
+ "name": "issue_initiative_id_initiative_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_cycle_id_cycle_id_fk": {
+ "name": "issue_cycle_id_cycle_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "cycle",
+ "columnsFrom": [
+ "cycle_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_column_id_project_column_id_fk": {
+ "name": "issue_column_id_project_column_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "issue_parent_id_issue_id_fk": {
+ "name": "issue_parent_id_issue_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_assignee_user_id_user_id_fk": {
+ "name": "issue_assignee_user_id_user_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "assignee_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_delegate_user_id_user_id_fk": {
+ "name": "issue_delegate_user_id_user_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "delegate_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_share_token_unique": {
+ "name": "issue_share_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "share_token"
+ ]
+ },
+ "issue_project_id_sequence_number_unique": {
+ "name": "issue_project_id_sequence_number_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "sequence_number"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "issue_estimate_points_check": {
+ "name": "issue_estimate_points_check",
+ "value": "\"issue\".\"estimate_points\" >= 0"
+ },
+ "issue_estimate_minutes_check": {
+ "name": "issue_estimate_minutes_check",
+ "value": "\"issue\".\"estimate_minutes\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_activity": {
+ "name": "issue_activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reply_to_id": {
+ "name": "reply_to_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "edited_at": {
+ "name": "edited_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": {
+ "issue_activity_issue_idx": {
+ "name": "issue_activity_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_activity_reply_idx": {
+ "name": "issue_activity_reply_idx",
+ "columns": [
+ {
+ "expression": "reply_to_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_activity_initiative_idx": {
+ "name": "issue_activity_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_activity_issue_id_issue_id_fk": {
+ "name": "issue_activity_issue_id_issue_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_initiative_id_initiative_id_fk": {
+ "name": "issue_activity_initiative_id_initiative_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_reply_to_id_issue_activity_id_fk": {
+ "name": "issue_activity_reply_to_id_issue_activity_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "reply_to_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_actor_user_id_user_id_fk": {
+ "name": "issue_activity_actor_user_id_user_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "user",
+ "columnsFrom": [
+ "actor_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_activity_kind_check": {
+ "name": "issue_activity_kind_check",
+ "value": "\"issue_activity\".\"kind\" IN ('comment', 'activity')"
+ },
+ "issue_activity_owner_check": {
+ "name": "issue_activity_owner_check",
+ "value": "(\"issue_activity\".\"issue_id\" IS NOT NULL) <> (\"issue_activity\".\"initiative_id\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_attachment": {
+ "name": "issue_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "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": {
+ "issue_attachment_issue_idx": {
+ "name": "issue_attachment_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_attachment_issue_id_issue_id_fk": {
+ "name": "issue_attachment_issue_id_issue_id_fk",
+ "tableFrom": "issue_attachment",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_attachment_public_id_unique": {
+ "name": "issue_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_checklist": {
+ "name": "issue_checklist",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_checklist_issue_idx": {
+ "name": "issue_checklist_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_checklist_issue_id_issue_id_fk": {
+ "name": "issue_checklist_issue_id_issue_id_fk",
+ "tableFrom": "issue_checklist",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_checklist_item": {
+ "name": "issue_checklist_item",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "checklist_id": {
+ "name": "checklist_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "done": {
+ "name": "done",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_checklist_item_checklist_idx": {
+ "name": "issue_checklist_item_checklist_idx",
+ "columns": [
+ {
+ "expression": "checklist_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_checklist_item_checklist_id_issue_checklist_id_fk": {
+ "name": "issue_checklist_item_checklist_id_issue_checklist_id_fk",
+ "tableFrom": "issue_checklist_item",
+ "tableTo": "issue_checklist",
+ "columnsFrom": [
+ "checklist_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_cycle": {
+ "name": "issue_cycle",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cycle_id": {
+ "name": "cycle_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entered_at": {
+ "name": "entered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "left_at": {
+ "name": "left_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_cycle_issue_idx": {
+ "name": "issue_cycle_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entered_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_cycle_idx": {
+ "name": "issue_cycle_cycle_idx",
+ "columns": [
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_open_idx": {
+ "name": "issue_cycle_open_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"issue_cycle\".\"left_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_cycle_issue_id_issue_id_fk": {
+ "name": "issue_cycle_issue_id_issue_id_fk",
+ "tableFrom": "issue_cycle",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_cycle_cycle_id_cycle_id_fk": {
+ "name": "issue_cycle_cycle_id_cycle_id_fk",
+ "tableFrom": "issue_cycle",
+ "tableTo": "cycle",
+ "columnsFrom": [
+ "cycle_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_development_check": {
+ "name": "issue_development_check",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "development_link_id": {
+ "name": "development_link_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_id": {
+ "name": "app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_development_check_link_sha_idx": {
+ "name": "issue_development_check_link_sha_idx",
+ "columns": [
+ {
+ "expression": "development_link_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "head_sha",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_development_check_development_link_id_issue_development_link_id_fk": {
+ "name": "issue_development_check_development_link_id_issue_development_link_id_fk",
+ "tableFrom": "issue_development_check",
+ "tableTo": "issue_development_link",
+ "columnsFrom": [
+ "development_link_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_development_check_development_link_id_app_id_name_unique": {
+ "name": "issue_development_check_development_link_id_app_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "development_link_id",
+ "app_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_development_link": {
+ "name": "issue_development_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pull_request'"
+ },
+ "external_key": {
+ "name": "external_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "draft": {
+ "name": "draft",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "source_branch": {
+ "name": "source_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_branch": {
+ "name": "target_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pipeline_status": {
+ "name": "pipeline_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pipeline_url": {
+ "name": "pipeline_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_development_link_issue_idx": {
+ "name": "issue_development_link_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_development_link_pr_idx": {
+ "name": "issue_development_link_pr_idx",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_development_link_sha_idx": {
+ "name": "issue_development_link_sha_idx",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "head_sha",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_development_link_issue_id_issue_id_fk": {
+ "name": "issue_development_link_issue_id_issue_id_fk",
+ "tableFrom": "issue_development_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_development_link_issue_id_provider_repository_external_key_unique": {
+ "name": "issue_development_link_issue_id_provider_repository_external_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "issue_id",
+ "provider",
+ "repository",
+ "external_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_field_option": {
+ "name": "issue_field_option",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "option_id": {
+ "name": "option_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_field_option_issue_id_issue_id_fk": {
+ "name": "issue_field_option_issue_id_issue_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_option_field_id_custom_field_id_fk": {
+ "name": "issue_field_option_field_id_custom_field_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_option_option_id_custom_field_option_id_fk": {
+ "name": "issue_field_option_option_id_custom_field_option_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "custom_field_option",
+ "columnsFrom": [
+ "option_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_field_option_issue_id_field_id_option_id_pk": {
+ "name": "issue_field_option_issue_id_field_id_option_id_pk",
+ "columns": [
+ "issue_id",
+ "field_id",
+ "option_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_field_value": {
+ "name": "issue_field_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value_text": {
+ "name": "value_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_number": {
+ "name": "value_number",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_bool": {
+ "name": "value_bool",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_date": {
+ "name": "value_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_datetime": {
+ "name": "value_datetime",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_datetime_end": {
+ "name": "value_datetime_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_user_id": {
+ "name": "value_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_field_value_issue_id_issue_id_fk": {
+ "name": "issue_field_value_issue_id_issue_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_value_field_id_custom_field_id_fk": {
+ "name": "issue_field_value_field_id_custom_field_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_value_value_user_id_user_id_fk": {
+ "name": "issue_field_value_value_user_id_user_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "user",
+ "columnsFrom": [
+ "value_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_field_value_issue_id_field_id_unique": {
+ "name": "issue_field_value_issue_id_field_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "issue_id",
+ "field_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_import": {
+ "name": "issue_import",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_id": {
+ "name": "attachment_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'mapped'"
+ },
+ "mapping": {
+ "name": "mapping",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_text": {
+ "name": "error_text",
+ "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": {
+ "issue_import_project_idx": {
+ "name": "issue_import_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_import_project_id_project_id_fk": {
+ "name": "issue_import_project_id_project_id_fk",
+ "tableFrom": "issue_import",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_import_attachment_id_chat_attachment_id_fk": {
+ "name": "issue_import_attachment_id_chat_attachment_id_fk",
+ "tableFrom": "issue_import",
+ "tableTo": "chat_attachment",
+ "columnsFrom": [
+ "attachment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_import_public_id_unique": {
+ "name": "issue_import_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_key_alias": {
+ "name": "issue_key_alias",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence_number": {
+ "name": "sequence_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "issue_key_alias_issue_idx": {
+ "name": "issue_key_alias_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_key_alias_project_id_project_id_fk": {
+ "name": "issue_key_alias_project_id_project_id_fk",
+ "tableFrom": "issue_key_alias",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_key_alias_issue_id_issue_id_fk": {
+ "name": "issue_key_alias_issue_id_issue_id_fk",
+ "tableFrom": "issue_key_alias",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_key_alias_project_id_sequence_number_pk": {
+ "name": "issue_key_alias_project_id_sequence_number_pk",
+ "columns": [
+ "project_id",
+ "sequence_number"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_label": {
+ "name": "issue_label",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_label_issue_id_issue_id_fk": {
+ "name": "issue_label_issue_id_issue_id_fk",
+ "tableFrom": "issue_label",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_label_label_id_label_id_fk": {
+ "name": "issue_label_label_id_label_id_fk",
+ "tableFrom": "issue_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_label_issue_id_label_id_pk": {
+ "name": "issue_label_issue_id_label_id_pk",
+ "columns": [
+ "issue_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_link": {
+ "name": "issue_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "source_issue_id": {
+ "name": "source_issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_issue_id": {
+ "name": "target_issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_link_pair_kind_idx": {
+ "name": "issue_link_pair_kind_idx",
+ "columns": [
+ {
+ "expression": "least(\"source_issue_id\", \"target_issue_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "greatest(\"source_issue_id\", \"target_issue_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_link_source_idx": {
+ "name": "issue_link_source_idx",
+ "columns": [
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_link_target_idx": {
+ "name": "issue_link_target_idx",
+ "columns": [
+ {
+ "expression": "target_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_link_source_issue_id_issue_id_fk": {
+ "name": "issue_link_source_issue_id_issue_id_fk",
+ "tableFrom": "issue_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "source_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_link_target_issue_id_issue_id_fk": {
+ "name": "issue_link_target_issue_id_issue_id_fk",
+ "tableFrom": "issue_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "target_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_link_kind_check": {
+ "name": "issue_link_kind_check",
+ "value": "\"issue_link\".\"kind\" IN ('blocks', 'relates', 'duplicates')"
+ },
+ "issue_link_self_check": {
+ "name": "issue_link_self_check",
+ "value": "\"issue_link\".\"source_issue_id\" <> \"issue_link\".\"target_issue_id\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_status": {
+ "name": "issue_status",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_name": {
+ "name": "column_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state_type": {
+ "name": "state_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entered_at": {
+ "name": "entered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "left_at": {
+ "name": "left_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_status_issue_idx": {
+ "name": "issue_status_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entered_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_status_column_idx": {
+ "name": "issue_status_column_idx",
+ "columns": [
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue_status\".\"column_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_status_open_idx": {
+ "name": "issue_status_open_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"issue_status\".\"left_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_status_issue_id_issue_id_fk": {
+ "name": "issue_status_issue_id_issue_id_fk",
+ "tableFrom": "issue_status",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_status_column_id_project_column_id_fk": {
+ "name": "issue_status_column_id_project_column_id_fk",
+ "tableFrom": "issue_status",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_template": {
+ "name": "issue_template",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "title_template": {
+ "name": "title_template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "description_template": {
+ "name": "description_template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "type_id": {
+ "name": "type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_user_id": {
+ "name": "assignee_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": {
+ "issue_template_project_id_project_id_fk": {
+ "name": "issue_template_project_id_project_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_template_type_id_issue_type_id_fk": {
+ "name": "issue_template_type_id_issue_type_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_template_column_id_project_column_id_fk": {
+ "name": "issue_template_column_id_project_column_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_template_assignee_user_id_user_id_fk": {
+ "name": "issue_template_assignee_user_id_user_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "user",
+ "columnsFrom": [
+ "assignee_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_template_project_id_name_unique": {
+ "name": "issue_template_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_template_label": {
+ "name": "issue_template_label",
+ "schema": "",
+ "columns": {
+ "template_id": {
+ "name": "template_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_template_label_template_id_issue_template_id_fk": {
+ "name": "issue_template_label_template_id_issue_template_id_fk",
+ "tableFrom": "issue_template_label",
+ "tableTo": "issue_template",
+ "columnsFrom": [
+ "template_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_template_label_label_id_label_id_fk": {
+ "name": "issue_template_label_label_id_label_id_fk",
+ "tableFrom": "issue_template_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_template_label_template_id_label_id_pk": {
+ "name": "issue_template_label_template_id_label_id_pk",
+ "columns": [
+ "template_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_type": {
+ "name": "issue_type",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "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": {},
+ "foreignKeys": {
+ "issue_type_project_id_project_id_fk": {
+ "name": "issue_type_project_id_project_id_fk",
+ "tableFrom": "issue_type",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_type_project_id_name_unique": {
+ "name": "issue_type_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_watcher": {
+ "name": "issue_watcher",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subscribed": {
+ "name": "subscribed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_watcher_issue_id_issue_id_fk": {
+ "name": "issue_watcher_issue_id_issue_id_fk",
+ "tableFrom": "issue_watcher",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_watcher_user_id_user_id_fk": {
+ "name": "issue_watcher_user_id_user_id_fk",
+ "tableFrom": "issue_watcher",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_watcher_issue_id_user_id_pk": {
+ "name": "issue_watcher_issue_id_user_id_pk",
+ "columns": [
+ "issue_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_worklog": {
+ "name": "issue_worklog",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "minutes": {
+ "name": "minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "spent_on": {
+ "name": "spent_on",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_worklog_issue_idx": {
+ "name": "issue_worklog_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "spent_on",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_worklog_issue_id_issue_id_fk": {
+ "name": "issue_worklog_issue_id_issue_id_fk",
+ "tableFrom": "issue_worklog",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_worklog_user_id_user_id_fk": {
+ "name": "issue_worklog_user_id_user_id_fk",
+ "tableFrom": "issue_worklog",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_worklog_minutes_check": {
+ "name": "issue_worklog_minutes_check",
+ "value": "\"issue_worklog\".\"minutes\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.jwks": {
+ "name": "jwks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_key": {
+ "name": "public_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "private_key": {
+ "name": "private_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "alg": {
+ "name": "alg",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "crv": {
+ "name": "crv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_project_id_project_id_fk": {
+ "name": "label_project_id_project_id_fk",
+ "tableFrom": "label",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "label_group_id_label_group_id_fk": {
+ "name": "label_group_id_label_group_id_fk",
+ "tableFrom": "label",
+ "tableTo": "label_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_project_id_name_unique": {
+ "name": "label_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label_group": {
+ "name": "label_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_group_project_id_project_id_fk": {
+ "name": "label_group_project_id_project_id_fk",
+ "tableFrom": "label_group",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_group_project_id_name_unique": {
+ "name": "label_group_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.model_price": {
+ "name": "model_price",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input": {
+ "name": "input",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "output": {
+ "name": "output",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cache_read": {
+ "name": "cache_read",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cache_write": {
+ "name": "cache_write",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "model_price_workspace_id_workspace_id_fk": {
+ "name": "model_price_workspace_id_workspace_id_fk",
+ "tableFrom": "model_price",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "model_price_workspace_id_provider_model_unique": {
+ "name": "model_price_workspace_id_provider_model_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "provider",
+ "model"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "model_price_rates_check": {
+ "name": "model_price_rates_check",
+ "value": "\"model_price\".\"input\" >= 0 AND \"model_price\".\"output\" >= 0 AND coalesce(\"model_price\".\"cache_read\", 0) >= 0 AND coalesce(\"model_price\".\"cache_write\", 0) >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.note_board": {
+ "name": "note_board",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_user_id": {
+ "name": "owner_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
+ },
+ "canvas": {
+ "name": "canvas",
+ "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": {
+ "note_board_project_idx": {
+ "name": "note_board_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "note_board_project_id_project_id_fk": {
+ "name": "note_board_project_id_project_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_owner_user_id_user_id_fk": {
+ "name": "note_board_owner_user_id_user_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_created_by_user_id_user_id_fk": {
+ "name": "note_board_created_by_user_id_user_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.note_board_member": {
+ "name": "note_board_member",
+ "schema": "",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "note_board_member_user_idx": {
+ "name": "note_board_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "note_board_member_board_id_note_board_id_fk": {
+ "name": "note_board_member_board_id_note_board_id_fk",
+ "tableFrom": "note_board_member",
+ "tableTo": "note_board",
+ "columnsFrom": [
+ "board_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_member_user_id_user_id_fk": {
+ "name": "note_board_member_user_id_user_id_fk",
+ "tableFrom": "note_board_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "note_board_member_board_id_user_id_pk": {
+ "name": "note_board_member_board_id_user_id_pk",
+ "columns": [
+ "board_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_activity_id": {
+ "name": "source_activity_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "read_at": {
+ "name": "read_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snoozed_until": {
+ "name": "snoozed_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()"
+ }
+ },
+ "indexes": {
+ "notification_user_idx": {
+ "name": "notification_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_user_unread_idx": {
+ "name": "notification_user_unread_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification\".\"read_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_project_id_project_id_fk": {
+ "name": "notification_project_id_project_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_issue_id_issue_id_fk": {
+ "name": "notification_issue_id_issue_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_source_activity_id_issue_activity_id_fk": {
+ "name": "notification_source_activity_id_issue_activity_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "source_activity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "notification_actor_user_id_user_id_fk": {
+ "name": "notification_actor_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": [
+ "actor_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "notification_type_check": {
+ "name": "notification_type_check",
+ "value": "\"notification\".\"type\" IN ('assigned', 'mentioned', 'commented', 'state_changed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.notification_delivery": {
+ "name": "notification_delivery",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recipient": {
+ "name": "recipient",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "notification_delivery_due_idx": {
+ "name": "notification_delivery_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification_delivery\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_delivery_project_id_project_id_fk": {
+ "name": "notification_delivery_project_id_project_id_fk",
+ "tableFrom": "notification_delivery",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "notification_delivery_channel_check": {
+ "name": "notification_delivery_channel_check",
+ "value": "\"notification_delivery\".\"channel\" IN ('email', 'telegram')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.oauth_access_token": {
+ "name": "oauth_access_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorization_code_id": {
+ "name": "authorization_code_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_user_info_claims": {
+ "name": "requested_user_info_claims",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_id": {
+ "name": "refresh_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked": {
+ "name": "revoked",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmation": {
+ "name": "confirmation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthAccessToken_clientId_idx": {
+ "name": "oauthAccessToken_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_sessionId_idx": {
+ "name": "oauthAccessToken_sessionId_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_userId_idx": {
+ "name": "oauthAccessToken_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_authorizationCodeId_idx": {
+ "name": "oauthAccessToken_authorizationCodeId_idx",
+ "columns": [
+ {
+ "expression": "authorization_code_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_refreshId_idx": {
+ "name": "oauthAccessToken_refreshId_idx",
+ "columns": [
+ {
+ "expression": "refresh_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_access_token_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_access_token_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_session_id_session_id_fk": {
+ "name": "oauth_access_token_session_id_session_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "session",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_user_id_user_id_fk": {
+ "name": "oauth_access_token_user_id_user_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_refresh_id_oauth_refresh_token_id_fk": {
+ "name": "oauth_access_token_refresh_id_oauth_refresh_token_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "oauth_refresh_token",
+ "columnsFrom": [
+ "refresh_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_access_token_token_unique": {
+ "name": "oauth_access_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_client": {
+ "name": "oauth_client",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_secret": {
+ "name": "client_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_discovery_id": {
+ "name": "client_discovery_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "skip_consent": {
+ "name": "skip_consent",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enable_end_session": {
+ "name": "enable_end_session",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_credentials_scopes": {
+ "name": "client_credentials_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uri": {
+ "name": "uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contacts": {
+ "name": "contacts",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tos": {
+ "name": "tos",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy": {
+ "name": "policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_id": {
+ "name": "software_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_version": {
+ "name": "software_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_statement": {
+ "name": "software_statement",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redirect_uris": {
+ "name": "redirect_uris",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "post_logout_redirect_uris": {
+ "name": "post_logout_redirect_uris",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backchannel_logout_uri": {
+ "name": "backchannel_logout_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backchannel_logout_session_required": {
+ "name": "backchannel_logout_session_required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_endpoint_auth_method": {
+ "name": "token_endpoint_auth_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "application_type": {
+ "name": "application_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "jwks": {
+ "name": "jwks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "jwks_uri": {
+ "name": "jwks_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_types": {
+ "name": "grant_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_types": {
+ "name": "response_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "require_pkce": {
+ "name": "require_pkce",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dpop_bound_access_tokens": {
+ "name": "dpop_bound_access_tokens",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauthClient_userId_idx": {
+ "name": "oauthClient_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_client_user_id_user_id_fk": {
+ "name": "oauth_client_user_id_user_id_fk",
+ "tableFrom": "oauth_client",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_client_client_id_unique": {
+ "name": "oauth_client_client_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "client_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_client_assertion": {
+ "name": "oauth_client_assertion",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_client_resource": {
+ "name": "oauth_client_resource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauthClientResource_clientId_resourceId_uidx": {
+ "name": "oauthClientResource_clientId_resourceId_uidx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthClientResource_clientId_idx": {
+ "name": "oauthClientResource_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthClientResource_resourceId_idx": {
+ "name": "oauthClientResource_resourceId_idx",
+ "columns": [
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_client_resource_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_client_resource_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_client_resource",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_client_resource_resource_id_oauth_resource_identifier_fk": {
+ "name": "oauth_client_resource_resource_id_oauth_resource_identifier_fk",
+ "tableFrom": "oauth_client_resource",
+ "tableTo": "oauth_resource",
+ "columnsFrom": [
+ "resource_id"
+ ],
+ "columnsTo": [
+ "identifier"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_consent": {
+ "name": "oauth_consent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_user_info_claims": {
+ "name": "requested_user_info_claims",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthConsent_clientId_idx": {
+ "name": "oauthConsent_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthConsent_userId_idx": {
+ "name": "oauthConsent_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_consent_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_consent_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_consent",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_consent_user_id_user_id_fk": {
+ "name": "oauth_consent_user_id_user_id_fk",
+ "tableFrom": "oauth_consent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_refresh_token": {
+ "name": "oauth_refresh_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorization_code_id": {
+ "name": "authorization_code_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_user_info_claims": {
+ "name": "requested_user_info_claims",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked": {
+ "name": "revoked",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotated_at": {
+ "name": "rotated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotation_replay_response": {
+ "name": "rotation_replay_response",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotation_replay_expires_at": {
+ "name": "rotation_replay_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_time": {
+ "name": "auth_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmation": {
+ "name": "confirmation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthRefreshToken_clientId_idx": {
+ "name": "oauthRefreshToken_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_sessionId_idx": {
+ "name": "oauthRefreshToken_sessionId_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_userId_idx": {
+ "name": "oauthRefreshToken_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_authorizationCodeId_idx": {
+ "name": "oauthRefreshToken_authorizationCodeId_idx",
+ "columns": [
+ {
+ "expression": "authorization_code_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_refresh_token_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_refresh_token_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_refresh_token_session_id_session_id_fk": {
+ "name": "oauth_refresh_token_session_id_session_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "session",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauth_refresh_token_user_id_user_id_fk": {
+ "name": "oauth_refresh_token_user_id_user_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_refresh_token_token_unique": {
+ "name": "oauth_refresh_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_resource": {
+ "name": "oauth_resource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_ttl": {
+ "name": "access_token_ttl",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_ttl": {
+ "name": "refresh_token_ttl",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signing_algorithm": {
+ "name": "signing_algorithm",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signing_key_id": {
+ "name": "signing_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "allowed_scopes": {
+ "name": "allowed_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "custom_claims": {
+ "name": "custom_claims",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dpop_bound_access_tokens_required": {
+ "name": "dpop_bound_access_tokens_required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy_version": {
+ "name": "policy_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_resource_identifier_unique": {
+ "name": "oauth_resource_identifier_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "identifier"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.passkey": {
+ "name": "passkey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public_key": {
+ "name": "public_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counter": {
+ "name": "counter",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "device_type": {
+ "name": "device_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "backed_up": {
+ "name": "backed_up",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "transports": {
+ "name": "transports",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aaguid": {
+ "name": "aaguid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "passkey_userId_idx": {
+ "name": "passkey_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "passkey_credentialID_idx": {
+ "name": "passkey_credentialID_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "passkey_user_id_user_id_fk": {
+ "name": "passkey_user_id_user_id_fk",
+ "tableFrom": "passkey",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "next_sequence": {
+ "name": "next_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "mcp_enabled": {
+ "name": "mcp_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "initiatives_enabled": {
+ "name": "initiatives_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "dashboards_enabled": {
+ "name": "dashboards_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "documents_enabled": {
+ "name": "documents_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "notes_enabled": {
+ "name": "notes_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "cycles_enabled": {
+ "name": "cycles_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "subtasks_enabled": {
+ "name": "subtasks_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "checklists_enabled": {
+ "name": "checklists_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "issue_stats_enabled": {
+ "name": "issue_stats_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "points_estimate_enabled": {
+ "name": "points_estimate_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "time_estimate_enabled": {
+ "name": "time_estimate_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "time_logging_enabled": {
+ "name": "time_logging_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_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": {
+ "project_team_id_team_id_fk": {
+ "name": "project_team_id_team_id_fk",
+ "tableFrom": "project",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_team_key_uq": {
+ "name": "project_team_key_uq",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_action": {
+ "name": "project_action",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "condition": {
+ "name": "condition",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "effect": {
+ "name": "effect",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_action_project_idx": {
+ "name": "project_action_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_action_project_id_project_id_fk": {
+ "name": "project_action_project_id_project_id_fk",
+ "tableFrom": "project_action",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_column": {
+ "name": "project_column",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state_type": {
+ "name": "state_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unstarted'"
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "wip_limit": {
+ "name": "wip_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "wip_mode": {
+ "name": "wip_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'soft'"
+ },
+ "auto_assign_user_id": {
+ "name": "auto_assign_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": {
+ "project_column_project_id_project_id_fk": {
+ "name": "project_column_project_id_project_id_fk",
+ "tableFrom": "project_column",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_column_auto_assign_user_id_user_id_fk": {
+ "name": "project_column_auto_assign_user_id_user_id_fk",
+ "tableFrom": "project_column",
+ "tableTo": "user",
+ "columnsFrom": [
+ "auto_assign_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_column_project_id_position_unique": {
+ "name": "project_column_project_id_position_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "position"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "project_column_state_type_check": {
+ "name": "project_column_state_type_check",
+ "value": "\"project_column\".\"state_type\" IN ('backlog', 'unstarted', 'started', 'completed', 'canceled')"
+ },
+ "project_column_wip_mode_check": {
+ "name": "project_column_wip_mode_check",
+ "value": "\"project_column\".\"wip_mode\" IN ('soft', 'hard')"
+ },
+ "project_column_wip_limit_check": {
+ "name": "project_column_wip_limit_check",
+ "value": "\"project_column\".\"wip_limit\" IS NULL OR \"project_column\".\"wip_limit\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_dashboard": {
+ "name": "project_dashboard",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "layout": {
+ "name": "layout",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_dashboard_project_idx": {
+ "name": "project_dashboard_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_dashboard_project_id_project_id_fk": {
+ "name": "project_dashboard_project_id_project_id_fk",
+ "tableFrom": "project_dashboard",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document": {
+ "name": "project_document",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "content_json": {
+ "name": "content_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "full_width": {
+ "name": "full_width",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_private": {
+ "name": "is_private",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_locked": {
+ "name": "is_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_ancestor_id": {
+ "name": "archived_by_ancestor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_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()"
+ }
+ },
+ "indexes": {
+ "project_document_project_tree_idx": {
+ "name": "project_document_project_tree_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_document_owner_idx": {
+ "name": "project_document_owner_idx",
+ "columns": [
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_document_project_archive_idx": {
+ "name": "project_document_project_archive_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_project_id_project_id_fk": {
+ "name": "project_document_project_id_project_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_parent_id_project_document_id_fk": {
+ "name": "project_document_parent_id_project_document_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_archived_by_ancestor_id_project_document_id_fk": {
+ "name": "project_document_archived_by_ancestor_id_project_document_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "archived_by_ancestor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_owner_user_id_user_id_fk": {
+ "name": "project_document_owner_user_id_user_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_created_by_user_id_user_id_fk": {
+ "name": "project_document_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_updated_by_user_id_user_id_fk": {
+ "name": "project_document_updated_by_user_id_user_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "user",
+ "columnsFrom": [
+ "updated_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_document_version_check": {
+ "name": "project_document_version_check",
+ "value": "\"project_document\".\"version\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_document_initiative": {
+ "name": "project_document_initiative",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_initiative_initiative_idx": {
+ "name": "project_document_initiative_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_initiative_document_id_project_document_id_fk": {
+ "name": "project_document_initiative_document_id_project_document_id_fk",
+ "tableFrom": "project_document_initiative",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_initiative_initiative_id_initiative_id_fk": {
+ "name": "project_document_initiative_initiative_id_initiative_id_fk",
+ "tableFrom": "project_document_initiative",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_initiative_created_by_user_id_user_id_fk": {
+ "name": "project_document_initiative_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document_initiative",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_document_initiative_document_id_initiative_id_pk": {
+ "name": "project_document_initiative_document_id_initiative_id_pk",
+ "columns": [
+ "document_id",
+ "initiative_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document_issue": {
+ "name": "project_document_issue",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_issue_issue_idx": {
+ "name": "project_document_issue_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_issue_document_id_project_document_id_fk": {
+ "name": "project_document_issue_document_id_project_document_id_fk",
+ "tableFrom": "project_document_issue",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_issue_issue_id_issue_id_fk": {
+ "name": "project_document_issue_issue_id_issue_id_fk",
+ "tableFrom": "project_document_issue",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_issue_created_by_user_id_user_id_fk": {
+ "name": "project_document_issue_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document_issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_document_issue_document_id_issue_id_pk": {
+ "name": "project_document_issue_document_id_issue_id_pk",
+ "columns": [
+ "document_id",
+ "issue_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document_preference": {
+ "name": "project_document_preference",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_favorite": {
+ "name": "is_favorite",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_preference_user_idx": {
+ "name": "project_document_preference_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_preference_document_id_project_document_id_fk": {
+ "name": "project_document_preference_document_id_project_document_id_fk",
+ "tableFrom": "project_document_preference",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_preference_user_id_user_id_fk": {
+ "name": "project_document_preference_user_id_user_id_fk",
+ "tableFrom": "project_document_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_document_preference_document_id_user_id_pk": {
+ "name": "project_document_preference_document_id_user_id_pk",
+ "columns": [
+ "document_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document_revision": {
+ "name": "project_document_revision",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_json": {
+ "name": "content_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "full_width": {
+ "name": "full_width",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_private": {
+ "name": "is_private",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_locked": {
+ "name": "is_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": 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()"
+ }
+ },
+ "indexes": {
+ "project_document_revision_document_idx": {
+ "name": "project_document_revision_document_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_revision_document_id_project_document_id_fk": {
+ "name": "project_document_revision_document_id_project_document_id_fk",
+ "tableFrom": "project_document_revision",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_revision_owner_user_id_user_id_fk": {
+ "name": "project_document_revision_owner_user_id_user_id_fk",
+ "tableFrom": "project_document_revision",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_revision_created_by_user_id_user_id_fk": {
+ "name": "project_document_revision_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document_revision",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_document_revision_document_version_unique": {
+ "name": "project_document_revision_document_version_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "document_id",
+ "version"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_member": {
+ "name": "project_member",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'invite'"
+ },
+ "is_favorite": {
+ "name": "is_favorite",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_hidden": {
+ "name": "is_hidden",
+ "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": {
+ "project_member_user_idx": {
+ "name": "project_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_member_project_id_project_id_fk": {
+ "name": "project_member_project_id_project_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_member_user_id_user_id_fk": {
+ "name": "project_member_user_id_user_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_member_role_id_team_role_id_fk": {
+ "name": "project_member_role_id_team_role_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "team_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_member_project_id_user_id_pk": {
+ "name": "project_member_project_id_user_id_pk",
+ "columns": [
+ "project_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_member_role_check": {
+ "name": "project_member_role_check",
+ "value": "\"project_member\".\"role\" IN ('owner', 'member')"
+ },
+ "project_member_source_check": {
+ "name": "project_member_source_check",
+ "value": "\"project_member\".\"source\" IN ('invite', 'scim')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_setting": {
+ "name": "project_setting",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_setting_project_id_project_id_fk": {
+ "name": "project_setting_project_id_project_id_fk",
+ "tableFrom": "project_setting",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_setting_project_id_key_pk": {
+ "name": "project_setting_project_id_key_pk",
+ "columns": [
+ "project_id",
+ "key"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_view": {
+ "name": "project_view",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "filters": {
+ "name": "filters",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "display": {
+ "name": "display",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "share_token": {
+ "name": "share_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_extended": {
+ "name": "share_extended",
+ "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": {
+ "project_view_project_idx": {
+ "name": "project_view_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_view_project_id_project_id_fk": {
+ "name": "project_view_project_id_project_id_fk",
+ "tableFrom": "project_view",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_view_share_token_unique": {
+ "name": "project_view_share_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "share_token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_view_favorite": {
+ "name": "project_view_favorite",
+ "schema": "",
+ "columns": {
+ "view_id": {
+ "name": "view_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_view_favorite_view_id_project_view_id_fk": {
+ "name": "project_view_favorite_view_id_project_view_id_fk",
+ "tableFrom": "project_view_favorite",
+ "tableTo": "project_view",
+ "columnsFrom": [
+ "view_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_view_favorite_user_id_user_id_fk": {
+ "name": "project_view_favorite_user_id_user_id_fk",
+ "tableFrom": "project_view_favorite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_view_favorite_view_id_user_id_pk": {
+ "name": "project_view_favorite_view_id_user_id_pk",
+ "columns": [
+ "view_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.revision": {
+ "name": "revision",
+ "schema": "",
+ "columns": {
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rev": {
+ "name": "rev",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "revision_project_idx": {
+ "name": "revision_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_group": {
+ "name": "scim_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_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": {
+ "scim_group_instance_display_name_uq": {
+ "name": "scim_group_instance_display_name_uq",
+ "columns": [
+ {
+ "expression": "display_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"scim_group\".\"workspace_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_workspace_id_workspace_id_fk": {
+ "name": "scim_group_workspace_id_workspace_id_fk",
+ "tableFrom": "scim_group",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "scim_group_workspace_id_display_name_unique": {
+ "name": "scim_group_workspace_id_display_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "display_name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_group_mapping": {
+ "name": "scim_group_mapping",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_group_mapping_project_idx": {
+ "name": "scim_group_mapping_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_mapping_group_id_scim_group_id_fk": {
+ "name": "scim_group_mapping_group_id_scim_group_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "scim_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_mapping_project_id_project_id_fk": {
+ "name": "scim_group_mapping_project_id_project_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_mapping_role_id_team_role_id_fk": {
+ "name": "scim_group_mapping_role_id_team_role_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "team_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "scim_group_mapping_group_id_project_id_unique": {
+ "name": "scim_group_mapping_group_id_project_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "group_id",
+ "project_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "scim_group_mapping_role_check": {
+ "name": "scim_group_mapping_role_check",
+ "value": "\"scim_group_mapping\".\"role\" IN ('owner', 'member')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.scim_group_member": {
+ "name": "scim_group_member",
+ "schema": "",
+ "columns": {
+ "group_id": {
+ "name": "group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "scim_group_member_user_idx": {
+ "name": "scim_group_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_member_group_id_scim_group_id_fk": {
+ "name": "scim_group_member_group_id_scim_group_id_fk",
+ "tableFrom": "scim_group_member",
+ "tableTo": "scim_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_member_user_id_user_id_fk": {
+ "name": "scim_group_member_user_id_user_id_fk",
+ "tableFrom": "scim_group_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "scim_group_member_group_id_user_id_pk": {
+ "name": "scim_group_member_group_id_user_id_pk",
+ "columns": [
+ "group_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_user": {
+ "name": "scim_user",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active": {
+ "name": "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()"
+ }
+ },
+ "indexes": {
+ "scim_user_instance_user_uq": {
+ "name": "scim_user_instance_user_uq",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"scim_user\".\"workspace_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_user_user_idx": {
+ "name": "scim_user_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_user_workspace_id_workspace_id_fk": {
+ "name": "scim_user_workspace_id_workspace_id_fk",
+ "tableFrom": "scim_user",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_user_user_id_user_id_fk": {
+ "name": "scim_user_user_id_user_id_fk",
+ "tableFrom": "scim_user",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "scim_user_workspace_id_user_id_unique": {
+ "name": "scim_user_workspace_id_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_enabled": {
+ "name": "mcp_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "default_agent_ids": {
+ "name": "default_agent_ids",
+ "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": {
+ "team_workspace_idx": {
+ "name": "team_workspace_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_slug_unique": {
+ "name": "team_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_invite": {
+ "name": "team_invite",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_role": {
+ "name": "team_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "project_role": {
+ "name": "project_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "invited_by_user_id": {
+ "name": "invited_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_by_user_id": {
+ "name": "accepted_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()"
+ },
+ "responded_at": {
+ "name": "responded_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "team_invite_team_pending_uq": {
+ "name": "team_invite_team_pending_uq",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_invite_project_pending_uq": {
+ "name": "team_invite_project_pending_uq",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_invite_team_idx": {
+ "name": "team_invite_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_invite_project_idx": {
+ "name": "team_invite_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_invite_team_id_team_id_fk": {
+ "name": "team_invite_team_id_team_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_invite_project_id_project_id_fk": {
+ "name": "team_invite_project_id_project_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_invite_role_id_team_role_id_fk": {
+ "name": "team_invite_role_id_team_role_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "team_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "team_invite_invited_by_user_id_user_id_fk": {
+ "name": "team_invite_invited_by_user_id_user_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "invited_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "team_invite_accepted_by_user_id_user_id_fk": {
+ "name": "team_invite_accepted_by_user_id_user_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "accepted_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_invite_token_unique": {
+ "name": "team_invite_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "team_invite_team_role_check": {
+ "name": "team_invite_team_role_check",
+ "value": "\"team_invite\".\"team_role\" IN ('owner', 'manager', 'member')"
+ },
+ "team_invite_project_role_check": {
+ "name": "team_invite_project_role_check",
+ "value": "(\"team_invite\".\"project_id\" IS NULL AND \"team_invite\".\"project_role\" IS NULL)\n OR (\"team_invite\".\"project_id\" IS NOT NULL AND \"team_invite\".\"project_role\" IN ('owner', 'member'))"
+ },
+ "team_invite_status_check": {
+ "name": "team_invite_status_check",
+ "value": "\"team_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'invite'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "team_member_user_idx": {
+ "name": "team_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "team_member_team_id_user_id_pk": {
+ "name": "team_member_team_id_user_id_pk",
+ "columns": [
+ "team_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "team_member_role_check": {
+ "name": "team_member_role_check",
+ "value": "\"team_member\".\"role\" IN ('owner', 'manager', 'member', 'agent')"
+ },
+ "team_member_source_check": {
+ "name": "team_member_source_check",
+ "value": "\"team_member\".\"source\" IN ('invite', 'scim')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.team_notification_setting": {
+ "name": "team_notification_setting",
+ "schema": "",
+ "columns": {
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "team_notification_setting_team_id_team_id_fk": {
+ "name": "team_notification_setting_team_id_team_id_fk",
+ "tableFrom": "team_notification_setting",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_role": {
+ "name": "team_role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "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": {
+ "team_role_default_uq": {
+ "name": "team_role_default_uq",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_role\".\"is_default\"",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_role_team_idx": {
+ "name": "team_role_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_role_team_id_team_id_fk": {
+ "name": "team_role_team_id_team_id_fk",
+ "tableFrom": "team_role",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_role_team_id_name_unique": {
+ "name": "team_role_team_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_username": {
+ "name": "display_username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'user'"
+ },
+ "active": {
+ "name": "active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ },
+ "user_username_unique": {
+ "name": "user_username_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "username"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_preference": {
+ "name": "user_notification_preference",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_events": {
+ "name": "email_events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "telegram_events": {
+ "name": "telegram_events",
+ "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": {},
+ "foreignKeys": {
+ "user_notification_preference_user_id_user_id_fk": {
+ "name": "user_notification_preference_user_id_user_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_notification_preference_project_id_project_id_fk": {
+ "name": "user_notification_preference_project_id_project_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_pref_user_project_unique": {
+ "name": "user_notification_pref_user_project_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id",
+ "project_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_preference": {
+ "name": "user_preference",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'UTC'"
+ },
+ "locale": {
+ "name": "locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'en'"
+ },
+ "theme": {
+ "name": "theme",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "issue_open_mode": {
+ "name": "issue_open_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'panel'"
+ },
+ "start_page": {
+ "name": "start_page",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'work-items'"
+ },
+ "show_chat_by_default": {
+ "name": "show_chat_by_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "issue_stats_open": {
+ "name": "issue_stats_open",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "issue_stats_view": {
+ "name": "issue_stats_view",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'compact'"
+ },
+ "issue_activity_view": {
+ "name": "issue_activity_view",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'flat'"
+ },
+ "auto_watch": {
+ "name": "auto_watch",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "hotkeys": {
+ "name": "hotkeys",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_project_id": {
+ "name": "last_project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "seen_version": {
+ "name": "seen_version",
+ "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": {
+ "user_preference_user_id_user_id_fk": {
+ "name": "user_preference_user_id_user_id_fk",
+ "tableFrom": "user_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_preference_last_project_id_project_id_fk": {
+ "name": "user_preference_last_project_id_project_id_fk",
+ "tableFrom": "user_preference",
+ "tableTo": "project",
+ "columnsFrom": [
+ "last_project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_preference_theme_check": {
+ "name": "user_preference_theme_check",
+ "value": "\"user_preference\".\"theme\" IN ('light', 'dark', 'system')"
+ },
+ "user_preference_issue_open_mode_check": {
+ "name": "user_preference_issue_open_mode_check",
+ "value": "\"user_preference\".\"issue_open_mode\" IN ('panel', 'page')"
+ },
+ "user_preference_start_page_check": {
+ "name": "user_preference_start_page_check",
+ "value": "\"user_preference\".\"start_page\" IN ('inbox', 'dashboard', 'work-items', 'initiatives')"
+ },
+ "user_preference_issue_stats_view_check": {
+ "name": "user_preference_issue_stats_view_check",
+ "value": "\"user_preference\".\"issue_stats_view\" IN ('compact', 'timeline')"
+ },
+ "user_preference_issue_activity_view_check": {
+ "name": "user_preference_issue_activity_view_check",
+ "value": "\"user_preference\".\"issue_activity_view\" IN ('flat', 'grouped')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_telegram_account": {
+ "name": "user_telegram_account",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_name": {
+ "name": "first_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "link_code": {
+ "name": "link_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "link_code_expires_at": {
+ "name": "link_code_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linked_at": {
+ "name": "linked_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": {
+ "user_telegram_account_chat_id_unique": {
+ "name": "user_telegram_account_chat_id_unique",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_telegram_account\".\"chat_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_telegram_account_link_code_unique": {
+ "name": "user_telegram_account_link_code_unique",
+ "columns": [
+ {
+ "expression": "link_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_telegram_account\".\"link_code\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_telegram_account_user_id_user_id_fk": {
+ "name": "user_telegram_account_user_id_user_id_fk",
+ "tableFrom": "user_telegram_account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook": {
+ "name": "webhook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "events": {
+ "name": "events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "consecutive_failures": {
+ "name": "consecutive_failures",
+ "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": {
+ "webhook_project_idx": {
+ "name": "webhook_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_project_id_project_id_fk": {
+ "name": "webhook_project_id_project_id_fk",
+ "tableFrom": "webhook",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook_delivery": {
+ "name": "webhook_delivery",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "webhook_id": {
+ "name": "webhook_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_body": {
+ "name": "response_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "webhook_delivery_due_idx": {
+ "name": "webhook_delivery_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"webhook_delivery\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_delivery_webhook_idx": {
+ "name": "webhook_delivery_webhook_idx",
+ "columns": [
+ {
+ "expression": "webhook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_delivery_webhook_id_webhook_id_fk": {
+ "name": "webhook_delivery_webhook_id_webhook_id_fk",
+ "tableFrom": "webhook_delivery",
+ "tableTo": "webhook",
+ "columnsFrom": [
+ "webhook_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_creation": {
+ "name": "team_creation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'owner'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_team_creation_check": {
+ "name": "workspace_team_creation_check",
+ "value": "\"workspace\".\"team_creation\" IN ('owner', 'managers', 'members')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_manager": {
+ "name": "workspace_manager",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'admin'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_manager_owner_uq": {
+ "name": "workspace_manager_owner_uq",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workspace_manager\".\"role\" = 'owner'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_manager_user_idx": {
+ "name": "workspace_manager_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_manager_workspace_id_workspace_id_fk": {
+ "name": "workspace_manager_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_manager",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_manager_user_id_user_id_fk": {
+ "name": "workspace_manager_user_id_user_id_fk",
+ "tableFrom": "workspace_manager",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "workspace_manager_workspace_id_user_id_pk": {
+ "name": "workspace_manager_workspace_id_user_id_pk",
+ "columns": [
+ "workspace_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_manager_role_check": {
+ "name": "workspace_manager_role_check",
+ "value": "\"workspace_manager\".\"role\" IN ('owner', 'admin')"
+ }
+ },
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0153_snapshot.json b/packages/db/drizzle/meta/0153_snapshot.json
new file mode 100644
index 00000000..726db915
--- /dev/null
+++ b/packages/db/drizzle/meta/0153_snapshot.json
@@ -0,0 +1,12490 @@
+{
+ "id": "26229b60-ab43-4a10-b02c-0783214aa30b",
+ "prevId": "ee04d68c-123a-4cbf-bc84-0ba3f9b76253",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_event": {
+ "name": "agent_chat_event",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_chat_event_message_idx": {
+ "name": "agent_chat_event_message_idx",
+ "columns": [
+ {
+ "expression": "message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_event_message_id_agent_chat_message_id_fk": {
+ "name": "agent_chat_event_message_id_agent_chat_message_id_fk",
+ "tableFrom": "agent_chat_event",
+ "tableTo": "agent_chat_message",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_favorite": {
+ "name": "agent_chat_favorite",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_chat_favorite_user_id_user_id_fk": {
+ "name": "agent_chat_favorite_user_id_user_id_fk",
+ "tableFrom": "agent_chat_favorite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_chat_favorite_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_favorite_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_favorite",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_chat_favorite_user_id_thread_id_pk": {
+ "name": "agent_chat_favorite_user_id_thread_id_pk",
+ "columns": [
+ "user_id",
+ "thread_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_message": {
+ "name": "agent_chat_message",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_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": {
+ "agent_chat_message_thread_idx": {
+ "name": "agent_chat_message_thread_idx",
+ "columns": [
+ {
+ "expression": "thread_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_chat_message_due_idx": {
+ "name": "agent_chat_message_due_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_message_thread_id_agent_chat_thread_id_fk": {
+ "name": "agent_chat_message_thread_id_agent_chat_thread_id_fk",
+ "tableFrom": "agent_chat_message",
+ "tableTo": "agent_chat_thread",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_chat_message_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_message_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_message",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_chat_message_role_check": {
+ "name": "agent_chat_message_role_check",
+ "value": "\"agent_chat_message\".\"role\" IN ('user', 'assistant')"
+ },
+ "agent_chat_message_status_check": {
+ "name": "agent_chat_message_status_check",
+ "value": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming', 'success', 'failed', 'canceled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_thread": {
+ "name": "agent_chat_thread",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cli_session_id": {
+ "name": "cli_session_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": {
+ "agent_chat_thread_agent_user_idx": {
+ "name": "agent_chat_thread_agent_user_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_thread_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_thread_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_thread",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_chat_thread_user_id_user_id_fk": {
+ "name": "agent_chat_thread_user_id_user_id_fk",
+ "tableFrom": "agent_chat_thread",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_usage": {
+ "name": "agent_chat_usage",
+ "schema": "",
+ "columns": {
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_chat_usage_agent_idx": {
+ "name": "agent_chat_usage_agent_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_usage_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_usage_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_usage",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_field_trigger": {
+ "name": "agent_field_trigger",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delay_sec": {
+ "name": "delay_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 120
+ }
+ },
+ "indexes": {
+ "agent_field_trigger_field_idx": {
+ "name": "agent_field_trigger_field_idx",
+ "columns": [
+ {
+ "expression": "field_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_field_trigger_agent_id_ai_agent_id_fk": {
+ "name": "agent_field_trigger_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_field_trigger",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_field_trigger_field_id_custom_field_id_fk": {
+ "name": "agent_field_trigger_field_id_custom_field_id_fk",
+ "tableFrom": "agent_field_trigger",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_field_trigger_agent_id_field_id_pk": {
+ "name": "agent_field_trigger_agent_id_field_id_pk",
+ "columns": [
+ "agent_id",
+ "field_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_field_trigger_delay_check": {
+ "name": "agent_field_trigger_delay_check",
+ "value": "\"agent_field_trigger\".\"delay_sec\" >= 0 AND \"agent_field_trigger\".\"delay_sec\" <= 86400"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_run": {
+ "name": "agent_run",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "schedule_id": {
+ "name": "schedule_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'delegation'"
+ },
+ "scheduled_for": {
+ "name": "scheduled_for",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_activity_id": {
+ "name": "source_activity_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output": {
+ "name": "output",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_started_at": {
+ "name": "execution_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_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": {
+ "agent_run_schedule_fire_uq": {
+ "name": "agent_run_schedule_fire_uq",
+ "columns": [
+ {
+ "expression": "schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scheduled_for",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_due_idx": {
+ "name": "agent_run_due_idx",
+ "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": {}
+ },
+ "agent_run_schedule_idx": {
+ "name": "agent_run_schedule_idx",
+ "columns": [
+ {
+ "expression": "schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_project_idx": {
+ "name": "agent_run_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_run_agent_id_ai_agent_id_fk": {
+ "name": "agent_run_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_project_id_project_id_fk": {
+ "name": "agent_run_project_id_project_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_issue_id_issue_id_fk": {
+ "name": "agent_run_issue_id_issue_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_schedule_id_agent_schedule_id_fk": {
+ "name": "agent_run_schedule_id_agent_schedule_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "agent_schedule",
+ "columnsFrom": [
+ "schedule_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_source_activity_id_issue_activity_id_fk": {
+ "name": "agent_run_source_activity_id_issue_activity_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "source_activity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_run_status_check": {
+ "name": "agent_run_status_check",
+ "value": "\"agent_run\".\"status\" IN ('pending', 'success', 'failed', 'canceled')"
+ },
+ "agent_run_trigger_check": {
+ "name": "agent_run_trigger_check",
+ "value": "\"agent_run\".\"trigger\" IN ('mention', 'delegation', 'field', 'schedule', 'manual', 'status', 'event')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_run_trace": {
+ "name": "agent_run_trace",
+ "schema": "",
+ "columns": {
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attempt": {
+ "name": "attempt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "events": {
+ "name": "events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "next_offset": {
+ "name": "next_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "truncated": {
+ "name": "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": {},
+ "foreignKeys": {
+ "agent_run_trace_run_id_agent_run_id_fk": {
+ "name": "agent_run_trace_run_id_agent_run_id_fk",
+ "tableFrom": "agent_run_trace",
+ "tableTo": "agent_run",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_run_trace_run_id_attempt_pk": {
+ "name": "agent_run_trace_run_id_attempt_pk",
+ "columns": [
+ "run_id",
+ "attempt"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_schedule": {
+ "name": "agent_schedule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'cron'"
+ },
+ "cron": {
+ "name": "cron",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "next_run_at": {
+ "name": "next_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delay_sec": {
+ "name": "delay_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "options": {
+ "name": "options",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "last_run_at": {
+ "name": "last_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_schedule_due_idx": {
+ "name": "agent_schedule_due_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_agent_idx": {
+ "name": "agent_schedule_agent_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_project_idx": {
+ "name": "agent_schedule_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_column_idx": {
+ "name": "agent_schedule_column_idx",
+ "columns": [
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_schedule_agent_id_ai_agent_id_fk": {
+ "name": "agent_schedule_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_schedule_project_id_project_id_fk": {
+ "name": "agent_schedule_project_id_project_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_schedule_column_id_project_column_id_fk": {
+ "name": "agent_schedule_column_id_project_column_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_schedule_project_id_agent_id_name_unique": {
+ "name": "agent_schedule_project_id_agent_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "agent_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "agent_schedule_status_check": {
+ "name": "agent_schedule_status_check",
+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"
+ },
+ "agent_schedule_type_check": {
+ "name": "agent_schedule_type_check",
+ "value": "(\"agent_schedule\".\"type\" = 'cron' AND \"agent_schedule\".\"cron\" IS NOT NULL AND \"agent_schedule\".\"next_run_at\" IS NOT NULL AND \"agent_schedule\".\"column_id\" IS NULL)\n OR (\"agent_schedule\".\"type\" = 'status' AND \"agent_schedule\".\"column_id\" IS NOT NULL AND \"agent_schedule\".\"cron\" IS NULL AND \"agent_schedule\".\"next_run_at\" IS NULL)\n OR (\"agent_schedule\".\"type\" NOT IN ('cron', 'status') AND \"agent_schedule\".\"cron\" IS NULL AND \"agent_schedule\".\"next_run_at\" IS NULL AND \"agent_schedule\".\"column_id\" IS NULL)"
+ },
+ "agent_schedule_delay_check": {
+ "name": "agent_schedule_delay_check",
+ "value": "\"agent_schedule\".\"delay_sec\" >= 0 AND \"agent_schedule\".\"delay_sec\" <= 86400"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_skill": {
+ "name": "agent_skill",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_url": {
+ "name": "source_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_prefix": {
+ "name": "s3_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "files": {
+ "name": "files",
+ "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": {
+ "agent_skill_team_idx": {
+ "name": "agent_skill_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_skill_team_id_team_id_fk": {
+ "name": "agent_skill_team_id_team_id_fk",
+ "tableFrom": "agent_skill",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_skill_team_id_name_unique": {
+ "name": "agent_skill_team_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "agent_skill_source_check": {
+ "name": "agent_skill_source_check",
+ "value": "\"agent_skill\".\"source\" IN ('upload', 'inline', 'github')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_skill_link": {
+ "name": "agent_skill_link",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "skill_id": {
+ "name": "skill_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "agent_skill_link_skill_idx": {
+ "name": "agent_skill_link_skill_idx",
+ "columns": [
+ {
+ "expression": "skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_skill_link_agent_id_ai_agent_id_fk": {
+ "name": "agent_skill_link_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_skill_link",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_skill_link_skill_id_agent_skill_id_fk": {
+ "name": "agent_skill_link_skill_id_agent_skill_id_fk",
+ "tableFrom": "agent_skill_link",
+ "tableTo": "agent_skill",
+ "columnsFrom": [
+ "skill_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_skill_link_agent_id_skill_id_pk": {
+ "name": "agent_skill_link_agent_id_skill_id_pk",
+ "columns": [
+ "agent_id",
+ "skill_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_tool": {
+ "name": "agent_tool",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_key": {
+ "name": "tool_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_tool_team_idx": {
+ "name": "agent_tool_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_tool_credential_idx": {
+ "name": "agent_tool_credential_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_tool_team_id_team_id_fk": {
+ "name": "agent_tool_team_id_team_id_fk",
+ "tableFrom": "agent_tool",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_tool_credential_id_integration_credential_id_fk": {
+ "name": "agent_tool_credential_id_integration_credential_id_fk",
+ "tableFrom": "agent_tool",
+ "tableTo": "integration_credential",
+ "columnsFrom": [
+ "credential_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_tool_team_id_tool_key_credential_id_unique": {
+ "name": "agent_tool_team_id_tool_key_credential_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "tool_key",
+ "credential_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_tool_link": {
+ "name": "agent_tool_link",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_tool_id": {
+ "name": "agent_tool_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "agent_tool_link_tool_idx": {
+ "name": "agent_tool_link_tool_idx",
+ "columns": [
+ {
+ "expression": "agent_tool_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_tool_link_agent_id_ai_agent_id_fk": {
+ "name": "agent_tool_link_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_tool_link",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_tool_link_agent_tool_id_agent_tool_id_fk": {
+ "name": "agent_tool_link_agent_tool_id_agent_tool_id_fk",
+ "tableFrom": "agent_tool_link",
+ "tableTo": "agent_tool",
+ "columnsFrom": [
+ "agent_tool_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_tool_link_agent_id_agent_tool_id_pk": {
+ "name": "agent_tool_link_agent_id_agent_tool_id_pk",
+ "columns": [
+ "agent_id",
+ "agent_tool_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ai_agent": {
+ "name": "ai_agent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model_credential_id": {
+ "name": "model_credential_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instructions": {
+ "name": "instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tools": {
+ "name": "tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "temperature": {
+ "name": "temperature",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reasoning_effort": {
+ "name": "reasoning_effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_steps": {
+ "name": "max_steps",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_on_mention": {
+ "name": "trigger_on_mention",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "trigger_on_assign": {
+ "name": "trigger_on_assign",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "delegation_delay_sec": {
+ "name": "delegation_delay_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 120
+ },
+ "api_key_ciphertext": {
+ "name": "api_key_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_key_iv": {
+ "name": "api_key_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_key_auth_tag": {
+ "name": "api_key_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_enabled": {
+ "name": "memory_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "memory_last_messages": {
+ "name": "memory_last_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runner_scope": {
+ "name": "runner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'team'"
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_url": {
+ "name": "invocation_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_secret_ciphertext": {
+ "name": "invocation_secret_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_secret_iv": {
+ "name": "invocation_secret_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_secret_auth_tag": {
+ "name": "invocation_secret_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "ai_agent_team_username_uq": {
+ "name": "ai_agent_team_username_uq",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"username\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ai_agent_team_idx": {
+ "name": "ai_agent_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "ai_agent_team_id_team_id_fk": {
+ "name": "ai_agent_team_id_team_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ai_agent_user_id_user_id_fk": {
+ "name": "ai_agent_user_id_user_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ai_agent_model_credential_id_integration_credential_id_fk": {
+ "name": "ai_agent_model_credential_id_integration_credential_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "integration_credential",
+ "columnsFrom": [
+ "model_credential_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "ai_agent_owner_user_id_user_id_fk": {
+ "name": "ai_agent_owner_user_id_user_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "ai_agent_user_id_unique": {
+ "name": "ai_agent_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "ai_agent_kind_check": {
+ "name": "ai_agent_kind_check",
+ "value": "\"ai_agent\".\"kind\" IN ('external', 'internal')"
+ },
+ "ai_agent_runner_scope_check": {
+ "name": "ai_agent_runner_scope_check",
+ "value": "\"ai_agent\".\"runner_scope\" IN ('owner', 'team')"
+ },
+ "ai_agent_reasoning_effort_check": {
+ "name": "ai_agent_reasoning_effort_check",
+ "value": "\"ai_agent\".\"reasoning_effort\" IN ('low', 'medium', 'high')"
+ },
+ "ai_agent_delegation_delay_check": {
+ "name": "ai_agent_delegation_delay_check",
+ "value": "\"ai_agent\".\"delegation_delay_sec\" >= 0 AND \"ai_agent\".\"delegation_delay_sec\" <= 86400"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 100
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "apikey_configId_idx": {
+ "name": "apikey_configId_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_referenceId_idx": {
+ "name": "apikey_referenceId_idx",
+ "columns": [
+ {
+ "expression": "reference_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_secret": {
+ "name": "app_secret",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_setting": {
+ "name": "app_setting",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat_attachment": {
+ "name": "chat_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploaded_by_user_id": {
+ "name": "uploaded_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "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": {
+ "chat_attachment_project_idx": {
+ "name": "chat_attachment_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "chat_attachment_project_id_project_id_fk": {
+ "name": "chat_attachment_project_id_project_id_fk",
+ "tableFrom": "chat_attachment",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "chat_attachment_uploaded_by_user_id_user_id_fk": {
+ "name": "chat_attachment_uploaded_by_user_id_user_id_fk",
+ "tableFrom": "chat_attachment",
+ "tableTo": "user",
+ "columnsFrom": [
+ "uploaded_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "chat_attachment_public_id_unique": {
+ "name": "chat_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_field": {
+ "name": "custom_field",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_type_id": {
+ "name": "issue_type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_type": {
+ "name": "field_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "member_scope": {
+ "name": "member_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "show_in_body": {
+ "name": "show_in_body",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "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": {},
+ "foreignKeys": {
+ "custom_field_project_id_project_id_fk": {
+ "name": "custom_field_project_id_project_id_fk",
+ "tableFrom": "custom_field",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "custom_field_issue_type_id_issue_type_id_fk": {
+ "name": "custom_field_issue_type_id_issue_type_id_fk",
+ "tableFrom": "custom_field",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "issue_type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "custom_field_field_type_check": {
+ "name": "custom_field_field_type_check",
+ "value": "\"custom_field\".\"field_type\" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select', 'member')"
+ },
+ "custom_field_member_scope_check": {
+ "name": "custom_field_member_scope_check",
+ "value": "(\"custom_field\".\"field_type\" = 'member') = (\"custom_field\".\"member_scope\" IS NOT NULL) AND (\"custom_field\".\"member_scope\" IS NULL OR \"custom_field\".\"member_scope\" IN ('all', 'humans', 'agents'))"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.custom_field_option": {
+ "name": "custom_field_option",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "custom_field_option_field_id_custom_field_id_fk": {
+ "name": "custom_field_option_field_id_custom_field_id_fk",
+ "tableFrom": "custom_field_option",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "custom_field_option_field_id_value_unique": {
+ "name": "custom_field_option_field_id_value_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "field_id",
+ "value"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cycle": {
+ "name": "cycle",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "goal": {
+ "name": "goal",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_date": {
+ "name": "end_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "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": {
+ "cycle_project_idx": {
+ "name": "cycle_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "start_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cycle_project_id_project_id_fk": {
+ "name": "cycle_project_id_project_id_fk",
+ "tableFrom": "cycle",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cycle_dates_check": {
+ "name": "cycle_dates_check",
+ "value": "\"cycle\".\"end_date\" >= \"cycle\".\"start_date\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.document_asset": {
+ "name": "document_asset",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploaded_by_user_id": {
+ "name": "uploaded_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "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": {
+ "document_asset_document_idx": {
+ "name": "document_asset_document_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "document_asset_document_id_project_document_id_fk": {
+ "name": "document_asset_document_id_project_document_id_fk",
+ "tableFrom": "document_asset",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_asset_uploaded_by_user_id_user_id_fk": {
+ "name": "document_asset_uploaded_by_user_id_user_id_fk",
+ "tableFrom": "document_asset",
+ "tableTo": "user",
+ "columnsFrom": [
+ "uploaded_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "document_asset_public_id_unique": {
+ "name": "document_asset_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_collaboration": {
+ "name": "document_collaboration",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "epoch": {
+ "name": "epoch",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "content_json": {
+ "name": "content_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "document_collaboration_document_id_project_document_id_fk": {
+ "name": "document_collaboration_document_id_project_document_id_fk",
+ "tableFrom": "document_collaboration",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_comment": {
+ "name": "document_comment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_id": {
+ "name": "author_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "quote": {
+ "name": "quote",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "selection_from": {
+ "name": "selection_from",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "selection_to": {
+ "name": "selection_to",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "orphaned": {
+ "name": "orphaned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "resolved_at": {
+ "name": "resolved_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": {
+ "document_comment_document_idx": {
+ "name": "document_comment_document_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "document_comment_document_id_project_document_id_fk": {
+ "name": "document_comment_document_id_project_document_id_fk",
+ "tableFrom": "document_comment",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_comment_parent_id_document_comment_id_fk": {
+ "name": "document_comment_parent_id_document_comment_id_fk",
+ "tableFrom": "document_comment",
+ "tableTo": "document_comment",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_comment_author_id_user_id_fk": {
+ "name": "document_comment_author_id_user_id_fk",
+ "tableFrom": "document_comment",
+ "tableTo": "user",
+ "columnsFrom": [
+ "author_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_step": {
+ "name": "document_step",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "step": {
+ "name": "step",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "document_step_document_id_project_document_id_fk": {
+ "name": "document_step_document_id_project_document_id_fk",
+ "tableFrom": "document_step",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "document_step_document_id_version_pk": {
+ "name": "document_step_document_id_version_pk",
+ "columns": [
+ "document_id",
+ "version"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.git_managed_repository": {
+ "name": "git_managed_repository",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "full_name": {
+ "name": "full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "web_url": {
+ "name": "web_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "webhook_external_id": {
+ "name": "webhook_external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'connected'"
+ },
+ "last_error": {
+ "name": "last_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": {
+ "git_managed_repository_project_connection_idx": {
+ "name": "git_managed_repository_project_connection_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "git_managed_repository_project_id_project_id_fk": {
+ "name": "git_managed_repository_project_id_project_id_fk",
+ "tableFrom": "git_managed_repository",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "git_managed_repository_connection_id_git_provider_connection_id_fk": {
+ "name": "git_managed_repository_connection_id_git_provider_connection_id_fk",
+ "tableFrom": "git_managed_repository",
+ "tableTo": "git_provider_connection",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "git_managed_repository_project_connection_external_unique": {
+ "name": "git_managed_repository_project_connection_external_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "connection_id",
+ "external_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.git_provider_connection": {
+ "name": "git_provider_connection",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "base_url": {
+ "name": "base_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_login": {
+ "name": "account_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "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": {
+ "git_provider_connection_team_idx": {
+ "name": "git_provider_connection_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "git_provider_connection_team_id_team_id_fk": {
+ "name": "git_provider_connection_team_id_team_id_fk",
+ "tableFrom": "git_provider_connection",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.import_job": {
+ "name": "import_job",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'discover'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "cursor": {
+ "name": "cursor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "credential_ciphertext": {
+ "name": "credential_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_iv": {
+ "name": "credential_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_auth_tag": {
+ "name": "credential_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_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": {
+ "import_job_project_idx": {
+ "name": "import_job_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "import_job_due_idx": {
+ "name": "import_job_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"import_job\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "import_job_project_id_project_id_fk": {
+ "name": "import_job_project_id_project_id_fk",
+ "tableFrom": "import_job",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "import_job_created_by_user_id_user_id_fk": {
+ "name": "import_job_created_by_user_id_user_id_fk",
+ "tableFrom": "import_job",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "import_job_source_check": {
+ "name": "import_job_source_check",
+ "value": "\"import_job\".\"source\" IN ('plane', 'linear')"
+ },
+ "import_job_phase_check": {
+ "name": "import_job_phase_check",
+ "value": "\"import_job\".\"phase\" IN ('discover', 'create', 'link', 'rewrite', 'attachments', 'done')"
+ },
+ "import_job_status_check": {
+ "name": "import_job_status_check",
+ "value": "\"import_job\".\"status\" IN ('pending', 'running', 'paused', 'completed', 'failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.import_record": {
+ "name": "import_record",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "import_job_id": {
+ "name": "import_job_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_entity_type": {
+ "name": "source_entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_display_id": {
+ "name": "source_display_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "local_entity_type": {
+ "name": "local_entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "local_id": {
+ "name": "local_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "import_record_job_source_uq": {
+ "name": "import_record_job_source_uq",
+ "columns": [
+ {
+ "expression": "import_job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "import_record_job_local_idx": {
+ "name": "import_record_job_local_idx",
+ "columns": [
+ {
+ "expression": "import_job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "local_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "local_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "import_record_job_display_idx": {
+ "name": "import_record_job_display_idx",
+ "columns": [
+ {
+ "expression": "import_job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_display_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "import_record_import_job_id_import_job_id_fk": {
+ "name": "import_record_import_job_id_import_job_id_fk",
+ "tableFrom": "import_record",
+ "tableTo": "import_job",
+ "columnsFrom": [
+ "import_job_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "import_record_source_entity_type_check": {
+ "name": "import_record_source_entity_type_check",
+ "value": "\"import_record\".\"source_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment')"
+ },
+ "import_record_local_entity_type_check": {
+ "name": "import_record_local_entity_type_check",
+ "value": "\"import_record\".\"local_entity_type\" IS NULL OR \"import_record\".\"local_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.initiative": {
+ "name": "initiative",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'planned'"
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_date": {
+ "name": "target_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "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": {
+ "initiative_project_idx": {
+ "name": "initiative_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "initiative_project_id_project_id_fk": {
+ "name": "initiative_project_id_project_id_fk",
+ "tableFrom": "initiative",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "initiative_owner_user_id_user_id_fk": {
+ "name": "initiative_owner_user_id_user_id_fk",
+ "tableFrom": "initiative",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "initiative_status_check": {
+ "name": "initiative_status_check",
+ "value": "\"initiative\".\"status\" IN ('proposed', 'planned', 'active', 'completed', 'canceled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.initiative_attachment": {
+ "name": "initiative_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "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": {
+ "initiative_attachment_initiative_idx": {
+ "name": "initiative_attachment_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "initiative_attachment_initiative_id_initiative_id_fk": {
+ "name": "initiative_attachment_initiative_id_initiative_id_fk",
+ "tableFrom": "initiative_attachment",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "initiative_attachment_public_id_unique": {
+ "name": "initiative_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.initiative_label": {
+ "name": "initiative_label",
+ "schema": "",
+ "columns": {
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "initiative_label_initiative_id_initiative_id_fk": {
+ "name": "initiative_label_initiative_id_initiative_id_fk",
+ "tableFrom": "initiative_label",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "initiative_label_label_id_label_id_fk": {
+ "name": "initiative_label_label_id_label_id_fk",
+ "tableFrom": "initiative_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "initiative_label_initiative_id_label_id_pk": {
+ "name": "initiative_label_initiative_id_label_id_pk",
+ "columns": [
+ "initiative_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.integration_credential": {
+ "name": "integration_credential",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_key": {
+ "name": "integration_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "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": {
+ "integration_credential_team_idx": {
+ "name": "integration_credential_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_credential_team_id_team_id_fk": {
+ "name": "integration_credential_team_id_team_id_fk",
+ "tableFrom": "integration_credential",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue": {
+ "name": "issue",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence_number": {
+ "name": "sequence_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type_id": {
+ "name": "type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cycle_id": {
+ "name": "cycle_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_user_id": {
+ "name": "assignee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delegate_user_id": {
+ "name": "delegate_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimate_points": {
+ "name": "estimate_points",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimate_minutes": {
+ "name": "estimate_minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_token": {
+ "name": "share_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_extended": {
+ "name": "share_extended",
+ "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": {
+ "issue_project_active_idx": {
+ "name": "issue_project_active_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_project_title_idx": {
+ "name": "issue_project_title_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(btrim(\"title\"))",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_parent_idx": {
+ "name": "issue_parent_idx",
+ "columns": [
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"parent_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_idx": {
+ "name": "issue_cycle_idx",
+ "columns": [
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"cycle_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_project_id_project_id_fk": {
+ "name": "issue_project_id_project_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_type_id_issue_type_id_fk": {
+ "name": "issue_type_id_issue_type_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_initiative_id_initiative_id_fk": {
+ "name": "issue_initiative_id_initiative_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_cycle_id_cycle_id_fk": {
+ "name": "issue_cycle_id_cycle_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "cycle",
+ "columnsFrom": [
+ "cycle_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_column_id_project_column_id_fk": {
+ "name": "issue_column_id_project_column_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "issue_parent_id_issue_id_fk": {
+ "name": "issue_parent_id_issue_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_assignee_user_id_user_id_fk": {
+ "name": "issue_assignee_user_id_user_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "assignee_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_delegate_user_id_user_id_fk": {
+ "name": "issue_delegate_user_id_user_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "delegate_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_share_token_unique": {
+ "name": "issue_share_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "share_token"
+ ]
+ },
+ "issue_project_id_sequence_number_unique": {
+ "name": "issue_project_id_sequence_number_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "sequence_number"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "issue_estimate_points_check": {
+ "name": "issue_estimate_points_check",
+ "value": "\"issue\".\"estimate_points\" >= 0"
+ },
+ "issue_estimate_minutes_check": {
+ "name": "issue_estimate_minutes_check",
+ "value": "\"issue\".\"estimate_minutes\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_activity": {
+ "name": "issue_activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reply_to_id": {
+ "name": "reply_to_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "edited_at": {
+ "name": "edited_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": {
+ "issue_activity_issue_idx": {
+ "name": "issue_activity_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_activity_reply_idx": {
+ "name": "issue_activity_reply_idx",
+ "columns": [
+ {
+ "expression": "reply_to_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_activity_initiative_idx": {
+ "name": "issue_activity_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_activity_issue_id_issue_id_fk": {
+ "name": "issue_activity_issue_id_issue_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_initiative_id_initiative_id_fk": {
+ "name": "issue_activity_initiative_id_initiative_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_reply_to_id_issue_activity_id_fk": {
+ "name": "issue_activity_reply_to_id_issue_activity_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "reply_to_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_actor_user_id_user_id_fk": {
+ "name": "issue_activity_actor_user_id_user_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "user",
+ "columnsFrom": [
+ "actor_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_activity_kind_check": {
+ "name": "issue_activity_kind_check",
+ "value": "\"issue_activity\".\"kind\" IN ('comment', 'activity')"
+ },
+ "issue_activity_owner_check": {
+ "name": "issue_activity_owner_check",
+ "value": "(\"issue_activity\".\"issue_id\" IS NOT NULL) <> (\"issue_activity\".\"initiative_id\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_attachment": {
+ "name": "issue_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "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": {
+ "issue_attachment_issue_idx": {
+ "name": "issue_attachment_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_attachment_issue_id_issue_id_fk": {
+ "name": "issue_attachment_issue_id_issue_id_fk",
+ "tableFrom": "issue_attachment",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_attachment_public_id_unique": {
+ "name": "issue_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_checklist": {
+ "name": "issue_checklist",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_checklist_issue_idx": {
+ "name": "issue_checklist_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_checklist_issue_id_issue_id_fk": {
+ "name": "issue_checklist_issue_id_issue_id_fk",
+ "tableFrom": "issue_checklist",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_checklist_item": {
+ "name": "issue_checklist_item",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "checklist_id": {
+ "name": "checklist_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "done": {
+ "name": "done",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_checklist_item_checklist_idx": {
+ "name": "issue_checklist_item_checklist_idx",
+ "columns": [
+ {
+ "expression": "checklist_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_checklist_item_checklist_id_issue_checklist_id_fk": {
+ "name": "issue_checklist_item_checklist_id_issue_checklist_id_fk",
+ "tableFrom": "issue_checklist_item",
+ "tableTo": "issue_checklist",
+ "columnsFrom": [
+ "checklist_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_cycle": {
+ "name": "issue_cycle",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cycle_id": {
+ "name": "cycle_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entered_at": {
+ "name": "entered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "left_at": {
+ "name": "left_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_cycle_issue_idx": {
+ "name": "issue_cycle_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entered_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_cycle_idx": {
+ "name": "issue_cycle_cycle_idx",
+ "columns": [
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_open_idx": {
+ "name": "issue_cycle_open_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"issue_cycle\".\"left_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_cycle_issue_id_issue_id_fk": {
+ "name": "issue_cycle_issue_id_issue_id_fk",
+ "tableFrom": "issue_cycle",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_cycle_cycle_id_cycle_id_fk": {
+ "name": "issue_cycle_cycle_id_cycle_id_fk",
+ "tableFrom": "issue_cycle",
+ "tableTo": "cycle",
+ "columnsFrom": [
+ "cycle_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_development_check": {
+ "name": "issue_development_check",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "development_link_id": {
+ "name": "development_link_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_id": {
+ "name": "app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_development_check_link_sha_idx": {
+ "name": "issue_development_check_link_sha_idx",
+ "columns": [
+ {
+ "expression": "development_link_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "head_sha",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_development_check_development_link_id_issue_development_link_id_fk": {
+ "name": "issue_development_check_development_link_id_issue_development_link_id_fk",
+ "tableFrom": "issue_development_check",
+ "tableTo": "issue_development_link",
+ "columnsFrom": [
+ "development_link_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_development_check_development_link_id_app_id_name_unique": {
+ "name": "issue_development_check_development_link_id_app_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "development_link_id",
+ "app_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_development_link": {
+ "name": "issue_development_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pull_request'"
+ },
+ "external_key": {
+ "name": "external_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "draft": {
+ "name": "draft",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "source_branch": {
+ "name": "source_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_branch": {
+ "name": "target_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pipeline_status": {
+ "name": "pipeline_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pipeline_url": {
+ "name": "pipeline_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_development_link_issue_idx": {
+ "name": "issue_development_link_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_development_link_pr_idx": {
+ "name": "issue_development_link_pr_idx",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_development_link_sha_idx": {
+ "name": "issue_development_link_sha_idx",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "head_sha",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_development_link_issue_id_issue_id_fk": {
+ "name": "issue_development_link_issue_id_issue_id_fk",
+ "tableFrom": "issue_development_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_development_link_issue_id_provider_repository_external_key_unique": {
+ "name": "issue_development_link_issue_id_provider_repository_external_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "issue_id",
+ "provider",
+ "repository",
+ "external_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_field_option": {
+ "name": "issue_field_option",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "option_id": {
+ "name": "option_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_field_option_issue_id_issue_id_fk": {
+ "name": "issue_field_option_issue_id_issue_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_option_field_id_custom_field_id_fk": {
+ "name": "issue_field_option_field_id_custom_field_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_option_option_id_custom_field_option_id_fk": {
+ "name": "issue_field_option_option_id_custom_field_option_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "custom_field_option",
+ "columnsFrom": [
+ "option_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_field_option_issue_id_field_id_option_id_pk": {
+ "name": "issue_field_option_issue_id_field_id_option_id_pk",
+ "columns": [
+ "issue_id",
+ "field_id",
+ "option_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_field_value": {
+ "name": "issue_field_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value_text": {
+ "name": "value_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_number": {
+ "name": "value_number",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_bool": {
+ "name": "value_bool",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_date": {
+ "name": "value_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_datetime": {
+ "name": "value_datetime",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_datetime_end": {
+ "name": "value_datetime_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_user_id": {
+ "name": "value_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_field_value_issue_id_issue_id_fk": {
+ "name": "issue_field_value_issue_id_issue_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_value_field_id_custom_field_id_fk": {
+ "name": "issue_field_value_field_id_custom_field_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_value_value_user_id_user_id_fk": {
+ "name": "issue_field_value_value_user_id_user_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "user",
+ "columnsFrom": [
+ "value_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_field_value_issue_id_field_id_unique": {
+ "name": "issue_field_value_issue_id_field_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "issue_id",
+ "field_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_import": {
+ "name": "issue_import",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_id": {
+ "name": "attachment_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'mapped'"
+ },
+ "mapping": {
+ "name": "mapping",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_text": {
+ "name": "error_text",
+ "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": {
+ "issue_import_project_idx": {
+ "name": "issue_import_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_import_project_id_project_id_fk": {
+ "name": "issue_import_project_id_project_id_fk",
+ "tableFrom": "issue_import",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_import_attachment_id_chat_attachment_id_fk": {
+ "name": "issue_import_attachment_id_chat_attachment_id_fk",
+ "tableFrom": "issue_import",
+ "tableTo": "chat_attachment",
+ "columnsFrom": [
+ "attachment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_import_public_id_unique": {
+ "name": "issue_import_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_key_alias": {
+ "name": "issue_key_alias",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence_number": {
+ "name": "sequence_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "issue_key_alias_issue_idx": {
+ "name": "issue_key_alias_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_key_alias_project_id_project_id_fk": {
+ "name": "issue_key_alias_project_id_project_id_fk",
+ "tableFrom": "issue_key_alias",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_key_alias_issue_id_issue_id_fk": {
+ "name": "issue_key_alias_issue_id_issue_id_fk",
+ "tableFrom": "issue_key_alias",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_key_alias_project_id_sequence_number_pk": {
+ "name": "issue_key_alias_project_id_sequence_number_pk",
+ "columns": [
+ "project_id",
+ "sequence_number"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_label": {
+ "name": "issue_label",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_label_issue_id_issue_id_fk": {
+ "name": "issue_label_issue_id_issue_id_fk",
+ "tableFrom": "issue_label",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_label_label_id_label_id_fk": {
+ "name": "issue_label_label_id_label_id_fk",
+ "tableFrom": "issue_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_label_issue_id_label_id_pk": {
+ "name": "issue_label_issue_id_label_id_pk",
+ "columns": [
+ "issue_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_link": {
+ "name": "issue_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "source_issue_id": {
+ "name": "source_issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_issue_id": {
+ "name": "target_issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_link_pair_kind_idx": {
+ "name": "issue_link_pair_kind_idx",
+ "columns": [
+ {
+ "expression": "least(\"source_issue_id\", \"target_issue_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "greatest(\"source_issue_id\", \"target_issue_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_link_source_idx": {
+ "name": "issue_link_source_idx",
+ "columns": [
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_link_target_idx": {
+ "name": "issue_link_target_idx",
+ "columns": [
+ {
+ "expression": "target_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_link_source_issue_id_issue_id_fk": {
+ "name": "issue_link_source_issue_id_issue_id_fk",
+ "tableFrom": "issue_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "source_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_link_target_issue_id_issue_id_fk": {
+ "name": "issue_link_target_issue_id_issue_id_fk",
+ "tableFrom": "issue_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "target_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_link_kind_check": {
+ "name": "issue_link_kind_check",
+ "value": "\"issue_link\".\"kind\" IN ('blocks', 'relates', 'duplicates')"
+ },
+ "issue_link_self_check": {
+ "name": "issue_link_self_check",
+ "value": "\"issue_link\".\"source_issue_id\" <> \"issue_link\".\"target_issue_id\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_status": {
+ "name": "issue_status",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_name": {
+ "name": "column_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state_type": {
+ "name": "state_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entered_at": {
+ "name": "entered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "left_at": {
+ "name": "left_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_status_issue_idx": {
+ "name": "issue_status_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entered_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_status_column_idx": {
+ "name": "issue_status_column_idx",
+ "columns": [
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue_status\".\"column_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_status_open_idx": {
+ "name": "issue_status_open_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"issue_status\".\"left_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_status_issue_id_issue_id_fk": {
+ "name": "issue_status_issue_id_issue_id_fk",
+ "tableFrom": "issue_status",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_status_column_id_project_column_id_fk": {
+ "name": "issue_status_column_id_project_column_id_fk",
+ "tableFrom": "issue_status",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_template": {
+ "name": "issue_template",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "title_template": {
+ "name": "title_template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "description_template": {
+ "name": "description_template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "type_id": {
+ "name": "type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_user_id": {
+ "name": "assignee_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": {
+ "issue_template_project_id_project_id_fk": {
+ "name": "issue_template_project_id_project_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_template_type_id_issue_type_id_fk": {
+ "name": "issue_template_type_id_issue_type_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_template_column_id_project_column_id_fk": {
+ "name": "issue_template_column_id_project_column_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_template_assignee_user_id_user_id_fk": {
+ "name": "issue_template_assignee_user_id_user_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "user",
+ "columnsFrom": [
+ "assignee_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_template_project_id_name_unique": {
+ "name": "issue_template_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_template_label": {
+ "name": "issue_template_label",
+ "schema": "",
+ "columns": {
+ "template_id": {
+ "name": "template_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_template_label_template_id_issue_template_id_fk": {
+ "name": "issue_template_label_template_id_issue_template_id_fk",
+ "tableFrom": "issue_template_label",
+ "tableTo": "issue_template",
+ "columnsFrom": [
+ "template_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_template_label_label_id_label_id_fk": {
+ "name": "issue_template_label_label_id_label_id_fk",
+ "tableFrom": "issue_template_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_template_label_template_id_label_id_pk": {
+ "name": "issue_template_label_template_id_label_id_pk",
+ "columns": [
+ "template_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_type": {
+ "name": "issue_type",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "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": {},
+ "foreignKeys": {
+ "issue_type_project_id_project_id_fk": {
+ "name": "issue_type_project_id_project_id_fk",
+ "tableFrom": "issue_type",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_type_project_id_name_unique": {
+ "name": "issue_type_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_watcher": {
+ "name": "issue_watcher",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subscribed": {
+ "name": "subscribed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_watcher_issue_id_issue_id_fk": {
+ "name": "issue_watcher_issue_id_issue_id_fk",
+ "tableFrom": "issue_watcher",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_watcher_user_id_user_id_fk": {
+ "name": "issue_watcher_user_id_user_id_fk",
+ "tableFrom": "issue_watcher",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_watcher_issue_id_user_id_pk": {
+ "name": "issue_watcher_issue_id_user_id_pk",
+ "columns": [
+ "issue_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_worklog": {
+ "name": "issue_worklog",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "minutes": {
+ "name": "minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "spent_on": {
+ "name": "spent_on",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_worklog_issue_idx": {
+ "name": "issue_worklog_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "spent_on",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_worklog_issue_id_issue_id_fk": {
+ "name": "issue_worklog_issue_id_issue_id_fk",
+ "tableFrom": "issue_worklog",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_worklog_user_id_user_id_fk": {
+ "name": "issue_worklog_user_id_user_id_fk",
+ "tableFrom": "issue_worklog",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_worklog_minutes_check": {
+ "name": "issue_worklog_minutes_check",
+ "value": "\"issue_worklog\".\"minutes\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.jwks": {
+ "name": "jwks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_key": {
+ "name": "public_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "private_key": {
+ "name": "private_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "alg": {
+ "name": "alg",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "crv": {
+ "name": "crv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_project_id_project_id_fk": {
+ "name": "label_project_id_project_id_fk",
+ "tableFrom": "label",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "label_group_id_label_group_id_fk": {
+ "name": "label_group_id_label_group_id_fk",
+ "tableFrom": "label",
+ "tableTo": "label_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_project_id_name_unique": {
+ "name": "label_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label_group": {
+ "name": "label_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_group_project_id_project_id_fk": {
+ "name": "label_group_project_id_project_id_fk",
+ "tableFrom": "label_group",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_group_project_id_name_unique": {
+ "name": "label_group_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.model_price": {
+ "name": "model_price",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input": {
+ "name": "input",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "output": {
+ "name": "output",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cache_read": {
+ "name": "cache_read",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cache_write": {
+ "name": "cache_write",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "model_price_workspace_id_workspace_id_fk": {
+ "name": "model_price_workspace_id_workspace_id_fk",
+ "tableFrom": "model_price",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "model_price_workspace_id_provider_model_unique": {
+ "name": "model_price_workspace_id_provider_model_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "provider",
+ "model"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "model_price_rates_check": {
+ "name": "model_price_rates_check",
+ "value": "\"model_price\".\"input\" >= 0 AND \"model_price\".\"output\" >= 0 AND coalesce(\"model_price\".\"cache_read\", 0) >= 0 AND coalesce(\"model_price\".\"cache_write\", 0) >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.note_board": {
+ "name": "note_board",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_user_id": {
+ "name": "owner_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
+ },
+ "canvas": {
+ "name": "canvas",
+ "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": {
+ "note_board_project_idx": {
+ "name": "note_board_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "note_board_project_id_project_id_fk": {
+ "name": "note_board_project_id_project_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_owner_user_id_user_id_fk": {
+ "name": "note_board_owner_user_id_user_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_created_by_user_id_user_id_fk": {
+ "name": "note_board_created_by_user_id_user_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.note_board_member": {
+ "name": "note_board_member",
+ "schema": "",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "note_board_member_user_idx": {
+ "name": "note_board_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "note_board_member_board_id_note_board_id_fk": {
+ "name": "note_board_member_board_id_note_board_id_fk",
+ "tableFrom": "note_board_member",
+ "tableTo": "note_board",
+ "columnsFrom": [
+ "board_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_member_user_id_user_id_fk": {
+ "name": "note_board_member_user_id_user_id_fk",
+ "tableFrom": "note_board_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "note_board_member_board_id_user_id_pk": {
+ "name": "note_board_member_board_id_user_id_pk",
+ "columns": [
+ "board_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_activity_id": {
+ "name": "source_activity_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "read_at": {
+ "name": "read_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snoozed_until": {
+ "name": "snoozed_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()"
+ }
+ },
+ "indexes": {
+ "notification_user_idx": {
+ "name": "notification_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_user_unread_idx": {
+ "name": "notification_user_unread_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification\".\"read_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_project_id_project_id_fk": {
+ "name": "notification_project_id_project_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_issue_id_issue_id_fk": {
+ "name": "notification_issue_id_issue_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_source_activity_id_issue_activity_id_fk": {
+ "name": "notification_source_activity_id_issue_activity_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "source_activity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "notification_actor_user_id_user_id_fk": {
+ "name": "notification_actor_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": [
+ "actor_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "notification_type_check": {
+ "name": "notification_type_check",
+ "value": "\"notification\".\"type\" IN ('assigned', 'mentioned', 'commented', 'state_changed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.notification_delivery": {
+ "name": "notification_delivery",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recipient": {
+ "name": "recipient",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "notification_delivery_due_idx": {
+ "name": "notification_delivery_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification_delivery\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_delivery_project_id_project_id_fk": {
+ "name": "notification_delivery_project_id_project_id_fk",
+ "tableFrom": "notification_delivery",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "notification_delivery_channel_check": {
+ "name": "notification_delivery_channel_check",
+ "value": "\"notification_delivery\".\"channel\" IN ('email', 'telegram')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.oauth_access_token": {
+ "name": "oauth_access_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorization_code_id": {
+ "name": "authorization_code_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_user_info_claims": {
+ "name": "requested_user_info_claims",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_id": {
+ "name": "refresh_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked": {
+ "name": "revoked",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmation": {
+ "name": "confirmation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthAccessToken_clientId_idx": {
+ "name": "oauthAccessToken_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_sessionId_idx": {
+ "name": "oauthAccessToken_sessionId_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_userId_idx": {
+ "name": "oauthAccessToken_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_authorizationCodeId_idx": {
+ "name": "oauthAccessToken_authorizationCodeId_idx",
+ "columns": [
+ {
+ "expression": "authorization_code_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_refreshId_idx": {
+ "name": "oauthAccessToken_refreshId_idx",
+ "columns": [
+ {
+ "expression": "refresh_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_access_token_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_access_token_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_session_id_session_id_fk": {
+ "name": "oauth_access_token_session_id_session_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "session",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_user_id_user_id_fk": {
+ "name": "oauth_access_token_user_id_user_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_refresh_id_oauth_refresh_token_id_fk": {
+ "name": "oauth_access_token_refresh_id_oauth_refresh_token_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "oauth_refresh_token",
+ "columnsFrom": [
+ "refresh_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_access_token_token_unique": {
+ "name": "oauth_access_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_client": {
+ "name": "oauth_client",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_secret": {
+ "name": "client_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_discovery_id": {
+ "name": "client_discovery_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "skip_consent": {
+ "name": "skip_consent",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enable_end_session": {
+ "name": "enable_end_session",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_credentials_scopes": {
+ "name": "client_credentials_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uri": {
+ "name": "uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contacts": {
+ "name": "contacts",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tos": {
+ "name": "tos",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy": {
+ "name": "policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_id": {
+ "name": "software_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_version": {
+ "name": "software_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_statement": {
+ "name": "software_statement",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redirect_uris": {
+ "name": "redirect_uris",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "post_logout_redirect_uris": {
+ "name": "post_logout_redirect_uris",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backchannel_logout_uri": {
+ "name": "backchannel_logout_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backchannel_logout_session_required": {
+ "name": "backchannel_logout_session_required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_endpoint_auth_method": {
+ "name": "token_endpoint_auth_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "application_type": {
+ "name": "application_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "jwks": {
+ "name": "jwks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "jwks_uri": {
+ "name": "jwks_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_types": {
+ "name": "grant_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_types": {
+ "name": "response_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "require_pkce": {
+ "name": "require_pkce",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dpop_bound_access_tokens": {
+ "name": "dpop_bound_access_tokens",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauthClient_userId_idx": {
+ "name": "oauthClient_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_client_user_id_user_id_fk": {
+ "name": "oauth_client_user_id_user_id_fk",
+ "tableFrom": "oauth_client",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_client_client_id_unique": {
+ "name": "oauth_client_client_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "client_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_client_assertion": {
+ "name": "oauth_client_assertion",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_client_resource": {
+ "name": "oauth_client_resource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauthClientResource_clientId_resourceId_uidx": {
+ "name": "oauthClientResource_clientId_resourceId_uidx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthClientResource_clientId_idx": {
+ "name": "oauthClientResource_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthClientResource_resourceId_idx": {
+ "name": "oauthClientResource_resourceId_idx",
+ "columns": [
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_client_resource_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_client_resource_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_client_resource",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_client_resource_resource_id_oauth_resource_identifier_fk": {
+ "name": "oauth_client_resource_resource_id_oauth_resource_identifier_fk",
+ "tableFrom": "oauth_client_resource",
+ "tableTo": "oauth_resource",
+ "columnsFrom": [
+ "resource_id"
+ ],
+ "columnsTo": [
+ "identifier"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_consent": {
+ "name": "oauth_consent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_user_info_claims": {
+ "name": "requested_user_info_claims",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthConsent_clientId_idx": {
+ "name": "oauthConsent_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthConsent_userId_idx": {
+ "name": "oauthConsent_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_consent_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_consent_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_consent",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_consent_user_id_user_id_fk": {
+ "name": "oauth_consent_user_id_user_id_fk",
+ "tableFrom": "oauth_consent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_refresh_token": {
+ "name": "oauth_refresh_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorization_code_id": {
+ "name": "authorization_code_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_user_info_claims": {
+ "name": "requested_user_info_claims",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked": {
+ "name": "revoked",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotated_at": {
+ "name": "rotated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotation_replay_response": {
+ "name": "rotation_replay_response",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotation_replay_expires_at": {
+ "name": "rotation_replay_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_time": {
+ "name": "auth_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmation": {
+ "name": "confirmation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthRefreshToken_clientId_idx": {
+ "name": "oauthRefreshToken_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_sessionId_idx": {
+ "name": "oauthRefreshToken_sessionId_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_userId_idx": {
+ "name": "oauthRefreshToken_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_authorizationCodeId_idx": {
+ "name": "oauthRefreshToken_authorizationCodeId_idx",
+ "columns": [
+ {
+ "expression": "authorization_code_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_refresh_token_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_refresh_token_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_refresh_token_session_id_session_id_fk": {
+ "name": "oauth_refresh_token_session_id_session_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "session",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauth_refresh_token_user_id_user_id_fk": {
+ "name": "oauth_refresh_token_user_id_user_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_refresh_token_token_unique": {
+ "name": "oauth_refresh_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_resource": {
+ "name": "oauth_resource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_ttl": {
+ "name": "access_token_ttl",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_ttl": {
+ "name": "refresh_token_ttl",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signing_algorithm": {
+ "name": "signing_algorithm",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signing_key_id": {
+ "name": "signing_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "allowed_scopes": {
+ "name": "allowed_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "custom_claims": {
+ "name": "custom_claims",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dpop_bound_access_tokens_required": {
+ "name": "dpop_bound_access_tokens_required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy_version": {
+ "name": "policy_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_resource_identifier_unique": {
+ "name": "oauth_resource_identifier_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "identifier"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.passkey": {
+ "name": "passkey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public_key": {
+ "name": "public_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counter": {
+ "name": "counter",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "device_type": {
+ "name": "device_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "backed_up": {
+ "name": "backed_up",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "transports": {
+ "name": "transports",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aaguid": {
+ "name": "aaguid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "passkey_userId_idx": {
+ "name": "passkey_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "passkey_credentialID_idx": {
+ "name": "passkey_credentialID_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "passkey_user_id_user_id_fk": {
+ "name": "passkey_user_id_user_id_fk",
+ "tableFrom": "passkey",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "next_sequence": {
+ "name": "next_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "mcp_enabled": {
+ "name": "mcp_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "initiatives_enabled": {
+ "name": "initiatives_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "dashboards_enabled": {
+ "name": "dashboards_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "documents_enabled": {
+ "name": "documents_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "notes_enabled": {
+ "name": "notes_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "cycles_enabled": {
+ "name": "cycles_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "subtasks_enabled": {
+ "name": "subtasks_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "checklists_enabled": {
+ "name": "checklists_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "issue_stats_enabled": {
+ "name": "issue_stats_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "points_estimate_enabled": {
+ "name": "points_estimate_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "time_estimate_enabled": {
+ "name": "time_estimate_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "time_logging_enabled": {
+ "name": "time_logging_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_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": {
+ "project_team_id_team_id_fk": {
+ "name": "project_team_id_team_id_fk",
+ "tableFrom": "project",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_team_key_uq": {
+ "name": "project_team_key_uq",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_action": {
+ "name": "project_action",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "condition": {
+ "name": "condition",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "effect": {
+ "name": "effect",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_action_project_idx": {
+ "name": "project_action_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_action_project_id_project_id_fk": {
+ "name": "project_action_project_id_project_id_fk",
+ "tableFrom": "project_action",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_column": {
+ "name": "project_column",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state_type": {
+ "name": "state_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unstarted'"
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "wip_limit": {
+ "name": "wip_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "wip_mode": {
+ "name": "wip_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'soft'"
+ },
+ "auto_assign_user_id": {
+ "name": "auto_assign_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": {
+ "project_column_project_id_project_id_fk": {
+ "name": "project_column_project_id_project_id_fk",
+ "tableFrom": "project_column",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_column_auto_assign_user_id_user_id_fk": {
+ "name": "project_column_auto_assign_user_id_user_id_fk",
+ "tableFrom": "project_column",
+ "tableTo": "user",
+ "columnsFrom": [
+ "auto_assign_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_column_project_id_position_unique": {
+ "name": "project_column_project_id_position_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "position"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "project_column_state_type_check": {
+ "name": "project_column_state_type_check",
+ "value": "\"project_column\".\"state_type\" IN ('backlog', 'unstarted', 'started', 'completed', 'canceled')"
+ },
+ "project_column_wip_mode_check": {
+ "name": "project_column_wip_mode_check",
+ "value": "\"project_column\".\"wip_mode\" IN ('soft', 'hard')"
+ },
+ "project_column_wip_limit_check": {
+ "name": "project_column_wip_limit_check",
+ "value": "\"project_column\".\"wip_limit\" IS NULL OR \"project_column\".\"wip_limit\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_dashboard": {
+ "name": "project_dashboard",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "layout": {
+ "name": "layout",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_dashboard_project_idx": {
+ "name": "project_dashboard_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_dashboard_project_id_project_id_fk": {
+ "name": "project_dashboard_project_id_project_id_fk",
+ "tableFrom": "project_dashboard",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document": {
+ "name": "project_document",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "content_json": {
+ "name": "content_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "full_width": {
+ "name": "full_width",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_private": {
+ "name": "is_private",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_locked": {
+ "name": "is_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_ancestor_id": {
+ "name": "archived_by_ancestor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_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()"
+ }
+ },
+ "indexes": {
+ "project_document_project_tree_idx": {
+ "name": "project_document_project_tree_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_document_owner_idx": {
+ "name": "project_document_owner_idx",
+ "columns": [
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_document_project_archive_idx": {
+ "name": "project_document_project_archive_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_project_id_project_id_fk": {
+ "name": "project_document_project_id_project_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_parent_id_project_document_id_fk": {
+ "name": "project_document_parent_id_project_document_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_archived_by_ancestor_id_project_document_id_fk": {
+ "name": "project_document_archived_by_ancestor_id_project_document_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "archived_by_ancestor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_owner_user_id_user_id_fk": {
+ "name": "project_document_owner_user_id_user_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_created_by_user_id_user_id_fk": {
+ "name": "project_document_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_updated_by_user_id_user_id_fk": {
+ "name": "project_document_updated_by_user_id_user_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "user",
+ "columnsFrom": [
+ "updated_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_document_version_check": {
+ "name": "project_document_version_check",
+ "value": "\"project_document\".\"version\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_document_initiative": {
+ "name": "project_document_initiative",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_initiative_initiative_idx": {
+ "name": "project_document_initiative_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_initiative_document_id_project_document_id_fk": {
+ "name": "project_document_initiative_document_id_project_document_id_fk",
+ "tableFrom": "project_document_initiative",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_initiative_initiative_id_initiative_id_fk": {
+ "name": "project_document_initiative_initiative_id_initiative_id_fk",
+ "tableFrom": "project_document_initiative",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_initiative_created_by_user_id_user_id_fk": {
+ "name": "project_document_initiative_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document_initiative",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_document_initiative_document_id_initiative_id_pk": {
+ "name": "project_document_initiative_document_id_initiative_id_pk",
+ "columns": [
+ "document_id",
+ "initiative_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document_issue": {
+ "name": "project_document_issue",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_issue_issue_idx": {
+ "name": "project_document_issue_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_issue_document_id_project_document_id_fk": {
+ "name": "project_document_issue_document_id_project_document_id_fk",
+ "tableFrom": "project_document_issue",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_issue_issue_id_issue_id_fk": {
+ "name": "project_document_issue_issue_id_issue_id_fk",
+ "tableFrom": "project_document_issue",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_issue_created_by_user_id_user_id_fk": {
+ "name": "project_document_issue_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document_issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_document_issue_document_id_issue_id_pk": {
+ "name": "project_document_issue_document_id_issue_id_pk",
+ "columns": [
+ "document_id",
+ "issue_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document_preference": {
+ "name": "project_document_preference",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_favorite": {
+ "name": "is_favorite",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_preference_user_idx": {
+ "name": "project_document_preference_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_preference_document_id_project_document_id_fk": {
+ "name": "project_document_preference_document_id_project_document_id_fk",
+ "tableFrom": "project_document_preference",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_preference_user_id_user_id_fk": {
+ "name": "project_document_preference_user_id_user_id_fk",
+ "tableFrom": "project_document_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_document_preference_document_id_user_id_pk": {
+ "name": "project_document_preference_document_id_user_id_pk",
+ "columns": [
+ "document_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document_revision": {
+ "name": "project_document_revision",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_json": {
+ "name": "content_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "full_width": {
+ "name": "full_width",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_private": {
+ "name": "is_private",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_locked": {
+ "name": "is_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": 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()"
+ }
+ },
+ "indexes": {
+ "project_document_revision_document_idx": {
+ "name": "project_document_revision_document_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_revision_document_id_project_document_id_fk": {
+ "name": "project_document_revision_document_id_project_document_id_fk",
+ "tableFrom": "project_document_revision",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_revision_owner_user_id_user_id_fk": {
+ "name": "project_document_revision_owner_user_id_user_id_fk",
+ "tableFrom": "project_document_revision",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_revision_created_by_user_id_user_id_fk": {
+ "name": "project_document_revision_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document_revision",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_document_revision_document_version_unique": {
+ "name": "project_document_revision_document_version_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "document_id",
+ "version"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_member": {
+ "name": "project_member",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'invite'"
+ },
+ "is_favorite": {
+ "name": "is_favorite",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_hidden": {
+ "name": "is_hidden",
+ "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": {
+ "project_member_user_idx": {
+ "name": "project_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_member_project_id_project_id_fk": {
+ "name": "project_member_project_id_project_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_member_user_id_user_id_fk": {
+ "name": "project_member_user_id_user_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_member_role_id_team_role_id_fk": {
+ "name": "project_member_role_id_team_role_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "team_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_member_project_id_user_id_pk": {
+ "name": "project_member_project_id_user_id_pk",
+ "columns": [
+ "project_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_member_role_check": {
+ "name": "project_member_role_check",
+ "value": "\"project_member\".\"role\" IN ('owner', 'member')"
+ },
+ "project_member_source_check": {
+ "name": "project_member_source_check",
+ "value": "\"project_member\".\"source\" IN ('invite', 'scim')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_setting": {
+ "name": "project_setting",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_setting_project_id_project_id_fk": {
+ "name": "project_setting_project_id_project_id_fk",
+ "tableFrom": "project_setting",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_setting_project_id_key_pk": {
+ "name": "project_setting_project_id_key_pk",
+ "columns": [
+ "project_id",
+ "key"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_view": {
+ "name": "project_view",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "filters": {
+ "name": "filters",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "display": {
+ "name": "display",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "share_token": {
+ "name": "share_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_extended": {
+ "name": "share_extended",
+ "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": {
+ "project_view_project_idx": {
+ "name": "project_view_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_view_project_id_project_id_fk": {
+ "name": "project_view_project_id_project_id_fk",
+ "tableFrom": "project_view",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_view_share_token_unique": {
+ "name": "project_view_share_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "share_token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_view_favorite": {
+ "name": "project_view_favorite",
+ "schema": "",
+ "columns": {
+ "view_id": {
+ "name": "view_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_view_favorite_view_id_project_view_id_fk": {
+ "name": "project_view_favorite_view_id_project_view_id_fk",
+ "tableFrom": "project_view_favorite",
+ "tableTo": "project_view",
+ "columnsFrom": [
+ "view_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_view_favorite_user_id_user_id_fk": {
+ "name": "project_view_favorite_user_id_user_id_fk",
+ "tableFrom": "project_view_favorite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_view_favorite_view_id_user_id_pk": {
+ "name": "project_view_favorite_view_id_user_id_pk",
+ "columns": [
+ "view_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.revision": {
+ "name": "revision",
+ "schema": "",
+ "columns": {
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rev": {
+ "name": "rev",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "revision_project_idx": {
+ "name": "revision_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_group": {
+ "name": "scim_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_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": {
+ "scim_group_instance_display_name_uq": {
+ "name": "scim_group_instance_display_name_uq",
+ "columns": [
+ {
+ "expression": "display_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"scim_group\".\"workspace_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_workspace_id_workspace_id_fk": {
+ "name": "scim_group_workspace_id_workspace_id_fk",
+ "tableFrom": "scim_group",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "scim_group_workspace_id_display_name_unique": {
+ "name": "scim_group_workspace_id_display_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "display_name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_group_mapping": {
+ "name": "scim_group_mapping",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_group_mapping_project_idx": {
+ "name": "scim_group_mapping_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_mapping_group_id_scim_group_id_fk": {
+ "name": "scim_group_mapping_group_id_scim_group_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "scim_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_mapping_project_id_project_id_fk": {
+ "name": "scim_group_mapping_project_id_project_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_mapping_role_id_team_role_id_fk": {
+ "name": "scim_group_mapping_role_id_team_role_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "team_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "scim_group_mapping_group_id_project_id_unique": {
+ "name": "scim_group_mapping_group_id_project_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "group_id",
+ "project_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "scim_group_mapping_role_check": {
+ "name": "scim_group_mapping_role_check",
+ "value": "\"scim_group_mapping\".\"role\" IN ('owner', 'member')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.scim_group_member": {
+ "name": "scim_group_member",
+ "schema": "",
+ "columns": {
+ "group_id": {
+ "name": "group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "scim_group_member_user_idx": {
+ "name": "scim_group_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_member_group_id_scim_group_id_fk": {
+ "name": "scim_group_member_group_id_scim_group_id_fk",
+ "tableFrom": "scim_group_member",
+ "tableTo": "scim_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_member_user_id_user_id_fk": {
+ "name": "scim_group_member_user_id_user_id_fk",
+ "tableFrom": "scim_group_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "scim_group_member_group_id_user_id_pk": {
+ "name": "scim_group_member_group_id_user_id_pk",
+ "columns": [
+ "group_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_user": {
+ "name": "scim_user",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active": {
+ "name": "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()"
+ }
+ },
+ "indexes": {
+ "scim_user_instance_user_uq": {
+ "name": "scim_user_instance_user_uq",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"scim_user\".\"workspace_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_user_user_idx": {
+ "name": "scim_user_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_user_workspace_id_workspace_id_fk": {
+ "name": "scim_user_workspace_id_workspace_id_fk",
+ "tableFrom": "scim_user",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_user_user_id_user_id_fk": {
+ "name": "scim_user_user_id_user_id_fk",
+ "tableFrom": "scim_user",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "scim_user_workspace_id_user_id_unique": {
+ "name": "scim_user_workspace_id_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_enabled": {
+ "name": "mcp_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "default_agent_ids": {
+ "name": "default_agent_ids",
+ "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": {
+ "team_workspace_idx": {
+ "name": "team_workspace_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_slug_unique": {
+ "name": "team_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_invite": {
+ "name": "team_invite",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_role": {
+ "name": "team_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "project_role": {
+ "name": "project_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "invited_by_user_id": {
+ "name": "invited_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_by_user_id": {
+ "name": "accepted_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()"
+ },
+ "responded_at": {
+ "name": "responded_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "team_invite_team_pending_uq": {
+ "name": "team_invite_team_pending_uq",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_invite_project_pending_uq": {
+ "name": "team_invite_project_pending_uq",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_invite_team_idx": {
+ "name": "team_invite_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_invite_project_idx": {
+ "name": "team_invite_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_invite_team_id_team_id_fk": {
+ "name": "team_invite_team_id_team_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_invite_project_id_project_id_fk": {
+ "name": "team_invite_project_id_project_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_invite_role_id_team_role_id_fk": {
+ "name": "team_invite_role_id_team_role_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "team_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "team_invite_invited_by_user_id_user_id_fk": {
+ "name": "team_invite_invited_by_user_id_user_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "invited_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "team_invite_accepted_by_user_id_user_id_fk": {
+ "name": "team_invite_accepted_by_user_id_user_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "accepted_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_invite_token_unique": {
+ "name": "team_invite_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "team_invite_team_role_check": {
+ "name": "team_invite_team_role_check",
+ "value": "\"team_invite\".\"team_role\" IN ('owner', 'manager', 'member')"
+ },
+ "team_invite_project_role_check": {
+ "name": "team_invite_project_role_check",
+ "value": "(\"team_invite\".\"project_id\" IS NULL AND \"team_invite\".\"project_role\" IS NULL)\n OR (\"team_invite\".\"project_id\" IS NOT NULL AND \"team_invite\".\"project_role\" IN ('owner', 'member'))"
+ },
+ "team_invite_status_check": {
+ "name": "team_invite_status_check",
+ "value": "\"team_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'invite'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "team_member_user_idx": {
+ "name": "team_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "team_member_team_id_user_id_pk": {
+ "name": "team_member_team_id_user_id_pk",
+ "columns": [
+ "team_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "team_member_role_check": {
+ "name": "team_member_role_check",
+ "value": "\"team_member\".\"role\" IN ('owner', 'manager', 'member', 'agent')"
+ },
+ "team_member_source_check": {
+ "name": "team_member_source_check",
+ "value": "\"team_member\".\"source\" IN ('invite', 'scim')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.team_notification_setting": {
+ "name": "team_notification_setting",
+ "schema": "",
+ "columns": {
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "team_notification_setting_team_id_team_id_fk": {
+ "name": "team_notification_setting_team_id_team_id_fk",
+ "tableFrom": "team_notification_setting",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_role": {
+ "name": "team_role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "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": {
+ "team_role_default_uq": {
+ "name": "team_role_default_uq",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_role\".\"is_default\"",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_role_team_idx": {
+ "name": "team_role_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_role_team_id_team_id_fk": {
+ "name": "team_role_team_id_team_id_fk",
+ "tableFrom": "team_role",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_role_team_id_name_unique": {
+ "name": "team_role_team_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_username": {
+ "name": "display_username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'user'"
+ },
+ "active": {
+ "name": "active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ },
+ "user_username_unique": {
+ "name": "user_username_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "username"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_preference": {
+ "name": "user_notification_preference",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_events": {
+ "name": "email_events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "telegram_events": {
+ "name": "telegram_events",
+ "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": {},
+ "foreignKeys": {
+ "user_notification_preference_user_id_user_id_fk": {
+ "name": "user_notification_preference_user_id_user_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_notification_preference_project_id_project_id_fk": {
+ "name": "user_notification_preference_project_id_project_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_pref_user_project_unique": {
+ "name": "user_notification_pref_user_project_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id",
+ "project_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_preference": {
+ "name": "user_preference",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'UTC'"
+ },
+ "locale": {
+ "name": "locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'en'"
+ },
+ "theme": {
+ "name": "theme",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "issue_open_mode": {
+ "name": "issue_open_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'panel'"
+ },
+ "start_page": {
+ "name": "start_page",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'work-items'"
+ },
+ "show_chat_by_default": {
+ "name": "show_chat_by_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "issue_stats_open": {
+ "name": "issue_stats_open",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "issue_stats_view": {
+ "name": "issue_stats_view",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'compact'"
+ },
+ "issue_activity_view": {
+ "name": "issue_activity_view",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'flat'"
+ },
+ "auto_watch": {
+ "name": "auto_watch",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "hotkeys": {
+ "name": "hotkeys",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_project_id": {
+ "name": "last_project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "seen_version": {
+ "name": "seen_version",
+ "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": {
+ "user_preference_user_id_user_id_fk": {
+ "name": "user_preference_user_id_user_id_fk",
+ "tableFrom": "user_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_preference_last_project_id_project_id_fk": {
+ "name": "user_preference_last_project_id_project_id_fk",
+ "tableFrom": "user_preference",
+ "tableTo": "project",
+ "columnsFrom": [
+ "last_project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_preference_theme_check": {
+ "name": "user_preference_theme_check",
+ "value": "\"user_preference\".\"theme\" IN ('light', 'dark', 'system')"
+ },
+ "user_preference_issue_open_mode_check": {
+ "name": "user_preference_issue_open_mode_check",
+ "value": "\"user_preference\".\"issue_open_mode\" IN ('panel', 'page')"
+ },
+ "user_preference_start_page_check": {
+ "name": "user_preference_start_page_check",
+ "value": "\"user_preference\".\"start_page\" IN ('inbox', 'dashboard', 'work-items', 'initiatives')"
+ },
+ "user_preference_issue_stats_view_check": {
+ "name": "user_preference_issue_stats_view_check",
+ "value": "\"user_preference\".\"issue_stats_view\" IN ('compact', 'timeline')"
+ },
+ "user_preference_issue_activity_view_check": {
+ "name": "user_preference_issue_activity_view_check",
+ "value": "\"user_preference\".\"issue_activity_view\" IN ('flat', 'grouped')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_telegram_account": {
+ "name": "user_telegram_account",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_name": {
+ "name": "first_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "link_code": {
+ "name": "link_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "link_code_expires_at": {
+ "name": "link_code_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linked_at": {
+ "name": "linked_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": {
+ "user_telegram_account_chat_id_unique": {
+ "name": "user_telegram_account_chat_id_unique",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_telegram_account\".\"chat_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_telegram_account_link_code_unique": {
+ "name": "user_telegram_account_link_code_unique",
+ "columns": [
+ {
+ "expression": "link_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_telegram_account\".\"link_code\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_telegram_account_user_id_user_id_fk": {
+ "name": "user_telegram_account_user_id_user_id_fk",
+ "tableFrom": "user_telegram_account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook": {
+ "name": "webhook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "events": {
+ "name": "events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "consecutive_failures": {
+ "name": "consecutive_failures",
+ "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": {
+ "webhook_project_idx": {
+ "name": "webhook_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_project_id_project_id_fk": {
+ "name": "webhook_project_id_project_id_fk",
+ "tableFrom": "webhook",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook_delivery": {
+ "name": "webhook_delivery",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "webhook_id": {
+ "name": "webhook_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "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": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_body": {
+ "name": "response_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "webhook_delivery_due_idx": {
+ "name": "webhook_delivery_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"webhook_delivery\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_delivery_webhook_idx": {
+ "name": "webhook_delivery_webhook_idx",
+ "columns": [
+ {
+ "expression": "webhook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_delivery_webhook_id_webhook_id_fk": {
+ "name": "webhook_delivery_webhook_id_webhook_id_fk",
+ "tableFrom": "webhook_delivery",
+ "tableTo": "webhook",
+ "columnsFrom": [
+ "webhook_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_creation": {
+ "name": "team_creation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'owner'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_team_creation_check": {
+ "name": "workspace_team_creation_check",
+ "value": "\"workspace\".\"team_creation\" IN ('owner', 'managers', 'members')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_manager": {
+ "name": "workspace_manager",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'admin'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_manager_owner_uq": {
+ "name": "workspace_manager_owner_uq",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workspace_manager\".\"role\" = 'owner'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_manager_user_idx": {
+ "name": "workspace_manager_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_manager_workspace_id_workspace_id_fk": {
+ "name": "workspace_manager_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_manager",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_manager_user_id_user_id_fk": {
+ "name": "workspace_manager_user_id_user_id_fk",
+ "tableFrom": "workspace_manager",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "workspace_manager_workspace_id_user_id_pk": {
+ "name": "workspace_manager_workspace_id_user_id_pk",
+ "columns": [
+ "workspace_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_manager_role_check": {
+ "name": "workspace_manager_role_check",
+ "value": "\"workspace_manager\".\"role\" IN ('owner', 'admin')"
+ }
+ },
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index 113f0c40..e4652eaf 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -1065,6 +1065,20 @@
"when": 1792447270678,
"tag": "0151_agent_invocation_url",
"breakpoints": true
+ },
+ {
+ "idx": 152,
+ "version": "7",
+ "when": 1792496405688,
+ "tag": "0152_agent_execution_state",
+ "breakpoints": true
+ },
+ {
+ "idx": 153,
+ "version": "7",
+ "when": 1792496411346,
+ "tag": "0153_external_run_traces",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema/app.ts b/packages/db/src/schema/app.ts
index 6b537eb2..3fbd80e0 100644
--- a/packages/db/src/schema/app.ts
+++ b/packages/db/src/schema/app.ts
@@ -719,6 +719,7 @@ export const agentRun = pgTable(
inputTokens: integer('input_tokens'),
outputTokens: integer('output_tokens'),
startedAt: timestamp('started_at', { withTimezone: true }),
+ executionStartedAt: timestamp('execution_started_at', { withTimezone: true }),
finishedAt: timestamp('finished_at', { withTimezone: true }),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
},
@@ -738,6 +739,23 @@ export const agentRun = pgTable(
],
);
+// A bounded execution transcript for one external runner attempt.
+export const agentRunTrace = pgTable(
+ 'agent_run_trace',
+ {
+ runId: integer('run_id')
+ .notNull()
+ .references(() => agentRun.id, { onDelete: 'cascade' }),
+ attempt: integer('attempt').notNull(),
+ sessionId: text('session_id'),
+ events: jsonb('events').notNull().default([]),
+ nextOffset: integer('next_offset').notNull().default(0),
+ truncated: boolean('truncated').notNull().default(false),
+ createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
+ },
+ (t) => [primaryKey({ columns: [t.runId, t.attempt] })],
+);
+
// A conversation between one member and one external agent. The internal agents'
// threads are held by Mastra's own store; an external agent is driven by a runner on
// its operator's machine, which has no memory of its own, so the conversation lives
diff --git a/packages/runner/README.md b/packages/runner/README.md
index 5e621ddc..51c3016d 100644
--- a/packages/runner/README.md
+++ b/packages/runner/README.md
@@ -257,7 +257,7 @@ priority over both. An `agents` entry has priority over all three, for the field
| `concurrency` | `ITSAPLAN_CONCURRENCY` | `1` | Tasks at once, per agent. Queued runs and chat answers count apart |
| `pollIntervalMs` | `ITSAPLAN_POLL_INTERVAL_MS` | `3000` | Wait after an empty queue. Minimum 1000 |
| `timeoutMs` | `ITSAPLAN_TIMEOUT_MS` | `1800000` | Time before the runner stops a task |
-| `outputFormat` | `ITSAPLAN_OUTPUT_FORMAT` | the preset's | How the runner reads a chat answer |
+| `outputFormat` | `ITSAPLAN_OUTPUT_FORMAT` | the preset's | How the runner reads run and chat output |
| `listen` | `ITSAPLAN_LISTEN` | — | Port that receives the tasks. The runner does not poll for the agent |
| `signingSecret` | `ITSAPLAN_SIGNING_SECRET` | — | The agent's signing secret. Required with `listen` |
@@ -319,7 +319,9 @@ Sessions below.
### The result
Exit code `0` is a success. Any other code is a failure. The end of stderr then becomes
-the error. Stdout becomes the run's output in both cases.
+the error. In both cases the run's output is the answer: all of stdout with `outputFormat`
+`text`, and with an event stream format the text the agent wrote after its last tool call
+(see Chat below for the formats).
## Chat
@@ -374,3 +376,20 @@ Do everything else in WSL: Node, the coding agent, the config file, and the runn
Copyright © 2026 Andrii Poluosmak.
[Apache-2.0](LICENSE).
+
+### Issue run transcripts
+
+A server that advertises `traceEvents` on a run claim accepts its streamed messages
+and tool calls at `/agent-runs/:runId/events`. The runner reports numbered batches
+for the claimed attempt before reporting its result. Retries of a batch use the
+same offsets. A server without this capability still receives the final result.
+
+The `codex-jsonl` format records the session UUID from `thread.started`, shell
+commands, MCP calls and file changes. Plan shows an **Open in Codex** link for that
+attempt. The session must be available in the viewer's local Codex app or a
+connected host; the link does not publish or copy the Codex session. The events
+recorded in Plan are readable there independently of the local session.
+
+Each attempt records up to 2,000 events or 1 MB. Plan marks a truncated transcript;
+the final run result is reported separately. Plain-text commands provide messages
+and output, while tool details require a supported structured output format.
diff --git a/packages/runner/src/__tests__/agui.test.ts b/packages/runner/src/__tests__/agui.test.ts
index e487688a..b16fd0ad 100644
--- a/packages/runner/src/__tests__/agui.test.ts
+++ b/packages/runner/src/__tests__/agui.test.ts
@@ -99,6 +99,34 @@ describe('answer stream', () => {
expect(text(sink.events)).toBe('Checking done.');
});
+ it('answers with the text the agent ended on, after its last tool call', async () => {
+ const stream = new AnswerStream('claude-stream-json', 'run-1', '1', collect().send);
+ const delta = (text: string) =>
+ JSON.stringify({
+ type: 'stream_event',
+ event: { type: 'content_block_delta', delta: { type: 'text_delta', text } },
+ });
+ stream.write(
+ [
+ delta('Reading the issue.'),
+ JSON.stringify({
+ type: 'assistant',
+ message: { content: [{ type: 'tool_use', id: 't1', name: 'get_issue', input: {} }] },
+ }),
+ JSON.stringify({
+ type: 'user',
+ message: { content: [{ type: 'tool_result', tool_use_id: 't1', content: '{}' }] },
+ }),
+ delta('Replied in the '),
+ delta('thread.'),
+ JSON.stringify({ type: 'result', result: 'Replied in the thread.' }),
+ '',
+ ].join('\n'),
+ );
+ await stream.finish('raw stdout');
+ expect(stream.answer()).toBe('Replied in the thread.');
+ });
+
it('takes the final message when the command reported no partials', async () => {
const sink = collect();
const stream = new AnswerStream('claude-stream-json', 'chat:1:u:x', '7', sink.send);
diff --git a/packages/runner/src/__tests__/listen.test.ts b/packages/runner/src/__tests__/listen.test.ts
index ce27aa28..0d603805 100644
--- a/packages/runner/src/__tests__/listen.test.ts
+++ b/packages/runner/src/__tests__/listen.test.ts
@@ -12,6 +12,8 @@ function sign(secret: string, body: string, t = Math.floor(Date.now() / 1000)):
const run = (id: number): Run => ({
id,
+ attempts: 1,
+ traceEvents: true,
trigger: 'mention',
prompt: 'p',
systemPrompt: 's',
diff --git a/packages/runner/src/__tests__/run.test.ts b/packages/runner/src/__tests__/run.test.ts
new file mode 100644
index 00000000..cb02d774
--- /dev/null
+++ b/packages/runner/src/__tests__/run.test.ts
@@ -0,0 +1,173 @@
+import { expect, it } from 'bun:test';
+import { AnswerStream, type AgUiEvent } from '../agui';
+import { Client, type Run } from '../client';
+import type { RunnerConfig } from '../config';
+import { runTask } from '../run';
+import { handleRun } from '../tasks';
+
+const sessionId = '0199a213-81c0-7800-8aa1-bbab2a035a53';
+
+it('captures Codex command starts, MCP calls and file changes without duplicate tool calls', async () => {
+ const events: AgUiEvent[] = [];
+ const stream = new AnswerStream('codex-jsonl', 'thread', '1', async (batch) => {
+ events.push(...batch);
+ });
+ const command = {
+ id: 'cmd',
+ type: 'command_execution',
+ command: 'ls',
+ aggregated_output: 'README.md',
+ };
+ for (const event of [
+ { type: 'thread.started', thread_id: sessionId },
+ { type: 'item.started', item: command },
+ { type: 'item.completed', item: command },
+ {
+ type: 'item.completed',
+ item: {
+ id: 'mcp',
+ type: 'mcp_tool_call',
+ tool: 'get_issue',
+ arguments: { id: 1 },
+ result: { title: 'Task' },
+ },
+ },
+ {
+ type: 'item.completed',
+ item: {
+ id: 'file',
+ type: 'file_change',
+ status: 'completed',
+ changes: [{ path: 'README.md', kind: 'update' }],
+ },
+ },
+ ])
+ stream.write(JSON.stringify(event) + '\n');
+ await stream.finish('');
+ expect(stream.startedSession()).toBe(sessionId);
+ expect(events.filter((e) => e.type === 'TOOL_CALL_START')).toHaveLength(3);
+ expect(events).toContainEqual(
+ expect.objectContaining({ type: 'TOOL_CALL_RESULT', toolCallId: 'cmd', content: 'README.md' }),
+ );
+ expect(events).toContainEqual(
+ expect.objectContaining({ type: 'TOOL_CALL_START', toolCallName: 'get_issue' }),
+ );
+ expect(events).toContainEqual(
+ expect.objectContaining({ type: 'TOOL_CALL_START', toolCallName: 'file_change' }),
+ );
+});
+
+it('executes a queued task and reports its session and tool events before the final result', async () => {
+ const original = globalThis.fetch;
+ const posts: { path: string; body: Record<string, unknown> }[] = [];
+ globalThis.fetch = (async (input, init) => {
+ posts.push({ path: new URL(String(input)).pathname, body: JSON.parse(String(init?.body)) });
+ return Response.json({ nextOffset: 100, truncated: false });
+ }) as typeof fetch;
+ const output = [
+ { type: 'thread.started', thread_id: sessionId },
+ {
+ type: 'item.completed',
+ item: {
+ id: 'tool',
+ type: 'command_execution',
+ command: 'ls',
+ aggregated_output: 'README.md',
+ },
+ },
+ { type: 'item.completed', item: { id: 'msg', type: 'agent_message', text: 'Done' } },
+ ]
+ .map((event) => JSON.stringify(event))
+ .join('\n');
+ const config: RunnerConfig = {
+ name: '',
+ url: 'http://plan.test',
+ apiKey: 'test',
+ command: `printf '%s' '${output}'`,
+ args: [],
+ env: {},
+ concurrency: 1,
+ pollIntervalMs: 1000,
+ timeoutMs: 5000,
+ outputFormat: 'codex-jsonl',
+ };
+ const run: Run = {
+ id: 1,
+ attempts: 2,
+ traceEvents: true,
+ trigger: 'manual',
+ prompt: 'Task',
+ systemPrompt: '',
+ issueId: null,
+ issueIdentifier: null,
+ };
+ try {
+ await handleRun(config, new Client(config), () => {}, run);
+ expect(posts[0].path).toBe('/agent-runs/1/events');
+ expect(posts[0].body).toMatchObject({ attempt: 2, offset: 0, sessionId });
+ expect(posts[0].body.events).toContainEqual(
+ expect.objectContaining({ type: 'TOOL_CALL_RESULT', content: 'README.md' }),
+ );
+ expect(posts[posts.length - 1].path).toBe('/agent-runs/1/result');
+ expect(posts[posts.length - 1].body).toMatchObject({
+ status: 'success',
+ attempt: 2,
+ output: 'Done',
+ });
+ } finally {
+ globalThis.fetch = original;
+ }
+});
+
+it('retries a partially accepted stream batch with its original offsets', async () => {
+ const original = globalThis.fetch;
+ const offsets: number[] = [];
+ let failed = false;
+ globalThis.fetch = (async (input, init) => {
+ if (String(input).endsWith('/events')) {
+ const body = JSON.parse(String(init?.body));
+ offsets.push(body.offset);
+ if (body.offset === 200 && !failed) {
+ failed = true;
+ throw new Error('Lost response');
+ }
+ }
+ return Response.json({ nextOffset: 0, truncated: false });
+ }) as typeof fetch;
+ const lines = Array.from({ length: 60 }, (_, id) =>
+ JSON.stringify({
+ type: 'item.completed',
+ item: { id: String(id), type: 'command_execution', command: 'ls', aggregated_output: 'ok' },
+ }),
+ );
+ lines.push(
+ JSON.stringify({ type: 'item.completed', item: { type: 'agent_message', text: 'Done' } }),
+ );
+ const config: RunnerConfig = {
+ name: '',
+ url: 'http://plan.test',
+ apiKey: 'test',
+ command: `printf '%s\\n' '${lines.join('\n')}'; sleep 2`,
+ args: [],
+ env: {},
+ concurrency: 1,
+ pollIntervalMs: 1000,
+ timeoutMs: 5000,
+ outputFormat: 'codex-jsonl',
+ };
+ try {
+ await runTask(config, new Client(config), {
+ id: 1,
+ attempts: 1,
+ traceEvents: true,
+ trigger: 'manual',
+ prompt: '',
+ systemPrompt: '',
+ issueId: null,
+ issueIdentifier: null,
+ });
+ expect(offsets.slice(0, 4)).toEqual([0, 200, 0, 200]);
+ } finally {
+ globalThis.fetch = original;
+ }
+}, 15_000);
diff --git a/packages/runner/src/agui.ts b/packages/runner/src/agui.ts
index 2f98b7be..af11e8e1 100644
--- a/packages/runner/src/agui.ts
+++ b/packages/runner/src/agui.ts
@@ -58,6 +58,11 @@ export class AnswerStream {
// that text, and emitting both would say everything twice.
private sawPartialText = false;
private sawAnyText = false;
+ // The text since the last tool call, and the last such stretch that held any. A run
+ // reports the stretch the agent ended on as its output: what it wrote before a tool
+ // call is narration on the way to it.
+ private segment = '';
+ private lastSegment = '';
// The flush in flight, so the next one waits for it instead of racing it.
private sending: Promise<void> = Promise.resolve();
private readonly usage: UsageReader;
@@ -89,6 +94,10 @@ export class AnswerStream {
return this.sessionId;
}
+ answer(): string {
+ return (this.segment.trim() ? this.segment : this.lastSegment).trim();
+ }
+
// The size of the conversation's context after this answer, as the reader saw it.
contextUsage(): ContextUsage | null | undefined {
return this.usage.value();
@@ -146,6 +155,7 @@ export class AnswerStream {
if (!text) return;
this.sawAnyText = true;
this.text += text;
+ this.segment += text;
if (this.text.length >= FLUSH_CHARS) this.drainText();
}
@@ -329,14 +339,42 @@ export class AnswerStream {
return;
}
const item = message.item;
- if (message.type !== 'item.completed' || !item) return;
- if (item.type === 'agent_message' && item.text) {
+ if (!item) return;
+ if (message.type === 'item.completed' && item.type === 'agent_message' && item.text) {
this.appendText(item.text);
return;
}
- if (item.type === 'command_execution' && item.id) {
- this.pushToolCall(item.id, 'shell', item.command ?? '');
- this.pushToolResult(item.id, item.aggregated_output ?? '');
+ if (
+ !item.id ||
+ !['command_execution', 'mcp_tool_call', 'file_change', 'web_search'].includes(item.type ?? '')
+ )
+ return;
+ if (!['item.started', 'item.completed'].includes(message.type ?? '')) return;
+ if (!this.openToolCalls.has(item.id)) {
+ this.openToolCalls.add(item.id);
+ const name = item.type === 'command_execution' ? 'shell' : (item.tool ?? item.type ?? 'tool');
+ const args =
+ item.command ?? JSON.stringify(item.arguments ?? item.changes ?? { query: item.query });
+ this.pushToolCall(item.id, name, args);
+ }
+ if (message.type === 'item.completed' && !this.closedToolCalls.has(item.id)) {
+ this.closedToolCalls.add(item.id);
+ let result = item.aggregated_output;
+ if (
+ result == null ||
+ item.status === 'failed' ||
+ (item.exit_code != null && item.exit_code !== 0)
+ ) {
+ result = JSON.stringify({
+ status: item.status,
+ exitCode: item.exit_code,
+ output: item.aggregated_output,
+ result: item.result,
+ error: item.error,
+ changes: item.changes,
+ });
+ }
+ this.pushToolResult(item.id, result);
}
}
@@ -419,6 +457,7 @@ export class AnswerStream {
// it and the words said after it.
private pushToolCall(toolCallId: string, toolCallName: string, args: string): void {
this.drainText();
+ this.closeSegment();
this.queued.push(
{ type: 'TOOL_CALL_START', toolCallId, toolCallName, parentMessageId: this.messageId },
{ type: 'TOOL_CALL_ARGS', toolCallId, delta: tail(args, TOOL_TEXT_LIMIT) },
@@ -426,8 +465,14 @@ export class AnswerStream {
);
}
+ private closeSegment(): void {
+ if (this.segment.trim()) this.lastSegment = this.segment;
+ this.segment = '';
+ }
+
private pushToolResult(toolCallId: string, content: string): void {
this.drainText();
+ this.closeSegment();
this.queued.push({
type: 'TOOL_CALL_RESULT',
messageId: this.messageId,
@@ -630,6 +675,14 @@ interface CodexLine {
text?: string;
command?: string;
aggregated_output?: string;
+ exit_code?: number;
+ status?: string;
+ tool?: string;
+ arguments?: unknown;
+ result?: unknown;
+ error?: unknown;
+ changes?: unknown;
+ query?: string;
};
}
diff --git a/packages/runner/src/client.ts b/packages/runner/src/client.ts
index 4618b10a..95f6873b 100644
--- a/packages/runner/src/client.ts
+++ b/packages/runner/src/client.ts
@@ -5,6 +5,8 @@ import type { RunnerConfig } from './config';
// only ever hands back that agent's work.
export interface Run {
+ attempts: number;
+ traceEvents?: boolean;
id: number;
trigger: 'mention' | 'delegation' | 'field' | 'schedule' | 'manual' | 'status' | 'event';
prompt: string;
@@ -75,8 +77,8 @@ export class Client {
return body.run;
}
- async heartbeat(runId: number): Promise<void> {
- await this.post(`/agent-runs/${runId}/heartbeat`);
+ async heartbeat(runId: number, attempt?: number): Promise<void> {
+ await this.post(`/agent-runs/${runId}/heartbeat`, attempt == null ? undefined : { attempt });
}
// `usage` is what the last model call of the run read and wrote. Left out where the
@@ -85,6 +87,7 @@ export class Client {
runId: number,
result: {
status: 'success' | 'failed';
+ attempt?: number;
output?: string;
error?: string;
usage?: ContextUsage | null;
@@ -93,6 +96,20 @@ export class Client {
await this.post(`/agent-runs/${runId}/result`, result);
}
+ async runEvents(
+ run: Run,
+ offset: number,
+ events: AgUiEvent[],
+ sessionId?: string,
+ ): Promise<void> {
+ await this.post(`/agent-runs/${run.id}/events`, {
+ attempt: run.attempts,
+ offset,
+ events,
+ ...(sessionId && { sessionId }),
+ });
+ }
+
async claimChat(): Promise<ChatMessage | null> {
const res = await this.post('/agent-chats/claim', undefined, CHAT_CLAIM_TIMEOUT_MS);
const body = (await res.json()) as { message: ChatMessage | null };
diff --git a/packages/runner/src/config.ts b/packages/runner/src/config.ts
index 39a5f186..2e516493 100644
--- a/packages/runner/src/config.ts
+++ b/packages/runner/src/config.ts
@@ -36,7 +36,7 @@ export interface RunnerConfig {
signingSecret?: string;
// How long one task may take before it is killed and reported as failed.
timeoutMs: number;
- // How the output is read when the command answers a chat message. 'text' takes whatever
+ // How the output of a queued run or chat answer is read. 'text' takes whatever
// it prints; the others read one CLI's own event stream, which also carries the tool
// calls it makes and the session it started.
outputFormat: OutputFormat;
diff --git a/packages/runner/src/run.ts b/packages/runner/src/run.ts
new file mode 100644
index 00000000..74093568
--- /dev/null
+++ b/packages/runner/src/run.ts
@@ -0,0 +1,68 @@
+import { AnswerStream, UsageReader } from './agui';
+import type { Client, Run } from './client';
+import type { RunnerConfig } from './config';
+import { execute } from './execute';
+
+export async function runTask(config: RunnerConfig, client: Client, run: Run) {
+ let offset = 0;
+ const stream = new AnswerStream(
+ config.outputFormat,
+ `run-${run.id}`,
+ String(run.id),
+ async (events) => {
+ if (!run.traceEvents) return;
+ const session = config.outputFormat === 'codex-jsonl' ? stream.startedSession() : null;
+ const sessionId =
+ session && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(session)
+ ? session
+ : undefined;
+ for (let start = 0; start < events.length; start += 200) {
+ const batch = events.slice(start, start + 200);
+ await client.runEvents(run, offset + start, batch, sessionId);
+ }
+ offset += events.length;
+ },
+ );
+ const usage = new UsageReader(config.outputFormat);
+ const timer = setInterval(() => {
+ void stream.flush().catch(() => {});
+ }, 500);
+ try {
+ const outcome = await execute(
+ config,
+ {
+ prompt: run.prompt,
+ systemPrompt: run.systemPrompt,
+ env: {
+ ITSAPLAN_RUN_ID: String(run.id),
+ ITSAPLAN_TRIGGER: run.trigger,
+ ITSAPLAN_SYSTEM_PROMPT: run.systemPrompt,
+ ITSAPLAN_ISSUE: run.issueIdentifier ?? '',
+ ITSAPLAN_ISSUE_ID: run.issueId == null ? '' : String(run.issueId),
+ },
+ },
+ {
+ onData: (chunk) => {
+ usage.write(chunk);
+ stream.write(chunk);
+ },
+ },
+ );
+ clearInterval(timer);
+ usage.end();
+ if (outcome.status === 'success') await stream.finish(outcome.output);
+ else await stream.fail(outcome.error ?? 'The command failed', outcome.output);
+ // A stream format's stdout is its raw event lines; the run reports the answer read out
+ // of them. Plain text is the answer as printed.
+ const output = config.outputFormat === 'text' ? outcome.output : stream.answer();
+ await client.report(run.id, {
+ ...outcome,
+ output,
+ ...(run.traceEvents && { attempt: run.attempts }),
+ usage: usage.value(),
+ });
+ return outcome;
+ } finally {
+ clearInterval(timer);
+ }
+}
diff --git a/packages/runner/src/tasks.ts b/packages/runner/src/tasks.ts
index 03e607ff..61f5b031 100644
--- a/packages/runner/src/tasks.ts
+++ b/packages/runner/src/tasks.ts
@@ -1,8 +1,7 @@
-import { UsageReader } from './agui';
import { answer } from './chat';
import type { ChatMessage, Client, Run } from './client';
import type { RunnerConfig } from './config';
-import { execute } from './execute';
+import { runTask } from './run';
// One task of either feed, from the moment the runner holds it to its reported result. A
// task is the same whether the runner claimed it or the instance sent it.
@@ -24,20 +23,6 @@ async function withHeartbeat<T>(log: Log, beat: () => Promise<void>, work: Promi
}
}
-function taskOf(run: Run) {
- return {
- prompt: run.prompt,
- systemPrompt: run.systemPrompt,
- env: {
- ITSAPLAN_RUN_ID: String(run.id),
- ITSAPLAN_TRIGGER: run.trigger,
- ITSAPLAN_SYSTEM_PROMPT: run.systemPrompt,
- ITSAPLAN_ISSUE: run.issueIdentifier ?? '',
- ITSAPLAN_ISSUE_ID: run.issueId == null ? '' : String(run.issueId),
- },
- };
-}
-
export async function handleRun(
config: RunnerConfig,
client: Client,
@@ -47,23 +32,24 @@ export async function handleRun(
const label = run.issueIdentifier ?? `run ${run.id}`;
log(`${label}: started (${run.trigger})`);
try {
- // Read as the command writes, not off the outcome: only the tail of the output is
- // kept, and the line carrying the counts can fall outside it.
- const usage = new UsageReader(config.outputFormat);
const outcome = await withHeartbeat(
log,
- () => client.heartbeat(run.id),
- execute(config, taskOf(run), { onData: (chunk) => usage.write(chunk) }),
+ () => client.heartbeat(run.id, run.traceEvents ? run.attempts : undefined),
+ runTask(config, client, run),
);
- usage.end();
- await client.report(run.id, { ...outcome, usage: usage.value() });
log(`${label}: ${outcome.status}${outcome.error ? ` — ${outcome.error}` : ''}`);
} catch (err) {
// The command itself never throws here; this is the runner failing to run or
// report it. Reporting the failure keeps the run from being retried blindly.
const message = err instanceof Error ? err.message : String(err);
log(`${label}: runner error — ${message}`);
- await client.report(run.id, { status: 'failed', error: message }).catch(() => {});
+ await client
+ .report(run.id, {
+ status: 'failed',
+ error: message,
+ ...(run.traceEvents && { attempt: run.attempts }),
+ })
+ .catch(() => {});
}
}