⭐️⭐️⭐️ 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.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
feat: add a member custom field that can trigger an agent (#191)
Croffef788e63458e
diff --git a/AGENTS.md b/AGENTS.mdindex 602306bf..33b94bb2 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -22,8 +22,9 @@ solutions.Write a minimum of comments. A comment explains why, the code explains what — cover a commentwith your hand and read the code under it: if the fact is recoverable from the code alone, thecomment does not belong there. A wrong comment is worse than no comment, so change a comment in-the same edit as the code it describes, or delete it. The full rules, and the pass that removes-comments that no longer hold, are in the `tidy` skill.+the same edit as the code it describes, or delete it. Layout and styling are never commented:+no notes on positioning, sticky or overflow behaviour, spacing, or why a class is set. The full+rules, and the pass that removes comments that no longer hold, are in the `tidy` skill.## Writing style (docs, comments, chat)diff --git a/apps/api/src/issues/__tests__/integration/issues.test.ts b/apps/api/src/issues/__tests__/integration/issues.test.tsindex 2ef5e568..9eca4d26 100644--- a/apps/api/src/issues/__tests__/integration/issues.test.ts+++ b/apps/api/src/issues/__tests__/integration/issues.test.ts@@ -12,6 +12,7 @@ import { resetDb } from '../../../__tests__/helpers/db';interface Setup {asOwner: Api;+ ownerUserId: string;columnId: number;columnIds: number[];}@@ -24,7 +25,7 @@ async function setupProject(): Promise<Setup> {await asOwner.projects.post({ key: 'MKT', name: 'Marketing' });const view = await asOwner.projects({ projectKey: 'MKT' }).get();const columnIds = view.data!.columns.map((c) => c.id);- return { asOwner, columnId: columnIds[0], columnIds };+ return { asOwner, ownerUserId: owner.userId, columnId: columnIds[0], columnIds };}function createIssue(client: Api, columnId: number, patch: Record<string, unknown> = {}) {@@ -503,6 +504,103 @@ describe('issues', () => {expect((await fieldValue(asOwner, issue.id, field.id))?.value).toBe('hello');});+ // A member field holds a user id. Which users it offers is its scope: everyone+ // the project has, the people only, or the agents only.+ async function memberField(+ client: Api,+ name: string,+ memberScope: 'all' | 'humans' | 'agents',+ ) {+ const res = await client+ .projects({ projectKey: 'MKT' })+ ['custom-fields'].post({ name, fieldType: 'member', memberScope });+ return res.data!;+ }++ async function createAgentUserId(client: Api) {+ const res = await client+ .projects({ projectKey: 'MKT' })+ ['ai-agents'].post({ name: 'Bot', username: 'bot', kind: 'external' });+ return res.data!.agent.userId;+ }++ it('sets a member field to a project member', async () => {+ const { asOwner, ownerUserId, columnId } = await setupProject();+ const field = await memberField(asOwner, 'Reviewer', 'all');+ const issue = (await createIssue(asOwner, columnId)).data!;++ const put = await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: field.id })+ .put({ value: ownerUserId });+ expect(put.status).toBe(200);++ expect((await fieldValue(asOwner, issue.id, field.id))?.value).toBe(ownerUserId);+ });++ it('clears a member field with a null value', async () => {+ const { asOwner, ownerUserId, columnId } = await setupProject();+ const field = await memberField(asOwner, 'Reviewer', 'all');+ const issue = (await createIssue(asOwner, columnId)).data!;+ const fields = asOwner.issues({ issueId: issue.id }).fields({ fieldId: field.id });++ await fields.put({ value: ownerUserId });+ expect((await fields.put({ value: null })).status).toBe(200);+ expect((await fieldValue(asOwner, issue.id, field.id))?.value).toBeNull();+ });++ it('rejects a member field value that is not a member of the project', async () => {+ const { asOwner, columnId } = await setupProject();+ const outsider = await signUpTestUser();+ const field = await memberField(asOwner, 'Reviewer', 'all');+ const issue = (await createIssue(asOwner, columnId)).data!;++ const put = await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: field.id })+ .put({ value: outsider.userId });+ expect(put.status).toBe(400);+ });++ it('rejects an agent in a field scoped to the people', async () => {+ const { asOwner, columnId } = await setupProject();+ const agentUserId = await createAgentUserId(asOwner);+ const field = await memberField(asOwner, 'Reviewer', 'humans');+ const issue = (await createIssue(asOwner, columnId)).data!;++ const put = await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: field.id })+ .put({ value: agentUserId });+ expect(put.status).toBe(400);+ });++ it('rejects a member in a field scoped to the agents', async () => {+ const { asOwner, ownerUserId, columnId } = await setupProject();+ const field = await memberField(asOwner, 'Runner', 'agents');+ const issue = (await createIssue(asOwner, columnId)).data!;++ const put = await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: field.id })+ .put({ value: ownerUserId });+ expect(put.status).toBe(400);+ });++ it('accepts an agent in a field scoped to the agents', async () => {+ const { asOwner, columnId } = await setupProject();+ const agentUserId = await createAgentUserId(asOwner);+ const field = await memberField(asOwner, 'Runner', 'agents');+ const issue = (await createIssue(asOwner, columnId)).data!;++ const put = await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: field.id })+ .put({ value: agentUserId });+ expect(put.status).toBe(200);+ expect((await fieldValue(asOwner, issue.id, field.id))?.value).toBe(agentUserId);+ });+it("sets a select field's option ids", async () => {const { asOwner, columnId } = await setupProject();const field = (diff --git a/apps/api/src/issues/activity.ts b/apps/api/src/issues/activity.tsindex c462d71e..e0838c0c 100644--- a/apps/api/src/issues/activity.ts+++ b/apps/api/src/issues/activity.ts@@ -524,7 +524,7 @@ async function cycleName(id: number | null): Promise<string | null> {const rows = await db.select({ name: cycle.name }).from(cycle).where(eq(cycle.id, id));return rows[0]?.name ?? null;}-async function userName(id: string | null): Promise<string | null> {+export async function userName(id: string | null): Promise<string | null> {if (id == null) return null;const rows = await db.select({ name: user.name }).from(user).where(eq(user.id, id));return rows[0]?.name ?? null;diff --git a/apps/api/src/issues/routes.ts b/apps/api/src/issues/routes.tsindex 76e80b62..b72a57bf 100644--- a/apps/api/src/issues/routes.ts+++ b/apps/api/src/issues/routes.ts@@ -955,8 +955,9 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues// Sets one custom field's value on one issue. For select/multi_select fields,// body.optionIds replaces the full selection; for every other field type,- // body.value must match the field's type (text/number/boolean/date/datetime).- // A datetime_range takes its end in body.valueEnd.+ // body.value must match the field's type (text/number/boolean/date/datetime,+ // and the user id of a project member for a member field). A datetime_range takes+ // its end in body.valueEnd..put('/issues/:issueId/fields/:fieldId',async ({ params, body, user, projectId }) => {@@ -980,7 +981,9 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issuesresponse: { 200: t.Object({ ok: t.Boolean() }), ...commonErrors },detail: {summary: 'Set a custom field value',- description: 'Set a custom field value on an issue by its numeric id.',+ description:+ 'Set a custom field value on an issue by its numeric id. A member field takes the ' ++ "user id of a project member the field's scope allows.",...mcpTool('set_issue_field_value'),},},diff --git a/apps/api/src/issues/store.ts b/apps/api/src/issues/store.tsindex 29fc3152..038acc2c 100644--- a/apps/api/src/issues/store.ts+++ b/apps/api/src/issues/store.ts@@ -34,7 +34,12 @@ import {import type { IssueQuery } from '#modules/agents/core/issue-query';import { iso, num, HttpError } from '../shared/lib';import type { ProjectRow } from '#modules/projects/service';-import { getCustomFieldById, type CustomFieldType } from '#modules/custom-fields/service';+import {+ getCustomFieldById,+ type CustomFieldRow,+ type CustomFieldType,+ type MemberScope,+} from '#modules/custom-fields/service';import {recordActivity,recordActivityEntries,@@ -42,6 +47,7 @@ import {labelNames,actorId,type ActivityActor,+ userName,type ActivityInput,type IssueSnapshot,} from './activity';@@ -49,7 +55,11 @@ import { autoWatchIssue } from './watchers';import { mapAttachment, type AttachmentRow } from '#modules/attachments/service';import { notifyIssueChange, notifyTextMentions } from '#modules/notifications/service';import { emitWebhookEvent } from '../webhooks/emit';-import { getAssignTriggerAgent, isProjectAgent } from '#modules/agents/core/service';+import {+ getAssignTriggerAgent,+ getFieldTriggerAgent,+ isProjectAgent,+} from '#modules/agents/core/service';import { deleteThreadsWhere } from '#modules/agents/core/runtime/memory';import { getInitiativeProjectId } from '#modules/initiatives/service';import { cycleStatus, getCycleRef, type CycleStatus } from '#modules/cycles/service';@@ -545,6 +555,7 @@ async function attachFieldValues(issues: IssueRow[]): Promise<void> {valueDate: issueFieldValue.valueDate,valueDatetime: issueFieldValue.valueDatetime,valueDatetimeEnd: issueFieldValue.valueDatetimeEnd,+ valueUserId: issueFieldValue.valueUserId,}).from(issueFieldValue).where(inArray(issueFieldValue.issueId, issueIds)),@@ -1290,7 +1301,9 @@ function pickScalarValue(row: {valueBool: boolean | null;valueDate: string | null;valueDatetime: Date | null;+ valueUserId: string | null;}): string | number | boolean | null {+ if (row.valueUserId != null) return row.valueUserId;if (row.valueText != null) return row.valueText;if (row.valueNumber != null) return Number(row.valueNumber);if (row.valueBool != null) return row.valueBool;@@ -1314,6 +1327,7 @@ export async function getIssueFieldValues(issueId: number): Promise<IssueFieldVavalueDate: issueFieldValue.valueDate,valueDatetime: issueFieldValue.valueDatetime,valueDatetimeEnd: issueFieldValue.valueDatetimeEnd,+ valueUserId: issueFieldValue.valueUserId,}).from(issue).innerJoin(@@ -1376,6 +1390,77 @@ function parseDatetime(value: unknown): Date | null {return date;}+// Enforces that a member field holds someone the project offers for it: a member of+// the project, and within the field's scope — the people only, the agents only, or+// both. An agent's bot user also holds a project_member row, so the scope decides.+async function assertFieldMember(+ projectId: number,+ scope: MemberScope | null,+ userId: string,+): Promise<void> {+ const isAgent = await isProjectAgent(projectId, userId);+ if (scope === 'agents') {+ if (!isAgent) throw new HttpError(400, 'This field takes an agent of this project');+ return;+ }+ if (!(await getMembership(projectId, userId)) || (scope === 'humans' && isAgent)) {+ throw new HttpError(400, 'This field takes a member of this project');+ }+}++// If the issue's new value for a member field is an agent that reacts to that field,+// queue a run so it can act on the issue. Skipped when the agent set itself. The run+// is executed later, so the write is never blocked on it.+async function enqueueFieldRun(+ issueId: number,+ field: CustomFieldRow,+ userId: string,+ actorUserId: string | null | undefined,+): Promise<void> {+ if (userId === actorUserId) return;+ const agent = await getFieldTriggerAgent(userId, field.id, actorUserId ?? null);+ if (!agent) return;+ const row = await getIssue(issueId);+ if (!row) return;+ await enqueueAgentRun({+ agentId: agent.id,+ issueId,+ sourceActivityId: null,+ trigger: 'field',+ prompt: `Work item ${row.identifier}: "${row.title}" now has you as its "${field.name}". Review it and take the appropriate next step.`,+ delaySeconds: agent.delaySec,+ });+}++// Tells the person put into a member field about it and subscribes them to the issue,+// the way an assignee is told. An agent is skipped: its bot user reads no inbox, and+// its own trigger is what starts it.+async function notifyFieldMember(+ projectId: number,+ issueId: number,+ userId: string,+ activityId: number | null,+ actorUserId: string | null | undefined,+): Promise<void> {+ if (await isProjectAgent(projectId, userId)) return;+ await notifyIssueChange({+ projectId,+ issueId,+ actorUserId: actorUserId ?? null,+ assignedUserId: userId,+ assignedActivityId: activityId,+ });+}++// The user id a member field currently holds on an issue, null when it is unset.+async function fieldMemberUserId(issueId: number, fieldId: number): Promise<string | null> {+ const [row] = await db+ .select({ valueUserId: issueFieldValue.valueUserId })+ .from(issueFieldValue)+ .where(and(eq(issueFieldValue.issueId, issueId), eq(issueFieldValue.fieldId, fieldId)));+ return row?.valueUserId ?? null;+}+// The text a markdown field currently holds on an issue, empty when it is unset.async function fieldMarkdown(issueId: number, fieldId: number): Promise<string> {const [row] = await db@@ -1412,12 +1497,22 @@ export async function setIssueFieldValue(if (field.fieldType === 'number' && input.value != null && input.value !== '') {if (!Number.isFinite(Number(input.value))) throw new HttpError(400, 'Invalid number');}+ const memberUserId =+ field.fieldType === 'member' && typeof input.value === 'string' && input.value !== ''+ ? input.value+ : null;+ if (memberUserId) await assertFieldMember(projectId, field.memberScope, memberUserId);// The markdown a field held before this write, so only the mentions the write// adds reach anyone.const previousMarkdown =field.fieldType === 'markdown' ? await fieldMarkdown(issueId, fieldId) : '';+ // Who the member field held before this write. A write that sets the same person+ // again starts no run and tells nobody.+ const previousMemberUserId =+ field.fieldType === 'member' ? await fieldMemberUserId(issueId, fieldId) : null;+// to_text is the display-ready new value logged to the activity feed: option// value names for select/multi_select, the raw value for everything else.let toText: string | null;@@ -1456,6 +1551,9 @@ export async function setIssueFieldValue(case 'date':column = { valueDate: (input.value as string) ?? null };break;+ case 'member':+ column = { valueUserId: memberUserId };+ break;case 'datetime':column = { valueDatetime: parseDatetime(input.value), valueDatetimeEnd: null };break;@@ -1482,6 +1580,8 @@ export async function setIssueFieldValue(const value = input.value;if (value == null || value === '') {toText = null;+ } else if (field.fieldType === 'member') {+ toText = await userName(memberUserId);} else if (field.fieldType === 'boolean') {toText = value ? 'true' : 'false';} else if (field.fieldType === 'datetime_range' && input.valueEnd) {@@ -1497,6 +1597,11 @@ export async function setIssueFieldValue(actorUserId,);+ if (memberUserId && memberUserId !== previousMemberUserId) {+ await enqueueFieldRun(issueId, field, memberUserId, actorUserId);+ await notifyFieldMember(projectId, issueId, memberUserId, entry?.id ?? null, actorUserId);+ }+// A markdown field is written in the same editor as the description and reaches// the people it mentions the same way.if (field.fieldType === 'markdown') {diff --git a/apps/api/src/modules/agents/core/__tests__/integration/agent-runs.test.ts b/apps/api/src/modules/agents/core/__tests__/integration/agent-runs.test.tsindex 5d590652..6886dff3 100644--- a/apps/api/src/modules/agents/core/__tests__/integration/agent-runs.test.ts+++ b/apps/api/src/modules/agents/core/__tests__/integration/agent-runs.test.ts@@ -7,7 +7,9 @@ import { resetDb } from '#tests/helpers/db';// triggered runs (a mention or a delegation), newest first, keyset-paginated. Runs are// created by the same paths the runtime uses: mentioning the agent in a comment queues// a mention run; delegating an issue to an agent with trigger_on_assign queues a-// delegation run. The poller (a live LLM call) is not exercised, so runs stay pending.+// delegation run; setting it into a member custom field it carries a trigger for+// queues a field run, held back by that trigger's own delay. The poller (a live LLM+// call) is not exercised, so runs stay pending.async function setup() {const owner = await signUpTestUser({ name: 'Owner' });@@ -29,6 +31,21 @@ async function createInternalAgent(asOwner: Api, name: string, username: string)return res.data!.agent;}+// A member field that takes agents.+async function memberField(asOwner: Api, name: string) {+ const res = await asOwner+ .projects({ projectKey: 'MKT' })+ ['custom-fields'].post({ name, fieldType: 'member', memberScope: 'agents' });+ return res.data!;+}++// A member field the agent reacts to, with the delay its run waits.+async function fieldTrigger(asOwner: Api, agentId: number, name: string, delaySec: number) {+ const field = await memberField(asOwner, name);+ await agents(asOwner)({ agentId }).patch({ fieldTriggers: [{ fieldId: field.id, delaySec }] });+ return field;+}+// Queues a mention run by commenting on the issue with the agent tagged.async function mentionAgent(asOwner: Api, issueId: number, username: string) {await asOwner.issues({ issueId }).comments.post({ body: `please review @${username}` });@@ -82,6 +99,49 @@ describe('agent run history', () => {expect(res.data!.items[0]).toMatchObject({ trigger: 'delegation', issueId: issue.id });});+ it('queues a run when the agent is set into a field it reacts to', async () => {+ const { asOwner, columnId } = await setup();+ const agent = await createInternalAgent(asOwner, 'Design Bot', 'design');+ const field = (+ await asOwner+ .projects({ projectKey: 'MKT' })+ ['custom-fields'].post({ name: 'Reviewer', fieldType: 'member', memberScope: 'agents' })+ ).data!;+ await agents(asOwner)({ agentId: agent.id }).patch({+ fieldTriggers: [{ fieldId: field.id, delaySec: 0 }],+ });+ const issue = (await createIssue(asOwner, columnId)).data!;++ await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: field.id })+ .put({ value: agent.userId });++ const res = await agents(asOwner)({ agentId: agent.id }).runs.get();+ expect(res.data!.items.length).toBe(1);+ expect(res.data!.items[0]).toMatchObject({ trigger: 'field', issueId: issue.id });+ expect(res.data!.items[0].prompt).toContain('Reviewer');+ });++ it('queues nothing when the agent carries no trigger for the field', async () => {+ const { asOwner, columnId } = await setup();+ const agent = await createInternalAgent(asOwner, 'Design Bot', 'design');+ const field = (+ await asOwner+ .projects({ projectKey: 'MKT' })+ ['custom-fields'].post({ name: 'Reviewer', fieldType: 'member', memberScope: 'agents' })+ ).data!;+ const issue = (await createIssue(asOwner, columnId)).data!;++ await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: field.id })+ .put({ value: agent.userId });++ const res = await agents(asOwner)({ agentId: agent.id }).runs.get();+ expect(res.data!.items).toEqual([]);+ });+it('holds a delegation run back by the agent delay, and a mention run not at all', async () => {const { asOwner, columnId } = await setup();const agent = await createInternalAgent(asOwner, 'Design Bot', 'design');@@ -115,6 +175,76 @@ describe('agent run history', () => {expect(new Date(run.nextAttemptAt).getTime()).toBeLessThanOrEqual(Date.now());});+ it("holds a field run back by that field trigger's own delay", async () => {+ const { asOwner, columnId } = await setup();+ const agent = await createInternalAgent(asOwner, 'Design Bot', 'design');+ const now = await memberField(asOwner, 'Reviewer');+ const later = await memberField(asOwner, 'Owner');+ await agents(asOwner)({ agentId: agent.id }).patch({+ fieldTriggers: [+ { fieldId: now.id, delaySec: 0 },+ { fieldId: later.id, delaySec: 600 },+ ],+ });+ const issue = (await createIssue(asOwner, columnId)).data!;++ await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: now.id })+ .put({ value: agent.userId });+ await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: later.id })+ .put({ value: agent.userId });++ const res = await agents(asOwner)({ agentId: agent.id }).runs.get();+ const byField = res.data!.items.map((r) => ({+ prompt: r.prompt,+ dueInMs: new Date(r.nextAttemptAt).getTime() - Date.now(),+ }));+ const immediate = byField.find((r) => r.prompt.includes('Reviewer'))!;+ const delayed = byField.find((r) => r.prompt.includes('Owner'))!;+ expect(immediate.dueInMs).toBeLessThanOrEqual(0);+ expect(delayed.dueInMs).toBeGreaterThan(590_000);+ });++ it('queues nothing when the same member is set again', async () => {+ const { asOwner, columnId } = await setup();+ const agent = await createInternalAgent(asOwner, 'Design Bot', 'design');+ const field = await fieldTrigger(asOwner, agent.id, 'Reviewer', 0);+ const issue = (await createIssue(asOwner, columnId)).data!;+ const value = asOwner.issues({ issueId: issue.id }).fields({ fieldId: field.id });++ await value.put({ value: agent.userId });+ await value.put({ value: agent.userId });++ const res = await agents(asOwner)({ agentId: agent.id }).runs.get();+ expect(res.data!.items.length).toBe(1);+ });++ it('drops the trigger when the field stops taking agents', async () => {+ const { asOwner, columnId } = await setup();+ const agent = await createInternalAgent(asOwner, 'Design Bot', 'design');+ const field = await fieldTrigger(asOwner, agent.id, 'Reviewer', 0);+ await asOwner+ .projects({ projectKey: 'MKT' })+ ['custom-fields']({ fieldId: field.id })+ .patch({ memberScope: 'humans' });+ await asOwner+ .projects({ projectKey: 'MKT' })+ ['custom-fields']({ fieldId: field.id })+ .patch({ memberScope: 'agents' });+ const issue = (await createIssue(asOwner, columnId)).data!;++ await asOwner+ .issues({ issueId: issue.id })+ .fields({ fieldId: field.id })+ .put({ value: agent.userId });++ const res = await agents(asOwner)({ agentId: agent.id }).runs.get();+ expect(res.data!.items).toEqual([]);+ });+it('paginates newest first with a keyset cursor', async () => {const { asOwner, columnId } = await setup();const agent = await createInternalAgent(asOwner, 'Design Bot', 'design');diff --git a/apps/api/src/modules/agents/core/__tests__/integration/ai-agents.test.ts b/apps/api/src/modules/agents/core/__tests__/integration/ai-agents.test.tsindex 8cae32b4..5ac3daf6 100644--- a/apps/api/src/modules/agents/core/__tests__/integration/ai-agents.test.ts+++ b/apps/api/src/modules/agents/core/__tests__/integration/ai-agents.test.ts@@ -409,6 +409,32 @@ describe('ai agents', () => {});});+ it('links the member fields the agent reacts to, and drops the ids of other fields', async () => {+ const { asOwner } = await setup();+ const fields = asOwner.projects({ projectKey: 'MKT' })['custom-fields'];+ const reviewer = (+ await fields.post({ name: 'Reviewer', fieldType: 'member', memberScope: 'agents' })+ ).data!;+ // A field the agents cannot be set into carries no trigger, so its id is dropped.+ const owner = (await fields.post({ name: 'Owner', fieldType: 'member', memberScope: 'humans' }))+ .data!;+ const created = await agents(asOwner).post({ name: 'Bot', username: 'bot', kind: 'internal' });+ const agentId = created.data!.agent.id;+ expect(created.data!.agent.fieldTriggers).toEqual([]);++ const res = await agents(asOwner)({ agentId }).patch({+ fieldTriggers: [+ { fieldId: reviewer.id, delaySec: 300 },+ { fieldId: owner.id, delaySec: 0 },+ ],+ });+ expect(res.status).toBe(200);+ expect(res.data?.fieldTriggers).toEqual([{ fieldId: reviewer.id, delaySec: 300 }]);++ const cleared = await agents(asOwner)({ agentId }).patch({ fieldTriggers: [] });+ expect(cleared.data?.fieldTriggers).toEqual([]);+ });+it('deletes an agent and drops it from assignee candidates', async () => {const { asOwner } = await setup();const created = await agents(asOwner).post({ name: 'Bot', username: 'bot', kind: 'external' });diff --git a/apps/api/src/modules/agents/core/internal-routes.ts b/apps/api/src/modules/agents/core/internal-routes.tsindex afd02469..75f587db 100644--- a/apps/api/src/modules/agents/core/internal-routes.ts+++ b/apps/api/src/modules/agents/core/internal-routes.ts@@ -11,7 +11,7 @@ const runBody = t.Object({agentId: t.Number(),issueId: t.Nullable(t.Number()),scheduleId: t.Nullable(t.Number()),- trigger: t.UnionEnum(['mention', 'delegation', 'schedule', 'manual']),+ trigger: t.UnionEnum(['mention', 'delegation', 'field', 'schedule', 'manual']),prompt: t.String(),attempts: t.Number(),projectId: t.Number(),diff --git a/apps/api/src/modules/agents/core/model.ts b/apps/api/src/modules/agents/core/model.tsindex 778e3c44..e57b8f4b 100644--- a/apps/api/src/modules/agents/core/model.ts+++ b/apps/api/src/modules/agents/core/model.ts@@ -66,6 +66,19 @@ const configFields = {),triggerOnMention: t.Optional(t.Boolean({ description: 'Run when @-mentioned in a comment.' })),triggerOnAssign: t.Optional(t.Boolean({ description: 'Run when assigned to an issue.' })),+ fieldTriggers: t.Optional(+ t.Array(+ t.Object({+ fieldId: t.Integer(),+ delaySec: t.Integer({ minimum: 0, maximum: 86400 }),+ }),+ {+ description:+ 'Member custom fields (from list_custom_fields) the agent also reacts to: being set ' ++ 'into one of them starts a run after delaySec seconds. Other fields are ignored.',+ },+ ),+ ),delegationDelaySec: t.Optional(t.Integer({minimum: 0,@@ -109,6 +122,7 @@ export const AiAgentResponse = t.Object({memoryLastMessages: t.Nullable(t.Number()),triggerOnMention: t.Boolean(),triggerOnAssign: t.Boolean(),+ fieldTriggers: t.Array(t.Object({ fieldId: t.Number(), delaySec: t.Number() })),delegationDelaySec: t.Number(),roleId: t.Nullable(t.Number()),ownerUserId: t.Nullable(t.String()),diff --git a/apps/api/src/modules/agents/core/run-queue.ts b/apps/api/src/modules/agents/core/run-queue.tsindex 8ac6f8e3..6fc47732 100644--- a/apps/api/src/modules/agents/core/run-queue.ts+++ b/apps/api/src/modules/agents/core/run-queue.ts@@ -23,7 +23,7 @@ export async function enqueueAgentRun(input: {issueId: number;sourceActivityId: number | null;prompt: string;- trigger?: 'mention' | 'delegation';+ trigger?: 'mention' | 'delegation' | 'field';// Seconds the run stays unclaimable after it is queued, so the issue can still be// edited before the agent reads it.delaySeconds?: number;diff --git a/apps/api/src/modules/agents/core/service.ts b/apps/api/src/modules/agents/core/service.tsindex 6526b281..42b5fa60 100644--- a/apps/api/src/modules/agents/core/service.ts+++ b/apps/api/src/modules/agents/core/service.ts@@ -7,6 +7,7 @@ import {projectRole,agentSkillLink,agentToolLink,+ agentFieldTrigger,integrationCredential,} from '@repo/db';import { and, eq, inArray, ne, sql } from 'drizzle-orm';@@ -17,6 +18,7 @@ import { integrationKind } from '../integrations/catalog';import { encryptSecret, decryptSecret } from '@repo/crypto';import { normalizeToolKeys, ALWAYS_ON_ACTIONS } from './runtime/tools/catalog';import { deleteThreadsWhere } from './runtime/memory';+import { listAgentMemberFieldIds } from '#modules/custom-fields/service';// Data access for AI agents. Each agent is backed by a hidden bot user// (ai_agent.user_id -> user.id): that user is what a work item is assigned to,@@ -41,6 +43,13 @@ export type AgentKind = 'external' | 'internal';// credentials should serve nobody else.export type RunnerScope = 'owner' | 'project';+// One member custom field an agent reacts to, with the seconds its run waits before+// the agent may pick it up.+export interface FieldTrigger {+ fieldId: number;+ delaySec: number;+}+export interface AiAgentRow {id: number;projectId: number;@@ -61,6 +70,10 @@ export interface AiAgentRow {// Run triggers.triggerOnMention: boolean;triggerOnAssign: boolean;+ // The member custom fields the agent also reacts to: being set into one of them+ // starts a run the way being made an issue's delegate does. Each field carries its+ // own delay, so a field can start at once while another leaves time to edit.+ fieldTriggers: FieldTrigger[];// How long a delegation run waits before it can be claimed.delegationDelaySec: number;// The project_role the bot user acts under. NULL falls back to the project's@@ -105,6 +118,7 @@ function mapAgent(row: {memoryLastMessages: number | null;triggerOnMention: boolean;triggerOnAssign: boolean;+ fieldTriggers: FieldTrigger[];delegationDelaySec: number;roleId: number | null;ownerUserId: string | null;@@ -134,6 +148,7 @@ function mapAgent(row: {memoryLastMessages: row.memoryLastMessages,triggerOnMention: row.triggerOnMention,triggerOnAssign: row.triggerOnAssign,+ fieldTriggers: row.fieldTriggers,delegationDelaySec: row.delegationDelaySec,roleId: row.roleId,ownerUserId: row.ownerUserId,@@ -165,6 +180,9 @@ const agentColumns = {memoryLastMessages: aiAgent.memoryLastMessages,triggerOnMention: aiAgent.triggerOnMention,triggerOnAssign: aiAgent.triggerOnAssign,+ fieldTriggers: sql<+ FieldTrigger[]+ >`(select coalesce(json_agg(json_build_object('fieldId', ${agentFieldTrigger.fieldId}, 'delaySec', ${agentFieldTrigger.delaySec}) order by ${agentFieldTrigger.fieldId}), '[]'::json) from ${agentFieldTrigger} where ${agentFieldTrigger.agentId} = ${aiAgent.id})`,delegationDelaySec: aiAgent.delegationDelaySec,roleId: aiAgent.roleId,ownerUserId: aiAgent.ownerUserId,@@ -282,6 +300,49 @@ export async function getAssignTriggerAgent(return { id: row.id, delegationDelaySec: row.delegationDelaySec };}+// The agent whose bot user is userId and that reacts to being set into that member+// field, or null. The counterpart of getAssignTriggerAgent for a custom field.+export async function getFieldTriggerAgent(+ userId: string,+ fieldId: number,+ actorUserId: string | null,+): Promise<{ id: number; delaySec: number } | null> {+ const rows = await db+ .select({+ id: aiAgent.id,+ delaySec: agentFieldTrigger.delaySec,+ ...triggerScopeColumns,+ })+ .from(aiAgent)+ .innerJoin(agentFieldTrigger, eq(agentFieldTrigger.agentId, aiAgent.id))+ .where(and(eq(aiAgent.userId, userId), eq(agentFieldTrigger.fieldId, fieldId)))+ .limit(1);+ const row = rows[0];+ if (!row || !isTriggerableBy(row, actorUserId)) return null;+ return { id: row.id, delaySec: row.delaySec };+}++// Replaces the member fields an agent reacts to. A field that no member field of the+// project holds agents for is dropped, so a stale id from a client never links.+async function setFieldTriggers(+ agentId: number,+ projectId: number,+ triggers: FieldTrigger[],+): Promise<void> {+ const allowed = new Set(await listAgentMemberFieldIds(projectId));+ const byField = new Map(+ triggers.filter((t) => allowed.has(t.fieldId)).map((t) => [t.fieldId, t.delaySec]),+ );+ await db.transaction(async (tx) => {+ await tx.delete(agentFieldTrigger).where(eq(agentFieldTrigger.agentId, agentId));+ if (byField.size > 0) {+ await tx+ .insert(agentFieldTrigger)+ .values([...byField].map(([fieldId, delaySec]) => ({ agentId, fieldId, delaySec })));+ }+ });+}+// True if the user id is the bot user of an agent in this project. Validates that a// delegate is an agent of the same project before it is written to an issue.export async function isProjectAgent(projectId: number, userId: string): Promise<boolean> {@@ -364,6 +425,8 @@ export interface NewAgentInput {// for its API key alone must not collect runs no one drains.triggerOnMention?: boolean;triggerOnAssign?: boolean;+ // The member custom fields that start a run when the agent is set into one.+ fieldTriggers?: FieldTrigger[];delegationDelaySec?: number;// Authorization role. Required in effect for an external agent: left out, it// resolves to the project's default role.@@ -467,6 +530,10 @@ export async function createAgent(}});+ if (input.fieldTriggers?.length) {+ await setFieldTriggers(agentId, projectId, input.fieldTriggers);+ }+// Issued outside the transaction: better-auth writes the key through its own// connection, so it cannot join this one.const apiKey = await issueKey(userId, input.name);@@ -558,6 +625,7 @@ export interface AgentPatch {memoryLastMessages?: number | null;triggerOnMention?: boolean;triggerOnAssign?: boolean;+ fieldTriggers?: FieldTrigger[];delegationDelaySec?: number;roleId?: number | null;runnerScope?: RunnerScope;@@ -627,6 +695,9 @@ export async function updateAgent(throw err;}}+ if (patch.fieldTriggers !== undefined) {+ await setFieldTriggers(id, projectId, patch.fieldTriggers);+ }return getAgentById(id, projectId);}diff --git a/apps/api/src/modules/agents/model.ts b/apps/api/src/modules/agents/model.tsindex 3b0a5ec8..fdf23d1a 100644--- a/apps/api/src/modules/agents/model.ts+++ b/apps/api/src/modules/agents/model.ts@@ -10,6 +10,7 @@ export const agentParams = t.Object({export const agentRunTrigger = t.Union([t.Literal('mention'),t.Literal('delegation'),+ t.Literal('field'),t.Literal('schedule'),t.Literal('manual'),]);diff --git a/apps/api/src/modules/analytics/model.ts b/apps/api/src/modules/analytics/model.tsindex 05f75660..cabf9498 100644--- a/apps/api/src/modules/analytics/model.ts+++ b/apps/api/src/modules/analytics/model.ts@@ -59,6 +59,7 @@ const AgentRunFeedItem = t.Object({trigger: t.Union([t.Literal('mention'),t.Literal('delegation'),+ t.Literal('field'),t.Literal('schedule'),t.Literal('manual'),]),diff --git a/apps/api/src/modules/analytics/service.ts b/apps/api/src/modules/analytics/service.tsindex f50ddcf2..b8e83039 100644--- a/apps/api/src/modules/analytics/service.ts+++ b/apps/api/src/modules/analytics/service.ts@@ -443,7 +443,7 @@ export async function listActivity(export interface AgentRunFeedItem {id: number;status: string;- trigger: 'mention' | 'delegation' | 'schedule' | 'manual';+ trigger: 'mention' | 'delegation' | 'field' | 'schedule' | 'manual';agentId: number;agentName: string;issueId: number | null;diff --git a/apps/api/src/modules/custom-fields/__tests__/integration/custom-fields.test.ts b/apps/api/src/modules/custom-fields/__tests__/integration/custom-fields.test.tsindex 66169c54..41b82429 100644--- a/apps/api/src/modules/custom-fields/__tests__/integration/custom-fields.test.ts+++ b/apps/api/src/modules/custom-fields/__tests__/integration/custom-fields.test.ts@@ -34,6 +34,28 @@ function createType(client: Api, name: string, projectKey = 'MKT') {return client.projects({ projectKey })['issue-types'].post({ name });}+// A project with an issue to hold field values, plus the ids needed to write them.+async function setupWithIssue() {+ const owner = await signUpTestUser();+ const asOwner = authedApi(owner.cookie);+ await asOwner.projects.post({ key: 'MKT', name: 'Marketing' });+ const view = await asOwner.projects({ projectKey: 'MKT' }).get();+ const issue = (+ await asOwner.projects({ projectKey: 'MKT' }).issues.post({+ columnId: view.data!.columns[0].id,+ title: 'Task',+ })+ ).data!;+ return { asOwner, ownerUserId: owner.userId, issueId: issue.id };+}++// The entry an issue carries for a field. Every field of the issue's type is listed,+// so an unset one comes back with a null value rather than missing.+async function issueValue(client: Api, issueId: number, fieldId: number) {+ const res = await client.issues({ issueId }).get();+ return res.data!.fields.find((f) => f.fieldId === fieldId);+}+describe('custom-fields', () => {beforeEach(async () => {await resetDb();@@ -123,6 +145,44 @@ describe('custom-fields', () => {expect(res.status).toBe(400);});+ it('defaults a member field to the "all" scope', async () => {+ const { asOwner } = await setupProject();+ const created = await fields(asOwner).post({ name: 'Reviewer', fieldType: 'member' });+ expect(created.status).toBe(201);+ expect(created.data).toMatchObject({ fieldType: 'member', memberScope: 'all' });+ });++ it('stores the member scope it was created with', async () => {+ const { asOwner } = await setupProject();+ const created = await fields(asOwner).post({+ name: 'Runner',+ fieldType: 'member',+ memberScope: 'agents',+ });+ expect(created.data).toMatchObject({ memberScope: 'agents' });+ });++ it('leaves memberScope null on a field of another type', async () => {+ const { asOwner } = await setupProject();+ const created = await fields(asOwner).post({+ name: 'Severity',+ fieldType: 'text',+ memberScope: 'humans',+ });+ expect(created.data).toMatchObject({ fieldType: 'text', memberScope: null });+ });++ it('rejects a member scope outside the three it offers', async () => {+ const { asOwner } = await setupProject();+ const res = await fields(asOwner).post({+ name: 'Reviewer',+ fieldType: 'member',+ // @ts-expect-error the scope union rejects this at typecheck; the server rejects it too.+ memberScope: 'robots',+ });+ expect(res.status).toBe(400);+ });+it('rejects an empty name', async () => {const { asOwner } = await setupProject();const res = await fields(asOwner).post({ name: '', fieldType: 'text' });@@ -227,6 +287,134 @@ describe('custom-fields', () => {});});+ it('changes the type and clears the values issues held under the old one', async () => {+ const { asOwner, issueId } = await setupWithIssue();+ const field = (await fields(asOwner).post({ name: 'Severity', fieldType: 'text' })).data!;+ await asOwner.issues({ issueId }).fields({ fieldId: field.id }).put({ value: 'high' });++ const patched = await fields(asOwner)({ fieldId: field.id }).patch({ fieldType: 'number' });+ expect(patched.data).toMatchObject({ fieldType: 'number' });+ expect((await issueValue(asOwner, issueId, field.id))?.value).toBeNull();+ });++ it('drops the options when the type stops holding them', async () => {+ const { asOwner } = await setupWithIssue();+ const field = (+ await fields(asOwner).post({+ name: 'Priority',+ fieldType: 'select',+ options: ['Low', 'High'],+ })+ ).data!;++ const patched = await fields(asOwner)({ fieldId: field.id }).patch({ fieldType: 'text' });+ expect(patched.data).toMatchObject({ fieldType: 'text', options: [] });+ });++ it('renames an option in place and keeps the issues holding it', async () => {+ const { asOwner, issueId } = await setupWithIssue();+ const field = (+ await fields(asOwner).post({+ name: 'Priority',+ fieldType: 'select',+ options: ['Low', 'High'],+ })+ ).data!;+ const low = field.options[0];+ await asOwner+ .issues({ issueId })+ .fields({ fieldId: field.id })+ .put({ optionIds: [low.id] });++ const patched = await fields(asOwner)({ fieldId: field.id }).patch({+ options: [{ id: low.id, value: 'Lowest' }, { value: 'Urgent' }],+ });+ expect(patched.data!.options.map((o) => o.value)).toEqual(['Lowest', 'Urgent']);+ expect((await issueValue(asOwner, issueId, field.id))?.optionIds).toEqual([low.id]);+ });++ it('deletes an option left out of the list, and the selections of it', async () => {+ const { asOwner, issueId } = await setupWithIssue();+ const field = (+ await fields(asOwner).post({+ name: 'Priority',+ fieldType: 'select',+ options: ['Low', 'High'],+ })+ ).data!;+ const [low, high] = field.options;+ await asOwner+ .issues({ issueId })+ .fields({ fieldId: field.id })+ .put({ optionIds: [low.id] });++ const patched = await fields(asOwner)({ fieldId: field.id }).patch({+ options: [{ id: high.id, value: 'High' }],+ });+ expect(patched.data!.options.map((o) => o.value)).toEqual(['High']);+ expect((await issueValue(asOwner, issueId, field.id))?.optionIds ?? []).toEqual([]);+ });++ it('keeps the options when a select becomes a multi-select', async () => {+ const { asOwner } = await setupWithIssue();+ const field = (+ await fields(asOwner).post({+ name: 'Priority',+ fieldType: 'select',+ options: ['Low', 'High'],+ })+ ).data!;++ const patched = await fields(asOwner)({ fieldId: field.id }).patch({+ fieldType: 'multi_select',+ options: field.options.map((o) => ({ id: o.id, value: o.value })),+ });+ expect(patched.status).toBe(200);+ expect(patched.data).toMatchObject({ fieldType: 'multi_select' });+ expect(patched.data!.options.map((o) => o.id)).toEqual(field.options.map((o) => o.id));+ });++ it('rejects an option list with a repeated value', async () => {+ const { asOwner } = await setupWithIssue();+ const field = (+ await fields(asOwner).post({ name: 'Priority', fieldType: 'select', options: ['Low'] })+ ).data!;++ const res = await fields(asOwner)({ fieldId: field.id }).patch({+ options: [{ value: 'Same' }, { value: 'Same' }],+ });+ expect(res.status).toBe(400);+ });++ it('narrows a member scope and clears only the members it no longer allows', async () => {+ const { asOwner, ownerUserId, issueId } = await setupWithIssue();+ const agent = (+ await asOwner+ .projects({ projectKey: 'MKT' })+ ['ai-agents'].post({ name: 'Bot', username: 'bot', kind: 'external' })+ ).data!.agent;+ const forOwner = (+ await fields(asOwner).post({ name: 'Reviewer', fieldType: 'member', memberScope: 'all' })+ ).data!;+ const forAgent = (+ await fields(asOwner).post({ name: 'Runner', fieldType: 'member', memberScope: 'all' })+ ).data!;+ await asOwner+ .issues({ issueId })+ .fields({ fieldId: forOwner.id })+ .put({ value: ownerUserId });+ await asOwner+ .issues({ issueId })+ .fields({ fieldId: forAgent.id })+ .put({ value: agent.userId });++ await fields(asOwner)({ fieldId: forOwner.id }).patch({ memberScope: 'humans' });+ await fields(asOwner)({ fieldId: forAgent.id }).patch({ memberScope: 'humans' });++ expect((await issueValue(asOwner, issueId, forOwner.id))?.value).toBe(ownerUserId);+ expect((await issueValue(asOwner, issueId, forAgent.id))?.value).toBeNull();+ });+it('returns 404 for a missing field', async () => {const { asOwner } = await setupProject();const res = await fields(asOwner)({ fieldId: 999999 }).patch({ name: 'Nope' });diff --git a/apps/api/src/modules/custom-fields/index.ts b/apps/api/src/modules/custom-fields/index.tsindex 13fff380..aea34c61 100644--- a/apps/api/src/modules/custom-fields/index.ts+++ b/apps/api/src/modules/custom-fields/index.ts@@ -75,7 +75,10 @@ export const customFieldRoutes = new Elysia({response: { 200: CustomFieldResponse, ...commonErrors },detail: {summary: 'Update a custom field',- description: 'Update a custom field.',+ description:+ 'Update a custom field. Changing its type clears the values issues hold in it, ' ++ 'narrowing a member scope clears the ones it no longer allows, and an option left ' ++ 'out of `options` is deleted along with the selections of it.',...mcpTool('update_custom_field'),},},diff --git a/apps/api/src/modules/custom-fields/model.ts b/apps/api/src/modules/custom-fields/model.tsindex 9981efb6..1b0837d4 100644--- a/apps/api/src/modules/custom-fields/model.ts+++ b/apps/api/src/modules/custom-fields/model.ts@@ -11,8 +11,12 @@ const fieldType = t.Union([t.Literal('datetime_range'),t.Literal('select'),t.Literal('multi_select'),+ t.Literal('member'),]);+// Who a member field may hold: every candidate, the people only, or the agents only.+const memberScope = t.Union([t.Literal('all'), t.Literal('humans'), t.Literal('agents')]);+export const fieldParams = t.Object({ projectKey: t.String(), fieldId: t.Numeric() });export const listFieldsQuery = t.Object({ issueTypeId: t.Optional(t.Numeric()) });@@ -31,6 +35,7 @@ export const CustomFieldResponse = t.Object({issueTypeId: t.Nullable(t.Number()),name: t.String(),fieldType,+ memberScope: t.Nullable(memberScope),showInBody: t.Boolean(),position: t.Number(),options: t.Array(CustomFieldOptionResponse),@@ -42,12 +47,29 @@ export const createCustomFieldBody = t.Object({issueTypeId: t.Optional(t.Nullable(t.Integer())),name: t.String({ minLength: 1 }),fieldType,+ // Only read for a member field, where it defaults to 'all'.+ memberScope: t.Optional(memberScope),showInBody: t.Optional(t.Boolean()),options: t.Optional(t.Array(t.String({ minLength: 1 }))),});-// Only the two fields an existing field lets you change; its type and options are fixed.+// One option on the way in: with an id it renames the option that carries it and+// keeps the issues that hold it; without one it is a new option. An option of the+// field left out of the array is deleted, along with the selections of it.+const updateFieldOption = t.Object({+ id: t.Optional(t.Integer()),+ value: t.String({ minLength: 1 }),+});+export const updateCustomFieldBody = t.Object({name: t.Optional(t.String({ minLength: 1 })),showInBody: t.Optional(t.Boolean()),+ // Changing the type clears the values issues hold in this field: they are stored+ // in the column of the type they were written under.+ fieldType: t.Optional(fieldType),+ // Read for a member field. Narrowing the scope clears the values it no longer+ // allows; the rest are kept.+ memberScope: t.Optional(memberScope),+ // The full option list of a select field, in display order.+ options: t.Optional(t.Array(updateFieldOption)),});diff --git a/apps/api/src/modules/custom-fields/service.ts b/apps/api/src/modules/custom-fields/service.tsindex 27f6d528..ad44a661 100644--- a/apps/api/src/modules/custom-fields/service.ts+++ b/apps/api/src/modules/custom-fields/service.ts@@ -1,4 +1,12 @@-import { db, customField, customFieldOption } from '@repo/db';+import {+ db,+ agentFieldTrigger,+ aiAgent,+ customField,+ customFieldOption,+ issueFieldOption,+ issueFieldValue,+} from '@repo/db';import { and, asc, eq, inArray, isNull, or, sql, type SQL } from 'drizzle-orm';import { HttpError } from '#shared/lib';import { getIssueTypeById } from '#modules/issue-types/service';@@ -19,7 +27,11 @@ export type CustomFieldType =| 'datetime'| 'datetime_range'| 'select'- | 'multi_select';+ | 'multi_select'+ | 'member';++// Who a member field may hold. Null for every other field type.+export type MemberScope = 'all' | 'humans' | 'agents';export interface CustomFieldOptionRow {id: number;@@ -33,6 +45,7 @@ export interface CustomFieldRow {issueTypeId: number | null;name: string;fieldType: CustomFieldType;+ memberScope: MemberScope | null;showInBody: boolean;position: number;options: CustomFieldOptionRow[];@@ -47,6 +60,7 @@ function mapField(issueTypeId: row.issueTypeId,name: row.name,fieldType: row.fieldType as CustomFieldType,+ memberScope: row.memberScope as MemberScope | null,showInBody: row.showInBody,position: row.position,options,@@ -98,6 +112,22 @@ export async function listCustomFields(return fields.map((f) => mapField(f, options.get(f.id) ?? []));}+// The ids of the member fields of a project an agent can be set into: the ones whose+// scope holds agents. These are the fields an agent may carry a run trigger for.+export async function listAgentMemberFieldIds(projectId: number): Promise<number[]> {+ const rows = await db+ .select({ id: customField.id })+ .from(customField)+ .where(+ and(+ eq(customField.projectId, projectId),+ eq(customField.fieldType, 'member'),+ inArray(customField.memberScope, ['all', 'agents']),+ ),+ );+ return rows.map((r) => r.id);+}+// One field by id, scoped to its project so a field id from another project is// not matched. Returns null when no field of that id exists in the project.export async function getCustomFieldById(@@ -118,6 +148,7 @@ export async function createCustomField(input: {issueTypeId?: number | null;name: string;fieldType: CustomFieldType;+ memberScope?: MemberScope | null;showInBody?: boolean;options?: string[];}): Promise<CustomFieldRow> {@@ -144,6 +175,7 @@ export async function createCustomField(input: {issueTypeId,name: input.name,fieldType: input.fieldType,+ memberScope: input.fieldType === 'member' ? (input.memberScope ?? 'all') : null,showInBody: input.showInBody ?? false,position: Number(pos),})@@ -157,28 +189,130 @@ export async function createCustomField(input: {return (await getCustomFieldById(input.projectId, row.id))!;}+type Transaction = Parameters<Parameters<typeof db.transaction>[0]>[0];++function holdsOptions(fieldType: CustomFieldType): boolean {+ return fieldType === 'select' || fieldType === 'multi_select';+}++// Every value issues hold in the field, both the scalar rows and the selections of+// its options. A value is written into the column of the type it was set under, so+// it is unreadable once the field carries another type.+async function clearFieldValues(tx: Transaction, fieldId: number): Promise<void> {+ await tx.delete(issueFieldValue).where(eq(issueFieldValue.fieldId, fieldId));+ await tx.delete(issueFieldOption).where(eq(issueFieldOption.fieldId, fieldId));+}++// Clears the members a narrowed scope no longer allows, leaving the rest in place.+// An agent of the project is one whose bot user backs an ai_agent row of it.+async function clearMembersOutOfScope(+ tx: Transaction,+ projectId: number,+ fieldId: number,+ scope: MemberScope,+): Promise<void> {+ if (scope === 'all') return;+ const isAgent = sql`EXISTS (SELECT 1 FROM ${aiAgent} WHERE ${aiAgent.userId} = ${issueFieldValue.valueUserId} AND ${aiAgent.projectId} = ${projectId})`;+ await tx+ .update(issueFieldValue)+ .set({ valueUserId: null })+ .where(+ and(eq(issueFieldValue.fieldId, fieldId), scope === 'humans' ? isAgent : sql`NOT ${isAgent}`),+ );+}++// Writes the option list a select field should end up with. An option that arrives+// with an id is renamed in place, so the issues holding it keep it; one that is left+// out is deleted, and its selections go with it.+async function syncOptions(+ tx: Transaction,+ fieldId: number,+ existing: CustomFieldOptionRow[],+ next: { id?: number; value: string }[],+): Promise<void> {+ const values = next.map((o) => o.value);+ if (new Set(values).size !== values.length) {+ throw new HttpError(400, 'Option values must be unique');+ }+ const byId = new Map(existing.map((o) => [o.id, o]));+ const kept = new Set(+ next.map((o) => o.id).filter((id): id is number => id != null && byId.has(id)),+ );+ const removed = existing.filter((o) => !kept.has(o.id)).map((o) => o.id);+ if (removed.length > 0) {+ await tx.delete(customFieldOption).where(inArray(customFieldOption.id, removed));+ }+ for (const [position, option] of next.entries()) {+ if (option.id != null && kept.has(option.id)) {+ await tx+ .update(customFieldOption)+ .set({ value: option.value, position })+ .where(eq(customFieldOption.id, option.id));+ } else {+ await tx.insert(customFieldOption).values({ fieldId, value: option.value, position });+ }+ }+}+// Updates a field, scoped to its project. Returns null when no field of that id-// exists in the project.+// exists in the project. A field can be reshaped after creation, and the values+// issues already hold follow the reshape: changing the type clears them, narrowing+// a member scope clears the ones it no longer allows, and dropping an option clears+// the selections of it.export async function updateCustomField(projectId: number,id: number,- patch: { name?: string; showInBody?: boolean },+ patch: {+ name?: string;+ showInBody?: boolean;+ fieldType?: CustomFieldType;+ memberScope?: MemberScope;+ options?: { id?: number; value: string }[];+ },): Promise<CustomFieldRow | null> {- const scope = and(eq(customField.id, id), eq(customField.projectId, projectId));- const set: Partial<typeof customField.$inferInsert> = {};- if (patch.name !== undefined) set.name = patch.name;- if (patch.showInBody !== undefined) set.showInBody = patch.showInBody;- if (Object.keys(set).length > 0) {- const updated = await db- .update(customField)- .set(set)- .where(scope)- .returning({ id: customField.id });- if (updated.length === 0) return null;- } else {- const rows = await db.select({ id: customField.id }).from(customField).where(scope);- if (rows.length === 0) return null;+ const current = await getCustomFieldById(projectId, id);+ if (!current) return null;++ const fieldType = patch.fieldType ?? current.fieldType;+ const typeChanged = fieldType !== current.fieldType;+ // A field that has just become a member field carries no scope yet, so it starts+ // at the same default a new one gets.+ let memberScope: MemberScope | null = null;+ if (fieldType === 'member') {+ memberScope = patch.memberScope ?? (typeChanged ? 'all' : current.memberScope);}++ await db.transaction(async (tx) => {+ await tx+ .update(customField)+ .set({+ name: patch.name ?? current.name,+ showInBody: patch.showInBody ?? current.showInBody,+ fieldType,+ memberScope,+ })+ .where(and(eq(customField.id, id), eq(customField.projectId, projectId)));++ if (typeChanged) {+ await clearFieldValues(tx, id);+ if (!holdsOptions(fieldType)) {+ await tx.delete(customFieldOption).where(eq(customFieldOption.fieldId, id));+ }+ } else if (memberScope != null && memberScope !== current.memberScope) {+ await clearMembersOutOfScope(tx, projectId, id, memberScope);+ }++ // A field that no longer takes agents drops its agent triggers: kept, they would+ // arm again on their own once the field takes agents anew.+ if (fieldType !== 'member' || memberScope === 'humans') {+ await tx.delete(agentFieldTrigger).where(eq(agentFieldTrigger.fieldId, id));+ }++ if (patch.options && holdsOptions(fieldType)) {+ await syncOptions(tx, id, current.options, patch.options);+ }+ });+return getCustomFieldById(projectId, id);}diff --git a/apps/api/src/modules/notifications/__tests__/integration/notifications.test.ts b/apps/api/src/modules/notifications/__tests__/integration/notifications.test.tsindex 9a315d81..61fc6cc7 100644--- a/apps/api/src/modules/notifications/__tests__/integration/notifications.test.ts+++ b/apps/api/src/modules/notifications/__tests__/integration/notifications.test.ts@@ -118,6 +118,30 @@ describe('notifications', () => {expect(ownerInbox.data!.items).toHaveLength(0);});+ it('notifies the member put into a member custom field', async () => {+ const { owner, columnId } = await setup();+ const member = await addMember(owner);+ const field = (+ await owner.api+ .projects({ projectKey: 'MKT' })+ ['custom-fields'].post({ name: 'Reviewer', fieldType: 'member', memberScope: 'humans' })+ ).data!;+ const issue = (await createIssue(owner.api, columnId, { title: 'Ship it' })).data!;++ await owner.api+ .issues({ issueId: issue.id })+ .fields({ fieldId: field.id })+ .put({ value: member.userId });++ const inbox = await member.api.notifications.get({ query: {} });+ expect(inbox.data!.items).toHaveLength(1);+ expect(inbox.data!.items[0]).toMatchObject({+ type: 'assigned',+ actorUserId: owner.userId,+ issueTitle: 'Ship it',+ });+ });+it('notifies watchers on a comment', async () => {const { owner, columnId } = await setup();const member = await addMember(owner);diff --git a/apps/api/src/modules/projects/copy.ts b/apps/api/src/modules/projects/copy.tsindex 8bccc824..c15bc109 100644--- a/apps/api/src/modules/projects/copy.ts+++ b/apps/api/src/modules/projects/copy.ts@@ -450,6 +450,7 @@ export async function copyProject(issueTypeId: f.issueTypeId != null ? (maps.type.get(f.issueTypeId) ?? null) : null,name: f.name,fieldType: f.fieldType,+ memberScope: f.memberScope,position: f.position,}).returning({ id: customField.id });@@ -677,6 +678,10 @@ export async function copyProject(memoryLastMessages: a.memoryLastMessages,triggerOnMention: a.triggerOnMention,triggerOnAssign: a.triggerOnAssign,+ fieldTriggers: a.fieldTriggers.flatMap((trigger) => {+ const fieldId = maps.field.get(trigger.fieldId);+ return fieldId == null ? [] : [{ fieldId, delaySec: trigger.delaySec }];+ }),delegationDelaySec: a.delegationDelaySec,roleId: a.roleId != null ? (roleMap.get(a.roleId) ?? null) : null,// An 'owner'-scoped agent keeps its scope, bound to whoever made the copy —diff --git a/apps/web/messages/ar/dashboards.json b/apps/web/messages/ar/dashboards.jsonindex 5422014d..4fde4279 100644--- a/apps/web/messages/ar/dashboards.json+++ b/apps/web/messages/ar/dashboards.json@@ -165,6 +165,7 @@"trigger": {"mention": "شُغّل عند ذكره في","delegation": "شُغّل عند تفويض",+ "field": "شُغّل عند تعيينه في حقل","manual": "شُغّل يدويًا","schedule": "شُغّل حسب الجدولة"}diff --git a/apps/web/messages/ar/filters.json b/apps/web/messages/ar/filters.jsonindex f5524bdd..53cf3cdd 100644--- a/apps/web/messages/ar/filters.json+++ b/apps/web/messages/ar/filters.json@@ -47,6 +47,7 @@"delegate": "بلا مفوَّض","type": "بلا نوع","initiative": "بلا مبادرة",- "cycle": "بلا دورة"+ "cycle": "بلا دورة",+ "member": "بدون قيمة"}}diff --git a/apps/web/messages/ar/issue.json b/apps/web/messages/ar/issue.jsonindex 8210b24a..09a2138b 100644--- a/apps/web/messages/ar/issue.json+++ b/apps/web/messages/ar/issue.json@@ -309,7 +309,10 @@"state": "الحالة","type": "النوع","labels": "الوسوم",- "labelCount": "{count, plural, zero {لا وسوم} one {وسم واحد} two {وسمان} few {# وسوم} many {# وسمًا} other {# وسم}}"+ "labelCount": "{count, plural, zero {لا وسوم} one {وسم واحد} two {وسمان} few {# وسوم} many {# وسمًا} other {# وسم}}",+ "noMember": "مش متحدد",+ "pickMember": "اختار حد…",+ "noCandidates": "مفيش حد تختاره."},"watchers": {"watch": "متابعة",diff --git a/apps/web/messages/ar/settings.json b/apps/web/messages/ar/settings.jsonindex a4cc24d3..511880fd 100644--- a/apps/web/messages/ar/settings.json+++ b/apps/web/messages/ar/settings.json@@ -147,8 +147,10 @@"onMentionHint": "بيشتغل لما حد يشاور عليه بـ @ في تعليق.","onDelegation": "التفاعل مع التفويض","onDelegationHint": "بيشتغل لما يتحدد مفوَّض لمهمة.",- "delegationDelay": "استنى قبل ما تبدأ",- "delegationDelayHint": "الوقت اللي تفضل فيه تعدّل على المهمة بعد ما تفوّضها. صفر يعني تبدأ على طول.",+ "onFieldSet": "التفاعل مع «{field}»",+ "onFieldSetHint": "بيشتغل لما يتحدد كقيمة للحقل ده في مهمة.",+ "runDelay": "استنى قبل ما تبدأ",+ "runDelayHint": "الوقت اللي تفضل فيه تعدّل على المهمة قبل ما الوكيل يبدأ. صفر يعني يبدأ على طول.","minutes": "دقيقة","runner": "المنفّذ (runner)","runnerHint": "العملية اللي على جهازك واللي بتنفّذ مهام الوكيل ده",@@ -244,7 +246,7 @@"testChat": "محادثة تجريبية","moreActions": "إجراءات أخرى","createdOn": "أُنشئ {date}",- "runsSubtitle": "@{username} · تشغيلات الإشارة والتفويض",+ "runsSubtitle": "@{username} · تشغيلات المشغّلات","regenerateMessage": "مفتاح <v>{name}</v> الحالي هيبطّل يشتغل على طول. حدّث أي حاجة بتستخدمه بالمفتاح الجديد.","deleteMessage": "<v>{name}</v> ومفتاح API بتاعها هيتشالوا، وهتتشال من أي مهام كانت مسنودة ليها أو مفوّضة ليها. مش هينفع ترجع في ده.","actionCount": "{count, plural, zero {لا إجراءات} one {إجراء واحد} two {إجراءان} few {# إجراءات} many {# إجراءً} other {# إجراء}}",@@ -253,6 +255,7 @@"triggersNone": "لا شيء","triggerMention": "إشارة","triggerDelegation": "تفويض",+ "triggerFieldCount": "{count, plural, zero {# حقل} one {# حقل} two {# حقلين} few {# حقول} many {# حقلاً} other {# حقل}}","noMatch": "لا نتائج لـ “{query}”.","useCustomModel": "استخدام \"{query}\"","readOnlyAlwaysOn": "الوصول للقراءة بس مفعّل على طول ومش هينفع توقفه.",@@ -540,7 +543,8 @@"datetime": "تاريخ ووقت","datetime_range": "نطاق تاريخ ووقت","select": "اختيار",- "multi_select": "اختيار متعدد"+ "multi_select": "اختيار متعدد",+ "member": "عضو"},"global": "عام (كل الأنواع)","globalShort": "عام",@@ -552,8 +556,16 @@"deleteTitle": "حذف الحقل \"{name}\"","deleteMessage": "الحقل ده هيتشال، وأي قيم متحطة فيه على المهام هتتشال معاه. مش هينفع ترجع في ده.","namePlaceholder": "اسم الحقل",- "optionsPlaceholder": "الخيارات: منخفض، متوسط، مرتفع",+ "optionsPlaceholder": "منخفض، متوسط، عالي",+ "options": "الخيارات",+ "optionsHint": "افصل بينهم بفاصلة.","type": "النوع",+ "memberScope": "مين ممكن يتحدد فيه",+ "memberScopes": {+ "all": "أي حد",+ "humans": "الناس بس",+ "agents": "الوكلاء بس"+ },"mainInfo": "المعلومات الرئيسية","mainInfoTooltip": "يظهر في متن المهمة، لا في الخصائص","mainInfoMeta": "معلومات رئيسية",@@ -574,7 +586,11 @@"actionNew": "جديد","actionExists": "موجود","imported": "طُبّقت الحقول المخصصة: {created} مُنشأة.",- "importedWithTypes": "طُبّقت الحقول المخصصة: {created} مُنشأة، و{types} نوع مهمة مُضاف."+ "importedWithTypes": "طُبّقت الحقول المخصصة: {created} مُنشأة، و{types} نوع مهمة مُضاف.",+ "removeOption": "امسح الخيار {value}",+ "typeChangeWarning": "تغيير النوع هيمسح القيم اللي موجودة في الحقل ده.",+ "optionsRemovedWarning": "الخيار اللي هيتشال هيتمسح من المهام اللي مختاراه.",+ "memberScopeWarning": "الأعضاء اللي النطاق الجديد مش بيسمح بيهم هيتمسحوا."},"actions": {"new": "إجراء جديد",diff --git a/apps/web/messages/ar/workItems.json b/apps/web/messages/ar/workItems.jsonindex cc9b1de4..fb33e5f6 100644--- a/apps/web/messages/ar/workItems.json+++ b/apps/web/messages/ar/workItems.json@@ -102,7 +102,8 @@"noPriority": "بلا أولوية","noType": "بلا نوع","noInitiative": "بلا مبادرة",- "noCycle": "بلا دورة"+ "noCycle": "بلا دورة",+ "noMember": "بدون قيمة"},"wip": {"reached": "{column} وصل لحدّه الأقصى وهو {limit} مهمة.",diff --git a/apps/web/messages/en/dashboards.json b/apps/web/messages/en/dashboards.jsonindex ec16cdb1..3778aa6d 100644--- a/apps/web/messages/en/dashboards.json+++ b/apps/web/messages/en/dashboards.json@@ -165,6 +165,7 @@"trigger": {"mention": "ran on mention in","delegation": "ran on delegation of",+ "field": "ran on a field of","manual": "ran manually","schedule": "ran on schedule"}diff --git a/apps/web/messages/en/filters.json b/apps/web/messages/en/filters.jsonindex 84ff3ba9..0b231516 100644--- a/apps/web/messages/en/filters.json+++ b/apps/web/messages/en/filters.json@@ -47,6 +47,7 @@"delegate": "No delegate","type": "No type","initiative": "No initiative",- "cycle": "No cycle"+ "cycle": "No cycle",+ "member": "No value"}}diff --git a/apps/web/messages/en/issue.json b/apps/web/messages/en/issue.jsonindex 6e901f99..5723375c 100644--- a/apps/web/messages/en/issue.json+++ b/apps/web/messages/en/issue.json@@ -309,7 +309,10 @@"state": "State","type": "Type","labels": "Labels",- "labelCount": "{count, plural, one {# label} other {# labels}}"+ "labelCount": "{count, plural, one {# label} other {# labels}}",+ "noMember": "Not set",+ "pickMember": "Pick someone…",+ "noCandidates": "Nobody to pick."},"watchers": {"watch": "Watch",diff --git a/apps/web/messages/en/settings.json b/apps/web/messages/en/settings.jsonindex e0d3fbb5..3edd0d76 100644--- a/apps/web/messages/en/settings.json+++ b/apps/web/messages/en/settings.json@@ -147,8 +147,10 @@"onMentionHint": "Run when @-mentioned in a comment.","onDelegation": "React to delegation","onDelegationHint": "Run when set as an issue's delegate.",- "delegationDelay": "Wait before starting",- "delegationDelayHint": "Time to keep editing the issue after delegating it. 0 starts at once.",+ "onFieldSet": "React to \"{field}\"",+ "onFieldSetHint": "Run when set as the value of this field on an issue.",+ "runDelay": "Wait before starting",+ "runDelayHint": "Time to keep editing the issue before the agent starts. 0 starts at once.","minutes": "min","runner": "Runner","runnerHint": "The process on your machine that executes this agent's tasks",@@ -244,7 +246,7 @@"testChat": "Test chat","moreActions": "More actions","createdOn": "Created {date}",- "runsSubtitle": "@{username} · mention and delegation runs",+ "runsSubtitle": "@{username} · triggered runs","regenerateMessage": "The current key for <v>{name}</v> stops working right away. Update everything that uses it with the new key.","deleteMessage": "<v>{name}</v> and its API key will be removed, and it will be cleared from any issues it was assigned or delegated to. This cannot be undone.","actionCount": "{count, plural, one {# action} other {# actions}}",@@ -253,6 +255,7 @@"triggersNone": "None","triggerMention": "Mention","triggerDelegation": "Delegation",+ "triggerFieldCount": "{count, plural, one {# field} other {# fields}}","noMatch": "No match for “{query}”.","useCustomModel": "Use \"{query}\"","readOnlyAlwaysOn": "Read-only access is always on and can't be turned off.",@@ -540,7 +543,8 @@"datetime": "date & time","datetime_range": "date & time range","select": "select",- "multi_select": "multi-select"+ "multi_select": "multi-select",+ "member": "member"},"global": "Global (all types)","globalShort": "Global",@@ -552,11 +556,19 @@"deleteTitle": "Delete field \"{name}\"","deleteMessage": "This field and any values set for it on issues will be removed. This cannot be undone.","namePlaceholder": "Field name",- "optionsPlaceholder": "Options: Low, Medium, High",+ "optionsPlaceholder": "Low, Medium, High",+ "options": "Options",+ "optionsHint": "Separate several with commas.","type": "Type",+ "memberScope": "Who it holds",+ "memberScopes": {+ "all": "Anyone",+ "humans": "People only",+ "agents": "Agents only"+ },"mainInfo": "Main info","mainInfoTooltip": "Shows in the issue body, not Properties",- "mainInfoMeta": "main info",+ "mainInfoMeta": "Main info","menu": "Custom field import and export","copy": "Copy custom fields","paste": "Paste custom fields",@@ -574,7 +586,11 @@"actionNew": "New","actionExists": "Exists","imported": "Applied custom fields: {created} created.",- "importedWithTypes": "Applied custom fields: {created} created, {types} issue types added."+ "importedWithTypes": "Applied custom fields: {created} created, {types} issue types added.",+ "removeOption": "Remove option {value}",+ "typeChangeWarning": "Changing the type clears the values issues already hold in this field.",+ "optionsRemovedWarning": "A removed option is cleared from the issues that hold it.",+ "memberScopeWarning": "Members the new scope does not allow are cleared from this field."},"actions": {"new": "New action",diff --git a/apps/web/messages/en/workItems.json b/apps/web/messages/en/workItems.jsonindex 09de1b63..d8176cf5 100644--- a/apps/web/messages/en/workItems.json+++ b/apps/web/messages/en/workItems.json@@ -109,6 +109,7 @@"noPriority": "No priority","noType": "No type","noInitiative": "No initiative",- "noCycle": "No cycle"+ "noCycle": "No cycle",+ "noMember": "No value"}}diff --git a/apps/web/messages/ru/dashboards.json b/apps/web/messages/ru/dashboards.jsonindex 56ec1da0..ef00b203 100644--- a/apps/web/messages/ru/dashboards.json+++ b/apps/web/messages/ru/dashboards.json@@ -165,6 +165,7 @@"trigger": {"mention": "запущен упоминанием в","delegation": "запущен делегированием",+ "field": "запущен полем в","manual": "запущен вручную","schedule": "запущен по расписанию"}diff --git a/apps/web/messages/ru/filters.json b/apps/web/messages/ru/filters.jsonindex f631db52..a789e138 100644--- a/apps/web/messages/ru/filters.json+++ b/apps/web/messages/ru/filters.json@@ -47,6 +47,7 @@"delegate": "Без делегата","type": "Без типа","initiative": "Без инициативы",- "cycle": "Без цикла"+ "cycle": "Без цикла",+ "member": "Не задано"}}diff --git a/apps/web/messages/ru/issue.json b/apps/web/messages/ru/issue.jsonindex 15ff5e69..8f6ce67b 100644--- a/apps/web/messages/ru/issue.json+++ b/apps/web/messages/ru/issue.json@@ -309,7 +309,10 @@"state": "Статус","type": "Тип","labels": "Метки",- "labelCount": "{count, plural, one {# метка} few {# метки} many {# меток} other {# метки}}"+ "labelCount": "{count, plural, one {# метка} few {# метки} many {# меток} other {# метки}}",+ "noMember": "Не задано",+ "pickMember": "Выбрать…",+ "noCandidates": "Некого выбрать."},"watchers": {"watch": "Следить",diff --git a/apps/web/messages/ru/settings.json b/apps/web/messages/ru/settings.jsonindex 0b65ad3d..19c8fa2c 100644--- a/apps/web/messages/ru/settings.json+++ b/apps/web/messages/ru/settings.json@@ -147,8 +147,10 @@"onMentionHint": "Запускается при @-упоминании в комментарии.","onDelegation": "Реагировать на делегирование","onDelegationHint": "Запускается, когда назначен делегатом задачи.",- "delegationDelay": "Пауза перед стартом",- "delegationDelayHint": "Время дописать задачу после делегирования. 0 — запуск сразу.",+ "onFieldSet": "Реагировать на «{field}»",+ "onFieldSetHint": "Запускается, когда назначен значением этого поля в задаче.",+ "runDelay": "Пауза перед стартом",+ "runDelayHint": "Время дописать задачу до старта агента. 0 — запуск сразу.","minutes": "мин","runner": "Раннер","runnerHint": "Процесс на вашей машине, который выполняет задачи этого агента",@@ -244,7 +246,7 @@"testChat": "Тестовый чат","moreActions": "Другие действия","createdOn": "Создан {date}",- "runsSubtitle": "@{username} · запуски по упоминаниям и делегированию",+ "runsSubtitle": "@{username} · запуски по триггерам","regenerateMessage": "Текущий ключ <v>{name}</v> перестанет работать сразу. Обновите новым ключом всё, что им пользуется.","deleteMessage": "<v>{name}</v> и его API-ключ будут удалены, а сам он снят со всех задач, где был исполнителем или делегатом. Это нельзя отменить.","actionCount": "{count, plural, one {# действие} few {# действия} many {# действий} other {# действия}}",@@ -253,6 +255,7 @@"triggersNone": "Нет","triggerMention": "Упоминание","triggerDelegation": "Делегирование",+ "triggerFieldCount": "{count, plural, one {# поле} few {# поля} many {# полей} other {# поля}}","noMatch": "Ничего не найдено по запросу «{query}».","useCustomModel": "Использовать «{query}»","readOnlyAlwaysOn": "Доступ на чтение включён всегда, его нельзя выключить.",@@ -540,7 +543,8 @@"datetime": "дата и время","datetime_range": "дата и диапазон времени","select": "выбор",- "multi_select": "мультивыбор"+ "multi_select": "мультивыбор",+ "member": "участник"},"global": "Общие (все типы)","globalShort": "Общее",@@ -552,11 +556,19 @@"deleteTitle": "Удалить поле «{name}»","deleteMessage": "Поле и все его значения в задачах будут удалены. Это нельзя отменить.","namePlaceholder": "Название поля",- "optionsPlaceholder": "Варианты: Низкий, Средний, Высокий",+ "optionsPlaceholder": "Низкий, Средний, Высокий",+ "options": "Варианты",+ "optionsHint": "Несколько — через запятую.","type": "Тип",+ "memberScope": "Кого можно выбрать",+ "memberScopes": {+ "all": "Любого",+ "humans": "Только людей",+ "agents": "Только агентов"+ },"mainInfo": "Основное","mainInfoTooltip": "Показывать в теле задачи, а не в свойствах",- "mainInfoMeta": "основное",+ "mainInfoMeta": "Основное","menu": "Импорт и экспорт пользовательских полей","copy": "Скопировать пользовательские поля","paste": "Вставить пользовательские поля",@@ -574,7 +586,11 @@"actionNew": "Новое","actionExists": "Существует","imported": "Применены пользовательские поля: {created} создано.",- "importedWithTypes": "Применены пользовательские поля: {created} создано, {types} типов задач добавлено."+ "importedWithTypes": "Применены пользовательские поля: {created} создано, {types} типов задач добавлено.",+ "removeOption": "Удалить вариант {value}",+ "typeChangeWarning": "Смена типа очистит значения, которые уже стоят в этом поле.",+ "optionsRemovedWarning": "Удалённый вариант пропадёт из задач, где он выбран.",+ "memberScopeWarning": "Участники, которых новый режим не допускает, будут очищены."},"actions": {"new": "Новое действие",diff --git a/apps/web/messages/ru/workItems.json b/apps/web/messages/ru/workItems.jsonindex 3a0fb3af..72af0d74 100644--- a/apps/web/messages/ru/workItems.json+++ b/apps/web/messages/ru/workItems.json@@ -109,6 +109,7 @@"noPriority": "Без приоритета","noType": "Без типа","noInitiative": "Без инициативы",- "noCycle": "Без цикла"+ "noCycle": "Без цикла",+ "noMember": "Не задано"}}diff --git a/apps/web/messages/uk/dashboards.json b/apps/web/messages/uk/dashboards.jsonindex 33ac0c34..36c83c89 100644--- a/apps/web/messages/uk/dashboards.json+++ b/apps/web/messages/uk/dashboards.json@@ -165,6 +165,7 @@"trigger": {"mention": "запущений згадкою в","delegation": "запущений делегуванням",+ "field": "запущений полем у","manual": "запущений вручну","schedule": "запущений за розкладом"}diff --git a/apps/web/messages/uk/filters.json b/apps/web/messages/uk/filters.jsonindex 16606884..0dfce4ad 100644--- a/apps/web/messages/uk/filters.json+++ b/apps/web/messages/uk/filters.json@@ -47,6 +47,7 @@"delegate": "Без делегата","type": "Без типу","initiative": "Без ініціативи",- "cycle": "Без циклу"+ "cycle": "Без циклу",+ "member": "Не задано"}}diff --git a/apps/web/messages/uk/issue.json b/apps/web/messages/uk/issue.jsonindex e49133fa..ab6b5e3e 100644--- a/apps/web/messages/uk/issue.json+++ b/apps/web/messages/uk/issue.json@@ -309,7 +309,10 @@"state": "Статус","type": "Тип","labels": "Мітки",- "labelCount": "{count, plural, one {# мітка} few {# мітки} many {# міток} other {# мітки}}"+ "labelCount": "{count, plural, one {# мітка} few {# мітки} many {# міток} other {# мітки}}",+ "noMember": "Не задано",+ "pickMember": "Вибрати…",+ "noCandidates": "Нема кого вибрати."},"watchers": {"watch": "Стежити",diff --git a/apps/web/messages/uk/settings.json b/apps/web/messages/uk/settings.jsonindex 2bfad7dc..015cf593 100644--- a/apps/web/messages/uk/settings.json+++ b/apps/web/messages/uk/settings.json@@ -147,8 +147,10 @@"onMentionHint": "Запускатися, коли згадали через @ у коментарі.","onDelegation": "Реагувати на делегування","onDelegationHint": "Запускатися, коли призначений делегатом задачі.",- "delegationDelay": "Пауза перед стартом",- "delegationDelayHint": "Час дописати задачу після делегування. 0 — запуск одразу.",+ "onFieldSet": "Реагувати на «{field}»",+ "onFieldSetHint": "Запускатися, коли призначений значенням цього поля в задачі.",+ "runDelay": "Пауза перед стартом",+ "runDelayHint": "Час дописати задачу до старту агента. 0 — запуск одразу.","minutes": "хв","runner": "Раннер","runnerHint": "Процес на вашій машині, який виконує завдання цього агента",@@ -244,7 +246,7 @@"testChat": "Тестовий чат","moreActions": "Інші дії","createdOn": "Створено {date}",- "runsSubtitle": "@{username} · запуски за згадками і делегуванням",+ "runsSubtitle": "@{username} · запуски за тригерами","regenerateMessage": "Поточний ключ <v>{name}</v> перестане працювати одразу. Оновіть новим ключем усе, що ним користується.","deleteMessage": "<v>{name}</v> та його API-ключ буде видалено, а сам агент прибереться з усіх задач, де він був виконавцем чи делегатом. Цю дію не можна скасувати.","actionCount": "{count, plural, one {# дія} few {# дії} many {# дій} other {# дії}}",@@ -253,6 +255,7 @@"triggersNone": "Немає","triggerMention": "Згадка","triggerDelegation": "Делегування",+ "triggerFieldCount": "{count, plural, one {# поле} few {# поля} many {# полів} other {# поля}}","noMatch": "Нічого не знайдено за «{query}».","useCustomModel": "Використати «{query}»","readOnlyAlwaysOn": "Доступ лише на читання завжди увімкнений, його не можна вимкнути.",@@ -540,7 +543,8 @@"datetime": "дата й час","datetime_range": "дата й діапазон часу","select": "вибір",- "multi_select": "мультивибір"+ "multi_select": "мультивибір",+ "member": "учасник"},"global": "Загальні (усі типи)","globalShort": "Загальне",@@ -552,11 +556,19 @@"deleteTitle": "Видалити поле «{name}»","deleteMessage": "Поле і всі його значення в задачах буде видалено. Це не можна скасувати.","namePlaceholder": "Назва поля",- "optionsPlaceholder": "Варіанти: Низький, Середній, Високий",+ "optionsPlaceholder": "Низький, Середній, Високий",+ "options": "Варіанти",+ "optionsHint": "Кілька — через кому.","type": "Тип",+ "memberScope": "Кого можна вибрати",+ "memberScopes": {+ "all": "Будь-кого",+ "humans": "Лише людей",+ "agents": "Лише агентів"+ },"mainInfo": "Основне","mainInfoTooltip": "Показувати в тілі задачі, а не у властивостях",- "mainInfoMeta": "основне",+ "mainInfoMeta": "Основне","menu": "Імпорт і експорт власних полів","copy": "Скопіювати власні поля","paste": "Вставити власні поля",@@ -574,7 +586,11 @@"actionNew": "Нове","actionExists": "Існує","imported": "Застосовано власні поля: {created} створено.",- "importedWithTypes": "Застосовано власні поля: {created} створено, {types} типів задач додано."+ "importedWithTypes": "Застосовано власні поля: {created} створено, {types} типів задач додано.",+ "removeOption": "Видалити варіант {value}",+ "typeChangeWarning": "Зміна типу очистить значення, які вже стоять у цьому полі.",+ "optionsRemovedWarning": "Видалений варіант зникне із задач, де він вибраний.",+ "memberScopeWarning": "Учасників, яких новий режим не допускає, буде очищено."},"actions": {"new": "Нова дія",diff --git a/apps/web/messages/uk/workItems.json b/apps/web/messages/uk/workItems.jsonindex 46df519b..536aa811 100644--- a/apps/web/messages/uk/workItems.json+++ b/apps/web/messages/uk/workItems.json@@ -109,6 +109,7 @@"noPriority": "Без пріоритету","noType": "Без типу","noInitiative": "Без ініціативи",- "noCycle": "Без циклу"+ "noCycle": "Без циклу",+ "noMember": "Не задано"}}diff --git a/apps/web/messages/zh-CN/dashboards.json b/apps/web/messages/zh-CN/dashboards.jsonindex 2df9ba23..aecefb58 100644--- a/apps/web/messages/zh-CN/dashboards.json+++ b/apps/web/messages/zh-CN/dashboards.json@@ -165,6 +165,7 @@"trigger": {"mention": "因以下位置的提及而运行:","delegation": "因以下工作项的委派而运行:",+ "field": "因以下工作项的字段而运行:","manual": "手动运行","schedule": "按定时任务运行"}diff --git a/apps/web/messages/zh-CN/filters.json b/apps/web/messages/zh-CN/filters.jsonindex afc2bdc7..db88e552 100644--- a/apps/web/messages/zh-CN/filters.json+++ b/apps/web/messages/zh-CN/filters.json@@ -47,6 +47,7 @@"delegate": "无执行代理","type": "无类型","initiative": "无计划",- "cycle": "无周期"+ "cycle": "无周期",+ "member": "无值"}}diff --git a/apps/web/messages/zh-CN/issue.json b/apps/web/messages/zh-CN/issue.jsonindex 171954a8..6c515e1c 100644--- a/apps/web/messages/zh-CN/issue.json+++ b/apps/web/messages/zh-CN/issue.json@@ -309,7 +309,10 @@"state": "状态","type": "类型","labels": "标签",- "labelCount": "{count, plural, other {# 个标签}}"+ "labelCount": "{count, plural, other {# 个标签}}",+ "noMember": "未设置",+ "pickMember": "选择…",+ "noCandidates": "没有可选对象。"},"watchers": {"watch": "关注",diff --git a/apps/web/messages/zh-CN/settings.json b/apps/web/messages/zh-CN/settings.jsonindex 5923c049..01600c59 100644--- a/apps/web/messages/zh-CN/settings.json+++ b/apps/web/messages/zh-CN/settings.json@@ -147,8 +147,10 @@"onMentionHint": "在评论中被 @ 提及时运行。","onDelegation": "响应委派","onDelegationHint": "设为工作项的执行代理时运行。",- "delegationDelay": "启动前等待",- "delegationDelayHint": "委派后继续编辑事项的时间。0 表示立即开始。",+ "onFieldSet": "响应“{field}”",+ "onFieldSetHint": "在工作项中被设为该字段的值时运行。",+ "runDelay": "启动前等待",+ "runDelayHint": "代理启动前继续编辑事项的时间。0 表示立即开始。","minutes": "分钟","runner": "运行器","runnerHint": "在你的机器上执行该智能体任务的进程",@@ -244,7 +246,7 @@"testChat": "测试对话","moreActions": "更多操作","createdOn": "创建于 {date}",- "runsSubtitle": "@{username} · 因提及或委派触发的运行",+ "runsSubtitle": "@{username} · 由触发器启动的运行","regenerateMessage": "<v>{name}</v> 的当前密钥会立即失效。请用新密钥更新所有使用它的地方。","deleteMessage": "<v>{name}</v> 及其 API 密钥将被删除,并从所有指派或委派给它的工作项中移除。此操作无法撤销。","actionCount": "{count, plural, other {# 个操作}}",@@ -253,6 +255,7 @@"triggersNone": "无","triggerMention": "提及","triggerDelegation": "委派",+ "triggerFieldCount": "{count, plural, other {# 个字段}}","noMatch": "没有与“{query}”匹配的结果。","useCustomModel": "使用“{query}”","readOnlyAlwaysOn": "只读权限始终启用,无法关闭。",@@ -540,7 +543,8 @@"datetime": "日期和时间","datetime_range": "日期和时间范围","select": "单选",- "multi_select": "多选"+ "multi_select": "多选",+ "member": "成员"},"global": "全局(所有类型)","globalShort": "全局",@@ -552,8 +556,16 @@"deleteTitle": "删除字段“{name}”","deleteMessage": "此字段及工作项中为它设置的所有值都会删除。此操作无法撤销。","namePlaceholder": "字段名称",- "optionsPlaceholder": "选项:低、中、高",+ "optionsPlaceholder": "低、中、高",+ "options": "选项",+ "optionsHint": "多个用逗号分隔。","type": "类型",+ "memberScope": "可选择的对象",+ "memberScopes": {+ "all": "任何人",+ "humans": "仅成员",+ "agents": "仅代理"+ },"mainInfo": "主要信息","mainInfoTooltip": "显示在工作项正文中,而不是“属性”区域","mainInfoMeta": "主要信息",@@ -574,7 +586,11 @@"actionNew": "新设","actionExists": "已存在","imported": "已应用自定义字段:新建 {created} 个。",- "importedWithTypes": "已应用自定义字段:新建 {created} 个,添加 {types} 个工作项类型。"+ "importedWithTypes": "已应用自定义字段:新建 {created} 个,添加 {types} 个工作项类型。",+ "removeOption": "删除选项 {value}",+ "typeChangeWarning": "更改类型会清除该字段中已有的值。",+ "optionsRemovedWarning": "删除的选项会从选中它的任务中清除。",+ "memberScopeWarning": "新范围不允许的成员会被清除。"},"actions": {"new": "新建操作",diff --git a/apps/web/messages/zh-CN/workItems.json b/apps/web/messages/zh-CN/workItems.jsonindex 36f890bd..d458bca2 100644--- a/apps/web/messages/zh-CN/workItems.json+++ b/apps/web/messages/zh-CN/workItems.json@@ -109,6 +109,7 @@"noPriority": "无优先级","noType": "无类型","noInitiative": "无计划",- "noCycle": "无周期"+ "noCycle": "无周期",+ "noMember": "无值"}}diff --git a/apps/web/src/components/layout/DisplayGroupingRows.tsx b/apps/web/src/components/layout/DisplayGroupingRows.tsxindex 7138c67d..a67f780f 100644--- a/apps/web/src/components/layout/DisplayGroupingRows.tsx+++ b/apps/web/src/components/layout/DisplayGroupingRows.tsx@@ -1,7 +1,15 @@import { ArrowDownNarrowWide, ArrowUpNarrowWide } from 'lucide-react';import { useTranslations } from 'next-intl';+import type { CustomField } from '@/lib/api';import { SORT_FIELDS, type SortField, type WorkItemsView } from '@/utils/viewTypes';-import { isFieldEnabled, type GroupField, type ViewSettings } from '@/utils/viewSettings';+import {+ customFieldKey,+ isFieldEnabled,+ type BuiltinGroupField,+ type GroupField,+ type ViewSettings,+} from '@/utils/viewSettings';+import { isMemberField } from '@/utils/memberFields';import { byKey } from '@/utils/messageKey';import { useProjectFeatures } from '@/hooks/useProjectFeatures';import { Button } from '@/components/ui/button';@@ -13,9 +21,9 @@ import DisplaySettingsSelect from '@/components/layout/DisplaySettingsSelect';// Timeline and Calendar ignore it.const ORDERING_VIEWS: WorkItemsView[] = ['kanban', 'table'];-// Grouping fields, in menu order. Project always groups by something, so it drops-// 'none'.-const GROUP_FIELDS: GroupField[] = [+// Grouping fields, in menu order, before the project's own member custom fields.+// Project always groups by something, so it drops 'none'.+const GROUP_FIELDS: BuiltinGroupField[] = ['none','status','assignee',@@ -34,10 +42,12 @@ const GROUP_FIELDS: GroupField[] = [export default function DisplayGroupingRows({view,settings,+ customFields,onChange,}: {view: WorkItemsView;settings: ViewSettings;+ customFields: CustomField[];onChange: (patch: Partial<ViewSettings>) => void;}) {const t = useTranslations('display.rows');@@ -48,17 +58,23 @@ export default function DisplayGroupingRows({const setGroup = (group: GroupField) =>onChange(group === settings.subgroup ? { group, subgroup: 'none' } : { group });- // Initiative and Cycle are only offered while the project shows their section.+ // Initiative and Cycle are only offered while the project shows their section. A+ // member custom field groups by whoever it holds, and is named by itself.const features = useProjectFeatures();const fields = GROUP_FIELDS.filter((f) => isFieldEnabled(f, features));- const toOptions = (values: GroupField[]) =>- values.map((value) => ({ value, label: groupLabel(value) }));+ const memberOptions = customFields+ .filter(isMemberField)+ .map((f) => ({ value: customFieldKey(f.id), label: f.name }));+ const toOptions = (values: BuiltinGroupField[]): { value: GroupField; label: string }[] => [+ ...values.map((value) => ({ value, label: groupLabel(value) })),+ ...memberOptions,+ ];const groupOptions = toOptions(view === 'kanban' || view === 'timeline' ? fields.filter((f) => f !== 'none') : fields,);// The sub-group never offers the field already used by the primary group.- const subgroupOptions = toOptions(fields.filter((f) => f !== settings.group));+ const subgroupOptions = toOptions(fields).filter((o) => o.value !== settings.group);const sortOptions = SORT_FIELDS.map((value) => ({ value, label: sortLabel(value) }));const showsGrouping = view === 'kanban' || view === 'table' || view === 'timeline';const showsSubgrouping = showsGrouping && settings.group !== 'none';diff --git a/apps/web/src/components/layout/DisplaySettingsBody.tsx b/apps/web/src/components/layout/DisplaySettingsBody.tsxindex 149236d8..244525e1 100644--- a/apps/web/src/components/layout/DisplaySettingsBody.tsx+++ b/apps/web/src/components/layout/DisplaySettingsBody.tsx@@ -32,7 +32,12 @@ export default function DisplaySettingsBody({<div className="space-y-2"><DisplayLayoutTabs view={view} onViewChange={onViewChange} />- <DisplayGroupingRows view={view} settings={settings} onChange={set} />+ <DisplayGroupingRows+ view={view}+ settings={settings}+ customFields={customFields}+ onChange={set}+ />{view === 'timeline' && <DisplayTimelineRows settings={settings} onChange={set} />}diff --git a/apps/web/src/features/issue/components/create/NewIssueBody.tsx b/apps/web/src/features/issue/components/create/NewIssueBody.tsxindex f6a4c56c..b6d9baf0 100644--- a/apps/web/src/features/issue/components/create/NewIssueBody.tsx+++ b/apps/web/src/features/issue/components/create/NewIssueBody.tsx@@ -1,5 +1,5 @@import { type Editor } from '@tiptap/react';-import { type CustomField, type IssueFieldValueInput } from '@/lib/api';+import { type Assignee, type CustomField, type IssueFieldValueInput } from '@/lib/api';import { cn } from '@/lib/utils';import { type Embeddable } from '../../utils/attachmentEmbed';import { DESCRIPTION_SECTION, OTHER_SECTION, fieldSection } from '../../utils/bodySections';@@ -23,6 +23,7 @@ export default function NewIssueBody({onDescriptionReady,bodyDefs,fieldValues,+ assignees,onFieldValue,onFieldEditorReady,uploadFile,@@ -37,6 +38,7 @@ export default function NewIssueBody({onDescriptionReady: (editor: Editor | null) => void;bodyDefs: CustomField[];fieldValues: Record<number, IssueFieldValueInput>;+ assignees: Assignee[];onFieldValue: (id: number, patch: IssueFieldValueInput) => void;onFieldEditorReady: (id: number, editor: Editor | null) => void;uploadFile: (file: File) => Promise<Embeddable>;@@ -114,7 +116,12 @@ export default function NewIssueBody({{pillDefs.length > 0 && (<div className={cn(sectionClass(OTHER_SECTION), 'overflow-y-auto')}>- <NewIssueBodyFields defs={pillDefs} values={fieldValues} onChange={onFieldValue} />+ <NewIssueBodyFields+ defs={pillDefs}+ values={fieldValues}+ assignees={assignees}+ onChange={onFieldValue}+ /></div>)}</div>diff --git a/apps/web/src/features/issue/components/create/NewIssueBodyFields.tsx b/apps/web/src/features/issue/components/create/NewIssueBodyFields.tsxindex 834381d6..2999331e 100644--- a/apps/web/src/features/issue/components/create/NewIssueBodyFields.tsx+++ b/apps/web/src/features/issue/components/create/NewIssueBodyFields.tsx@@ -1,4 +1,4 @@-import { type CustomField, type IssueFieldValueInput } from '@/lib/api';+import { type Assignee, type CustomField, type IssueFieldValueInput } from '@/lib/api';import IssueCustomFieldPill from '../fields/IssueCustomFieldPill';// The body fields that are not markdown, gathered in the "Other" section: a pill@@ -6,10 +6,12 @@ import IssueCustomFieldPill from '../fields/IssueCustomFieldPill';export default function NewIssueBodyFields({defs,values,+ assignees,onChange,}: {defs: CustomField[];values: Record<number, IssueFieldValueInput>;+ assignees: Assignee[];onChange: (id: number, patch: IssueFieldValueInput) => void;}) {return (@@ -22,6 +24,7 @@ export default function NewIssueBodyFields({<IssueCustomFieldPilldef={def}value={values[def.id]}+ assignees={assignees}onChange={(v) => onChange(def.id, v)}/></div>diff --git a/apps/web/src/features/issue/components/create/NewIssueModal.tsx b/apps/web/src/features/issue/components/create/NewIssueModal.tsxindex 2d76f901..18d7d0c3 100644--- a/apps/web/src/features/issue/components/create/NewIssueModal.tsx+++ b/apps/web/src/features/issue/components/create/NewIssueModal.tsx@@ -112,8 +112,14 @@ export default function NewIssueModal({() => fieldDefsForType(project.customFields, typeId),[project.customFields, typeId],);- const [activeFieldIds, setActiveFieldIds] = useState<number[]>([]);- const [fieldValues, setFieldValues] = useState<Record<number, IssueFieldValueInput>>({});+ // A member field the dialog was opened with (the board grouped by it) starts+ // filled in, and shows as a property row so it is visible before saving.+ const [activeFieldIds, setActiveFieldIds] = useState<number[]>(() =>+ (defaults.fieldValues ?? []).map((f) => f.fieldId),+ );+ const [fieldValues, setFieldValues] = useState<Record<number, IssueFieldValueInput>>(() =>+ Object.fromEntries((defaults.fieldValues ?? []).map((f) => [f.fieldId, { value: f.userId }])),+ );const [justAddedId, setJustAddedId] = useState<number | null>(null);const createIssue = useCreateIssue();@@ -301,8 +307,6 @@ export default function NewIssueModal({className={cn('flex min-h-0 flex-col', fullscreen && 'flex-1 overflow-hidden')}{...dragHandlers}>- {/* Not inside a relative box on purpose: the dialog itself is the- positioned ancestor, so the overlay covers the whole modal. */}{draggedFiles !== null && <NewIssueDropOverlay count={draggedFiles} />}<inputref={titleRef}@@ -316,9 +320,6 @@ export default function NewIssueModal({onChange={(e) => setTitle(e.target.value)}autoFocus/>- {/* The written content is the one part that gives up height, so the pills- and the footer stay in view however much of it there is. It scrolls- inside its editors, not here, which keeps the switcher in place. */}<div className={cn('flex min-h-0 flex-col overflow-hidden', fullscreen && 'flex-1')}><NewIssueBodysection={bodySection}@@ -329,6 +330,7 @@ export default function NewIssueModal({onDescriptionReady={setDescEditor}bodyDefs={bodyDefs}fieldValues={fieldValues}+ assignees={project.assignees}onFieldValue={setFieldValue}onFieldEditorReady={(id, editor) => {if (editor) fieldEditors.current.set(id, editor);@@ -400,18 +402,17 @@ export default function NewIssueModal({onChange={(v) => setDueDate(v ?? '')}/>- {/* Custom fields the user added, each with its own value editor. */}{activeDefs.map((def) => (<IssueCustomFieldPillkey={def.id}def={def}value={fieldValues[def.id]}+ assignees={project.assignees}defaultOpen={def.id === justAddedId}onChange={(v) => setFieldValue(def.id, v)}/>))}- {/* "…" menu to add a custom field to this issue. */}{availableDefs.length > 0 && (<Popover open={addFieldOpen} onOpenChange={setAddFieldOpen}><PopoverTrigger asChild>diff --git a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsxindex a51c1caf..2a92b80b 100644--- a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx+++ b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx@@ -128,8 +128,6 @@ export default function IssueDetailContent({)}</div>- {/* Read-only with nothing written is an empty block with a placeholder- inviting an edit that cannot happen. */}{(canEdit || issue.description.trim() !== '') && (<IssueMarkdownEditorclassName="mt-4"@@ -146,8 +144,6 @@ export default function IssueDetailContent({/>)}- {/* Custom fields flagged "show in main info" render below the description,- each under its own heading, rather than as a Properties row. */}{fieldDefs.filter((def) => def.showInBody).map((def) => (@@ -155,6 +151,7 @@ export default function IssueDetailContent({key={def.id}def={def}current={issue.fields.find((f) => f.fieldId === def.id)}+ assignees={project.assignees}saveKey={`${def.id}-${issue.updatedAt}-${replacements}`}uploadFile={uploadFile}imageAttachments={imageAttachments}@@ -245,10 +242,6 @@ export default function IssueDetailContent({imageByUserId={imageByUserId}/></div>- {/* Last in the column: a bottom-sticky box only lifts into view from a static- position below the viewport, so higher up it would never appear. Keyed by the- issue, because the panel keeps it mounted while it switches between issues and- each issue gets its own turn. */}<LastCommentBubblekey={issue.id}issueId={issue.id}@@ -268,10 +261,6 @@ export default function IssueDetailContent({return (<><div className="max-w-3xl xl:me-(--issue-properties-w)" style={propertiesWidthVar}>- {/* Stuck to the top of the scrolling page, with the same translucent,- blurred backdrop the side panel's header uses. The negative top- margin cancels the page's padding so the row starts where the title- would. */}<div className="sticky top-0 z-10 -mt-6 bg-background/85 pt-6 pb-3 backdrop-blur-md xl:hidden">{actions}</div>@@ -280,8 +269,6 @@ export default function IssueDetailContent({{sections}{activity}</div>- {/* The grip sits outside the scrolling box: a panel that scrolls on one- axis clips the other too, which would cut it off. */}<asideclassName="hidden xl:fixed xl:end-6 xl:top-16 xl:block xl:w-(--issue-properties-w)"style={propertiesWidthVar}diff --git a/apps/web/src/features/issue/components/detail/IssueProperties.tsx b/apps/web/src/features/issue/components/detail/IssueProperties.tsxindex e9fdde32..1ac7873a 100644--- a/apps/web/src/features/issue/components/detail/IssueProperties.tsx+++ b/apps/web/src/features/issue/components/detail/IssueProperties.tsx@@ -214,8 +214,6 @@ export default function IssueProperties({/></PropertyRow>- {/* Custom fields not flagged "show in main info". A markdown field here- spans both columns as a full-width block; the rest are property rows. */}{fieldDefs.filter((def) => !def.showInBody).map((def) => {@@ -227,6 +225,7 @@ export default function IssueProperties({<IssueCustomFieldBodydef={def}current={current}+ assignees={project.assignees}saveKey={saveKey}uploadFile={uploadFile}imageAttachments={imageAttachments}@@ -241,6 +240,7 @@ export default function IssueProperties({<IssueCustomFieldControldef={def}current={current}+ assignees={project.assignees}saveKey={saveKey}onChange={(value) => onSetField(def.id, value)}readOnly={readOnly}diff --git a/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx b/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsxindex cfeaa9de..2771a168 100644--- a/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx+++ b/apps/web/src/features/issue/components/detail/ReadOnlyIssueDetail.tsx@@ -65,6 +65,7 @@ export default function ReadOnlyIssueDetail({key={def.id}def={def}current={issue.fields.find((f) => f.fieldId === def.id)}+ assignees={project.assignees}saveKey={`${def.id}-${issue.updatedAt}`}onSetField={noop}readOnly@@ -79,8 +80,6 @@ export default function ReadOnlyIssueDetail({{extended && <ReadOnlyActivityFeed feed={feed} imageByUserId={imageByUserId} />}</div>- {/* Nothing sits above it in this column, so the section drops the room and- the separator it keeps for the block it follows in a single column. */}<aside className="w-[340px] shrink-0"><IssuePropertiesproject={project}diff --git a/apps/web/src/features/issue/components/fields/DelegateSelect.tsx b/apps/web/src/features/issue/components/fields/DelegateSelect.tsxindex 0f612d8c..ae8d15b9 100644--- a/apps/web/src/features/issue/components/fields/DelegateSelect.tsx+++ b/apps/web/src/features/issue/components/fields/DelegateSelect.tsx@@ -1,11 +1,10 @@import { CircleDashed } from 'lucide-react';import { useTranslations } from 'next-intl';import type { Assignee } from '@/lib/api';-import { useSession } from '@/lib/auth-client';import Avatar from '@/components/common/Avatar';import { Pill } from '@/components/common/fields/Pill';import PopoverPick from '@/components/common/fields/PopoverPick';-import { isForeignAgent } from '../../utils/delegates';+import { useCandidatePickItem } from '../../hooks/useCandidatePickItem';// The agent an issue is delegated to. `assignees` is the project's full candidate// list; this control filters it to agents. Members are set through AssigneeSelect.@@ -23,12 +22,10 @@ export default function DelegateSelect({readOnly?: boolean;}) {const t = useTranslations('issue.fieldSelects');- const { data: session } = useSession();- const currentUserId = session?.user.id ?? null;const none = t('noDelegate');const agents = assignees.filter((a) => a.kind === 'agent');const delegate = agents.find((a) => a.userId === value);- const byId = new Map(assignees.map((a) => [a.userId, a]));+ const toItem = useCandidatePickItem(assignees, value, onChange);return (<PopoverPick@@ -54,32 +51,7 @@ export default function DelegateSelect({selected: value == null,onSelect: () => onChange(null),},- ...agents.map((a) => {- // An agent bound to someone else runs nothing for you, so it is listed with- // its owner's avatar and cannot be picked.- const foreign = isForeignAgent(a, currentUserId);- const owner = a.restrictedToUserId ? byId.get(a.restrictedToUserId) : undefined;- const ownerLabel = owner- ? t('delegateOwnedBy', { name: owner.name })- : t('delegateOwnedByOther');- return {- key: a.userId,- search: a.name,- icon: <Avatar name={a.name} image={a.image} className="size-4 text-[8px]" />,- label: a.name,- selected: a.userId === value,- trailing: foreign ? (- <Avatar- name={owner?.name ?? ''}- image={owner?.image ?? null}- className="size-4 text-[8px]"- />- ) : undefined,- tooltip: foreign ? ownerLabel : undefined,- disabled: foreign,- onSelect: () => onChange(a.userId),- };- }),+ ...agents.map(toItem),]}/>);diff --git a/apps/web/src/features/issue/components/fields/IssueCustomFieldBody.tsx b/apps/web/src/features/issue/components/fields/IssueCustomFieldBody.tsxindex 8f4c4362..b49e4e67 100644--- a/apps/web/src/features/issue/components/fields/IssueCustomFieldBody.tsx+++ b/apps/web/src/features/issue/components/fields/IssueCustomFieldBody.tsx@@ -1,4 +1,9 @@-import { type CustomField, type IssueFieldValue, type IssueFieldValueInput } from '@/lib/api';+import {+ type Assignee,+ type CustomField,+ type IssueFieldValue,+ type IssueFieldValueInput,+} from '@/lib/api';import IssueMarkdownEditor from '../editor/IssueMarkdownEditor';import { type Embeddable } from '../../utils/attachmentEmbed';import IssueCustomFieldControl from './IssueCustomFieldControl';@@ -11,6 +16,7 @@ import { useTranslations } from 'next-intl';export default function IssueCustomFieldBody({def,current,+ assignees,saveKey,uploadFile,imageAttachments,@@ -19,6 +25,7 @@ export default function IssueCustomFieldBody({}: {def: CustomField;current: IssueFieldValue | undefined;+ assignees: Assignee[];saveKey: string;uploadFile?: (file: File) => Promise<Embeddable>;imageAttachments?: Embeddable[];@@ -49,6 +56,7 @@ export default function IssueCustomFieldBody({<IssueCustomFieldControldef={def}current={current}+ assignees={assignees}saveKey={saveKey}onChange={(value) => onSetField(def.id, value)}readOnly={readOnly}diff --git a/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx b/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsxindex 42f6ed0a..f556c0ab 100644--- a/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx+++ b/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx@@ -1,4 +1,9 @@-import { type CustomField, type IssueFieldValue, type IssueFieldValueInput } from '@/lib/api';+import {+ type Assignee,+ type CustomField,+ type IssueFieldValue,+ type IssueFieldValueInput,+} from '@/lib/api';import { formatDate, formatDateTimeRange } from '@/utils/dates';import { Button } from '@/components/ui/button';import { Checkbox } from '@/components/ui/checkbox';@@ -11,6 +16,8 @@ import {SelectTrigger,SelectValue,} from '@/components/ui/select';+import Avatar from '@/components/common/Avatar';+import MemberSelect from './MemberSelect';import InlineUrlField from './InlineUrlField';import InlineTextField from './InlineTextField';import { useTranslations } from 'next-intl';@@ -26,12 +33,14 @@ const NONE = '__none__';export default function IssueCustomFieldControl({def,current,+ assignees,saveKey,onChange,readOnly,}: {def: CustomField;current: IssueFieldValue | undefined;+ assignees: Assignee[];saveKey: string;onChange: (value: IssueFieldValueInput) => void;readOnly?: boolean;@@ -59,6 +68,16 @@ export default function IssueCustomFieldControl({</span>);}+ if (def.fieldType === 'member') {+ const member = assignees.find((a) => a.userId === current?.value);+ if (!member) return <span className="text-sm text-muted-foreground">—</span>;+ return (+ <span className="flex items-center gap-1.5 text-sm">+ <Avatar name={member.name} image={member.image} className="size-4 text-[8px]" />+ {member.name}+ </span>+ );+ }if (def.fieldType === 'boolean') {return <span className="text-sm">{current?.value ? t('yes') : t('no')}</span>;}@@ -73,6 +92,18 @@ export default function IssueCustomFieldControl({return <span className="text-sm">{String(v)}</span>;}+ if (def.fieldType === 'member') {+ return (+ <MemberSelect+ assignees={assignees}+ scope={def.memberScope ?? 'all'}+ value={(current?.value as string | null) ?? null}+ placeholder={def.name}+ onChange={(userId) => onChange({ value: userId })}+ />+ );+ }+if (def.fieldType === 'url') {return (<InlineUrlFielddiff --git a/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx b/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsxindex fd17a224..a8e6dcf7 100644--- a/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx+++ b/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx@@ -1,6 +1,6 @@import { useState } from 'react';import { Check } from 'lucide-react';-import { type CustomField, type IssueFieldValueInput } from '@/lib/api';+import { type Assignee, type CustomField, type IssueFieldValueInput } from '@/lib/api';import { cn } from '@/lib/utils';import {Command,@@ -15,6 +15,7 @@ import { colorDot } from '@/components/common/fields/colorDot';import DatePill from '@/components/common/fields/DatePill';import DateTimePill from '@/components/common/fields/DateTimePill';import { Pill } from '@/components/common/fields/Pill';+import MemberSelect from './MemberSelect';import { useTranslations } from 'next-intl';// A pill + popover editor for a single non-markdown custom field, used in the@@ -22,17 +23,31 @@ import { useTranslations } from 'next-intl';export default function IssueCustomFieldPill({def,value,+ assignees,onChange,defaultOpen = false,}: {def: CustomField;value: IssueFieldValueInput | undefined;+ assignees: Assignee[];onChange: (v: IssueFieldValueInput) => void;defaultOpen?: boolean;}) {const t = useTranslations('issue.customFields');const [open, setOpen] = useState(defaultOpen);+ if (def.fieldType === 'member') {+ return (+ <MemberSelect+ assignees={assignees}+ scope={def.memberScope ?? 'all'}+ value={(value?.value as string | null) ?? null}+ placeholder={def.name}+ onChange={(userId) => onChange({ value: userId })}+ />+ );+ }+if (def.fieldType === 'boolean') {const on = value?.value === true;return (diff --git a/apps/web/src/features/issue/components/fields/MemberSelect.tsx b/apps/web/src/features/issue/components/fields/MemberSelect.tsxnew file mode 100644index 00000000..e1bd1272--- /dev/null+++ b/apps/web/src/features/issue/components/fields/MemberSelect.tsx@@ -0,0 +1,68 @@+import { CircleDashed } from 'lucide-react';+import { useTranslations } from 'next-intl';+import type { Assignee, MemberScope } from '@/lib/api';+import Avatar from '@/components/common/Avatar';+import { Pill } from '@/components/common/fields/Pill';+import PopoverPick from '@/components/common/fields/PopoverPick';+import { memberCandidates } from '@/utils/memberFields';+import { useCandidatePickItem } from '../../hooks/useCandidatePickItem';++// The candidates the field's scope offers, listed with the people before the agents.+function candidates(assignees: Assignee[], scope: MemberScope): Assignee[] {+ const offered = memberCandidates(assignees, scope);+ return [+ ...offered.filter((a) => a.kind === 'member'),+ ...offered.filter((a) => a.kind === 'agent'),+ ];+}++// The person or agent a member custom field holds. Which of them the field offers is+// its scope, chosen when the field was created. Shaped like AssigneeSelect and+// DelegateSelect, which do the same for the built-in fields.+export default function MemberSelect({+ assignees,+ scope,+ value,+ onChange,+ placeholder,+}: {+ assignees: Assignee[];+ scope: MemberScope;+ value: string | null;+ onChange: (userId: string | null) => void;+ placeholder?: string;+}) {+ const t = useTranslations('issue.fieldSelects');+ const none = t('noMember');+ const options = candidates(assignees, scope);+ const selected = options.find((a) => a.userId === value);+ const toItem = useCandidatePickItem(assignees, value, onChange);++ return (+ <PopoverPick+ trigger={+ <Pill active={!!selected}>+ {selected ? (+ <Avatar name={selected.name} image={selected.image} className="size-4 text-[8px]" />+ ) : (+ <CircleDashed />+ )}+ <span className="truncate">{selected?.name ?? placeholder ?? none}</span>+ </Pill>+ }+ inputPlaceholder={t('pickMember')}+ emptyText={t('noCandidates')}+ items={[+ {+ key: 'none',+ search: none,+ icon: <CircleDashed />,+ label: none,+ selected: value == null,+ onSelect: () => onChange(null),+ },+ ...options.map(toItem),+ ]}+ />+ );+}diff --git a/apps/web/src/features/issue/hooks/useCandidatePickItem.tsx b/apps/web/src/features/issue/hooks/useCandidatePickItem.tsxnew file mode 100644index 00000000..311602cb--- /dev/null+++ b/apps/web/src/features/issue/hooks/useCandidatePickItem.tsx@@ -0,0 +1,46 @@+import { useTranslations } from 'next-intl';+import type { Assignee } from '@/lib/api';+import { useSession } from '@/lib/auth-client';+import Avatar from '@/components/common/Avatar';+import type { PickItem } from '@/components/common/fields/PopoverPick';+import { isForeignAgent } from '../utils/delegates';++// Builds the row one candidate gets in a picker over the project's people and agents,+// shared by the controls that write such a candidate to an issue. An agent bound to+// someone else runs nothing for you, so it is listed with its owner's avatar and+// cannot be picked.+export function useCandidatePickItem(+ assignees: Assignee[],+ value: string | null,+ onChange: (userId: string) => void,+) {+ const t = useTranslations('issue.fieldSelects');+ const { data: session } = useSession();+ const currentUserId = session?.user.id ?? null;+ const byId = new Map(assignees.map((a) => [a.userId, a]));++ return (a: Assignee): PickItem => {+ const foreign = a.kind === 'agent' && isForeignAgent(a, currentUserId);+ const owner = a.restrictedToUserId ? byId.get(a.restrictedToUserId) : undefined;+ const ownerLabel = owner+ ? t('delegateOwnedBy', { name: owner.name })+ : t('delegateOwnedByOther');+ return {+ key: a.userId,+ search: a.name,+ icon: <Avatar name={a.name} image={a.image} className="size-4 text-[8px]" />,+ label: a.name,+ selected: a.userId === value,+ trailing: foreign ? (+ <Avatar+ name={owner?.name ?? ''}+ image={owner?.image ?? null}+ className="size-4 text-[8px]"+ />+ ) : undefined,+ tooltip: foreign ? ownerLabel : undefined,+ disabled: foreign,+ onSelect: () => onChange(a.userId),+ };+ };+}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentDelayInput.tsx b/apps/web/src/features/settings/components/ai-agents/AgentDelayInput.tsxnew file mode 100644index 00000000..cd89bac2--- /dev/null+++ b/apps/web/src/features/settings/components/ai-agents/AgentDelayInput.tsx@@ -0,0 +1,39 @@+import { Input } from '@/components/ui/input';+import { useTranslations } from 'next-intl';++// How long a triggered run waits before the agent may pick it up, in minutes. Both+// the delegation trigger and each field trigger carry one.+export function AgentDelayInput({+ id,+ value,+ onChange,+}: {+ id: string;+ value: string;+ onChange: (value: string) => void;+}) {+ const t = useTranslations('settings.agents');+ return (+ <div className="flex items-center justify-between gap-2 border-s ps-3">+ <span>+ <label htmlFor={id} className="text-sm">+ {t('runDelay')}+ </label>+ <span className="block text-xs text-muted-foreground">{t('runDelayHint')}</span>+ </span>+ <div className="flex shrink-0 items-center gap-2">+ <Input+ id={id}+ type="number"+ step="1"+ min="0"+ max="1440"+ className="w-20"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ />+ <span className="text-xs text-muted-foreground">{t('minutes')}</span>+ </div>+ </div>+ );+}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentMetaRow.tsx b/apps/web/src/features/settings/components/ai-agents/AgentMetaRow.tsxindex af3ad887..87d9cc50 100644--- a/apps/web/src/features/settings/components/ai-agents/AgentMetaRow.tsx+++ b/apps/web/src/features/settings/components/ai-agents/AgentMetaRow.tsx@@ -1,5 +1,5 @@import type { ComponentType } from 'react';-import { AtSign, BookOpen, Sparkles, UserRoundCheck, Wrench, Zap } from 'lucide-react';+import { AtSign, BookOpen, ListChecks, Sparkles, UserRoundCheck, Wrench, Zap } from 'lucide-react';import type { AiAgent } from '@/lib/api';import { cn } from '@/lib/utils';import { useTranslations } from 'next-intl';@@ -53,11 +53,12 @@ export function AgentMetaRow({);}-// The enabled run triggers for an internal agent (mention, delegation), or a muted-// dash when none are on.+// The enabled run triggers for an internal agent (mention, delegation, member+// fields), or a muted dash when none are on.export function AgentTriggers({ agent }: { agent: AiAgent }) {const t = useTranslations('settings.agents');- if (!agent.triggerOnMention && !agent.triggerOnAssign) {+ const fieldCount = agent.fieldTriggers.length;+ if (!agent.triggerOnMention && !agent.triggerOnAssign && fieldCount === 0) {return <span className="text-xs text-muted-foreground">{t('triggersNone')}</span>;}return (@@ -72,6 +73,11 @@ export function AgentTriggers({ agent }: { agent: AiAgent }) {{t('triggerDelegation')}</MetaChip>)}+ {fieldCount > 0 && (+ <MetaChip icon={ListChecks} accent>+ {t('triggerFieldCount', { count: fieldCount })}+ </MetaChip>+ )}</div>);}diff --git a/apps/web/src/features/settings/components/ai-agents/AgentTriggersSection.tsx b/apps/web/src/features/settings/components/ai-agents/AgentTriggersSection.tsxindex 53dbbe34..67f789ef 100644--- a/apps/web/src/features/settings/components/ai-agents/AgentTriggersSection.tsx+++ b/apps/web/src/features/settings/components/ai-agents/AgentTriggersSection.tsx@@ -1,25 +1,52 @@+import { Fragment } from 'react';import { Zap } from 'lucide-react';-import { Input } from '@/components/ui/input';import { Switch } from '@/components/ui/switch';+import { isMemberField } from '@/utils/memberFields';+import { useProjectQuery } from '@/services/projects.service';import type { AgentFormValue } from '../../utils/agentForm';+import { AgentDelayInput } from './AgentDelayInput';import { AgentFormSection } from './AgentFormSection';import { useTranslations } from 'next-intl';-// What starts a run: a mention in a comment, or being made an issue's delegate. The-// delegation delay only applies to the second, so it is shown with it.+// What starts a run: a mention in a comment, being made an issue's delegate, or being+// set into a member custom field that holds agents. Every trigger but the mention+// carries the wait before the run starts, so one field can start at once while+// another leaves time to edit the issue.export default function AgentTriggersSection({open,onOpenChange,+ projectKey,value,onChange,}: {open: boolean;onOpenChange: (open: boolean) => void;+ projectKey: string;value: AgentFormValue;onChange: (patch: Partial<AgentFormValue>) => void;}) {const t = useTranslations('settings.agents');- const enabled = [value.triggerOnMention, value.triggerOnAssign].filter(Boolean).length;+ const customFields = useProjectQuery(projectKey).data?.customFields ?? [];+ const memberFields = customFields.filter((f) => isMemberField(f) && f.memberScope !== 'humans');+ const enabled =+ [value.triggerOnMention, value.triggerOnAssign].filter(Boolean).length ++ memberFields.filter((f) => value.fieldTriggers.some((tr) => tr.fieldId === f.id)).length;++ function toggleField(id: number, on: boolean) {+ onChange({+ fieldTriggers: on+ ? [...value.fieldTriggers, { fieldId: id, delayMin: '0' }]+ : value.fieldTriggers.filter((tr) => tr.fieldId !== id),+ });+ }++ function setFieldDelay(id: number, delayMin: string) {+ onChange({+ fieldTriggers: value.fieldTriggers.map((tr) =>+ tr.fieldId === id ? { ...tr, delayMin } : tr,+ ),+ });+ }return (<AgentFormSection@@ -29,7 +56,7 @@ export default function AgentTriggersSection({icon={Zap}title={t('triggers')}hint={t('triggersHint')}- headerRight={`${enabled} / 2`}+ headerRight={`${enabled} / ${2 + memberFields.length}`}><label className="flex cursor-pointer items-center justify-between gap-2"><span>@@ -52,28 +79,33 @@ export default function AgentTriggersSection({/></label>{value.triggerOnAssign && (- <div className="flex items-center justify-between gap-2 border-s ps-3">- <span>- <label htmlFor="agent-delegation-delay" className="text-sm">- {t('delegationDelay')}- </label>- <span className="block text-xs text-muted-foreground">{t('delegationDelayHint')}</span>- </span>- <div className="flex shrink-0 items-center gap-2">- <Input- id="agent-delegation-delay"- type="number"- step="1"- min="0"- max="1440"- className="w-20"- value={value.delegationDelayMin}- onChange={(e) => onChange({ delegationDelayMin: e.target.value })}- />- <span className="text-xs text-muted-foreground">{t('minutes')}</span>- </div>- </div>+ <AgentDelayInput+ id="agent-delegation-delay"+ value={value.delegationDelayMin}+ onChange={(v) => onChange({ delegationDelayMin: v })}+ />)}+ {memberFields.map((field) => {+ const trigger = value.fieldTriggers.find((tr) => tr.fieldId === field.id);+ return (+ <Fragment key={field.id}>+ <label className="flex cursor-pointer items-center justify-between gap-2">+ <span>+ <span className="text-sm">{t('onFieldSet', { field: field.name })}</span>+ <span className="block text-xs text-muted-foreground">{t('onFieldSetHint')}</span>+ </span>+ <Switch checked={trigger != null} onCheckedChange={(v) => toggleField(field.id, v)} />+ </label>+ {trigger && (+ <AgentDelayInput+ id={`agent-field-delay-${field.id}`}+ value={trigger.delayMin}+ onChange={(v) => setFieldDelay(field.id, v)}+ />+ )}+ </Fragment>+ );+ })}</AgentFormSection>);}diff --git a/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentFields.tsx b/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentFields.tsxindex 8f9ddcc8..bd0e9d70 100644--- a/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentFields.tsx+++ b/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentFields.tsx@@ -208,6 +208,7 @@ export default function SettingsAiAgentFields({<AgentTriggersSectionkey="triggers"{...sectionProps('triggers')}+ projectKey={projectKey}value={value}onChange={onChange}/>diff --git a/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentRunsSheet.tsx b/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentRunsSheet.tsxindex 817107f4..1487adf3 100644--- a/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentRunsSheet.tsx+++ b/apps/web/src/features/settings/components/ai-agents/SettingsAiAgentRunsSheet.tsx@@ -19,9 +19,9 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltipimport { useTranslations } from 'next-intl';// Run history for an agent, in a right-side sidebar. Shows the triggered runs (a-// mention or a delegation) 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.+// 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 SettingsAiAgentRunsSheet({projectKey,agent,diff --git a/apps/web/src/features/settings/components/custom-fields/CustomFieldMeta.tsx b/apps/web/src/features/settings/components/custom-fields/CustomFieldMeta.tsxnew file mode 100644index 00000000..2cf59e06--- /dev/null+++ b/apps/web/src/features/settings/components/custom-fields/CustomFieldMeta.tsx@@ -0,0 +1,39 @@+import { ChevronRight } from 'lucide-react';+import { useTranslations } from 'next-intl';+import type { CustomField } from '@/lib/api';+import { FIELD_TYPE_ICONS, useFieldTypeLabel } from '../../utils/fieldTypes';++// What a field is, at the end of its row: its type, then what that type lets the field+// hold — the options of a select, or the people a member field is narrowed to.+export default function CustomFieldMeta({ field }: { field: CustomField }) {+ const t = useTranslations('settings.customFields');+ const fieldTypeLabel = useFieldTypeLabel();+ const Icon = FIELD_TYPE_ICONS[field.fieldType];++ let holds: string | null = null;+ if (field.options.length > 0) {+ holds = field.options.map((o) => o.value).join(', ');+ } else if (field.memberScope != null && field.memberScope !== 'all') {+ holds = t(`memberScopes.${field.memberScope}`);+ }++ return (+ <span className="flex items-center gap-2">+ <span className="flex items-center gap-1.5">+ <Icon className="size-3.5 shrink-0" />+ {fieldTypeLabel(field.fieldType)}+ </span>+ {holds != null && (+ <span className="hidden items-center gap-2 sm:flex">+ <ChevronRight className="size-3.5 shrink-0 rtl:rotate-180" />+ <span className="max-w-56 truncate text-muted-foreground/80">{holds}</span>+ </span>+ )}+ {field.showInBody && (+ <span className="rounded bg-primary/10 px-1.5 py-0.5 text-foreground">+ {t('mainInfoMeta')}+ </span>+ )}+ </span>+ );+}diff --git a/apps/web/src/features/settings/components/custom-fields/CustomFieldsImportDialog.tsx b/apps/web/src/features/settings/components/custom-fields/CustomFieldsImportDialog.tsxindex 4d7af496..9cd28e74 100644--- a/apps/web/src/features/settings/components/custom-fields/CustomFieldsImportDialog.tsx+++ b/apps/web/src/features/settings/components/custom-fields/CustomFieldsImportDialog.tsx@@ -8,7 +8,7 @@ import Modal from '@/components/common/overlay/Modal';import { Badge } from '@/components/ui/badge';import { Button } from '@/components/ui/button';import { useCreateCustomField, useCreateIssueType } from '../../services/settings.service';-import { useFieldTypeLabel } from './SettingsCustomFieldForm';+import { useFieldTypeLabel } from '../../utils/fieldTypes';import type { CustomFieldsImportPlan } from '../../utils/customFieldsTransfer';// Confirms a custom fields paste before applying it. Lists any issue types that will be@@ -53,6 +53,7 @@ export default function CustomFieldsImportDialog({issueTypeId,name: field.name,fieldType: field.fieldType,+ memberScope: field.memberScope ?? undefined,showInBody: field.showInBody,options: field.options,});diff --git a/apps/web/src/features/settings/components/custom-fields/FieldChangeWarning.tsx b/apps/web/src/features/settings/components/custom-fields/FieldChangeWarning.tsxnew file mode 100644index 00000000..0a75533a--- /dev/null+++ b/apps/web/src/features/settings/components/custom-fields/FieldChangeWarning.tsx@@ -0,0 +1,11 @@+import { TriangleAlert } from 'lucide-react';++// What a pending change will do to the values issues already hold.+export default function FieldChangeWarning({ children }: { children: string }) {+ return (+ <p className="flex items-start gap-2 rounded-md bg-warning/15 px-2.5 py-2 text-xs">+ <TriangleAlert className="mt-0.5 size-3.5 shrink-0 text-warning" />+ {children}+ </p>+ );+}diff --git a/apps/web/src/features/settings/components/custom-fields/FieldOptionsEditor.tsx b/apps/web/src/features/settings/components/custom-fields/FieldOptionsEditor.tsxnew file mode 100644index 00000000..cf4df32f--- /dev/null+++ b/apps/web/src/features/settings/components/custom-fields/FieldOptionsEditor.tsx@@ -0,0 +1,98 @@+import { X } from 'lucide-react';+import { useTranslations } from 'next-intl';+import { Button } from '@/components/ui/button';+import { Input } from '@/components/ui/input';+import { Label } from '@/components/ui/label';++// One row of the editor. `key` is local and stable across edits, so typing in a row+// does not move the focus when the rows above it change; `id` is the option's own id,+// absent on a row that does not exist yet.+export interface OptionDraft {+ key: string;+ id?: number;+ value: string;+}++// Splits the comma-separated field into option values, dropping the blanks.+export function parseOptionValues(text: string): string[] {+ return text+ .split(',')+ .map((value) => value.trim())+ .filter(Boolean);+}++// The options of a select field: one row per option, renamed in place or removed,+// plus a field that takes several new ones at once. What the add field still holds+// when the form is submitted counts as typed, so a quick "Low, Medium, High" needs+// no extra click.+export default function FieldOptionsEditor({+ options,+ onChange,+ pending,+ onPendingChange,+}: {+ options: OptionDraft[];+ onChange: (options: OptionDraft[]) => void;+ // The add field's text, held by the form so submitting can pick it up.+ pending: string;+ onPendingChange: (value: string) => void;+}) {+ const t = useTranslations('settings.customFields');++ function commitPending() {+ const values = parseOptionValues(pending);+ if (values.length === 0) return;+ onChange([...options, ...values.map((value) => ({ key: crypto.randomUUID(), value }))]);+ onPendingChange('');+ }++ return (+ <div className="space-y-1.5">+ <Label htmlFor="custom-field-options">{t('options')}</Label>++ {options.length > 0 && (+ <div className="space-y-1">+ {options.map((option, index) => (+ <div key={option.key} className="flex items-center gap-1">+ <Input+ value={option.value}+ onChange={(e) =>+ onChange(+ options.map((o, i) => (i === index ? { ...o, value: e.target.value } : o)),+ )+ }+ className="h-9"+ />+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="size-9 shrink-0 text-muted-foreground hover:text-foreground"+ aria-label={t('removeOption', { value: option.value })}+ onClick={() => onChange(options.filter((_, i) => i !== index))}+ >+ <X />+ </Button>+ </div>+ ))}+ </div>+ )}++ <Input+ id="custom-field-options"+ value={pending}+ onChange={(e) => onPendingChange(e.target.value)}+ onBlur={commitPending}+ onKeyDown={(e) => {+ if (e.key !== 'Enter') return;+ // Enter belongs to the option being typed, not to the form.+ e.preventDefault();+ commitPending();+ }}+ placeholder={t('optionsPlaceholder')}+ className="h-9"+ />+ <p className="text-xs text-muted-foreground">{t('optionsHint')}</p>+ </div>+ );+}diff --git a/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldDialog.tsx b/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldDialog.tsxnew file mode 100644index 00000000..32d66216--- /dev/null+++ b/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldDialog.tsx@@ -0,0 +1,217 @@+import { useState } from 'react';+import { useTranslations } from 'next-intl';+import { type CustomField, type CustomFieldType, type MemberScope } from '@/lib/api';+import { cn } from '@/lib/utils';+import Modal from '@/components/common/overlay/Modal';+import { Button } from '@/components/ui/button';+import { Input } from '@/components/ui/input';+import { Label } from '@/components/ui/label';+import { Switch } from '@/components/ui/switch';+import {+ FIELD_TYPES,+ FIELD_TYPE_ICONS,+ MEMBER_SCOPES,+ useFieldTypeLabel,+} from '../../utils/fieldTypes';+import FieldChangeWarning from './FieldChangeWarning';+import FieldOptionsEditor, { parseOptionValues, type OptionDraft } from './FieldOptionsEditor';++export interface FieldFormValues {+ name: string;+ fieldType: CustomFieldType;+ memberScope?: MemberScope;+ showInBody: boolean;+ options: { id?: number; value: string }[];+}++const CHOICE_CLASS =+ 'rounded-md text-sm transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none';+const CHOICE_ON = 'bg-primary/10 font-medium text-foreground';+const CHOICE_OFF = 'text-muted-foreground hover:bg-accent hover:text-accent-foreground';++function holdsOptions(fieldType: CustomFieldType): boolean {+ return fieldType === 'select' || fieldType === 'multi_select';+}++// The dialog that adds or edits one custom field: its name, its type picked from a+// grid, the settings that type brings (the options of a select, who a member field+// holds), and where it renders on the issue. Everything stays editable afterwards;+// a change that the values already stored cannot survive says so before it is saved.+export default function SettingsCustomFieldDialog({+ group,+ initial,+ onSubmit,+ onClose,+}: {+ // The group the field belongs to, named in the dialog header: an issue type or+ // the project-wide scope.+ group: string;+ // The field being edited; absent while adding one.+ initial?: CustomField;+ onSubmit: (values: FieldFormValues) => void;+ onClose: () => void;+}) {+ const t = useTranslations('settings.customFields');+ const tCommon = useTranslations('common');+ const fieldTypeLabel = useFieldTypeLabel();+ const [name, setName] = useState(initial?.name ?? '');+ const [fieldType, setFieldType] = useState<CustomFieldType>(initial?.fieldType ?? 'text');+ const [memberScope, setMemberScope] = useState<MemberScope>(initial?.memberScope ?? 'all');+ const [showInBody, setShowInBody] = useState(initial?.showInBody ?? false);+ const [options, setOptions] = useState<OptionDraft[]>(+ () => initial?.options.map((o) => ({ key: `option-${o.id}`, id: o.id, value: o.value })) ?? [],+ );+ const [pendingOptions, setPendingOptions] = useState('');+ const isMember = fieldType === 'member';++ // What the values issues already hold will not survive. Only an existing field has+ // any, so a new one warns about nothing.+ const typeChanged = initial != null && fieldType !== initial.fieldType;+ const scopeNarrowed =+ initial != null &&+ !typeChanged &&+ isMember &&+ memberScope !== 'all' &&+ memberScope !== initial.memberScope;+ const optionsRemoved = (initial?.options ?? []).some((o) => !options.some((d) => d.id === o.id));++ // Picking a type presets the placement to its default (body for markdown,+ // properties otherwise); the user can still flip it before saving.+ function changeType(next: CustomFieldType) {+ setFieldType(next);+ setShowInBody(next === 'markdown');+ }++ function submit() {+ if (!name.trim()) return;+ const typed = parseOptionValues(pendingOptions).map((value) => ({ value }));+ onSubmit({+ name: name.trim(),+ fieldType,+ memberScope: isMember ? memberScope : undefined,+ showInBody,+ options: holdsOptions(fieldType)+ ? [+ ...options.map((o) => ({ id: o.id, value: o.value.trim() })).filter((o) => o.value),+ ...typed,+ ]+ : [],+ });+ }++ return (+ <Modal title={t(initial ? 'editField' : 'addField')} crumb={group} onClose={onClose} wide>+ <form+ className="space-y-8"+ onSubmit={(event) => {+ event.preventDefault();+ submit();+ }}+ >+ <div className="space-y-1.5">+ <Label htmlFor="custom-field-name">{tCommon('name')}</Label>+ <Input+ id="custom-field-name"+ autoFocus+ required+ value={name}+ onChange={(e) => setName(e.target.value)}+ placeholder={t('namePlaceholder')}+ className="h-9"+ />+ </div>++ <div className="space-y-4">+ <div className="space-y-1.5">+ <Label>{t('type')}</Label>+ <div+ role="radiogroup"+ aria-label={t('type')}+ className="grid grid-cols-2 gap-x-2 gap-y-1 sm:grid-cols-3"+ >+ {FIELD_TYPES.map((option) => {+ const Icon = FIELD_TYPE_ICONS[option];+ const active = option === fieldType;+ return (+ <button+ key={option}+ type="button"+ role="radio"+ aria-checked={active}+ onClick={() => changeType(option)}+ className={cn(+ CHOICE_CLASS,+ 'flex h-9 items-center gap-2 px-2.5',+ active ? CHOICE_ON : CHOICE_OFF,+ )}+ >+ <Icon className="size-4 shrink-0" />+ <span className="truncate">{fieldTypeLabel(option)}</span>+ </button>+ );+ })}+ </div>+ {typeChanged && <FieldChangeWarning>{t('typeChangeWarning')}</FieldChangeWarning>}+ </div>++ {holdsOptions(fieldType) && (+ <div className="space-y-1.5">+ <FieldOptionsEditor+ options={options}+ onChange={setOptions}+ pending={pendingOptions}+ onPendingChange={setPendingOptions}+ />+ {optionsRemoved && (+ <FieldChangeWarning>{t('optionsRemovedWarning')}</FieldChangeWarning>+ )}+ </div>+ )}++ {isMember && (+ <div className="space-y-1.5">+ <Label>{t('memberScope')}</Label>+ <div role="radiogroup" aria-label={t('memberScope')} className="flex flex-wrap gap-1">+ {MEMBER_SCOPES.map((scope) => {+ const active = scope === memberScope;+ return (+ <button+ key={scope}+ type="button"+ role="radio"+ aria-checked={active}+ onClick={() => setMemberScope(scope)}+ className={cn(CHOICE_CLASS, 'h-8 px-2.5', active ? CHOICE_ON : CHOICE_OFF)}+ >+ {t(`memberScopes.${scope}`)}+ </button>+ );+ })}+ </div>+ {scopeNarrowed && <FieldChangeWarning>{t('memberScopeWarning')}</FieldChangeWarning>}+ </div>+ )}+ </div>++ <div className="border-t border-border/50 pt-5">+ <label className="flex cursor-pointer items-center justify-between gap-4">+ <span>+ <span className="text-sm">{t('mainInfo')}</span>+ <span className="block text-xs text-muted-foreground">{t('mainInfoTooltip')}</span>+ </span>+ <Switch checked={showInBody} onCheckedChange={setShowInBody} />+ </label>+ </div>++ <div className="flex justify-end gap-2 border-t border-border/50 pt-5">+ <Button type="button" variant="ghost" onClick={onClose}>+ {tCommon('cancel')}+ </Button>+ <Button type="submit" disabled={!name.trim()}>+ {tCommon(initial ? 'save' : 'add')}+ </Button>+ </div>+ </form>+ </Modal>+ );+}diff --git a/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldForm.tsx b/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldForm.tsxdeleted file mode 100644index c50815d0..00000000--- a/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldForm.tsx+++ /dev/null@@ -1,201 +0,0 @@-import { useState, type ReactNode } from 'react';-import { useTranslations } from 'next-intl';-import { Check } from 'lucide-react';-import { type CustomFieldType } from '@/lib/api';-import { cn } from '@/lib/utils';-import { Button } from '@/components/ui/button';-import { Input } from '@/components/ui/input';-import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,-} from '@/components/ui/select';-import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';--// The field types offered when creating a field. Type is immutable after-// creation (the values are already stored), so the edit form shows it as text.-const FIELD_TYPES: CustomFieldType[] = [- 'text',- 'markdown',- 'url',- 'number',- 'boolean',- 'date',- 'datetime',- 'datetime_range',- 'select',- 'multi_select',-];--// Display labels for the field types. The stored value stays the enum key; a few-// read as jargon when shown raw, so they map to plain words in the messages.-export function useFieldTypeLabel() {- const t = useTranslations('settings.customFields.fieldTypes');- return (fieldType: CustomFieldType) => t(fieldType);-}--export interface FieldFormValues {- name: string;- fieldType: CustomFieldType;- showInBody: boolean;- options?: string[];-}--// A labelled boolean toggle with a short explanatory tooltip: the whole chip is-// the target, filled with the selected-chip color when on.-function Toggle({- active,- onClick,- tooltip,- children,-}: {- active: boolean;- onClick: () => void;- tooltip: string;- children: ReactNode;-}) {- return (- <Tooltip>- <TooltipTrigger asChild>- <button- type="button"- onClick={onClick}- className={cn(- 'flex h-7 items-center gap-1.5 rounded-md px-2 text-xs transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50',- active- ? 'bg-secondary text-secondary-foreground'- : 'text-muted-foreground hover:bg-accent',- )}- >- <span- className={cn(- 'flex size-3.5 items-center justify-center rounded-[4px] transition-colors',- active ? 'bg-primary text-primary-foreground' : 'border border-input',- )}- >- {active && <Check className="size-2.5" />}- </span>- {children}- </button>- </TooltipTrigger>- <TooltipContent>{tooltip}</TooltipContent>- </Tooltip>- );-}--// The add/edit form for one custom field, on a subtly raised surface (a-// background shift, not a border). Name and type sit on the first row; the-// placement toggle and the actions on the second, so nothing crowds. In edit-// mode the type is fixed; options are only set at creation.-export function SettingsCustomFieldForm({- mode,- initial,- onSubmit,- onCancel,-}: {- mode: 'add' | 'edit';- initial?: {- name?: string;- fieldType?: CustomFieldType;- showInBody?: boolean;- };- onSubmit: (values: FieldFormValues) => void;- onCancel: () => void;-}) {- const t = useTranslations('settings.customFields');- const tCommon = useTranslations('common');- const fieldTypeLabel = useFieldTypeLabel();- const [name, setName] = useState(initial?.name ?? '');- const [fieldType, setFieldType] = useState<CustomFieldType>(initial?.fieldType ?? 'text');- const [showInBody, setShowInBody] = useState(initial?.showInBody ?? false);- const [options, setOptions] = useState('');- const needsOptions = mode === 'add' && (fieldType === 'select' || fieldType === 'multi_select');-- // Picking a type presets the placement to its default (body for markdown,- // properties otherwise); the user can still flip it before saving.- function changeType(v: CustomFieldType) {- setFieldType(v);- setShowInBody(v === 'markdown');- }-- function submit() {- if (!name.trim()) return;- onSubmit({- name: name.trim(),- fieldType,- showInBody,- options: needsOptions- ? options- .split(',')- .map((o) => o.trim())- .filter(Boolean)- : undefined,- });- }-- return (- <div className="space-y-2 rounded-lg bg-muted/40 p-3">- <div className="flex items-center gap-2">- <Input- autoFocus- value={name}- onChange={(e) => setName(e.target.value)}- placeholder={t('namePlaceholder')}- className="h-8 flex-1 bg-background"- onKeyDown={(e) => {- if (e.key === 'Enter' && !needsOptions) submit();- if (e.key === 'Escape') onCancel();- }}- />- <Button size="sm" className="h-8" disabled={!name.trim()} onClick={submit}>- {mode === 'add' ? tCommon('add') : tCommon('save')}- </Button>- <Button variant="ghost" size="sm" className="h-8 text-muted-foreground" onClick={onCancel}>- {tCommon('cancel')}- </Button>- </div>-- {needsOptions && (- <Input- value={options}- onChange={(e) => setOptions(e.target.value)}- placeholder={t('optionsPlaceholder')}- className="h-8 bg-background"- />- )}-- <div className="flex items-center gap-4">- <div className="flex items-center gap-1.5">- <span className="text-xs text-muted-foreground">{t('type')}</span>- {mode === 'add' ? (- <Select value={fieldType} onValueChange={(v) => changeType(v as CustomFieldType)}>- <SelectTrigger className="h-7 w-32 bg-background">- <SelectValue />- </SelectTrigger>- <SelectContent>- {FIELD_TYPES.map((option) => (- <SelectItem key={option} value={option}>- {fieldTypeLabel(option)}- </SelectItem>- ))}- </SelectContent>- </Select>- ) : (- <span className="text-xs text-foreground">{fieldTypeLabel(fieldType)}</span>- )}- </div>- <div className="flex items-center gap-1">- <Toggle- active={showInBody}- onClick={() => setShowInBody((v) => !v)}- tooltip={t('mainInfoTooltip')}- >- {t('mainInfo')}- </Toggle>- </div>- </div>- </div>- );-}diff --git a/apps/web/src/features/settings/components/custom-fields/SettingsCustomFields.tsx b/apps/web/src/features/settings/components/custom-fields/SettingsCustomFields.tsxindex 299a8c43..f833a533 100644--- a/apps/web/src/features/settings/components/custom-fields/SettingsCustomFields.tsx+++ b/apps/web/src/features/settings/components/custom-fields/SettingsCustomFields.tsx@@ -1,7 +1,7 @@import { useState } from 'react';import { useTranslations } from 'next-intl';import { ChevronRight, Plus } from 'lucide-react';-import { type CustomField, type NewCustomFieldInput, type ProjectDetail } from '@/lib/api';+import { type CustomField, type ProjectDetail } from '@/lib/api';import { cn } from '@/lib/utils';import { Button } from '@/components/ui/button';import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';@@ -12,22 +12,22 @@ import {useDeleteCustomField,useUpdateCustomField,} from '../../services/settings.service';-import { SettingsCustomFieldForm, useFieldTypeLabel } from './SettingsCustomFieldForm';+import CustomFieldMeta from './CustomFieldMeta';+import SettingsCustomFieldDialog, { type FieldFormValues } from './SettingsCustomFieldDialog';-// Which group's inline add form is open: 'global' for the project-wide field group,-// or a issue type id for a type-scoped group. null when no form is open.+// Which group the add dialog is open for: 'global' for the project-wide field group,+// or a issue type id for a type-scoped group. null when no dialog is open.type AddScope = 'global' | number;export default function SettingsCustomFields({ project }: { project: ProjectDetail }) {const projectKey = project.project.key;const [addingScope, setAddingScope] = useState<AddScope | null>(null);- const [editingId, setEditingId] = useState<number | null>(null);+ const [editing, setEditing] = useState<CustomField | null>(null);const [deleting, setDeleting] = useState<CustomField | null>(null);// Groups the user has collapsed, keyed by scope; every group is expanded by default.const [collapsed, setCollapsed] = useState<Set<string>>(new Set());const t = useTranslations('settings.customFields');- const fieldTypeLabel = useFieldTypeLabel();const can = useSettingsCan();const createCustomField = useCreateCustomField(projectKey);const updateCustomField = useUpdateCustomField(projectKey);@@ -56,64 +56,46 @@ export default function SettingsCustomFields({ project }: { project: ProjectDeta});}- // Open the add form for a group, expanding it first so the form is visible.- function openAdd(scope: AddScope) {- setEditingId(null);- setCollapsed((prev) => {- const next = new Set(prev);- next.delete(String(scope));- return next;- });- setAddingScope(scope);- }-- async function add(scope: AddScope, input: Omit<NewCustomFieldInput, 'issueTypeId'>) {+ async function add(scope: AddScope, values: FieldFormValues) {await createCustomField.mutateAsync({- ...input,+ name: values.name,+ fieldType: values.fieldType,+ memberScope: values.memberScope,+ showInBody: values.showInBody,+ options: values.options.map((o) => o.value),issueTypeId: scope === 'global' ? null : scope,});setAddingScope(null);}- function startEdit(f: CustomField) {- setAddingScope(null);- setEditingId(f.id);+ async function saveEdit(id: number, values: FieldFormValues) {+ await updateCustomField.mutateAsync({+ id,+ patch: {+ name: values.name,+ showInBody: values.showInBody,+ fieldType: values.fieldType,+ memberScope: values.memberScope,+ options: values.options,+ },+ });+ setEditing(null);}- async function saveEdit(f: CustomField, values: { name: string; showInBody: boolean }) {- await updateCustomField.mutateAsync({ id: f.id, patch: values });- setEditingId(null);+ function groupLabel(scope: AddScope): string {+ return groups.find((g) => g.scope === scope)?.label ?? '';}function renderField(f: CustomField) {- if (editingId === f.id) {- return (- <div key={f.id} className="py-1 pr-3 pl-9">- <SettingsCustomFieldForm- mode="edit"- initial={f}- onSubmit={(values) => void saveEdit(f, values)}- onCancel={() => setEditingId(null)}- />- </div>- );- }- const meta = [- fieldTypeLabel(f.fieldType),- f.showInBody ? t('mainInfoMeta') : null,- f.options.length ? f.options.map((o) => o.value).join(', ') : null,- ]- .filter(Boolean)- .join(' · ');return (<SettingsRowkey={f.id}className="h-11 pl-9"title={f.name}- meta={meta}+ meta={<CustomFieldMeta field={f} />}editTitle={t('editField')}deleteTitle={t('deleteField')}- onEdit={() => startEdit(f)}+ onEdit={() => setEditing(f)}onDelete={() => setDeleting(f)}/>);@@ -125,7 +107,6 @@ export default function SettingsCustomFields({ project }: { project: ProjectDeta{groups.map((g) => {const key = String(g.scope);const open = !collapsed.has(key);- const adding = addingScope === g.scope;return (<div key={key}><div className="flex h-11 items-center gap-2 rounded-md pr-2 transition-colors hover:bg-accent/50">@@ -157,7 +138,7 @@ export default function SettingsCustomFields({ project }: { project: ProjectDetaclassName="size-7 text-muted-foreground hover:text-foreground"title={t('addField')}aria-label={t('addFieldTo', { group: g.label })}- onClick={() => openAdd(g.scope)}+ onClick={() => setAddingScope(g.scope)}><Plus className="size-4" /></Button>@@ -167,16 +148,7 @@ export default function SettingsCustomFields({ project }: { project: ProjectDeta{open && (<div className="pb-1">{g.fields.map(renderField)}- {adding && (- <div className="py-1 pr-3 pl-9">- <SettingsCustomFieldForm- mode="add"- onSubmit={(input) => void add(g.scope, input)}- onCancel={() => setAddingScope(null)}- />- </div>- )}- {g.fields.length === 0 && !adding && (+ {g.fields.length === 0 && (<p className="py-3 pl-9 text-xs text-muted-foreground">{t('noFields')}</p>)}</div>@@ -186,6 +158,23 @@ export default function SettingsCustomFields({ project }: { project: ProjectDeta})}</div>+ {addingScope !== null && (+ <SettingsCustomFieldDialog+ group={groupLabel(addingScope)}+ onSubmit={(values) => void add(addingScope, values)}+ onClose={() => setAddingScope(null)}+ />+ )}++ {editing && (+ <SettingsCustomFieldDialog+ group={groupLabel(editing.issueTypeId ?? 'global')}+ initial={editing}+ onSubmit={(values) => void saveEdit(editing.id, values)}+ onClose={() => setEditing(null)}+ />+ )}+{deleting && (<SettingsConfirmDeleteDialogtitle={t('deleteTitle', { name: deleting.name })}diff --git a/apps/web/src/features/settings/utils/agentForm.ts b/apps/web/src/features/settings/utils/agentForm.tsindex 0365c18c..304754d2 100644--- a/apps/web/src/features/settings/utils/agentForm.ts+++ b/apps/web/src/features/settings/utils/agentForm.ts@@ -17,6 +17,9 @@ export interface AgentFormValue {memoryLastMessages: string;triggerOnMention: boolean;triggerOnAssign: boolean;+ // The member custom fields that start a run when the agent is set into one, each+ // with its own wait.+ fieldTriggers: FormFieldTrigger[];// Minutes a delegation run waits before the agent may pick it up, as a string so// the input can be cleared while typing.delegationDelayMin: string;@@ -24,6 +27,11 @@ export interface AgentFormValue {runnerScope: 'owner' | 'project';}+export interface FormFieldTrigger {+ fieldId: number;+ delayMin: string;+}+const USERNAME_PATTERN = /^[a-zA-Z0-9._-]+$/;// Suggests a mention handle from the agent's name: non-Latin scripts are@@ -62,15 +70,20 @@ export function initialAgentValue(agent?: AiAgent): AgentFormValue {memoryLastMessages: agent?.memoryLastMessages != null ? String(agent.memoryLastMessages) : '',triggerOnMention: agent?.triggerOnMention ?? true,triggerOnAssign: agent?.triggerOnAssign ?? false,+ fieldTriggers: (agent?.fieldTriggers ?? []).map((trigger) => ({+ fieldId: trigger.fieldId,+ delayMin: String(Math.round(trigger.delaySec / 60)),+ })),delegationDelayMin: String(Math.round((agent?.delegationDelaySec ?? 120) / 60)),roleId: agent?.roleId ?? null,runnerScope: agent?.runnerScope ?? 'project',};}-// The delegation delay the server stores. A blank or unparseable input means no-// delay; the value is clamped to the server's 0..24h range.-function delegationDelaySec(minutes: string): number {+// The delay the server stores, for delegation and for a field trigger alike. A blank+// or unparseable input means no delay; the value is clamped to the server's 0..24h+// range.+export function delaySecFromMinutes(minutes: string): number {const n = Math.round(Number(minutes.trim()));if (!Number.isFinite(n) || n <= 0) return 0;return Math.min(n, 1440) * 60;@@ -95,7 +108,11 @@ function configFields(v: AgentFormValue) {instructions: v.instructions.trim() || null,triggerOnMention: v.triggerOnMention,triggerOnAssign: v.triggerOnAssign,- delegationDelaySec: delegationDelaySec(v.delegationDelayMin),+ fieldTriggers: v.fieldTriggers.map((trigger) => ({+ fieldId: trigger.fieldId,+ delaySec: delaySecFromMinutes(trigger.delayMin),+ })),+ delegationDelaySec: delaySecFromMinutes(v.delegationDelayMin),};if (v.kind === 'external') {return { ...common, runnerScope: v.runnerScope };diff --git a/apps/web/src/features/settings/utils/customFieldsTransfer.ts b/apps/web/src/features/settings/utils/customFieldsTransfer.tsindex c3ea5167..81d7d161 100644--- a/apps/web/src/features/settings/utils/customFieldsTransfer.ts+++ b/apps/web/src/features/settings/utils/customFieldsTransfer.ts@@ -1,11 +1,12 @@// Serialize/parse a project's custom fields for the copy/paste transfer between// projects. The payload holds each field with its scope named by the issue type (null// for a global field) and, for select fields, its option values. Matching is by name-// within a scope: an existing field is left as is (its type and options cannot be-// changed after creation), a missing one is created, and a referenced issue type that+// within a scope: an existing field is left as is (a paste never rewrites what the+// project already defines), a missing one is created, and a referenced issue type that// does not exist yet is created first.-import type { CustomField, CustomFieldType, IssueType } from '@/lib/api';+import type { CustomField, CustomFieldType, IssueType, MemberScope } from '@/lib/api';+import { FIELD_TYPES, MEMBER_SCOPES } from './fieldTypes';const PAYLOAD_TYPE = 'plan.custom-fields';const PAYLOAD_VERSION = 1;@@ -13,6 +14,7 @@ const PAYLOAD_VERSION = 1;export interface FieldTransfer {name: string;fieldType: CustomFieldType;+ memberScope: MemberScope | null;showInBody: boolean;options: string[];// The issue type's name this field is scoped to, or null for a global field.@@ -35,19 +37,6 @@ export interface CustomFieldsImportPlan {fields: PlannedField[];}-const FIELD_TYPES: CustomFieldType[] = [- 'text',- 'markdown',- 'url',- 'number',- 'boolean',- 'date',- 'datetime',- 'datetime_range',- 'select',- 'multi_select',-];-// The clipboard text for the project's custom fields. When includeTypeScoped is false,// only global fields are exported.export function serializeCustomFields(@@ -62,6 +51,7 @@ export function serializeCustomFields(fields: chosen.map((f) => ({name: f.name,fieldType: f.fieldType,+ memberScope: f.memberScope,showInBody: f.showInBody,options: f.options.map((o) => o.value),type: f.issueTypeId != null ? (typeNameById.get(f.issueTypeId) ?? null) : null,@@ -90,6 +80,9 @@ export function parseCustomFieldsText(text: string): FieldTransfer[] {fields.push({name,fieldType: raw.fieldType as CustomFieldType,+ memberScope: MEMBER_SCOPES.includes(raw?.memberScope as MemberScope)+ ? (raw.memberScope as MemberScope)+ : null,showInBody: raw?.showInBody === true,options: Array.isArray(raw?.options)? raw.options.filter((o): o is string => typeof o === 'string')diff --git a/apps/web/src/features/settings/utils/fieldTypes.ts b/apps/web/src/features/settings/utils/fieldTypes.tsnew file mode 100644index 00000000..8c0dfc29--- /dev/null+++ b/apps/web/src/features/settings/utils/fieldTypes.ts@@ -0,0 +1,56 @@+import {+ AlignLeft,+ Calendar,+ CalendarClock,+ CalendarRange,+ CircleCheck,+ Hash,+ Link as LinkIcon,+ List,+ ListChecks,+ Type,+ UserRound,+ type LucideIcon,+} from 'lucide-react';+import { useTranslations } from 'next-intl';+import type { CustomFieldType, MemberScope } from '@/lib/api';++// Every field type, in the order the picker shows them. Also the list a pasted+// transfer payload is validated against.+export const FIELD_TYPES: CustomFieldType[] = [+ 'text',+ 'markdown',+ 'url',+ 'number',+ 'boolean',+ 'date',+ 'datetime',+ 'datetime_range',+ 'select',+ 'multi_select',+ 'member',+];++export const FIELD_TYPE_ICONS: Record<CustomFieldType, LucideIcon> = {+ text: Type,+ markdown: AlignLeft,+ url: LinkIcon,+ number: Hash,+ boolean: CircleCheck,+ date: Calendar,+ datetime: CalendarClock,+ datetime_range: CalendarRange,+ select: List,+ multi_select: ListChecks,+ member: UserRound,+};++// Who a member field may hold, in the order the picker shows them.+export const MEMBER_SCOPES: MemberScope[] = ['all', 'humans', 'agents'];++// Display labels for the field types. The stored value stays the enum key; a few+// read as jargon when shown raw, so they map to plain words in the messages.+export function useFieldTypeLabel() {+ const t = useTranslations('settings.customFields.fieldTypes');+ return (fieldType: CustomFieldType) => t(fieldType);+}diff --git a/apps/web/src/features/work-items/components/kanban/FlatBoard.tsx b/apps/web/src/features/work-items/components/kanban/FlatBoard.tsxindex 98690a30..e080089a 100644--- a/apps/web/src/features/work-items/components/kanban/FlatBoard.tsx+++ b/apps/web/src/features/work-items/components/kanban/FlatBoard.tsx@@ -5,6 +5,7 @@ import { useTranslations } from 'next-intl';import {buildGroups,buildMaps,+ groupDefaults,groupIssues,positionsAt,sortIssues,@@ -42,7 +43,7 @@ export default function FlatBoard({const groupLabels = useGroupLabels();const sortedOrderMessage = useSortedOrderMessage();const wipLimitMessage = useWipLimitMessage();- const dnd = useBoardDnd(project.project.key, readOnly);+ const dnd = useBoardDnd(project, readOnly);const selection = useSelection();const filtered = isActiveFilterSet(filters);@@ -109,11 +110,11 @@ export default function FlatBoard({return;}const positions = positionsAt(target, index, ids.length);- ids.forEach((id, n) => dnd.move(id, { ...assign, position: positions[n] }));+ ids.forEach((id, n) => dnd.move(id, assign, positions[n]));}function addIssueTo(group: IssueGroup) {- onAddIssue({ ...group.assign });+ onAddIssue(groupDefaults(group.assign));}return (diff --git a/apps/web/src/features/work-items/components/kanban/SwimlaneBoard.tsx b/apps/web/src/features/work-items/components/kanban/SwimlaneBoard.tsxindex 8267fb31..4a6ceb92 100644--- a/apps/web/src/features/work-items/components/kanban/SwimlaneBoard.tsx+++ b/apps/web/src/features/work-items/components/kanban/SwimlaneBoard.tsx@@ -60,7 +60,7 @@ export default function SwimlaneBoard({const wipLimitMessage = useWipLimitMessage();const groupLabels = useGroupLabels();const filtered = isActiveFilterSet(filters);- const dnd = useBoardDnd(project.project.key, readOnly);+ const dnd = useBoardDnd(project, readOnly);const selection = useSelection();const collapsed = usePersistedSet(collapsedSwimlanesKey(project.project.id, settings.subgroup));@@ -153,7 +153,7 @@ export default function SwimlaneBoard({return;}const positions = positionsAt(cellIssues, index, ids.length);- ids.forEach((id, n) => dnd.move(id, { ...assign, position: positions[n] }));+ ids.forEach((id, n) => dnd.move(id, assign, positions[n]));}// Inner width so the sticky header and every swimlane share one horizontaldiff --git a/apps/web/src/features/work-items/components/table/TableCustomCell.tsx b/apps/web/src/features/work-items/components/table/TableCustomCell.tsxindex fef178c5..a4f5cba3 100644--- a/apps/web/src/features/work-items/components/table/TableCustomCell.tsx+++ b/apps/web/src/features/work-items/components/table/TableCustomCell.tsx@@ -1,6 +1,8 @@import { Check, ExternalLink } from 'lucide-react';import { type CustomField, type Issue } from '@/lib/api';+import { type Maps } from '@/utils/project';import { formatDateTimeRange, formatShortDate } from '@/utils/dates';+import Avatar from '@/components/common/Avatar';import { colorDot } from '@/components/common/fields/colorDot';import { MarkdownCell } from './MarkdownCell';@@ -14,7 +16,15 @@ function preview(value: unknown): string {// One custom-field value cell. Reads the issue's entry for the field; an issue// whose type doesn't have this field (or has it unset) shows a dash.-export function TableCustomCell({ field, issue }: { field: CustomField; issue: Issue }) {+export function TableCustomCell({+ field,+ issue,+ maps,+}: {+ field: CustomField;+ issue: Issue;+ maps: Maps;+}) {const entry = issue.fieldValues.find((v) => v.fieldId === field.id);if (field.fieldType === 'select' || field.fieldType === 'multi_select') {@@ -34,6 +44,18 @@ export function TableCustomCell({ field, issue }: { field: CustomField; issue: I);}+ if (field.fieldType === 'member') {+ const member =+ typeof entry?.value === 'string' ? maps.assigneeById.get(entry.value) : undefined;+ if (!member) return <div>{DASH}</div>;+ return (+ <div className="flex min-w-0 items-center gap-1.5 text-xs">+ <Avatar name={member.name} image={member.image} className="size-4 text-[8px]" />+ <span className="truncate">{member.name}</span>+ </div>+ );+ }+if (field.fieldType === 'boolean') {return (<div className="text-muted-foreground">diff --git a/apps/web/src/features/work-items/components/table/TableRow.tsx b/apps/web/src/features/work-items/components/table/TableRow.tsxindex 8bc48149..f5e30adc 100644--- a/apps/web/src/features/work-items/components/table/TableRow.tsx+++ b/apps/web/src/features/work-items/components/table/TableRow.tsx@@ -109,7 +109,7 @@ export function TableRow({c.kind === 'builtin' ? (<TableBuiltinCell key={columnKey(c)} column={c.col} issue={issue} maps={maps} />) : (- <TableCustomCell key={columnKey(c)} field={c.field} issue={issue} />+ <TableCustomCell key={columnKey(c)} field={c.field} issue={issue} maps={maps} />),)}diff --git a/apps/web/src/features/work-items/components/table/TableView.tsx b/apps/web/src/features/work-items/components/table/TableView.tsxindex 01a0519e..46049f2e 100644--- a/apps/web/src/features/work-items/components/table/TableView.tsx+++ b/apps/web/src/features/work-items/components/table/TableView.tsx@@ -1,7 +1,13 @@import { useRef } from 'react';import { DndContext } from '@dnd-kit/core';import { useVirtualizer } from '@tanstack/react-virtual';-import { buildGroups, buildMaps, sortIssues, type WorkItemsViewProps } from '@/utils/project';+import {+ buildGroups,+ buildMaps,+ groupDefaults,+ sortIssues,+ type WorkItemsViewProps,+} from '@/utils/project';import { usePersistedSet } from '@/hooks/usePersistedSet';import { useTableColumnWidths } from '../../hooks/useTableColumnWidths';import { useIssueReorder } from '../../hooks/useIssueReorder';@@ -94,7 +100,7 @@ export default function TableView({dropId={`sec:${item.dropKey}`}onDrop={(id) => reorder.moveIssue(id, item.assign, item.bucket, item.bucket.length)}onToggle={() => collapsed.toggle(item.group.key)}- onAddIssue={() => onAddIssue({ ...item.group.assign })}+ onAddIssue={() => onAddIssue(groupDefaults(item.group.assign))}readOnly={readOnly}/>);diff --git a/apps/web/src/features/work-items/hooks/useApplyAssign.ts b/apps/web/src/features/work-items/hooks/useApplyAssign.tsnew file mode 100644index 00000000..8690909e--- /dev/null+++ b/apps/web/src/features/work-items/hooks/useApplyAssign.ts@@ -0,0 +1,23 @@+import type { ProjectDetail } from '@/lib/api';+import type { GroupAssign } from '@/utils/project';+import { memberFieldValue } from '@/utils/memberFields';+import { useSetFieldValue, useUpdateIssue } from '@/services/issues.service';++// Applies what a drop into a group assigns, shared by the boards and the row+// layouts: the built-in fields and the new position in one patch, then a write per+// member custom field the grouping levels name. A field the issue already holds is+// left alone — rewriting the same value would log another activity entry and start+// another run of an agent that reacts to the field.+export function useApplyAssign(project: ProjectDetail) {+ const updateIssue = useUpdateIssue(project.project.key);+ const setFieldValue = useSetFieldValue(project.project.key);++ return function applyAssign(issueId: number, assign: GroupAssign | null, position: number) {+ updateIssue.mutate({ id: issueId, patch: { ...assign?.patch, position } });+ const issue = project.issues.find((i) => i.id === issueId);+ for (const { fieldId, userId } of assign?.fields ?? []) {+ if (issue && memberFieldValue(issue, fieldId) === userId) continue;+ setFieldValue.mutate({ issueId, fieldId, value: { value: userId } });+ }+ };+}diff --git a/apps/web/src/features/work-items/hooks/useBoardDnd.ts b/apps/web/src/features/work-items/hooks/useBoardDnd.tsindex fa56aba9..9eca6a4d 100644--- a/apps/web/src/features/work-items/hooks/useBoardDnd.ts+++ b/apps/web/src/features/work-items/hooks/useBoardDnd.ts@@ -1,9 +1,9 @@import { useState } from 'react';import { type DragEndEvent, type DragStartEvent } from '@dnd-kit/core';-import type { IssuePatch } from '@/lib/api';-import { useUpdateIssue } from '@/services/issues.service';+import type { ProjectDetail } from '@/lib/api';import { useDndSensors } from '@/lib/dnd';import { draggedIds, type BoardDropData } from '../utils/kanban';+import { useApplyAssign } from './useApplyAssign';// Drag-and-drop state and helpers shared by the two board layouts (the flat// column board and the swimlane grid). It owns which card is being dragged (for@@ -12,14 +12,12 @@ import { draggedIds, type BoardDropData } from '../utils/kanban';// it with the dragged issue ids — the card alone, or the whole selection when the// card is part of it. In a read-only share the board keeps its DndContext but// gets inert sensors, so no drag can ever start (see useDndSensors).-export function useBoardDnd(projectKey: string, readOnly = false) {- const updateIssue = useUpdateIssue(projectKey);+export function useBoardDnd(project: ProjectDetail, readOnly = false) {+ const move = useApplyAssign(project);// The grabbed card and how many issues move with it, for the drag overlay.const [active, setActive] = useState<{ id: number; count: number } | null>(null);const sensors = useDndSensors(readOnly);- const move = (issueId: number, patch: IssuePatch) => updateIssue.mutate({ id: issueId, patch });-const onDragStart = (e: DragStartEvent) =>setActive({ id: Number(e.active.id), count: draggedIds(e.active).length });const onDragCancel = () => setActive(null);diff --git a/apps/web/src/features/work-items/hooks/useIssueReorder.ts b/apps/web/src/features/work-items/hooks/useIssueReorder.tsindex c51c4021..dd946fc9 100644--- a/apps/web/src/features/work-items/hooks/useIssueReorder.ts+++ b/apps/web/src/features/work-items/hooks/useIssueReorder.ts@@ -1,11 +1,11 @@import { useState } from 'react';import { type DragEndEvent, type DragStartEvent } from '@dnd-kit/core';import { toast } from 'sonner';-import { type Issue, type IssuePatch, type ProjectDetail } from '@/lib/api';-import { positionsAt } from '@/utils/project';+import { type Issue, type ProjectDetail } from '@/lib/api';+import { positionsAt, type GroupAssign } from '@/utils/project';import { useDndSensors } from '@/lib/dnd';-import { useUpdateIssue } from '@/services/issues.service';import type { Sort } from '@/utils/viewTypes';+import { useApplyAssign } from './useApplyAssign';import { useSortedOrderMessage } from './useSortedOrderMessage';import { preferPrefix, type DropData } from '../utils/dnd';@@ -31,17 +31,17 @@ export function useIssueReorder({readOnly?: boolean;}) {const sortedOrderMessage = useSortedOrderMessage();- const updateIssue = useUpdateIssue(project.project.key);+ const applyAssign = useApplyAssign(project);const sensors = useDndSensors(readOnly);const [activeId, setActiveId] = useState<number | null>(null);- function moveIssue(issueId: number, assign: IssuePatch | null, bucket: Issue[], index: number) {+ function moveIssue(issueId: number, assign: GroupAssign | null, bucket: Issue[], index: number) {if (sort.field !== 'manual' && bucket.some((i) => i.id === issueId)) {toast.info(sortedOrderMessage(sort.field));return;}const [position] = positionsAt(bucket, index, 1);- updateIssue.mutate({ id: issueId, patch: assign ? { ...assign, position } : { position } });+ applyAssign(issueId, assign, position);}return {diff --git a/apps/web/src/features/work-items/utils/table.ts b/apps/web/src/features/work-items/utils/table.tsindex e0a6d034..02716504 100644--- a/apps/web/src/features/work-items/utils/table.ts+++ b/apps/web/src/features/work-items/utils/table.ts@@ -1,9 +1,10 @@-import { type BoardIssue, type CustomField, type Issue, type IssuePatch } from '@/lib/api';+import { type BoardIssue, type CustomField, type Issue } from '@/lib/api';import {groupIssues,mergeAssign,nestIssues,subgroupKey,+ type GroupAssign,type IssueGroup,} from '@/utils/project';import {@@ -71,7 +72,7 @@ export type FlatItem =kind: 'header';group: IssueGroup;count: number;- assign: IssuePatch | null;+ assign: GroupAssign | null;bucket: Issue[];dropKey: string;}@@ -79,7 +80,7 @@ export type FlatItem =kind: 'subheader';sub: IssueGroup;count: number;- assign: IssuePatch | null;+ assign: GroupAssign | null;bucket: Issue[];dropKey: string;}@@ -87,7 +88,7 @@ export type FlatItem =kind: 'row';issue: BoardIssue;index: number;- assign: IssuePatch | null;+ assign: GroupAssign | null;bucket: Issue[];dropKey: string;};diff --git a/apps/web/src/features/work-items/utils/timeline.ts b/apps/web/src/features/work-items/utils/timeline.tsindex 6ec1db0c..b3eae6f0 100644--- a/apps/web/src/features/work-items/utils/timeline.ts+++ b/apps/web/src/features/work-items/utils/timeline.ts@@ -1,5 +1,5 @@import { startOfDay } from 'date-fns';-import { type BoardIssue, type Issue, type IssuePatch, type ProjectDetail } from '@/lib/api';+import { type BoardIssue, type Issue, type ProjectDetail } from '@/lib/api';import { parseDate } from '@/utils/dates';import type { FilterSet } from '@/utils/filters';import { buildDayTrack, type DayTrack } from '@/utils/timelineTrack';@@ -10,6 +10,7 @@ import {nestIssues,sortIssues,subgroupKey,+ type GroupAssign,type GroupLabels,type IssueGroup,} from '@/utils/project';@@ -63,7 +64,7 @@ export type TimelineRow =count: number;collapsed: boolean;aggregateSpan: Span | null;- assign: IssuePatch | null;+ assign: GroupAssign | null;bucket: BoardIssue[];}| {@@ -73,7 +74,7 @@ export type TimelineRow =count: number;collapsed: boolean;aggregateSpan: Span | null;- assign: IssuePatch | null;+ assign: GroupAssign | null;bucket: BoardIssue[];}| {@@ -81,7 +82,7 @@ export type TimelineRow =issue: BoardIssue;span: Span;index: number;- assign: IssuePatch | null;+ assign: GroupAssign | null;bucket: BoardIssue[];};diff --git a/apps/web/src/features/work-items/utils/wipLimit.ts b/apps/web/src/features/work-items/utils/wipLimit.tsindex 3cca1208..25b74107 100644--- a/apps/web/src/features/work-items/utils/wipLimit.ts+++ b/apps/web/src/features/work-items/utils/wipLimit.ts@@ -22,7 +22,7 @@ export function wipStateFor(columns: Column[],counts: Map<number, number>,): WipState | null {- const columnId = group.assign?.columnId;+ const columnId = group.assign?.patch.columnId;if (columnId == null) return null;const column = columns.find((c) => c.id === columnId);if (!column || column.wipLimit == null) return null;@@ -75,7 +75,7 @@ export function countEntering(issues: { id: number; columnId: number }[],group: IssueGroup,): number {- const columnId = group.assign?.columnId;+ const columnId = group.assign?.patch.columnId;if (columnId == null) return movedIds.length;const byId = new Map(issues.map((issue) => [issue.id, issue.columnId]));return movedIds.filter((id) => byId.get(id) !== columnId).length;diff --git a/apps/web/src/hooks/useFilterFields.ts b/apps/web/src/hooks/useFilterFields.tsindex 3c018c57..33f7294f 100644--- a/apps/web/src/hooks/useFilterFields.ts+++ b/apps/web/src/hooks/useFilterFields.ts@@ -1,7 +1,13 @@'use client';import { useTranslations } from 'next-intl';-import type { CustomField, InitiativeOption, InitiativeRef, ProjectDetail } from '@/lib/api';+import type {+ CustomField,+ InitiativeOption,+ InitiativeRef,+ MemberScope,+ ProjectDetail,+} from '@/lib/api';import { useInitiativeOptionsQuery } from '@/services/initiatives.service';import { CYCLE_STATUS_META } from '@/utils/cycleMeta';import { formatDate } from '@/utils/dates';@@ -26,15 +32,18 @@ import {type FieldSpec,} from '@/utils/filterFields';import { customFieldKey, isFieldEnabled, type GroupField } from '@/utils/viewSettings';+import { memberCandidates } from '@/utils/memberFields';import { usePriorityLabel } from '@/hooks/usePriorityLabel';import { byKey } from '@/utils/messageKey';// Maps a custom field type to a filter field kind. select/multi_select are set-// fields over their options; the scalar types map to their editors.+// fields over their options, member is a set over the project's people and agents;+// the scalar types map to their editors.function customFieldKind(field: CustomField): FieldKind {switch (field.fieldType) {case 'select':case 'multi_select':+ case 'member':return 'set';case 'number':return 'number';@@ -84,6 +93,18 @@ function cycleOptions(project: ProjectDetail): FieldOption[] {];}+// The people and agents a member field of this scope holds, plus the unset value.+function memberFieldOptions(+ project: ProjectDetail,+ scope: MemberScope,+ unsetLabel: string,+): FieldOption[] {+ return [+ ...memberCandidates(project.assignees, scope).map((a) => ({ value: a.userId, label: a.name })),+ { value: null, label: unsetLabel },+ ];+}+// Marks the first option, so a rule separates the ones naming a single cycle or// initiative from the values that stand for a whole status.function withDivider(options: FieldOption[]): FieldOption[] {@@ -223,15 +244,13 @@ export function useFilterFields(projectKey?: string) {];for (const f of customFields) {const kind = customFieldKind(f);- specs.push({- field: customFieldKey(f.id),- label: f.name,- kind,- options:- kind === 'set'- ? f.options.map((o) => ({ value: o.id, label: o.value, color: o.color }))- : undefined,- });+ let options: FieldOption[] | undefined;+ if (f.fieldType === 'member') {+ options = memberFieldOptions(project, f.memberScope ?? 'all', t('unset.member'));+ } else if (kind === 'set') {+ options = f.options.map((o) => ({ value: o.id, label: o.value, color: o.color }));+ }+ specs.push({ field: customFieldKey(f.id), label: f.name, kind, options });}// The fields of an optional section are offered only while it is on, as the// grouping fields and display properties are.diff --git a/apps/web/src/hooks/useGroupLabels.ts b/apps/web/src/hooks/useGroupLabels.tsindex 7e169581..115d6443 100644--- a/apps/web/src/hooks/useGroupLabels.ts+++ b/apps/web/src/hooks/useGroupLabels.ts@@ -16,6 +16,7 @@ export function useGroupLabels(): GroupLabels {noType: t('noType'),noInitiative: t('noInitiative'),noCycle: t('noCycle'),+ noMember: t('noMember'),priority,};}diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.tsindex e02dc5e6..3bfdb9ee 100644--- a/apps/web/src/lib/api.ts+++ b/apps/web/src/lib/api.ts@@ -212,6 +212,12 @@ export interface Assignee {restrictedToUserId: string | null;}+// One member custom field an agent reacts to, with the seconds its run waits.+export interface AgentFieldTrigger {+ fieldId: number;+ delaySec: number;+}+// An AI agent on a project: a bot user plus its configuration. `kind` is// 'external' (driven by an outside caller through the API) or 'internal' (run by// the built-in runtime, so it carries provider/model/instructions/tools). Only an@@ -237,6 +243,9 @@ export interface AiAgent {// Run triggers.triggerOnMention: boolean;triggerOnAssign: boolean;+ // The member custom fields that start a run when the agent is set into one, each+ // with the seconds its run waits before the agent may pick it up.+ fieldTriggers: AgentFieldTrigger[];// How long a delegation run waits before the agent may pick it up.delegationDelaySec: number;// External-agent authorization role (a project_role id, or null for the default).@@ -268,7 +277,7 @@ export type AgentRunStatus = 'pending' | 'success' | 'failed' | 'canceled';export interface AgentRun {id: number;status: AgentRunStatus;- trigger: 'mention' | 'delegation' | 'schedule' | 'manual';+ trigger: 'mention' | 'delegation' | 'field' | 'schedule' | 'manual';issueId: number | null;issueIdentifier: string | null;issueTitle: string | null;@@ -352,6 +361,7 @@ export interface NewAiAgentInput {memoryLastMessages?: number | null;triggerOnMention?: boolean;triggerOnAssign?: boolean;+ fieldTriggers?: AgentFieldTrigger[];delegationDelaySec?: number;roleId?: number | null;runnerScope?: 'owner' | 'project';@@ -370,6 +380,7 @@ export interface AiAgentPatch {memoryLastMessages?: number | null;triggerOnMention?: boolean;triggerOnAssign?: boolean;+ fieldTriggers?: AgentFieldTrigger[];delegationDelaySec?: number;roleId?: number | null;runnerScope?: 'owner' | 'project';@@ -693,7 +704,12 @@ export type CustomFieldType =| 'datetime'| 'datetime_range'| 'select'- | 'multi_select';+ | 'multi_select'+ | 'member';++// Who a member field may hold: every candidate, the people only, or the agents only.+// Null for every other field type.+export type MemberScope = 'all' | 'humans' | 'agents';export interface CustomFieldOption {id: number;@@ -707,6 +723,7 @@ export interface CustomField {issueTypeId: number | null;name: string;fieldType: CustomFieldType;+ memberScope: MemberScope | null;// When true the field renders in the issue body (under the description);// when false it renders as a Properties row.showInBody: boolean;@@ -1375,7 +1392,7 @@ export interface ThroughputWeek {export interface AgentRunFeedItem {id: number;status: AgentRunStatus;- trigger: 'mention' | 'delegation' | 'schedule' | 'manual';+ trigger: 'mention' | 'delegation' | 'field' | 'schedule' | 'manual';agentId: number;agentName: string;issueId: number | null;@@ -2075,10 +2092,24 @@ export interface InitiativeFeedPage {nextCursor: FeedCursor | null;}+// A field can be reshaped after it exists, and the values issues hold follow: a new+// fieldType clears them, a narrowed memberScope clears the ones it no longer allows,+// and an option missing from `options` is deleted along with the selections of it.+export interface CustomFieldPatch {+ name?: string;+ showInBody?: boolean;+ fieldType?: CustomFieldType;+ memberScope?: MemberScope;+ // The full option list of a select field, in display order. An entry with an id+ // renames that option; one without is new.+ options?: { id?: number; value: string }[];+}+export interface NewCustomFieldInput {issueTypeId?: number | null;name: string;fieldType: CustomFieldType;+ memberScope?: MemberScope;showInBody?: boolean;options?: string[];}@@ -2408,11 +2439,7 @@ export const api = {method: 'POST',body: JSON.stringify(input),}),- updateCustomField: (- projectKey: string,- fieldId: number,- patch: { name?: string; showInBody?: boolean },- ) =>+ updateCustomField: (projectKey: string, fieldId: number, patch: CustomFieldPatch) =>request<CustomField>(`/projects/${projectKey}/custom-fields/${fieldId}`, {method: 'PATCH',body: JSON.stringify(patch),diff --git a/apps/web/src/utils/memberFields.ts b/apps/web/src/utils/memberFields.tsnew file mode 100644index 00000000..a599aa6c--- /dev/null+++ b/apps/web/src/utils/memberFields.ts@@ -0,0 +1,39 @@+import type { Assignee, CustomField, Issue, MemberScope } from '@/lib/api';+import { customFieldId, isCustomFieldKey, type GroupField } from '@/utils/viewSettings';++// The custom fields that hold one person or agent. They are offered wherever the+// built-in assignee and delegate are: as a filter field, and as a grouping.++export function isMemberField(field: CustomField): boolean {+ return field.fieldType === 'member';+}++// The people and agents a member field of this scope holds.+export function memberCandidates(assignees: Assignee[], scope: MemberScope): Assignee[] {+ if (scope === 'humans') return assignees.filter((a) => a.kind === 'member');+ if (scope === 'agents') return assignees.filter((a) => a.kind === 'agent');+ return assignees;+}++// The member custom field a `cf:<id>` grouping points at, or null when the grouping+// names a built-in field (or a field that has since been deleted or retyped).+export function groupMemberField(+ group: GroupField,+ customFields: CustomField[],+): CustomField | null {+ if (!isCustomFieldKey(group)) return null;+ const id = customFieldId(group);+ return customFields.find((f) => f.id === id && isMemberField(f)) ?? null;+}++// The group key a member field's value belongs to, namespaced by the field so two+// member groupings never collide. A null user is the "No value" group.+export function memberGroupKey(fieldId: number, userId: string | null): string {+ return userId != null ? `f${fieldId}u${userId}` : `f${fieldId}-none`;+}++// Who a member field holds on an issue, or null when it holds no one.+export function memberFieldValue(issue: Issue, fieldId: number): string | null {+ const value = issue.fieldValues.find((v) => v.fieldId === fieldId)?.value;+ return typeof value === 'string' && value !== '' ? value : null;+}diff --git a/apps/web/src/utils/project.ts b/apps/web/src/utils/project.tsindex bb47a31b..10b665e9 100644--- a/apps/web/src/utils/project.ts+++ b/apps/web/src/utils/project.ts@@ -29,7 +29,19 @@ import {type FilterValue,} from '@/utils/filters';import { compareByGroupOrder } from '@/utils/initiativeMeta';-import type { GroupField, ViewSettings } from '@/utils/viewSettings';+import {+ customFieldId,+ isCustomFieldKey,+ type CustomFieldKey,+ type GroupField,+ type ViewSettings,+} from '@/utils/viewSettings';+import {+ groupMemberField,+ memberCandidates,+ memberFieldValue,+ memberGroupKey,+} from '@/utils/memberFields';import type { Sort } from '@/utils/viewTypes';export type { Sort, SortField } from '@/utils/viewTypes';@@ -51,7 +63,11 @@ export type NewIssueDefaults = Partial<| 'parentId'| 'labelIds'>->;+> & {+ // Member custom fields the dialog opens with, set once the issue exists (they+ // are not part of the create payload).+ fieldValues?: { fieldId: number; userId: string }[];+};// The value a condition pins its field to. A field named by several conditions,// or by one that allows several values, is not pinned to any.@@ -258,16 +274,27 @@ export function groupByColumn(columnIds: number[], issues: Issue[]): Map<number,return byColumn;}+// What a drop into a group writes: the patch of the built-in fields it stands for,+// and the member custom field values, one per grouping level that names such a+// field. A two-level grouping merges both levels (see mergeAssign).+export interface GroupAssign {+ patch: IssuePatch;+ fields: { fieldId: number; userId: string | null }[];+}++// The assign of a built-in grouping: a patch alone, no custom field to write.+const patchOnly = (patch: IssuePatch): GroupAssign => ({ patch, fields: [] });+// One Project column / Table section when grouping by the chosen field. `key` is a// stable id (field-prefixed so different groupings never collide). `assign` is-// the patch that reassigns a issue dropped into this group; null marks a group-// that takes no drop (the single 'none' group, a finished cycle).+// what reassigns a issue dropped into this group; null marks a group that takes no+// drop (the single 'none' group, a finished cycle).export interface IssueGroup {key: string;name: string;color?: string;stateType?: StateType; // status groups, for the state icon- assign: IssuePatch | null;+ assign: GroupAssign | null;// What a filter condition on the grouping field matches this group by: the// field's value, plus the status an initiative or a cycle is in. Read by// buildGroups to drop the groups an active filter makes unreachable.@@ -284,6 +311,8 @@ export interface GroupLabels {noType: string;noInitiative: string;noCycle: string;+ // The "No value" group of a member custom field, which has no name of its own.+ noMember: string;priority: (value: string) => string;}@@ -302,6 +331,7 @@ export function buildGroups(}function allGroups(project: ProjectDetail, group: GroupField, labels: GroupLabels): IssueGroup[] {+ if (isCustomFieldKey(group)) return memberGroups(project, group, labels);switch (group) {case 'status':return project.columns.map((c) => ({@@ -309,7 +339,7 @@ function allGroups(project: ProjectDetail, group: GroupField, labels: GroupLabelname: c.name,color: c.color,stateType: c.stateType,- assign: { columnId: c.id },+ assign: patchOnly({ columnId: c.id }),values: [c.id],}));case 'assignee':@@ -319,13 +349,13 @@ function allGroups(project: ProjectDetail, group: GroupField, labels: GroupLabel.map((a) => ({key: `a${a.userId}`,name: a.name,- assign: { assigneeUserId: a.userId },+ assign: patchOnly({ assigneeUserId: a.userId }),values: [a.userId],})),{key: 'a-none',name: labels.noAssignee,- assign: { assigneeUserId: null },+ assign: patchOnly({ assigneeUserId: null }),values: [null],},];@@ -336,13 +366,13 @@ function allGroups(project: ProjectDetail, group: GroupField, labels: GroupLabel.map((a) => ({key: `d${a.userId}`,name: a.name,- assign: { delegateUserId: a.userId },+ assign: patchOnly({ delegateUserId: a.userId }),values: [a.userId],})),{key: 'd-none',name: labels.noDelegate,- assign: { delegateUserId: null },+ assign: patchOnly({ delegateUserId: null }),values: [null],},];@@ -351,10 +381,15 @@ function allGroups(project: ProjectDetail, group: GroupField, labels: GroupLabel...PRIORITY_ORDER.map((value) => ({key: `p${value}`,name: labels.priority(value),- assign: { priority: value },+ assign: patchOnly({ priority: value }),values: [value],})),- { key: 'p-none', name: labels.noPriority, assign: { priority: null }, values: [null] },+ {+ key: 'p-none',+ name: labels.noPriority,+ assign: patchOnly({ priority: null }),+ values: [null],+ },];case 'type':return [@@ -362,10 +397,10 @@ function allGroups(project: ProjectDetail, group: GroupField, labels: GroupLabelkey: `t${t.id}`,name: t.name,color: t.color,- assign: { typeId: t.id },+ assign: patchOnly({ typeId: t.id }),values: [t.id],})),- { key: 't-none', name: labels.noType, assign: { typeId: null }, values: [null] },+ { key: 't-none', name: labels.noType, assign: patchOnly({ typeId: null }), values: [null] },];case 'initiative': {// Lanes come from the initiatives the loaded issues are linked to (each issue@@ -378,14 +413,14 @@ function allGroups(project: ProjectDetail, group: GroupField, labels: GroupLabelconst options = [...seen.values()].sort(compareByGroupOrder).map((i) => ({key: `i${i.id}`,name: i.title,- assign: { initiativeId: i.id },+ assign: patchOnly({ initiativeId: i.id }),values: [i.id, statusValue(i.status)],}));return [{key: 'i-none',name: labels.noInitiative,- assign: { initiativeId: null },+ assign: patchOnly({ initiativeId: null }),values: [null],},...options,@@ -408,12 +443,17 @@ function allGroups(project: ProjectDetail, group: GroupField, labels: GroupLabel...project.plannedCycles.filter((c) => c.status !== 'upcoming'),];return [- { key: 'y-none', name: labels.noCycle, assign: { cycleId: null }, values: [null] },+ {+ key: 'y-none',+ name: labels.noCycle,+ assign: patchOnly({ cycleId: null }),+ values: [null],+ },...upcomingFirst.map((c) => ({key: `y${c.id}`,name: c.name,color: CYCLE_STATUS_META[c.status].color,- assign: { cycleId: c.id },+ assign: patchOnly({ cycleId: c.id }),values: [c.id, statusValue(c.status)],})),...[...namedByIssues.entries()]@@ -431,6 +471,33 @@ function allGroups(project: ProjectDetail, group: GroupField, labels: GroupLabel}}+// The groups of a member custom field: the people and agents its scope offers, then+// the issues that hold none. A grouping naming a field the project no longer has+// keeps only that last group, which then holds every issue.+function memberGroups(+ project: ProjectDetail,+ group: CustomFieldKey,+ labels: GroupLabels,+): IssueGroup[] {+ const field = groupMemberField(group, project.customFields);+ const fieldId = customFieldId(group);+ const candidates = field ? memberCandidates(project.assignees, field.memberScope ?? 'all') : [];+ return [+ ...candidates.map((a) => ({+ key: memberGroupKey(fieldId, a.userId),+ name: a.name,+ assign: { patch: {}, fields: [{ fieldId, userId: a.userId }] },+ values: [a.userId],+ })),+ {+ key: memberGroupKey(fieldId, null),+ name: labels.noMember,+ assign: { patch: {}, fields: [{ fieldId, userId: null }] },+ values: [null],+ },+ ];+}+// The groups an active filter still lets an issue reach. Only the conditions on// the grouping field itself narrow it: the rest decide which issues show, not// which groups exist. Operators that read a date or a text never apply to a@@ -459,6 +526,10 @@ function groupMatches(group: IssueGroup, cond: FilterCondition): boolean {// The group key a issue belongs to under the chosen field — matches a key from// buildGroups(project, group).export function groupKeyOf(issue: Issue, group: GroupField): string {+ if (isCustomFieldKey(group)) {+ const fieldId = customFieldId(group);+ return memberGroupKey(fieldId, memberFieldValue(issue, fieldId));+ }switch (group) {case 'status':return `c${issue.columnId}`;@@ -524,12 +595,24 @@ export function subgroupKey(groupKey: string, subKey: string): string {return `${groupKey}::${subKey}`;}+// The create-dialog defaults a group stands for: what a drop into it would assign,+// so an issue added inside the group lands in it. Its "No …" group prefills+// nothing — an unset field is what a new issue already has.+export function groupDefaults(assign: GroupAssign | null): NewIssueDefaults {+ return {+ ...assign?.patch,+ fieldValues: (assign?.fields ?? []).flatMap((f) =>+ f.userId != null ? [{ fieldId: f.fieldId, userId: f.userId }] : [],+ ),+ };+}+// The patch that reassigns a issue dropped into a two-level cell: the primary// group's assign combined with the sub-group's assign. Either may be null (the// 'none' group / a Table with no sub-grouping), in which case only the other// applies; both null means the cell is not a drop target.-export function mergeAssign(a: IssuePatch | null, b: IssuePatch | null): IssuePatch | null {+export function mergeAssign(a: GroupAssign | null, b: GroupAssign | null): GroupAssign | null {if (!a) return b;if (!b) return a;- return { ...a, ...b };+ return { patch: { ...a.patch, ...b.patch }, fields: [...a.fields, ...b.fields] };}diff --git a/apps/web/src/utils/viewSettings.ts b/apps/web/src/utils/viewSettings.tsindex 9865238a..04425d5d 100644--- a/apps/web/src/utils/viewSettings.ts+++ b/apps/web/src/utils/viewSettings.ts@@ -10,8 +10,11 @@ import type { Sort, WorkItemsView } from '@/utils/viewTypes';// Field the Project columns / Table sections group by. 'none' is a single flat// list (Table only). Project always groups by something. `subgroup` (below) adds a// second level: Project swimlanes / Table sub-sections, and may be 'none'.-export type GroupField =+// A `cf:<id>` key groups by a member custom field, which holds one person or agent+// the way assignee and delegate do.+export type BuiltinGroupField ='none' | 'status' | 'assignee' | 'delegate' | 'priority' | 'type' | 'initiative' | 'cycle';+export type GroupField = BuiltinGroupField | CustomFieldKey;// Issue properties that can be shown on a Project card or as a Table column.// 'id' is the issue identifier; 'status' the state; the rest map to issue@@ -67,10 +70,11 @@ export const DISPLAY_PROPERTIES: DisplayProperty[] = [// entity, with the section each one needs. Grouping by one while its section is off// would render columns for something the project does not show, and its property// would print a value from there.-const SECTION_FIELDS: Partial<Record<GroupField | DisplayProperty, keyof ProjectFeatures>> = {- initiative: 'initiatives',- cycle: 'cycles',-};+const SECTION_FIELDS: Partial<Record<BuiltinGroupField | DisplayProperty, keyof ProjectFeatures>> =+ {+ initiative: 'initiatives',+ cycle: 'cycles',+ };// Whether a grouping field or display property applies to a project: the ones behind// an optional section only while it is on. A custom field key is never section-bound.@@ -78,7 +82,7 @@ export function isFieldEnabled(field: GroupField | PropertyKey,features: ProjectFeatures,): boolean {- const section = SECTION_FIELDS[field as GroupField];+ const section = SECTION_FIELDS[field as BuiltinGroupField];return section === undefined || features[section];}@@ -129,9 +133,10 @@ export interface ViewSettings {calendarDateField: DateField;weekStart: WeekStart;// Group keys collapsed into the "Hidden columns" panel on the flat project (see- // KanbanBoard). Keys are namespaced by grouping field (c<id>/a<id>/p<v>/t<id>),- // so a set from one grouping never matches another. Empty for every other- // layout. Part of the display, so each saved view keeps its own hidden set.+ // KanbanBoard). Keys are namespaced by grouping field (c<id>/a<id>/p<v>/t<id>/+ // f<fieldId>u<userId>), so a set from one grouping never matches another. Empty+ // for every other layout. Part of the display, so each saved view keeps its own+ // hidden set.hiddenGroups: string[];// Group keys collapsed to a narrow vertical strip on the flat project. Unlike// hiddenGroups the column stays in place (in column order) with its count@@ -188,7 +193,7 @@ export function defaultViewSettings(view: WorkItemsView): ViewSettings {};}-const GROUP_FIELDS: GroupField[] = [+const GROUP_FIELDS: BuiltinGroupField[] = ['none','status','assignee',@@ -201,6 +206,10 @@ const GROUP_FIELDS: GroupField[] = [const DISPLAY_VALUES: string[] = DISPLAY_PROPERTIES;const TIMELINE_SCALES: TimelineScale[] = ['week', 'month', 'quarter'];+const isGroupField = (value: unknown): value is GroupField =>+ typeof value === 'string' &&+ (GROUP_FIELDS.includes(value as BuiltinGroupField) || isCustomFieldKey(value));+function normalizeSort(sort: unknown): Sort | null {if (sort && typeof sort === 'object') {const s = sort as Partial<Sort>;@@ -246,18 +255,14 @@ export function normalizeViewSettings(): ViewSettings {const d = defaultViewSettings(view);if (!s) return d;- const storedGroup = GROUP_FIELDS.includes(s.group as GroupField)- ? (s.group as GroupField)- : d.group;+ const storedGroup = isGroupField(s.group) ? s.group : d.group;// Timeline was previously hard-coded to State while its persisted group was// `none`. Normalize that legacy value so existing local and saved views keep// their visible grouping after the control becomes configurable.const group = view === 'timeline' && storedGroup === 'none' ? d.group : storedGroup;// The sub-group is only kept when it names a different field than the primary// group; grouping twice by the same field would collapse to one level.- const rawSubgroup = GROUP_FIELDS.includes(s.subgroup as GroupField)- ? (s.subgroup as GroupField)- : 'none';+ const rawSubgroup = isGroupField(s.subgroup) ? s.subgroup : 'none';return {sort: normalizeSort(s.sort) ?? d.sort,group,diff --git a/packages/db/drizzle/0094_moaning_mesmero.sql b/packages/db/drizzle/0094_moaning_mesmero.sqlnew file mode 100644index 00000000..555c0afe--- /dev/null+++ b/packages/db/drizzle/0094_moaning_mesmero.sql@@ -0,0 +1,15 @@+CREATE TABLE "agent_field_trigger" (+ "agent_id" integer NOT NULL,+ "field_id" integer NOT NULL,+ CONSTRAINT "agent_field_trigger_agent_id_field_id_pk" PRIMARY KEY("agent_id","field_id")+);+--> statement-breakpoint+ALTER TABLE "custom_field" DROP CONSTRAINT "custom_field_field_type_check";--> statement-breakpoint+ALTER TABLE "custom_field" ADD COLUMN "member_scope" text;--> statement-breakpoint+ALTER TABLE "issue_field_value" ADD COLUMN "value_user_id" text;--> statement-breakpoint+ALTER TABLE "agent_field_trigger" ADD CONSTRAINT "agent_field_trigger_agent_id_ai_agent_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."ai_agent"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "agent_field_trigger" ADD CONSTRAINT "agent_field_trigger_field_id_custom_field_id_fk" FOREIGN KEY ("field_id") REFERENCES "public"."custom_field"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+CREATE INDEX "agent_field_trigger_field_idx" ON "agent_field_trigger" USING btree ("field_id");--> statement-breakpoint+ALTER TABLE "issue_field_value" ADD CONSTRAINT "issue_field_value_value_user_id_user_id_fk" FOREIGN KEY ("value_user_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "custom_field" ADD CONSTRAINT "custom_field_member_scope_check" CHECK (("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')));--> statement-breakpoint+ALTER TABLE "custom_field" ADD CONSTRAINT "custom_field_field_type_check" CHECK ("custom_field"."field_type" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select', 'member'));\ No newline at end of filediff --git a/packages/db/drizzle/0095_square_mysterio.sql b/packages/db/drizzle/0095_square_mysterio.sqlnew file mode 100644index 00000000..7c02930b--- /dev/null+++ b/packages/db/drizzle/0095_square_mysterio.sql@@ -0,0 +1,4 @@+ALTER TABLE "agent_run" DROP CONSTRAINT "agent_run_trigger_check";--> statement-breakpoint+ALTER TABLE "agent_field_trigger" ADD COLUMN "delay_sec" integer DEFAULT 120 NOT NULL;--> statement-breakpoint+ALTER TABLE "agent_field_trigger" ADD CONSTRAINT "agent_field_trigger_delay_check" CHECK ("agent_field_trigger"."delay_sec" >= 0 AND "agent_field_trigger"."delay_sec" <= 86400);--> statement-breakpoint+ALTER TABLE "agent_run" ADD CONSTRAINT "agent_run_trigger_check" CHECK ("agent_run"."trigger" IN ('mention', 'delegation', 'field', 'schedule', 'manual'));\ No newline at end of filediff --git a/packages/db/drizzle/meta/0094_snapshot.json b/packages/db/drizzle/meta/0094_snapshot.jsonnew file mode 100644index 00000000..36634640--- /dev/null+++ b/packages/db/drizzle/meta/0094_snapshot.json@@ -0,0 +1,6721 @@+{+ "id": "9269ee30-b2b5-494b-82f1-861bfde98b7e",+ "prevId": "4ae51aad-4554-4020-830b-a815d6eeff2a",+ "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.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.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.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.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'"+ }+ },+ "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.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.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_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')"+ }+ },+ "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_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+ }+ },+ "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": {},+ "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+ },+ "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+ },+ "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_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": {}+ }+ },+ "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_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', 'schedule', 'manual')"+ }+ },+ "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+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "cron": {+ "name": "cron",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "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": true+ },+ "last_run_at": {+ "name": "last_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "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": {}+ }+ },+ "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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_schedule_agent_id_name_unique": {+ "name": "agent_schedule_agent_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "agent_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "agent_schedule_status_check": {+ "name": "agent_schedule_status_check",+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_skill": {+ "name": "agent_skill",+ "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": "''"+ },+ "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_project_idx": {+ "name": "agent_skill_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skill_project_id_project_id_fk": {+ "name": "agent_skill_project_id_project_id_fk",+ "tableFrom": "agent_skill",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_skill_project_id_name_unique": {+ "name": "agent_skill_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_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+ },+ "project_id": {+ "name": "project_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_project_idx": {+ "name": "agent_tool_project_idx",+ "columns": [+ {+ "expression": "project_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_project_id_project_id_fk": {+ "name": "agent_tool_project_id_project_id_fk",+ "tableFrom": "agent_tool",+ "tableTo": "project",+ "columnsFrom": [+ "project_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_project_id_tool_key_credential_id_unique": {+ "name": "agent_tool_project_id_tool_key_credential_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_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+ },+ "project_id": {+ "name": "project_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+ },+ "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+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "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": "'project'"+ },+ "last_seen_at": {+ "name": "last_seen_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": {+ "ai_agent_project_username_uq": {+ "name": "ai_agent_project_username_uq",+ "columns": [+ {+ "expression": "project_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_project_idx": {+ "name": "ai_agent_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "ai_agent_project_id_project_id_fk": {+ "name": "ai_agent_project_id_project_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "project",+ "columnsFrom": [+ "project_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_role_id_project_role_id_fk": {+ "name": "ai_agent_role_id_project_role_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "project_role",+ "columnsFrom": [+ "role_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', 'project')"+ },+ "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.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.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+ },+ "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.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_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+ },+ "project_id": {+ "name": "project_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_project_idx": {+ "name": "integration_credential_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "integration_credential_project_id_project_id_fk": {+ "name": "integration_credential_project_id_project_id_fk",+ "tableFrom": "integration_credential",+ "tableTo": "project",+ "columnsFrom": [+ "project_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+ },+ "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_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": {},+ "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+ },+ "subject": {+ "name": "subject",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "from_text": {+ "name": "from_text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "to_text": {+ "name": "to_text",+ "type": "text",+ "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_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_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_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.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.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.project": {+ "name": "project",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "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+ },+ "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+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_key_unique": {+ "name": "project_key_unique",+ "nullsNotDistinct": false,+ "columns": [+ "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_invite": {+ "name": "project_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()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "email": {+ "name": "email",+ "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+ },+ "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": {+ "project_invite_pending_uq": {+ "name": "project_invite_pending_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"project_invite\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_invite_project_idx": {+ "name": "project_invite_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_invite_project_id_project_id_fk": {+ "name": "project_invite_project_id_project_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_invite_role_id_project_role_id_fk": {+ "name": "project_invite_role_id_project_role_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "project_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_invite_invited_by_user_id_user_id_fk": {+ "name": "project_invite_invited_by_user_id_user_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "user",+ "columnsFrom": [+ "invited_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_invite_accepted_by_user_id_user_id_fk": {+ "name": "project_invite_accepted_by_user_id_user_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "user",+ "columnsFrom": [+ "accepted_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_invite_token_unique": {+ "name": "project_invite_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "project_invite_role_check": {+ "name": "project_invite_role_check",+ "value": "\"project_invite\".\"role\" IN ('owner', 'member')"+ },+ "project_invite_status_check": {+ "name": "project_invite_status_check",+ "value": "\"project_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"+ }+ },+ "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": "''"+ },+ "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_project_role_id_fk": {+ "name": "project_member_role_id_project_role_id_fk",+ "tableFrom": "project_member",+ "tableTo": "project_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')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_notification_setting": {+ "name": "project_notification_setting",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_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": {+ "project_notification_setting_project_id_project_id_fk": {+ "name": "project_notification_setting_project_id_project_id_fk",+ "tableFrom": "project_notification_setting",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_role": {+ "name": "project_role",+ "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+ },+ "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": {+ "project_role_default_uq": {+ "name": "project_role_default_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"project_role\".\"is_default\"",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_role_project_idx": {+ "name": "project_role_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_role_project_id_project_id_fk": {+ "name": "project_role_project_id_project_id_fk",+ "tableFrom": "project_role",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_role_project_id_name_unique": {+ "name": "project_role_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "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.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+ },+ "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', 'ai-chat')"+ },+ "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.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+ }+ },+ "enums": {},+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/packages/db/drizzle/meta/0095_snapshot.json b/packages/db/drizzle/meta/0095_snapshot.jsonnew file mode 100644index 00000000..22fcb9ed--- /dev/null+++ b/packages/db/drizzle/meta/0095_snapshot.json@@ -0,0 +1,6733 @@+{+ "id": "c82b2301-7df8-4ac3-8ea0-a66ed737b067",+ "prevId": "9269ee30-b2b5-494b-82f1-861bfde98b7e",+ "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.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.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.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.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'"+ }+ },+ "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.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.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_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')"+ }+ },+ "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_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+ },+ "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+ },+ "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_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": {}+ }+ },+ "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_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')"+ }+ },+ "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+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "cron": {+ "name": "cron",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "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": true+ },+ "last_run_at": {+ "name": "last_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "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": {}+ }+ },+ "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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_schedule_agent_id_name_unique": {+ "name": "agent_schedule_agent_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "agent_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "agent_schedule_status_check": {+ "name": "agent_schedule_status_check",+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_skill": {+ "name": "agent_skill",+ "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": "''"+ },+ "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_project_idx": {+ "name": "agent_skill_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skill_project_id_project_id_fk": {+ "name": "agent_skill_project_id_project_id_fk",+ "tableFrom": "agent_skill",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_skill_project_id_name_unique": {+ "name": "agent_skill_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_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+ },+ "project_id": {+ "name": "project_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_project_idx": {+ "name": "agent_tool_project_idx",+ "columns": [+ {+ "expression": "project_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_project_id_project_id_fk": {+ "name": "agent_tool_project_id_project_id_fk",+ "tableFrom": "agent_tool",+ "tableTo": "project",+ "columnsFrom": [+ "project_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_project_id_tool_key_credential_id_unique": {+ "name": "agent_tool_project_id_tool_key_credential_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_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+ },+ "project_id": {+ "name": "project_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+ },+ "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+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "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": "'project'"+ },+ "last_seen_at": {+ "name": "last_seen_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": {+ "ai_agent_project_username_uq": {+ "name": "ai_agent_project_username_uq",+ "columns": [+ {+ "expression": "project_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_project_idx": {+ "name": "ai_agent_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "ai_agent_project_id_project_id_fk": {+ "name": "ai_agent_project_id_project_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "project",+ "columnsFrom": [+ "project_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_role_id_project_role_id_fk": {+ "name": "ai_agent_role_id_project_role_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "project_role",+ "columnsFrom": [+ "role_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', 'project')"+ },+ "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.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.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+ },+ "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.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_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+ },+ "project_id": {+ "name": "project_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_project_idx": {+ "name": "integration_credential_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "integration_credential_project_id_project_id_fk": {+ "name": "integration_credential_project_id_project_id_fk",+ "tableFrom": "integration_credential",+ "tableTo": "project",+ "columnsFrom": [+ "project_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+ },+ "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_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": {},+ "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+ },+ "subject": {+ "name": "subject",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "from_text": {+ "name": "from_text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "to_text": {+ "name": "to_text",+ "type": "text",+ "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_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_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_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.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.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.project": {+ "name": "project",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "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+ },+ "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+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_key_unique": {+ "name": "project_key_unique",+ "nullsNotDistinct": false,+ "columns": [+ "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_invite": {+ "name": "project_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()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "email": {+ "name": "email",+ "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+ },+ "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": {+ "project_invite_pending_uq": {+ "name": "project_invite_pending_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"project_invite\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_invite_project_idx": {+ "name": "project_invite_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_invite_project_id_project_id_fk": {+ "name": "project_invite_project_id_project_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_invite_role_id_project_role_id_fk": {+ "name": "project_invite_role_id_project_role_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "project_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_invite_invited_by_user_id_user_id_fk": {+ "name": "project_invite_invited_by_user_id_user_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "user",+ "columnsFrom": [+ "invited_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_invite_accepted_by_user_id_user_id_fk": {+ "name": "project_invite_accepted_by_user_id_user_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "user",+ "columnsFrom": [+ "accepted_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_invite_token_unique": {+ "name": "project_invite_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "project_invite_role_check": {+ "name": "project_invite_role_check",+ "value": "\"project_invite\".\"role\" IN ('owner', 'member')"+ },+ "project_invite_status_check": {+ "name": "project_invite_status_check",+ "value": "\"project_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"+ }+ },+ "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": "''"+ },+ "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_project_role_id_fk": {+ "name": "project_member_role_id_project_role_id_fk",+ "tableFrom": "project_member",+ "tableTo": "project_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')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_notification_setting": {+ "name": "project_notification_setting",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_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": {+ "project_notification_setting_project_id_project_id_fk": {+ "name": "project_notification_setting_project_id_project_id_fk",+ "tableFrom": "project_notification_setting",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_role": {+ "name": "project_role",+ "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+ },+ "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": {+ "project_role_default_uq": {+ "name": "project_role_default_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"project_role\".\"is_default\"",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_role_project_idx": {+ "name": "project_role_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_role_project_id_project_id_fk": {+ "name": "project_role_project_id_project_id_fk",+ "tableFrom": "project_role",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_role_project_id_name_unique": {+ "name": "project_role_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "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.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+ },+ "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', 'ai-chat')"+ },+ "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.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+ }+ },+ "enums": {},+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.jsonindex 76312cd8..6c013d71 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -659,6 +659,20 @@"when": 1787325880651,"tag": "0093_git_drop_last_event","breakpoints": true+ },+ {+ "idx": 94,+ "version": "7",+ "when": 1787329480651,+ "tag": "0094_moaning_mesmero",+ "breakpoints": true+ },+ {+ "idx": 95,+ "version": "7",+ "when": 1787352480541,+ "tag": "0095_square_mysterio",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/schema/app.ts b/packages/db/src/schema/app.tsindex f712d0c6..b25d7654 100644--- a/packages/db/src/schema/app.ts+++ b/packages/db/src/schema/app.ts@@ -500,7 +500,7 @@ export const agentRun = pgTable(),check('agent_run_trigger_check',- sql`${t.trigger} IN ('mention', 'delegation', 'schedule', 'manual')`,+ sql`${t.trigger} IN ('mention', 'delegation', 'field', 'schedule', 'manual')`,),uniqueIndex('agent_run_schedule_fire_uq').on(t.scheduleId, t.scheduledFor),index('agent_run_due_idx').on(t.status, t.nextAttemptAt),@@ -844,6 +844,9 @@ export const customField = pgTable(}),name: text('name').notNull(),fieldType: text('field_type').notNull(),+ // Who a 'member' field may hold: every candidate, the people only, or the+ // agents only. NULL for every other field type.+ memberScope: text('member_scope'),// When true the field renders in the issue body (under the description),// like a second description; when false it renders as a Properties row.showInBody: boolean('show_in_body').notNull().default(false),@@ -853,7 +856,11 @@ export const customField = pgTable((t) => [check('custom_field_field_type_check',- sql`${t.fieldType} IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select')`,+ sql`${t.fieldType} IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select', 'member')`,+ ),+ check(+ 'custom_field_member_scope_check',+ sql`(${t.fieldType} = 'member') = (${t.memberScope} IS NOT NULL) AND (${t.memberScope} IS NULL OR ${t.memberScope} IN ('all', 'humans', 'agents'))`,),],);@@ -872,6 +879,30 @@ export const customFieldOption = pgTable((t) => [unique().on(t.fieldId, t.value)],);+// Which member custom fields an agent reacts to. Setting the agent into one of the+// listed fields enqueues a run for it, the way being made an issue's delegate does+// with trigger_on_assign. A field the agent is not linked to holds it without+// starting anything.+export const agentFieldTrigger = pgTable(+ 'agent_field_trigger',+ {+ agentId: integer('agent_id')+ .notNull()+ .references(() => aiAgent.id, { onDelete: 'cascade' }),+ fieldId: integer('field_id')+ .notNull()+ .references(() => customField.id, { onDelete: 'cascade' }),+ // How long this field's run waits before it becomes claimable. Each field carries+ // its own, the way delegation carries delegation_delay_sec.+ delaySec: integer('delay_sec').notNull().default(120),+ },+ (t) => [+ primaryKey({ columns: [t.agentId, t.fieldId] }),+ check('agent_field_trigger_delay_check', sql`${t.delaySec} >= 0 AND ${t.delaySec} <= 86400`),+ index('agent_field_trigger_field_idx').on(t.fieldId),+ ],+);+// A strategic grouping of issues inside a project (project-scoped, not// cross-project). Issues point at it through issue.initiative_id. status is a// fixed lifecycle enum; health is not stored — it is computed on the fly from the@@ -1115,6 +1146,9 @@ export const issueFieldValue = pgTable(// for a datetime the end stays NULL.valueDatetime: timestamp('value_datetime', { withTimezone: true }),valueDatetimeEnd: timestamp('value_datetime_end', { withTimezone: true }),+ // member fields. Deleting the user clears the field rather than the row, so the+ // issue keeps the rest of its values.+ valueUserId: text('value_user_id').references(() => user.id, { onDelete: 'set null' }),},(t) => [unique().on(t.issueId, t.fieldId)],);