@rudderhq/cli 0.1.0-canary.63 → 0.1.0-canary.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -402,6 +402,13 @@ var init_observability = __esm({
402
402
  }
403
403
  });
404
404
 
405
+ // ../packages/shared/src/types/workspace-backup.ts
406
+ var init_workspace_backup = __esm({
407
+ "../packages/shared/src/types/workspace-backup.ts"() {
408
+ "use strict";
409
+ }
410
+ });
411
+
405
412
  // ../packages/shared/src/validators/instance.ts
406
413
  import { z } from "zod";
407
414
  var instanceLocaleSchema, instanceGeneralSettingsSchema, patchInstanceGeneralSettingsSchema, instanceNotificationSettingsSchema, patchInstanceNotificationSettingsSchema, instanceLangfuseSettingsSchema, patchInstanceLangfuseSettingsSchema, operatorProfileSettingsSchema, patchOperatorProfileSettingsSchema, instancePathPickerSelectionTypeSchema, instancePathPickerRequestSchema, instancePathPickerResultSchema;
@@ -544,13 +551,13 @@ function validateModelFallbacksConfig(value, ctx, pathPrefix) {
544
551
  });
545
552
  return;
546
553
  }
547
- fallbackModels.forEach((fallback, index65) => {
554
+ fallbackModels.forEach((fallback, index66) => {
548
555
  if (typeof fallback === "string") {
549
556
  if (fallback.trim().length === 0) {
550
557
  ctx.addIssue({
551
558
  code: z4.ZodIssueCode.custom,
552
559
  message: "modelFallbacks string entries must be non-empty",
553
- path: [...pathPrefix, "modelFallbacks", index65]
560
+ path: [...pathPrefix, "modelFallbacks", index66]
554
561
  });
555
562
  }
556
563
  return;
@@ -559,7 +566,7 @@ function validateModelFallbacksConfig(value, ctx, pathPrefix) {
559
566
  ctx.addIssue({
560
567
  code: z4.ZodIssueCode.custom,
561
568
  message: "modelFallbacks entries must be strings or runtime/model objects",
562
- path: [...pathPrefix, "modelFallbacks", index65]
569
+ path: [...pathPrefix, "modelFallbacks", index66]
563
570
  });
564
571
  return;
565
572
  }
@@ -567,27 +574,27 @@ function validateModelFallbacksConfig(value, ctx, pathPrefix) {
567
574
  ctx.addIssue({
568
575
  code: z4.ZodIssueCode.custom,
569
576
  message: "modelFallbacks entries must include agentRuntimeType",
570
- path: [...pathPrefix, "modelFallbacks", index65, "agentRuntimeType"]
577
+ path: [...pathPrefix, "modelFallbacks", index66, "agentRuntimeType"]
571
578
  });
572
579
  } else if (!agentRuntimeTypes.has(fallback.agentRuntimeType)) {
573
580
  ctx.addIssue({
574
581
  code: z4.ZodIssueCode.custom,
575
582
  message: "modelFallbacks entries must include a valid agentRuntimeType",
576
- path: [...pathPrefix, "modelFallbacks", index65, "agentRuntimeType"]
583
+ path: [...pathPrefix, "modelFallbacks", index66, "agentRuntimeType"]
577
584
  });
578
585
  }
579
586
  if (typeof fallback.model !== "string" || fallback.model.trim().length === 0) {
580
587
  ctx.addIssue({
581
588
  code: z4.ZodIssueCode.custom,
582
589
  message: "modelFallbacks entries must include model",
583
- path: [...pathPrefix, "modelFallbacks", index65, "model"]
590
+ path: [...pathPrefix, "modelFallbacks", index66, "model"]
584
591
  });
585
592
  }
586
593
  if (fallback.config !== void 0 && !isRecord(fallback.config)) {
587
594
  ctx.addIssue({
588
595
  code: z4.ZodIssueCode.custom,
589
596
  message: "modelFallbacks entry config must be an object",
590
- path: [...pathPrefix, "modelFallbacks", index65, "config"]
597
+ path: [...pathPrefix, "modelFallbacks", index66, "config"]
591
598
  });
592
599
  } else if (isRecord(fallback.config) && fallback.config.env !== void 0) {
593
600
  const parsed = envConfigSchema.safeParse(fallback.config.env);
@@ -595,7 +602,7 @@ function validateModelFallbacksConfig(value, ctx, pathPrefix) {
595
602
  ctx.addIssue({
596
603
  code: z4.ZodIssueCode.custom,
597
604
  message: "modelFallbacks entry config.env must be a map of valid env bindings",
598
- path: [...pathPrefix, "modelFallbacks", index65, "config", "env"]
605
+ path: [...pathPrefix, "modelFallbacks", index66, "config", "env"]
599
606
  });
600
607
  }
601
608
  }
@@ -1609,161 +1616,177 @@ var init_execution_workspace = __esm({
1609
1616
  }
1610
1617
  });
1611
1618
 
1612
- // ../packages/shared/src/validators/goal.ts
1619
+ // ../packages/shared/src/validators/workspace-backup.ts
1613
1620
  import { z as z16 } from "zod";
1621
+ var workspaceBackupTriggerSourceSchema, createWorkspaceBackupSchema, restoreWorkspaceBackupSchema;
1622
+ var init_workspace_backup2 = __esm({
1623
+ "../packages/shared/src/validators/workspace-backup.ts"() {
1624
+ "use strict";
1625
+ workspaceBackupTriggerSourceSchema = z16.enum(["manual", "scheduled", "pre_restore"]);
1626
+ createWorkspaceBackupSchema = z16.object({
1627
+ triggerSource: workspaceBackupTriggerSourceSchema.optional().default("manual")
1628
+ }).strict();
1629
+ restoreWorkspaceBackupSchema = z16.object({
1630
+ confirm: z16.literal(true)
1631
+ }).strict();
1632
+ }
1633
+ });
1634
+
1635
+ // ../packages/shared/src/validators/goal.ts
1636
+ import { z as z17 } from "zod";
1614
1637
  var createGoalSchema, updateGoalSchema;
1615
1638
  var init_goal = __esm({
1616
1639
  "../packages/shared/src/validators/goal.ts"() {
1617
1640
  "use strict";
1618
1641
  init_constants();
1619
- createGoalSchema = z16.object({
1620
- title: z16.string().min(1),
1621
- description: z16.string().optional().nullable(),
1622
- level: z16.enum(GOAL_LEVELS).optional().default("task"),
1623
- status: z16.enum(GOAL_STATUSES).optional().default("planned"),
1624
- parentId: z16.string().uuid().optional().nullable(),
1625
- ownerAgentId: z16.string().uuid().optional().nullable()
1642
+ createGoalSchema = z17.object({
1643
+ title: z17.string().min(1),
1644
+ description: z17.string().optional().nullable(),
1645
+ level: z17.enum(GOAL_LEVELS).optional().default("task"),
1646
+ status: z17.enum(GOAL_STATUSES).optional().default("planned"),
1647
+ parentId: z17.string().uuid().optional().nullable(),
1648
+ ownerAgentId: z17.string().uuid().optional().nullable()
1626
1649
  });
1627
1650
  updateGoalSchema = createGoalSchema.partial();
1628
1651
  }
1629
1652
  });
1630
1653
 
1631
1654
  // ../packages/shared/src/validators/approval.ts
1632
- import { z as z17 } from "zod";
1655
+ import { z as z18 } from "zod";
1633
1656
  var createApprovalSchema, resolveApprovalSchema, requestApprovalRevisionSchema, resubmitApprovalSchema, addApprovalCommentSchema;
1634
1657
  var init_approval = __esm({
1635
1658
  "../packages/shared/src/validators/approval.ts"() {
1636
1659
  "use strict";
1637
1660
  init_constants();
1638
- createApprovalSchema = z17.object({
1639
- type: z17.enum(APPROVAL_TYPES),
1640
- requestedByAgentId: z17.string().uuid().optional().nullable(),
1641
- payload: z17.record(z17.unknown()),
1642
- issueIds: z17.array(z17.string().uuid()).optional()
1661
+ createApprovalSchema = z18.object({
1662
+ type: z18.enum(APPROVAL_TYPES),
1663
+ requestedByAgentId: z18.string().uuid().optional().nullable(),
1664
+ payload: z18.record(z18.unknown()),
1665
+ issueIds: z18.array(z18.string().uuid()).optional()
1643
1666
  });
1644
- resolveApprovalSchema = z17.object({
1645
- decisionNote: z17.string().optional().nullable(),
1646
- decidedByUserId: z17.string().optional().default("board")
1667
+ resolveApprovalSchema = z18.object({
1668
+ decisionNote: z18.string().optional().nullable(),
1669
+ decidedByUserId: z18.string().optional().default("board")
1647
1670
  });
1648
- requestApprovalRevisionSchema = z17.object({
1649
- decisionNote: z17.string().optional().nullable(),
1650
- decidedByUserId: z17.string().optional().default("board")
1671
+ requestApprovalRevisionSchema = z18.object({
1672
+ decisionNote: z18.string().optional().nullable(),
1673
+ decidedByUserId: z18.string().optional().default("board")
1651
1674
  });
1652
- resubmitApprovalSchema = z17.object({
1653
- payload: z17.record(z17.unknown()).optional()
1675
+ resubmitApprovalSchema = z18.object({
1676
+ payload: z18.record(z18.unknown()).optional()
1654
1677
  });
1655
- addApprovalCommentSchema = z17.object({
1656
- body: z17.string().min(1)
1678
+ addApprovalCommentSchema = z18.object({
1679
+ body: z18.string().min(1)
1657
1680
  });
1658
1681
  }
1659
1682
  });
1660
1683
 
1661
1684
  // ../packages/shared/src/validators/automation.ts
1662
- import { z as z18 } from "zod";
1685
+ import { z as z19 } from "zod";
1663
1686
  var createAutomationSchema, updateAutomationSchema, baseTriggerSchema, createAutomationTriggerSchema, updateAutomationTriggerSchema, runAutomationSchema, rotateAutomationTriggerSecretSchema;
1664
1687
  var init_automation = __esm({
1665
1688
  "../packages/shared/src/validators/automation.ts"() {
1666
1689
  "use strict";
1667
1690
  init_constants();
1668
- createAutomationSchema = z18.object({
1669
- projectId: z18.string().uuid(),
1670
- goalId: z18.string().uuid().optional().nullable(),
1671
- parentIssueId: z18.string().uuid().optional().nullable(),
1672
- title: z18.string().trim().min(1).max(200),
1673
- description: z18.string().optional().nullable(),
1674
- assigneeAgentId: z18.string().uuid(),
1675
- priority: z18.enum(ISSUE_PRIORITIES).optional().default("medium"),
1676
- status: z18.enum(AUTOMATION_STATUSES).optional().default("active"),
1677
- concurrencyPolicy: z18.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
1678
- catchUpPolicy: z18.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed")
1691
+ createAutomationSchema = z19.object({
1692
+ projectId: z19.string().uuid(),
1693
+ goalId: z19.string().uuid().optional().nullable(),
1694
+ parentIssueId: z19.string().uuid().optional().nullable(),
1695
+ title: z19.string().trim().min(1).max(200),
1696
+ description: z19.string().optional().nullable(),
1697
+ assigneeAgentId: z19.string().uuid(),
1698
+ priority: z19.enum(ISSUE_PRIORITIES).optional().default("medium"),
1699
+ status: z19.enum(AUTOMATION_STATUSES).optional().default("active"),
1700
+ concurrencyPolicy: z19.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
1701
+ catchUpPolicy: z19.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed")
1679
1702
  });
1680
1703
  updateAutomationSchema = createAutomationSchema.partial();
1681
- baseTriggerSchema = z18.object({
1682
- label: z18.string().trim().max(120).optional().nullable(),
1683
- enabled: z18.boolean().optional().default(true)
1704
+ baseTriggerSchema = z19.object({
1705
+ label: z19.string().trim().max(120).optional().nullable(),
1706
+ enabled: z19.boolean().optional().default(true)
1684
1707
  });
1685
- createAutomationTriggerSchema = z18.discriminatedUnion("kind", [
1708
+ createAutomationTriggerSchema = z19.discriminatedUnion("kind", [
1686
1709
  baseTriggerSchema.extend({
1687
- kind: z18.literal("schedule"),
1688
- cronExpression: z18.string().trim().min(1),
1689
- timezone: z18.string().trim().min(1).default("UTC")
1710
+ kind: z19.literal("schedule"),
1711
+ cronExpression: z19.string().trim().min(1),
1712
+ timezone: z19.string().trim().min(1).default("UTC")
1690
1713
  }),
1691
1714
  baseTriggerSchema.extend({
1692
- kind: z18.literal("webhook"),
1693
- signingMode: z18.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().default("bearer"),
1694
- replayWindowSec: z18.number().int().min(30).max(86400).optional().default(300)
1715
+ kind: z19.literal("webhook"),
1716
+ signingMode: z19.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().default("bearer"),
1717
+ replayWindowSec: z19.number().int().min(30).max(86400).optional().default(300)
1695
1718
  }),
1696
1719
  baseTriggerSchema.extend({
1697
- kind: z18.literal("api")
1720
+ kind: z19.literal("api")
1698
1721
  })
1699
1722
  ]);
1700
- updateAutomationTriggerSchema = z18.object({
1701
- label: z18.string().trim().max(120).optional().nullable(),
1702
- enabled: z18.boolean().optional(),
1703
- cronExpression: z18.string().trim().min(1).optional().nullable(),
1704
- timezone: z18.string().trim().min(1).optional().nullable(),
1705
- signingMode: z18.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().nullable(),
1706
- replayWindowSec: z18.number().int().min(30).max(86400).optional().nullable()
1723
+ updateAutomationTriggerSchema = z19.object({
1724
+ label: z19.string().trim().max(120).optional().nullable(),
1725
+ enabled: z19.boolean().optional(),
1726
+ cronExpression: z19.string().trim().min(1).optional().nullable(),
1727
+ timezone: z19.string().trim().min(1).optional().nullable(),
1728
+ signingMode: z19.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().nullable(),
1729
+ replayWindowSec: z19.number().int().min(30).max(86400).optional().nullable()
1707
1730
  });
1708
- runAutomationSchema = z18.object({
1709
- triggerId: z18.string().uuid().optional().nullable(),
1710
- payload: z18.record(z18.unknown()).optional().nullable(),
1711
- idempotencyKey: z18.string().trim().max(255).optional().nullable(),
1712
- source: z18.enum(["manual", "api"]).optional().default("manual")
1731
+ runAutomationSchema = z19.object({
1732
+ triggerId: z19.string().uuid().optional().nullable(),
1733
+ payload: z19.record(z19.unknown()).optional().nullable(),
1734
+ idempotencyKey: z19.string().trim().max(255).optional().nullable(),
1735
+ source: z19.enum(["manual", "api"]).optional().default("manual")
1713
1736
  });
1714
- rotateAutomationTriggerSecretSchema = z18.object({});
1737
+ rotateAutomationTriggerSecretSchema = z19.object({});
1715
1738
  }
1716
1739
  });
1717
1740
 
1718
1741
  // ../packages/shared/src/validators/calendar.ts
1719
- import { z as z19 } from "zod";
1742
+ import { z as z20 } from "zod";
1720
1743
  var nullableUuid, createCalendarSourceSchema, updateCalendarSourceSchema, calendarEventBaseSchema, createCalendarEventSchema, updateCalendarEventSchema, calendarEventListQuerySchema, googleCalendarSyncSchema, updateGoogleCalendarOAuthConfigSchema;
1721
1744
  var init_calendar = __esm({
1722
1745
  "../packages/shared/src/validators/calendar.ts"() {
1723
1746
  "use strict";
1724
1747
  init_constants();
1725
- nullableUuid = z19.string().uuid().optional().nullable();
1726
- createCalendarSourceSchema = z19.object({
1727
- type: z19.enum(CALENDAR_SOURCE_TYPES).optional().default("rudder_local"),
1728
- name: z19.string().trim().min(1).max(160),
1729
- ownerType: z19.enum(CALENDAR_OWNER_TYPES).optional().default("user"),
1730
- ownerUserId: z19.string().trim().min(1).optional().nullable(),
1748
+ nullableUuid = z20.string().uuid().optional().nullable();
1749
+ createCalendarSourceSchema = z20.object({
1750
+ type: z20.enum(CALENDAR_SOURCE_TYPES).optional().default("rudder_local"),
1751
+ name: z20.string().trim().min(1).max(160),
1752
+ ownerType: z20.enum(CALENDAR_OWNER_TYPES).optional().default("user"),
1753
+ ownerUserId: z20.string().trim().min(1).optional().nullable(),
1731
1754
  ownerAgentId: nullableUuid,
1732
- externalProvider: z19.string().trim().min(1).max(80).optional().nullable(),
1733
- externalCalendarId: z19.string().trim().min(1).max(512).optional().nullable(),
1734
- visibilityDefault: z19.enum(CALENDAR_VISIBILITIES).optional().default("full"),
1735
- status: z19.enum(CALENDAR_SOURCE_STATUSES).optional().default("active"),
1736
- syncCursorJson: z19.record(z19.unknown()).optional().nullable()
1755
+ externalProvider: z20.string().trim().min(1).max(80).optional().nullable(),
1756
+ externalCalendarId: z20.string().trim().min(1).max(512).optional().nullable(),
1757
+ visibilityDefault: z20.enum(CALENDAR_VISIBILITIES).optional().default("full"),
1758
+ status: z20.enum(CALENDAR_SOURCE_STATUSES).optional().default("active"),
1759
+ syncCursorJson: z20.record(z20.unknown()).optional().nullable()
1737
1760
  });
1738
1761
  updateCalendarSourceSchema = createCalendarSourceSchema.partial().extend({
1739
- lastSyncedAt: z19.coerce.date().optional().nullable()
1762
+ lastSyncedAt: z20.coerce.date().optional().nullable()
1740
1763
  });
1741
- calendarEventBaseSchema = z19.object({
1764
+ calendarEventBaseSchema = z20.object({
1742
1765
  sourceId: nullableUuid,
1743
- eventKind: z19.enum(CALENDAR_EVENT_KINDS),
1744
- eventStatus: z19.enum(CALENDAR_EVENT_STATUSES).optional().default("planned"),
1745
- ownerType: z19.enum(CALENDAR_OWNER_TYPES),
1746
- ownerUserId: z19.string().trim().min(1).optional().nullable(),
1766
+ eventKind: z20.enum(CALENDAR_EVENT_KINDS),
1767
+ eventStatus: z20.enum(CALENDAR_EVENT_STATUSES).optional().default("planned"),
1768
+ ownerType: z20.enum(CALENDAR_OWNER_TYPES),
1769
+ ownerUserId: z20.string().trim().min(1).optional().nullable(),
1747
1770
  ownerAgentId: nullableUuid,
1748
- title: z19.string().trim().min(1).max(240),
1749
- description: z19.string().optional().nullable(),
1750
- startAt: z19.coerce.date(),
1751
- endAt: z19.coerce.date(),
1752
- timezone: z19.string().trim().min(1).max(80).optional().default("UTC"),
1753
- allDay: z19.boolean().optional().default(false),
1754
- visibility: z19.enum(CALENDAR_VISIBILITIES).optional().default("full"),
1771
+ title: z20.string().trim().min(1).max(240),
1772
+ description: z20.string().optional().nullable(),
1773
+ startAt: z20.coerce.date(),
1774
+ endAt: z20.coerce.date(),
1775
+ timezone: z20.string().trim().min(1).max(80).optional().default("UTC"),
1776
+ allDay: z20.boolean().optional().default(false),
1777
+ visibility: z20.enum(CALENDAR_VISIBILITIES).optional().default("full"),
1755
1778
  issueId: nullableUuid,
1756
1779
  projectId: nullableUuid,
1757
1780
  goalId: nullableUuid,
1758
1781
  approvalId: nullableUuid,
1759
1782
  heartbeatRunId: nullableUuid,
1760
1783
  activityId: nullableUuid,
1761
- sourceMode: z19.enum(CALENDAR_SOURCE_MODES).optional().default("manual"),
1762
- externalProvider: z19.string().trim().min(1).max(80).optional().nullable(),
1763
- externalCalendarId: z19.string().trim().min(1).max(512).optional().nullable(),
1764
- externalEventId: z19.string().trim().min(1).max(512).optional().nullable(),
1765
- externalEtag: z19.string().trim().min(1).max(512).optional().nullable(),
1766
- externalUpdatedAt: z19.coerce.date().optional().nullable()
1784
+ sourceMode: z20.enum(CALENDAR_SOURCE_MODES).optional().default("manual"),
1785
+ externalProvider: z20.string().trim().min(1).max(80).optional().nullable(),
1786
+ externalCalendarId: z20.string().trim().min(1).max(512).optional().nullable(),
1787
+ externalEventId: z20.string().trim().min(1).max(512).optional().nullable(),
1788
+ externalEtag: z20.string().trim().min(1).max(512).optional().nullable(),
1789
+ externalUpdatedAt: z20.coerce.date().optional().nullable()
1767
1790
  });
1768
1791
  createCalendarEventSchema = calendarEventBaseSchema.refine(
1769
1792
  (value) => value.endAt.getTime() > value.startAt.getTime(),
@@ -1773,24 +1796,24 @@ var init_calendar = __esm({
1773
1796
  (value) => value.startAt === void 0 || value.endAt === void 0 || value.endAt.getTime() > value.startAt.getTime(),
1774
1797
  { path: ["endAt"], message: "End time must be after start time" }
1775
1798
  );
1776
- calendarEventListQuerySchema = z19.object({
1777
- start: z19.coerce.date(),
1778
- end: z19.coerce.date(),
1779
- agentIds: z19.string().optional(),
1780
- sourceIds: z19.string().optional(),
1781
- eventKinds: z19.string().optional(),
1782
- statuses: z19.string().optional()
1799
+ calendarEventListQuerySchema = z20.object({
1800
+ start: z20.coerce.date(),
1801
+ end: z20.coerce.date(),
1802
+ agentIds: z20.string().optional(),
1803
+ sourceIds: z20.string().optional(),
1804
+ eventKinds: z20.string().optional(),
1805
+ statuses: z20.string().optional()
1783
1806
  }).refine(
1784
1807
  (value) => value.end.getTime() > value.start.getTime(),
1785
1808
  { path: ["end"], message: "End time must be after start time" }
1786
1809
  );
1787
- googleCalendarSyncSchema = z19.object({
1788
- sourceId: z19.string().uuid().optional().nullable()
1810
+ googleCalendarSyncSchema = z20.object({
1811
+ sourceId: z20.string().uuid().optional().nullable()
1789
1812
  });
1790
- updateGoogleCalendarOAuthConfigSchema = z19.object({
1791
- clientId: z19.string().trim().min(1).max(512).optional(),
1792
- clientSecret: z19.string().trim().min(1).max(2048).optional(),
1793
- clear: z19.boolean().optional().default(false)
1813
+ updateGoogleCalendarOAuthConfigSchema = z20.object({
1814
+ clientId: z20.string().trim().min(1).max(512).optional(),
1815
+ clientSecret: z20.string().trim().min(1).max(2048).optional(),
1816
+ clear: z20.boolean().optional().default(false)
1794
1817
  }).refine(
1795
1818
  (value) => value.clear || value.clientId !== void 0 || value.clientSecret !== void 0,
1796
1819
  { message: "Provide credentials or clear the stored Google Calendar OAuth configuration" }
@@ -1799,70 +1822,70 @@ var init_calendar = __esm({
1799
1822
  });
1800
1823
 
1801
1824
  // ../packages/shared/src/validators/cost.ts
1802
- import { z as z20 } from "zod";
1825
+ import { z as z21 } from "zod";
1803
1826
  var createCostEventSchema, updateBudgetSchema;
1804
1827
  var init_cost = __esm({
1805
1828
  "../packages/shared/src/validators/cost.ts"() {
1806
1829
  "use strict";
1807
1830
  init_constants();
1808
- createCostEventSchema = z20.object({
1809
- agentId: z20.string().uuid(),
1810
- issueId: z20.string().uuid().optional().nullable(),
1811
- projectId: z20.string().uuid().optional().nullable(),
1812
- goalId: z20.string().uuid().optional().nullable(),
1813
- heartbeatRunId: z20.string().uuid().optional().nullable(),
1814
- billingCode: z20.string().optional().nullable(),
1815
- provider: z20.string().min(1),
1816
- biller: z20.string().min(1).optional(),
1817
- billingType: z20.enum(BILLING_TYPES).optional().default("unknown"),
1818
- model: z20.string().min(1),
1819
- inputTokens: z20.number().int().nonnegative().optional().default(0),
1820
- cachedInputTokens: z20.number().int().nonnegative().optional().default(0),
1821
- outputTokens: z20.number().int().nonnegative().optional().default(0),
1822
- costCents: z20.number().int().nonnegative(),
1823
- occurredAt: z20.string().datetime()
1831
+ createCostEventSchema = z21.object({
1832
+ agentId: z21.string().uuid(),
1833
+ issueId: z21.string().uuid().optional().nullable(),
1834
+ projectId: z21.string().uuid().optional().nullable(),
1835
+ goalId: z21.string().uuid().optional().nullable(),
1836
+ heartbeatRunId: z21.string().uuid().optional().nullable(),
1837
+ billingCode: z21.string().optional().nullable(),
1838
+ provider: z21.string().min(1),
1839
+ biller: z21.string().min(1).optional(),
1840
+ billingType: z21.enum(BILLING_TYPES).optional().default("unknown"),
1841
+ model: z21.string().min(1),
1842
+ inputTokens: z21.number().int().nonnegative().optional().default(0),
1843
+ cachedInputTokens: z21.number().int().nonnegative().optional().default(0),
1844
+ outputTokens: z21.number().int().nonnegative().optional().default(0),
1845
+ costCents: z21.number().int().nonnegative(),
1846
+ occurredAt: z21.string().datetime()
1824
1847
  }).transform((value) => ({
1825
1848
  ...value,
1826
1849
  biller: value.biller ?? value.provider
1827
1850
  }));
1828
- updateBudgetSchema = z20.object({
1829
- budgetMonthlyCents: z20.number().int().nonnegative()
1851
+ updateBudgetSchema = z21.object({
1852
+ budgetMonthlyCents: z21.number().int().nonnegative()
1830
1853
  });
1831
1854
  }
1832
1855
  });
1833
1856
 
1834
1857
  // ../packages/shared/src/validators/finance.ts
1835
- import { z as z21 } from "zod";
1858
+ import { z as z22 } from "zod";
1836
1859
  var createFinanceEventSchema;
1837
1860
  var init_finance = __esm({
1838
1861
  "../packages/shared/src/validators/finance.ts"() {
1839
1862
  "use strict";
1840
1863
  init_constants();
1841
- createFinanceEventSchema = z21.object({
1842
- agentId: z21.string().uuid().optional().nullable(),
1843
- issueId: z21.string().uuid().optional().nullable(),
1844
- projectId: z21.string().uuid().optional().nullable(),
1845
- goalId: z21.string().uuid().optional().nullable(),
1846
- heartbeatRunId: z21.string().uuid().optional().nullable(),
1847
- costEventId: z21.string().uuid().optional().nullable(),
1848
- billingCode: z21.string().optional().nullable(),
1849
- description: z21.string().max(500).optional().nullable(),
1850
- eventKind: z21.enum(FINANCE_EVENT_KINDS),
1851
- direction: z21.enum(FINANCE_DIRECTIONS).optional().default("debit"),
1852
- biller: z21.string().min(1),
1853
- provider: z21.string().min(1).optional().nullable(),
1854
- executionAgentRuntimeType: z21.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
1855
- pricingTier: z21.string().min(1).optional().nullable(),
1856
- region: z21.string().min(1).optional().nullable(),
1857
- model: z21.string().min(1).optional().nullable(),
1858
- quantity: z21.number().int().nonnegative().optional().nullable(),
1859
- unit: z21.enum(FINANCE_UNITS).optional().nullable(),
1860
- amountCents: z21.number().int().nonnegative(),
1861
- currency: z21.string().length(3).optional().default("USD"),
1862
- estimated: z21.boolean().optional().default(false),
1863
- externalInvoiceId: z21.string().optional().nullable(),
1864
- metadataJson: z21.record(z21.string(), z21.unknown()).optional().nullable(),
1865
- occurredAt: z21.string().datetime()
1864
+ createFinanceEventSchema = z22.object({
1865
+ agentId: z22.string().uuid().optional().nullable(),
1866
+ issueId: z22.string().uuid().optional().nullable(),
1867
+ projectId: z22.string().uuid().optional().nullable(),
1868
+ goalId: z22.string().uuid().optional().nullable(),
1869
+ heartbeatRunId: z22.string().uuid().optional().nullable(),
1870
+ costEventId: z22.string().uuid().optional().nullable(),
1871
+ billingCode: z22.string().optional().nullable(),
1872
+ description: z22.string().max(500).optional().nullable(),
1873
+ eventKind: z22.enum(FINANCE_EVENT_KINDS),
1874
+ direction: z22.enum(FINANCE_DIRECTIONS).optional().default("debit"),
1875
+ biller: z22.string().min(1),
1876
+ provider: z22.string().min(1).optional().nullable(),
1877
+ executionAgentRuntimeType: z22.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
1878
+ pricingTier: z22.string().min(1).optional().nullable(),
1879
+ region: z22.string().min(1).optional().nullable(),
1880
+ model: z22.string().min(1).optional().nullable(),
1881
+ quantity: z22.number().int().nonnegative().optional().nullable(),
1882
+ unit: z22.enum(FINANCE_UNITS).optional().nullable(),
1883
+ amountCents: z22.number().int().nonnegative(),
1884
+ currency: z22.string().length(3).optional().default("USD"),
1885
+ estimated: z22.boolean().optional().default(false),
1886
+ externalInvoiceId: z22.string().optional().nullable(),
1887
+ metadataJson: z22.record(z22.string(), z22.unknown()).optional().nullable(),
1888
+ occurredAt: z22.string().datetime()
1866
1889
  }).transform((value) => ({
1867
1890
  ...value,
1868
1891
  currency: value.currency.toUpperCase()
@@ -1871,81 +1894,81 @@ var init_finance = __esm({
1871
1894
  });
1872
1895
 
1873
1896
  // ../packages/shared/src/validators/asset.ts
1874
- import { z as z22 } from "zod";
1897
+ import { z as z23 } from "zod";
1875
1898
  var createAssetImageMetadataSchema;
1876
1899
  var init_asset = __esm({
1877
1900
  "../packages/shared/src/validators/asset.ts"() {
1878
1901
  "use strict";
1879
- createAssetImageMetadataSchema = z22.object({
1880
- namespace: z22.string().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()
1902
+ createAssetImageMetadataSchema = z23.object({
1903
+ namespace: z23.string().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()
1881
1904
  });
1882
1905
  }
1883
1906
  });
1884
1907
 
1885
1908
  // ../packages/shared/src/validators/access.ts
1886
- import { z as z23 } from "zod";
1909
+ import { z as z24 } from "zod";
1887
1910
  var createCompanyInviteSchema, createOpenClawInvitePromptSchema, acceptInviteSchema, listJoinRequestsQuerySchema, claimJoinRequestApiKeySchema, boardCliAuthAccessLevelSchema, createCliAuthChallengeSchema, resolveCliAuthChallengeSchema, updateMemberPermissionsSchema, updateUserCompanyAccessSchema;
1888
1911
  var init_access = __esm({
1889
1912
  "../packages/shared/src/validators/access.ts"() {
1890
1913
  "use strict";
1891
1914
  init_constants();
1892
- createCompanyInviteSchema = z23.object({
1893
- allowedJoinTypes: z23.enum(INVITE_JOIN_TYPES).default("both"),
1894
- defaultsPayload: z23.record(z23.string(), z23.unknown()).optional().nullable(),
1895
- agentMessage: z23.string().max(4e3).optional().nullable()
1915
+ createCompanyInviteSchema = z24.object({
1916
+ allowedJoinTypes: z24.enum(INVITE_JOIN_TYPES).default("both"),
1917
+ defaultsPayload: z24.record(z24.string(), z24.unknown()).optional().nullable(),
1918
+ agentMessage: z24.string().max(4e3).optional().nullable()
1896
1919
  });
1897
- createOpenClawInvitePromptSchema = z23.object({
1898
- agentMessage: z23.string().max(4e3).optional().nullable()
1920
+ createOpenClawInvitePromptSchema = z24.object({
1921
+ agentMessage: z24.string().max(4e3).optional().nullable()
1899
1922
  });
1900
- acceptInviteSchema = z23.object({
1901
- requestType: z23.enum(JOIN_REQUEST_TYPES),
1902
- agentName: z23.string().min(1).max(120).optional(),
1903
- agentRuntimeType: z23.enum(AGENT_RUNTIME_TYPES).optional(),
1904
- capabilities: z23.string().max(4e3).optional().nullable(),
1905
- agentDefaultsPayload: z23.record(z23.string(), z23.unknown()).optional().nullable(),
1923
+ acceptInviteSchema = z24.object({
1924
+ requestType: z24.enum(JOIN_REQUEST_TYPES),
1925
+ agentName: z24.string().min(1).max(120).optional(),
1926
+ agentRuntimeType: z24.enum(AGENT_RUNTIME_TYPES).optional(),
1927
+ capabilities: z24.string().max(4e3).optional().nullable(),
1928
+ agentDefaultsPayload: z24.record(z24.string(), z24.unknown()).optional().nullable(),
1906
1929
  // OpenClaw join compatibility fields accepted at top level.
1907
- responsesWebhookUrl: z23.string().max(4e3).optional().nullable(),
1908
- responsesWebhookMethod: z23.string().max(32).optional().nullable(),
1909
- responsesWebhookHeaders: z23.record(z23.string(), z23.unknown()).optional().nullable(),
1910
- rudderApiUrl: z23.string().max(4e3).optional().nullable(),
1911
- webhookAuthHeader: z23.string().max(4e3).optional().nullable()
1930
+ responsesWebhookUrl: z24.string().max(4e3).optional().nullable(),
1931
+ responsesWebhookMethod: z24.string().max(32).optional().nullable(),
1932
+ responsesWebhookHeaders: z24.record(z24.string(), z24.unknown()).optional().nullable(),
1933
+ rudderApiUrl: z24.string().max(4e3).optional().nullable(),
1934
+ webhookAuthHeader: z24.string().max(4e3).optional().nullable()
1912
1935
  });
1913
- listJoinRequestsQuerySchema = z23.object({
1914
- status: z23.enum(JOIN_REQUEST_STATUSES).optional(),
1915
- requestType: z23.enum(JOIN_REQUEST_TYPES).optional()
1936
+ listJoinRequestsQuerySchema = z24.object({
1937
+ status: z24.enum(JOIN_REQUEST_STATUSES).optional(),
1938
+ requestType: z24.enum(JOIN_REQUEST_TYPES).optional()
1916
1939
  });
1917
- claimJoinRequestApiKeySchema = z23.object({
1918
- claimSecret: z23.string().min(16).max(256)
1940
+ claimJoinRequestApiKeySchema = z24.object({
1941
+ claimSecret: z24.string().min(16).max(256)
1919
1942
  });
1920
- boardCliAuthAccessLevelSchema = z23.enum([
1943
+ boardCliAuthAccessLevelSchema = z24.enum([
1921
1944
  "board",
1922
1945
  "instance_admin_required"
1923
1946
  ]);
1924
- createCliAuthChallengeSchema = z23.object({
1925
- command: z23.string().min(1).max(240),
1926
- clientName: z23.string().max(120).optional().nullable(),
1947
+ createCliAuthChallengeSchema = z24.object({
1948
+ command: z24.string().min(1).max(240),
1949
+ clientName: z24.string().max(120).optional().nullable(),
1927
1950
  requestedAccess: boardCliAuthAccessLevelSchema.default("board"),
1928
- requestedCompanyId: z23.string().uuid().optional().nullable()
1951
+ requestedCompanyId: z24.string().uuid().optional().nullable()
1929
1952
  });
1930
- resolveCliAuthChallengeSchema = z23.object({
1931
- token: z23.string().min(16).max(256)
1953
+ resolveCliAuthChallengeSchema = z24.object({
1954
+ token: z24.string().min(16).max(256)
1932
1955
  });
1933
- updateMemberPermissionsSchema = z23.object({
1934
- grants: z23.array(
1935
- z23.object({
1936
- permissionKey: z23.enum(PERMISSION_KEYS),
1937
- scope: z23.record(z23.string(), z23.unknown()).optional().nullable()
1956
+ updateMemberPermissionsSchema = z24.object({
1957
+ grants: z24.array(
1958
+ z24.object({
1959
+ permissionKey: z24.enum(PERMISSION_KEYS),
1960
+ scope: z24.record(z24.string(), z24.unknown()).optional().nullable()
1938
1961
  })
1939
1962
  )
1940
1963
  });
1941
- updateUserCompanyAccessSchema = z23.object({
1942
- orgIds: z23.array(z23.string().uuid()).default([])
1964
+ updateUserCompanyAccessSchema = z24.object({
1965
+ orgIds: z24.array(z24.string().uuid()).default([])
1943
1966
  });
1944
1967
  }
1945
1968
  });
1946
1969
 
1947
1970
  // ../packages/shared/src/validators/plugin.ts
1948
- import { z as z24 } from "zod";
1971
+ import { z as z25 } from "zod";
1949
1972
  function isValidCronExpression(expression) {
1950
1973
  const trimmed = expression.trim();
1951
1974
  if (!trimmed) return false;
@@ -1958,7 +1981,7 @@ var init_plugin = __esm({
1958
1981
  "../packages/shared/src/validators/plugin.ts"() {
1959
1982
  "use strict";
1960
1983
  init_constants();
1961
- jsonSchemaSchema = z24.record(z24.unknown()).refine(
1984
+ jsonSchemaSchema = z25.record(z25.unknown()).refine(
1962
1985
  (val) => {
1963
1986
  if (Object.keys(val).length === 0) return true;
1964
1987
  return typeof val.type === "string" || val.$ref !== void 0 || val.oneOf !== void 0 || val.anyOf !== void 0 || val.allOf !== void 0;
@@ -1966,76 +1989,76 @@ var init_plugin = __esm({
1966
1989
  { message: "Must be a valid JSON Schema object (requires at least a 'type', '$ref', or composition keyword)" }
1967
1990
  );
1968
1991
  CRON_FIELD_PATTERN = /^(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?)(?:,(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?))*$/;
1969
- pluginJobDeclarationSchema = z24.object({
1970
- jobKey: z24.string().min(1),
1971
- displayName: z24.string().min(1),
1972
- description: z24.string().optional(),
1973
- schedule: z24.string().refine(
1992
+ pluginJobDeclarationSchema = z25.object({
1993
+ jobKey: z25.string().min(1),
1994
+ displayName: z25.string().min(1),
1995
+ description: z25.string().optional(),
1996
+ schedule: z25.string().refine(
1974
1997
  (val) => isValidCronExpression(val),
1975
1998
  { message: "schedule must be a valid 5-field cron expression (e.g. '*/15 * * * *')" }
1976
1999
  ).optional()
1977
2000
  });
1978
- pluginWebhookDeclarationSchema = z24.object({
1979
- endpointKey: z24.string().min(1),
1980
- displayName: z24.string().min(1),
1981
- description: z24.string().optional()
2001
+ pluginWebhookDeclarationSchema = z25.object({
2002
+ endpointKey: z25.string().min(1),
2003
+ displayName: z25.string().min(1),
2004
+ description: z25.string().optional()
1982
2005
  });
1983
- pluginToolDeclarationSchema = z24.object({
1984
- name: z24.string().min(1),
1985
- displayName: z24.string().min(1),
1986
- description: z24.string().min(1),
2006
+ pluginToolDeclarationSchema = z25.object({
2007
+ name: z25.string().min(1),
2008
+ displayName: z25.string().min(1),
2009
+ description: z25.string().min(1),
1987
2010
  parametersSchema: jsonSchemaSchema
1988
2011
  });
1989
- pluginUiSlotDeclarationSchema = z24.object({
1990
- type: z24.enum(PLUGIN_UI_SLOT_TYPES),
1991
- id: z24.string().min(1),
1992
- displayName: z24.string().min(1),
1993
- exportName: z24.string().min(1),
1994
- entityTypes: z24.array(z24.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
1995
- routePath: z24.string().regex(/^[a-z0-9][a-z0-9-]*$/, {
2012
+ pluginUiSlotDeclarationSchema = z25.object({
2013
+ type: z25.enum(PLUGIN_UI_SLOT_TYPES),
2014
+ id: z25.string().min(1),
2015
+ displayName: z25.string().min(1),
2016
+ exportName: z25.string().min(1),
2017
+ entityTypes: z25.array(z25.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
2018
+ routePath: z25.string().regex(/^[a-z0-9][a-z0-9-]*$/, {
1996
2019
  message: "routePath must be a lowercase single-segment slug (letters, numbers, hyphens)"
1997
2020
  }).optional(),
1998
- order: z24.number().int().optional()
2021
+ order: z25.number().int().optional()
1999
2022
  }).superRefine((value, ctx) => {
2000
2023
  const entityScopedTypes = ["detailTab", "taskDetailView", "contextMenuItem", "commentAnnotation", "commentContextMenuItem", "projectSidebarItem"];
2001
2024
  if (entityScopedTypes.includes(value.type) && (!value.entityTypes || value.entityTypes.length === 0)) {
2002
2025
  ctx.addIssue({
2003
- code: z24.ZodIssueCode.custom,
2026
+ code: z25.ZodIssueCode.custom,
2004
2027
  message: `${value.type} slots require at least one entityType`,
2005
2028
  path: ["entityTypes"]
2006
2029
  });
2007
2030
  }
2008
2031
  if (value.type === "projectSidebarItem" && value.entityTypes && !value.entityTypes.includes("project")) {
2009
2032
  ctx.addIssue({
2010
- code: z24.ZodIssueCode.custom,
2033
+ code: z25.ZodIssueCode.custom,
2011
2034
  message: 'projectSidebarItem slots require entityTypes to include "project"',
2012
2035
  path: ["entityTypes"]
2013
2036
  });
2014
2037
  }
2015
2038
  if (value.type === "commentAnnotation" && value.entityTypes && !value.entityTypes.includes("comment")) {
2016
2039
  ctx.addIssue({
2017
- code: z24.ZodIssueCode.custom,
2040
+ code: z25.ZodIssueCode.custom,
2018
2041
  message: 'commentAnnotation slots require entityTypes to include "comment"',
2019
2042
  path: ["entityTypes"]
2020
2043
  });
2021
2044
  }
2022
2045
  if (value.type === "commentContextMenuItem" && value.entityTypes && !value.entityTypes.includes("comment")) {
2023
2046
  ctx.addIssue({
2024
- code: z24.ZodIssueCode.custom,
2047
+ code: z25.ZodIssueCode.custom,
2025
2048
  message: 'commentContextMenuItem slots require entityTypes to include "comment"',
2026
2049
  path: ["entityTypes"]
2027
2050
  });
2028
2051
  }
2029
2052
  if (value.routePath && value.type !== "page") {
2030
2053
  ctx.addIssue({
2031
- code: z24.ZodIssueCode.custom,
2054
+ code: z25.ZodIssueCode.custom,
2032
2055
  message: "routePath is only supported for page slots",
2033
2056
  path: ["routePath"]
2034
2057
  });
2035
2058
  }
2036
2059
  if (value.routePath && PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS.includes(value.routePath)) {
2037
2060
  ctx.addIssue({
2038
- code: z24.ZodIssueCode.custom,
2061
+ code: z25.ZodIssueCode.custom,
2039
2062
  message: `routePath "${value.routePath}" is reserved by the host`,
2040
2063
  path: ["routePath"]
2041
2064
  });
@@ -2056,29 +2079,29 @@ var init_plugin = __esm({
2056
2079
  external: [],
2057
2080
  iframe: ["compact", "default", "wide", "full"]
2058
2081
  };
2059
- pluginLauncherActionDeclarationSchema = z24.object({
2060
- type: z24.enum(PLUGIN_LAUNCHER_ACTIONS),
2061
- target: z24.string().min(1),
2062
- params: z24.record(z24.unknown()).optional()
2082
+ pluginLauncherActionDeclarationSchema = z25.object({
2083
+ type: z25.enum(PLUGIN_LAUNCHER_ACTIONS),
2084
+ target: z25.string().min(1),
2085
+ params: z25.record(z25.unknown()).optional()
2063
2086
  }).superRefine((value, ctx) => {
2064
2087
  if (value.type === "performAction" && value.target.includes("/")) {
2065
2088
  ctx.addIssue({
2066
- code: z24.ZodIssueCode.custom,
2089
+ code: z25.ZodIssueCode.custom,
2067
2090
  message: "performAction launchers must target an action key, not a route or URL",
2068
2091
  path: ["target"]
2069
2092
  });
2070
2093
  }
2071
2094
  if (value.type === "navigate" && /^https?:\/\//.test(value.target)) {
2072
2095
  ctx.addIssue({
2073
- code: z24.ZodIssueCode.custom,
2096
+ code: z25.ZodIssueCode.custom,
2074
2097
  message: "navigate launchers must target a host route, not an absolute URL",
2075
2098
  path: ["target"]
2076
2099
  });
2077
2100
  }
2078
2101
  });
2079
- pluginLauncherRenderDeclarationSchema = z24.object({
2080
- environment: z24.enum(PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS),
2081
- bounds: z24.enum(PLUGIN_LAUNCHER_BOUNDS).optional()
2102
+ pluginLauncherRenderDeclarationSchema = z25.object({
2103
+ environment: z25.enum(PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS),
2104
+ bounds: z25.enum(PLUGIN_LAUNCHER_BOUNDS).optional()
2082
2105
  }).superRefine((value, ctx) => {
2083
2106
  if (!value.bounds) {
2084
2107
  return;
@@ -2086,122 +2109,122 @@ var init_plugin = __esm({
2086
2109
  const supportedBounds = launcherBoundsByEnvironment[value.environment];
2087
2110
  if (!supportedBounds.includes(value.bounds)) {
2088
2111
  ctx.addIssue({
2089
- code: z24.ZodIssueCode.custom,
2112
+ code: z25.ZodIssueCode.custom,
2090
2113
  message: `bounds "${value.bounds}" is not supported for render environment "${value.environment}"`,
2091
2114
  path: ["bounds"]
2092
2115
  });
2093
2116
  }
2094
2117
  });
2095
- pluginLauncherDeclarationSchema = z24.object({
2096
- id: z24.string().min(1),
2097
- displayName: z24.string().min(1),
2098
- description: z24.string().optional(),
2099
- placementZone: z24.enum(PLUGIN_LAUNCHER_PLACEMENT_ZONES),
2100
- exportName: z24.string().min(1).optional(),
2101
- entityTypes: z24.array(z24.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
2102
- order: z24.number().int().optional(),
2118
+ pluginLauncherDeclarationSchema = z25.object({
2119
+ id: z25.string().min(1),
2120
+ displayName: z25.string().min(1),
2121
+ description: z25.string().optional(),
2122
+ placementZone: z25.enum(PLUGIN_LAUNCHER_PLACEMENT_ZONES),
2123
+ exportName: z25.string().min(1).optional(),
2124
+ entityTypes: z25.array(z25.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
2125
+ order: z25.number().int().optional(),
2103
2126
  action: pluginLauncherActionDeclarationSchema,
2104
2127
  render: pluginLauncherRenderDeclarationSchema.optional()
2105
2128
  }).superRefine((value, ctx) => {
2106
2129
  if (entityScopedLauncherPlacementZones.some((zone) => zone === value.placementZone) && (!value.entityTypes || value.entityTypes.length === 0)) {
2107
2130
  ctx.addIssue({
2108
- code: z24.ZodIssueCode.custom,
2131
+ code: z25.ZodIssueCode.custom,
2109
2132
  message: `${value.placementZone} launchers require at least one entityType`,
2110
2133
  path: ["entityTypes"]
2111
2134
  });
2112
2135
  }
2113
2136
  if (value.placementZone === "projectSidebarItem" && value.entityTypes && !value.entityTypes.includes("project")) {
2114
2137
  ctx.addIssue({
2115
- code: z24.ZodIssueCode.custom,
2138
+ code: z25.ZodIssueCode.custom,
2116
2139
  message: 'projectSidebarItem launchers require entityTypes to include "project"',
2117
2140
  path: ["entityTypes"]
2118
2141
  });
2119
2142
  }
2120
2143
  if (value.action.type === "performAction" && value.render) {
2121
2144
  ctx.addIssue({
2122
- code: z24.ZodIssueCode.custom,
2145
+ code: z25.ZodIssueCode.custom,
2123
2146
  message: "performAction launchers cannot declare render hints",
2124
2147
  path: ["render"]
2125
2148
  });
2126
2149
  }
2127
2150
  if (["openModal", "openDrawer", "openPopover"].includes(value.action.type) && !value.render) {
2128
2151
  ctx.addIssue({
2129
- code: z24.ZodIssueCode.custom,
2152
+ code: z25.ZodIssueCode.custom,
2130
2153
  message: `${value.action.type} launchers require render metadata`,
2131
2154
  path: ["render"]
2132
2155
  });
2133
2156
  }
2134
2157
  if (value.action.type === "openModal" && value.render?.environment === "hostInline") {
2135
2158
  ctx.addIssue({
2136
- code: z24.ZodIssueCode.custom,
2159
+ code: z25.ZodIssueCode.custom,
2137
2160
  message: "openModal launchers cannot use the hostInline render environment",
2138
2161
  path: ["render", "environment"]
2139
2162
  });
2140
2163
  }
2141
2164
  if (value.action.type === "openDrawer" && value.render && !["hostOverlay", "iframe"].includes(value.render.environment)) {
2142
2165
  ctx.addIssue({
2143
- code: z24.ZodIssueCode.custom,
2166
+ code: z25.ZodIssueCode.custom,
2144
2167
  message: "openDrawer launchers must use hostOverlay or iframe render environments",
2145
2168
  path: ["render", "environment"]
2146
2169
  });
2147
2170
  }
2148
2171
  if (value.action.type === "openPopover" && value.render?.environment === "hostRoute") {
2149
2172
  ctx.addIssue({
2150
- code: z24.ZodIssueCode.custom,
2173
+ code: z25.ZodIssueCode.custom,
2151
2174
  message: "openPopover launchers cannot use the hostRoute render environment",
2152
2175
  path: ["render", "environment"]
2153
2176
  });
2154
2177
  }
2155
2178
  });
2156
- pluginManifestV1Schema = z24.object({
2157
- id: z24.string().min(1).regex(
2179
+ pluginManifestV1Schema = z25.object({
2180
+ id: z25.string().min(1).regex(
2158
2181
  /^[a-z0-9][a-z0-9._-]*$/,
2159
2182
  "Plugin id must start with a lowercase alphanumeric and contain only lowercase letters, digits, dots, hyphens, or underscores"
2160
2183
  ),
2161
- apiVersion: z24.literal(1),
2162
- version: z24.string().min(1).regex(
2184
+ apiVersion: z25.literal(1),
2185
+ version: z25.string().min(1).regex(
2163
2186
  /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
2164
2187
  "Version must follow semver (e.g. 1.0.0 or 1.0.0-beta.1)"
2165
2188
  ),
2166
- displayName: z24.string().min(1).max(100),
2167
- description: z24.string().min(1).max(500),
2168
- author: z24.string().min(1).max(200),
2169
- categories: z24.array(z24.enum(PLUGIN_CATEGORIES)).min(1),
2170
- minimumHostVersion: z24.string().regex(
2189
+ displayName: z25.string().min(1).max(100),
2190
+ description: z25.string().min(1).max(500),
2191
+ author: z25.string().min(1).max(200),
2192
+ categories: z25.array(z25.enum(PLUGIN_CATEGORIES)).min(1),
2193
+ minimumHostVersion: z25.string().regex(
2171
2194
  /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
2172
2195
  "minimumHostVersion must follow semver (e.g. 1.0.0)"
2173
2196
  ).optional(),
2174
- minimumPaperclipVersion: z24.string().regex(
2197
+ minimumPaperclipVersion: z25.string().regex(
2175
2198
  /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
2176
2199
  "minimumPaperclipVersion must follow semver (e.g. 1.0.0)"
2177
2200
  ).optional(),
2178
- capabilities: z24.array(z24.enum(PLUGIN_CAPABILITIES)).min(1),
2179
- entrypoints: z24.object({
2180
- worker: z24.string().min(1),
2181
- ui: z24.string().min(1).optional()
2201
+ capabilities: z25.array(z25.enum(PLUGIN_CAPABILITIES)).min(1),
2202
+ entrypoints: z25.object({
2203
+ worker: z25.string().min(1),
2204
+ ui: z25.string().min(1).optional()
2182
2205
  }),
2183
2206
  instanceConfigSchema: jsonSchemaSchema.optional(),
2184
- jobs: z24.array(pluginJobDeclarationSchema).optional(),
2185
- webhooks: z24.array(pluginWebhookDeclarationSchema).optional(),
2186
- tools: z24.array(pluginToolDeclarationSchema).optional(),
2187
- launchers: z24.array(pluginLauncherDeclarationSchema).optional(),
2188
- ui: z24.object({
2189
- slots: z24.array(pluginUiSlotDeclarationSchema).min(1).optional(),
2190
- launchers: z24.array(pluginLauncherDeclarationSchema).optional()
2207
+ jobs: z25.array(pluginJobDeclarationSchema).optional(),
2208
+ webhooks: z25.array(pluginWebhookDeclarationSchema).optional(),
2209
+ tools: z25.array(pluginToolDeclarationSchema).optional(),
2210
+ launchers: z25.array(pluginLauncherDeclarationSchema).optional(),
2211
+ ui: z25.object({
2212
+ slots: z25.array(pluginUiSlotDeclarationSchema).min(1).optional(),
2213
+ launchers: z25.array(pluginLauncherDeclarationSchema).optional()
2191
2214
  }).optional()
2192
2215
  }).superRefine((manifest, ctx) => {
2193
2216
  const hasUiSlots = (manifest.ui?.slots?.length ?? 0) > 0;
2194
2217
  const hasUiLaunchers = (manifest.ui?.launchers?.length ?? 0) > 0;
2195
2218
  if ((hasUiSlots || hasUiLaunchers) && !manifest.entrypoints.ui) {
2196
2219
  ctx.addIssue({
2197
- code: z24.ZodIssueCode.custom,
2220
+ code: z25.ZodIssueCode.custom,
2198
2221
  message: "entrypoints.ui is required when ui.slots or ui.launchers are declared",
2199
2222
  path: ["entrypoints", "ui"]
2200
2223
  });
2201
2224
  }
2202
2225
  if (manifest.minimumHostVersion && manifest.minimumPaperclipVersion && manifest.minimumHostVersion !== manifest.minimumPaperclipVersion) {
2203
2226
  ctx.addIssue({
2204
- code: z24.ZodIssueCode.custom,
2227
+ code: z25.ZodIssueCode.custom,
2205
2228
  message: "minimumHostVersion and minimumPaperclipVersion must match when both are declared",
2206
2229
  path: ["minimumHostVersion"]
2207
2230
  });
@@ -2209,7 +2232,7 @@ var init_plugin = __esm({
2209
2232
  if (manifest.tools && manifest.tools.length > 0) {
2210
2233
  if (!manifest.capabilities.includes("agent.tools.register")) {
2211
2234
  ctx.addIssue({
2212
- code: z24.ZodIssueCode.custom,
2235
+ code: z25.ZodIssueCode.custom,
2213
2236
  message: "Capability 'agent.tools.register' is required when tools are declared",
2214
2237
  path: ["capabilities"]
2215
2238
  });
@@ -2218,7 +2241,7 @@ var init_plugin = __esm({
2218
2241
  if (manifest.jobs && manifest.jobs.length > 0) {
2219
2242
  if (!manifest.capabilities.includes("jobs.schedule")) {
2220
2243
  ctx.addIssue({
2221
- code: z24.ZodIssueCode.custom,
2244
+ code: z25.ZodIssueCode.custom,
2222
2245
  message: "Capability 'jobs.schedule' is required when jobs are declared",
2223
2246
  path: ["capabilities"]
2224
2247
  });
@@ -2227,7 +2250,7 @@ var init_plugin = __esm({
2227
2250
  if (manifest.webhooks && manifest.webhooks.length > 0) {
2228
2251
  if (!manifest.capabilities.includes("webhooks.receive")) {
2229
2252
  ctx.addIssue({
2230
- code: z24.ZodIssueCode.custom,
2253
+ code: z25.ZodIssueCode.custom,
2231
2254
  message: "Capability 'webhooks.receive' is required when webhooks are declared",
2232
2255
  path: ["capabilities"]
2233
2256
  });
@@ -2238,7 +2261,7 @@ var init_plugin = __esm({
2238
2261
  const duplicates = jobKeys.filter((key, i) => jobKeys.indexOf(key) !== i);
2239
2262
  if (duplicates.length > 0) {
2240
2263
  ctx.addIssue({
2241
- code: z24.ZodIssueCode.custom,
2264
+ code: z25.ZodIssueCode.custom,
2242
2265
  message: `Duplicate job keys: ${[...new Set(duplicates)].join(", ")}`,
2243
2266
  path: ["jobs"]
2244
2267
  });
@@ -2249,7 +2272,7 @@ var init_plugin = __esm({
2249
2272
  const duplicates = endpointKeys.filter((key, i) => endpointKeys.indexOf(key) !== i);
2250
2273
  if (duplicates.length > 0) {
2251
2274
  ctx.addIssue({
2252
- code: z24.ZodIssueCode.custom,
2275
+ code: z25.ZodIssueCode.custom,
2253
2276
  message: `Duplicate webhook endpoint keys: ${[...new Set(duplicates)].join(", ")}`,
2254
2277
  path: ["webhooks"]
2255
2278
  });
@@ -2260,7 +2283,7 @@ var init_plugin = __esm({
2260
2283
  const duplicates = toolNames.filter((name, i) => toolNames.indexOf(name) !== i);
2261
2284
  if (duplicates.length > 0) {
2262
2285
  ctx.addIssue({
2263
- code: z24.ZodIssueCode.custom,
2286
+ code: z25.ZodIssueCode.custom,
2264
2287
  message: `Duplicate tool names: ${[...new Set(duplicates)].join(", ")}`,
2265
2288
  path: ["tools"]
2266
2289
  });
@@ -2272,7 +2295,7 @@ var init_plugin = __esm({
2272
2295
  const duplicates = slotIds.filter((id, i) => slotIds.indexOf(id) !== i);
2273
2296
  if (duplicates.length > 0) {
2274
2297
  ctx.addIssue({
2275
- code: z24.ZodIssueCode.custom,
2298
+ code: z25.ZodIssueCode.custom,
2276
2299
  message: `Duplicate UI slot ids: ${[...new Set(duplicates)].join(", ")}`,
2277
2300
  path: ["ui", "slots"]
2278
2301
  });
@@ -2288,50 +2311,50 @@ var init_plugin = __esm({
2288
2311
  const duplicates = launcherIds.filter((id, i) => launcherIds.indexOf(id) !== i);
2289
2312
  if (duplicates.length > 0) {
2290
2313
  ctx.addIssue({
2291
- code: z24.ZodIssueCode.custom,
2314
+ code: z25.ZodIssueCode.custom,
2292
2315
  message: `Duplicate launcher ids: ${[...new Set(duplicates)].join(", ")}`,
2293
2316
  path: manifest.ui?.launchers ? ["ui", "launchers"] : ["launchers"]
2294
2317
  });
2295
2318
  }
2296
2319
  }
2297
2320
  });
2298
- installPluginSchema = z24.object({
2299
- packageName: z24.string().min(1),
2300
- version: z24.string().min(1).optional(),
2321
+ installPluginSchema = z25.object({
2322
+ packageName: z25.string().min(1),
2323
+ version: z25.string().min(1).optional(),
2301
2324
  /** Set by loader for local-path installs so the worker can be resolved. */
2302
- packagePath: z24.string().min(1).optional()
2325
+ packagePath: z25.string().min(1).optional()
2303
2326
  });
2304
- upsertPluginConfigSchema = z24.object({
2305
- configJson: z24.record(z24.unknown())
2327
+ upsertPluginConfigSchema = z25.object({
2328
+ configJson: z25.record(z25.unknown())
2306
2329
  });
2307
- patchPluginConfigSchema = z24.object({
2308
- configJson: z24.record(z24.unknown())
2330
+ patchPluginConfigSchema = z25.object({
2331
+ configJson: z25.record(z25.unknown())
2309
2332
  });
2310
- updatePluginStatusSchema = z24.object({
2311
- status: z24.enum(PLUGIN_STATUSES),
2312
- lastError: z24.string().nullable().optional()
2333
+ updatePluginStatusSchema = z25.object({
2334
+ status: z25.enum(PLUGIN_STATUSES),
2335
+ lastError: z25.string().nullable().optional()
2313
2336
  });
2314
- uninstallPluginSchema = z24.object({
2315
- removeData: z24.boolean().optional().default(false)
2337
+ uninstallPluginSchema = z25.object({
2338
+ removeData: z25.boolean().optional().default(false)
2316
2339
  });
2317
- pluginStateScopeKeySchema = z24.object({
2318
- scopeKind: z24.enum(PLUGIN_STATE_SCOPE_KINDS),
2319
- scopeId: z24.string().min(1).optional(),
2320
- namespace: z24.string().min(1).optional(),
2321
- stateKey: z24.string().min(1)
2340
+ pluginStateScopeKeySchema = z25.object({
2341
+ scopeKind: z25.enum(PLUGIN_STATE_SCOPE_KINDS),
2342
+ scopeId: z25.string().min(1).optional(),
2343
+ namespace: z25.string().min(1).optional(),
2344
+ stateKey: z25.string().min(1)
2322
2345
  });
2323
- setPluginStateSchema = z24.object({
2324
- scopeKind: z24.enum(PLUGIN_STATE_SCOPE_KINDS),
2325
- scopeId: z24.string().min(1).optional(),
2326
- namespace: z24.string().min(1).optional(),
2327
- stateKey: z24.string().min(1),
2346
+ setPluginStateSchema = z25.object({
2347
+ scopeKind: z25.enum(PLUGIN_STATE_SCOPE_KINDS),
2348
+ scopeId: z25.string().min(1).optional(),
2349
+ namespace: z25.string().min(1).optional(),
2350
+ stateKey: z25.string().min(1),
2328
2351
  /** JSON-serializable value to store. */
2329
- value: z24.unknown()
2352
+ value: z25.unknown()
2330
2353
  });
2331
- listPluginStateSchema = z24.object({
2332
- scopeKind: z24.enum(PLUGIN_STATE_SCOPE_KINDS).optional(),
2333
- scopeId: z24.string().min(1).optional(),
2334
- namespace: z24.string().min(1).optional()
2354
+ listPluginStateSchema = z25.object({
2355
+ scopeKind: z25.enum(PLUGIN_STATE_SCOPE_KINDS).optional(),
2356
+ scopeId: z25.string().min(1).optional(),
2357
+ namespace: z25.string().min(1).optional()
2335
2358
  });
2336
2359
  }
2337
2360
  });
@@ -2353,6 +2376,7 @@ var init_validators = __esm({
2353
2376
  init_issue();
2354
2377
  init_work_product();
2355
2378
  init_execution_workspace();
2379
+ init_workspace_backup2();
2356
2380
  init_goal();
2357
2381
  init_approval();
2358
2382
  init_secret();
@@ -2454,32 +2478,32 @@ var init_project_mentions = __esm({
2454
2478
  });
2455
2479
 
2456
2480
  // ../packages/shared/src/config-schema.ts
2457
- import { z as z25 } from "zod";
2481
+ import { z as z26 } from "zod";
2458
2482
  var configMetaSchema, llmConfigSchema, databaseBackupConfigSchema, databaseConfigSchema, loggingConfigSchema, serverConfigSchema, authConfigSchema, storageLocalDiskConfigSchema, storageS3ConfigSchema, storageConfigSchema, secretsLocalEncryptedConfigSchema, secretsConfigSchema, langfuseConfigSchema, rudderConfigSchema;
2459
2483
  var init_config_schema = __esm({
2460
2484
  "../packages/shared/src/config-schema.ts"() {
2461
2485
  "use strict";
2462
2486
  init_constants();
2463
- configMetaSchema = z25.object({
2464
- version: z25.literal(1),
2465
- updatedAt: z25.string(),
2466
- source: z25.enum(["onboard", "configure", "doctor"])
2487
+ configMetaSchema = z26.object({
2488
+ version: z26.literal(1),
2489
+ updatedAt: z26.string(),
2490
+ source: z26.enum(["onboard", "configure", "doctor"])
2467
2491
  });
2468
- llmConfigSchema = z25.object({
2469
- provider: z25.enum(["claude", "openai"]),
2470
- apiKey: z25.string().optional()
2492
+ llmConfigSchema = z26.object({
2493
+ provider: z26.enum(["claude", "openai"]),
2494
+ apiKey: z26.string().optional()
2471
2495
  });
2472
- databaseBackupConfigSchema = z25.object({
2473
- enabled: z25.boolean().default(true),
2474
- intervalMinutes: z25.number().int().min(1).max(7 * 24 * 60).default(60),
2475
- retentionDays: z25.number().int().min(1).max(3650).default(30),
2476
- dir: z25.string().default("~/.rudder/instances/default/data/backups")
2496
+ databaseBackupConfigSchema = z26.object({
2497
+ enabled: z26.boolean().default(true),
2498
+ intervalMinutes: z26.number().int().min(1).max(7 * 24 * 60).default(60),
2499
+ retentionDays: z26.number().int().min(1).max(3650).default(30),
2500
+ dir: z26.string().default("~/.rudder/instances/default/data/backups")
2477
2501
  });
2478
- databaseConfigSchema = z25.object({
2479
- mode: z25.enum(["embedded-postgres", "postgres"]).default("embedded-postgres"),
2480
- connectionString: z25.string().optional(),
2481
- embeddedPostgresDataDir: z25.string().default("~/.rudder/instances/default/db"),
2482
- embeddedPostgresPort: z25.number().int().min(1).max(65535).default(54329),
2502
+ databaseConfigSchema = z26.object({
2503
+ mode: z26.enum(["embedded-postgres", "postgres"]).default("embedded-postgres"),
2504
+ connectionString: z26.string().optional(),
2505
+ embeddedPostgresDataDir: z26.string().default("~/.rudder/instances/default/db"),
2506
+ embeddedPostgresPort: z26.number().int().min(1).max(65535).default(54329),
2483
2507
  backup: databaseBackupConfigSchema.default({
2484
2508
  enabled: true,
2485
2509
  intervalMinutes: 60,
@@ -2487,35 +2511,35 @@ var init_config_schema = __esm({
2487
2511
  dir: "~/.rudder/instances/default/data/backups"
2488
2512
  })
2489
2513
  });
2490
- loggingConfigSchema = z25.object({
2491
- mode: z25.enum(["file", "cloud"]),
2492
- logDir: z25.string().default("~/.rudder/instances/default/logs")
2514
+ loggingConfigSchema = z26.object({
2515
+ mode: z26.enum(["file", "cloud"]),
2516
+ logDir: z26.string().default("~/.rudder/instances/default/logs")
2493
2517
  });
2494
- serverConfigSchema = z25.object({
2495
- deploymentMode: z25.enum(DEPLOYMENT_MODES).default("local_trusted"),
2496
- exposure: z25.enum(DEPLOYMENT_EXPOSURES).default("private"),
2497
- host: z25.string().default("127.0.0.1"),
2498
- port: z25.number().int().min(1).max(65535).default(3100),
2499
- allowedHostnames: z25.array(z25.string().min(1)).default([]),
2500
- serveUi: z25.boolean().default(true)
2518
+ serverConfigSchema = z26.object({
2519
+ deploymentMode: z26.enum(DEPLOYMENT_MODES).default("local_trusted"),
2520
+ exposure: z26.enum(DEPLOYMENT_EXPOSURES).default("private"),
2521
+ host: z26.string().default("127.0.0.1"),
2522
+ port: z26.number().int().min(1).max(65535).default(3100),
2523
+ allowedHostnames: z26.array(z26.string().min(1)).default([]),
2524
+ serveUi: z26.boolean().default(true)
2501
2525
  });
2502
- authConfigSchema = z25.object({
2503
- baseUrlMode: z25.enum(AUTH_BASE_URL_MODES).default("auto"),
2504
- publicBaseUrl: z25.string().url().optional(),
2505
- disableSignUp: z25.boolean().default(false)
2526
+ authConfigSchema = z26.object({
2527
+ baseUrlMode: z26.enum(AUTH_BASE_URL_MODES).default("auto"),
2528
+ publicBaseUrl: z26.string().url().optional(),
2529
+ disableSignUp: z26.boolean().default(false)
2506
2530
  });
2507
- storageLocalDiskConfigSchema = z25.object({
2508
- baseDir: z25.string().default("~/.rudder/instances/default/data/storage")
2531
+ storageLocalDiskConfigSchema = z26.object({
2532
+ baseDir: z26.string().default("~/.rudder/instances/default/data/storage")
2509
2533
  });
2510
- storageS3ConfigSchema = z25.object({
2511
- bucket: z25.string().min(1).default("rudder"),
2512
- region: z25.string().min(1).default("us-east-1"),
2513
- endpoint: z25.string().optional(),
2514
- prefix: z25.string().default(""),
2515
- forcePathStyle: z25.boolean().default(false)
2534
+ storageS3ConfigSchema = z26.object({
2535
+ bucket: z26.string().min(1).default("rudder"),
2536
+ region: z26.string().min(1).default("us-east-1"),
2537
+ endpoint: z26.string().optional(),
2538
+ prefix: z26.string().default(""),
2539
+ forcePathStyle: z26.boolean().default(false)
2516
2540
  });
2517
- storageConfigSchema = z25.object({
2518
- provider: z25.enum(STORAGE_PROVIDERS).default("local_disk"),
2541
+ storageConfigSchema = z26.object({
2542
+ provider: z26.enum(STORAGE_PROVIDERS).default("local_disk"),
2519
2543
  localDisk: storageLocalDiskConfigSchema.default({
2520
2544
  baseDir: "~/.rudder/instances/default/data/storage"
2521
2545
  }),
@@ -2526,24 +2550,24 @@ var init_config_schema = __esm({
2526
2550
  forcePathStyle: false
2527
2551
  })
2528
2552
  });
2529
- secretsLocalEncryptedConfigSchema = z25.object({
2530
- keyFilePath: z25.string().default("~/.rudder/instances/default/secrets/master.key")
2553
+ secretsLocalEncryptedConfigSchema = z26.object({
2554
+ keyFilePath: z26.string().default("~/.rudder/instances/default/secrets/master.key")
2531
2555
  });
2532
- secretsConfigSchema = z25.object({
2533
- provider: z25.enum(SECRET_PROVIDERS).default("local_encrypted"),
2534
- strictMode: z25.boolean().default(false),
2556
+ secretsConfigSchema = z26.object({
2557
+ provider: z26.enum(SECRET_PROVIDERS).default("local_encrypted"),
2558
+ strictMode: z26.boolean().default(false),
2535
2559
  localEncrypted: secretsLocalEncryptedConfigSchema.default({
2536
2560
  keyFilePath: "~/.rudder/instances/default/secrets/master.key"
2537
2561
  })
2538
2562
  });
2539
- langfuseConfigSchema = z25.object({
2540
- enabled: z25.boolean().default(false),
2541
- baseUrl: z25.string().url().default("http://localhost:3000"),
2542
- publicKey: z25.string().optional(),
2543
- secretKey: z25.string().optional(),
2544
- environment: z25.string().optional()
2563
+ langfuseConfigSchema = z26.object({
2564
+ enabled: z26.boolean().default(false),
2565
+ baseUrl: z26.string().url().default("http://localhost:3000"),
2566
+ publicKey: z26.string().optional(),
2567
+ secretKey: z26.string().optional(),
2568
+ environment: z26.string().optional()
2545
2569
  });
2546
- rudderConfigSchema = z25.object({
2570
+ rudderConfigSchema = z26.object({
2547
2571
  $meta: configMetaSchema,
2548
2572
  llm: llmConfigSchema.optional(),
2549
2573
  database: databaseConfigSchema,
@@ -2577,7 +2601,7 @@ var init_config_schema = __esm({
2577
2601
  if (value.server.deploymentMode === "local_trusted") {
2578
2602
  if (value.server.exposure !== "private") {
2579
2603
  ctx.addIssue({
2580
- code: z25.ZodIssueCode.custom,
2604
+ code: z26.ZodIssueCode.custom,
2581
2605
  message: "server.exposure must be private when deploymentMode is local_trusted",
2582
2606
  path: ["server", "exposure"]
2583
2607
  });
@@ -2586,21 +2610,21 @@ var init_config_schema = __esm({
2586
2610
  }
2587
2611
  if (value.auth.baseUrlMode === "explicit" && !value.auth.publicBaseUrl) {
2588
2612
  ctx.addIssue({
2589
- code: z25.ZodIssueCode.custom,
2613
+ code: z26.ZodIssueCode.custom,
2590
2614
  message: "auth.publicBaseUrl is required when auth.baseUrlMode is explicit",
2591
2615
  path: ["auth", "publicBaseUrl"]
2592
2616
  });
2593
2617
  }
2594
2618
  if (value.server.exposure === "public" && value.auth.baseUrlMode !== "explicit") {
2595
2619
  ctx.addIssue({
2596
- code: z25.ZodIssueCode.custom,
2620
+ code: z26.ZodIssueCode.custom,
2597
2621
  message: "auth.baseUrlMode must be explicit when deploymentMode=authenticated and exposure=public",
2598
2622
  path: ["auth", "baseUrlMode"]
2599
2623
  });
2600
2624
  }
2601
2625
  if (value.server.exposure === "public" && !value.auth.publicBaseUrl) {
2602
2626
  ctx.addIssue({
2603
- code: z25.ZodIssueCode.custom,
2627
+ code: z26.ZodIssueCode.custom,
2604
2628
  message: "auth.publicBaseUrl is required when deploymentMode=authenticated and exposure=public",
2605
2629
  path: ["auth", "publicBaseUrl"]
2606
2630
  });
@@ -2615,6 +2639,7 @@ var init_src = __esm({
2615
2639
  "use strict";
2616
2640
  init_constants();
2617
2641
  init_observability();
2642
+ init_workspace_backup();
2618
2643
  init_validators();
2619
2644
  init_validators();
2620
2645
  init_api();
@@ -4929,8 +4954,9 @@ var init_workspace_operations = __esm({
4929
4954
  }
4930
4955
  });
4931
4956
 
4932
- // ../packages/db/src/schema/workspace_runtime_services.ts
4957
+ // ../packages/db/src/schema/workspace_backups.ts
4933
4958
  import {
4959
+ bigint as bigint4,
4934
4960
  index as index28,
4935
4961
  integer as integer11,
4936
4962
  jsonb as jsonb19,
@@ -4939,6 +4965,57 @@ import {
4939
4965
  timestamp as timestamp33,
4940
4966
  uuid as uuid31
4941
4967
  } from "drizzle-orm/pg-core";
4968
+ var workspaceBackups;
4969
+ var init_workspace_backups = __esm({
4970
+ "../packages/db/src/schema/workspace_backups.ts"() {
4971
+ "use strict";
4972
+ init_organizations();
4973
+ init_auth();
4974
+ workspaceBackups = pgTable33(
4975
+ "workspace_backups",
4976
+ {
4977
+ id: uuid31("id").primaryKey().defaultRandom(),
4978
+ orgId: uuid31("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
4979
+ status: text37("status").notNull().default("running"),
4980
+ triggerSource: text37("trigger_source").notNull().default("manual"),
4981
+ artifactProvider: text37("artifact_provider").notNull().default("local_file"),
4982
+ artifactRef: text37("artifact_ref").notNull(),
4983
+ archiveSha256: text37("archive_sha256"),
4984
+ treeSha256: text37("tree_sha256"),
4985
+ fileCount: integer11("file_count").notNull().default(0),
4986
+ byteSize: bigint4("byte_size", { mode: "number" }).notNull().default(0),
4987
+ compressedSize: bigint4("compressed_size", { mode: "number" }).notNull().default(0),
4988
+ manifest: jsonb19("manifest").$type(),
4989
+ warnings: jsonb19("warnings").$type(),
4990
+ error: text37("error"),
4991
+ startedAt: timestamp33("started_at", { withTimezone: true }),
4992
+ finishedAt: timestamp33("finished_at", { withTimezone: true }),
4993
+ expiresAt: timestamp33("expires_at", { withTimezone: true }),
4994
+ restoredFromBackupId: uuid31("restored_from_backup_id").references(() => workspaceBackups.id, {
4995
+ onDelete: "set null"
4996
+ }),
4997
+ createdByUserId: text37("created_by_user_id").references(() => authUsers.id, { onDelete: "set null" }),
4998
+ createdAt: timestamp33("created_at", { withTimezone: true }).notNull().defaultNow(),
4999
+ updatedAt: timestamp33("updated_at", { withTimezone: true }).notNull().defaultNow()
5000
+ },
5001
+ (table) => ({
5002
+ orgCreatedIdx: index28("workspace_backups_org_created_idx").on(table.orgId, table.createdAt),
5003
+ orgStatusIdx: index28("workspace_backups_org_status_idx").on(table.orgId, table.status)
5004
+ })
5005
+ );
5006
+ }
5007
+ });
5008
+
5009
+ // ../packages/db/src/schema/workspace_runtime_services.ts
5010
+ import {
5011
+ index as index29,
5012
+ integer as integer12,
5013
+ jsonb as jsonb20,
5014
+ pgTable as pgTable34,
5015
+ text as text38,
5016
+ timestamp as timestamp34,
5017
+ uuid as uuid32
5018
+ } from "drizzle-orm/pg-core";
4942
5019
  var workspaceRuntimeServices;
4943
5020
  var init_workspace_runtime_services = __esm({
4944
5021
  "../packages/db/src/schema/workspace_runtime_services.ts"() {
@@ -4950,55 +5027,55 @@ var init_workspace_runtime_services = __esm({
4950
5027
  init_issues();
4951
5028
  init_agents();
4952
5029
  init_heartbeat_runs();
4953
- workspaceRuntimeServices = pgTable33(
5030
+ workspaceRuntimeServices = pgTable34(
4954
5031
  "workspace_runtime_services",
4955
5032
  {
4956
- id: uuid31("id").primaryKey(),
4957
- orgId: uuid31("org_id").notNull().references(() => organizations.id),
4958
- projectId: uuid31("project_id").references(() => projects.id, { onDelete: "set null" }),
4959
- projectWorkspaceId: uuid31("project_workspace_id").references(() => projectWorkspaces.id, { onDelete: "set null" }),
4960
- executionWorkspaceId: uuid31("execution_workspace_id").references(() => executionWorkspaces.id, { onDelete: "set null" }),
4961
- issueId: uuid31("issue_id").references(() => issues.id, { onDelete: "set null" }),
4962
- scopeType: text37("scope_type").notNull(),
4963
- scopeId: text37("scope_id"),
4964
- serviceName: text37("service_name").notNull(),
4965
- status: text37("status").notNull(),
4966
- lifecycle: text37("lifecycle").notNull(),
4967
- reuseKey: text37("reuse_key"),
4968
- command: text37("command"),
4969
- cwd: text37("cwd"),
4970
- port: integer11("port"),
4971
- url: text37("url"),
4972
- provider: text37("provider").notNull(),
4973
- providerRef: text37("provider_ref"),
4974
- ownerAgentId: uuid31("owner_agent_id").references(() => agents.id, { onDelete: "set null" }),
4975
- startedByRunId: uuid31("started_by_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
4976
- lastUsedAt: timestamp33("last_used_at", { withTimezone: true }).notNull().defaultNow(),
4977
- startedAt: timestamp33("started_at", { withTimezone: true }).notNull().defaultNow(),
4978
- stoppedAt: timestamp33("stopped_at", { withTimezone: true }),
4979
- stopPolicy: jsonb19("stop_policy").$type(),
4980
- healthStatus: text37("health_status").notNull().default("unknown"),
4981
- createdAt: timestamp33("created_at", { withTimezone: true }).notNull().defaultNow(),
4982
- updatedAt: timestamp33("updated_at", { withTimezone: true }).notNull().defaultNow()
5033
+ id: uuid32("id").primaryKey(),
5034
+ orgId: uuid32("org_id").notNull().references(() => organizations.id),
5035
+ projectId: uuid32("project_id").references(() => projects.id, { onDelete: "set null" }),
5036
+ projectWorkspaceId: uuid32("project_workspace_id").references(() => projectWorkspaces.id, { onDelete: "set null" }),
5037
+ executionWorkspaceId: uuid32("execution_workspace_id").references(() => executionWorkspaces.id, { onDelete: "set null" }),
5038
+ issueId: uuid32("issue_id").references(() => issues.id, { onDelete: "set null" }),
5039
+ scopeType: text38("scope_type").notNull(),
5040
+ scopeId: text38("scope_id"),
5041
+ serviceName: text38("service_name").notNull(),
5042
+ status: text38("status").notNull(),
5043
+ lifecycle: text38("lifecycle").notNull(),
5044
+ reuseKey: text38("reuse_key"),
5045
+ command: text38("command"),
5046
+ cwd: text38("cwd"),
5047
+ port: integer12("port"),
5048
+ url: text38("url"),
5049
+ provider: text38("provider").notNull(),
5050
+ providerRef: text38("provider_ref"),
5051
+ ownerAgentId: uuid32("owner_agent_id").references(() => agents.id, { onDelete: "set null" }),
5052
+ startedByRunId: uuid32("started_by_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
5053
+ lastUsedAt: timestamp34("last_used_at", { withTimezone: true }).notNull().defaultNow(),
5054
+ startedAt: timestamp34("started_at", { withTimezone: true }).notNull().defaultNow(),
5055
+ stoppedAt: timestamp34("stopped_at", { withTimezone: true }),
5056
+ stopPolicy: jsonb20("stop_policy").$type(),
5057
+ healthStatus: text38("health_status").notNull().default("unknown"),
5058
+ createdAt: timestamp34("created_at", { withTimezone: true }).notNull().defaultNow(),
5059
+ updatedAt: timestamp34("updated_at", { withTimezone: true }).notNull().defaultNow()
4983
5060
  },
4984
5061
  (table) => ({
4985
- companyWorkspaceStatusIdx: index28("workspace_runtime_services_company_workspace_status_idx").on(
5062
+ companyWorkspaceStatusIdx: index29("workspace_runtime_services_company_workspace_status_idx").on(
4986
5063
  table.orgId,
4987
5064
  table.projectWorkspaceId,
4988
5065
  table.status
4989
5066
  ),
4990
- companyExecutionWorkspaceStatusIdx: index28("workspace_runtime_services_company_execution_workspace_status_idx").on(
5067
+ companyExecutionWorkspaceStatusIdx: index29("workspace_runtime_services_company_execution_workspace_status_idx").on(
4991
5068
  table.orgId,
4992
5069
  table.executionWorkspaceId,
4993
5070
  table.status
4994
5071
  ),
4995
- companyProjectStatusIdx: index28("workspace_runtime_services_company_project_status_idx").on(
5072
+ companyProjectStatusIdx: index29("workspace_runtime_services_company_project_status_idx").on(
4996
5073
  table.orgId,
4997
5074
  table.projectId,
4998
5075
  table.status
4999
5076
  ),
5000
- runIdx: index28("workspace_runtime_services_run_idx").on(table.startedByRunId),
5001
- companyUpdatedIdx: index28("workspace_runtime_services_company_updated_idx").on(
5077
+ runIdx: index29("workspace_runtime_services_run_idx").on(table.startedByRunId),
5078
+ companyUpdatedIdx: index29("workspace_runtime_services_company_updated_idx").on(
5002
5079
  table.orgId,
5003
5080
  table.updatedAt
5004
5081
  )
@@ -5008,7 +5085,7 @@ var init_workspace_runtime_services = __esm({
5008
5085
  });
5009
5086
 
5010
5087
  // ../packages/db/src/schema/project_goals.ts
5011
- import { pgTable as pgTable34, uuid as uuid32, timestamp as timestamp34, index as index29, primaryKey } from "drizzle-orm/pg-core";
5088
+ import { pgTable as pgTable35, uuid as uuid33, timestamp as timestamp35, index as index30, primaryKey } from "drizzle-orm/pg-core";
5012
5089
  var projectGoals;
5013
5090
  var init_project_goals = __esm({
5014
5091
  "../packages/db/src/schema/project_goals.ts"() {
@@ -5016,45 +5093,45 @@ var init_project_goals = __esm({
5016
5093
  init_organizations();
5017
5094
  init_projects();
5018
5095
  init_goals();
5019
- projectGoals = pgTable34(
5096
+ projectGoals = pgTable35(
5020
5097
  "project_goals",
5021
5098
  {
5022
- projectId: uuid32("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
5023
- goalId: uuid32("goal_id").notNull().references(() => goals.id, { onDelete: "cascade" }),
5024
- orgId: uuid32("org_id").notNull().references(() => organizations.id),
5025
- createdAt: timestamp34("created_at", { withTimezone: true }).notNull().defaultNow(),
5026
- updatedAt: timestamp34("updated_at", { withTimezone: true }).notNull().defaultNow()
5099
+ projectId: uuid33("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
5100
+ goalId: uuid33("goal_id").notNull().references(() => goals.id, { onDelete: "cascade" }),
5101
+ orgId: uuid33("org_id").notNull().references(() => organizations.id),
5102
+ createdAt: timestamp35("created_at", { withTimezone: true }).notNull().defaultNow(),
5103
+ updatedAt: timestamp35("updated_at", { withTimezone: true }).notNull().defaultNow()
5027
5104
  },
5028
5105
  (table) => ({
5029
5106
  pk: primaryKey({ columns: [table.projectId, table.goalId] }),
5030
- projectIdx: index29("project_goals_project_idx").on(table.projectId),
5031
- goalIdx: index29("project_goals_goal_idx").on(table.goalId),
5032
- orgIdx: index29("project_goals_company_idx").on(table.orgId)
5107
+ projectIdx: index30("project_goals_project_idx").on(table.projectId),
5108
+ goalIdx: index30("project_goals_goal_idx").on(table.goalId),
5109
+ orgIdx: index30("project_goals_company_idx").on(table.orgId)
5033
5110
  })
5034
5111
  );
5035
5112
  }
5036
5113
  });
5037
5114
 
5038
5115
  // ../packages/db/src/schema/issue_follows.ts
5039
- import { index as index30, pgTable as pgTable35, timestamp as timestamp35, uniqueIndex as uniqueIndex20, uuid as uuid33, text as text38 } from "drizzle-orm/pg-core";
5116
+ import { index as index31, pgTable as pgTable36, timestamp as timestamp36, uniqueIndex as uniqueIndex20, uuid as uuid34, text as text39 } from "drizzle-orm/pg-core";
5040
5117
  var issueFollows;
5041
5118
  var init_issue_follows = __esm({
5042
5119
  "../packages/db/src/schema/issue_follows.ts"() {
5043
5120
  "use strict";
5044
5121
  init_organizations();
5045
5122
  init_issues();
5046
- issueFollows = pgTable35(
5123
+ issueFollows = pgTable36(
5047
5124
  "issue_follows",
5048
5125
  {
5049
- id: uuid33("id").primaryKey().defaultRandom(),
5050
- orgId: uuid33("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5051
- issueId: uuid33("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5052
- userId: text38("user_id").notNull(),
5053
- createdAt: timestamp35("created_at", { withTimezone: true }).notNull().defaultNow()
5126
+ id: uuid34("id").primaryKey().defaultRandom(),
5127
+ orgId: uuid34("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5128
+ issueId: uuid34("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5129
+ userId: text39("user_id").notNull(),
5130
+ createdAt: timestamp36("created_at", { withTimezone: true }).notNull().defaultNow()
5054
5131
  },
5055
5132
  (table) => ({
5056
- orgIssueIdx: index30("issue_follows_org_issue_idx").on(table.orgId, table.issueId),
5057
- orgUserIdx: index30("issue_follows_org_user_idx").on(table.orgId, table.userId),
5133
+ orgIssueIdx: index31("issue_follows_org_issue_idx").on(table.orgId, table.issueId),
5134
+ orgUserIdx: index31("issue_follows_org_user_idx").on(table.orgId, table.userId),
5058
5135
  orgIssueUserUnique: uniqueIndex20("issue_follows_org_issue_user_idx").on(
5059
5136
  table.orgId,
5060
5137
  table.issueId,
@@ -5066,7 +5143,7 @@ var init_issue_follows = __esm({
5066
5143
  });
5067
5144
 
5068
5145
  // ../packages/db/src/schema/chat_conversations.ts
5069
- import { boolean as boolean7, index as index31, pgTable as pgTable36, text as text39, timestamp as timestamp36, uuid as uuid34 } from "drizzle-orm/pg-core";
5146
+ import { boolean as boolean7, index as index32, pgTable as pgTable37, text as text40, timestamp as timestamp37, uuid as uuid35 } from "drizzle-orm/pg-core";
5070
5147
  var chatConversations;
5071
5148
  var init_chat_conversations = __esm({
5072
5149
  "../packages/db/src/schema/chat_conversations.ts"() {
@@ -5074,64 +5151,64 @@ var init_chat_conversations = __esm({
5074
5151
  init_agents();
5075
5152
  init_organizations();
5076
5153
  init_issues();
5077
- chatConversations = pgTable36(
5154
+ chatConversations = pgTable37(
5078
5155
  "chat_conversations",
5079
5156
  {
5080
- id: uuid34("id").primaryKey().defaultRandom(),
5081
- orgId: uuid34("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5082
- status: text39("status").notNull().default("active"),
5083
- title: text39("title").notNull().default("New chat"),
5084
- summary: text39("summary"),
5085
- preferredAgentId: uuid34("preferred_agent_id").references(() => agents.id, { onDelete: "set null" }),
5086
- routedAgentId: uuid34("routed_agent_id").references(() => agents.id, { onDelete: "set null" }),
5087
- primaryIssueId: uuid34("primary_issue_id").references(() => issues.id, { onDelete: "set null" }),
5088
- issueCreationMode: text39("issue_creation_mode").notNull().default("manual_approval"),
5157
+ id: uuid35("id").primaryKey().defaultRandom(),
5158
+ orgId: uuid35("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5159
+ status: text40("status").notNull().default("active"),
5160
+ title: text40("title").notNull().default("New chat"),
5161
+ summary: text40("summary"),
5162
+ preferredAgentId: uuid35("preferred_agent_id").references(() => agents.id, { onDelete: "set null" }),
5163
+ routedAgentId: uuid35("routed_agent_id").references(() => agents.id, { onDelete: "set null" }),
5164
+ primaryIssueId: uuid35("primary_issue_id").references(() => issues.id, { onDelete: "set null" }),
5165
+ issueCreationMode: text40("issue_creation_mode").notNull().default("manual_approval"),
5089
5166
  planMode: boolean7("plan_mode").notNull().default(false),
5090
- createdByUserId: text39("created_by_user_id"),
5091
- lastMessageAt: timestamp36("last_message_at", { withTimezone: true }),
5092
- resolvedAt: timestamp36("resolved_at", { withTimezone: true }),
5093
- createdAt: timestamp36("created_at", { withTimezone: true }).notNull().defaultNow(),
5094
- updatedAt: timestamp36("updated_at", { withTimezone: true }).notNull().defaultNow()
5167
+ createdByUserId: text40("created_by_user_id"),
5168
+ lastMessageAt: timestamp37("last_message_at", { withTimezone: true }),
5169
+ resolvedAt: timestamp37("resolved_at", { withTimezone: true }),
5170
+ createdAt: timestamp37("created_at", { withTimezone: true }).notNull().defaultNow(),
5171
+ updatedAt: timestamp37("updated_at", { withTimezone: true }).notNull().defaultNow()
5095
5172
  },
5096
5173
  (table) => ({
5097
- orgUpdatedIdx: index31("chat_conversations_org_updated_idx").on(table.orgId, table.updatedAt),
5098
- orgStatusUpdatedIdx: index31("chat_conversations_org_status_updated_idx").on(
5174
+ orgUpdatedIdx: index32("chat_conversations_org_updated_idx").on(table.orgId, table.updatedAt),
5175
+ orgStatusUpdatedIdx: index32("chat_conversations_org_status_updated_idx").on(
5099
5176
  table.orgId,
5100
5177
  table.status,
5101
5178
  table.updatedAt
5102
5179
  ),
5103
- primaryIssueIdx: index31("chat_conversations_primary_issue_idx").on(table.primaryIssueId)
5180
+ primaryIssueIdx: index32("chat_conversations_primary_issue_idx").on(table.primaryIssueId)
5104
5181
  })
5105
5182
  );
5106
5183
  }
5107
5184
  });
5108
5185
 
5109
5186
  // ../packages/db/src/schema/chat_conversation_user_states.ts
5110
- import { index as index32, pgTable as pgTable37, text as text40, timestamp as timestamp37, uniqueIndex as uniqueIndex21, uuid as uuid35 } from "drizzle-orm/pg-core";
5187
+ import { index as index33, pgTable as pgTable38, text as text41, timestamp as timestamp38, uniqueIndex as uniqueIndex21, uuid as uuid36 } from "drizzle-orm/pg-core";
5111
5188
  var chatConversationUserStates;
5112
5189
  var init_chat_conversation_user_states = __esm({
5113
5190
  "../packages/db/src/schema/chat_conversation_user_states.ts"() {
5114
5191
  "use strict";
5115
5192
  init_chat_conversations();
5116
5193
  init_organizations();
5117
- chatConversationUserStates = pgTable37(
5194
+ chatConversationUserStates = pgTable38(
5118
5195
  "chat_conversation_user_states",
5119
5196
  {
5120
- id: uuid35("id").primaryKey().defaultRandom(),
5121
- orgId: uuid35("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5122
- conversationId: uuid35("conversation_id").notNull().references(() => chatConversations.id, { onDelete: "cascade" }),
5123
- userId: text40("user_id").notNull(),
5124
- lastReadAt: timestamp37("last_read_at", { withTimezone: true }).notNull().defaultNow(),
5125
- pinnedAt: timestamp37("pinned_at", { withTimezone: true }),
5126
- createdAt: timestamp37("created_at", { withTimezone: true }).notNull().defaultNow(),
5127
- updatedAt: timestamp37("updated_at", { withTimezone: true }).notNull().defaultNow()
5197
+ id: uuid36("id").primaryKey().defaultRandom(),
5198
+ orgId: uuid36("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5199
+ conversationId: uuid36("conversation_id").notNull().references(() => chatConversations.id, { onDelete: "cascade" }),
5200
+ userId: text41("user_id").notNull(),
5201
+ lastReadAt: timestamp38("last_read_at", { withTimezone: true }).notNull().defaultNow(),
5202
+ pinnedAt: timestamp38("pinned_at", { withTimezone: true }),
5203
+ createdAt: timestamp38("created_at", { withTimezone: true }).notNull().defaultNow(),
5204
+ updatedAt: timestamp38("updated_at", { withTimezone: true }).notNull().defaultNow()
5128
5205
  },
5129
5206
  (table) => ({
5130
- orgConversationIdx: index32("chat_conversation_user_states_org_conversation_idx").on(
5207
+ orgConversationIdx: index33("chat_conversation_user_states_org_conversation_idx").on(
5131
5208
  table.orgId,
5132
5209
  table.conversationId
5133
5210
  ),
5134
- orgUserIdx: index32("chat_conversation_user_states_org_user_idx").on(table.orgId, table.userId),
5211
+ orgUserIdx: index33("chat_conversation_user_states_org_user_idx").on(table.orgId, table.userId),
5135
5212
  orgConversationUserUnique: uniqueIndex21("chat_conversation_user_states_org_conversation_user_idx").on(
5136
5213
  table.orgId,
5137
5214
  table.conversationId,
@@ -5143,7 +5220,7 @@ var init_chat_conversation_user_states = __esm({
5143
5220
  });
5144
5221
 
5145
5222
  // ../packages/db/src/schema/chat_messages.ts
5146
- import { index as index33, integer as integer12, jsonb as jsonb20, pgTable as pgTable38, text as text41, timestamp as timestamp38, uuid as uuid36 } from "drizzle-orm/pg-core";
5223
+ import { index as index34, integer as integer13, jsonb as jsonb21, pgTable as pgTable39, text as text42, timestamp as timestamp39, uuid as uuid37 } from "drizzle-orm/pg-core";
5147
5224
  var chatMessages;
5148
5225
  var init_chat_messages = __esm({
5149
5226
  "../packages/db/src/schema/chat_messages.ts"() {
@@ -5152,69 +5229,69 @@ var init_chat_messages = __esm({
5152
5229
  init_approvals();
5153
5230
  init_chat_conversations();
5154
5231
  init_organizations();
5155
- chatMessages = pgTable38(
5232
+ chatMessages = pgTable39(
5156
5233
  "chat_messages",
5157
5234
  {
5158
- id: uuid36("id").primaryKey().defaultRandom(),
5159
- orgId: uuid36("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5160
- conversationId: uuid36("conversation_id").notNull().references(() => chatConversations.id, { onDelete: "cascade" }),
5161
- role: text41("role").notNull(),
5162
- kind: text41("kind").notNull().default("message"),
5163
- status: text41("status").notNull().default("completed"),
5164
- body: text41("body").notNull(),
5165
- structuredPayload: jsonb20("structured_payload").$type(),
5166
- approvalId: uuid36("approval_id").references(() => approvals.id, { onDelete: "set null" }),
5167
- replyingAgentId: uuid36("replying_agent_id").references(() => agents.id, { onDelete: "set null" }),
5235
+ id: uuid37("id").primaryKey().defaultRandom(),
5236
+ orgId: uuid37("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5237
+ conversationId: uuid37("conversation_id").notNull().references(() => chatConversations.id, { onDelete: "cascade" }),
5238
+ role: text42("role").notNull(),
5239
+ kind: text42("kind").notNull().default("message"),
5240
+ status: text42("status").notNull().default("completed"),
5241
+ body: text42("body").notNull(),
5242
+ structuredPayload: jsonb21("structured_payload").$type(),
5243
+ approvalId: uuid37("approval_id").references(() => approvals.id, { onDelete: "set null" }),
5244
+ replyingAgentId: uuid37("replying_agent_id").references(() => agents.id, { onDelete: "set null" }),
5168
5245
  /** User+assistant pairs that share a logical "turn" (for edit/regenerate variants). */
5169
- chatTurnId: uuid36("chat_turn_id"),
5170
- turnVariant: integer12("turn_variant").notNull().default(0),
5171
- supersededAt: timestamp38("superseded_at", { withTimezone: true }),
5172
- createdAt: timestamp38("created_at", { withTimezone: true }).notNull().defaultNow(),
5173
- updatedAt: timestamp38("updated_at", { withTimezone: true }).notNull().defaultNow()
5246
+ chatTurnId: uuid37("chat_turn_id"),
5247
+ turnVariant: integer13("turn_variant").notNull().default(0),
5248
+ supersededAt: timestamp39("superseded_at", { withTimezone: true }),
5249
+ createdAt: timestamp39("created_at", { withTimezone: true }).notNull().defaultNow(),
5250
+ updatedAt: timestamp39("updated_at", { withTimezone: true }).notNull().defaultNow()
5174
5251
  },
5175
5252
  (table) => ({
5176
- conversationCreatedIdx: index33("chat_messages_conversation_created_idx").on(
5253
+ conversationCreatedIdx: index34("chat_messages_conversation_created_idx").on(
5177
5254
  table.conversationId,
5178
5255
  table.createdAt
5179
5256
  ),
5180
- orgConversationCreatedIdx: index33("chat_messages_org_conversation_created_idx").on(
5257
+ orgConversationCreatedIdx: index34("chat_messages_org_conversation_created_idx").on(
5181
5258
  table.orgId,
5182
5259
  table.conversationId,
5183
5260
  table.createdAt
5184
5261
  ),
5185
- approvalIdx: index33("chat_messages_approval_idx").on(table.approvalId)
5262
+ approvalIdx: index34("chat_messages_approval_idx").on(table.approvalId)
5186
5263
  })
5187
5264
  );
5188
5265
  }
5189
5266
  });
5190
5267
 
5191
5268
  // ../packages/db/src/schema/chat_context_links.ts
5192
- import { index as index34, jsonb as jsonb21, pgTable as pgTable39, text as text42, timestamp as timestamp39, uniqueIndex as uniqueIndex22, uuid as uuid37 } from "drizzle-orm/pg-core";
5269
+ import { index as index35, jsonb as jsonb22, pgTable as pgTable40, text as text43, timestamp as timestamp40, uniqueIndex as uniqueIndex22, uuid as uuid38 } from "drizzle-orm/pg-core";
5193
5270
  var chatContextLinks;
5194
5271
  var init_chat_context_links = __esm({
5195
5272
  "../packages/db/src/schema/chat_context_links.ts"() {
5196
5273
  "use strict";
5197
5274
  init_chat_conversations();
5198
5275
  init_organizations();
5199
- chatContextLinks = pgTable39(
5276
+ chatContextLinks = pgTable40(
5200
5277
  "chat_context_links",
5201
5278
  {
5202
- id: uuid37("id").primaryKey().defaultRandom(),
5203
- orgId: uuid37("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5204
- conversationId: uuid37("conversation_id").notNull().references(() => chatConversations.id, { onDelete: "cascade" }),
5205
- entityType: text42("entity_type").notNull(),
5206
- entityId: text42("entity_id").notNull(),
5207
- metadata: jsonb21("metadata").$type(),
5208
- createdAt: timestamp39("created_at", { withTimezone: true }).notNull().defaultNow(),
5209
- updatedAt: timestamp39("updated_at", { withTimezone: true }).notNull().defaultNow()
5279
+ id: uuid38("id").primaryKey().defaultRandom(),
5280
+ orgId: uuid38("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5281
+ conversationId: uuid38("conversation_id").notNull().references(() => chatConversations.id, { onDelete: "cascade" }),
5282
+ entityType: text43("entity_type").notNull(),
5283
+ entityId: text43("entity_id").notNull(),
5284
+ metadata: jsonb22("metadata").$type(),
5285
+ createdAt: timestamp40("created_at", { withTimezone: true }).notNull().defaultNow(),
5286
+ updatedAt: timestamp40("updated_at", { withTimezone: true }).notNull().defaultNow()
5210
5287
  },
5211
5288
  (table) => ({
5212
- conversationEntityIdx: index34("chat_context_links_conversation_entity_idx").on(
5289
+ conversationEntityIdx: index35("chat_context_links_conversation_entity_idx").on(
5213
5290
  table.conversationId,
5214
5291
  table.entityType,
5215
5292
  table.entityId
5216
5293
  ),
5217
- companyEntityIdx: index34("chat_context_links_company_entity_idx").on(
5294
+ companyEntityIdx: index35("chat_context_links_company_entity_idx").on(
5218
5295
  table.orgId,
5219
5296
  table.entityType,
5220
5297
  table.entityId
@@ -5230,7 +5307,7 @@ var init_chat_context_links = __esm({
5230
5307
  });
5231
5308
 
5232
5309
  // ../packages/db/src/schema/chat_attachments.ts
5233
- import { index as index35, pgTable as pgTable40, timestamp as timestamp40, uniqueIndex as uniqueIndex23, uuid as uuid38 } from "drizzle-orm/pg-core";
5310
+ import { index as index36, pgTable as pgTable41, timestamp as timestamp41, uniqueIndex as uniqueIndex23, uuid as uuid39 } from "drizzle-orm/pg-core";
5234
5311
  var chatAttachments;
5235
5312
  var init_chat_attachments = __esm({
5236
5313
  "../packages/db/src/schema/chat_attachments.ts"() {
@@ -5239,23 +5316,23 @@ var init_chat_attachments = __esm({
5239
5316
  init_chat_conversations();
5240
5317
  init_chat_messages();
5241
5318
  init_organizations();
5242
- chatAttachments = pgTable40(
5319
+ chatAttachments = pgTable41(
5243
5320
  "chat_attachments",
5244
5321
  {
5245
- id: uuid38("id").primaryKey().defaultRandom(),
5246
- orgId: uuid38("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5247
- conversationId: uuid38("conversation_id").notNull().references(() => chatConversations.id, { onDelete: "cascade" }),
5248
- messageId: uuid38("message_id").notNull().references(() => chatMessages.id, { onDelete: "cascade" }),
5249
- assetId: uuid38("asset_id").notNull().references(() => assets.id, { onDelete: "cascade" }),
5250
- createdAt: timestamp40("created_at", { withTimezone: true }).notNull().defaultNow(),
5251
- updatedAt: timestamp40("updated_at", { withTimezone: true }).notNull().defaultNow()
5322
+ id: uuid39("id").primaryKey().defaultRandom(),
5323
+ orgId: uuid39("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5324
+ conversationId: uuid39("conversation_id").notNull().references(() => chatConversations.id, { onDelete: "cascade" }),
5325
+ messageId: uuid39("message_id").notNull().references(() => chatMessages.id, { onDelete: "cascade" }),
5326
+ assetId: uuid39("asset_id").notNull().references(() => assets.id, { onDelete: "cascade" }),
5327
+ createdAt: timestamp41("created_at", { withTimezone: true }).notNull().defaultNow(),
5328
+ updatedAt: timestamp41("updated_at", { withTimezone: true }).notNull().defaultNow()
5252
5329
  },
5253
5330
  (table) => ({
5254
- conversationMessageIdx: index35("chat_attachments_conversation_message_idx").on(
5331
+ conversationMessageIdx: index36("chat_attachments_conversation_message_idx").on(
5255
5332
  table.conversationId,
5256
5333
  table.messageId
5257
5334
  ),
5258
- companyConversationIdx: index35("chat_attachments_company_conversation_idx").on(
5335
+ companyConversationIdx: index36("chat_attachments_company_conversation_idx").on(
5259
5336
  table.orgId,
5260
5337
  table.conversationId
5261
5338
  ),
@@ -5266,35 +5343,35 @@ var init_chat_attachments = __esm({
5266
5343
  });
5267
5344
 
5268
5345
  // ../packages/db/src/schema/calendar_sources.ts
5269
- import { index as index36, jsonb as jsonb22, pgTable as pgTable41, text as text43, timestamp as timestamp41, uuid as uuid39 } from "drizzle-orm/pg-core";
5346
+ import { index as index37, jsonb as jsonb23, pgTable as pgTable42, text as text44, timestamp as timestamp42, uuid as uuid40 } from "drizzle-orm/pg-core";
5270
5347
  var calendarSources;
5271
5348
  var init_calendar_sources = __esm({
5272
5349
  "../packages/db/src/schema/calendar_sources.ts"() {
5273
5350
  "use strict";
5274
5351
  init_organizations();
5275
5352
  init_agents();
5276
- calendarSources = pgTable41(
5353
+ calendarSources = pgTable42(
5277
5354
  "calendar_sources",
5278
5355
  {
5279
- id: uuid39("id").primaryKey().defaultRandom(),
5280
- orgId: uuid39("org_id").notNull().references(() => organizations.id),
5281
- type: text43("type").notNull().default("rudder_local"),
5282
- name: text43("name").notNull(),
5283
- ownerType: text43("owner_type").notNull().default("user"),
5284
- ownerUserId: text43("owner_user_id"),
5285
- ownerAgentId: uuid39("owner_agent_id").references(() => agents.id, { onDelete: "set null" }),
5286
- externalProvider: text43("external_provider"),
5287
- externalCalendarId: text43("external_calendar_id"),
5288
- visibilityDefault: text43("visibility_default").notNull().default("full"),
5289
- status: text43("status").notNull().default("active"),
5290
- lastSyncedAt: timestamp41("last_synced_at", { withTimezone: true }),
5291
- syncCursorJson: jsonb22("sync_cursor_json").$type(),
5292
- createdAt: timestamp41("created_at", { withTimezone: true }).notNull().defaultNow(),
5293
- updatedAt: timestamp41("updated_at", { withTimezone: true }).notNull().defaultNow()
5356
+ id: uuid40("id").primaryKey().defaultRandom(),
5357
+ orgId: uuid40("org_id").notNull().references(() => organizations.id),
5358
+ type: text44("type").notNull().default("rudder_local"),
5359
+ name: text44("name").notNull(),
5360
+ ownerType: text44("owner_type").notNull().default("user"),
5361
+ ownerUserId: text44("owner_user_id"),
5362
+ ownerAgentId: uuid40("owner_agent_id").references(() => agents.id, { onDelete: "set null" }),
5363
+ externalProvider: text44("external_provider"),
5364
+ externalCalendarId: text44("external_calendar_id"),
5365
+ visibilityDefault: text44("visibility_default").notNull().default("full"),
5366
+ status: text44("status").notNull().default("active"),
5367
+ lastSyncedAt: timestamp42("last_synced_at", { withTimezone: true }),
5368
+ syncCursorJson: jsonb23("sync_cursor_json").$type(),
5369
+ createdAt: timestamp42("created_at", { withTimezone: true }).notNull().defaultNow(),
5370
+ updatedAt: timestamp42("updated_at", { withTimezone: true }).notNull().defaultNow()
5294
5371
  },
5295
5372
  (table) => ({
5296
- orgTypeIdx: index36("calendar_sources_org_type_idx").on(table.orgId, table.type),
5297
- externalIdx: index36("calendar_sources_external_idx").on(
5373
+ orgTypeIdx: index37("calendar_sources_org_type_idx").on(table.orgId, table.type),
5374
+ externalIdx: index37("calendar_sources_external_idx").on(
5298
5375
  table.orgId,
5299
5376
  table.externalProvider,
5300
5377
  table.externalCalendarId
@@ -5305,7 +5382,7 @@ var init_calendar_sources = __esm({
5305
5382
  });
5306
5383
 
5307
5384
  // ../packages/db/src/schema/activity_log.ts
5308
- import { pgTable as pgTable42, uuid as uuid40, text as text44, timestamp as timestamp42, jsonb as jsonb23, index as index37 } from "drizzle-orm/pg-core";
5385
+ import { pgTable as pgTable43, uuid as uuid41, text as text45, timestamp as timestamp43, jsonb as jsonb24, index as index38 } from "drizzle-orm/pg-core";
5309
5386
  var activityLog;
5310
5387
  var init_activity_log = __esm({
5311
5388
  "../packages/db/src/schema/activity_log.ts"() {
@@ -5313,32 +5390,32 @@ var init_activity_log = __esm({
5313
5390
  init_organizations();
5314
5391
  init_agents();
5315
5392
  init_heartbeat_runs();
5316
- activityLog = pgTable42(
5393
+ activityLog = pgTable43(
5317
5394
  "activity_log",
5318
5395
  {
5319
- id: uuid40("id").primaryKey().defaultRandom(),
5320
- orgId: uuid40("org_id").notNull().references(() => organizations.id),
5321
- actorType: text44("actor_type").notNull().default("system"),
5322
- actorId: text44("actor_id").notNull(),
5323
- action: text44("action").notNull(),
5324
- entityType: text44("entity_type").notNull(),
5325
- entityId: text44("entity_id").notNull(),
5326
- agentId: uuid40("agent_id").references(() => agents.id),
5327
- runId: uuid40("run_id").references(() => heartbeatRuns.id),
5328
- details: jsonb23("details").$type(),
5329
- createdAt: timestamp42("created_at", { withTimezone: true }).notNull().defaultNow()
5396
+ id: uuid41("id").primaryKey().defaultRandom(),
5397
+ orgId: uuid41("org_id").notNull().references(() => organizations.id),
5398
+ actorType: text45("actor_type").notNull().default("system"),
5399
+ actorId: text45("actor_id").notNull(),
5400
+ action: text45("action").notNull(),
5401
+ entityType: text45("entity_type").notNull(),
5402
+ entityId: text45("entity_id").notNull(),
5403
+ agentId: uuid41("agent_id").references(() => agents.id),
5404
+ runId: uuid41("run_id").references(() => heartbeatRuns.id),
5405
+ details: jsonb24("details").$type(),
5406
+ createdAt: timestamp43("created_at", { withTimezone: true }).notNull().defaultNow()
5330
5407
  },
5331
5408
  (table) => ({
5332
- companyCreatedIdx: index37("activity_log_company_created_idx").on(table.orgId, table.createdAt),
5333
- runIdIdx: index37("activity_log_run_id_idx").on(table.runId),
5334
- entityIdx: index37("activity_log_entity_type_id_idx").on(table.entityType, table.entityId)
5409
+ companyCreatedIdx: index38("activity_log_company_created_idx").on(table.orgId, table.createdAt),
5410
+ runIdIdx: index38("activity_log_run_id_idx").on(table.runId),
5411
+ entityIdx: index38("activity_log_entity_type_id_idx").on(table.entityType, table.entityId)
5335
5412
  })
5336
5413
  );
5337
5414
  }
5338
5415
  });
5339
5416
 
5340
5417
  // ../packages/db/src/schema/calendar_events.ts
5341
- import { index as index38, pgTable as pgTable43, text as text45, timestamp as timestamp43, uuid as uuid41, boolean as boolean8 } from "drizzle-orm/pg-core";
5418
+ import { index as index39, pgTable as pgTable44, text as text46, timestamp as timestamp44, uuid as uuid42, boolean as boolean8 } from "drizzle-orm/pg-core";
5342
5419
  var calendarEvents;
5343
5420
  var init_calendar_events = __esm({
5344
5421
  "../packages/db/src/schema/calendar_events.ts"() {
@@ -5352,55 +5429,55 @@ var init_calendar_events = __esm({
5352
5429
  init_approvals();
5353
5430
  init_heartbeat_runs();
5354
5431
  init_activity_log();
5355
- calendarEvents = pgTable43(
5432
+ calendarEvents = pgTable44(
5356
5433
  "calendar_events",
5357
5434
  {
5358
- id: uuid41("id").primaryKey().defaultRandom(),
5359
- orgId: uuid41("org_id").notNull().references(() => organizations.id),
5360
- sourceId: uuid41("source_id").references(() => calendarSources.id, { onDelete: "set null" }),
5361
- eventKind: text45("event_kind").notNull(),
5362
- eventStatus: text45("event_status").notNull(),
5363
- ownerType: text45("owner_type").notNull(),
5364
- ownerUserId: text45("owner_user_id"),
5365
- ownerAgentId: uuid41("owner_agent_id").references(() => agents.id, { onDelete: "set null" }),
5366
- title: text45("title").notNull(),
5367
- description: text45("description"),
5368
- startAt: timestamp43("start_at", { withTimezone: true }).notNull(),
5369
- endAt: timestamp43("end_at", { withTimezone: true }).notNull(),
5370
- timezone: text45("timezone").notNull().default("UTC"),
5435
+ id: uuid42("id").primaryKey().defaultRandom(),
5436
+ orgId: uuid42("org_id").notNull().references(() => organizations.id),
5437
+ sourceId: uuid42("source_id").references(() => calendarSources.id, { onDelete: "set null" }),
5438
+ eventKind: text46("event_kind").notNull(),
5439
+ eventStatus: text46("event_status").notNull(),
5440
+ ownerType: text46("owner_type").notNull(),
5441
+ ownerUserId: text46("owner_user_id"),
5442
+ ownerAgentId: uuid42("owner_agent_id").references(() => agents.id, { onDelete: "set null" }),
5443
+ title: text46("title").notNull(),
5444
+ description: text46("description"),
5445
+ startAt: timestamp44("start_at", { withTimezone: true }).notNull(),
5446
+ endAt: timestamp44("end_at", { withTimezone: true }).notNull(),
5447
+ timezone: text46("timezone").notNull().default("UTC"),
5371
5448
  allDay: boolean8("all_day").notNull().default(false),
5372
- visibility: text45("visibility").notNull().default("full"),
5373
- issueId: uuid41("issue_id").references(() => issues.id, { onDelete: "set null" }),
5374
- projectId: uuid41("project_id").references(() => projects.id, { onDelete: "set null" }),
5375
- goalId: uuid41("goal_id").references(() => goals.id, { onDelete: "set null" }),
5376
- approvalId: uuid41("approval_id").references(() => approvals.id, { onDelete: "set null" }),
5377
- heartbeatRunId: uuid41("heartbeat_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
5378
- activityId: uuid41("activity_id").references(() => activityLog.id, { onDelete: "set null" }),
5379
- sourceMode: text45("source_mode").notNull().default("manual"),
5380
- externalProvider: text45("external_provider"),
5381
- externalCalendarId: text45("external_calendar_id"),
5382
- externalEventId: text45("external_event_id"),
5383
- externalEtag: text45("external_etag"),
5384
- externalUpdatedAt: timestamp43("external_updated_at", { withTimezone: true }),
5385
- createdByUserId: text45("created_by_user_id"),
5386
- updatedByUserId: text45("updated_by_user_id"),
5387
- createdAt: timestamp43("created_at", { withTimezone: true }).notNull().defaultNow(),
5388
- updatedAt: timestamp43("updated_at", { withTimezone: true }).notNull().defaultNow(),
5389
- deletedAt: timestamp43("deleted_at", { withTimezone: true })
5449
+ visibility: text46("visibility").notNull().default("full"),
5450
+ issueId: uuid42("issue_id").references(() => issues.id, { onDelete: "set null" }),
5451
+ projectId: uuid42("project_id").references(() => projects.id, { onDelete: "set null" }),
5452
+ goalId: uuid42("goal_id").references(() => goals.id, { onDelete: "set null" }),
5453
+ approvalId: uuid42("approval_id").references(() => approvals.id, { onDelete: "set null" }),
5454
+ heartbeatRunId: uuid42("heartbeat_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
5455
+ activityId: uuid42("activity_id").references(() => activityLog.id, { onDelete: "set null" }),
5456
+ sourceMode: text46("source_mode").notNull().default("manual"),
5457
+ externalProvider: text46("external_provider"),
5458
+ externalCalendarId: text46("external_calendar_id"),
5459
+ externalEventId: text46("external_event_id"),
5460
+ externalEtag: text46("external_etag"),
5461
+ externalUpdatedAt: timestamp44("external_updated_at", { withTimezone: true }),
5462
+ createdByUserId: text46("created_by_user_id"),
5463
+ updatedByUserId: text46("updated_by_user_id"),
5464
+ createdAt: timestamp44("created_at", { withTimezone: true }).notNull().defaultNow(),
5465
+ updatedAt: timestamp44("updated_at", { withTimezone: true }).notNull().defaultNow(),
5466
+ deletedAt: timestamp44("deleted_at", { withTimezone: true })
5390
5467
  },
5391
5468
  (table) => ({
5392
- orgRangeIdx: index38("calendar_events_org_range_idx").on(table.orgId, table.startAt, table.endAt),
5393
- orgAgentRangeIdx: index38("calendar_events_org_agent_range_idx").on(
5469
+ orgRangeIdx: index39("calendar_events_org_range_idx").on(table.orgId, table.startAt, table.endAt),
5470
+ orgAgentRangeIdx: index39("calendar_events_org_agent_range_idx").on(
5394
5471
  table.orgId,
5395
5472
  table.ownerAgentId,
5396
5473
  table.startAt
5397
5474
  ),
5398
- orgSourceRangeIdx: index38("calendar_events_org_source_range_idx").on(
5475
+ orgSourceRangeIdx: index39("calendar_events_org_source_range_idx").on(
5399
5476
  table.orgId,
5400
5477
  table.sourceId,
5401
5478
  table.startAt
5402
5479
  ),
5403
- externalIdx: index38("calendar_events_external_idx").on(
5480
+ externalIdx: index39("calendar_events_external_idx").on(
5404
5481
  table.orgId,
5405
5482
  table.externalProvider,
5406
5483
  table.externalCalendarId,
@@ -5412,31 +5489,31 @@ var init_calendar_events = __esm({
5412
5489
  });
5413
5490
 
5414
5491
  // ../packages/db/src/schema/organization_secrets.ts
5415
- import { pgTable as pgTable44, uuid as uuid42, text as text46, timestamp as timestamp44, integer as integer13, index as index39, uniqueIndex as uniqueIndex24 } from "drizzle-orm/pg-core";
5492
+ import { pgTable as pgTable45, uuid as uuid43, text as text47, timestamp as timestamp45, integer as integer14, index as index40, uniqueIndex as uniqueIndex24 } from "drizzle-orm/pg-core";
5416
5493
  var organizationSecrets;
5417
5494
  var init_organization_secrets = __esm({
5418
5495
  "../packages/db/src/schema/organization_secrets.ts"() {
5419
5496
  "use strict";
5420
5497
  init_organizations();
5421
5498
  init_agents();
5422
- organizationSecrets = pgTable44(
5499
+ organizationSecrets = pgTable45(
5423
5500
  "organization_secrets",
5424
5501
  {
5425
- id: uuid42("id").primaryKey().defaultRandom(),
5426
- orgId: uuid42("org_id").notNull().references(() => organizations.id),
5427
- name: text46("name").notNull(),
5428
- provider: text46("provider").notNull().default("local_encrypted"),
5429
- externalRef: text46("external_ref"),
5430
- latestVersion: integer13("latest_version").notNull().default(1),
5431
- description: text46("description"),
5432
- createdByAgentId: uuid42("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5433
- createdByUserId: text46("created_by_user_id"),
5434
- createdAt: timestamp44("created_at", { withTimezone: true }).notNull().defaultNow(),
5435
- updatedAt: timestamp44("updated_at", { withTimezone: true }).notNull().defaultNow()
5502
+ id: uuid43("id").primaryKey().defaultRandom(),
5503
+ orgId: uuid43("org_id").notNull().references(() => organizations.id),
5504
+ name: text47("name").notNull(),
5505
+ provider: text47("provider").notNull().default("local_encrypted"),
5506
+ externalRef: text47("external_ref"),
5507
+ latestVersion: integer14("latest_version").notNull().default(1),
5508
+ description: text47("description"),
5509
+ createdByAgentId: uuid43("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5510
+ createdByUserId: text47("created_by_user_id"),
5511
+ createdAt: timestamp45("created_at", { withTimezone: true }).notNull().defaultNow(),
5512
+ updatedAt: timestamp45("updated_at", { withTimezone: true }).notNull().defaultNow()
5436
5513
  },
5437
5514
  (table) => ({
5438
- organizationIdx: index39("organization_secrets_org_idx").on(table.orgId),
5439
- organizationProviderIdx: index39("organization_secrets_org_provider_idx").on(table.orgId, table.provider),
5515
+ organizationIdx: index40("organization_secrets_org_idx").on(table.orgId),
5516
+ organizationProviderIdx: index40("organization_secrets_org_provider_idx").on(table.orgId, table.provider),
5440
5517
  organizationNameUq: uniqueIndex24("organization_secrets_org_name_uq").on(table.orgId, table.name)
5441
5518
  })
5442
5519
  );
@@ -5446,14 +5523,14 @@ var init_organization_secrets = __esm({
5446
5523
  // ../packages/db/src/schema/automations.ts
5447
5524
  import {
5448
5525
  boolean as boolean9,
5449
- index as index40,
5450
- integer as integer14,
5451
- jsonb as jsonb24,
5452
- pgTable as pgTable45,
5453
- text as text47,
5454
- timestamp as timestamp45,
5526
+ index as index41,
5527
+ integer as integer15,
5528
+ jsonb as jsonb25,
5529
+ pgTable as pgTable46,
5530
+ text as text48,
5531
+ timestamp as timestamp46,
5455
5532
  uniqueIndex as uniqueIndex25,
5456
- uuid as uuid43
5533
+ uuid as uuid44
5457
5534
  } from "drizzle-orm/pg-core";
5458
5535
  var automations, automationTriggers, automationRuns;
5459
5536
  var init_automations = __esm({
@@ -5465,94 +5542,94 @@ var init_automations = __esm({
5465
5542
  init_issues();
5466
5543
  init_projects();
5467
5544
  init_goals();
5468
- automations = pgTable45(
5545
+ automations = pgTable46(
5469
5546
  "automations",
5470
5547
  {
5471
- id: uuid43("id").primaryKey().defaultRandom(),
5472
- orgId: uuid43("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5473
- projectId: uuid43("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
5474
- goalId: uuid43("goal_id").references(() => goals.id, { onDelete: "set null" }),
5475
- parentIssueId: uuid43("parent_issue_id").references(() => issues.id, { onDelete: "set null" }),
5476
- title: text47("title").notNull(),
5477
- description: text47("description"),
5478
- assigneeAgentId: uuid43("assignee_agent_id").notNull().references(() => agents.id),
5479
- priority: text47("priority").notNull().default("medium"),
5480
- status: text47("status").notNull().default("active"),
5481
- concurrencyPolicy: text47("concurrency_policy").notNull().default("coalesce_if_active"),
5482
- catchUpPolicy: text47("catch_up_policy").notNull().default("skip_missed"),
5483
- createdByAgentId: uuid43("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5484
- createdByUserId: text47("created_by_user_id"),
5485
- updatedByAgentId: uuid43("updated_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5486
- updatedByUserId: text47("updated_by_user_id"),
5487
- lastTriggeredAt: timestamp45("last_triggered_at", { withTimezone: true }),
5488
- lastEnqueuedAt: timestamp45("last_enqueued_at", { withTimezone: true }),
5489
- createdAt: timestamp45("created_at", { withTimezone: true }).notNull().defaultNow(),
5490
- updatedAt: timestamp45("updated_at", { withTimezone: true }).notNull().defaultNow()
5548
+ id: uuid44("id").primaryKey().defaultRandom(),
5549
+ orgId: uuid44("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5550
+ projectId: uuid44("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
5551
+ goalId: uuid44("goal_id").references(() => goals.id, { onDelete: "set null" }),
5552
+ parentIssueId: uuid44("parent_issue_id").references(() => issues.id, { onDelete: "set null" }),
5553
+ title: text48("title").notNull(),
5554
+ description: text48("description"),
5555
+ assigneeAgentId: uuid44("assignee_agent_id").notNull().references(() => agents.id),
5556
+ priority: text48("priority").notNull().default("medium"),
5557
+ status: text48("status").notNull().default("active"),
5558
+ concurrencyPolicy: text48("concurrency_policy").notNull().default("coalesce_if_active"),
5559
+ catchUpPolicy: text48("catch_up_policy").notNull().default("skip_missed"),
5560
+ createdByAgentId: uuid44("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5561
+ createdByUserId: text48("created_by_user_id"),
5562
+ updatedByAgentId: uuid44("updated_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5563
+ updatedByUserId: text48("updated_by_user_id"),
5564
+ lastTriggeredAt: timestamp46("last_triggered_at", { withTimezone: true }),
5565
+ lastEnqueuedAt: timestamp46("last_enqueued_at", { withTimezone: true }),
5566
+ createdAt: timestamp46("created_at", { withTimezone: true }).notNull().defaultNow(),
5567
+ updatedAt: timestamp46("updated_at", { withTimezone: true }).notNull().defaultNow()
5491
5568
  },
5492
5569
  (table) => ({
5493
- companyStatusIdx: index40("automations_company_status_idx").on(table.orgId, table.status),
5494
- companyAssigneeIdx: index40("automations_company_assignee_idx").on(table.orgId, table.assigneeAgentId),
5495
- companyProjectIdx: index40("automations_company_project_idx").on(table.orgId, table.projectId)
5570
+ companyStatusIdx: index41("automations_company_status_idx").on(table.orgId, table.status),
5571
+ companyAssigneeIdx: index41("automations_company_assignee_idx").on(table.orgId, table.assigneeAgentId),
5572
+ companyProjectIdx: index41("automations_company_project_idx").on(table.orgId, table.projectId)
5496
5573
  })
5497
5574
  );
5498
- automationTriggers = pgTable45(
5575
+ automationTriggers = pgTable46(
5499
5576
  "automation_triggers",
5500
5577
  {
5501
- id: uuid43("id").primaryKey().defaultRandom(),
5502
- orgId: uuid43("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5503
- automationId: uuid43("automation_id").notNull().references(() => automations.id, { onDelete: "cascade" }),
5504
- kind: text47("kind").notNull(),
5505
- label: text47("label"),
5578
+ id: uuid44("id").primaryKey().defaultRandom(),
5579
+ orgId: uuid44("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5580
+ automationId: uuid44("automation_id").notNull().references(() => automations.id, { onDelete: "cascade" }),
5581
+ kind: text48("kind").notNull(),
5582
+ label: text48("label"),
5506
5583
  enabled: boolean9("enabled").notNull().default(true),
5507
- cronExpression: text47("cron_expression"),
5508
- timezone: text47("timezone"),
5509
- nextRunAt: timestamp45("next_run_at", { withTimezone: true }),
5510
- lastFiredAt: timestamp45("last_fired_at", { withTimezone: true }),
5511
- publicId: text47("public_id"),
5512
- secretId: uuid43("secret_id").references(() => organizationSecrets.id, { onDelete: "set null" }),
5513
- signingMode: text47("signing_mode"),
5514
- replayWindowSec: integer14("replay_window_sec"),
5515
- lastRotatedAt: timestamp45("last_rotated_at", { withTimezone: true }),
5516
- lastResult: text47("last_result"),
5517
- createdByAgentId: uuid43("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5518
- createdByUserId: text47("created_by_user_id"),
5519
- updatedByAgentId: uuid43("updated_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5520
- updatedByUserId: text47("updated_by_user_id"),
5521
- createdAt: timestamp45("created_at", { withTimezone: true }).notNull().defaultNow(),
5522
- updatedAt: timestamp45("updated_at", { withTimezone: true }).notNull().defaultNow()
5584
+ cronExpression: text48("cron_expression"),
5585
+ timezone: text48("timezone"),
5586
+ nextRunAt: timestamp46("next_run_at", { withTimezone: true }),
5587
+ lastFiredAt: timestamp46("last_fired_at", { withTimezone: true }),
5588
+ publicId: text48("public_id"),
5589
+ secretId: uuid44("secret_id").references(() => organizationSecrets.id, { onDelete: "set null" }),
5590
+ signingMode: text48("signing_mode"),
5591
+ replayWindowSec: integer15("replay_window_sec"),
5592
+ lastRotatedAt: timestamp46("last_rotated_at", { withTimezone: true }),
5593
+ lastResult: text48("last_result"),
5594
+ createdByAgentId: uuid44("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5595
+ createdByUserId: text48("created_by_user_id"),
5596
+ updatedByAgentId: uuid44("updated_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5597
+ updatedByUserId: text48("updated_by_user_id"),
5598
+ createdAt: timestamp46("created_at", { withTimezone: true }).notNull().defaultNow(),
5599
+ updatedAt: timestamp46("updated_at", { withTimezone: true }).notNull().defaultNow()
5523
5600
  },
5524
5601
  (table) => ({
5525
- companyAutomationIdx: index40("automation_triggers_company_automation_idx").on(table.orgId, table.automationId),
5526
- companyKindIdx: index40("automation_triggers_company_kind_idx").on(table.orgId, table.kind),
5527
- nextRunIdx: index40("automation_triggers_next_run_idx").on(table.nextRunAt),
5528
- publicIdIdx: index40("automation_triggers_public_id_idx").on(table.publicId),
5602
+ companyAutomationIdx: index41("automation_triggers_company_automation_idx").on(table.orgId, table.automationId),
5603
+ companyKindIdx: index41("automation_triggers_company_kind_idx").on(table.orgId, table.kind),
5604
+ nextRunIdx: index41("automation_triggers_next_run_idx").on(table.nextRunAt),
5605
+ publicIdIdx: index41("automation_triggers_public_id_idx").on(table.publicId),
5529
5606
  publicIdUq: uniqueIndex25("automation_triggers_public_id_uq").on(table.publicId)
5530
5607
  })
5531
5608
  );
5532
- automationRuns = pgTable45(
5609
+ automationRuns = pgTable46(
5533
5610
  "automation_runs",
5534
5611
  {
5535
- id: uuid43("id").primaryKey().defaultRandom(),
5536
- orgId: uuid43("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5537
- automationId: uuid43("automation_id").notNull().references(() => automations.id, { onDelete: "cascade" }),
5538
- triggerId: uuid43("trigger_id").references(() => automationTriggers.id, { onDelete: "set null" }),
5539
- source: text47("source").notNull(),
5540
- status: text47("status").notNull().default("received"),
5541
- triggeredAt: timestamp45("triggered_at", { withTimezone: true }).notNull().defaultNow(),
5542
- idempotencyKey: text47("idempotency_key"),
5543
- triggerPayload: jsonb24("trigger_payload").$type(),
5544
- linkedIssueId: uuid43("linked_issue_id").references(() => issues.id, { onDelete: "set null" }),
5545
- coalescedIntoRunId: uuid43("coalesced_into_run_id"),
5546
- failureReason: text47("failure_reason"),
5547
- completedAt: timestamp45("completed_at", { withTimezone: true }),
5548
- createdAt: timestamp45("created_at", { withTimezone: true }).notNull().defaultNow(),
5549
- updatedAt: timestamp45("updated_at", { withTimezone: true }).notNull().defaultNow()
5612
+ id: uuid44("id").primaryKey().defaultRandom(),
5613
+ orgId: uuid44("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5614
+ automationId: uuid44("automation_id").notNull().references(() => automations.id, { onDelete: "cascade" }),
5615
+ triggerId: uuid44("trigger_id").references(() => automationTriggers.id, { onDelete: "set null" }),
5616
+ source: text48("source").notNull(),
5617
+ status: text48("status").notNull().default("received"),
5618
+ triggeredAt: timestamp46("triggered_at", { withTimezone: true }).notNull().defaultNow(),
5619
+ idempotencyKey: text48("idempotency_key"),
5620
+ triggerPayload: jsonb25("trigger_payload").$type(),
5621
+ linkedIssueId: uuid44("linked_issue_id").references(() => issues.id, { onDelete: "set null" }),
5622
+ coalescedIntoRunId: uuid44("coalesced_into_run_id"),
5623
+ failureReason: text48("failure_reason"),
5624
+ completedAt: timestamp46("completed_at", { withTimezone: true }),
5625
+ createdAt: timestamp46("created_at", { withTimezone: true }).notNull().defaultNow(),
5626
+ updatedAt: timestamp46("updated_at", { withTimezone: true }).notNull().defaultNow()
5550
5627
  },
5551
5628
  (table) => ({
5552
- companyAutomationIdx: index40("automation_runs_company_automation_idx").on(table.orgId, table.automationId, table.createdAt),
5553
- triggerIdx: index40("automation_runs_trigger_idx").on(table.triggerId, table.createdAt),
5554
- linkedIssueIdx: index40("automation_runs_linked_issue_idx").on(table.linkedIssueId),
5555
- idempotencyIdx: index40("automation_runs_trigger_idempotency_idx").on(table.triggerId, table.idempotencyKey)
5629
+ companyAutomationIdx: index41("automation_runs_company_automation_idx").on(table.orgId, table.automationId, table.createdAt),
5630
+ triggerIdx: index41("automation_runs_trigger_idx").on(table.triggerId, table.createdAt),
5631
+ linkedIssueIdx: index41("automation_runs_linked_issue_idx").on(table.linkedIssueId),
5632
+ idempotencyIdx: index41("automation_runs_trigger_idempotency_idx").on(table.triggerId, table.idempotencyKey)
5556
5633
  })
5557
5634
  );
5558
5635
  }
@@ -5561,12 +5638,12 @@ var init_automations = __esm({
5561
5638
  // ../packages/db/src/schema/issue_work_products.ts
5562
5639
  import {
5563
5640
  boolean as boolean10,
5564
- index as index41,
5565
- jsonb as jsonb25,
5566
- pgTable as pgTable46,
5567
- text as text48,
5568
- timestamp as timestamp46,
5569
- uuid as uuid44
5641
+ index as index42,
5642
+ jsonb as jsonb26,
5643
+ pgTable as pgTable47,
5644
+ text as text49,
5645
+ timestamp as timestamp47,
5646
+ uuid as uuid45
5570
5647
  } from "drizzle-orm/pg-core";
5571
5648
  var issueWorkProducts;
5572
5649
  var init_issue_work_products = __esm({
@@ -5578,47 +5655,47 @@ var init_issue_work_products = __esm({
5578
5655
  init_issues();
5579
5656
  init_projects();
5580
5657
  init_workspace_runtime_services();
5581
- issueWorkProducts = pgTable46(
5658
+ issueWorkProducts = pgTable47(
5582
5659
  "issue_work_products",
5583
5660
  {
5584
- id: uuid44("id").primaryKey().defaultRandom(),
5585
- orgId: uuid44("org_id").notNull().references(() => organizations.id),
5586
- projectId: uuid44("project_id").references(() => projects.id, { onDelete: "set null" }),
5587
- issueId: uuid44("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5588
- executionWorkspaceId: uuid44("execution_workspace_id").references(() => executionWorkspaces.id, { onDelete: "set null" }),
5589
- runtimeServiceId: uuid44("runtime_service_id").references(() => workspaceRuntimeServices.id, { onDelete: "set null" }),
5590
- type: text48("type").notNull(),
5591
- provider: text48("provider").notNull(),
5592
- externalId: text48("external_id"),
5593
- title: text48("title").notNull(),
5594
- url: text48("url"),
5595
- status: text48("status").notNull(),
5596
- reviewState: text48("review_state").notNull().default("none"),
5661
+ id: uuid45("id").primaryKey().defaultRandom(),
5662
+ orgId: uuid45("org_id").notNull().references(() => organizations.id),
5663
+ projectId: uuid45("project_id").references(() => projects.id, { onDelete: "set null" }),
5664
+ issueId: uuid45("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5665
+ executionWorkspaceId: uuid45("execution_workspace_id").references(() => executionWorkspaces.id, { onDelete: "set null" }),
5666
+ runtimeServiceId: uuid45("runtime_service_id").references(() => workspaceRuntimeServices.id, { onDelete: "set null" }),
5667
+ type: text49("type").notNull(),
5668
+ provider: text49("provider").notNull(),
5669
+ externalId: text49("external_id"),
5670
+ title: text49("title").notNull(),
5671
+ url: text49("url"),
5672
+ status: text49("status").notNull(),
5673
+ reviewState: text49("review_state").notNull().default("none"),
5597
5674
  isPrimary: boolean10("is_primary").notNull().default(false),
5598
- healthStatus: text48("health_status").notNull().default("unknown"),
5599
- summary: text48("summary"),
5600
- metadata: jsonb25("metadata").$type(),
5601
- createdByRunId: uuid44("created_by_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
5602
- createdAt: timestamp46("created_at", { withTimezone: true }).notNull().defaultNow(),
5603
- updatedAt: timestamp46("updated_at", { withTimezone: true }).notNull().defaultNow()
5675
+ healthStatus: text49("health_status").notNull().default("unknown"),
5676
+ summary: text49("summary"),
5677
+ metadata: jsonb26("metadata").$type(),
5678
+ createdByRunId: uuid45("created_by_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
5679
+ createdAt: timestamp47("created_at", { withTimezone: true }).notNull().defaultNow(),
5680
+ updatedAt: timestamp47("updated_at", { withTimezone: true }).notNull().defaultNow()
5604
5681
  },
5605
5682
  (table) => ({
5606
- companyIssueTypeIdx: index41("issue_work_products_company_issue_type_idx").on(
5683
+ companyIssueTypeIdx: index42("issue_work_products_company_issue_type_idx").on(
5607
5684
  table.orgId,
5608
5685
  table.issueId,
5609
5686
  table.type
5610
5687
  ),
5611
- companyExecutionWorkspaceTypeIdx: index41("issue_work_products_company_execution_workspace_type_idx").on(
5688
+ companyExecutionWorkspaceTypeIdx: index42("issue_work_products_company_execution_workspace_type_idx").on(
5612
5689
  table.orgId,
5613
5690
  table.executionWorkspaceId,
5614
5691
  table.type
5615
5692
  ),
5616
- companyProviderExternalIdIdx: index41("issue_work_products_company_provider_external_id_idx").on(
5693
+ companyProviderExternalIdIdx: index42("issue_work_products_company_provider_external_id_idx").on(
5617
5694
  table.orgId,
5618
5695
  table.provider,
5619
5696
  table.externalId
5620
5697
  ),
5621
- companyUpdatedIdx: index41("issue_work_products_company_updated_idx").on(
5698
+ companyUpdatedIdx: index42("issue_work_products_company_updated_idx").on(
5622
5699
  table.orgId,
5623
5700
  table.updatedAt
5624
5701
  )
@@ -5628,24 +5705,24 @@ var init_issue_work_products = __esm({
5628
5705
  });
5629
5706
 
5630
5707
  // ../packages/db/src/schema/labels.ts
5631
- import { pgTable as pgTable47, uuid as uuid45, text as text49, timestamp as timestamp47, index as index42, uniqueIndex as uniqueIndex26 } from "drizzle-orm/pg-core";
5708
+ import { pgTable as pgTable48, uuid as uuid46, text as text50, timestamp as timestamp48, index as index43, uniqueIndex as uniqueIndex26 } from "drizzle-orm/pg-core";
5632
5709
  var labels;
5633
5710
  var init_labels = __esm({
5634
5711
  "../packages/db/src/schema/labels.ts"() {
5635
5712
  "use strict";
5636
5713
  init_organizations();
5637
- labels = pgTable47(
5714
+ labels = pgTable48(
5638
5715
  "labels",
5639
5716
  {
5640
- id: uuid45("id").primaryKey().defaultRandom(),
5641
- orgId: uuid45("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5642
- name: text49("name").notNull(),
5643
- color: text49("color").notNull(),
5644
- createdAt: timestamp47("created_at", { withTimezone: true }).notNull().defaultNow(),
5645
- updatedAt: timestamp47("updated_at", { withTimezone: true }).notNull().defaultNow()
5717
+ id: uuid46("id").primaryKey().defaultRandom(),
5718
+ orgId: uuid46("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5719
+ name: text50("name").notNull(),
5720
+ color: text50("color").notNull(),
5721
+ createdAt: timestamp48("created_at", { withTimezone: true }).notNull().defaultNow(),
5722
+ updatedAt: timestamp48("updated_at", { withTimezone: true }).notNull().defaultNow()
5646
5723
  },
5647
5724
  (table) => ({
5648
- orgIdx: index42("labels_company_idx").on(table.orgId),
5725
+ orgIdx: index43("labels_company_idx").on(table.orgId),
5649
5726
  orgNameIdx: uniqueIndex26("labels_company_name_idx").on(table.orgId, table.name)
5650
5727
  })
5651
5728
  );
@@ -5653,7 +5730,7 @@ var init_labels = __esm({
5653
5730
  });
5654
5731
 
5655
5732
  // ../packages/db/src/schema/issue_labels.ts
5656
- import { pgTable as pgTable48, uuid as uuid46, timestamp as timestamp48, index as index43, primaryKey as primaryKey2 } from "drizzle-orm/pg-core";
5733
+ import { pgTable as pgTable49, uuid as uuid47, timestamp as timestamp49, index as index44, primaryKey as primaryKey2 } from "drizzle-orm/pg-core";
5657
5734
  var issueLabels;
5658
5735
  var init_issue_labels = __esm({
5659
5736
  "../packages/db/src/schema/issue_labels.ts"() {
@@ -5661,26 +5738,26 @@ var init_issue_labels = __esm({
5661
5738
  init_organizations();
5662
5739
  init_issues();
5663
5740
  init_labels();
5664
- issueLabels = pgTable48(
5741
+ issueLabels = pgTable49(
5665
5742
  "issue_labels",
5666
5743
  {
5667
- issueId: uuid46("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5668
- labelId: uuid46("label_id").notNull().references(() => labels.id, { onDelete: "cascade" }),
5669
- orgId: uuid46("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5670
- createdAt: timestamp48("created_at", { withTimezone: true }).notNull().defaultNow()
5744
+ issueId: uuid47("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5745
+ labelId: uuid47("label_id").notNull().references(() => labels.id, { onDelete: "cascade" }),
5746
+ orgId: uuid47("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5747
+ createdAt: timestamp49("created_at", { withTimezone: true }).notNull().defaultNow()
5671
5748
  },
5672
5749
  (table) => ({
5673
5750
  pk: primaryKey2({ columns: [table.issueId, table.labelId], name: "issue_labels_pk" }),
5674
- issueIdx: index43("issue_labels_issue_idx").on(table.issueId),
5675
- labelIdx: index43("issue_labels_label_idx").on(table.labelId),
5676
- orgIdx: index43("issue_labels_company_idx").on(table.orgId)
5751
+ issueIdx: index44("issue_labels_issue_idx").on(table.issueId),
5752
+ labelIdx: index44("issue_labels_label_idx").on(table.labelId),
5753
+ orgIdx: index44("issue_labels_company_idx").on(table.orgId)
5677
5754
  })
5678
5755
  );
5679
5756
  }
5680
5757
  });
5681
5758
 
5682
5759
  // ../packages/db/src/schema/issue_approvals.ts
5683
- import { pgTable as pgTable49, uuid as uuid47, text as text50, timestamp as timestamp49, index as index44, primaryKey as primaryKey3 } from "drizzle-orm/pg-core";
5760
+ import { pgTable as pgTable50, uuid as uuid48, text as text51, timestamp as timestamp50, index as index45, primaryKey as primaryKey3 } from "drizzle-orm/pg-core";
5684
5761
  var issueApprovals;
5685
5762
  var init_issue_approvals = __esm({
5686
5763
  "../packages/db/src/schema/issue_approvals.ts"() {
@@ -5689,28 +5766,28 @@ var init_issue_approvals = __esm({
5689
5766
  init_issues();
5690
5767
  init_approvals();
5691
5768
  init_agents();
5692
- issueApprovals = pgTable49(
5769
+ issueApprovals = pgTable50(
5693
5770
  "issue_approvals",
5694
5771
  {
5695
- orgId: uuid47("org_id").notNull().references(() => organizations.id),
5696
- issueId: uuid47("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5697
- approvalId: uuid47("approval_id").notNull().references(() => approvals.id, { onDelete: "cascade" }),
5698
- linkedByAgentId: uuid47("linked_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5699
- linkedByUserId: text50("linked_by_user_id"),
5700
- createdAt: timestamp49("created_at", { withTimezone: true }).notNull().defaultNow()
5772
+ orgId: uuid48("org_id").notNull().references(() => organizations.id),
5773
+ issueId: uuid48("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5774
+ approvalId: uuid48("approval_id").notNull().references(() => approvals.id, { onDelete: "cascade" }),
5775
+ linkedByAgentId: uuid48("linked_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5776
+ linkedByUserId: text51("linked_by_user_id"),
5777
+ createdAt: timestamp50("created_at", { withTimezone: true }).notNull().defaultNow()
5701
5778
  },
5702
5779
  (table) => ({
5703
5780
  pk: primaryKey3({ columns: [table.issueId, table.approvalId], name: "issue_approvals_pk" }),
5704
- issueIdx: index44("issue_approvals_issue_idx").on(table.issueId),
5705
- approvalIdx: index44("issue_approvals_approval_idx").on(table.approvalId),
5706
- orgIdx: index44("issue_approvals_company_idx").on(table.orgId)
5781
+ issueIdx: index45("issue_approvals_issue_idx").on(table.issueId),
5782
+ approvalIdx: index45("issue_approvals_approval_idx").on(table.approvalId),
5783
+ orgIdx: index45("issue_approvals_company_idx").on(table.orgId)
5707
5784
  })
5708
5785
  );
5709
5786
  }
5710
5787
  });
5711
5788
 
5712
5789
  // ../packages/db/src/schema/issue_comments.ts
5713
- import { pgTable as pgTable50, uuid as uuid48, text as text51, timestamp as timestamp50, index as index45 } from "drizzle-orm/pg-core";
5790
+ import { pgTable as pgTable51, uuid as uuid49, text as text52, timestamp as timestamp51, index as index46 } from "drizzle-orm/pg-core";
5714
5791
  var issueComments;
5715
5792
  var init_issue_comments = __esm({
5716
5793
  "../packages/db/src/schema/issue_comments.ts"() {
@@ -5718,27 +5795,27 @@ var init_issue_comments = __esm({
5718
5795
  init_organizations();
5719
5796
  init_issues();
5720
5797
  init_agents();
5721
- issueComments = pgTable50(
5798
+ issueComments = pgTable51(
5722
5799
  "issue_comments",
5723
5800
  {
5724
- id: uuid48("id").primaryKey().defaultRandom(),
5725
- orgId: uuid48("org_id").notNull().references(() => organizations.id),
5726
- issueId: uuid48("issue_id").notNull().references(() => issues.id),
5727
- authorAgentId: uuid48("author_agent_id").references(() => agents.id),
5728
- authorUserId: text51("author_user_id"),
5729
- body: text51("body").notNull(),
5730
- createdAt: timestamp50("created_at", { withTimezone: true }).notNull().defaultNow(),
5731
- updatedAt: timestamp50("updated_at", { withTimezone: true }).notNull().defaultNow()
5801
+ id: uuid49("id").primaryKey().defaultRandom(),
5802
+ orgId: uuid49("org_id").notNull().references(() => organizations.id),
5803
+ issueId: uuid49("issue_id").notNull().references(() => issues.id),
5804
+ authorAgentId: uuid49("author_agent_id").references(() => agents.id),
5805
+ authorUserId: text52("author_user_id"),
5806
+ body: text52("body").notNull(),
5807
+ createdAt: timestamp51("created_at", { withTimezone: true }).notNull().defaultNow(),
5808
+ updatedAt: timestamp51("updated_at", { withTimezone: true }).notNull().defaultNow()
5732
5809
  },
5733
5810
  (table) => ({
5734
- issueIdx: index45("issue_comments_issue_idx").on(table.issueId),
5735
- orgIdx: index45("issue_comments_company_idx").on(table.orgId),
5736
- orgIssueCreatedAtIdx: index45("issue_comments_company_issue_created_at_idx").on(
5811
+ issueIdx: index46("issue_comments_issue_idx").on(table.issueId),
5812
+ orgIdx: index46("issue_comments_company_idx").on(table.orgId),
5813
+ orgIssueCreatedAtIdx: index46("issue_comments_company_issue_created_at_idx").on(
5737
5814
  table.orgId,
5738
5815
  table.issueId,
5739
5816
  table.createdAt
5740
5817
  ),
5741
- orgAuthorIssueCreatedAtIdx: index45("issue_comments_company_author_issue_created_at_idx").on(
5818
+ orgAuthorIssueCreatedAtIdx: index46("issue_comments_company_author_issue_created_at_idx").on(
5742
5819
  table.orgId,
5743
5820
  table.authorUserId,
5744
5821
  table.issueId,
@@ -5750,27 +5827,27 @@ var init_issue_comments = __esm({
5750
5827
  });
5751
5828
 
5752
5829
  // ../packages/db/src/schema/issue_read_states.ts
5753
- import { pgTable as pgTable51, uuid as uuid49, text as text52, timestamp as timestamp51, index as index46, uniqueIndex as uniqueIndex27 } from "drizzle-orm/pg-core";
5830
+ import { pgTable as pgTable52, uuid as uuid50, text as text53, timestamp as timestamp52, index as index47, uniqueIndex as uniqueIndex27 } from "drizzle-orm/pg-core";
5754
5831
  var issueReadStates;
5755
5832
  var init_issue_read_states = __esm({
5756
5833
  "../packages/db/src/schema/issue_read_states.ts"() {
5757
5834
  "use strict";
5758
5835
  init_organizations();
5759
5836
  init_issues();
5760
- issueReadStates = pgTable51(
5837
+ issueReadStates = pgTable52(
5761
5838
  "issue_read_states",
5762
5839
  {
5763
- id: uuid49("id").primaryKey().defaultRandom(),
5764
- orgId: uuid49("org_id").notNull().references(() => organizations.id),
5765
- issueId: uuid49("issue_id").notNull().references(() => issues.id),
5766
- userId: text52("user_id").notNull(),
5767
- lastReadAt: timestamp51("last_read_at", { withTimezone: true }).notNull().defaultNow(),
5768
- createdAt: timestamp51("created_at", { withTimezone: true }).notNull().defaultNow(),
5769
- updatedAt: timestamp51("updated_at", { withTimezone: true }).notNull().defaultNow()
5840
+ id: uuid50("id").primaryKey().defaultRandom(),
5841
+ orgId: uuid50("org_id").notNull().references(() => organizations.id),
5842
+ issueId: uuid50("issue_id").notNull().references(() => issues.id),
5843
+ userId: text53("user_id").notNull(),
5844
+ lastReadAt: timestamp52("last_read_at", { withTimezone: true }).notNull().defaultNow(),
5845
+ createdAt: timestamp52("created_at", { withTimezone: true }).notNull().defaultNow(),
5846
+ updatedAt: timestamp52("updated_at", { withTimezone: true }).notNull().defaultNow()
5770
5847
  },
5771
5848
  (table) => ({
5772
- companyIssueIdx: index46("issue_read_states_company_issue_idx").on(table.orgId, table.issueId),
5773
- companyUserIdx: index46("issue_read_states_company_user_idx").on(table.orgId, table.userId),
5849
+ companyIssueIdx: index47("issue_read_states_company_issue_idx").on(table.orgId, table.issueId),
5850
+ companyUserIdx: index47("issue_read_states_company_user_idx").on(table.orgId, table.userId),
5774
5851
  companyIssueUserUnique: uniqueIndex27("issue_read_states_company_issue_user_idx").on(
5775
5852
  table.orgId,
5776
5853
  table.issueId,
@@ -5782,26 +5859,26 @@ var init_issue_read_states = __esm({
5782
5859
  });
5783
5860
 
5784
5861
  // ../packages/db/src/schema/messenger_thread_user_states.ts
5785
- import { index as index47, pgTable as pgTable52, text as text53, timestamp as timestamp52, uniqueIndex as uniqueIndex28, uuid as uuid50 } from "drizzle-orm/pg-core";
5862
+ import { index as index48, pgTable as pgTable53, text as text54, timestamp as timestamp53, uniqueIndex as uniqueIndex28, uuid as uuid51 } from "drizzle-orm/pg-core";
5786
5863
  var messengerThreadUserStates;
5787
5864
  var init_messenger_thread_user_states = __esm({
5788
5865
  "../packages/db/src/schema/messenger_thread_user_states.ts"() {
5789
5866
  "use strict";
5790
5867
  init_organizations();
5791
- messengerThreadUserStates = pgTable52(
5868
+ messengerThreadUserStates = pgTable53(
5792
5869
  "messenger_thread_user_states",
5793
5870
  {
5794
- id: uuid50("id").primaryKey().defaultRandom(),
5795
- orgId: uuid50("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5796
- userId: text53("user_id").notNull(),
5797
- threadKey: text53("thread_key").notNull(),
5798
- lastReadAt: timestamp52("last_read_at", { withTimezone: true }).notNull().defaultNow(),
5799
- createdAt: timestamp52("created_at", { withTimezone: true }).notNull().defaultNow(),
5800
- updatedAt: timestamp52("updated_at", { withTimezone: true }).notNull().defaultNow()
5871
+ id: uuid51("id").primaryKey().defaultRandom(),
5872
+ orgId: uuid51("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
5873
+ userId: text54("user_id").notNull(),
5874
+ threadKey: text54("thread_key").notNull(),
5875
+ lastReadAt: timestamp53("last_read_at", { withTimezone: true }).notNull().defaultNow(),
5876
+ createdAt: timestamp53("created_at", { withTimezone: true }).notNull().defaultNow(),
5877
+ updatedAt: timestamp53("updated_at", { withTimezone: true }).notNull().defaultNow()
5801
5878
  },
5802
5879
  (table) => ({
5803
- orgUserIdx: index47("messenger_thread_user_states_org_user_idx").on(table.orgId, table.userId),
5804
- orgThreadIdx: index47("messenger_thread_user_states_org_thread_idx").on(table.orgId, table.threadKey),
5880
+ orgUserIdx: index48("messenger_thread_user_states_org_user_idx").on(table.orgId, table.userId),
5881
+ orgThreadIdx: index48("messenger_thread_user_states_org_thread_idx").on(table.orgId, table.threadKey),
5805
5882
  orgThreadUserUnique: uniqueIndex28("messenger_thread_user_states_org_thread_user_idx").on(
5806
5883
  table.orgId,
5807
5884
  table.threadKey,
@@ -5813,7 +5890,7 @@ var init_messenger_thread_user_states = __esm({
5813
5890
  });
5814
5891
 
5815
5892
  // ../packages/db/src/schema/issue_attachments.ts
5816
- import { pgTable as pgTable53, uuid as uuid51, timestamp as timestamp53, index as index48, uniqueIndex as uniqueIndex29, text as text54 } from "drizzle-orm/pg-core";
5893
+ import { pgTable as pgTable54, uuid as uuid52, timestamp as timestamp54, index as index49, uniqueIndex as uniqueIndex29, text as text55 } from "drizzle-orm/pg-core";
5817
5894
  var issueAttachments;
5818
5895
  var init_issue_attachments = __esm({
5819
5896
  "../packages/db/src/schema/issue_attachments.ts"() {
@@ -5822,22 +5899,22 @@ var init_issue_attachments = __esm({
5822
5899
  init_issues();
5823
5900
  init_assets();
5824
5901
  init_issue_comments();
5825
- issueAttachments = pgTable53(
5902
+ issueAttachments = pgTable54(
5826
5903
  "issue_attachments",
5827
5904
  {
5828
- id: uuid51("id").primaryKey().defaultRandom(),
5829
- orgId: uuid51("org_id").notNull().references(() => organizations.id),
5830
- issueId: uuid51("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5831
- assetId: uuid51("asset_id").notNull().references(() => assets.id, { onDelete: "cascade" }),
5832
- issueCommentId: uuid51("issue_comment_id").references(() => issueComments.id, { onDelete: "set null" }),
5833
- usage: text54("usage").notNull().default("issue"),
5834
- createdAt: timestamp53("created_at", { withTimezone: true }).notNull().defaultNow(),
5835
- updatedAt: timestamp53("updated_at", { withTimezone: true }).notNull().defaultNow()
5905
+ id: uuid52("id").primaryKey().defaultRandom(),
5906
+ orgId: uuid52("org_id").notNull().references(() => organizations.id),
5907
+ issueId: uuid52("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5908
+ assetId: uuid52("asset_id").notNull().references(() => assets.id, { onDelete: "cascade" }),
5909
+ issueCommentId: uuid52("issue_comment_id").references(() => issueComments.id, { onDelete: "set null" }),
5910
+ usage: text55("usage").notNull().default("issue"),
5911
+ createdAt: timestamp54("created_at", { withTimezone: true }).notNull().defaultNow(),
5912
+ updatedAt: timestamp54("updated_at", { withTimezone: true }).notNull().defaultNow()
5836
5913
  },
5837
5914
  (table) => ({
5838
- companyIssueIdx: index48("issue_attachments_company_issue_idx").on(table.orgId, table.issueId),
5839
- issueCommentIdx: index48("issue_attachments_issue_comment_idx").on(table.issueCommentId),
5840
- usageIdx: index48("issue_attachments_usage_idx").on(table.usage),
5915
+ companyIssueIdx: index49("issue_attachments_company_issue_idx").on(table.orgId, table.issueId),
5916
+ issueCommentIdx: index49("issue_attachments_issue_comment_idx").on(table.issueCommentId),
5917
+ usageIdx: index49("issue_attachments_usage_idx").on(table.usage),
5841
5918
  assetUq: uniqueIndex29("issue_attachments_asset_uq").on(table.assetId)
5842
5919
  })
5843
5920
  );
@@ -5845,40 +5922,40 @@ var init_issue_attachments = __esm({
5845
5922
  });
5846
5923
 
5847
5924
  // ../packages/db/src/schema/documents.ts
5848
- import { pgTable as pgTable54, uuid as uuid52, text as text55, integer as integer15, timestamp as timestamp54, index as index49 } from "drizzle-orm/pg-core";
5925
+ import { pgTable as pgTable55, uuid as uuid53, text as text56, integer as integer16, timestamp as timestamp55, index as index50 } from "drizzle-orm/pg-core";
5849
5926
  var documents;
5850
5927
  var init_documents = __esm({
5851
5928
  "../packages/db/src/schema/documents.ts"() {
5852
5929
  "use strict";
5853
5930
  init_organizations();
5854
5931
  init_agents();
5855
- documents = pgTable54(
5932
+ documents = pgTable55(
5856
5933
  "documents",
5857
5934
  {
5858
- id: uuid52("id").primaryKey().defaultRandom(),
5859
- orgId: uuid52("org_id").notNull().references(() => organizations.id),
5860
- title: text55("title"),
5861
- format: text55("format").notNull().default("markdown"),
5862
- latestBody: text55("latest_body").notNull(),
5863
- latestRevisionId: uuid52("latest_revision_id"),
5864
- latestRevisionNumber: integer15("latest_revision_number").notNull().default(1),
5865
- createdByAgentId: uuid52("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5866
- createdByUserId: text55("created_by_user_id"),
5867
- updatedByAgentId: uuid52("updated_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5868
- updatedByUserId: text55("updated_by_user_id"),
5869
- createdAt: timestamp54("created_at", { withTimezone: true }).notNull().defaultNow(),
5870
- updatedAt: timestamp54("updated_at", { withTimezone: true }).notNull().defaultNow()
5935
+ id: uuid53("id").primaryKey().defaultRandom(),
5936
+ orgId: uuid53("org_id").notNull().references(() => organizations.id),
5937
+ title: text56("title"),
5938
+ format: text56("format").notNull().default("markdown"),
5939
+ latestBody: text56("latest_body").notNull(),
5940
+ latestRevisionId: uuid53("latest_revision_id"),
5941
+ latestRevisionNumber: integer16("latest_revision_number").notNull().default(1),
5942
+ createdByAgentId: uuid53("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5943
+ createdByUserId: text56("created_by_user_id"),
5944
+ updatedByAgentId: uuid53("updated_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5945
+ updatedByUserId: text56("updated_by_user_id"),
5946
+ createdAt: timestamp55("created_at", { withTimezone: true }).notNull().defaultNow(),
5947
+ updatedAt: timestamp55("updated_at", { withTimezone: true }).notNull().defaultNow()
5871
5948
  },
5872
5949
  (table) => ({
5873
- companyUpdatedIdx: index49("documents_company_updated_idx").on(table.orgId, table.updatedAt),
5874
- companyCreatedIdx: index49("documents_company_created_idx").on(table.orgId, table.createdAt)
5950
+ companyUpdatedIdx: index50("documents_company_updated_idx").on(table.orgId, table.updatedAt),
5951
+ companyCreatedIdx: index50("documents_company_created_idx").on(table.orgId, table.createdAt)
5875
5952
  })
5876
5953
  );
5877
5954
  }
5878
5955
  });
5879
5956
 
5880
5957
  // ../packages/db/src/schema/document_revisions.ts
5881
- import { pgTable as pgTable55, uuid as uuid53, text as text56, integer as integer16, timestamp as timestamp55, index as index50, uniqueIndex as uniqueIndex30 } from "drizzle-orm/pg-core";
5958
+ import { pgTable as pgTable56, uuid as uuid54, text as text57, integer as integer17, timestamp as timestamp56, index as index51, uniqueIndex as uniqueIndex30 } from "drizzle-orm/pg-core";
5882
5959
  var documentRevisions;
5883
5960
  var init_document_revisions = __esm({
5884
5961
  "../packages/db/src/schema/document_revisions.ts"() {
@@ -5886,25 +5963,25 @@ var init_document_revisions = __esm({
5886
5963
  init_organizations();
5887
5964
  init_agents();
5888
5965
  init_documents();
5889
- documentRevisions = pgTable55(
5966
+ documentRevisions = pgTable56(
5890
5967
  "document_revisions",
5891
5968
  {
5892
- id: uuid53("id").primaryKey().defaultRandom(),
5893
- orgId: uuid53("org_id").notNull().references(() => organizations.id),
5894
- documentId: uuid53("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
5895
- revisionNumber: integer16("revision_number").notNull(),
5896
- body: text56("body").notNull(),
5897
- changeSummary: text56("change_summary"),
5898
- createdByAgentId: uuid53("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5899
- createdByUserId: text56("created_by_user_id"),
5900
- createdAt: timestamp55("created_at", { withTimezone: true }).notNull().defaultNow()
5969
+ id: uuid54("id").primaryKey().defaultRandom(),
5970
+ orgId: uuid54("org_id").notNull().references(() => organizations.id),
5971
+ documentId: uuid54("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
5972
+ revisionNumber: integer17("revision_number").notNull(),
5973
+ body: text57("body").notNull(),
5974
+ changeSummary: text57("change_summary"),
5975
+ createdByAgentId: uuid54("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
5976
+ createdByUserId: text57("created_by_user_id"),
5977
+ createdAt: timestamp56("created_at", { withTimezone: true }).notNull().defaultNow()
5901
5978
  },
5902
5979
  (table) => ({
5903
5980
  documentRevisionUq: uniqueIndex30("document_revisions_document_revision_uq").on(
5904
5981
  table.documentId,
5905
5982
  table.revisionNumber
5906
5983
  ),
5907
- companyDocumentCreatedIdx: index50("document_revisions_company_document_created_idx").on(
5984
+ companyDocumentCreatedIdx: index51("document_revisions_company_document_created_idx").on(
5908
5985
  table.orgId,
5909
5986
  table.documentId,
5910
5987
  table.createdAt
@@ -5915,7 +5992,7 @@ var init_document_revisions = __esm({
5915
5992
  });
5916
5993
 
5917
5994
  // ../packages/db/src/schema/issue_documents.ts
5918
- import { pgTable as pgTable56, uuid as uuid54, text as text57, timestamp as timestamp56, index as index51, uniqueIndex as uniqueIndex31 } from "drizzle-orm/pg-core";
5995
+ import { pgTable as pgTable57, uuid as uuid55, text as text58, timestamp as timestamp57, index as index52, uniqueIndex as uniqueIndex31 } from "drizzle-orm/pg-core";
5919
5996
  var issueDocuments;
5920
5997
  var init_issue_documents = __esm({
5921
5998
  "../packages/db/src/schema/issue_documents.ts"() {
@@ -5923,16 +6000,16 @@ var init_issue_documents = __esm({
5923
6000
  init_organizations();
5924
6001
  init_issues();
5925
6002
  init_documents();
5926
- issueDocuments = pgTable56(
6003
+ issueDocuments = pgTable57(
5927
6004
  "issue_documents",
5928
6005
  {
5929
- id: uuid54("id").primaryKey().defaultRandom(),
5930
- orgId: uuid54("org_id").notNull().references(() => organizations.id),
5931
- issueId: uuid54("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
5932
- documentId: uuid54("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
5933
- key: text57("key").notNull(),
5934
- createdAt: timestamp56("created_at", { withTimezone: true }).notNull().defaultNow(),
5935
- updatedAt: timestamp56("updated_at", { withTimezone: true }).notNull().defaultNow()
6006
+ id: uuid55("id").primaryKey().defaultRandom(),
6007
+ orgId: uuid55("org_id").notNull().references(() => organizations.id),
6008
+ issueId: uuid55("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
6009
+ documentId: uuid55("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
6010
+ key: text58("key").notNull(),
6011
+ createdAt: timestamp57("created_at", { withTimezone: true }).notNull().defaultNow(),
6012
+ updatedAt: timestamp57("updated_at", { withTimezone: true }).notNull().defaultNow()
5936
6013
  },
5937
6014
  (table) => ({
5938
6015
  companyIssueKeyUq: uniqueIndex31("issue_documents_company_issue_key_uq").on(
@@ -5941,7 +6018,7 @@ var init_issue_documents = __esm({
5941
6018
  table.key
5942
6019
  ),
5943
6020
  documentUq: uniqueIndex31("issue_documents_document_uq").on(table.documentId),
5944
- companyIssueUpdatedIdx: index51("issue_documents_company_issue_updated_idx").on(
6021
+ companyIssueUpdatedIdx: index52("issue_documents_company_issue_updated_idx").on(
5945
6022
  table.orgId,
5946
6023
  table.issueId,
5947
6024
  table.updatedAt
@@ -5952,7 +6029,7 @@ var init_issue_documents = __esm({
5952
6029
  });
5953
6030
 
5954
6031
  // ../packages/db/src/schema/heartbeat_run_events.ts
5955
- import { pgTable as pgTable57, uuid as uuid55, text as text58, timestamp as timestamp57, integer as integer17, jsonb as jsonb26, index as index52, bigserial } from "drizzle-orm/pg-core";
6032
+ import { pgTable as pgTable58, uuid as uuid56, text as text59, timestamp as timestamp58, integer as integer18, jsonb as jsonb27, index as index53, bigserial } from "drizzle-orm/pg-core";
5956
6033
  var heartbeatRunEvents;
5957
6034
  var init_heartbeat_run_events = __esm({
5958
6035
  "../packages/db/src/schema/heartbeat_run_events.ts"() {
@@ -5960,33 +6037,33 @@ var init_heartbeat_run_events = __esm({
5960
6037
  init_organizations();
5961
6038
  init_agents();
5962
6039
  init_heartbeat_runs();
5963
- heartbeatRunEvents = pgTable57(
6040
+ heartbeatRunEvents = pgTable58(
5964
6041
  "heartbeat_run_events",
5965
6042
  {
5966
6043
  id: bigserial("id", { mode: "number" }).primaryKey(),
5967
- orgId: uuid55("org_id").notNull().references(() => organizations.id),
5968
- runId: uuid55("run_id").notNull().references(() => heartbeatRuns.id),
5969
- agentId: uuid55("agent_id").notNull().references(() => agents.id),
5970
- seq: integer17("seq").notNull(),
5971
- eventType: text58("event_type").notNull(),
5972
- stream: text58("stream"),
5973
- level: text58("level"),
5974
- color: text58("color"),
5975
- message: text58("message"),
5976
- payload: jsonb26("payload").$type(),
5977
- createdAt: timestamp57("created_at", { withTimezone: true }).notNull().defaultNow()
6044
+ orgId: uuid56("org_id").notNull().references(() => organizations.id),
6045
+ runId: uuid56("run_id").notNull().references(() => heartbeatRuns.id),
6046
+ agentId: uuid56("agent_id").notNull().references(() => agents.id),
6047
+ seq: integer18("seq").notNull(),
6048
+ eventType: text59("event_type").notNull(),
6049
+ stream: text59("stream"),
6050
+ level: text59("level"),
6051
+ color: text59("color"),
6052
+ message: text59("message"),
6053
+ payload: jsonb27("payload").$type(),
6054
+ createdAt: timestamp58("created_at", { withTimezone: true }).notNull().defaultNow()
5978
6055
  },
5979
6056
  (table) => ({
5980
- runSeqIdx: index52("heartbeat_run_events_run_seq_idx").on(table.runId, table.seq),
5981
- companyRunIdx: index52("heartbeat_run_events_company_run_idx").on(table.orgId, table.runId),
5982
- companyCreatedIdx: index52("heartbeat_run_events_company_created_idx").on(table.orgId, table.createdAt)
6057
+ runSeqIdx: index53("heartbeat_run_events_run_seq_idx").on(table.runId, table.seq),
6058
+ companyRunIdx: index53("heartbeat_run_events_company_run_idx").on(table.orgId, table.runId),
6059
+ companyCreatedIdx: index53("heartbeat_run_events_company_created_idx").on(table.orgId, table.createdAt)
5983
6060
  })
5984
6061
  );
5985
6062
  }
5986
6063
  });
5987
6064
 
5988
6065
  // ../packages/db/src/schema/cost_events.ts
5989
- import { pgTable as pgTable58, uuid as uuid56, text as text59, timestamp as timestamp58, integer as integer18, index as index53 } from "drizzle-orm/pg-core";
6066
+ import { pgTable as pgTable59, uuid as uuid57, text as text60, timestamp as timestamp59, integer as integer19, index as index54 } from "drizzle-orm/pg-core";
5990
6067
  var costEvents;
5991
6068
  var init_cost_events = __esm({
5992
6069
  "../packages/db/src/schema/cost_events.ts"() {
@@ -5997,46 +6074,46 @@ var init_cost_events = __esm({
5997
6074
  init_projects();
5998
6075
  init_goals();
5999
6076
  init_heartbeat_runs();
6000
- costEvents = pgTable58(
6077
+ costEvents = pgTable59(
6001
6078
  "cost_events",
6002
6079
  {
6003
- id: uuid56("id").primaryKey().defaultRandom(),
6004
- orgId: uuid56("org_id").notNull().references(() => organizations.id),
6005
- agentId: uuid56("agent_id").notNull().references(() => agents.id),
6006
- issueId: uuid56("issue_id").references(() => issues.id),
6007
- projectId: uuid56("project_id").references(() => projects.id),
6008
- goalId: uuid56("goal_id").references(() => goals.id),
6009
- heartbeatRunId: uuid56("heartbeat_run_id").references(() => heartbeatRuns.id),
6010
- billingCode: text59("billing_code"),
6011
- provider: text59("provider").notNull(),
6012
- biller: text59("biller").notNull().default("unknown"),
6013
- billingType: text59("billing_type").notNull().default("unknown"),
6014
- model: text59("model").notNull(),
6015
- inputTokens: integer18("input_tokens").notNull().default(0),
6016
- cachedInputTokens: integer18("cached_input_tokens").notNull().default(0),
6017
- outputTokens: integer18("output_tokens").notNull().default(0),
6018
- costCents: integer18("cost_cents").notNull(),
6019
- occurredAt: timestamp58("occurred_at", { withTimezone: true }).notNull(),
6020
- createdAt: timestamp58("created_at", { withTimezone: true }).notNull().defaultNow()
6080
+ id: uuid57("id").primaryKey().defaultRandom(),
6081
+ orgId: uuid57("org_id").notNull().references(() => organizations.id),
6082
+ agentId: uuid57("agent_id").notNull().references(() => agents.id),
6083
+ issueId: uuid57("issue_id").references(() => issues.id),
6084
+ projectId: uuid57("project_id").references(() => projects.id),
6085
+ goalId: uuid57("goal_id").references(() => goals.id),
6086
+ heartbeatRunId: uuid57("heartbeat_run_id").references(() => heartbeatRuns.id),
6087
+ billingCode: text60("billing_code"),
6088
+ provider: text60("provider").notNull(),
6089
+ biller: text60("biller").notNull().default("unknown"),
6090
+ billingType: text60("billing_type").notNull().default("unknown"),
6091
+ model: text60("model").notNull(),
6092
+ inputTokens: integer19("input_tokens").notNull().default(0),
6093
+ cachedInputTokens: integer19("cached_input_tokens").notNull().default(0),
6094
+ outputTokens: integer19("output_tokens").notNull().default(0),
6095
+ costCents: integer19("cost_cents").notNull(),
6096
+ occurredAt: timestamp59("occurred_at", { withTimezone: true }).notNull(),
6097
+ createdAt: timestamp59("created_at", { withTimezone: true }).notNull().defaultNow()
6021
6098
  },
6022
6099
  (table) => ({
6023
- companyOccurredIdx: index53("cost_events_company_occurred_idx").on(table.orgId, table.occurredAt),
6024
- companyAgentOccurredIdx: index53("cost_events_company_agent_occurred_idx").on(
6100
+ companyOccurredIdx: index54("cost_events_company_occurred_idx").on(table.orgId, table.occurredAt),
6101
+ companyAgentOccurredIdx: index54("cost_events_company_agent_occurred_idx").on(
6025
6102
  table.orgId,
6026
6103
  table.agentId,
6027
6104
  table.occurredAt
6028
6105
  ),
6029
- companyProviderOccurredIdx: index53("cost_events_company_provider_occurred_idx").on(
6106
+ companyProviderOccurredIdx: index54("cost_events_company_provider_occurred_idx").on(
6030
6107
  table.orgId,
6031
6108
  table.provider,
6032
6109
  table.occurredAt
6033
6110
  ),
6034
- companyBillerOccurredIdx: index53("cost_events_company_biller_occurred_idx").on(
6111
+ companyBillerOccurredIdx: index54("cost_events_company_biller_occurred_idx").on(
6035
6112
  table.orgId,
6036
6113
  table.biller,
6037
6114
  table.occurredAt
6038
6115
  ),
6039
- companyHeartbeatRunIdx: index53("cost_events_company_heartbeat_run_idx").on(
6116
+ companyHeartbeatRunIdx: index54("cost_events_company_heartbeat_run_idx").on(
6040
6117
  table.orgId,
6041
6118
  table.heartbeatRunId
6042
6119
  )
@@ -6046,7 +6123,7 @@ var init_cost_events = __esm({
6046
6123
  });
6047
6124
 
6048
6125
  // ../packages/db/src/schema/finance_events.ts
6049
- import { pgTable as pgTable59, uuid as uuid57, text as text60, timestamp as timestamp59, integer as integer19, index as index54, boolean as boolean11, jsonb as jsonb27 } from "drizzle-orm/pg-core";
6126
+ import { pgTable as pgTable60, uuid as uuid58, text as text61, timestamp as timestamp60, integer as integer20, index as index55, boolean as boolean11, jsonb as jsonb28 } from "drizzle-orm/pg-core";
6050
6127
  var financeEvents;
6051
6128
  var init_finance_events = __esm({
6052
6129
  "../packages/db/src/schema/finance_events.ts"() {
@@ -6058,59 +6135,59 @@ var init_finance_events = __esm({
6058
6135
  init_goals();
6059
6136
  init_heartbeat_runs();
6060
6137
  init_cost_events();
6061
- financeEvents = pgTable59(
6138
+ financeEvents = pgTable60(
6062
6139
  "finance_events",
6063
6140
  {
6064
- id: uuid57("id").primaryKey().defaultRandom(),
6065
- orgId: uuid57("org_id").notNull().references(() => organizations.id),
6066
- agentId: uuid57("agent_id").references(() => agents.id),
6067
- issueId: uuid57("issue_id").references(() => issues.id),
6068
- projectId: uuid57("project_id").references(() => projects.id),
6069
- goalId: uuid57("goal_id").references(() => goals.id),
6070
- heartbeatRunId: uuid57("heartbeat_run_id").references(() => heartbeatRuns.id),
6071
- costEventId: uuid57("cost_event_id").references(() => costEvents.id),
6072
- billingCode: text60("billing_code"),
6073
- description: text60("description"),
6074
- eventKind: text60("event_kind").notNull(),
6075
- direction: text60("direction").notNull().default("debit"),
6076
- biller: text60("biller").notNull(),
6077
- provider: text60("provider"),
6078
- executionAgentRuntimeType: text60("execution_agent_runtime_type"),
6079
- pricingTier: text60("pricing_tier"),
6080
- region: text60("region"),
6081
- model: text60("model"),
6082
- quantity: integer19("quantity"),
6083
- unit: text60("unit"),
6084
- amountCents: integer19("amount_cents").notNull(),
6085
- currency: text60("currency").notNull().default("USD"),
6141
+ id: uuid58("id").primaryKey().defaultRandom(),
6142
+ orgId: uuid58("org_id").notNull().references(() => organizations.id),
6143
+ agentId: uuid58("agent_id").references(() => agents.id),
6144
+ issueId: uuid58("issue_id").references(() => issues.id),
6145
+ projectId: uuid58("project_id").references(() => projects.id),
6146
+ goalId: uuid58("goal_id").references(() => goals.id),
6147
+ heartbeatRunId: uuid58("heartbeat_run_id").references(() => heartbeatRuns.id),
6148
+ costEventId: uuid58("cost_event_id").references(() => costEvents.id),
6149
+ billingCode: text61("billing_code"),
6150
+ description: text61("description"),
6151
+ eventKind: text61("event_kind").notNull(),
6152
+ direction: text61("direction").notNull().default("debit"),
6153
+ biller: text61("biller").notNull(),
6154
+ provider: text61("provider"),
6155
+ executionAgentRuntimeType: text61("execution_agent_runtime_type"),
6156
+ pricingTier: text61("pricing_tier"),
6157
+ region: text61("region"),
6158
+ model: text61("model"),
6159
+ quantity: integer20("quantity"),
6160
+ unit: text61("unit"),
6161
+ amountCents: integer20("amount_cents").notNull(),
6162
+ currency: text61("currency").notNull().default("USD"),
6086
6163
  estimated: boolean11("estimated").notNull().default(false),
6087
- externalInvoiceId: text60("external_invoice_id"),
6088
- metadataJson: jsonb27("metadata_json").$type(),
6089
- occurredAt: timestamp59("occurred_at", { withTimezone: true }).notNull(),
6090
- createdAt: timestamp59("created_at", { withTimezone: true }).notNull().defaultNow()
6164
+ externalInvoiceId: text61("external_invoice_id"),
6165
+ metadataJson: jsonb28("metadata_json").$type(),
6166
+ occurredAt: timestamp60("occurred_at", { withTimezone: true }).notNull(),
6167
+ createdAt: timestamp60("created_at", { withTimezone: true }).notNull().defaultNow()
6091
6168
  },
6092
6169
  (table) => ({
6093
- companyOccurredIdx: index54("finance_events_company_occurred_idx").on(table.orgId, table.occurredAt),
6094
- companyBillerOccurredIdx: index54("finance_events_company_biller_occurred_idx").on(
6170
+ companyOccurredIdx: index55("finance_events_company_occurred_idx").on(table.orgId, table.occurredAt),
6171
+ companyBillerOccurredIdx: index55("finance_events_company_biller_occurred_idx").on(
6095
6172
  table.orgId,
6096
6173
  table.biller,
6097
6174
  table.occurredAt
6098
6175
  ),
6099
- companyKindOccurredIdx: index54("finance_events_company_kind_occurred_idx").on(
6176
+ companyKindOccurredIdx: index55("finance_events_company_kind_occurred_idx").on(
6100
6177
  table.orgId,
6101
6178
  table.eventKind,
6102
6179
  table.occurredAt
6103
6180
  ),
6104
- companyDirectionOccurredIdx: index54("finance_events_company_direction_occurred_idx").on(
6181
+ companyDirectionOccurredIdx: index55("finance_events_company_direction_occurred_idx").on(
6105
6182
  table.orgId,
6106
6183
  table.direction,
6107
6184
  table.occurredAt
6108
6185
  ),
6109
- companyHeartbeatRunIdx: index54("finance_events_company_heartbeat_run_idx").on(
6186
+ companyHeartbeatRunIdx: index55("finance_events_company_heartbeat_run_idx").on(
6110
6187
  table.orgId,
6111
6188
  table.heartbeatRunId
6112
6189
  ),
6113
- companyCostEventIdx: index54("finance_events_company_cost_event_idx").on(
6190
+ companyCostEventIdx: index55("finance_events_company_cost_event_idx").on(
6114
6191
  table.orgId,
6115
6192
  table.costEventId
6116
6193
  )
@@ -6120,7 +6197,7 @@ var init_finance_events = __esm({
6120
6197
  });
6121
6198
 
6122
6199
  // ../packages/db/src/schema/approval_comments.ts
6123
- import { pgTable as pgTable60, uuid as uuid58, text as text61, timestamp as timestamp60, index as index55 } from "drizzle-orm/pg-core";
6200
+ import { pgTable as pgTable61, uuid as uuid59, text as text62, timestamp as timestamp61, index as index56 } from "drizzle-orm/pg-core";
6124
6201
  var approvalComments;
6125
6202
  var init_approval_comments = __esm({
6126
6203
  "../packages/db/src/schema/approval_comments.ts"() {
@@ -6128,22 +6205,22 @@ var init_approval_comments = __esm({
6128
6205
  init_organizations();
6129
6206
  init_approvals();
6130
6207
  init_agents();
6131
- approvalComments = pgTable60(
6208
+ approvalComments = pgTable61(
6132
6209
  "approval_comments",
6133
6210
  {
6134
- id: uuid58("id").primaryKey().defaultRandom(),
6135
- orgId: uuid58("org_id").notNull().references(() => organizations.id),
6136
- approvalId: uuid58("approval_id").notNull().references(() => approvals.id),
6137
- authorAgentId: uuid58("author_agent_id").references(() => agents.id),
6138
- authorUserId: text61("author_user_id"),
6139
- body: text61("body").notNull(),
6140
- createdAt: timestamp60("created_at", { withTimezone: true }).notNull().defaultNow(),
6141
- updatedAt: timestamp60("updated_at", { withTimezone: true }).notNull().defaultNow()
6211
+ id: uuid59("id").primaryKey().defaultRandom(),
6212
+ orgId: uuid59("org_id").notNull().references(() => organizations.id),
6213
+ approvalId: uuid59("approval_id").notNull().references(() => approvals.id),
6214
+ authorAgentId: uuid59("author_agent_id").references(() => agents.id),
6215
+ authorUserId: text62("author_user_id"),
6216
+ body: text62("body").notNull(),
6217
+ createdAt: timestamp61("created_at", { withTimezone: true }).notNull().defaultNow(),
6218
+ updatedAt: timestamp61("updated_at", { withTimezone: true }).notNull().defaultNow()
6142
6219
  },
6143
6220
  (table) => ({
6144
- orgIdx: index55("approval_comments_company_idx").on(table.orgId),
6145
- approvalIdx: index55("approval_comments_approval_idx").on(table.approvalId),
6146
- approvalCreatedIdx: index55("approval_comments_approval_created_idx").on(
6221
+ orgIdx: index56("approval_comments_company_idx").on(table.orgId),
6222
+ approvalIdx: index56("approval_comments_approval_idx").on(table.approvalId),
6223
+ approvalCreatedIdx: index56("approval_comments_approval_created_idx").on(
6147
6224
  table.approvalId,
6148
6225
  table.createdAt
6149
6226
  )
@@ -6153,29 +6230,29 @@ var init_approval_comments = __esm({
6153
6230
  });
6154
6231
 
6155
6232
  // ../packages/db/src/schema/organization_secret_versions.ts
6156
- import { pgTable as pgTable61, uuid as uuid59, text as text62, timestamp as timestamp61, integer as integer20, jsonb as jsonb28, index as index56, uniqueIndex as uniqueIndex32 } from "drizzle-orm/pg-core";
6233
+ import { pgTable as pgTable62, uuid as uuid60, text as text63, timestamp as timestamp62, integer as integer21, jsonb as jsonb29, index as index57, uniqueIndex as uniqueIndex32 } from "drizzle-orm/pg-core";
6157
6234
  var organizationSecretVersions;
6158
6235
  var init_organization_secret_versions = __esm({
6159
6236
  "../packages/db/src/schema/organization_secret_versions.ts"() {
6160
6237
  "use strict";
6161
6238
  init_agents();
6162
6239
  init_organization_secrets();
6163
- organizationSecretVersions = pgTable61(
6240
+ organizationSecretVersions = pgTable62(
6164
6241
  "organization_secret_versions",
6165
6242
  {
6166
- id: uuid59("id").primaryKey().defaultRandom(),
6167
- secretId: uuid59("secret_id").notNull().references(() => organizationSecrets.id, { onDelete: "cascade" }),
6168
- version: integer20("version").notNull(),
6169
- material: jsonb28("material").$type().notNull(),
6170
- valueSha256: text62("value_sha256").notNull(),
6171
- createdByAgentId: uuid59("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
6172
- createdByUserId: text62("created_by_user_id"),
6173
- createdAt: timestamp61("created_at", { withTimezone: true }).notNull().defaultNow(),
6174
- revokedAt: timestamp61("revoked_at", { withTimezone: true })
6243
+ id: uuid60("id").primaryKey().defaultRandom(),
6244
+ secretId: uuid60("secret_id").notNull().references(() => organizationSecrets.id, { onDelete: "cascade" }),
6245
+ version: integer21("version").notNull(),
6246
+ material: jsonb29("material").$type().notNull(),
6247
+ valueSha256: text63("value_sha256").notNull(),
6248
+ createdByAgentId: uuid60("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
6249
+ createdByUserId: text63("created_by_user_id"),
6250
+ createdAt: timestamp62("created_at", { withTimezone: true }).notNull().defaultNow(),
6251
+ revokedAt: timestamp62("revoked_at", { withTimezone: true })
6175
6252
  },
6176
6253
  (table) => ({
6177
- secretIdx: index56("organization_secret_versions_secret_idx").on(table.secretId, table.createdAt),
6178
- valueHashIdx: index56("organization_secret_versions_value_sha256_idx").on(table.valueSha256),
6254
+ secretIdx: index57("organization_secret_versions_secret_idx").on(table.secretId, table.createdAt),
6255
+ valueHashIdx: index57("organization_secret_versions_value_sha256_idx").on(table.valueSha256),
6179
6256
  secretVersionUq: uniqueIndex32("organization_secret_versions_secret_version_uq").on(table.secretId, table.version)
6180
6257
  })
6181
6258
  );
@@ -6184,12 +6261,12 @@ var init_organization_secret_versions = __esm({
6184
6261
 
6185
6262
  // ../packages/db/src/schema/organization_skills.ts
6186
6263
  import {
6187
- pgTable as pgTable62,
6188
- uuid as uuid60,
6189
- text as text63,
6190
- timestamp as timestamp62,
6191
- jsonb as jsonb29,
6192
- index as index57,
6264
+ pgTable as pgTable63,
6265
+ uuid as uuid61,
6266
+ text as text64,
6267
+ timestamp as timestamp63,
6268
+ jsonb as jsonb30,
6269
+ index as index58,
6193
6270
  uniqueIndex as uniqueIndex33
6194
6271
  } from "drizzle-orm/pg-core";
6195
6272
  var organizationSkills;
@@ -6197,29 +6274,29 @@ var init_organization_skills = __esm({
6197
6274
  "../packages/db/src/schema/organization_skills.ts"() {
6198
6275
  "use strict";
6199
6276
  init_organizations();
6200
- organizationSkills = pgTable62(
6277
+ organizationSkills = pgTable63(
6201
6278
  "organization_skills",
6202
6279
  {
6203
- id: uuid60("id").primaryKey().defaultRandom(),
6204
- orgId: uuid60("org_id").notNull().references(() => organizations.id),
6205
- key: text63("key").notNull(),
6206
- slug: text63("slug").notNull(),
6207
- name: text63("name").notNull(),
6208
- description: text63("description"),
6209
- markdown: text63("markdown").notNull(),
6210
- sourceType: text63("source_type").notNull().default("local_path"),
6211
- sourceLocator: text63("source_locator"),
6212
- sourceRef: text63("source_ref"),
6213
- trustLevel: text63("trust_level").notNull().default("markdown_only"),
6214
- compatibility: text63("compatibility").notNull().default("compatible"),
6215
- fileInventory: jsonb29("file_inventory").$type().notNull().default([]),
6216
- metadata: jsonb29("metadata").$type(),
6217
- createdAt: timestamp62("created_at", { withTimezone: true }).notNull().defaultNow(),
6218
- updatedAt: timestamp62("updated_at", { withTimezone: true }).notNull().defaultNow()
6280
+ id: uuid61("id").primaryKey().defaultRandom(),
6281
+ orgId: uuid61("org_id").notNull().references(() => organizations.id),
6282
+ key: text64("key").notNull(),
6283
+ slug: text64("slug").notNull(),
6284
+ name: text64("name").notNull(),
6285
+ description: text64("description"),
6286
+ markdown: text64("markdown").notNull(),
6287
+ sourceType: text64("source_type").notNull().default("local_path"),
6288
+ sourceLocator: text64("source_locator"),
6289
+ sourceRef: text64("source_ref"),
6290
+ trustLevel: text64("trust_level").notNull().default("markdown_only"),
6291
+ compatibility: text64("compatibility").notNull().default("compatible"),
6292
+ fileInventory: jsonb30("file_inventory").$type().notNull().default([]),
6293
+ metadata: jsonb30("metadata").$type(),
6294
+ createdAt: timestamp63("created_at", { withTimezone: true }).notNull().defaultNow(),
6295
+ updatedAt: timestamp63("updated_at", { withTimezone: true }).notNull().defaultNow()
6219
6296
  },
6220
6297
  (table) => ({
6221
6298
  organizationKeyUniqueIdx: uniqueIndex33("organization_skills_org_key_idx").on(table.orgId, table.key),
6222
- organizationNameIdx: index57("organization_skills_org_name_idx").on(table.orgId, table.name)
6299
+ organizationNameIdx: index58("organization_skills_org_name_idx").on(table.orgId, table.name)
6223
6300
  })
6224
6301
  );
6225
6302
  }
@@ -6227,61 +6304,61 @@ var init_organization_skills = __esm({
6227
6304
 
6228
6305
  // ../packages/db/src/schema/plugins.ts
6229
6306
  import {
6230
- pgTable as pgTable63,
6231
- uuid as uuid61,
6232
- text as text64,
6233
- integer as integer21,
6234
- timestamp as timestamp63,
6235
- jsonb as jsonb30,
6236
- index as index58,
6307
+ pgTable as pgTable64,
6308
+ uuid as uuid62,
6309
+ text as text65,
6310
+ integer as integer22,
6311
+ timestamp as timestamp64,
6312
+ jsonb as jsonb31,
6313
+ index as index59,
6237
6314
  uniqueIndex as uniqueIndex34
6238
6315
  } from "drizzle-orm/pg-core";
6239
6316
  var plugins;
6240
6317
  var init_plugins = __esm({
6241
6318
  "../packages/db/src/schema/plugins.ts"() {
6242
6319
  "use strict";
6243
- plugins = pgTable63(
6320
+ plugins = pgTable64(
6244
6321
  "plugins",
6245
6322
  {
6246
- id: uuid61("id").primaryKey().defaultRandom(),
6247
- pluginKey: text64("plugin_key").notNull(),
6248
- packageName: text64("package_name").notNull(),
6249
- version: text64("version").notNull(),
6250
- apiVersion: integer21("api_version").notNull().default(1),
6251
- categories: jsonb30("categories").$type().notNull().default([]),
6252
- manifestJson: jsonb30("manifest_json").$type().notNull(),
6253
- status: text64("status").$type().notNull().default("installed"),
6254
- installOrder: integer21("install_order"),
6323
+ id: uuid62("id").primaryKey().defaultRandom(),
6324
+ pluginKey: text65("plugin_key").notNull(),
6325
+ packageName: text65("package_name").notNull(),
6326
+ version: text65("version").notNull(),
6327
+ apiVersion: integer22("api_version").notNull().default(1),
6328
+ categories: jsonb31("categories").$type().notNull().default([]),
6329
+ manifestJson: jsonb31("manifest_json").$type().notNull(),
6330
+ status: text65("status").$type().notNull().default("installed"),
6331
+ installOrder: integer22("install_order"),
6255
6332
  /** Resolved package path for local-path installs; used to find worker entrypoint. */
6256
- packagePath: text64("package_path"),
6257
- lastError: text64("last_error"),
6258
- installedAt: timestamp63("installed_at", { withTimezone: true }).notNull().defaultNow(),
6259
- updatedAt: timestamp63("updated_at", { withTimezone: true }).notNull().defaultNow()
6333
+ packagePath: text65("package_path"),
6334
+ lastError: text65("last_error"),
6335
+ installedAt: timestamp64("installed_at", { withTimezone: true }).notNull().defaultNow(),
6336
+ updatedAt: timestamp64("updated_at", { withTimezone: true }).notNull().defaultNow()
6260
6337
  },
6261
6338
  (table) => ({
6262
6339
  pluginKeyIdx: uniqueIndex34("plugins_plugin_key_idx").on(table.pluginKey),
6263
- statusIdx: index58("plugins_status_idx").on(table.status)
6340
+ statusIdx: index59("plugins_status_idx").on(table.status)
6264
6341
  })
6265
6342
  );
6266
6343
  }
6267
6344
  });
6268
6345
 
6269
6346
  // ../packages/db/src/schema/plugin_config.ts
6270
- import { pgTable as pgTable64, uuid as uuid62, text as text65, timestamp as timestamp64, jsonb as jsonb31, uniqueIndex as uniqueIndex35 } from "drizzle-orm/pg-core";
6347
+ import { pgTable as pgTable65, uuid as uuid63, text as text66, timestamp as timestamp65, jsonb as jsonb32, uniqueIndex as uniqueIndex35 } from "drizzle-orm/pg-core";
6271
6348
  var pluginConfig;
6272
6349
  var init_plugin_config = __esm({
6273
6350
  "../packages/db/src/schema/plugin_config.ts"() {
6274
6351
  "use strict";
6275
6352
  init_plugins();
6276
- pluginConfig = pgTable64(
6353
+ pluginConfig = pgTable65(
6277
6354
  "plugin_config",
6278
6355
  {
6279
- id: uuid62("id").primaryKey().defaultRandom(),
6280
- pluginId: uuid62("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6281
- configJson: jsonb31("config_json").$type().notNull().default({}),
6282
- lastError: text65("last_error"),
6283
- createdAt: timestamp64("created_at", { withTimezone: true }).notNull().defaultNow(),
6284
- updatedAt: timestamp64("updated_at", { withTimezone: true }).notNull().defaultNow()
6356
+ id: uuid63("id").primaryKey().defaultRandom(),
6357
+ pluginId: uuid63("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6358
+ configJson: jsonb32("config_json").$type().notNull().default({}),
6359
+ lastError: text66("last_error"),
6360
+ createdAt: timestamp65("created_at", { withTimezone: true }).notNull().defaultNow(),
6361
+ updatedAt: timestamp65("updated_at", { withTimezone: true }).notNull().defaultNow()
6285
6362
  },
6286
6363
  (table) => ({
6287
6364
  pluginIdIdx: uniqueIndex35("plugin_config_plugin_id_idx").on(table.pluginId)
@@ -6291,28 +6368,28 @@ var init_plugin_config = __esm({
6291
6368
  });
6292
6369
 
6293
6370
  // ../packages/db/src/schema/plugin_organization_settings.ts
6294
- import { pgTable as pgTable65, uuid as uuid63, text as text66, timestamp as timestamp65, jsonb as jsonb32, index as index59, uniqueIndex as uniqueIndex36, boolean as boolean12 } from "drizzle-orm/pg-core";
6371
+ import { pgTable as pgTable66, uuid as uuid64, text as text67, timestamp as timestamp66, jsonb as jsonb33, index as index60, uniqueIndex as uniqueIndex36, boolean as boolean12 } from "drizzle-orm/pg-core";
6295
6372
  var pluginOrganizationSettings;
6296
6373
  var init_plugin_organization_settings = __esm({
6297
6374
  "../packages/db/src/schema/plugin_organization_settings.ts"() {
6298
6375
  "use strict";
6299
6376
  init_organizations();
6300
6377
  init_plugins();
6301
- pluginOrganizationSettings = pgTable65(
6378
+ pluginOrganizationSettings = pgTable66(
6302
6379
  "plugin_organization_settings",
6303
6380
  {
6304
- id: uuid63("id").primaryKey().defaultRandom(),
6305
- orgId: uuid63("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
6306
- pluginId: uuid63("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6381
+ id: uuid64("id").primaryKey().defaultRandom(),
6382
+ orgId: uuid64("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
6383
+ pluginId: uuid64("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6307
6384
  enabled: boolean12("enabled").notNull().default(true),
6308
- settingsJson: jsonb32("settings_json").$type().notNull().default({}),
6309
- lastError: text66("last_error"),
6310
- createdAt: timestamp65("created_at", { withTimezone: true }).notNull().defaultNow(),
6311
- updatedAt: timestamp65("updated_at", { withTimezone: true }).notNull().defaultNow()
6385
+ settingsJson: jsonb33("settings_json").$type().notNull().default({}),
6386
+ lastError: text67("last_error"),
6387
+ createdAt: timestamp66("created_at", { withTimezone: true }).notNull().defaultNow(),
6388
+ updatedAt: timestamp66("updated_at", { withTimezone: true }).notNull().defaultNow()
6312
6389
  },
6313
6390
  (table) => ({
6314
- organizationIdx: index59("plugin_organization_settings_org_idx").on(table.orgId),
6315
- pluginIdx: index59("plugin_organization_settings_plugin_idx").on(table.pluginId),
6391
+ organizationIdx: index60("plugin_organization_settings_org_idx").on(table.orgId),
6392
+ pluginIdx: index60("plugin_organization_settings_plugin_idx").on(table.pluginId),
6316
6393
  organizationPluginUq: uniqueIndex36("plugin_organization_settings_org_plugin_uq").on(
6317
6394
  table.orgId,
6318
6395
  table.pluginId
@@ -6324,12 +6401,12 @@ var init_plugin_organization_settings = __esm({
6324
6401
 
6325
6402
  // ../packages/db/src/schema/plugin_state.ts
6326
6403
  import {
6327
- pgTable as pgTable66,
6328
- uuid as uuid64,
6329
- text as text67,
6330
- timestamp as timestamp66,
6331
- jsonb as jsonb33,
6332
- index as index60,
6404
+ pgTable as pgTable67,
6405
+ uuid as uuid65,
6406
+ text as text68,
6407
+ timestamp as timestamp67,
6408
+ jsonb as jsonb34,
6409
+ index as index61,
6333
6410
  unique as unique2
6334
6411
  } from "drizzle-orm/pg-core";
6335
6412
  var pluginState;
@@ -6337,30 +6414,30 @@ var init_plugin_state = __esm({
6337
6414
  "../packages/db/src/schema/plugin_state.ts"() {
6338
6415
  "use strict";
6339
6416
  init_plugins();
6340
- pluginState = pgTable66(
6417
+ pluginState = pgTable67(
6341
6418
  "plugin_state",
6342
6419
  {
6343
- id: uuid64("id").primaryKey().defaultRandom(),
6420
+ id: uuid65("id").primaryKey().defaultRandom(),
6344
6421
  /** FK to the owning plugin. Cascades on delete. */
6345
- pluginId: uuid64("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6422
+ pluginId: uuid65("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6346
6423
  /** Granularity of the scope (e.g. `"instance"`, `"project"`, `"issue"`). */
6347
- scopeKind: text67("scope_kind").$type().notNull(),
6424
+ scopeKind: text68("scope_kind").$type().notNull(),
6348
6425
  /**
6349
6426
  * UUID or text identifier for the scoped object.
6350
6427
  * Null for `instance` scope (which has no associated entity).
6351
6428
  */
6352
- scopeId: text67("scope_id"),
6429
+ scopeId: text68("scope_id"),
6353
6430
  /**
6354
6431
  * Sub-namespace to avoid key collisions within a scope.
6355
6432
  * Defaults to `"default"` if the plugin does not specify one.
6356
6433
  */
6357
- namespace: text67("namespace").notNull().default("default"),
6434
+ namespace: text68("namespace").notNull().default("default"),
6358
6435
  /** The key identifying this state entry within the namespace. */
6359
- stateKey: text67("state_key").notNull(),
6436
+ stateKey: text68("state_key").notNull(),
6360
6437
  /** JSON-serializable value stored by the plugin. */
6361
- valueJson: jsonb33("value_json").notNull(),
6438
+ valueJson: jsonb34("value_json").notNull(),
6362
6439
  /** Timestamp of the most recent write. */
6363
- updatedAt: timestamp66("updated_at", { withTimezone: true }).notNull().defaultNow()
6440
+ updatedAt: timestamp67("updated_at", { withTimezone: true }).notNull().defaultNow()
6364
6441
  },
6365
6442
  (table) => ({
6366
6443
  /**
@@ -6382,7 +6459,7 @@ var init_plugin_state = __esm({
6382
6459
  table.stateKey
6383
6460
  ).nullsNotDistinct(),
6384
6461
  /** Speed up lookups by plugin + scope kind (most common access pattern). */
6385
- pluginScopeIdx: index60("plugin_state_plugin_scope_idx").on(
6462
+ pluginScopeIdx: index61("plugin_state_plugin_scope_idx").on(
6386
6463
  table.pluginId,
6387
6464
  table.scopeKind
6388
6465
  )
@@ -6393,12 +6470,12 @@ var init_plugin_state = __esm({
6393
6470
 
6394
6471
  // ../packages/db/src/schema/plugin_entities.ts
6395
6472
  import {
6396
- pgTable as pgTable67,
6397
- uuid as uuid65,
6398
- text as text68,
6399
- timestamp as timestamp67,
6400
- jsonb as jsonb34,
6401
- index as index61,
6473
+ pgTable as pgTable68,
6474
+ uuid as uuid66,
6475
+ text as text69,
6476
+ timestamp as timestamp68,
6477
+ jsonb as jsonb35,
6478
+ index as index62,
6402
6479
  uniqueIndex as uniqueIndex37
6403
6480
  } from "drizzle-orm/pg-core";
6404
6481
  var pluginEntities;
@@ -6406,27 +6483,27 @@ var init_plugin_entities = __esm({
6406
6483
  "../packages/db/src/schema/plugin_entities.ts"() {
6407
6484
  "use strict";
6408
6485
  init_plugins();
6409
- pluginEntities = pgTable67(
6486
+ pluginEntities = pgTable68(
6410
6487
  "plugin_entities",
6411
6488
  {
6412
- id: uuid65("id").primaryKey().defaultRandom(),
6413
- pluginId: uuid65("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6414
- entityType: text68("entity_type").notNull(),
6415
- scopeKind: text68("scope_kind").$type().notNull(),
6416
- scopeId: text68("scope_id"),
6489
+ id: uuid66("id").primaryKey().defaultRandom(),
6490
+ pluginId: uuid66("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6491
+ entityType: text69("entity_type").notNull(),
6492
+ scopeKind: text69("scope_kind").$type().notNull(),
6493
+ scopeId: text69("scope_id"),
6417
6494
  // NULL for global scope (text to match plugin_state.scope_id)
6418
- externalId: text68("external_id"),
6495
+ externalId: text69("external_id"),
6419
6496
  // ID in the external system
6420
- title: text68("title"),
6421
- status: text68("status"),
6422
- data: jsonb34("data").$type().notNull().default({}),
6423
- createdAt: timestamp67("created_at", { withTimezone: true }).notNull().defaultNow(),
6424
- updatedAt: timestamp67("updated_at", { withTimezone: true }).notNull().defaultNow()
6497
+ title: text69("title"),
6498
+ status: text69("status"),
6499
+ data: jsonb35("data").$type().notNull().default({}),
6500
+ createdAt: timestamp68("created_at", { withTimezone: true }).notNull().defaultNow(),
6501
+ updatedAt: timestamp68("updated_at", { withTimezone: true }).notNull().defaultNow()
6425
6502
  },
6426
6503
  (table) => ({
6427
- pluginIdx: index61("plugin_entities_plugin_idx").on(table.pluginId),
6428
- typeIdx: index61("plugin_entities_type_idx").on(table.entityType),
6429
- scopeIdx: index61("plugin_entities_scope_idx").on(table.scopeKind, table.scopeId),
6504
+ pluginIdx: index62("plugin_entities_plugin_idx").on(table.pluginId),
6505
+ typeIdx: index62("plugin_entities_type_idx").on(table.entityType),
6506
+ scopeIdx: index62("plugin_entities_scope_idx").on(table.scopeKind, table.scopeId),
6430
6507
  externalIdx: uniqueIndex37("plugin_entities_external_idx").on(
6431
6508
  table.pluginId,
6432
6509
  table.entityType,
@@ -6439,13 +6516,13 @@ var init_plugin_entities = __esm({
6439
6516
 
6440
6517
  // ../packages/db/src/schema/plugin_jobs.ts
6441
6518
  import {
6442
- pgTable as pgTable68,
6443
- uuid as uuid66,
6444
- text as text69,
6445
- integer as integer22,
6446
- timestamp as timestamp68,
6447
- jsonb as jsonb35,
6448
- index as index62,
6519
+ pgTable as pgTable69,
6520
+ uuid as uuid67,
6521
+ text as text70,
6522
+ integer as integer23,
6523
+ timestamp as timestamp69,
6524
+ jsonb as jsonb36,
6525
+ index as index63,
6449
6526
  uniqueIndex as uniqueIndex38
6450
6527
  } from "drizzle-orm/pg-core";
6451
6528
  var pluginJobs, pluginJobRuns;
@@ -6453,57 +6530,57 @@ var init_plugin_jobs = __esm({
6453
6530
  "../packages/db/src/schema/plugin_jobs.ts"() {
6454
6531
  "use strict";
6455
6532
  init_plugins();
6456
- pluginJobs = pgTable68(
6533
+ pluginJobs = pgTable69(
6457
6534
  "plugin_jobs",
6458
6535
  {
6459
- id: uuid66("id").primaryKey().defaultRandom(),
6536
+ id: uuid67("id").primaryKey().defaultRandom(),
6460
6537
  /** FK to the owning plugin. Cascades on delete. */
6461
- pluginId: uuid66("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6538
+ pluginId: uuid67("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6462
6539
  /** Identifier matching the key in the plugin manifest's `jobs` array. */
6463
- jobKey: text69("job_key").notNull(),
6540
+ jobKey: text70("job_key").notNull(),
6464
6541
  /** Cron expression (e.g. `"0 * * * *"`) or interval string. */
6465
- schedule: text69("schedule").notNull(),
6542
+ schedule: text70("schedule").notNull(),
6466
6543
  /** Current scheduling state. */
6467
- status: text69("status").$type().notNull().default("active"),
6544
+ status: text70("status").$type().notNull().default("active"),
6468
6545
  /** Timestamp of the most recent successful execution. */
6469
- lastRunAt: timestamp68("last_run_at", { withTimezone: true }),
6546
+ lastRunAt: timestamp69("last_run_at", { withTimezone: true }),
6470
6547
  /** Pre-computed timestamp of the next scheduled execution. */
6471
- nextRunAt: timestamp68("next_run_at", { withTimezone: true }),
6472
- createdAt: timestamp68("created_at", { withTimezone: true }).notNull().defaultNow(),
6473
- updatedAt: timestamp68("updated_at", { withTimezone: true }).notNull().defaultNow()
6548
+ nextRunAt: timestamp69("next_run_at", { withTimezone: true }),
6549
+ createdAt: timestamp69("created_at", { withTimezone: true }).notNull().defaultNow(),
6550
+ updatedAt: timestamp69("updated_at", { withTimezone: true }).notNull().defaultNow()
6474
6551
  },
6475
6552
  (table) => ({
6476
- pluginIdx: index62("plugin_jobs_plugin_idx").on(table.pluginId),
6477
- nextRunIdx: index62("plugin_jobs_next_run_idx").on(table.nextRunAt),
6553
+ pluginIdx: index63("plugin_jobs_plugin_idx").on(table.pluginId),
6554
+ nextRunIdx: index63("plugin_jobs_next_run_idx").on(table.nextRunAt),
6478
6555
  uniqueJobIdx: uniqueIndex38("plugin_jobs_unique_idx").on(table.pluginId, table.jobKey)
6479
6556
  })
6480
6557
  );
6481
- pluginJobRuns = pgTable68(
6558
+ pluginJobRuns = pgTable69(
6482
6559
  "plugin_job_runs",
6483
6560
  {
6484
- id: uuid66("id").primaryKey().defaultRandom(),
6561
+ id: uuid67("id").primaryKey().defaultRandom(),
6485
6562
  /** FK to the parent job definition. Cascades on delete. */
6486
- jobId: uuid66("job_id").notNull().references(() => pluginJobs.id, { onDelete: "cascade" }),
6563
+ jobId: uuid67("job_id").notNull().references(() => pluginJobs.id, { onDelete: "cascade" }),
6487
6564
  /** Denormalized FK to the owning plugin for efficient querying. Cascades on delete. */
6488
- pluginId: uuid66("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6565
+ pluginId: uuid67("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6489
6566
  /** What caused this run to start (`"scheduled"` or `"manual"`). */
6490
- trigger: text69("trigger").$type().notNull(),
6567
+ trigger: text70("trigger").$type().notNull(),
6491
6568
  /** Current lifecycle state of this run. */
6492
- status: text69("status").$type().notNull().default("pending"),
6569
+ status: text70("status").$type().notNull().default("pending"),
6493
6570
  /** Wall-clock duration in milliseconds. Null until the run finishes. */
6494
- durationMs: integer22("duration_ms"),
6571
+ durationMs: integer23("duration_ms"),
6495
6572
  /** Error message if `status === "failed"`. */
6496
- error: text69("error"),
6573
+ error: text70("error"),
6497
6574
  /** Ordered list of log lines emitted during this run. */
6498
- logs: jsonb35("logs").$type().notNull().default([]),
6499
- startedAt: timestamp68("started_at", { withTimezone: true }),
6500
- finishedAt: timestamp68("finished_at", { withTimezone: true }),
6501
- createdAt: timestamp68("created_at", { withTimezone: true }).notNull().defaultNow()
6575
+ logs: jsonb36("logs").$type().notNull().default([]),
6576
+ startedAt: timestamp69("started_at", { withTimezone: true }),
6577
+ finishedAt: timestamp69("finished_at", { withTimezone: true }),
6578
+ createdAt: timestamp69("created_at", { withTimezone: true }).notNull().defaultNow()
6502
6579
  },
6503
6580
  (table) => ({
6504
- jobIdx: index62("plugin_job_runs_job_idx").on(table.jobId),
6505
- pluginIdx: index62("plugin_job_runs_plugin_idx").on(table.pluginId),
6506
- statusIdx: index62("plugin_job_runs_status_idx").on(table.status)
6581
+ jobIdx: index63("plugin_job_runs_job_idx").on(table.jobId),
6582
+ pluginIdx: index63("plugin_job_runs_plugin_idx").on(table.pluginId),
6583
+ statusIdx: index63("plugin_job_runs_status_idx").on(table.status)
6507
6584
  })
6508
6585
  );
6509
6586
  }
@@ -6511,47 +6588,47 @@ var init_plugin_jobs = __esm({
6511
6588
 
6512
6589
  // ../packages/db/src/schema/plugin_webhooks.ts
6513
6590
  import {
6514
- pgTable as pgTable69,
6515
- uuid as uuid67,
6516
- text as text70,
6517
- integer as integer23,
6518
- timestamp as timestamp69,
6519
- jsonb as jsonb36,
6520
- index as index63
6591
+ pgTable as pgTable70,
6592
+ uuid as uuid68,
6593
+ text as text71,
6594
+ integer as integer24,
6595
+ timestamp as timestamp70,
6596
+ jsonb as jsonb37,
6597
+ index as index64
6521
6598
  } from "drizzle-orm/pg-core";
6522
6599
  var pluginWebhookDeliveries;
6523
6600
  var init_plugin_webhooks = __esm({
6524
6601
  "../packages/db/src/schema/plugin_webhooks.ts"() {
6525
6602
  "use strict";
6526
6603
  init_plugins();
6527
- pluginWebhookDeliveries = pgTable69(
6604
+ pluginWebhookDeliveries = pgTable70(
6528
6605
  "plugin_webhook_deliveries",
6529
6606
  {
6530
- id: uuid67("id").primaryKey().defaultRandom(),
6607
+ id: uuid68("id").primaryKey().defaultRandom(),
6531
6608
  /** FK to the owning plugin. Cascades on delete. */
6532
- pluginId: uuid67("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6609
+ pluginId: uuid68("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6533
6610
  /** Identifier matching the key in the plugin manifest's `webhooks` array. */
6534
- webhookKey: text70("webhook_key").notNull(),
6611
+ webhookKey: text71("webhook_key").notNull(),
6535
6612
  /** Optional de-duplication ID provided by the external system. */
6536
- externalId: text70("external_id"),
6613
+ externalId: text71("external_id"),
6537
6614
  /** Current delivery state. */
6538
- status: text70("status").$type().notNull().default("pending"),
6615
+ status: text71("status").$type().notNull().default("pending"),
6539
6616
  /** Wall-clock processing duration in milliseconds. Null until delivery finishes. */
6540
- durationMs: integer23("duration_ms"),
6617
+ durationMs: integer24("duration_ms"),
6541
6618
  /** Error message if `status === "failed"`. */
6542
- error: text70("error"),
6619
+ error: text71("error"),
6543
6620
  /** Raw JSON body of the inbound HTTP request. */
6544
- payload: jsonb36("payload").$type().notNull(),
6621
+ payload: jsonb37("payload").$type().notNull(),
6545
6622
  /** Relevant HTTP headers from the inbound request (e.g. signature headers). */
6546
- headers: jsonb36("headers").$type().notNull().default({}),
6547
- startedAt: timestamp69("started_at", { withTimezone: true }),
6548
- finishedAt: timestamp69("finished_at", { withTimezone: true }),
6549
- createdAt: timestamp69("created_at", { withTimezone: true }).notNull().defaultNow()
6623
+ headers: jsonb37("headers").$type().notNull().default({}),
6624
+ startedAt: timestamp70("started_at", { withTimezone: true }),
6625
+ finishedAt: timestamp70("finished_at", { withTimezone: true }),
6626
+ createdAt: timestamp70("created_at", { withTimezone: true }).notNull().defaultNow()
6550
6627
  },
6551
6628
  (table) => ({
6552
- pluginIdx: index63("plugin_webhook_deliveries_plugin_idx").on(table.pluginId),
6553
- statusIdx: index63("plugin_webhook_deliveries_status_idx").on(table.status),
6554
- keyIdx: index63("plugin_webhook_deliveries_key_idx").on(table.webhookKey)
6629
+ pluginIdx: index64("plugin_webhook_deliveries_plugin_idx").on(table.pluginId),
6630
+ statusIdx: index64("plugin_webhook_deliveries_status_idx").on(table.status),
6631
+ keyIdx: index64("plugin_webhook_deliveries_key_idx").on(table.webhookKey)
6555
6632
  })
6556
6633
  );
6557
6634
  }
@@ -6559,34 +6636,34 @@ var init_plugin_webhooks = __esm({
6559
6636
 
6560
6637
  // ../packages/db/src/schema/plugin_logs.ts
6561
6638
  import {
6562
- pgTable as pgTable70,
6563
- uuid as uuid68,
6564
- text as text71,
6565
- timestamp as timestamp70,
6566
- jsonb as jsonb37,
6567
- index as index64
6639
+ pgTable as pgTable71,
6640
+ uuid as uuid69,
6641
+ text as text72,
6642
+ timestamp as timestamp71,
6643
+ jsonb as jsonb38,
6644
+ index as index65
6568
6645
  } from "drizzle-orm/pg-core";
6569
6646
  var pluginLogs;
6570
6647
  var init_plugin_logs = __esm({
6571
6648
  "../packages/db/src/schema/plugin_logs.ts"() {
6572
6649
  "use strict";
6573
6650
  init_plugins();
6574
- pluginLogs = pgTable70(
6651
+ pluginLogs = pgTable71(
6575
6652
  "plugin_logs",
6576
6653
  {
6577
- id: uuid68("id").primaryKey().defaultRandom(),
6578
- pluginId: uuid68("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6579
- level: text71("level").notNull().default("info"),
6580
- message: text71("message").notNull(),
6581
- meta: jsonb37("meta").$type(),
6582
- createdAt: timestamp70("created_at", { withTimezone: true }).notNull().defaultNow()
6654
+ id: uuid69("id").primaryKey().defaultRandom(),
6655
+ pluginId: uuid69("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
6656
+ level: text72("level").notNull().default("info"),
6657
+ message: text72("message").notNull(),
6658
+ meta: jsonb38("meta").$type(),
6659
+ createdAt: timestamp71("created_at", { withTimezone: true }).notNull().defaultNow()
6583
6660
  },
6584
6661
  (table) => ({
6585
- pluginTimeIdx: index64("plugin_logs_plugin_time_idx").on(
6662
+ pluginTimeIdx: index65("plugin_logs_plugin_time_idx").on(
6586
6663
  table.pluginId,
6587
6664
  table.createdAt
6588
6665
  ),
6589
- levelIdx: index64("plugin_logs_level_idx").on(table.level)
6666
+ levelIdx: index65("plugin_logs_level_idx").on(table.level)
6590
6667
  })
6591
6668
  );
6592
6669
  }
@@ -6669,6 +6746,7 @@ __export(schema_exports, {
6669
6746
  projectResourceAttachments: () => projectResourceAttachments,
6670
6747
  projectWorkspaces: () => projectWorkspaces,
6671
6748
  projects: () => projects,
6749
+ workspaceBackups: () => workspaceBackups,
6672
6750
  workspaceOperations: () => workspaceOperations,
6673
6751
  workspaceRuntimeServices: () => workspaceRuntimeServices
6674
6752
  });
@@ -6702,6 +6780,7 @@ var init_schema2 = __esm({
6702
6780
  init_project_workspaces();
6703
6781
  init_execution_workspaces();
6704
6782
  init_workspace_operations();
6783
+ init_workspace_backups();
6705
6784
  init_workspace_runtime_services();
6706
6785
  init_project_goals();
6707
6786
  init_goals();
@@ -7578,7 +7657,7 @@ function sanitizeRestoreErrorMessage(error) {
7578
7657
  }
7579
7658
  return error instanceof Error ? error.message : String(error);
7580
7659
  }
7581
- function timestamp71(date2 = /* @__PURE__ */ new Date()) {
7660
+ function timestamp72(date2 = /* @__PURE__ */ new Date()) {
7582
7661
  const pad = (n) => String(n).padStart(2, "0");
7583
7662
  return `${date2.getFullYear()}${pad(date2.getMonth() + 1)}${pad(date2.getDate())}-${pad(date2.getHours())}${pad(date2.getMinutes())}${pad(date2.getSeconds())}`;
7584
7663
  }
@@ -7902,8 +7981,8 @@ async function runDatabaseBackup(opts) {
7902
7981
  const rows = await sql4.unsafe(`SELECT * FROM ${qualifiedTableName}`).values();
7903
7982
  const nullifiedColumns = nullifiedColumnsByTable.get(tablename) ?? /* @__PURE__ */ new Set();
7904
7983
  for (const row of rows) {
7905
- const values = row.map((rawValue, index65) => {
7906
- const columnName = cols[index65]?.column_name;
7984
+ const values = row.map((rawValue, index66) => {
7985
+ const columnName = cols[index66]?.column_name;
7907
7986
  const val = columnName && nullifiedColumns.has(columnName) ? null : rawValue;
7908
7987
  if (val === null || val === void 0) return "NULL";
7909
7988
  if (typeof val === "boolean") return val ? "true" : "false";
@@ -7933,7 +8012,7 @@ async function runDatabaseBackup(opts) {
7933
8012
  emitStatement("COMMIT;");
7934
8013
  emit("");
7935
8014
  mkdirSync(opts.backupDir, { recursive: true });
7936
- const backupFile = resolve2(opts.backupDir, `${filenamePrefix}-${timestamp71()}.sql`);
8015
+ const backupFile = resolve2(opts.backupDir, `${filenamePrefix}-${timestamp72()}.sql`);
7937
8016
  await writeFile(backupFile, lines.join("\n"), "utf8");
7938
8017
  const sizeBytes = statSync(backupFile).size;
7939
8018
  const prunedCount = pruneOldBackups(opts.backupDir, retentionDays, filenamePrefix);
@@ -8072,6 +8151,7 @@ __export(src_exports, {
8072
8151
  reconcilePendingMigrationHistory: () => reconcilePendingMigrationHistory,
8073
8152
  runDatabaseBackup: () => runDatabaseBackup,
8074
8153
  runDatabaseRestore: () => runDatabaseRestore,
8154
+ workspaceBackups: () => workspaceBackups,
8075
8155
  workspaceOperations: () => workspaceOperations,
8076
8156
  workspaceRuntimeServices: () => workspaceRuntimeServices
8077
8157
  });
@@ -10432,8 +10512,8 @@ function compareStableSemver(a, b) {
10432
10512
  const aMatch = a.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)$/);
10433
10513
  const bMatch = b.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)$/);
10434
10514
  if (!aMatch || !bMatch) return 0;
10435
- for (let index65 = 1; index65 <= 3; index65 += 1) {
10436
- const diff = Number(aMatch[index65]) - Number(bMatch[index65]);
10515
+ for (let index66 = 1; index66 <= 3; index66 += 1) {
10516
+ const diff = Number(aMatch[index66]) - Number(bMatch[index66]);
10437
10517
  if (diff !== 0) return diff;
10438
10518
  }
10439
10519
  return 0;
@@ -11143,8 +11223,8 @@ function printClaudeStreamEvent(raw, debug) {
11143
11223
  const block = blockRaw;
11144
11224
  const blockType = typeof block.type === "string" ? block.type : "";
11145
11225
  if (blockType === "text") {
11146
- const text72 = typeof block.text === "string" ? block.text : "";
11147
- if (text72) console.log(pc10.green(`assistant: ${text72}`));
11226
+ const text73 = typeof block.text === "string" ? block.text : "";
11227
+ if (text73) console.log(pc10.green(`assistant: ${text73}`));
11148
11228
  } else if (blockType === "tool_use") {
11149
11229
  const name = typeof block.name === "string" ? block.name : "unknown";
11150
11230
  console.log(pc10.yellow(`tool_call: ${name}`));
@@ -11236,13 +11316,13 @@ function printItemStarted(item) {
11236
11316
  function printItemCompleted(item) {
11237
11317
  const itemType = asString(item.type);
11238
11318
  if (itemType === "agent_message") {
11239
- const text72 = asString(item.text);
11240
- if (text72) console.log(pc11.green(`assistant: ${text72}`));
11319
+ const text73 = asString(item.text);
11320
+ if (text73) console.log(pc11.green(`assistant: ${text73}`));
11241
11321
  return true;
11242
11322
  }
11243
11323
  if (itemType === "reasoning") {
11244
- const text72 = asString(item.text);
11245
- if (text72) console.log(pc11.gray(`thinking: ${text72}`));
11324
+ const text73 = asString(item.text);
11325
+ if (text73) console.log(pc11.gray(`thinking: ${text73}`));
11246
11326
  return true;
11247
11327
  }
11248
11328
  if (itemType === "tool_use") {
@@ -11292,9 +11372,9 @@ function printItemCompleted(item) {
11292
11372
  }
11293
11373
  if (itemType === "tool_result") {
11294
11374
  const isError = item.is_error === true || asString(item.status) === "error";
11295
- const text72 = asString(item.content) || asString(item.result) || asString(item.output);
11375
+ const text73 = asString(item.content) || asString(item.result) || asString(item.output);
11296
11376
  console.log((isError ? pc11.red : pc11.cyan)(`tool_result${isError ? " (error)" : ""}`));
11297
- if (text72) console.log((isError ? pc11.red : pc11.gray)(text72));
11377
+ if (text73) console.log((isError ? pc11.red : pc11.gray)(text73));
11298
11378
  return true;
11299
11379
  }
11300
11380
  return false;
@@ -11413,8 +11493,8 @@ function stringifyUnknown(value) {
11413
11493
  }
11414
11494
  function printUserMessage(messageRaw) {
11415
11495
  if (typeof messageRaw === "string") {
11416
- const text72 = messageRaw.trim();
11417
- if (text72) console.log(pc12.gray(`user: ${text72}`));
11496
+ const text73 = messageRaw.trim();
11497
+ if (text73) console.log(pc12.gray(`user: ${text73}`));
11418
11498
  return;
11419
11499
  }
11420
11500
  const message = asRecord2(messageRaw);
@@ -11427,14 +11507,14 @@ function printUserMessage(messageRaw) {
11427
11507
  if (!part) continue;
11428
11508
  const type = asString2(part.type).trim();
11429
11509
  if (type !== "output_text" && type !== "text") continue;
11430
- const text72 = asString2(part.text).trim();
11431
- if (text72) console.log(pc12.gray(`user: ${text72}`));
11510
+ const text73 = asString2(part.text).trim();
11511
+ if (text73) console.log(pc12.gray(`user: ${text73}`));
11432
11512
  }
11433
11513
  }
11434
11514
  function printAssistantMessage(messageRaw) {
11435
11515
  if (typeof messageRaw === "string") {
11436
- const text72 = messageRaw.trim();
11437
- if (text72) console.log(pc12.green(`assistant: ${text72}`));
11516
+ const text73 = messageRaw.trim();
11517
+ if (text73) console.log(pc12.green(`assistant: ${text73}`));
11438
11518
  return;
11439
11519
  }
11440
11520
  const message = asRecord2(messageRaw);
@@ -11447,13 +11527,13 @@ function printAssistantMessage(messageRaw) {
11447
11527
  if (!part) continue;
11448
11528
  const type = asString2(part.type).trim();
11449
11529
  if (type === "output_text" || type === "text") {
11450
- const text72 = asString2(part.text).trim();
11451
- if (text72) console.log(pc12.green(`assistant: ${text72}`));
11530
+ const text73 = asString2(part.text).trim();
11531
+ if (text73) console.log(pc12.green(`assistant: ${text73}`));
11452
11532
  continue;
11453
11533
  }
11454
11534
  if (type === "thinking") {
11455
- const text72 = asString2(part.text).trim();
11456
- if (text72) console.log(pc12.gray(`thinking: ${text72}`));
11535
+ const text73 = asString2(part.text).trim();
11536
+ if (text73) console.log(pc12.gray(`thinking: ${text73}`));
11457
11537
  continue;
11458
11538
  }
11459
11539
  if (type === "tool_call") {
@@ -11573,8 +11653,8 @@ function printCursorStreamEvent(raw, _debug) {
11573
11653
  return;
11574
11654
  }
11575
11655
  if (type === "thinking") {
11576
- const text72 = asString2(parsed.text).trim() || asString2(asRecord2(parsed.delta)?.text).trim();
11577
- if (text72) console.log(pc12.gray(`thinking: ${text72}`));
11656
+ const text73 = asString2(parsed.text).trim() || asString2(asRecord2(parsed.delta)?.text).trim();
11657
+ if (text73) console.log(pc12.gray(`thinking: ${text73}`));
11578
11658
  return;
11579
11659
  }
11580
11660
  if (type === "tool_call") {
@@ -11612,8 +11692,8 @@ function printCursorStreamEvent(raw, _debug) {
11612
11692
  }
11613
11693
  if (type === "text") {
11614
11694
  const part = asRecord2(parsed.part);
11615
- const text72 = asString2(part?.text);
11616
- if (text72) console.log(pc12.green(`assistant: ${text72}`));
11695
+ const text73 = asString2(part?.text);
11696
+ if (text73) console.log(pc12.green(`assistant: ${text73}`));
11617
11697
  return;
11618
11698
  }
11619
11699
  if (type === "tool_use") {
@@ -11676,8 +11756,8 @@ function errorText2(value) {
11676
11756
  }
11677
11757
  function printTextMessage(prefix, colorize, messageRaw) {
11678
11758
  if (typeof messageRaw === "string") {
11679
- const text72 = messageRaw.trim();
11680
- if (text72) console.log(colorize(`${prefix}: ${text72}`));
11759
+ const text73 = messageRaw.trim();
11760
+ if (text73) console.log(colorize(`${prefix}: ${text73}`));
11681
11761
  return;
11682
11762
  }
11683
11763
  const message = asRecord3(messageRaw);
@@ -11690,13 +11770,13 @@ function printTextMessage(prefix, colorize, messageRaw) {
11690
11770
  if (!part) continue;
11691
11771
  const type = asString3(part.type).trim();
11692
11772
  if (type === "output_text" || type === "text" || type === "content") {
11693
- const text72 = asString3(part.text).trim() || asString3(part.content).trim();
11694
- if (text72) console.log(colorize(`${prefix}: ${text72}`));
11773
+ const text73 = asString3(part.text).trim() || asString3(part.content).trim();
11774
+ if (text73) console.log(colorize(`${prefix}: ${text73}`));
11695
11775
  continue;
11696
11776
  }
11697
11777
  if (type === "thinking") {
11698
- const text72 = asString3(part.text).trim();
11699
- if (text72) console.log(pc13.gray(`thinking: ${text72}`));
11778
+ const text73 = asString3(part.text).trim();
11779
+ if (text73) console.log(pc13.gray(`thinking: ${text73}`));
11700
11780
  continue;
11701
11781
  }
11702
11782
  if (type === "tool_call") {
@@ -11748,8 +11828,8 @@ function printGeminiStreamEvent(raw, _debug) {
11748
11828
  return;
11749
11829
  }
11750
11830
  if (subtype === "error") {
11751
- const text72 = errorText2(parsed.error ?? parsed.message ?? parsed.detail);
11752
- if (text72) console.log(pc13.red(`error: ${text72}`));
11831
+ const text73 = errorText2(parsed.error ?? parsed.message ?? parsed.detail);
11832
+ if (text73) console.log(pc13.red(`error: ${text73}`));
11753
11833
  return;
11754
11834
  }
11755
11835
  console.log(pc13.blue(`system: ${subtype || "event"}`));
@@ -11764,8 +11844,8 @@ function printGeminiStreamEvent(raw, _debug) {
11764
11844
  return;
11765
11845
  }
11766
11846
  if (type === "thinking") {
11767
- const text72 = asString3(parsed.text).trim() || asString3(asRecord3(parsed.delta)?.text).trim();
11768
- if (text72) console.log(pc13.gray(`thinking: ${text72}`));
11847
+ const text73 = asString3(parsed.text).trim() || asString3(asRecord3(parsed.delta)?.text).trim();
11848
+ if (text73) console.log(pc13.gray(`thinking: ${text73}`));
11769
11849
  return;
11770
11850
  }
11771
11851
  if (type === "tool_call") {
@@ -11801,8 +11881,8 @@ function printGeminiStreamEvent(raw, _debug) {
11801
11881
  return;
11802
11882
  }
11803
11883
  if (type === "error") {
11804
- const text72 = errorText2(parsed.error ?? parsed.message ?? parsed.detail);
11805
- if (text72) console.log(pc13.red(`error: ${text72}`));
11884
+ const text73 = errorText2(parsed.error ?? parsed.message ?? parsed.detail);
11885
+ if (text73) console.log(pc13.red(`error: ${text73}`));
11806
11886
  return;
11807
11887
  }
11808
11888
  console.log(line);
@@ -11810,9 +11890,9 @@ function printGeminiStreamEvent(raw, _debug) {
11810
11890
 
11811
11891
  // ../packages/agent-runtimes/opencode-local/src/cli/format-event.ts
11812
11892
  import pc14 from "picocolors";
11813
- function safeJsonParse(text72) {
11893
+ function safeJsonParse(text73) {
11814
11894
  try {
11815
- return JSON.parse(text72);
11895
+ return JSON.parse(text73);
11816
11896
  } catch {
11817
11897
  return null;
11818
11898
  }
@@ -11856,14 +11936,14 @@ function printOpenCodeStreamEvent(raw, _debug) {
11856
11936
  }
11857
11937
  if (type === "text") {
11858
11938
  const part = asRecord4(parsed.part);
11859
- const text72 = asString4(part?.text).trim();
11860
- if (text72) console.log(pc14.green(`assistant: ${text72}`));
11939
+ const text73 = asString4(part?.text).trim();
11940
+ if (text73) console.log(pc14.green(`assistant: ${text73}`));
11861
11941
  return;
11862
11942
  }
11863
11943
  if (type === "reasoning") {
11864
11944
  const part = asRecord4(parsed.part);
11865
- const text72 = asString4(part?.text).trim();
11866
- if (text72) console.log(pc14.gray(`thinking: ${text72}`));
11945
+ const text73 = asString4(part?.text).trim();
11946
+ if (text73) console.log(pc14.gray(`thinking: ${text73}`));
11867
11947
  return;
11868
11948
  }
11869
11949
  if (type === "tool_use") {
@@ -11911,9 +11991,9 @@ function printOpenCodeStreamEvent(raw, _debug) {
11911
11991
 
11912
11992
  // ../packages/agent-runtimes/pi-local/src/cli/format-event.ts
11913
11993
  import pc15 from "picocolors";
11914
- function safeJsonParse2(text72) {
11994
+ function safeJsonParse2(text73) {
11915
11995
  try {
11916
- return JSON.parse(text72);
11996
+ return JSON.parse(text73);
11917
11997
  } catch {
11918
11998
  return null;
11919
11999
  }
@@ -11955,9 +12035,9 @@ function printPiStreamEvent(raw, _debug) {
11955
12035
  const message = asRecord5(parsed.message);
11956
12036
  if (message) {
11957
12037
  const content = message.content;
11958
- const text72 = extractTextContent(content);
11959
- if (text72) {
11960
- console.log(pc15.green(`assistant: ${text72}`));
12038
+ const text73 = extractTextContent(content);
12039
+ if (text73) {
12040
+ console.log(pc15.green(`assistant: ${text73}`));
11961
12041
  }
11962
12042
  }
11963
12043
  return;
@@ -12526,11 +12606,11 @@ var RudderApiClient = class {
12526
12606
  if (response.status === 204) {
12527
12607
  return null;
12528
12608
  }
12529
- const text72 = await response.text();
12530
- if (!text72.trim()) {
12609
+ const text73 = await response.text();
12610
+ if (!text73.trim()) {
12531
12611
  return null;
12532
12612
  }
12533
- return safeParseJson(text72);
12613
+ return safeParseJson(text73);
12534
12614
  }
12535
12615
  };
12536
12616
  function shouldAttachRunId(method) {
@@ -12545,16 +12625,16 @@ function buildUrl(apiBase, path23) {
12545
12625
  if (query) url.search = query;
12546
12626
  return url.toString();
12547
12627
  }
12548
- function safeParseJson(text72) {
12628
+ function safeParseJson(text73) {
12549
12629
  try {
12550
- return JSON.parse(text72);
12630
+ return JSON.parse(text73);
12551
12631
  } catch {
12552
- return text72;
12632
+ return text73;
12553
12633
  }
12554
12634
  }
12555
12635
  async function toApiError(response) {
12556
- const text72 = await response.text();
12557
- const parsed = safeParseJson(text72);
12636
+ const text73 = await response.text();
12637
+ const parsed = safeParseJson(text73);
12558
12638
  if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
12559
12639
  const body = parsed;
12560
12640
  const message = typeof body.error === "string" && body.error.trim() || typeof body.message === "string" && body.message.trim() || `Request failed with status ${response.status}`;
@@ -15197,8 +15277,8 @@ function filterIssueRows(rows, match) {
15197
15277
  if (!match?.trim()) return rows;
15198
15278
  const needle = match.trim().toLowerCase();
15199
15279
  return rows.filter((row) => {
15200
- const text72 = [row.identifier, row.title, row.description].filter((part) => Boolean(part)).join("\n").toLowerCase();
15201
- return text72.includes(needle);
15280
+ const text73 = [row.identifier, row.title, row.description].filter((part) => Boolean(part)).join("\n").toLowerCase();
15281
+ return text73.includes(needle);
15202
15282
  });
15203
15283
  }
15204
15284
 
@@ -15222,6 +15302,37 @@ function isMaintainerOnlySkillTarget(candidate) {
15222
15302
  const normalized = normalizePathSlashes(candidate);
15223
15303
  return normalized.includes("/server/resources/bundled-skills/") || normalized.includes("/.agents/skills/");
15224
15304
  }
15305
+ var RUDDER_AGENT_OPERATING_CONTRACT = [
15306
+ "# Rudder Agent Operating Contract",
15307
+ "",
15308
+ "Your home directory is `$AGENT_HOME`. Everything personal to you -- life, memory, knowledge -- lives there. Other agents may have their own folders and you may update them when necessary.",
15309
+ "",
15310
+ "Use these paths consistently:",
15311
+ "",
15312
+ "- Personal instructions live under `$AGENT_HOME/instructions`.",
15313
+ "- Personal memory lives under `$AGENT_HOME/memory`.",
15314
+ "- Tacit memory instruction lives at `$AGENT_HOME/instructions/MEMORY.md` and is automatically loaded when present.",
15315
+ "- Personal skills live under `$AGENT_HOME/skills`.",
15316
+ "- Shared organization workspace root lives under `$RUDDER_ORG_WORKSPACE_ROOT`.",
15317
+ "- Shared organization skills live under `$RUDDER_ORG_SKILLS_DIR`.",
15318
+ "- Shared organization plans live under `$RUDDER_ORG_PLANS_DIR`.",
15319
+ "- Durable shared work output should prefer these managed workspace paths instead of ad-hoc top-level `projects/` folders.",
15320
+ "",
15321
+ "When you write issue comments or chat replies, match the language of the user's or board's most recent substantive message unless they explicitly ask for a different language.",
15322
+ "",
15323
+ "## Memory and Planning",
15324
+ "",
15325
+ "You MUST use the `para-memory-files` skill for all memory operations: storing facts, writing daily notes, creating entities, running weekly synthesis, recalling past context, and managing plans. The skill defines your three-layer memory system (knowledge graph, daily notes, tacit knowledge), the PARA folder structure, atomic fact schemas, memory decay rules, and recall/planning conventions.",
15326
+ "",
15327
+ "Keep stable preferences and operating lessons in `$AGENT_HOME/instructions/MEMORY.md`. Use `$AGENT_HOME/memory/YYYY-MM-DD.md` for daily notes and `$AGENT_HOME/life/` for structured long-term memory; those files are not auto-loaded.",
15328
+ "",
15329
+ "Invoke it whenever you need to remember, retrieve, or organize anything.",
15330
+ "",
15331
+ "## Safety Considerations",
15332
+ "",
15333
+ "- Never exfiltrate secrets or private data.",
15334
+ "- Do not perform any destructive commands unless explicitly requested by the board."
15335
+ ].join("\n");
15225
15336
  async function resolveRudderSkillsDir(moduleDir, additionalCandidates = []) {
15226
15337
  const candidates = [
15227
15338
  ...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) => path16.resolve(moduleDir, relativePath)),
@@ -18854,9 +18965,9 @@ import { LangfuseClient } from "@langfuse/client";
18854
18965
 
18855
18966
  // ../packages/run-intelligence-core/src/trace.ts
18856
18967
  function truncate(value, maxLength = 180) {
18857
- const text72 = value.trim();
18858
- if (!text72) return "";
18859
- return text72.length > maxLength ? `${text72.slice(0, maxLength - 1)}\u2026` : text72;
18968
+ const text73 = value.trim();
18969
+ if (!text73) return "";
18970
+ return text73.length > maxLength ? `${text73.slice(0, maxLength - 1)}\u2026` : text73;
18860
18971
  }
18861
18972
  function firstMeaningfulLine(value) {
18862
18973
  for (const line of value.split(/\r?\n/)) {
@@ -19660,9 +19771,9 @@ function extractPromptText(body) {
19660
19771
  const nested = asString6(prompt.prompt) ?? asString6(prompt.text);
19661
19772
  if (nested) return nested;
19662
19773
  }
19663
- const text72 = body.text;
19664
- if (text72 && typeof text72 === "object" && !Array.isArray(text72)) {
19665
- const nested = asString6(text72.content) ?? asString6(text72.text);
19774
+ const text73 = body.text;
19775
+ if (text73 && typeof text73 === "object" && !Array.isArray(text73)) {
19776
+ const nested = asString6(text73.content) ?? asString6(text73.text);
19666
19777
  if (nested) return nested;
19667
19778
  }
19668
19779
  return null;