@rudderhq/cli 0.1.0-canary.38 → 0.1.0-canary.39
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 +1068 -865
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __export = (target, all) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// ../packages/shared/src/constants.ts
|
|
13
|
-
var ORGANIZATION_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, ISSUE_STATUSES, ISSUE_PRIORITIES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
|
|
13
|
+
var ORGANIZATION_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, ISSUE_STATUSES, ISSUE_PRIORITIES, CALENDAR_SOURCE_TYPES, CALENDAR_OWNER_TYPES, CALENDAR_VISIBILITIES, CALENDAR_SOURCE_STATUSES, CALENDAR_EVENT_KINDS, CALENDAR_EVENT_STATUSES, CALENDAR_SOURCE_MODES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
|
|
14
14
|
var init_constants = __esm({
|
|
15
15
|
"../packages/shared/src/constants.ts"() {
|
|
16
16
|
"use strict";
|
|
@@ -105,6 +105,13 @@ var init_constants = __esm({
|
|
|
105
105
|
"cancelled"
|
|
106
106
|
];
|
|
107
107
|
ISSUE_PRIORITIES = ["critical", "high", "medium", "low"];
|
|
108
|
+
CALENDAR_SOURCE_TYPES = ["rudder_local", "google_calendar", "agent_work", "system"];
|
|
109
|
+
CALENDAR_OWNER_TYPES = ["user", "agent", "system"];
|
|
110
|
+
CALENDAR_VISIBILITIES = ["full", "busy_only", "private"];
|
|
111
|
+
CALENDAR_SOURCE_STATUSES = ["active", "paused", "disconnected", "error"];
|
|
112
|
+
CALENDAR_EVENT_KINDS = ["human_event", "agent_work_block", "external_event", "system_event"];
|
|
113
|
+
CALENDAR_EVENT_STATUSES = ["planned", "in_progress", "actual", "cancelled", "external", "projected"];
|
|
114
|
+
CALENDAR_SOURCE_MODES = ["manual", "derived", "imported"];
|
|
108
115
|
CHAT_CONVERSATION_STATUSES = ["active", "resolved", "archived"];
|
|
109
116
|
CHAT_ISSUE_CREATION_MODES = ["manual_approval", "auto_create"];
|
|
110
117
|
CHAT_MESSAGE_ROLES = ["user", "assistant", "system"];
|
|
@@ -537,13 +544,13 @@ function validateModelFallbacksConfig(value, ctx, pathPrefix) {
|
|
|
537
544
|
});
|
|
538
545
|
return;
|
|
539
546
|
}
|
|
540
|
-
fallbackModels.forEach((fallback,
|
|
547
|
+
fallbackModels.forEach((fallback, index65) => {
|
|
541
548
|
if (typeof fallback === "string") {
|
|
542
549
|
if (fallback.trim().length === 0) {
|
|
543
550
|
ctx.addIssue({
|
|
544
551
|
code: z4.ZodIssueCode.custom,
|
|
545
552
|
message: "modelFallbacks string entries must be non-empty",
|
|
546
|
-
path: [...pathPrefix, "modelFallbacks",
|
|
553
|
+
path: [...pathPrefix, "modelFallbacks", index65]
|
|
547
554
|
});
|
|
548
555
|
}
|
|
549
556
|
return;
|
|
@@ -552,7 +559,7 @@ function validateModelFallbacksConfig(value, ctx, pathPrefix) {
|
|
|
552
559
|
ctx.addIssue({
|
|
553
560
|
code: z4.ZodIssueCode.custom,
|
|
554
561
|
message: "modelFallbacks entries must be strings or runtime/model objects",
|
|
555
|
-
path: [...pathPrefix, "modelFallbacks",
|
|
562
|
+
path: [...pathPrefix, "modelFallbacks", index65]
|
|
556
563
|
});
|
|
557
564
|
return;
|
|
558
565
|
}
|
|
@@ -560,27 +567,27 @@ function validateModelFallbacksConfig(value, ctx, pathPrefix) {
|
|
|
560
567
|
ctx.addIssue({
|
|
561
568
|
code: z4.ZodIssueCode.custom,
|
|
562
569
|
message: "modelFallbacks entries must include agentRuntimeType",
|
|
563
|
-
path: [...pathPrefix, "modelFallbacks",
|
|
570
|
+
path: [...pathPrefix, "modelFallbacks", index65, "agentRuntimeType"]
|
|
564
571
|
});
|
|
565
572
|
} else if (!agentRuntimeTypes.has(fallback.agentRuntimeType)) {
|
|
566
573
|
ctx.addIssue({
|
|
567
574
|
code: z4.ZodIssueCode.custom,
|
|
568
575
|
message: "modelFallbacks entries must include a valid agentRuntimeType",
|
|
569
|
-
path: [...pathPrefix, "modelFallbacks",
|
|
576
|
+
path: [...pathPrefix, "modelFallbacks", index65, "agentRuntimeType"]
|
|
570
577
|
});
|
|
571
578
|
}
|
|
572
579
|
if (typeof fallback.model !== "string" || fallback.model.trim().length === 0) {
|
|
573
580
|
ctx.addIssue({
|
|
574
581
|
code: z4.ZodIssueCode.custom,
|
|
575
582
|
message: "modelFallbacks entries must include model",
|
|
576
|
-
path: [...pathPrefix, "modelFallbacks",
|
|
583
|
+
path: [...pathPrefix, "modelFallbacks", index65, "model"]
|
|
577
584
|
});
|
|
578
585
|
}
|
|
579
586
|
if (fallback.config !== void 0 && !isRecord(fallback.config)) {
|
|
580
587
|
ctx.addIssue({
|
|
581
588
|
code: z4.ZodIssueCode.custom,
|
|
582
589
|
message: "modelFallbacks entry config must be an object",
|
|
583
|
-
path: [...pathPrefix, "modelFallbacks",
|
|
590
|
+
path: [...pathPrefix, "modelFallbacks", index65, "config"]
|
|
584
591
|
});
|
|
585
592
|
} else if (isRecord(fallback.config) && fallback.config.env !== void 0) {
|
|
586
593
|
const parsed = envConfigSchema.safeParse(fallback.config.env);
|
|
@@ -588,7 +595,7 @@ function validateModelFallbacksConfig(value, ctx, pathPrefix) {
|
|
|
588
595
|
ctx.addIssue({
|
|
589
596
|
code: z4.ZodIssueCode.custom,
|
|
590
597
|
message: "modelFallbacks entry config.env must be a map of valid env bindings",
|
|
591
|
-
path: [...pathPrefix, "modelFallbacks",
|
|
598
|
+
path: [...pathPrefix, "modelFallbacks", index65, "config", "env"]
|
|
592
599
|
});
|
|
593
600
|
}
|
|
594
601
|
}
|
|
@@ -1708,71 +1715,146 @@ var init_automation = __esm({
|
|
|
1708
1715
|
}
|
|
1709
1716
|
});
|
|
1710
1717
|
|
|
1711
|
-
// ../packages/shared/src/validators/
|
|
1718
|
+
// ../packages/shared/src/validators/calendar.ts
|
|
1712
1719
|
import { z as z19 } from "zod";
|
|
1720
|
+
var nullableUuid, createCalendarSourceSchema, updateCalendarSourceSchema, calendarEventBaseSchema, createCalendarEventSchema, updateCalendarEventSchema, calendarEventListQuerySchema, googleCalendarSyncSchema;
|
|
1721
|
+
var init_calendar = __esm({
|
|
1722
|
+
"../packages/shared/src/validators/calendar.ts"() {
|
|
1723
|
+
"use strict";
|
|
1724
|
+
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(),
|
|
1731
|
+
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()
|
|
1737
|
+
});
|
|
1738
|
+
updateCalendarSourceSchema = createCalendarSourceSchema.partial().extend({
|
|
1739
|
+
lastSyncedAt: z19.coerce.date().optional().nullable()
|
|
1740
|
+
});
|
|
1741
|
+
calendarEventBaseSchema = z19.object({
|
|
1742
|
+
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(),
|
|
1747
|
+
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"),
|
|
1755
|
+
issueId: nullableUuid,
|
|
1756
|
+
projectId: nullableUuid,
|
|
1757
|
+
goalId: nullableUuid,
|
|
1758
|
+
approvalId: nullableUuid,
|
|
1759
|
+
heartbeatRunId: nullableUuid,
|
|
1760
|
+
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()
|
|
1767
|
+
});
|
|
1768
|
+
createCalendarEventSchema = calendarEventBaseSchema.refine(
|
|
1769
|
+
(value) => value.endAt.getTime() > value.startAt.getTime(),
|
|
1770
|
+
{ path: ["endAt"], message: "End time must be after start time" }
|
|
1771
|
+
);
|
|
1772
|
+
updateCalendarEventSchema = calendarEventBaseSchema.partial().refine(
|
|
1773
|
+
(value) => value.startAt === void 0 || value.endAt === void 0 || value.endAt.getTime() > value.startAt.getTime(),
|
|
1774
|
+
{ path: ["endAt"], message: "End time must be after start time" }
|
|
1775
|
+
);
|
|
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()
|
|
1783
|
+
}).refine(
|
|
1784
|
+
(value) => value.end.getTime() > value.start.getTime(),
|
|
1785
|
+
{ path: ["end"], message: "End time must be after start time" }
|
|
1786
|
+
);
|
|
1787
|
+
googleCalendarSyncSchema = z19.object({
|
|
1788
|
+
sourceId: z19.string().uuid().optional().nullable()
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
});
|
|
1792
|
+
|
|
1793
|
+
// ../packages/shared/src/validators/cost.ts
|
|
1794
|
+
import { z as z20 } from "zod";
|
|
1713
1795
|
var createCostEventSchema, updateBudgetSchema;
|
|
1714
1796
|
var init_cost = __esm({
|
|
1715
1797
|
"../packages/shared/src/validators/cost.ts"() {
|
|
1716
1798
|
"use strict";
|
|
1717
1799
|
init_constants();
|
|
1718
|
-
createCostEventSchema =
|
|
1719
|
-
agentId:
|
|
1720
|
-
issueId:
|
|
1721
|
-
projectId:
|
|
1722
|
-
goalId:
|
|
1723
|
-
heartbeatRunId:
|
|
1724
|
-
billingCode:
|
|
1725
|
-
provider:
|
|
1726
|
-
biller:
|
|
1727
|
-
billingType:
|
|
1728
|
-
model:
|
|
1729
|
-
inputTokens:
|
|
1730
|
-
cachedInputTokens:
|
|
1731
|
-
outputTokens:
|
|
1732
|
-
costCents:
|
|
1733
|
-
occurredAt:
|
|
1800
|
+
createCostEventSchema = z20.object({
|
|
1801
|
+
agentId: z20.string().uuid(),
|
|
1802
|
+
issueId: z20.string().uuid().optional().nullable(),
|
|
1803
|
+
projectId: z20.string().uuid().optional().nullable(),
|
|
1804
|
+
goalId: z20.string().uuid().optional().nullable(),
|
|
1805
|
+
heartbeatRunId: z20.string().uuid().optional().nullable(),
|
|
1806
|
+
billingCode: z20.string().optional().nullable(),
|
|
1807
|
+
provider: z20.string().min(1),
|
|
1808
|
+
biller: z20.string().min(1).optional(),
|
|
1809
|
+
billingType: z20.enum(BILLING_TYPES).optional().default("unknown"),
|
|
1810
|
+
model: z20.string().min(1),
|
|
1811
|
+
inputTokens: z20.number().int().nonnegative().optional().default(0),
|
|
1812
|
+
cachedInputTokens: z20.number().int().nonnegative().optional().default(0),
|
|
1813
|
+
outputTokens: z20.number().int().nonnegative().optional().default(0),
|
|
1814
|
+
costCents: z20.number().int().nonnegative(),
|
|
1815
|
+
occurredAt: z20.string().datetime()
|
|
1734
1816
|
}).transform((value) => ({
|
|
1735
1817
|
...value,
|
|
1736
1818
|
biller: value.biller ?? value.provider
|
|
1737
1819
|
}));
|
|
1738
|
-
updateBudgetSchema =
|
|
1739
|
-
budgetMonthlyCents:
|
|
1820
|
+
updateBudgetSchema = z20.object({
|
|
1821
|
+
budgetMonthlyCents: z20.number().int().nonnegative()
|
|
1740
1822
|
});
|
|
1741
1823
|
}
|
|
1742
1824
|
});
|
|
1743
1825
|
|
|
1744
1826
|
// ../packages/shared/src/validators/finance.ts
|
|
1745
|
-
import { z as
|
|
1827
|
+
import { z as z21 } from "zod";
|
|
1746
1828
|
var createFinanceEventSchema;
|
|
1747
1829
|
var init_finance = __esm({
|
|
1748
1830
|
"../packages/shared/src/validators/finance.ts"() {
|
|
1749
1831
|
"use strict";
|
|
1750
1832
|
init_constants();
|
|
1751
|
-
createFinanceEventSchema =
|
|
1752
|
-
agentId:
|
|
1753
|
-
issueId:
|
|
1754
|
-
projectId:
|
|
1755
|
-
goalId:
|
|
1756
|
-
heartbeatRunId:
|
|
1757
|
-
costEventId:
|
|
1758
|
-
billingCode:
|
|
1759
|
-
description:
|
|
1760
|
-
eventKind:
|
|
1761
|
-
direction:
|
|
1762
|
-
biller:
|
|
1763
|
-
provider:
|
|
1764
|
-
executionAgentRuntimeType:
|
|
1765
|
-
pricingTier:
|
|
1766
|
-
region:
|
|
1767
|
-
model:
|
|
1768
|
-
quantity:
|
|
1769
|
-
unit:
|
|
1770
|
-
amountCents:
|
|
1771
|
-
currency:
|
|
1772
|
-
estimated:
|
|
1773
|
-
externalInvoiceId:
|
|
1774
|
-
metadataJson:
|
|
1775
|
-
occurredAt:
|
|
1833
|
+
createFinanceEventSchema = z21.object({
|
|
1834
|
+
agentId: z21.string().uuid().optional().nullable(),
|
|
1835
|
+
issueId: z21.string().uuid().optional().nullable(),
|
|
1836
|
+
projectId: z21.string().uuid().optional().nullable(),
|
|
1837
|
+
goalId: z21.string().uuid().optional().nullable(),
|
|
1838
|
+
heartbeatRunId: z21.string().uuid().optional().nullable(),
|
|
1839
|
+
costEventId: z21.string().uuid().optional().nullable(),
|
|
1840
|
+
billingCode: z21.string().optional().nullable(),
|
|
1841
|
+
description: z21.string().max(500).optional().nullable(),
|
|
1842
|
+
eventKind: z21.enum(FINANCE_EVENT_KINDS),
|
|
1843
|
+
direction: z21.enum(FINANCE_DIRECTIONS).optional().default("debit"),
|
|
1844
|
+
biller: z21.string().min(1),
|
|
1845
|
+
provider: z21.string().min(1).optional().nullable(),
|
|
1846
|
+
executionAgentRuntimeType: z21.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
|
|
1847
|
+
pricingTier: z21.string().min(1).optional().nullable(),
|
|
1848
|
+
region: z21.string().min(1).optional().nullable(),
|
|
1849
|
+
model: z21.string().min(1).optional().nullable(),
|
|
1850
|
+
quantity: z21.number().int().nonnegative().optional().nullable(),
|
|
1851
|
+
unit: z21.enum(FINANCE_UNITS).optional().nullable(),
|
|
1852
|
+
amountCents: z21.number().int().nonnegative(),
|
|
1853
|
+
currency: z21.string().length(3).optional().default("USD"),
|
|
1854
|
+
estimated: z21.boolean().optional().default(false),
|
|
1855
|
+
externalInvoiceId: z21.string().optional().nullable(),
|
|
1856
|
+
metadataJson: z21.record(z21.string(), z21.unknown()).optional().nullable(),
|
|
1857
|
+
occurredAt: z21.string().datetime()
|
|
1776
1858
|
}).transform((value) => ({
|
|
1777
1859
|
...value,
|
|
1778
1860
|
currency: value.currency.toUpperCase()
|
|
@@ -1781,81 +1863,81 @@ var init_finance = __esm({
|
|
|
1781
1863
|
});
|
|
1782
1864
|
|
|
1783
1865
|
// ../packages/shared/src/validators/asset.ts
|
|
1784
|
-
import { z as
|
|
1866
|
+
import { z as z22 } from "zod";
|
|
1785
1867
|
var createAssetImageMetadataSchema;
|
|
1786
1868
|
var init_asset = __esm({
|
|
1787
1869
|
"../packages/shared/src/validators/asset.ts"() {
|
|
1788
1870
|
"use strict";
|
|
1789
|
-
createAssetImageMetadataSchema =
|
|
1790
|
-
namespace:
|
|
1871
|
+
createAssetImageMetadataSchema = z22.object({
|
|
1872
|
+
namespace: z22.string().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()
|
|
1791
1873
|
});
|
|
1792
1874
|
}
|
|
1793
1875
|
});
|
|
1794
1876
|
|
|
1795
1877
|
// ../packages/shared/src/validators/access.ts
|
|
1796
|
-
import { z as
|
|
1878
|
+
import { z as z23 } from "zod";
|
|
1797
1879
|
var createCompanyInviteSchema, createOpenClawInvitePromptSchema, acceptInviteSchema, listJoinRequestsQuerySchema, claimJoinRequestApiKeySchema, boardCliAuthAccessLevelSchema, createCliAuthChallengeSchema, resolveCliAuthChallengeSchema, updateMemberPermissionsSchema, updateUserCompanyAccessSchema;
|
|
1798
1880
|
var init_access = __esm({
|
|
1799
1881
|
"../packages/shared/src/validators/access.ts"() {
|
|
1800
1882
|
"use strict";
|
|
1801
1883
|
init_constants();
|
|
1802
|
-
createCompanyInviteSchema =
|
|
1803
|
-
allowedJoinTypes:
|
|
1804
|
-
defaultsPayload:
|
|
1805
|
-
agentMessage:
|
|
1884
|
+
createCompanyInviteSchema = z23.object({
|
|
1885
|
+
allowedJoinTypes: z23.enum(INVITE_JOIN_TYPES).default("both"),
|
|
1886
|
+
defaultsPayload: z23.record(z23.string(), z23.unknown()).optional().nullable(),
|
|
1887
|
+
agentMessage: z23.string().max(4e3).optional().nullable()
|
|
1806
1888
|
});
|
|
1807
|
-
createOpenClawInvitePromptSchema =
|
|
1808
|
-
agentMessage:
|
|
1889
|
+
createOpenClawInvitePromptSchema = z23.object({
|
|
1890
|
+
agentMessage: z23.string().max(4e3).optional().nullable()
|
|
1809
1891
|
});
|
|
1810
|
-
acceptInviteSchema =
|
|
1811
|
-
requestType:
|
|
1812
|
-
agentName:
|
|
1813
|
-
agentRuntimeType:
|
|
1814
|
-
capabilities:
|
|
1815
|
-
agentDefaultsPayload:
|
|
1892
|
+
acceptInviteSchema = z23.object({
|
|
1893
|
+
requestType: z23.enum(JOIN_REQUEST_TYPES),
|
|
1894
|
+
agentName: z23.string().min(1).max(120).optional(),
|
|
1895
|
+
agentRuntimeType: z23.enum(AGENT_RUNTIME_TYPES).optional(),
|
|
1896
|
+
capabilities: z23.string().max(4e3).optional().nullable(),
|
|
1897
|
+
agentDefaultsPayload: z23.record(z23.string(), z23.unknown()).optional().nullable(),
|
|
1816
1898
|
// OpenClaw join compatibility fields accepted at top level.
|
|
1817
|
-
responsesWebhookUrl:
|
|
1818
|
-
responsesWebhookMethod:
|
|
1819
|
-
responsesWebhookHeaders:
|
|
1820
|
-
rudderApiUrl:
|
|
1821
|
-
webhookAuthHeader:
|
|
1899
|
+
responsesWebhookUrl: z23.string().max(4e3).optional().nullable(),
|
|
1900
|
+
responsesWebhookMethod: z23.string().max(32).optional().nullable(),
|
|
1901
|
+
responsesWebhookHeaders: z23.record(z23.string(), z23.unknown()).optional().nullable(),
|
|
1902
|
+
rudderApiUrl: z23.string().max(4e3).optional().nullable(),
|
|
1903
|
+
webhookAuthHeader: z23.string().max(4e3).optional().nullable()
|
|
1822
1904
|
});
|
|
1823
|
-
listJoinRequestsQuerySchema =
|
|
1824
|
-
status:
|
|
1825
|
-
requestType:
|
|
1905
|
+
listJoinRequestsQuerySchema = z23.object({
|
|
1906
|
+
status: z23.enum(JOIN_REQUEST_STATUSES).optional(),
|
|
1907
|
+
requestType: z23.enum(JOIN_REQUEST_TYPES).optional()
|
|
1826
1908
|
});
|
|
1827
|
-
claimJoinRequestApiKeySchema =
|
|
1828
|
-
claimSecret:
|
|
1909
|
+
claimJoinRequestApiKeySchema = z23.object({
|
|
1910
|
+
claimSecret: z23.string().min(16).max(256)
|
|
1829
1911
|
});
|
|
1830
|
-
boardCliAuthAccessLevelSchema =
|
|
1912
|
+
boardCliAuthAccessLevelSchema = z23.enum([
|
|
1831
1913
|
"board",
|
|
1832
1914
|
"instance_admin_required"
|
|
1833
1915
|
]);
|
|
1834
|
-
createCliAuthChallengeSchema =
|
|
1835
|
-
command:
|
|
1836
|
-
clientName:
|
|
1916
|
+
createCliAuthChallengeSchema = z23.object({
|
|
1917
|
+
command: z23.string().min(1).max(240),
|
|
1918
|
+
clientName: z23.string().max(120).optional().nullable(),
|
|
1837
1919
|
requestedAccess: boardCliAuthAccessLevelSchema.default("board"),
|
|
1838
|
-
requestedCompanyId:
|
|
1920
|
+
requestedCompanyId: z23.string().uuid().optional().nullable()
|
|
1839
1921
|
});
|
|
1840
|
-
resolveCliAuthChallengeSchema =
|
|
1841
|
-
token:
|
|
1922
|
+
resolveCliAuthChallengeSchema = z23.object({
|
|
1923
|
+
token: z23.string().min(16).max(256)
|
|
1842
1924
|
});
|
|
1843
|
-
updateMemberPermissionsSchema =
|
|
1844
|
-
grants:
|
|
1845
|
-
|
|
1846
|
-
permissionKey:
|
|
1847
|
-
scope:
|
|
1925
|
+
updateMemberPermissionsSchema = z23.object({
|
|
1926
|
+
grants: z23.array(
|
|
1927
|
+
z23.object({
|
|
1928
|
+
permissionKey: z23.enum(PERMISSION_KEYS),
|
|
1929
|
+
scope: z23.record(z23.string(), z23.unknown()).optional().nullable()
|
|
1848
1930
|
})
|
|
1849
1931
|
)
|
|
1850
1932
|
});
|
|
1851
|
-
updateUserCompanyAccessSchema =
|
|
1852
|
-
orgIds:
|
|
1933
|
+
updateUserCompanyAccessSchema = z23.object({
|
|
1934
|
+
orgIds: z23.array(z23.string().uuid()).default([])
|
|
1853
1935
|
});
|
|
1854
1936
|
}
|
|
1855
1937
|
});
|
|
1856
1938
|
|
|
1857
1939
|
// ../packages/shared/src/validators/plugin.ts
|
|
1858
|
-
import { z as
|
|
1940
|
+
import { z as z24 } from "zod";
|
|
1859
1941
|
function isValidCronExpression(expression) {
|
|
1860
1942
|
const trimmed = expression.trim();
|
|
1861
1943
|
if (!trimmed) return false;
|
|
@@ -1868,7 +1950,7 @@ var init_plugin = __esm({
|
|
|
1868
1950
|
"../packages/shared/src/validators/plugin.ts"() {
|
|
1869
1951
|
"use strict";
|
|
1870
1952
|
init_constants();
|
|
1871
|
-
jsonSchemaSchema =
|
|
1953
|
+
jsonSchemaSchema = z24.record(z24.unknown()).refine(
|
|
1872
1954
|
(val) => {
|
|
1873
1955
|
if (Object.keys(val).length === 0) return true;
|
|
1874
1956
|
return typeof val.type === "string" || val.$ref !== void 0 || val.oneOf !== void 0 || val.anyOf !== void 0 || val.allOf !== void 0;
|
|
@@ -1876,76 +1958,76 @@ var init_plugin = __esm({
|
|
|
1876
1958
|
{ message: "Must be a valid JSON Schema object (requires at least a 'type', '$ref', or composition keyword)" }
|
|
1877
1959
|
);
|
|
1878
1960
|
CRON_FIELD_PATTERN = /^(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?)(?:,(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?))*$/;
|
|
1879
|
-
pluginJobDeclarationSchema =
|
|
1880
|
-
jobKey:
|
|
1881
|
-
displayName:
|
|
1882
|
-
description:
|
|
1883
|
-
schedule:
|
|
1961
|
+
pluginJobDeclarationSchema = z24.object({
|
|
1962
|
+
jobKey: z24.string().min(1),
|
|
1963
|
+
displayName: z24.string().min(1),
|
|
1964
|
+
description: z24.string().optional(),
|
|
1965
|
+
schedule: z24.string().refine(
|
|
1884
1966
|
(val) => isValidCronExpression(val),
|
|
1885
1967
|
{ message: "schedule must be a valid 5-field cron expression (e.g. '*/15 * * * *')" }
|
|
1886
1968
|
).optional()
|
|
1887
1969
|
});
|
|
1888
|
-
pluginWebhookDeclarationSchema =
|
|
1889
|
-
endpointKey:
|
|
1890
|
-
displayName:
|
|
1891
|
-
description:
|
|
1970
|
+
pluginWebhookDeclarationSchema = z24.object({
|
|
1971
|
+
endpointKey: z24.string().min(1),
|
|
1972
|
+
displayName: z24.string().min(1),
|
|
1973
|
+
description: z24.string().optional()
|
|
1892
1974
|
});
|
|
1893
|
-
pluginToolDeclarationSchema =
|
|
1894
|
-
name:
|
|
1895
|
-
displayName:
|
|
1896
|
-
description:
|
|
1975
|
+
pluginToolDeclarationSchema = z24.object({
|
|
1976
|
+
name: z24.string().min(1),
|
|
1977
|
+
displayName: z24.string().min(1),
|
|
1978
|
+
description: z24.string().min(1),
|
|
1897
1979
|
parametersSchema: jsonSchemaSchema
|
|
1898
1980
|
});
|
|
1899
|
-
pluginUiSlotDeclarationSchema =
|
|
1900
|
-
type:
|
|
1901
|
-
id:
|
|
1902
|
-
displayName:
|
|
1903
|
-
exportName:
|
|
1904
|
-
entityTypes:
|
|
1905
|
-
routePath:
|
|
1981
|
+
pluginUiSlotDeclarationSchema = z24.object({
|
|
1982
|
+
type: z24.enum(PLUGIN_UI_SLOT_TYPES),
|
|
1983
|
+
id: z24.string().min(1),
|
|
1984
|
+
displayName: z24.string().min(1),
|
|
1985
|
+
exportName: z24.string().min(1),
|
|
1986
|
+
entityTypes: z24.array(z24.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
|
|
1987
|
+
routePath: z24.string().regex(/^[a-z0-9][a-z0-9-]*$/, {
|
|
1906
1988
|
message: "routePath must be a lowercase single-segment slug (letters, numbers, hyphens)"
|
|
1907
1989
|
}).optional(),
|
|
1908
|
-
order:
|
|
1990
|
+
order: z24.number().int().optional()
|
|
1909
1991
|
}).superRefine((value, ctx) => {
|
|
1910
1992
|
const entityScopedTypes = ["detailTab", "taskDetailView", "contextMenuItem", "commentAnnotation", "commentContextMenuItem", "projectSidebarItem"];
|
|
1911
1993
|
if (entityScopedTypes.includes(value.type) && (!value.entityTypes || value.entityTypes.length === 0)) {
|
|
1912
1994
|
ctx.addIssue({
|
|
1913
|
-
code:
|
|
1995
|
+
code: z24.ZodIssueCode.custom,
|
|
1914
1996
|
message: `${value.type} slots require at least one entityType`,
|
|
1915
1997
|
path: ["entityTypes"]
|
|
1916
1998
|
});
|
|
1917
1999
|
}
|
|
1918
2000
|
if (value.type === "projectSidebarItem" && value.entityTypes && !value.entityTypes.includes("project")) {
|
|
1919
2001
|
ctx.addIssue({
|
|
1920
|
-
code:
|
|
2002
|
+
code: z24.ZodIssueCode.custom,
|
|
1921
2003
|
message: 'projectSidebarItem slots require entityTypes to include "project"',
|
|
1922
2004
|
path: ["entityTypes"]
|
|
1923
2005
|
});
|
|
1924
2006
|
}
|
|
1925
2007
|
if (value.type === "commentAnnotation" && value.entityTypes && !value.entityTypes.includes("comment")) {
|
|
1926
2008
|
ctx.addIssue({
|
|
1927
|
-
code:
|
|
2009
|
+
code: z24.ZodIssueCode.custom,
|
|
1928
2010
|
message: 'commentAnnotation slots require entityTypes to include "comment"',
|
|
1929
2011
|
path: ["entityTypes"]
|
|
1930
2012
|
});
|
|
1931
2013
|
}
|
|
1932
2014
|
if (value.type === "commentContextMenuItem" && value.entityTypes && !value.entityTypes.includes("comment")) {
|
|
1933
2015
|
ctx.addIssue({
|
|
1934
|
-
code:
|
|
2016
|
+
code: z24.ZodIssueCode.custom,
|
|
1935
2017
|
message: 'commentContextMenuItem slots require entityTypes to include "comment"',
|
|
1936
2018
|
path: ["entityTypes"]
|
|
1937
2019
|
});
|
|
1938
2020
|
}
|
|
1939
2021
|
if (value.routePath && value.type !== "page") {
|
|
1940
2022
|
ctx.addIssue({
|
|
1941
|
-
code:
|
|
2023
|
+
code: z24.ZodIssueCode.custom,
|
|
1942
2024
|
message: "routePath is only supported for page slots",
|
|
1943
2025
|
path: ["routePath"]
|
|
1944
2026
|
});
|
|
1945
2027
|
}
|
|
1946
2028
|
if (value.routePath && PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS.includes(value.routePath)) {
|
|
1947
2029
|
ctx.addIssue({
|
|
1948
|
-
code:
|
|
2030
|
+
code: z24.ZodIssueCode.custom,
|
|
1949
2031
|
message: `routePath "${value.routePath}" is reserved by the host`,
|
|
1950
2032
|
path: ["routePath"]
|
|
1951
2033
|
});
|
|
@@ -1966,29 +2048,29 @@ var init_plugin = __esm({
|
|
|
1966
2048
|
external: [],
|
|
1967
2049
|
iframe: ["compact", "default", "wide", "full"]
|
|
1968
2050
|
};
|
|
1969
|
-
pluginLauncherActionDeclarationSchema =
|
|
1970
|
-
type:
|
|
1971
|
-
target:
|
|
1972
|
-
params:
|
|
2051
|
+
pluginLauncherActionDeclarationSchema = z24.object({
|
|
2052
|
+
type: z24.enum(PLUGIN_LAUNCHER_ACTIONS),
|
|
2053
|
+
target: z24.string().min(1),
|
|
2054
|
+
params: z24.record(z24.unknown()).optional()
|
|
1973
2055
|
}).superRefine((value, ctx) => {
|
|
1974
2056
|
if (value.type === "performAction" && value.target.includes("/")) {
|
|
1975
2057
|
ctx.addIssue({
|
|
1976
|
-
code:
|
|
2058
|
+
code: z24.ZodIssueCode.custom,
|
|
1977
2059
|
message: "performAction launchers must target an action key, not a route or URL",
|
|
1978
2060
|
path: ["target"]
|
|
1979
2061
|
});
|
|
1980
2062
|
}
|
|
1981
2063
|
if (value.type === "navigate" && /^https?:\/\//.test(value.target)) {
|
|
1982
2064
|
ctx.addIssue({
|
|
1983
|
-
code:
|
|
2065
|
+
code: z24.ZodIssueCode.custom,
|
|
1984
2066
|
message: "navigate launchers must target a host route, not an absolute URL",
|
|
1985
2067
|
path: ["target"]
|
|
1986
2068
|
});
|
|
1987
2069
|
}
|
|
1988
2070
|
});
|
|
1989
|
-
pluginLauncherRenderDeclarationSchema =
|
|
1990
|
-
environment:
|
|
1991
|
-
bounds:
|
|
2071
|
+
pluginLauncherRenderDeclarationSchema = z24.object({
|
|
2072
|
+
environment: z24.enum(PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS),
|
|
2073
|
+
bounds: z24.enum(PLUGIN_LAUNCHER_BOUNDS).optional()
|
|
1992
2074
|
}).superRefine((value, ctx) => {
|
|
1993
2075
|
if (!value.bounds) {
|
|
1994
2076
|
return;
|
|
@@ -1996,122 +2078,122 @@ var init_plugin = __esm({
|
|
|
1996
2078
|
const supportedBounds = launcherBoundsByEnvironment[value.environment];
|
|
1997
2079
|
if (!supportedBounds.includes(value.bounds)) {
|
|
1998
2080
|
ctx.addIssue({
|
|
1999
|
-
code:
|
|
2081
|
+
code: z24.ZodIssueCode.custom,
|
|
2000
2082
|
message: `bounds "${value.bounds}" is not supported for render environment "${value.environment}"`,
|
|
2001
2083
|
path: ["bounds"]
|
|
2002
2084
|
});
|
|
2003
2085
|
}
|
|
2004
2086
|
});
|
|
2005
|
-
pluginLauncherDeclarationSchema =
|
|
2006
|
-
id:
|
|
2007
|
-
displayName:
|
|
2008
|
-
description:
|
|
2009
|
-
placementZone:
|
|
2010
|
-
exportName:
|
|
2011
|
-
entityTypes:
|
|
2012
|
-
order:
|
|
2087
|
+
pluginLauncherDeclarationSchema = z24.object({
|
|
2088
|
+
id: z24.string().min(1),
|
|
2089
|
+
displayName: z24.string().min(1),
|
|
2090
|
+
description: z24.string().optional(),
|
|
2091
|
+
placementZone: z24.enum(PLUGIN_LAUNCHER_PLACEMENT_ZONES),
|
|
2092
|
+
exportName: z24.string().min(1).optional(),
|
|
2093
|
+
entityTypes: z24.array(z24.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
|
|
2094
|
+
order: z24.number().int().optional(),
|
|
2013
2095
|
action: pluginLauncherActionDeclarationSchema,
|
|
2014
2096
|
render: pluginLauncherRenderDeclarationSchema.optional()
|
|
2015
2097
|
}).superRefine((value, ctx) => {
|
|
2016
2098
|
if (entityScopedLauncherPlacementZones.some((zone) => zone === value.placementZone) && (!value.entityTypes || value.entityTypes.length === 0)) {
|
|
2017
2099
|
ctx.addIssue({
|
|
2018
|
-
code:
|
|
2100
|
+
code: z24.ZodIssueCode.custom,
|
|
2019
2101
|
message: `${value.placementZone} launchers require at least one entityType`,
|
|
2020
2102
|
path: ["entityTypes"]
|
|
2021
2103
|
});
|
|
2022
2104
|
}
|
|
2023
2105
|
if (value.placementZone === "projectSidebarItem" && value.entityTypes && !value.entityTypes.includes("project")) {
|
|
2024
2106
|
ctx.addIssue({
|
|
2025
|
-
code:
|
|
2107
|
+
code: z24.ZodIssueCode.custom,
|
|
2026
2108
|
message: 'projectSidebarItem launchers require entityTypes to include "project"',
|
|
2027
2109
|
path: ["entityTypes"]
|
|
2028
2110
|
});
|
|
2029
2111
|
}
|
|
2030
2112
|
if (value.action.type === "performAction" && value.render) {
|
|
2031
2113
|
ctx.addIssue({
|
|
2032
|
-
code:
|
|
2114
|
+
code: z24.ZodIssueCode.custom,
|
|
2033
2115
|
message: "performAction launchers cannot declare render hints",
|
|
2034
2116
|
path: ["render"]
|
|
2035
2117
|
});
|
|
2036
2118
|
}
|
|
2037
2119
|
if (["openModal", "openDrawer", "openPopover"].includes(value.action.type) && !value.render) {
|
|
2038
2120
|
ctx.addIssue({
|
|
2039
|
-
code:
|
|
2121
|
+
code: z24.ZodIssueCode.custom,
|
|
2040
2122
|
message: `${value.action.type} launchers require render metadata`,
|
|
2041
2123
|
path: ["render"]
|
|
2042
2124
|
});
|
|
2043
2125
|
}
|
|
2044
2126
|
if (value.action.type === "openModal" && value.render?.environment === "hostInline") {
|
|
2045
2127
|
ctx.addIssue({
|
|
2046
|
-
code:
|
|
2128
|
+
code: z24.ZodIssueCode.custom,
|
|
2047
2129
|
message: "openModal launchers cannot use the hostInline render environment",
|
|
2048
2130
|
path: ["render", "environment"]
|
|
2049
2131
|
});
|
|
2050
2132
|
}
|
|
2051
2133
|
if (value.action.type === "openDrawer" && value.render && !["hostOverlay", "iframe"].includes(value.render.environment)) {
|
|
2052
2134
|
ctx.addIssue({
|
|
2053
|
-
code:
|
|
2135
|
+
code: z24.ZodIssueCode.custom,
|
|
2054
2136
|
message: "openDrawer launchers must use hostOverlay or iframe render environments",
|
|
2055
2137
|
path: ["render", "environment"]
|
|
2056
2138
|
});
|
|
2057
2139
|
}
|
|
2058
2140
|
if (value.action.type === "openPopover" && value.render?.environment === "hostRoute") {
|
|
2059
2141
|
ctx.addIssue({
|
|
2060
|
-
code:
|
|
2142
|
+
code: z24.ZodIssueCode.custom,
|
|
2061
2143
|
message: "openPopover launchers cannot use the hostRoute render environment",
|
|
2062
2144
|
path: ["render", "environment"]
|
|
2063
2145
|
});
|
|
2064
2146
|
}
|
|
2065
2147
|
});
|
|
2066
|
-
pluginManifestV1Schema =
|
|
2067
|
-
id:
|
|
2148
|
+
pluginManifestV1Schema = z24.object({
|
|
2149
|
+
id: z24.string().min(1).regex(
|
|
2068
2150
|
/^[a-z0-9][a-z0-9._-]*$/,
|
|
2069
2151
|
"Plugin id must start with a lowercase alphanumeric and contain only lowercase letters, digits, dots, hyphens, or underscores"
|
|
2070
2152
|
),
|
|
2071
|
-
apiVersion:
|
|
2072
|
-
version:
|
|
2153
|
+
apiVersion: z24.literal(1),
|
|
2154
|
+
version: z24.string().min(1).regex(
|
|
2073
2155
|
/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
|
|
2074
2156
|
"Version must follow semver (e.g. 1.0.0 or 1.0.0-beta.1)"
|
|
2075
2157
|
),
|
|
2076
|
-
displayName:
|
|
2077
|
-
description:
|
|
2078
|
-
author:
|
|
2079
|
-
categories:
|
|
2080
|
-
minimumHostVersion:
|
|
2158
|
+
displayName: z24.string().min(1).max(100),
|
|
2159
|
+
description: z24.string().min(1).max(500),
|
|
2160
|
+
author: z24.string().min(1).max(200),
|
|
2161
|
+
categories: z24.array(z24.enum(PLUGIN_CATEGORIES)).min(1),
|
|
2162
|
+
minimumHostVersion: z24.string().regex(
|
|
2081
2163
|
/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
|
|
2082
2164
|
"minimumHostVersion must follow semver (e.g. 1.0.0)"
|
|
2083
2165
|
).optional(),
|
|
2084
|
-
minimumPaperclipVersion:
|
|
2166
|
+
minimumPaperclipVersion: z24.string().regex(
|
|
2085
2167
|
/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
|
|
2086
2168
|
"minimumPaperclipVersion must follow semver (e.g. 1.0.0)"
|
|
2087
2169
|
).optional(),
|
|
2088
|
-
capabilities:
|
|
2089
|
-
entrypoints:
|
|
2090
|
-
worker:
|
|
2091
|
-
ui:
|
|
2170
|
+
capabilities: z24.array(z24.enum(PLUGIN_CAPABILITIES)).min(1),
|
|
2171
|
+
entrypoints: z24.object({
|
|
2172
|
+
worker: z24.string().min(1),
|
|
2173
|
+
ui: z24.string().min(1).optional()
|
|
2092
2174
|
}),
|
|
2093
2175
|
instanceConfigSchema: jsonSchemaSchema.optional(),
|
|
2094
|
-
jobs:
|
|
2095
|
-
webhooks:
|
|
2096
|
-
tools:
|
|
2097
|
-
launchers:
|
|
2098
|
-
ui:
|
|
2099
|
-
slots:
|
|
2100
|
-
launchers:
|
|
2176
|
+
jobs: z24.array(pluginJobDeclarationSchema).optional(),
|
|
2177
|
+
webhooks: z24.array(pluginWebhookDeclarationSchema).optional(),
|
|
2178
|
+
tools: z24.array(pluginToolDeclarationSchema).optional(),
|
|
2179
|
+
launchers: z24.array(pluginLauncherDeclarationSchema).optional(),
|
|
2180
|
+
ui: z24.object({
|
|
2181
|
+
slots: z24.array(pluginUiSlotDeclarationSchema).min(1).optional(),
|
|
2182
|
+
launchers: z24.array(pluginLauncherDeclarationSchema).optional()
|
|
2101
2183
|
}).optional()
|
|
2102
2184
|
}).superRefine((manifest, ctx) => {
|
|
2103
2185
|
const hasUiSlots = (manifest.ui?.slots?.length ?? 0) > 0;
|
|
2104
2186
|
const hasUiLaunchers = (manifest.ui?.launchers?.length ?? 0) > 0;
|
|
2105
2187
|
if ((hasUiSlots || hasUiLaunchers) && !manifest.entrypoints.ui) {
|
|
2106
2188
|
ctx.addIssue({
|
|
2107
|
-
code:
|
|
2189
|
+
code: z24.ZodIssueCode.custom,
|
|
2108
2190
|
message: "entrypoints.ui is required when ui.slots or ui.launchers are declared",
|
|
2109
2191
|
path: ["entrypoints", "ui"]
|
|
2110
2192
|
});
|
|
2111
2193
|
}
|
|
2112
2194
|
if (manifest.minimumHostVersion && manifest.minimumPaperclipVersion && manifest.minimumHostVersion !== manifest.minimumPaperclipVersion) {
|
|
2113
2195
|
ctx.addIssue({
|
|
2114
|
-
code:
|
|
2196
|
+
code: z24.ZodIssueCode.custom,
|
|
2115
2197
|
message: "minimumHostVersion and minimumPaperclipVersion must match when both are declared",
|
|
2116
2198
|
path: ["minimumHostVersion"]
|
|
2117
2199
|
});
|
|
@@ -2119,7 +2201,7 @@ var init_plugin = __esm({
|
|
|
2119
2201
|
if (manifest.tools && manifest.tools.length > 0) {
|
|
2120
2202
|
if (!manifest.capabilities.includes("agent.tools.register")) {
|
|
2121
2203
|
ctx.addIssue({
|
|
2122
|
-
code:
|
|
2204
|
+
code: z24.ZodIssueCode.custom,
|
|
2123
2205
|
message: "Capability 'agent.tools.register' is required when tools are declared",
|
|
2124
2206
|
path: ["capabilities"]
|
|
2125
2207
|
});
|
|
@@ -2128,7 +2210,7 @@ var init_plugin = __esm({
|
|
|
2128
2210
|
if (manifest.jobs && manifest.jobs.length > 0) {
|
|
2129
2211
|
if (!manifest.capabilities.includes("jobs.schedule")) {
|
|
2130
2212
|
ctx.addIssue({
|
|
2131
|
-
code:
|
|
2213
|
+
code: z24.ZodIssueCode.custom,
|
|
2132
2214
|
message: "Capability 'jobs.schedule' is required when jobs are declared",
|
|
2133
2215
|
path: ["capabilities"]
|
|
2134
2216
|
});
|
|
@@ -2137,7 +2219,7 @@ var init_plugin = __esm({
|
|
|
2137
2219
|
if (manifest.webhooks && manifest.webhooks.length > 0) {
|
|
2138
2220
|
if (!manifest.capabilities.includes("webhooks.receive")) {
|
|
2139
2221
|
ctx.addIssue({
|
|
2140
|
-
code:
|
|
2222
|
+
code: z24.ZodIssueCode.custom,
|
|
2141
2223
|
message: "Capability 'webhooks.receive' is required when webhooks are declared",
|
|
2142
2224
|
path: ["capabilities"]
|
|
2143
2225
|
});
|
|
@@ -2148,7 +2230,7 @@ var init_plugin = __esm({
|
|
|
2148
2230
|
const duplicates = jobKeys.filter((key, i) => jobKeys.indexOf(key) !== i);
|
|
2149
2231
|
if (duplicates.length > 0) {
|
|
2150
2232
|
ctx.addIssue({
|
|
2151
|
-
code:
|
|
2233
|
+
code: z24.ZodIssueCode.custom,
|
|
2152
2234
|
message: `Duplicate job keys: ${[...new Set(duplicates)].join(", ")}`,
|
|
2153
2235
|
path: ["jobs"]
|
|
2154
2236
|
});
|
|
@@ -2159,7 +2241,7 @@ var init_plugin = __esm({
|
|
|
2159
2241
|
const duplicates = endpointKeys.filter((key, i) => endpointKeys.indexOf(key) !== i);
|
|
2160
2242
|
if (duplicates.length > 0) {
|
|
2161
2243
|
ctx.addIssue({
|
|
2162
|
-
code:
|
|
2244
|
+
code: z24.ZodIssueCode.custom,
|
|
2163
2245
|
message: `Duplicate webhook endpoint keys: ${[...new Set(duplicates)].join(", ")}`,
|
|
2164
2246
|
path: ["webhooks"]
|
|
2165
2247
|
});
|
|
@@ -2170,7 +2252,7 @@ var init_plugin = __esm({
|
|
|
2170
2252
|
const duplicates = toolNames.filter((name, i) => toolNames.indexOf(name) !== i);
|
|
2171
2253
|
if (duplicates.length > 0) {
|
|
2172
2254
|
ctx.addIssue({
|
|
2173
|
-
code:
|
|
2255
|
+
code: z24.ZodIssueCode.custom,
|
|
2174
2256
|
message: `Duplicate tool names: ${[...new Set(duplicates)].join(", ")}`,
|
|
2175
2257
|
path: ["tools"]
|
|
2176
2258
|
});
|
|
@@ -2182,7 +2264,7 @@ var init_plugin = __esm({
|
|
|
2182
2264
|
const duplicates = slotIds.filter((id, i) => slotIds.indexOf(id) !== i);
|
|
2183
2265
|
if (duplicates.length > 0) {
|
|
2184
2266
|
ctx.addIssue({
|
|
2185
|
-
code:
|
|
2267
|
+
code: z24.ZodIssueCode.custom,
|
|
2186
2268
|
message: `Duplicate UI slot ids: ${[...new Set(duplicates)].join(", ")}`,
|
|
2187
2269
|
path: ["ui", "slots"]
|
|
2188
2270
|
});
|
|
@@ -2198,50 +2280,50 @@ var init_plugin = __esm({
|
|
|
2198
2280
|
const duplicates = launcherIds.filter((id, i) => launcherIds.indexOf(id) !== i);
|
|
2199
2281
|
if (duplicates.length > 0) {
|
|
2200
2282
|
ctx.addIssue({
|
|
2201
|
-
code:
|
|
2283
|
+
code: z24.ZodIssueCode.custom,
|
|
2202
2284
|
message: `Duplicate launcher ids: ${[...new Set(duplicates)].join(", ")}`,
|
|
2203
2285
|
path: manifest.ui?.launchers ? ["ui", "launchers"] : ["launchers"]
|
|
2204
2286
|
});
|
|
2205
2287
|
}
|
|
2206
2288
|
}
|
|
2207
2289
|
});
|
|
2208
|
-
installPluginSchema =
|
|
2209
|
-
packageName:
|
|
2210
|
-
version:
|
|
2290
|
+
installPluginSchema = z24.object({
|
|
2291
|
+
packageName: z24.string().min(1),
|
|
2292
|
+
version: z24.string().min(1).optional(),
|
|
2211
2293
|
/** Set by loader for local-path installs so the worker can be resolved. */
|
|
2212
|
-
packagePath:
|
|
2294
|
+
packagePath: z24.string().min(1).optional()
|
|
2213
2295
|
});
|
|
2214
|
-
upsertPluginConfigSchema =
|
|
2215
|
-
configJson:
|
|
2296
|
+
upsertPluginConfigSchema = z24.object({
|
|
2297
|
+
configJson: z24.record(z24.unknown())
|
|
2216
2298
|
});
|
|
2217
|
-
patchPluginConfigSchema =
|
|
2218
|
-
configJson:
|
|
2299
|
+
patchPluginConfigSchema = z24.object({
|
|
2300
|
+
configJson: z24.record(z24.unknown())
|
|
2219
2301
|
});
|
|
2220
|
-
updatePluginStatusSchema =
|
|
2221
|
-
status:
|
|
2222
|
-
lastError:
|
|
2302
|
+
updatePluginStatusSchema = z24.object({
|
|
2303
|
+
status: z24.enum(PLUGIN_STATUSES),
|
|
2304
|
+
lastError: z24.string().nullable().optional()
|
|
2223
2305
|
});
|
|
2224
|
-
uninstallPluginSchema =
|
|
2225
|
-
removeData:
|
|
2306
|
+
uninstallPluginSchema = z24.object({
|
|
2307
|
+
removeData: z24.boolean().optional().default(false)
|
|
2226
2308
|
});
|
|
2227
|
-
pluginStateScopeKeySchema =
|
|
2228
|
-
scopeKind:
|
|
2229
|
-
scopeId:
|
|
2230
|
-
namespace:
|
|
2231
|
-
stateKey:
|
|
2309
|
+
pluginStateScopeKeySchema = z24.object({
|
|
2310
|
+
scopeKind: z24.enum(PLUGIN_STATE_SCOPE_KINDS),
|
|
2311
|
+
scopeId: z24.string().min(1).optional(),
|
|
2312
|
+
namespace: z24.string().min(1).optional(),
|
|
2313
|
+
stateKey: z24.string().min(1)
|
|
2232
2314
|
});
|
|
2233
|
-
setPluginStateSchema =
|
|
2234
|
-
scopeKind:
|
|
2235
|
-
scopeId:
|
|
2236
|
-
namespace:
|
|
2237
|
-
stateKey:
|
|
2315
|
+
setPluginStateSchema = z24.object({
|
|
2316
|
+
scopeKind: z24.enum(PLUGIN_STATE_SCOPE_KINDS),
|
|
2317
|
+
scopeId: z24.string().min(1).optional(),
|
|
2318
|
+
namespace: z24.string().min(1).optional(),
|
|
2319
|
+
stateKey: z24.string().min(1),
|
|
2238
2320
|
/** JSON-serializable value to store. */
|
|
2239
|
-
value:
|
|
2321
|
+
value: z24.unknown()
|
|
2240
2322
|
});
|
|
2241
|
-
listPluginStateSchema =
|
|
2242
|
-
scopeKind:
|
|
2243
|
-
scopeId:
|
|
2244
|
-
namespace:
|
|
2323
|
+
listPluginStateSchema = z24.object({
|
|
2324
|
+
scopeKind: z24.enum(PLUGIN_STATE_SCOPE_KINDS).optional(),
|
|
2325
|
+
scopeId: z24.string().min(1).optional(),
|
|
2326
|
+
namespace: z24.string().min(1).optional()
|
|
2245
2327
|
});
|
|
2246
2328
|
}
|
|
2247
2329
|
});
|
|
@@ -2267,6 +2349,7 @@ var init_validators = __esm({
|
|
|
2267
2349
|
init_approval();
|
|
2268
2350
|
init_secret();
|
|
2269
2351
|
init_automation();
|
|
2352
|
+
init_calendar();
|
|
2270
2353
|
init_cost();
|
|
2271
2354
|
init_finance();
|
|
2272
2355
|
init_asset();
|
|
@@ -2289,6 +2372,7 @@ var init_api = __esm({
|
|
|
2289
2372
|
issues: `${API_PREFIX}/issues`,
|
|
2290
2373
|
chats: `${API_PREFIX}/chats`,
|
|
2291
2374
|
messenger: `${API_PREFIX}/messenger`,
|
|
2375
|
+
calendar: `${API_PREFIX}/calendar`,
|
|
2292
2376
|
goals: `${API_PREFIX}/goals`,
|
|
2293
2377
|
approvals: `${API_PREFIX}/approvals`,
|
|
2294
2378
|
secrets: `${API_PREFIX}/secrets`,
|
|
@@ -2362,32 +2446,32 @@ var init_project_mentions = __esm({
|
|
|
2362
2446
|
});
|
|
2363
2447
|
|
|
2364
2448
|
// ../packages/shared/src/config-schema.ts
|
|
2365
|
-
import { z as
|
|
2449
|
+
import { z as z25 } from "zod";
|
|
2366
2450
|
var configMetaSchema, llmConfigSchema, databaseBackupConfigSchema, databaseConfigSchema, loggingConfigSchema, serverConfigSchema, authConfigSchema, storageLocalDiskConfigSchema, storageS3ConfigSchema, storageConfigSchema, secretsLocalEncryptedConfigSchema, secretsConfigSchema, langfuseConfigSchema, rudderConfigSchema;
|
|
2367
2451
|
var init_config_schema = __esm({
|
|
2368
2452
|
"../packages/shared/src/config-schema.ts"() {
|
|
2369
2453
|
"use strict";
|
|
2370
2454
|
init_constants();
|
|
2371
|
-
configMetaSchema =
|
|
2372
|
-
version:
|
|
2373
|
-
updatedAt:
|
|
2374
|
-
source:
|
|
2455
|
+
configMetaSchema = z25.object({
|
|
2456
|
+
version: z25.literal(1),
|
|
2457
|
+
updatedAt: z25.string(),
|
|
2458
|
+
source: z25.enum(["onboard", "configure", "doctor"])
|
|
2375
2459
|
});
|
|
2376
|
-
llmConfigSchema =
|
|
2377
|
-
provider:
|
|
2378
|
-
apiKey:
|
|
2460
|
+
llmConfigSchema = z25.object({
|
|
2461
|
+
provider: z25.enum(["claude", "openai"]),
|
|
2462
|
+
apiKey: z25.string().optional()
|
|
2379
2463
|
});
|
|
2380
|
-
databaseBackupConfigSchema =
|
|
2381
|
-
enabled:
|
|
2382
|
-
intervalMinutes:
|
|
2383
|
-
retentionDays:
|
|
2384
|
-
dir:
|
|
2464
|
+
databaseBackupConfigSchema = z25.object({
|
|
2465
|
+
enabled: z25.boolean().default(true),
|
|
2466
|
+
intervalMinutes: z25.number().int().min(1).max(7 * 24 * 60).default(60),
|
|
2467
|
+
retentionDays: z25.number().int().min(1).max(3650).default(30),
|
|
2468
|
+
dir: z25.string().default("~/.rudder/instances/default/data/backups")
|
|
2385
2469
|
});
|
|
2386
|
-
databaseConfigSchema =
|
|
2387
|
-
mode:
|
|
2388
|
-
connectionString:
|
|
2389
|
-
embeddedPostgresDataDir:
|
|
2390
|
-
embeddedPostgresPort:
|
|
2470
|
+
databaseConfigSchema = z25.object({
|
|
2471
|
+
mode: z25.enum(["embedded-postgres", "postgres"]).default("embedded-postgres"),
|
|
2472
|
+
connectionString: z25.string().optional(),
|
|
2473
|
+
embeddedPostgresDataDir: z25.string().default("~/.rudder/instances/default/db"),
|
|
2474
|
+
embeddedPostgresPort: z25.number().int().min(1).max(65535).default(54329),
|
|
2391
2475
|
backup: databaseBackupConfigSchema.default({
|
|
2392
2476
|
enabled: true,
|
|
2393
2477
|
intervalMinutes: 60,
|
|
@@ -2395,35 +2479,35 @@ var init_config_schema = __esm({
|
|
|
2395
2479
|
dir: "~/.rudder/instances/default/data/backups"
|
|
2396
2480
|
})
|
|
2397
2481
|
});
|
|
2398
|
-
loggingConfigSchema =
|
|
2399
|
-
mode:
|
|
2400
|
-
logDir:
|
|
2482
|
+
loggingConfigSchema = z25.object({
|
|
2483
|
+
mode: z25.enum(["file", "cloud"]),
|
|
2484
|
+
logDir: z25.string().default("~/.rudder/instances/default/logs")
|
|
2401
2485
|
});
|
|
2402
|
-
serverConfigSchema =
|
|
2403
|
-
deploymentMode:
|
|
2404
|
-
exposure:
|
|
2405
|
-
host:
|
|
2406
|
-
port:
|
|
2407
|
-
allowedHostnames:
|
|
2408
|
-
serveUi:
|
|
2486
|
+
serverConfigSchema = z25.object({
|
|
2487
|
+
deploymentMode: z25.enum(DEPLOYMENT_MODES).default("local_trusted"),
|
|
2488
|
+
exposure: z25.enum(DEPLOYMENT_EXPOSURES).default("private"),
|
|
2489
|
+
host: z25.string().default("127.0.0.1"),
|
|
2490
|
+
port: z25.number().int().min(1).max(65535).default(3100),
|
|
2491
|
+
allowedHostnames: z25.array(z25.string().min(1)).default([]),
|
|
2492
|
+
serveUi: z25.boolean().default(true)
|
|
2409
2493
|
});
|
|
2410
|
-
authConfigSchema =
|
|
2411
|
-
baseUrlMode:
|
|
2412
|
-
publicBaseUrl:
|
|
2413
|
-
disableSignUp:
|
|
2494
|
+
authConfigSchema = z25.object({
|
|
2495
|
+
baseUrlMode: z25.enum(AUTH_BASE_URL_MODES).default("auto"),
|
|
2496
|
+
publicBaseUrl: z25.string().url().optional(),
|
|
2497
|
+
disableSignUp: z25.boolean().default(false)
|
|
2414
2498
|
});
|
|
2415
|
-
storageLocalDiskConfigSchema =
|
|
2416
|
-
baseDir:
|
|
2499
|
+
storageLocalDiskConfigSchema = z25.object({
|
|
2500
|
+
baseDir: z25.string().default("~/.rudder/instances/default/data/storage")
|
|
2417
2501
|
});
|
|
2418
|
-
storageS3ConfigSchema =
|
|
2419
|
-
bucket:
|
|
2420
|
-
region:
|
|
2421
|
-
endpoint:
|
|
2422
|
-
prefix:
|
|
2423
|
-
forcePathStyle:
|
|
2502
|
+
storageS3ConfigSchema = z25.object({
|
|
2503
|
+
bucket: z25.string().min(1).default("rudder"),
|
|
2504
|
+
region: z25.string().min(1).default("us-east-1"),
|
|
2505
|
+
endpoint: z25.string().optional(),
|
|
2506
|
+
prefix: z25.string().default(""),
|
|
2507
|
+
forcePathStyle: z25.boolean().default(false)
|
|
2424
2508
|
});
|
|
2425
|
-
storageConfigSchema =
|
|
2426
|
-
provider:
|
|
2509
|
+
storageConfigSchema = z25.object({
|
|
2510
|
+
provider: z25.enum(STORAGE_PROVIDERS).default("local_disk"),
|
|
2427
2511
|
localDisk: storageLocalDiskConfigSchema.default({
|
|
2428
2512
|
baseDir: "~/.rudder/instances/default/data/storage"
|
|
2429
2513
|
}),
|
|
@@ -2434,24 +2518,24 @@ var init_config_schema = __esm({
|
|
|
2434
2518
|
forcePathStyle: false
|
|
2435
2519
|
})
|
|
2436
2520
|
});
|
|
2437
|
-
secretsLocalEncryptedConfigSchema =
|
|
2438
|
-
keyFilePath:
|
|
2521
|
+
secretsLocalEncryptedConfigSchema = z25.object({
|
|
2522
|
+
keyFilePath: z25.string().default("~/.rudder/instances/default/secrets/master.key")
|
|
2439
2523
|
});
|
|
2440
|
-
secretsConfigSchema =
|
|
2441
|
-
provider:
|
|
2442
|
-
strictMode:
|
|
2524
|
+
secretsConfigSchema = z25.object({
|
|
2525
|
+
provider: z25.enum(SECRET_PROVIDERS).default("local_encrypted"),
|
|
2526
|
+
strictMode: z25.boolean().default(false),
|
|
2443
2527
|
localEncrypted: secretsLocalEncryptedConfigSchema.default({
|
|
2444
2528
|
keyFilePath: "~/.rudder/instances/default/secrets/master.key"
|
|
2445
2529
|
})
|
|
2446
2530
|
});
|
|
2447
|
-
langfuseConfigSchema =
|
|
2448
|
-
enabled:
|
|
2449
|
-
baseUrl:
|
|
2450
|
-
publicKey:
|
|
2451
|
-
secretKey:
|
|
2452
|
-
environment:
|
|
2531
|
+
langfuseConfigSchema = z25.object({
|
|
2532
|
+
enabled: z25.boolean().default(false),
|
|
2533
|
+
baseUrl: z25.string().url().default("http://localhost:3000"),
|
|
2534
|
+
publicKey: z25.string().optional(),
|
|
2535
|
+
secretKey: z25.string().optional(),
|
|
2536
|
+
environment: z25.string().optional()
|
|
2453
2537
|
});
|
|
2454
|
-
rudderConfigSchema =
|
|
2538
|
+
rudderConfigSchema = z25.object({
|
|
2455
2539
|
$meta: configMetaSchema,
|
|
2456
2540
|
llm: llmConfigSchema.optional(),
|
|
2457
2541
|
database: databaseConfigSchema,
|
|
@@ -2485,7 +2569,7 @@ var init_config_schema = __esm({
|
|
|
2485
2569
|
if (value.server.deploymentMode === "local_trusted") {
|
|
2486
2570
|
if (value.server.exposure !== "private") {
|
|
2487
2571
|
ctx.addIssue({
|
|
2488
|
-
code:
|
|
2572
|
+
code: z25.ZodIssueCode.custom,
|
|
2489
2573
|
message: "server.exposure must be private when deploymentMode is local_trusted",
|
|
2490
2574
|
path: ["server", "exposure"]
|
|
2491
2575
|
});
|
|
@@ -2494,21 +2578,21 @@ var init_config_schema = __esm({
|
|
|
2494
2578
|
}
|
|
2495
2579
|
if (value.auth.baseUrlMode === "explicit" && !value.auth.publicBaseUrl) {
|
|
2496
2580
|
ctx.addIssue({
|
|
2497
|
-
code:
|
|
2581
|
+
code: z25.ZodIssueCode.custom,
|
|
2498
2582
|
message: "auth.publicBaseUrl is required when auth.baseUrlMode is explicit",
|
|
2499
2583
|
path: ["auth", "publicBaseUrl"]
|
|
2500
2584
|
});
|
|
2501
2585
|
}
|
|
2502
2586
|
if (value.server.exposure === "public" && value.auth.baseUrlMode !== "explicit") {
|
|
2503
2587
|
ctx.addIssue({
|
|
2504
|
-
code:
|
|
2588
|
+
code: z25.ZodIssueCode.custom,
|
|
2505
2589
|
message: "auth.baseUrlMode must be explicit when deploymentMode=authenticated and exposure=public",
|
|
2506
2590
|
path: ["auth", "baseUrlMode"]
|
|
2507
2591
|
});
|
|
2508
2592
|
}
|
|
2509
2593
|
if (value.server.exposure === "public" && !value.auth.publicBaseUrl) {
|
|
2510
2594
|
ctx.addIssue({
|
|
2511
|
-
code:
|
|
2595
|
+
code: z25.ZodIssueCode.custom,
|
|
2512
2596
|
message: "auth.publicBaseUrl is required when deploymentMode=authenticated and exposure=public",
|
|
2513
2597
|
path: ["auth", "publicBaseUrl"]
|
|
2514
2598
|
});
|
|
@@ -5173,32 +5257,178 @@ var init_chat_attachments = __esm({
|
|
|
5173
5257
|
}
|
|
5174
5258
|
});
|
|
5175
5259
|
|
|
5260
|
+
// ../packages/db/src/schema/calendar_sources.ts
|
|
5261
|
+
import { index as index36, jsonb as jsonb22, pgTable as pgTable41, text as text43, timestamp as timestamp41, uuid as uuid39 } from "drizzle-orm/pg-core";
|
|
5262
|
+
var calendarSources;
|
|
5263
|
+
var init_calendar_sources = __esm({
|
|
5264
|
+
"../packages/db/src/schema/calendar_sources.ts"() {
|
|
5265
|
+
"use strict";
|
|
5266
|
+
init_organizations();
|
|
5267
|
+
init_agents();
|
|
5268
|
+
calendarSources = pgTable41(
|
|
5269
|
+
"calendar_sources",
|
|
5270
|
+
{
|
|
5271
|
+
id: uuid39("id").primaryKey().defaultRandom(),
|
|
5272
|
+
orgId: uuid39("org_id").notNull().references(() => organizations.id),
|
|
5273
|
+
type: text43("type").notNull().default("rudder_local"),
|
|
5274
|
+
name: text43("name").notNull(),
|
|
5275
|
+
ownerType: text43("owner_type").notNull().default("user"),
|
|
5276
|
+
ownerUserId: text43("owner_user_id"),
|
|
5277
|
+
ownerAgentId: uuid39("owner_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5278
|
+
externalProvider: text43("external_provider"),
|
|
5279
|
+
externalCalendarId: text43("external_calendar_id"),
|
|
5280
|
+
visibilityDefault: text43("visibility_default").notNull().default("full"),
|
|
5281
|
+
status: text43("status").notNull().default("active"),
|
|
5282
|
+
lastSyncedAt: timestamp41("last_synced_at", { withTimezone: true }),
|
|
5283
|
+
syncCursorJson: jsonb22("sync_cursor_json").$type(),
|
|
5284
|
+
createdAt: timestamp41("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5285
|
+
updatedAt: timestamp41("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5286
|
+
},
|
|
5287
|
+
(table) => ({
|
|
5288
|
+
orgTypeIdx: index36("calendar_sources_org_type_idx").on(table.orgId, table.type),
|
|
5289
|
+
externalIdx: index36("calendar_sources_external_idx").on(
|
|
5290
|
+
table.orgId,
|
|
5291
|
+
table.externalProvider,
|
|
5292
|
+
table.externalCalendarId
|
|
5293
|
+
)
|
|
5294
|
+
})
|
|
5295
|
+
);
|
|
5296
|
+
}
|
|
5297
|
+
});
|
|
5298
|
+
|
|
5299
|
+
// ../packages/db/src/schema/activity_log.ts
|
|
5300
|
+
import { pgTable as pgTable42, uuid as uuid40, text as text44, timestamp as timestamp42, jsonb as jsonb23, index as index37 } from "drizzle-orm/pg-core";
|
|
5301
|
+
var activityLog;
|
|
5302
|
+
var init_activity_log = __esm({
|
|
5303
|
+
"../packages/db/src/schema/activity_log.ts"() {
|
|
5304
|
+
"use strict";
|
|
5305
|
+
init_organizations();
|
|
5306
|
+
init_agents();
|
|
5307
|
+
init_heartbeat_runs();
|
|
5308
|
+
activityLog = pgTable42(
|
|
5309
|
+
"activity_log",
|
|
5310
|
+
{
|
|
5311
|
+
id: uuid40("id").primaryKey().defaultRandom(),
|
|
5312
|
+
orgId: uuid40("org_id").notNull().references(() => organizations.id),
|
|
5313
|
+
actorType: text44("actor_type").notNull().default("system"),
|
|
5314
|
+
actorId: text44("actor_id").notNull(),
|
|
5315
|
+
action: text44("action").notNull(),
|
|
5316
|
+
entityType: text44("entity_type").notNull(),
|
|
5317
|
+
entityId: text44("entity_id").notNull(),
|
|
5318
|
+
agentId: uuid40("agent_id").references(() => agents.id),
|
|
5319
|
+
runId: uuid40("run_id").references(() => heartbeatRuns.id),
|
|
5320
|
+
details: jsonb23("details").$type(),
|
|
5321
|
+
createdAt: timestamp42("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
5322
|
+
},
|
|
5323
|
+
(table) => ({
|
|
5324
|
+
companyCreatedIdx: index37("activity_log_company_created_idx").on(table.orgId, table.createdAt),
|
|
5325
|
+
runIdIdx: index37("activity_log_run_id_idx").on(table.runId),
|
|
5326
|
+
entityIdx: index37("activity_log_entity_type_id_idx").on(table.entityType, table.entityId)
|
|
5327
|
+
})
|
|
5328
|
+
);
|
|
5329
|
+
}
|
|
5330
|
+
});
|
|
5331
|
+
|
|
5332
|
+
// ../packages/db/src/schema/calendar_events.ts
|
|
5333
|
+
import { index as index38, pgTable as pgTable43, text as text45, timestamp as timestamp43, uuid as uuid41, boolean as boolean8 } from "drizzle-orm/pg-core";
|
|
5334
|
+
var calendarEvents;
|
|
5335
|
+
var init_calendar_events = __esm({
|
|
5336
|
+
"../packages/db/src/schema/calendar_events.ts"() {
|
|
5337
|
+
"use strict";
|
|
5338
|
+
init_organizations();
|
|
5339
|
+
init_calendar_sources();
|
|
5340
|
+
init_agents();
|
|
5341
|
+
init_issues();
|
|
5342
|
+
init_projects();
|
|
5343
|
+
init_goals();
|
|
5344
|
+
init_approvals();
|
|
5345
|
+
init_heartbeat_runs();
|
|
5346
|
+
init_activity_log();
|
|
5347
|
+
calendarEvents = pgTable43(
|
|
5348
|
+
"calendar_events",
|
|
5349
|
+
{
|
|
5350
|
+
id: uuid41("id").primaryKey().defaultRandom(),
|
|
5351
|
+
orgId: uuid41("org_id").notNull().references(() => organizations.id),
|
|
5352
|
+
sourceId: uuid41("source_id").references(() => calendarSources.id, { onDelete: "set null" }),
|
|
5353
|
+
eventKind: text45("event_kind").notNull(),
|
|
5354
|
+
eventStatus: text45("event_status").notNull(),
|
|
5355
|
+
ownerType: text45("owner_type").notNull(),
|
|
5356
|
+
ownerUserId: text45("owner_user_id"),
|
|
5357
|
+
ownerAgentId: uuid41("owner_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5358
|
+
title: text45("title").notNull(),
|
|
5359
|
+
description: text45("description"),
|
|
5360
|
+
startAt: timestamp43("start_at", { withTimezone: true }).notNull(),
|
|
5361
|
+
endAt: timestamp43("end_at", { withTimezone: true }).notNull(),
|
|
5362
|
+
timezone: text45("timezone").notNull().default("UTC"),
|
|
5363
|
+
allDay: boolean8("all_day").notNull().default(false),
|
|
5364
|
+
visibility: text45("visibility").notNull().default("full"),
|
|
5365
|
+
issueId: uuid41("issue_id").references(() => issues.id, { onDelete: "set null" }),
|
|
5366
|
+
projectId: uuid41("project_id").references(() => projects.id, { onDelete: "set null" }),
|
|
5367
|
+
goalId: uuid41("goal_id").references(() => goals.id, { onDelete: "set null" }),
|
|
5368
|
+
approvalId: uuid41("approval_id").references(() => approvals.id, { onDelete: "set null" }),
|
|
5369
|
+
heartbeatRunId: uuid41("heartbeat_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
|
|
5370
|
+
activityId: uuid41("activity_id").references(() => activityLog.id, { onDelete: "set null" }),
|
|
5371
|
+
sourceMode: text45("source_mode").notNull().default("manual"),
|
|
5372
|
+
externalProvider: text45("external_provider"),
|
|
5373
|
+
externalCalendarId: text45("external_calendar_id"),
|
|
5374
|
+
externalEventId: text45("external_event_id"),
|
|
5375
|
+
externalEtag: text45("external_etag"),
|
|
5376
|
+
externalUpdatedAt: timestamp43("external_updated_at", { withTimezone: true }),
|
|
5377
|
+
createdByUserId: text45("created_by_user_id"),
|
|
5378
|
+
updatedByUserId: text45("updated_by_user_id"),
|
|
5379
|
+
createdAt: timestamp43("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5380
|
+
updatedAt: timestamp43("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5381
|
+
deletedAt: timestamp43("deleted_at", { withTimezone: true })
|
|
5382
|
+
},
|
|
5383
|
+
(table) => ({
|
|
5384
|
+
orgRangeIdx: index38("calendar_events_org_range_idx").on(table.orgId, table.startAt, table.endAt),
|
|
5385
|
+
orgAgentRangeIdx: index38("calendar_events_org_agent_range_idx").on(
|
|
5386
|
+
table.orgId,
|
|
5387
|
+
table.ownerAgentId,
|
|
5388
|
+
table.startAt
|
|
5389
|
+
),
|
|
5390
|
+
orgSourceRangeIdx: index38("calendar_events_org_source_range_idx").on(
|
|
5391
|
+
table.orgId,
|
|
5392
|
+
table.sourceId,
|
|
5393
|
+
table.startAt
|
|
5394
|
+
),
|
|
5395
|
+
externalIdx: index38("calendar_events_external_idx").on(
|
|
5396
|
+
table.orgId,
|
|
5397
|
+
table.externalProvider,
|
|
5398
|
+
table.externalCalendarId,
|
|
5399
|
+
table.externalEventId
|
|
5400
|
+
)
|
|
5401
|
+
})
|
|
5402
|
+
);
|
|
5403
|
+
}
|
|
5404
|
+
});
|
|
5405
|
+
|
|
5176
5406
|
// ../packages/db/src/schema/organization_secrets.ts
|
|
5177
|
-
import { pgTable as
|
|
5407
|
+
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";
|
|
5178
5408
|
var organizationSecrets;
|
|
5179
5409
|
var init_organization_secrets = __esm({
|
|
5180
5410
|
"../packages/db/src/schema/organization_secrets.ts"() {
|
|
5181
5411
|
"use strict";
|
|
5182
5412
|
init_organizations();
|
|
5183
5413
|
init_agents();
|
|
5184
|
-
organizationSecrets =
|
|
5414
|
+
organizationSecrets = pgTable44(
|
|
5185
5415
|
"organization_secrets",
|
|
5186
5416
|
{
|
|
5187
|
-
id:
|
|
5188
|
-
orgId:
|
|
5189
|
-
name:
|
|
5190
|
-
provider:
|
|
5191
|
-
externalRef:
|
|
5417
|
+
id: uuid42("id").primaryKey().defaultRandom(),
|
|
5418
|
+
orgId: uuid42("org_id").notNull().references(() => organizations.id),
|
|
5419
|
+
name: text46("name").notNull(),
|
|
5420
|
+
provider: text46("provider").notNull().default("local_encrypted"),
|
|
5421
|
+
externalRef: text46("external_ref"),
|
|
5192
5422
|
latestVersion: integer13("latest_version").notNull().default(1),
|
|
5193
|
-
description:
|
|
5194
|
-
createdByAgentId:
|
|
5195
|
-
createdByUserId:
|
|
5196
|
-
createdAt:
|
|
5197
|
-
updatedAt:
|
|
5423
|
+
description: text46("description"),
|
|
5424
|
+
createdByAgentId: uuid42("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5425
|
+
createdByUserId: text46("created_by_user_id"),
|
|
5426
|
+
createdAt: timestamp44("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5427
|
+
updatedAt: timestamp44("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5198
5428
|
},
|
|
5199
5429
|
(table) => ({
|
|
5200
|
-
organizationIdx:
|
|
5201
|
-
organizationProviderIdx:
|
|
5430
|
+
organizationIdx: index39("organization_secrets_org_idx").on(table.orgId),
|
|
5431
|
+
organizationProviderIdx: index39("organization_secrets_org_provider_idx").on(table.orgId, table.provider),
|
|
5202
5432
|
organizationNameUq: uniqueIndex24("organization_secrets_org_name_uq").on(table.orgId, table.name)
|
|
5203
5433
|
})
|
|
5204
5434
|
);
|
|
@@ -5207,15 +5437,15 @@ var init_organization_secrets = __esm({
|
|
|
5207
5437
|
|
|
5208
5438
|
// ../packages/db/src/schema/automations.ts
|
|
5209
5439
|
import {
|
|
5210
|
-
boolean as
|
|
5211
|
-
index as
|
|
5440
|
+
boolean as boolean9,
|
|
5441
|
+
index as index40,
|
|
5212
5442
|
integer as integer14,
|
|
5213
|
-
jsonb as
|
|
5214
|
-
pgTable as
|
|
5215
|
-
text as
|
|
5216
|
-
timestamp as
|
|
5443
|
+
jsonb as jsonb24,
|
|
5444
|
+
pgTable as pgTable45,
|
|
5445
|
+
text as text47,
|
|
5446
|
+
timestamp as timestamp45,
|
|
5217
5447
|
uniqueIndex as uniqueIndex25,
|
|
5218
|
-
uuid as
|
|
5448
|
+
uuid as uuid43
|
|
5219
5449
|
} from "drizzle-orm/pg-core";
|
|
5220
5450
|
var automations, automationTriggers, automationRuns;
|
|
5221
5451
|
var init_automations = __esm({
|
|
@@ -5227,94 +5457,94 @@ var init_automations = __esm({
|
|
|
5227
5457
|
init_issues();
|
|
5228
5458
|
init_projects();
|
|
5229
5459
|
init_goals();
|
|
5230
|
-
automations =
|
|
5460
|
+
automations = pgTable45(
|
|
5231
5461
|
"automations",
|
|
5232
5462
|
{
|
|
5233
|
-
id:
|
|
5234
|
-
orgId:
|
|
5235
|
-
projectId:
|
|
5236
|
-
goalId:
|
|
5237
|
-
parentIssueId:
|
|
5238
|
-
title:
|
|
5239
|
-
description:
|
|
5240
|
-
assigneeAgentId:
|
|
5241
|
-
priority:
|
|
5242
|
-
status:
|
|
5243
|
-
concurrencyPolicy:
|
|
5244
|
-
catchUpPolicy:
|
|
5245
|
-
createdByAgentId:
|
|
5246
|
-
createdByUserId:
|
|
5247
|
-
updatedByAgentId:
|
|
5248
|
-
updatedByUserId:
|
|
5249
|
-
lastTriggeredAt:
|
|
5250
|
-
lastEnqueuedAt:
|
|
5251
|
-
createdAt:
|
|
5252
|
-
updatedAt:
|
|
5463
|
+
id: uuid43("id").primaryKey().defaultRandom(),
|
|
5464
|
+
orgId: uuid43("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
5465
|
+
projectId: uuid43("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
|
|
5466
|
+
goalId: uuid43("goal_id").references(() => goals.id, { onDelete: "set null" }),
|
|
5467
|
+
parentIssueId: uuid43("parent_issue_id").references(() => issues.id, { onDelete: "set null" }),
|
|
5468
|
+
title: text47("title").notNull(),
|
|
5469
|
+
description: text47("description"),
|
|
5470
|
+
assigneeAgentId: uuid43("assignee_agent_id").notNull().references(() => agents.id),
|
|
5471
|
+
priority: text47("priority").notNull().default("medium"),
|
|
5472
|
+
status: text47("status").notNull().default("active"),
|
|
5473
|
+
concurrencyPolicy: text47("concurrency_policy").notNull().default("coalesce_if_active"),
|
|
5474
|
+
catchUpPolicy: text47("catch_up_policy").notNull().default("skip_missed"),
|
|
5475
|
+
createdByAgentId: uuid43("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5476
|
+
createdByUserId: text47("created_by_user_id"),
|
|
5477
|
+
updatedByAgentId: uuid43("updated_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5478
|
+
updatedByUserId: text47("updated_by_user_id"),
|
|
5479
|
+
lastTriggeredAt: timestamp45("last_triggered_at", { withTimezone: true }),
|
|
5480
|
+
lastEnqueuedAt: timestamp45("last_enqueued_at", { withTimezone: true }),
|
|
5481
|
+
createdAt: timestamp45("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5482
|
+
updatedAt: timestamp45("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5253
5483
|
},
|
|
5254
5484
|
(table) => ({
|
|
5255
|
-
companyStatusIdx:
|
|
5256
|
-
companyAssigneeIdx:
|
|
5257
|
-
companyProjectIdx:
|
|
5485
|
+
companyStatusIdx: index40("automations_company_status_idx").on(table.orgId, table.status),
|
|
5486
|
+
companyAssigneeIdx: index40("automations_company_assignee_idx").on(table.orgId, table.assigneeAgentId),
|
|
5487
|
+
companyProjectIdx: index40("automations_company_project_idx").on(table.orgId, table.projectId)
|
|
5258
5488
|
})
|
|
5259
5489
|
);
|
|
5260
|
-
automationTriggers =
|
|
5490
|
+
automationTriggers = pgTable45(
|
|
5261
5491
|
"automation_triggers",
|
|
5262
5492
|
{
|
|
5263
|
-
id:
|
|
5264
|
-
orgId:
|
|
5265
|
-
automationId:
|
|
5266
|
-
kind:
|
|
5267
|
-
label:
|
|
5268
|
-
enabled:
|
|
5269
|
-
cronExpression:
|
|
5270
|
-
timezone:
|
|
5271
|
-
nextRunAt:
|
|
5272
|
-
lastFiredAt:
|
|
5273
|
-
publicId:
|
|
5274
|
-
secretId:
|
|
5275
|
-
signingMode:
|
|
5493
|
+
id: uuid43("id").primaryKey().defaultRandom(),
|
|
5494
|
+
orgId: uuid43("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
5495
|
+
automationId: uuid43("automation_id").notNull().references(() => automations.id, { onDelete: "cascade" }),
|
|
5496
|
+
kind: text47("kind").notNull(),
|
|
5497
|
+
label: text47("label"),
|
|
5498
|
+
enabled: boolean9("enabled").notNull().default(true),
|
|
5499
|
+
cronExpression: text47("cron_expression"),
|
|
5500
|
+
timezone: text47("timezone"),
|
|
5501
|
+
nextRunAt: timestamp45("next_run_at", { withTimezone: true }),
|
|
5502
|
+
lastFiredAt: timestamp45("last_fired_at", { withTimezone: true }),
|
|
5503
|
+
publicId: text47("public_id"),
|
|
5504
|
+
secretId: uuid43("secret_id").references(() => organizationSecrets.id, { onDelete: "set null" }),
|
|
5505
|
+
signingMode: text47("signing_mode"),
|
|
5276
5506
|
replayWindowSec: integer14("replay_window_sec"),
|
|
5277
|
-
lastRotatedAt:
|
|
5278
|
-
lastResult:
|
|
5279
|
-
createdByAgentId:
|
|
5280
|
-
createdByUserId:
|
|
5281
|
-
updatedByAgentId:
|
|
5282
|
-
updatedByUserId:
|
|
5283
|
-
createdAt:
|
|
5284
|
-
updatedAt:
|
|
5507
|
+
lastRotatedAt: timestamp45("last_rotated_at", { withTimezone: true }),
|
|
5508
|
+
lastResult: text47("last_result"),
|
|
5509
|
+
createdByAgentId: uuid43("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5510
|
+
createdByUserId: text47("created_by_user_id"),
|
|
5511
|
+
updatedByAgentId: uuid43("updated_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5512
|
+
updatedByUserId: text47("updated_by_user_id"),
|
|
5513
|
+
createdAt: timestamp45("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5514
|
+
updatedAt: timestamp45("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5285
5515
|
},
|
|
5286
5516
|
(table) => ({
|
|
5287
|
-
companyAutomationIdx:
|
|
5288
|
-
companyKindIdx:
|
|
5289
|
-
nextRunIdx:
|
|
5290
|
-
publicIdIdx:
|
|
5517
|
+
companyAutomationIdx: index40("automation_triggers_company_automation_idx").on(table.orgId, table.automationId),
|
|
5518
|
+
companyKindIdx: index40("automation_triggers_company_kind_idx").on(table.orgId, table.kind),
|
|
5519
|
+
nextRunIdx: index40("automation_triggers_next_run_idx").on(table.nextRunAt),
|
|
5520
|
+
publicIdIdx: index40("automation_triggers_public_id_idx").on(table.publicId),
|
|
5291
5521
|
publicIdUq: uniqueIndex25("automation_triggers_public_id_uq").on(table.publicId)
|
|
5292
5522
|
})
|
|
5293
5523
|
);
|
|
5294
|
-
automationRuns =
|
|
5524
|
+
automationRuns = pgTable45(
|
|
5295
5525
|
"automation_runs",
|
|
5296
5526
|
{
|
|
5297
|
-
id:
|
|
5298
|
-
orgId:
|
|
5299
|
-
automationId:
|
|
5300
|
-
triggerId:
|
|
5301
|
-
source:
|
|
5302
|
-
status:
|
|
5303
|
-
triggeredAt:
|
|
5304
|
-
idempotencyKey:
|
|
5305
|
-
triggerPayload:
|
|
5306
|
-
linkedIssueId:
|
|
5307
|
-
coalescedIntoRunId:
|
|
5308
|
-
failureReason:
|
|
5309
|
-
completedAt:
|
|
5310
|
-
createdAt:
|
|
5311
|
-
updatedAt:
|
|
5527
|
+
id: uuid43("id").primaryKey().defaultRandom(),
|
|
5528
|
+
orgId: uuid43("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
5529
|
+
automationId: uuid43("automation_id").notNull().references(() => automations.id, { onDelete: "cascade" }),
|
|
5530
|
+
triggerId: uuid43("trigger_id").references(() => automationTriggers.id, { onDelete: "set null" }),
|
|
5531
|
+
source: text47("source").notNull(),
|
|
5532
|
+
status: text47("status").notNull().default("received"),
|
|
5533
|
+
triggeredAt: timestamp45("triggered_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5534
|
+
idempotencyKey: text47("idempotency_key"),
|
|
5535
|
+
triggerPayload: jsonb24("trigger_payload").$type(),
|
|
5536
|
+
linkedIssueId: uuid43("linked_issue_id").references(() => issues.id, { onDelete: "set null" }),
|
|
5537
|
+
coalescedIntoRunId: uuid43("coalesced_into_run_id"),
|
|
5538
|
+
failureReason: text47("failure_reason"),
|
|
5539
|
+
completedAt: timestamp45("completed_at", { withTimezone: true }),
|
|
5540
|
+
createdAt: timestamp45("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5541
|
+
updatedAt: timestamp45("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5312
5542
|
},
|
|
5313
5543
|
(table) => ({
|
|
5314
|
-
companyAutomationIdx:
|
|
5315
|
-
triggerIdx:
|
|
5316
|
-
linkedIssueIdx:
|
|
5317
|
-
idempotencyIdx:
|
|
5544
|
+
companyAutomationIdx: index40("automation_runs_company_automation_idx").on(table.orgId, table.automationId, table.createdAt),
|
|
5545
|
+
triggerIdx: index40("automation_runs_trigger_idx").on(table.triggerId, table.createdAt),
|
|
5546
|
+
linkedIssueIdx: index40("automation_runs_linked_issue_idx").on(table.linkedIssueId),
|
|
5547
|
+
idempotencyIdx: index40("automation_runs_trigger_idempotency_idx").on(table.triggerId, table.idempotencyKey)
|
|
5318
5548
|
})
|
|
5319
5549
|
);
|
|
5320
5550
|
}
|
|
@@ -5322,13 +5552,13 @@ var init_automations = __esm({
|
|
|
5322
5552
|
|
|
5323
5553
|
// ../packages/db/src/schema/issue_work_products.ts
|
|
5324
5554
|
import {
|
|
5325
|
-
boolean as
|
|
5326
|
-
index as
|
|
5327
|
-
jsonb as
|
|
5328
|
-
pgTable as
|
|
5329
|
-
text as
|
|
5330
|
-
timestamp as
|
|
5331
|
-
uuid as
|
|
5555
|
+
boolean as boolean10,
|
|
5556
|
+
index as index41,
|
|
5557
|
+
jsonb as jsonb25,
|
|
5558
|
+
pgTable as pgTable46,
|
|
5559
|
+
text as text48,
|
|
5560
|
+
timestamp as timestamp46,
|
|
5561
|
+
uuid as uuid44
|
|
5332
5562
|
} from "drizzle-orm/pg-core";
|
|
5333
5563
|
var issueWorkProducts;
|
|
5334
5564
|
var init_issue_work_products = __esm({
|
|
@@ -5340,47 +5570,47 @@ var init_issue_work_products = __esm({
|
|
|
5340
5570
|
init_issues();
|
|
5341
5571
|
init_projects();
|
|
5342
5572
|
init_workspace_runtime_services();
|
|
5343
|
-
issueWorkProducts =
|
|
5573
|
+
issueWorkProducts = pgTable46(
|
|
5344
5574
|
"issue_work_products",
|
|
5345
5575
|
{
|
|
5346
|
-
id:
|
|
5347
|
-
orgId:
|
|
5348
|
-
projectId:
|
|
5349
|
-
issueId:
|
|
5350
|
-
executionWorkspaceId:
|
|
5351
|
-
runtimeServiceId:
|
|
5352
|
-
type:
|
|
5353
|
-
provider:
|
|
5354
|
-
externalId:
|
|
5355
|
-
title:
|
|
5356
|
-
url:
|
|
5357
|
-
status:
|
|
5358
|
-
reviewState:
|
|
5359
|
-
isPrimary:
|
|
5360
|
-
healthStatus:
|
|
5361
|
-
summary:
|
|
5362
|
-
metadata:
|
|
5363
|
-
createdByRunId:
|
|
5364
|
-
createdAt:
|
|
5365
|
-
updatedAt:
|
|
5576
|
+
id: uuid44("id").primaryKey().defaultRandom(),
|
|
5577
|
+
orgId: uuid44("org_id").notNull().references(() => organizations.id),
|
|
5578
|
+
projectId: uuid44("project_id").references(() => projects.id, { onDelete: "set null" }),
|
|
5579
|
+
issueId: uuid44("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
|
|
5580
|
+
executionWorkspaceId: uuid44("execution_workspace_id").references(() => executionWorkspaces.id, { onDelete: "set null" }),
|
|
5581
|
+
runtimeServiceId: uuid44("runtime_service_id").references(() => workspaceRuntimeServices.id, { onDelete: "set null" }),
|
|
5582
|
+
type: text48("type").notNull(),
|
|
5583
|
+
provider: text48("provider").notNull(),
|
|
5584
|
+
externalId: text48("external_id"),
|
|
5585
|
+
title: text48("title").notNull(),
|
|
5586
|
+
url: text48("url"),
|
|
5587
|
+
status: text48("status").notNull(),
|
|
5588
|
+
reviewState: text48("review_state").notNull().default("none"),
|
|
5589
|
+
isPrimary: boolean10("is_primary").notNull().default(false),
|
|
5590
|
+
healthStatus: text48("health_status").notNull().default("unknown"),
|
|
5591
|
+
summary: text48("summary"),
|
|
5592
|
+
metadata: jsonb25("metadata").$type(),
|
|
5593
|
+
createdByRunId: uuid44("created_by_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
|
|
5594
|
+
createdAt: timestamp46("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5595
|
+
updatedAt: timestamp46("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5366
5596
|
},
|
|
5367
5597
|
(table) => ({
|
|
5368
|
-
companyIssueTypeIdx:
|
|
5598
|
+
companyIssueTypeIdx: index41("issue_work_products_company_issue_type_idx").on(
|
|
5369
5599
|
table.orgId,
|
|
5370
5600
|
table.issueId,
|
|
5371
5601
|
table.type
|
|
5372
5602
|
),
|
|
5373
|
-
companyExecutionWorkspaceTypeIdx:
|
|
5603
|
+
companyExecutionWorkspaceTypeIdx: index41("issue_work_products_company_execution_workspace_type_idx").on(
|
|
5374
5604
|
table.orgId,
|
|
5375
5605
|
table.executionWorkspaceId,
|
|
5376
5606
|
table.type
|
|
5377
5607
|
),
|
|
5378
|
-
companyProviderExternalIdIdx:
|
|
5608
|
+
companyProviderExternalIdIdx: index41("issue_work_products_company_provider_external_id_idx").on(
|
|
5379
5609
|
table.orgId,
|
|
5380
5610
|
table.provider,
|
|
5381
5611
|
table.externalId
|
|
5382
5612
|
),
|
|
5383
|
-
companyUpdatedIdx:
|
|
5613
|
+
companyUpdatedIdx: index41("issue_work_products_company_updated_idx").on(
|
|
5384
5614
|
table.orgId,
|
|
5385
5615
|
table.updatedAt
|
|
5386
5616
|
)
|
|
@@ -5390,24 +5620,24 @@ var init_issue_work_products = __esm({
|
|
|
5390
5620
|
});
|
|
5391
5621
|
|
|
5392
5622
|
// ../packages/db/src/schema/labels.ts
|
|
5393
|
-
import { pgTable as
|
|
5623
|
+
import { pgTable as pgTable47, uuid as uuid45, text as text49, timestamp as timestamp47, index as index42, uniqueIndex as uniqueIndex26 } from "drizzle-orm/pg-core";
|
|
5394
5624
|
var labels;
|
|
5395
5625
|
var init_labels = __esm({
|
|
5396
5626
|
"../packages/db/src/schema/labels.ts"() {
|
|
5397
5627
|
"use strict";
|
|
5398
5628
|
init_organizations();
|
|
5399
|
-
labels =
|
|
5629
|
+
labels = pgTable47(
|
|
5400
5630
|
"labels",
|
|
5401
5631
|
{
|
|
5402
|
-
id:
|
|
5403
|
-
orgId:
|
|
5404
|
-
name:
|
|
5405
|
-
color:
|
|
5406
|
-
createdAt:
|
|
5407
|
-
updatedAt:
|
|
5632
|
+
id: uuid45("id").primaryKey().defaultRandom(),
|
|
5633
|
+
orgId: uuid45("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
5634
|
+
name: text49("name").notNull(),
|
|
5635
|
+
color: text49("color").notNull(),
|
|
5636
|
+
createdAt: timestamp47("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5637
|
+
updatedAt: timestamp47("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5408
5638
|
},
|
|
5409
5639
|
(table) => ({
|
|
5410
|
-
orgIdx:
|
|
5640
|
+
orgIdx: index42("labels_company_idx").on(table.orgId),
|
|
5411
5641
|
orgNameIdx: uniqueIndex26("labels_company_name_idx").on(table.orgId, table.name)
|
|
5412
5642
|
})
|
|
5413
5643
|
);
|
|
@@ -5415,7 +5645,7 @@ var init_labels = __esm({
|
|
|
5415
5645
|
});
|
|
5416
5646
|
|
|
5417
5647
|
// ../packages/db/src/schema/issue_labels.ts
|
|
5418
|
-
import { pgTable as
|
|
5648
|
+
import { pgTable as pgTable48, uuid as uuid46, timestamp as timestamp48, index as index43, primaryKey as primaryKey2 } from "drizzle-orm/pg-core";
|
|
5419
5649
|
var issueLabels;
|
|
5420
5650
|
var init_issue_labels = __esm({
|
|
5421
5651
|
"../packages/db/src/schema/issue_labels.ts"() {
|
|
@@ -5423,26 +5653,26 @@ var init_issue_labels = __esm({
|
|
|
5423
5653
|
init_organizations();
|
|
5424
5654
|
init_issues();
|
|
5425
5655
|
init_labels();
|
|
5426
|
-
issueLabels =
|
|
5656
|
+
issueLabels = pgTable48(
|
|
5427
5657
|
"issue_labels",
|
|
5428
5658
|
{
|
|
5429
|
-
issueId:
|
|
5430
|
-
labelId:
|
|
5431
|
-
orgId:
|
|
5432
|
-
createdAt:
|
|
5659
|
+
issueId: uuid46("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
|
|
5660
|
+
labelId: uuid46("label_id").notNull().references(() => labels.id, { onDelete: "cascade" }),
|
|
5661
|
+
orgId: uuid46("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
5662
|
+
createdAt: timestamp48("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
5433
5663
|
},
|
|
5434
5664
|
(table) => ({
|
|
5435
5665
|
pk: primaryKey2({ columns: [table.issueId, table.labelId], name: "issue_labels_pk" }),
|
|
5436
|
-
issueIdx:
|
|
5437
|
-
labelIdx:
|
|
5438
|
-
orgIdx:
|
|
5666
|
+
issueIdx: index43("issue_labels_issue_idx").on(table.issueId),
|
|
5667
|
+
labelIdx: index43("issue_labels_label_idx").on(table.labelId),
|
|
5668
|
+
orgIdx: index43("issue_labels_company_idx").on(table.orgId)
|
|
5439
5669
|
})
|
|
5440
5670
|
);
|
|
5441
5671
|
}
|
|
5442
5672
|
});
|
|
5443
5673
|
|
|
5444
5674
|
// ../packages/db/src/schema/issue_approvals.ts
|
|
5445
|
-
import { pgTable as
|
|
5675
|
+
import { pgTable as pgTable49, uuid as uuid47, text as text50, timestamp as timestamp49, index as index44, primaryKey as primaryKey3 } from "drizzle-orm/pg-core";
|
|
5446
5676
|
var issueApprovals;
|
|
5447
5677
|
var init_issue_approvals = __esm({
|
|
5448
5678
|
"../packages/db/src/schema/issue_approvals.ts"() {
|
|
@@ -5451,28 +5681,28 @@ var init_issue_approvals = __esm({
|
|
|
5451
5681
|
init_issues();
|
|
5452
5682
|
init_approvals();
|
|
5453
5683
|
init_agents();
|
|
5454
|
-
issueApprovals =
|
|
5684
|
+
issueApprovals = pgTable49(
|
|
5455
5685
|
"issue_approvals",
|
|
5456
5686
|
{
|
|
5457
|
-
orgId:
|
|
5458
|
-
issueId:
|
|
5459
|
-
approvalId:
|
|
5460
|
-
linkedByAgentId:
|
|
5461
|
-
linkedByUserId:
|
|
5462
|
-
createdAt:
|
|
5687
|
+
orgId: uuid47("org_id").notNull().references(() => organizations.id),
|
|
5688
|
+
issueId: uuid47("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
|
|
5689
|
+
approvalId: uuid47("approval_id").notNull().references(() => approvals.id, { onDelete: "cascade" }),
|
|
5690
|
+
linkedByAgentId: uuid47("linked_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5691
|
+
linkedByUserId: text50("linked_by_user_id"),
|
|
5692
|
+
createdAt: timestamp49("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
5463
5693
|
},
|
|
5464
5694
|
(table) => ({
|
|
5465
5695
|
pk: primaryKey3({ columns: [table.issueId, table.approvalId], name: "issue_approvals_pk" }),
|
|
5466
|
-
issueIdx:
|
|
5467
|
-
approvalIdx:
|
|
5468
|
-
orgIdx:
|
|
5696
|
+
issueIdx: index44("issue_approvals_issue_idx").on(table.issueId),
|
|
5697
|
+
approvalIdx: index44("issue_approvals_approval_idx").on(table.approvalId),
|
|
5698
|
+
orgIdx: index44("issue_approvals_company_idx").on(table.orgId)
|
|
5469
5699
|
})
|
|
5470
5700
|
);
|
|
5471
5701
|
}
|
|
5472
5702
|
});
|
|
5473
5703
|
|
|
5474
5704
|
// ../packages/db/src/schema/issue_comments.ts
|
|
5475
|
-
import { pgTable as
|
|
5705
|
+
import { pgTable as pgTable50, uuid as uuid48, text as text51, timestamp as timestamp50, index as index45 } from "drizzle-orm/pg-core";
|
|
5476
5706
|
var issueComments;
|
|
5477
5707
|
var init_issue_comments = __esm({
|
|
5478
5708
|
"../packages/db/src/schema/issue_comments.ts"() {
|
|
@@ -5480,27 +5710,27 @@ var init_issue_comments = __esm({
|
|
|
5480
5710
|
init_organizations();
|
|
5481
5711
|
init_issues();
|
|
5482
5712
|
init_agents();
|
|
5483
|
-
issueComments =
|
|
5713
|
+
issueComments = pgTable50(
|
|
5484
5714
|
"issue_comments",
|
|
5485
5715
|
{
|
|
5486
|
-
id:
|
|
5487
|
-
orgId:
|
|
5488
|
-
issueId:
|
|
5489
|
-
authorAgentId:
|
|
5490
|
-
authorUserId:
|
|
5491
|
-
body:
|
|
5492
|
-
createdAt:
|
|
5493
|
-
updatedAt:
|
|
5716
|
+
id: uuid48("id").primaryKey().defaultRandom(),
|
|
5717
|
+
orgId: uuid48("org_id").notNull().references(() => organizations.id),
|
|
5718
|
+
issueId: uuid48("issue_id").notNull().references(() => issues.id),
|
|
5719
|
+
authorAgentId: uuid48("author_agent_id").references(() => agents.id),
|
|
5720
|
+
authorUserId: text51("author_user_id"),
|
|
5721
|
+
body: text51("body").notNull(),
|
|
5722
|
+
createdAt: timestamp50("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5723
|
+
updatedAt: timestamp50("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5494
5724
|
},
|
|
5495
5725
|
(table) => ({
|
|
5496
|
-
issueIdx:
|
|
5497
|
-
orgIdx:
|
|
5498
|
-
orgIssueCreatedAtIdx:
|
|
5726
|
+
issueIdx: index45("issue_comments_issue_idx").on(table.issueId),
|
|
5727
|
+
orgIdx: index45("issue_comments_company_idx").on(table.orgId),
|
|
5728
|
+
orgIssueCreatedAtIdx: index45("issue_comments_company_issue_created_at_idx").on(
|
|
5499
5729
|
table.orgId,
|
|
5500
5730
|
table.issueId,
|
|
5501
5731
|
table.createdAt
|
|
5502
5732
|
),
|
|
5503
|
-
orgAuthorIssueCreatedAtIdx:
|
|
5733
|
+
orgAuthorIssueCreatedAtIdx: index45("issue_comments_company_author_issue_created_at_idx").on(
|
|
5504
5734
|
table.orgId,
|
|
5505
5735
|
table.authorUserId,
|
|
5506
5736
|
table.issueId,
|
|
@@ -5512,27 +5742,27 @@ var init_issue_comments = __esm({
|
|
|
5512
5742
|
});
|
|
5513
5743
|
|
|
5514
5744
|
// ../packages/db/src/schema/issue_read_states.ts
|
|
5515
|
-
import { pgTable as
|
|
5745
|
+
import { pgTable as pgTable51, uuid as uuid49, text as text52, timestamp as timestamp51, index as index46, uniqueIndex as uniqueIndex27 } from "drizzle-orm/pg-core";
|
|
5516
5746
|
var issueReadStates;
|
|
5517
5747
|
var init_issue_read_states = __esm({
|
|
5518
5748
|
"../packages/db/src/schema/issue_read_states.ts"() {
|
|
5519
5749
|
"use strict";
|
|
5520
5750
|
init_organizations();
|
|
5521
5751
|
init_issues();
|
|
5522
|
-
issueReadStates =
|
|
5752
|
+
issueReadStates = pgTable51(
|
|
5523
5753
|
"issue_read_states",
|
|
5524
5754
|
{
|
|
5525
|
-
id:
|
|
5526
|
-
orgId:
|
|
5527
|
-
issueId:
|
|
5528
|
-
userId:
|
|
5529
|
-
lastReadAt:
|
|
5530
|
-
createdAt:
|
|
5531
|
-
updatedAt:
|
|
5755
|
+
id: uuid49("id").primaryKey().defaultRandom(),
|
|
5756
|
+
orgId: uuid49("org_id").notNull().references(() => organizations.id),
|
|
5757
|
+
issueId: uuid49("issue_id").notNull().references(() => issues.id),
|
|
5758
|
+
userId: text52("user_id").notNull(),
|
|
5759
|
+
lastReadAt: timestamp51("last_read_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5760
|
+
createdAt: timestamp51("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5761
|
+
updatedAt: timestamp51("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5532
5762
|
},
|
|
5533
5763
|
(table) => ({
|
|
5534
|
-
companyIssueIdx:
|
|
5535
|
-
companyUserIdx:
|
|
5764
|
+
companyIssueIdx: index46("issue_read_states_company_issue_idx").on(table.orgId, table.issueId),
|
|
5765
|
+
companyUserIdx: index46("issue_read_states_company_user_idx").on(table.orgId, table.userId),
|
|
5536
5766
|
companyIssueUserUnique: uniqueIndex27("issue_read_states_company_issue_user_idx").on(
|
|
5537
5767
|
table.orgId,
|
|
5538
5768
|
table.issueId,
|
|
@@ -5544,26 +5774,26 @@ var init_issue_read_states = __esm({
|
|
|
5544
5774
|
});
|
|
5545
5775
|
|
|
5546
5776
|
// ../packages/db/src/schema/messenger_thread_user_states.ts
|
|
5547
|
-
import { index as
|
|
5777
|
+
import { index as index47, pgTable as pgTable52, text as text53, timestamp as timestamp52, uniqueIndex as uniqueIndex28, uuid as uuid50 } from "drizzle-orm/pg-core";
|
|
5548
5778
|
var messengerThreadUserStates;
|
|
5549
5779
|
var init_messenger_thread_user_states = __esm({
|
|
5550
5780
|
"../packages/db/src/schema/messenger_thread_user_states.ts"() {
|
|
5551
5781
|
"use strict";
|
|
5552
5782
|
init_organizations();
|
|
5553
|
-
messengerThreadUserStates =
|
|
5783
|
+
messengerThreadUserStates = pgTable52(
|
|
5554
5784
|
"messenger_thread_user_states",
|
|
5555
5785
|
{
|
|
5556
|
-
id:
|
|
5557
|
-
orgId:
|
|
5558
|
-
userId:
|
|
5559
|
-
threadKey:
|
|
5560
|
-
lastReadAt:
|
|
5561
|
-
createdAt:
|
|
5562
|
-
updatedAt:
|
|
5786
|
+
id: uuid50("id").primaryKey().defaultRandom(),
|
|
5787
|
+
orgId: uuid50("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
5788
|
+
userId: text53("user_id").notNull(),
|
|
5789
|
+
threadKey: text53("thread_key").notNull(),
|
|
5790
|
+
lastReadAt: timestamp52("last_read_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5791
|
+
createdAt: timestamp52("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5792
|
+
updatedAt: timestamp52("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5563
5793
|
},
|
|
5564
5794
|
(table) => ({
|
|
5565
|
-
orgUserIdx:
|
|
5566
|
-
orgThreadIdx:
|
|
5795
|
+
orgUserIdx: index47("messenger_thread_user_states_org_user_idx").on(table.orgId, table.userId),
|
|
5796
|
+
orgThreadIdx: index47("messenger_thread_user_states_org_thread_idx").on(table.orgId, table.threadKey),
|
|
5567
5797
|
orgThreadUserUnique: uniqueIndex28("messenger_thread_user_states_org_thread_user_idx").on(
|
|
5568
5798
|
table.orgId,
|
|
5569
5799
|
table.threadKey,
|
|
@@ -5575,7 +5805,7 @@ var init_messenger_thread_user_states = __esm({
|
|
|
5575
5805
|
});
|
|
5576
5806
|
|
|
5577
5807
|
// ../packages/db/src/schema/issue_attachments.ts
|
|
5578
|
-
import { pgTable as
|
|
5808
|
+
import { pgTable as pgTable53, uuid as uuid51, timestamp as timestamp53, index as index48, uniqueIndex as uniqueIndex29, text as text54 } from "drizzle-orm/pg-core";
|
|
5579
5809
|
var issueAttachments;
|
|
5580
5810
|
var init_issue_attachments = __esm({
|
|
5581
5811
|
"../packages/db/src/schema/issue_attachments.ts"() {
|
|
@@ -5584,22 +5814,22 @@ var init_issue_attachments = __esm({
|
|
|
5584
5814
|
init_issues();
|
|
5585
5815
|
init_assets();
|
|
5586
5816
|
init_issue_comments();
|
|
5587
|
-
issueAttachments =
|
|
5817
|
+
issueAttachments = pgTable53(
|
|
5588
5818
|
"issue_attachments",
|
|
5589
5819
|
{
|
|
5590
|
-
id:
|
|
5591
|
-
orgId:
|
|
5592
|
-
issueId:
|
|
5593
|
-
assetId:
|
|
5594
|
-
issueCommentId:
|
|
5595
|
-
usage:
|
|
5596
|
-
createdAt:
|
|
5597
|
-
updatedAt:
|
|
5820
|
+
id: uuid51("id").primaryKey().defaultRandom(),
|
|
5821
|
+
orgId: uuid51("org_id").notNull().references(() => organizations.id),
|
|
5822
|
+
issueId: uuid51("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
|
|
5823
|
+
assetId: uuid51("asset_id").notNull().references(() => assets.id, { onDelete: "cascade" }),
|
|
5824
|
+
issueCommentId: uuid51("issue_comment_id").references(() => issueComments.id, { onDelete: "set null" }),
|
|
5825
|
+
usage: text54("usage").notNull().default("issue"),
|
|
5826
|
+
createdAt: timestamp53("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5827
|
+
updatedAt: timestamp53("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5598
5828
|
},
|
|
5599
5829
|
(table) => ({
|
|
5600
|
-
companyIssueIdx:
|
|
5601
|
-
issueCommentIdx:
|
|
5602
|
-
usageIdx:
|
|
5830
|
+
companyIssueIdx: index48("issue_attachments_company_issue_idx").on(table.orgId, table.issueId),
|
|
5831
|
+
issueCommentIdx: index48("issue_attachments_issue_comment_idx").on(table.issueCommentId),
|
|
5832
|
+
usageIdx: index48("issue_attachments_usage_idx").on(table.usage),
|
|
5603
5833
|
assetUq: uniqueIndex29("issue_attachments_asset_uq").on(table.assetId)
|
|
5604
5834
|
})
|
|
5605
5835
|
);
|
|
@@ -5607,40 +5837,40 @@ var init_issue_attachments = __esm({
|
|
|
5607
5837
|
});
|
|
5608
5838
|
|
|
5609
5839
|
// ../packages/db/src/schema/documents.ts
|
|
5610
|
-
import { pgTable as
|
|
5840
|
+
import { pgTable as pgTable54, uuid as uuid52, text as text55, integer as integer15, timestamp as timestamp54, index as index49 } from "drizzle-orm/pg-core";
|
|
5611
5841
|
var documents;
|
|
5612
5842
|
var init_documents = __esm({
|
|
5613
5843
|
"../packages/db/src/schema/documents.ts"() {
|
|
5614
5844
|
"use strict";
|
|
5615
5845
|
init_organizations();
|
|
5616
5846
|
init_agents();
|
|
5617
|
-
documents =
|
|
5847
|
+
documents = pgTable54(
|
|
5618
5848
|
"documents",
|
|
5619
5849
|
{
|
|
5620
|
-
id:
|
|
5621
|
-
orgId:
|
|
5622
|
-
title:
|
|
5623
|
-
format:
|
|
5624
|
-
latestBody:
|
|
5625
|
-
latestRevisionId:
|
|
5850
|
+
id: uuid52("id").primaryKey().defaultRandom(),
|
|
5851
|
+
orgId: uuid52("org_id").notNull().references(() => organizations.id),
|
|
5852
|
+
title: text55("title"),
|
|
5853
|
+
format: text55("format").notNull().default("markdown"),
|
|
5854
|
+
latestBody: text55("latest_body").notNull(),
|
|
5855
|
+
latestRevisionId: uuid52("latest_revision_id"),
|
|
5626
5856
|
latestRevisionNumber: integer15("latest_revision_number").notNull().default(1),
|
|
5627
|
-
createdByAgentId:
|
|
5628
|
-
createdByUserId:
|
|
5629
|
-
updatedByAgentId:
|
|
5630
|
-
updatedByUserId:
|
|
5631
|
-
createdAt:
|
|
5632
|
-
updatedAt:
|
|
5857
|
+
createdByAgentId: uuid52("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5858
|
+
createdByUserId: text55("created_by_user_id"),
|
|
5859
|
+
updatedByAgentId: uuid52("updated_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5860
|
+
updatedByUserId: text55("updated_by_user_id"),
|
|
5861
|
+
createdAt: timestamp54("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5862
|
+
updatedAt: timestamp54("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5633
5863
|
},
|
|
5634
5864
|
(table) => ({
|
|
5635
|
-
companyUpdatedIdx:
|
|
5636
|
-
companyCreatedIdx:
|
|
5865
|
+
companyUpdatedIdx: index49("documents_company_updated_idx").on(table.orgId, table.updatedAt),
|
|
5866
|
+
companyCreatedIdx: index49("documents_company_created_idx").on(table.orgId, table.createdAt)
|
|
5637
5867
|
})
|
|
5638
5868
|
);
|
|
5639
5869
|
}
|
|
5640
5870
|
});
|
|
5641
5871
|
|
|
5642
5872
|
// ../packages/db/src/schema/document_revisions.ts
|
|
5643
|
-
import { pgTable as
|
|
5873
|
+
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";
|
|
5644
5874
|
var documentRevisions;
|
|
5645
5875
|
var init_document_revisions = __esm({
|
|
5646
5876
|
"../packages/db/src/schema/document_revisions.ts"() {
|
|
@@ -5648,25 +5878,25 @@ var init_document_revisions = __esm({
|
|
|
5648
5878
|
init_organizations();
|
|
5649
5879
|
init_agents();
|
|
5650
5880
|
init_documents();
|
|
5651
|
-
documentRevisions =
|
|
5881
|
+
documentRevisions = pgTable55(
|
|
5652
5882
|
"document_revisions",
|
|
5653
5883
|
{
|
|
5654
|
-
id:
|
|
5655
|
-
orgId:
|
|
5656
|
-
documentId:
|
|
5884
|
+
id: uuid53("id").primaryKey().defaultRandom(),
|
|
5885
|
+
orgId: uuid53("org_id").notNull().references(() => organizations.id),
|
|
5886
|
+
documentId: uuid53("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
|
|
5657
5887
|
revisionNumber: integer16("revision_number").notNull(),
|
|
5658
|
-
body:
|
|
5659
|
-
changeSummary:
|
|
5660
|
-
createdByAgentId:
|
|
5661
|
-
createdByUserId:
|
|
5662
|
-
createdAt:
|
|
5888
|
+
body: text56("body").notNull(),
|
|
5889
|
+
changeSummary: text56("change_summary"),
|
|
5890
|
+
createdByAgentId: uuid53("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
5891
|
+
createdByUserId: text56("created_by_user_id"),
|
|
5892
|
+
createdAt: timestamp55("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
5663
5893
|
},
|
|
5664
5894
|
(table) => ({
|
|
5665
5895
|
documentRevisionUq: uniqueIndex30("document_revisions_document_revision_uq").on(
|
|
5666
5896
|
table.documentId,
|
|
5667
5897
|
table.revisionNumber
|
|
5668
5898
|
),
|
|
5669
|
-
companyDocumentCreatedIdx:
|
|
5899
|
+
companyDocumentCreatedIdx: index50("document_revisions_company_document_created_idx").on(
|
|
5670
5900
|
table.orgId,
|
|
5671
5901
|
table.documentId,
|
|
5672
5902
|
table.createdAt
|
|
@@ -5677,7 +5907,7 @@ var init_document_revisions = __esm({
|
|
|
5677
5907
|
});
|
|
5678
5908
|
|
|
5679
5909
|
// ../packages/db/src/schema/issue_documents.ts
|
|
5680
|
-
import { pgTable as
|
|
5910
|
+
import { pgTable as pgTable56, uuid as uuid54, text as text57, timestamp as timestamp56, index as index51, uniqueIndex as uniqueIndex31 } from "drizzle-orm/pg-core";
|
|
5681
5911
|
var issueDocuments;
|
|
5682
5912
|
var init_issue_documents = __esm({
|
|
5683
5913
|
"../packages/db/src/schema/issue_documents.ts"() {
|
|
@@ -5685,16 +5915,16 @@ var init_issue_documents = __esm({
|
|
|
5685
5915
|
init_organizations();
|
|
5686
5916
|
init_issues();
|
|
5687
5917
|
init_documents();
|
|
5688
|
-
issueDocuments =
|
|
5918
|
+
issueDocuments = pgTable56(
|
|
5689
5919
|
"issue_documents",
|
|
5690
5920
|
{
|
|
5691
|
-
id:
|
|
5692
|
-
orgId:
|
|
5693
|
-
issueId:
|
|
5694
|
-
documentId:
|
|
5695
|
-
key:
|
|
5696
|
-
createdAt:
|
|
5697
|
-
updatedAt:
|
|
5921
|
+
id: uuid54("id").primaryKey().defaultRandom(),
|
|
5922
|
+
orgId: uuid54("org_id").notNull().references(() => organizations.id),
|
|
5923
|
+
issueId: uuid54("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
|
|
5924
|
+
documentId: uuid54("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
|
|
5925
|
+
key: text57("key").notNull(),
|
|
5926
|
+
createdAt: timestamp56("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
5927
|
+
updatedAt: timestamp56("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5698
5928
|
},
|
|
5699
5929
|
(table) => ({
|
|
5700
5930
|
companyIssueKeyUq: uniqueIndex31("issue_documents_company_issue_key_uq").on(
|
|
@@ -5703,7 +5933,7 @@ var init_issue_documents = __esm({
|
|
|
5703
5933
|
table.key
|
|
5704
5934
|
),
|
|
5705
5935
|
documentUq: uniqueIndex31("issue_documents_document_uq").on(table.documentId),
|
|
5706
|
-
companyIssueUpdatedIdx:
|
|
5936
|
+
companyIssueUpdatedIdx: index51("issue_documents_company_issue_updated_idx").on(
|
|
5707
5937
|
table.orgId,
|
|
5708
5938
|
table.issueId,
|
|
5709
5939
|
table.updatedAt
|
|
@@ -5714,7 +5944,7 @@ var init_issue_documents = __esm({
|
|
|
5714
5944
|
});
|
|
5715
5945
|
|
|
5716
5946
|
// ../packages/db/src/schema/heartbeat_run_events.ts
|
|
5717
|
-
import { pgTable as
|
|
5947
|
+
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";
|
|
5718
5948
|
var heartbeatRunEvents;
|
|
5719
5949
|
var init_heartbeat_run_events = __esm({
|
|
5720
5950
|
"../packages/db/src/schema/heartbeat_run_events.ts"() {
|
|
@@ -5722,33 +5952,33 @@ var init_heartbeat_run_events = __esm({
|
|
|
5722
5952
|
init_organizations();
|
|
5723
5953
|
init_agents();
|
|
5724
5954
|
init_heartbeat_runs();
|
|
5725
|
-
heartbeatRunEvents =
|
|
5955
|
+
heartbeatRunEvents = pgTable57(
|
|
5726
5956
|
"heartbeat_run_events",
|
|
5727
5957
|
{
|
|
5728
5958
|
id: bigserial("id", { mode: "number" }).primaryKey(),
|
|
5729
|
-
orgId:
|
|
5730
|
-
runId:
|
|
5731
|
-
agentId:
|
|
5959
|
+
orgId: uuid55("org_id").notNull().references(() => organizations.id),
|
|
5960
|
+
runId: uuid55("run_id").notNull().references(() => heartbeatRuns.id),
|
|
5961
|
+
agentId: uuid55("agent_id").notNull().references(() => agents.id),
|
|
5732
5962
|
seq: integer17("seq").notNull(),
|
|
5733
|
-
eventType:
|
|
5734
|
-
stream:
|
|
5735
|
-
level:
|
|
5736
|
-
color:
|
|
5737
|
-
message:
|
|
5738
|
-
payload:
|
|
5739
|
-
createdAt:
|
|
5963
|
+
eventType: text58("event_type").notNull(),
|
|
5964
|
+
stream: text58("stream"),
|
|
5965
|
+
level: text58("level"),
|
|
5966
|
+
color: text58("color"),
|
|
5967
|
+
message: text58("message"),
|
|
5968
|
+
payload: jsonb26("payload").$type(),
|
|
5969
|
+
createdAt: timestamp57("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
5740
5970
|
},
|
|
5741
5971
|
(table) => ({
|
|
5742
|
-
runSeqIdx:
|
|
5743
|
-
companyRunIdx:
|
|
5744
|
-
companyCreatedIdx:
|
|
5972
|
+
runSeqIdx: index52("heartbeat_run_events_run_seq_idx").on(table.runId, table.seq),
|
|
5973
|
+
companyRunIdx: index52("heartbeat_run_events_company_run_idx").on(table.orgId, table.runId),
|
|
5974
|
+
companyCreatedIdx: index52("heartbeat_run_events_company_created_idx").on(table.orgId, table.createdAt)
|
|
5745
5975
|
})
|
|
5746
5976
|
);
|
|
5747
5977
|
}
|
|
5748
5978
|
});
|
|
5749
5979
|
|
|
5750
5980
|
// ../packages/db/src/schema/cost_events.ts
|
|
5751
|
-
import { pgTable as
|
|
5981
|
+
import { pgTable as pgTable58, uuid as uuid56, text as text59, timestamp as timestamp58, integer as integer18, index as index53 } from "drizzle-orm/pg-core";
|
|
5752
5982
|
var costEvents;
|
|
5753
5983
|
var init_cost_events = __esm({
|
|
5754
5984
|
"../packages/db/src/schema/cost_events.ts"() {
|
|
@@ -5759,46 +5989,46 @@ var init_cost_events = __esm({
|
|
|
5759
5989
|
init_projects();
|
|
5760
5990
|
init_goals();
|
|
5761
5991
|
init_heartbeat_runs();
|
|
5762
|
-
costEvents =
|
|
5992
|
+
costEvents = pgTable58(
|
|
5763
5993
|
"cost_events",
|
|
5764
5994
|
{
|
|
5765
|
-
id:
|
|
5766
|
-
orgId:
|
|
5767
|
-
agentId:
|
|
5768
|
-
issueId:
|
|
5769
|
-
projectId:
|
|
5770
|
-
goalId:
|
|
5771
|
-
heartbeatRunId:
|
|
5772
|
-
billingCode:
|
|
5773
|
-
provider:
|
|
5774
|
-
biller:
|
|
5775
|
-
billingType:
|
|
5776
|
-
model:
|
|
5995
|
+
id: uuid56("id").primaryKey().defaultRandom(),
|
|
5996
|
+
orgId: uuid56("org_id").notNull().references(() => organizations.id),
|
|
5997
|
+
agentId: uuid56("agent_id").notNull().references(() => agents.id),
|
|
5998
|
+
issueId: uuid56("issue_id").references(() => issues.id),
|
|
5999
|
+
projectId: uuid56("project_id").references(() => projects.id),
|
|
6000
|
+
goalId: uuid56("goal_id").references(() => goals.id),
|
|
6001
|
+
heartbeatRunId: uuid56("heartbeat_run_id").references(() => heartbeatRuns.id),
|
|
6002
|
+
billingCode: text59("billing_code"),
|
|
6003
|
+
provider: text59("provider").notNull(),
|
|
6004
|
+
biller: text59("biller").notNull().default("unknown"),
|
|
6005
|
+
billingType: text59("billing_type").notNull().default("unknown"),
|
|
6006
|
+
model: text59("model").notNull(),
|
|
5777
6007
|
inputTokens: integer18("input_tokens").notNull().default(0),
|
|
5778
6008
|
cachedInputTokens: integer18("cached_input_tokens").notNull().default(0),
|
|
5779
6009
|
outputTokens: integer18("output_tokens").notNull().default(0),
|
|
5780
6010
|
costCents: integer18("cost_cents").notNull(),
|
|
5781
|
-
occurredAt:
|
|
5782
|
-
createdAt:
|
|
6011
|
+
occurredAt: timestamp58("occurred_at", { withTimezone: true }).notNull(),
|
|
6012
|
+
createdAt: timestamp58("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
5783
6013
|
},
|
|
5784
6014
|
(table) => ({
|
|
5785
|
-
companyOccurredIdx:
|
|
5786
|
-
companyAgentOccurredIdx:
|
|
6015
|
+
companyOccurredIdx: index53("cost_events_company_occurred_idx").on(table.orgId, table.occurredAt),
|
|
6016
|
+
companyAgentOccurredIdx: index53("cost_events_company_agent_occurred_idx").on(
|
|
5787
6017
|
table.orgId,
|
|
5788
6018
|
table.agentId,
|
|
5789
6019
|
table.occurredAt
|
|
5790
6020
|
),
|
|
5791
|
-
companyProviderOccurredIdx:
|
|
6021
|
+
companyProviderOccurredIdx: index53("cost_events_company_provider_occurred_idx").on(
|
|
5792
6022
|
table.orgId,
|
|
5793
6023
|
table.provider,
|
|
5794
6024
|
table.occurredAt
|
|
5795
6025
|
),
|
|
5796
|
-
companyBillerOccurredIdx:
|
|
6026
|
+
companyBillerOccurredIdx: index53("cost_events_company_biller_occurred_idx").on(
|
|
5797
6027
|
table.orgId,
|
|
5798
6028
|
table.biller,
|
|
5799
6029
|
table.occurredAt
|
|
5800
6030
|
),
|
|
5801
|
-
companyHeartbeatRunIdx:
|
|
6031
|
+
companyHeartbeatRunIdx: index53("cost_events_company_heartbeat_run_idx").on(
|
|
5802
6032
|
table.orgId,
|
|
5803
6033
|
table.heartbeatRunId
|
|
5804
6034
|
)
|
|
@@ -5808,7 +6038,7 @@ var init_cost_events = __esm({
|
|
|
5808
6038
|
});
|
|
5809
6039
|
|
|
5810
6040
|
// ../packages/db/src/schema/finance_events.ts
|
|
5811
|
-
import { pgTable as
|
|
6041
|
+
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";
|
|
5812
6042
|
var financeEvents;
|
|
5813
6043
|
var init_finance_events = __esm({
|
|
5814
6044
|
"../packages/db/src/schema/finance_events.ts"() {
|
|
@@ -5820,59 +6050,59 @@ var init_finance_events = __esm({
|
|
|
5820
6050
|
init_goals();
|
|
5821
6051
|
init_heartbeat_runs();
|
|
5822
6052
|
init_cost_events();
|
|
5823
|
-
financeEvents =
|
|
6053
|
+
financeEvents = pgTable59(
|
|
5824
6054
|
"finance_events",
|
|
5825
6055
|
{
|
|
5826
|
-
id:
|
|
5827
|
-
orgId:
|
|
5828
|
-
agentId:
|
|
5829
|
-
issueId:
|
|
5830
|
-
projectId:
|
|
5831
|
-
goalId:
|
|
5832
|
-
heartbeatRunId:
|
|
5833
|
-
costEventId:
|
|
5834
|
-
billingCode:
|
|
5835
|
-
description:
|
|
5836
|
-
eventKind:
|
|
5837
|
-
direction:
|
|
5838
|
-
biller:
|
|
5839
|
-
provider:
|
|
5840
|
-
executionAgentRuntimeType:
|
|
5841
|
-
pricingTier:
|
|
5842
|
-
region:
|
|
5843
|
-
model:
|
|
6056
|
+
id: uuid57("id").primaryKey().defaultRandom(),
|
|
6057
|
+
orgId: uuid57("org_id").notNull().references(() => organizations.id),
|
|
6058
|
+
agentId: uuid57("agent_id").references(() => agents.id),
|
|
6059
|
+
issueId: uuid57("issue_id").references(() => issues.id),
|
|
6060
|
+
projectId: uuid57("project_id").references(() => projects.id),
|
|
6061
|
+
goalId: uuid57("goal_id").references(() => goals.id),
|
|
6062
|
+
heartbeatRunId: uuid57("heartbeat_run_id").references(() => heartbeatRuns.id),
|
|
6063
|
+
costEventId: uuid57("cost_event_id").references(() => costEvents.id),
|
|
6064
|
+
billingCode: text60("billing_code"),
|
|
6065
|
+
description: text60("description"),
|
|
6066
|
+
eventKind: text60("event_kind").notNull(),
|
|
6067
|
+
direction: text60("direction").notNull().default("debit"),
|
|
6068
|
+
biller: text60("biller").notNull(),
|
|
6069
|
+
provider: text60("provider"),
|
|
6070
|
+
executionAgentRuntimeType: text60("execution_agent_runtime_type"),
|
|
6071
|
+
pricingTier: text60("pricing_tier"),
|
|
6072
|
+
region: text60("region"),
|
|
6073
|
+
model: text60("model"),
|
|
5844
6074
|
quantity: integer19("quantity"),
|
|
5845
|
-
unit:
|
|
6075
|
+
unit: text60("unit"),
|
|
5846
6076
|
amountCents: integer19("amount_cents").notNull(),
|
|
5847
|
-
currency:
|
|
5848
|
-
estimated:
|
|
5849
|
-
externalInvoiceId:
|
|
5850
|
-
metadataJson:
|
|
5851
|
-
occurredAt:
|
|
5852
|
-
createdAt:
|
|
6077
|
+
currency: text60("currency").notNull().default("USD"),
|
|
6078
|
+
estimated: boolean11("estimated").notNull().default(false),
|
|
6079
|
+
externalInvoiceId: text60("external_invoice_id"),
|
|
6080
|
+
metadataJson: jsonb27("metadata_json").$type(),
|
|
6081
|
+
occurredAt: timestamp59("occurred_at", { withTimezone: true }).notNull(),
|
|
6082
|
+
createdAt: timestamp59("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
5853
6083
|
},
|
|
5854
6084
|
(table) => ({
|
|
5855
|
-
companyOccurredIdx:
|
|
5856
|
-
companyBillerOccurredIdx:
|
|
6085
|
+
companyOccurredIdx: index54("finance_events_company_occurred_idx").on(table.orgId, table.occurredAt),
|
|
6086
|
+
companyBillerOccurredIdx: index54("finance_events_company_biller_occurred_idx").on(
|
|
5857
6087
|
table.orgId,
|
|
5858
6088
|
table.biller,
|
|
5859
6089
|
table.occurredAt
|
|
5860
6090
|
),
|
|
5861
|
-
companyKindOccurredIdx:
|
|
6091
|
+
companyKindOccurredIdx: index54("finance_events_company_kind_occurred_idx").on(
|
|
5862
6092
|
table.orgId,
|
|
5863
6093
|
table.eventKind,
|
|
5864
6094
|
table.occurredAt
|
|
5865
6095
|
),
|
|
5866
|
-
companyDirectionOccurredIdx:
|
|
6096
|
+
companyDirectionOccurredIdx: index54("finance_events_company_direction_occurred_idx").on(
|
|
5867
6097
|
table.orgId,
|
|
5868
6098
|
table.direction,
|
|
5869
6099
|
table.occurredAt
|
|
5870
6100
|
),
|
|
5871
|
-
companyHeartbeatRunIdx:
|
|
6101
|
+
companyHeartbeatRunIdx: index54("finance_events_company_heartbeat_run_idx").on(
|
|
5872
6102
|
table.orgId,
|
|
5873
6103
|
table.heartbeatRunId
|
|
5874
6104
|
),
|
|
5875
|
-
companyCostEventIdx:
|
|
6105
|
+
companyCostEventIdx: index54("finance_events_company_cost_event_idx").on(
|
|
5876
6106
|
table.orgId,
|
|
5877
6107
|
table.costEventId
|
|
5878
6108
|
)
|
|
@@ -5882,7 +6112,7 @@ var init_finance_events = __esm({
|
|
|
5882
6112
|
});
|
|
5883
6113
|
|
|
5884
6114
|
// ../packages/db/src/schema/approval_comments.ts
|
|
5885
|
-
import { pgTable as
|
|
6115
|
+
import { pgTable as pgTable60, uuid as uuid58, text as text61, timestamp as timestamp60, index as index55 } from "drizzle-orm/pg-core";
|
|
5886
6116
|
var approvalComments;
|
|
5887
6117
|
var init_approval_comments = __esm({
|
|
5888
6118
|
"../packages/db/src/schema/approval_comments.ts"() {
|
|
@@ -5890,22 +6120,22 @@ var init_approval_comments = __esm({
|
|
|
5890
6120
|
init_organizations();
|
|
5891
6121
|
init_approvals();
|
|
5892
6122
|
init_agents();
|
|
5893
|
-
approvalComments =
|
|
6123
|
+
approvalComments = pgTable60(
|
|
5894
6124
|
"approval_comments",
|
|
5895
6125
|
{
|
|
5896
|
-
id:
|
|
5897
|
-
orgId:
|
|
5898
|
-
approvalId:
|
|
5899
|
-
authorAgentId:
|
|
5900
|
-
authorUserId:
|
|
5901
|
-
body:
|
|
5902
|
-
createdAt:
|
|
5903
|
-
updatedAt:
|
|
6126
|
+
id: uuid58("id").primaryKey().defaultRandom(),
|
|
6127
|
+
orgId: uuid58("org_id").notNull().references(() => organizations.id),
|
|
6128
|
+
approvalId: uuid58("approval_id").notNull().references(() => approvals.id),
|
|
6129
|
+
authorAgentId: uuid58("author_agent_id").references(() => agents.id),
|
|
6130
|
+
authorUserId: text61("author_user_id"),
|
|
6131
|
+
body: text61("body").notNull(),
|
|
6132
|
+
createdAt: timestamp60("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6133
|
+
updatedAt: timestamp60("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
5904
6134
|
},
|
|
5905
6135
|
(table) => ({
|
|
5906
|
-
orgIdx:
|
|
5907
|
-
approvalIdx:
|
|
5908
|
-
approvalCreatedIdx:
|
|
6136
|
+
orgIdx: index55("approval_comments_company_idx").on(table.orgId),
|
|
6137
|
+
approvalIdx: index55("approval_comments_approval_idx").on(table.approvalId),
|
|
6138
|
+
approvalCreatedIdx: index55("approval_comments_approval_created_idx").on(
|
|
5909
6139
|
table.approvalId,
|
|
5910
6140
|
table.createdAt
|
|
5911
6141
|
)
|
|
@@ -5914,63 +6144,30 @@ var init_approval_comments = __esm({
|
|
|
5914
6144
|
}
|
|
5915
6145
|
});
|
|
5916
6146
|
|
|
5917
|
-
// ../packages/db/src/schema/activity_log.ts
|
|
5918
|
-
import { pgTable as pgTable58, uuid as uuid56, text as text59, timestamp as timestamp58, jsonb as jsonb26, index as index53 } from "drizzle-orm/pg-core";
|
|
5919
|
-
var activityLog;
|
|
5920
|
-
var init_activity_log = __esm({
|
|
5921
|
-
"../packages/db/src/schema/activity_log.ts"() {
|
|
5922
|
-
"use strict";
|
|
5923
|
-
init_organizations();
|
|
5924
|
-
init_agents();
|
|
5925
|
-
init_heartbeat_runs();
|
|
5926
|
-
activityLog = pgTable58(
|
|
5927
|
-
"activity_log",
|
|
5928
|
-
{
|
|
5929
|
-
id: uuid56("id").primaryKey().defaultRandom(),
|
|
5930
|
-
orgId: uuid56("org_id").notNull().references(() => organizations.id),
|
|
5931
|
-
actorType: text59("actor_type").notNull().default("system"),
|
|
5932
|
-
actorId: text59("actor_id").notNull(),
|
|
5933
|
-
action: text59("action").notNull(),
|
|
5934
|
-
entityType: text59("entity_type").notNull(),
|
|
5935
|
-
entityId: text59("entity_id").notNull(),
|
|
5936
|
-
agentId: uuid56("agent_id").references(() => agents.id),
|
|
5937
|
-
runId: uuid56("run_id").references(() => heartbeatRuns.id),
|
|
5938
|
-
details: jsonb26("details").$type(),
|
|
5939
|
-
createdAt: timestamp58("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
5940
|
-
},
|
|
5941
|
-
(table) => ({
|
|
5942
|
-
companyCreatedIdx: index53("activity_log_company_created_idx").on(table.orgId, table.createdAt),
|
|
5943
|
-
runIdIdx: index53("activity_log_run_id_idx").on(table.runId),
|
|
5944
|
-
entityIdx: index53("activity_log_entity_type_id_idx").on(table.entityType, table.entityId)
|
|
5945
|
-
})
|
|
5946
|
-
);
|
|
5947
|
-
}
|
|
5948
|
-
});
|
|
5949
|
-
|
|
5950
6147
|
// ../packages/db/src/schema/organization_secret_versions.ts
|
|
5951
|
-
import { pgTable as
|
|
6148
|
+
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";
|
|
5952
6149
|
var organizationSecretVersions;
|
|
5953
6150
|
var init_organization_secret_versions = __esm({
|
|
5954
6151
|
"../packages/db/src/schema/organization_secret_versions.ts"() {
|
|
5955
6152
|
"use strict";
|
|
5956
6153
|
init_agents();
|
|
5957
6154
|
init_organization_secrets();
|
|
5958
|
-
organizationSecretVersions =
|
|
6155
|
+
organizationSecretVersions = pgTable61(
|
|
5959
6156
|
"organization_secret_versions",
|
|
5960
6157
|
{
|
|
5961
|
-
id:
|
|
5962
|
-
secretId:
|
|
6158
|
+
id: uuid59("id").primaryKey().defaultRandom(),
|
|
6159
|
+
secretId: uuid59("secret_id").notNull().references(() => organizationSecrets.id, { onDelete: "cascade" }),
|
|
5963
6160
|
version: integer20("version").notNull(),
|
|
5964
|
-
material:
|
|
5965
|
-
valueSha256:
|
|
5966
|
-
createdByAgentId:
|
|
5967
|
-
createdByUserId:
|
|
5968
|
-
createdAt:
|
|
5969
|
-
revokedAt:
|
|
6161
|
+
material: jsonb28("material").$type().notNull(),
|
|
6162
|
+
valueSha256: text62("value_sha256").notNull(),
|
|
6163
|
+
createdByAgentId: uuid59("created_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
6164
|
+
createdByUserId: text62("created_by_user_id"),
|
|
6165
|
+
createdAt: timestamp61("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6166
|
+
revokedAt: timestamp61("revoked_at", { withTimezone: true })
|
|
5970
6167
|
},
|
|
5971
6168
|
(table) => ({
|
|
5972
|
-
secretIdx:
|
|
5973
|
-
valueHashIdx:
|
|
6169
|
+
secretIdx: index56("organization_secret_versions_secret_idx").on(table.secretId, table.createdAt),
|
|
6170
|
+
valueHashIdx: index56("organization_secret_versions_value_sha256_idx").on(table.valueSha256),
|
|
5974
6171
|
secretVersionUq: uniqueIndex32("organization_secret_versions_secret_version_uq").on(table.secretId, table.version)
|
|
5975
6172
|
})
|
|
5976
6173
|
);
|
|
@@ -5979,12 +6176,12 @@ var init_organization_secret_versions = __esm({
|
|
|
5979
6176
|
|
|
5980
6177
|
// ../packages/db/src/schema/organization_skills.ts
|
|
5981
6178
|
import {
|
|
5982
|
-
pgTable as
|
|
5983
|
-
uuid as
|
|
5984
|
-
text as
|
|
5985
|
-
timestamp as
|
|
5986
|
-
jsonb as
|
|
5987
|
-
index as
|
|
6179
|
+
pgTable as pgTable62,
|
|
6180
|
+
uuid as uuid60,
|
|
6181
|
+
text as text63,
|
|
6182
|
+
timestamp as timestamp62,
|
|
6183
|
+
jsonb as jsonb29,
|
|
6184
|
+
index as index57,
|
|
5988
6185
|
uniqueIndex as uniqueIndex33
|
|
5989
6186
|
} from "drizzle-orm/pg-core";
|
|
5990
6187
|
var organizationSkills;
|
|
@@ -5992,29 +6189,29 @@ var init_organization_skills = __esm({
|
|
|
5992
6189
|
"../packages/db/src/schema/organization_skills.ts"() {
|
|
5993
6190
|
"use strict";
|
|
5994
6191
|
init_organizations();
|
|
5995
|
-
organizationSkills =
|
|
6192
|
+
organizationSkills = pgTable62(
|
|
5996
6193
|
"organization_skills",
|
|
5997
6194
|
{
|
|
5998
|
-
id:
|
|
5999
|
-
orgId:
|
|
6000
|
-
key:
|
|
6001
|
-
slug:
|
|
6002
|
-
name:
|
|
6003
|
-
description:
|
|
6004
|
-
markdown:
|
|
6005
|
-
sourceType:
|
|
6006
|
-
sourceLocator:
|
|
6007
|
-
sourceRef:
|
|
6008
|
-
trustLevel:
|
|
6009
|
-
compatibility:
|
|
6010
|
-
fileInventory:
|
|
6011
|
-
metadata:
|
|
6012
|
-
createdAt:
|
|
6013
|
-
updatedAt:
|
|
6195
|
+
id: uuid60("id").primaryKey().defaultRandom(),
|
|
6196
|
+
orgId: uuid60("org_id").notNull().references(() => organizations.id),
|
|
6197
|
+
key: text63("key").notNull(),
|
|
6198
|
+
slug: text63("slug").notNull(),
|
|
6199
|
+
name: text63("name").notNull(),
|
|
6200
|
+
description: text63("description"),
|
|
6201
|
+
markdown: text63("markdown").notNull(),
|
|
6202
|
+
sourceType: text63("source_type").notNull().default("local_path"),
|
|
6203
|
+
sourceLocator: text63("source_locator"),
|
|
6204
|
+
sourceRef: text63("source_ref"),
|
|
6205
|
+
trustLevel: text63("trust_level").notNull().default("markdown_only"),
|
|
6206
|
+
compatibility: text63("compatibility").notNull().default("compatible"),
|
|
6207
|
+
fileInventory: jsonb29("file_inventory").$type().notNull().default([]),
|
|
6208
|
+
metadata: jsonb29("metadata").$type(),
|
|
6209
|
+
createdAt: timestamp62("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6210
|
+
updatedAt: timestamp62("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6014
6211
|
},
|
|
6015
6212
|
(table) => ({
|
|
6016
6213
|
organizationKeyUniqueIdx: uniqueIndex33("organization_skills_org_key_idx").on(table.orgId, table.key),
|
|
6017
|
-
organizationNameIdx:
|
|
6214
|
+
organizationNameIdx: index57("organization_skills_org_name_idx").on(table.orgId, table.name)
|
|
6018
6215
|
})
|
|
6019
6216
|
);
|
|
6020
6217
|
}
|
|
@@ -6022,61 +6219,61 @@ var init_organization_skills = __esm({
|
|
|
6022
6219
|
|
|
6023
6220
|
// ../packages/db/src/schema/plugins.ts
|
|
6024
6221
|
import {
|
|
6025
|
-
pgTable as
|
|
6026
|
-
uuid as
|
|
6027
|
-
text as
|
|
6222
|
+
pgTable as pgTable63,
|
|
6223
|
+
uuid as uuid61,
|
|
6224
|
+
text as text64,
|
|
6028
6225
|
integer as integer21,
|
|
6029
|
-
timestamp as
|
|
6030
|
-
jsonb as
|
|
6031
|
-
index as
|
|
6226
|
+
timestamp as timestamp63,
|
|
6227
|
+
jsonb as jsonb30,
|
|
6228
|
+
index as index58,
|
|
6032
6229
|
uniqueIndex as uniqueIndex34
|
|
6033
6230
|
} from "drizzle-orm/pg-core";
|
|
6034
6231
|
var plugins;
|
|
6035
6232
|
var init_plugins = __esm({
|
|
6036
6233
|
"../packages/db/src/schema/plugins.ts"() {
|
|
6037
6234
|
"use strict";
|
|
6038
|
-
plugins =
|
|
6235
|
+
plugins = pgTable63(
|
|
6039
6236
|
"plugins",
|
|
6040
6237
|
{
|
|
6041
|
-
id:
|
|
6042
|
-
pluginKey:
|
|
6043
|
-
packageName:
|
|
6044
|
-
version:
|
|
6238
|
+
id: uuid61("id").primaryKey().defaultRandom(),
|
|
6239
|
+
pluginKey: text64("plugin_key").notNull(),
|
|
6240
|
+
packageName: text64("package_name").notNull(),
|
|
6241
|
+
version: text64("version").notNull(),
|
|
6045
6242
|
apiVersion: integer21("api_version").notNull().default(1),
|
|
6046
|
-
categories:
|
|
6047
|
-
manifestJson:
|
|
6048
|
-
status:
|
|
6243
|
+
categories: jsonb30("categories").$type().notNull().default([]),
|
|
6244
|
+
manifestJson: jsonb30("manifest_json").$type().notNull(),
|
|
6245
|
+
status: text64("status").$type().notNull().default("installed"),
|
|
6049
6246
|
installOrder: integer21("install_order"),
|
|
6050
6247
|
/** Resolved package path for local-path installs; used to find worker entrypoint. */
|
|
6051
|
-
packagePath:
|
|
6052
|
-
lastError:
|
|
6053
|
-
installedAt:
|
|
6054
|
-
updatedAt:
|
|
6248
|
+
packagePath: text64("package_path"),
|
|
6249
|
+
lastError: text64("last_error"),
|
|
6250
|
+
installedAt: timestamp63("installed_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6251
|
+
updatedAt: timestamp63("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6055
6252
|
},
|
|
6056
6253
|
(table) => ({
|
|
6057
6254
|
pluginKeyIdx: uniqueIndex34("plugins_plugin_key_idx").on(table.pluginKey),
|
|
6058
|
-
statusIdx:
|
|
6255
|
+
statusIdx: index58("plugins_status_idx").on(table.status)
|
|
6059
6256
|
})
|
|
6060
6257
|
);
|
|
6061
6258
|
}
|
|
6062
6259
|
});
|
|
6063
6260
|
|
|
6064
6261
|
// ../packages/db/src/schema/plugin_config.ts
|
|
6065
|
-
import { pgTable as
|
|
6262
|
+
import { pgTable as pgTable64, uuid as uuid62, text as text65, timestamp as timestamp64, jsonb as jsonb31, uniqueIndex as uniqueIndex35 } from "drizzle-orm/pg-core";
|
|
6066
6263
|
var pluginConfig;
|
|
6067
6264
|
var init_plugin_config = __esm({
|
|
6068
6265
|
"../packages/db/src/schema/plugin_config.ts"() {
|
|
6069
6266
|
"use strict";
|
|
6070
6267
|
init_plugins();
|
|
6071
|
-
pluginConfig =
|
|
6268
|
+
pluginConfig = pgTable64(
|
|
6072
6269
|
"plugin_config",
|
|
6073
6270
|
{
|
|
6074
|
-
id:
|
|
6075
|
-
pluginId:
|
|
6076
|
-
configJson:
|
|
6077
|
-
lastError:
|
|
6078
|
-
createdAt:
|
|
6079
|
-
updatedAt:
|
|
6271
|
+
id: uuid62("id").primaryKey().defaultRandom(),
|
|
6272
|
+
pluginId: uuid62("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
|
|
6273
|
+
configJson: jsonb31("config_json").$type().notNull().default({}),
|
|
6274
|
+
lastError: text65("last_error"),
|
|
6275
|
+
createdAt: timestamp64("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6276
|
+
updatedAt: timestamp64("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6080
6277
|
},
|
|
6081
6278
|
(table) => ({
|
|
6082
6279
|
pluginIdIdx: uniqueIndex35("plugin_config_plugin_id_idx").on(table.pluginId)
|
|
@@ -6086,28 +6283,28 @@ var init_plugin_config = __esm({
|
|
|
6086
6283
|
});
|
|
6087
6284
|
|
|
6088
6285
|
// ../packages/db/src/schema/plugin_organization_settings.ts
|
|
6089
|
-
import { pgTable as
|
|
6286
|
+
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";
|
|
6090
6287
|
var pluginOrganizationSettings;
|
|
6091
6288
|
var init_plugin_organization_settings = __esm({
|
|
6092
6289
|
"../packages/db/src/schema/plugin_organization_settings.ts"() {
|
|
6093
6290
|
"use strict";
|
|
6094
6291
|
init_organizations();
|
|
6095
6292
|
init_plugins();
|
|
6096
|
-
pluginOrganizationSettings =
|
|
6293
|
+
pluginOrganizationSettings = pgTable65(
|
|
6097
6294
|
"plugin_organization_settings",
|
|
6098
6295
|
{
|
|
6099
|
-
id:
|
|
6100
|
-
orgId:
|
|
6101
|
-
pluginId:
|
|
6102
|
-
enabled:
|
|
6103
|
-
settingsJson:
|
|
6104
|
-
lastError:
|
|
6105
|
-
createdAt:
|
|
6106
|
-
updatedAt:
|
|
6296
|
+
id: uuid63("id").primaryKey().defaultRandom(),
|
|
6297
|
+
orgId: uuid63("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
6298
|
+
pluginId: uuid63("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
|
|
6299
|
+
enabled: boolean12("enabled").notNull().default(true),
|
|
6300
|
+
settingsJson: jsonb32("settings_json").$type().notNull().default({}),
|
|
6301
|
+
lastError: text66("last_error"),
|
|
6302
|
+
createdAt: timestamp65("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6303
|
+
updatedAt: timestamp65("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6107
6304
|
},
|
|
6108
6305
|
(table) => ({
|
|
6109
|
-
organizationIdx:
|
|
6110
|
-
pluginIdx:
|
|
6306
|
+
organizationIdx: index59("plugin_organization_settings_org_idx").on(table.orgId),
|
|
6307
|
+
pluginIdx: index59("plugin_organization_settings_plugin_idx").on(table.pluginId),
|
|
6111
6308
|
organizationPluginUq: uniqueIndex36("plugin_organization_settings_org_plugin_uq").on(
|
|
6112
6309
|
table.orgId,
|
|
6113
6310
|
table.pluginId
|
|
@@ -6119,12 +6316,12 @@ var init_plugin_organization_settings = __esm({
|
|
|
6119
6316
|
|
|
6120
6317
|
// ../packages/db/src/schema/plugin_state.ts
|
|
6121
6318
|
import {
|
|
6122
|
-
pgTable as
|
|
6123
|
-
uuid as
|
|
6124
|
-
text as
|
|
6125
|
-
timestamp as
|
|
6126
|
-
jsonb as
|
|
6127
|
-
index as
|
|
6319
|
+
pgTable as pgTable66,
|
|
6320
|
+
uuid as uuid64,
|
|
6321
|
+
text as text67,
|
|
6322
|
+
timestamp as timestamp66,
|
|
6323
|
+
jsonb as jsonb33,
|
|
6324
|
+
index as index60,
|
|
6128
6325
|
unique as unique2
|
|
6129
6326
|
} from "drizzle-orm/pg-core";
|
|
6130
6327
|
var pluginState;
|
|
@@ -6132,30 +6329,30 @@ var init_plugin_state = __esm({
|
|
|
6132
6329
|
"../packages/db/src/schema/plugin_state.ts"() {
|
|
6133
6330
|
"use strict";
|
|
6134
6331
|
init_plugins();
|
|
6135
|
-
pluginState =
|
|
6332
|
+
pluginState = pgTable66(
|
|
6136
6333
|
"plugin_state",
|
|
6137
6334
|
{
|
|
6138
|
-
id:
|
|
6335
|
+
id: uuid64("id").primaryKey().defaultRandom(),
|
|
6139
6336
|
/** FK to the owning plugin. Cascades on delete. */
|
|
6140
|
-
pluginId:
|
|
6337
|
+
pluginId: uuid64("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
|
|
6141
6338
|
/** Granularity of the scope (e.g. `"instance"`, `"project"`, `"issue"`). */
|
|
6142
|
-
scopeKind:
|
|
6339
|
+
scopeKind: text67("scope_kind").$type().notNull(),
|
|
6143
6340
|
/**
|
|
6144
6341
|
* UUID or text identifier for the scoped object.
|
|
6145
6342
|
* Null for `instance` scope (which has no associated entity).
|
|
6146
6343
|
*/
|
|
6147
|
-
scopeId:
|
|
6344
|
+
scopeId: text67("scope_id"),
|
|
6148
6345
|
/**
|
|
6149
6346
|
* Sub-namespace to avoid key collisions within a scope.
|
|
6150
6347
|
* Defaults to `"default"` if the plugin does not specify one.
|
|
6151
6348
|
*/
|
|
6152
|
-
namespace:
|
|
6349
|
+
namespace: text67("namespace").notNull().default("default"),
|
|
6153
6350
|
/** The key identifying this state entry within the namespace. */
|
|
6154
|
-
stateKey:
|
|
6351
|
+
stateKey: text67("state_key").notNull(),
|
|
6155
6352
|
/** JSON-serializable value stored by the plugin. */
|
|
6156
|
-
valueJson:
|
|
6353
|
+
valueJson: jsonb33("value_json").notNull(),
|
|
6157
6354
|
/** Timestamp of the most recent write. */
|
|
6158
|
-
updatedAt:
|
|
6355
|
+
updatedAt: timestamp66("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6159
6356
|
},
|
|
6160
6357
|
(table) => ({
|
|
6161
6358
|
/**
|
|
@@ -6177,7 +6374,7 @@ var init_plugin_state = __esm({
|
|
|
6177
6374
|
table.stateKey
|
|
6178
6375
|
).nullsNotDistinct(),
|
|
6179
6376
|
/** Speed up lookups by plugin + scope kind (most common access pattern). */
|
|
6180
|
-
pluginScopeIdx:
|
|
6377
|
+
pluginScopeIdx: index60("plugin_state_plugin_scope_idx").on(
|
|
6181
6378
|
table.pluginId,
|
|
6182
6379
|
table.scopeKind
|
|
6183
6380
|
)
|
|
@@ -6188,12 +6385,12 @@ var init_plugin_state = __esm({
|
|
|
6188
6385
|
|
|
6189
6386
|
// ../packages/db/src/schema/plugin_entities.ts
|
|
6190
6387
|
import {
|
|
6191
|
-
pgTable as
|
|
6192
|
-
uuid as
|
|
6193
|
-
text as
|
|
6194
|
-
timestamp as
|
|
6195
|
-
jsonb as
|
|
6196
|
-
index as
|
|
6388
|
+
pgTable as pgTable67,
|
|
6389
|
+
uuid as uuid65,
|
|
6390
|
+
text as text68,
|
|
6391
|
+
timestamp as timestamp67,
|
|
6392
|
+
jsonb as jsonb34,
|
|
6393
|
+
index as index61,
|
|
6197
6394
|
uniqueIndex as uniqueIndex37
|
|
6198
6395
|
} from "drizzle-orm/pg-core";
|
|
6199
6396
|
var pluginEntities;
|
|
@@ -6201,27 +6398,27 @@ var init_plugin_entities = __esm({
|
|
|
6201
6398
|
"../packages/db/src/schema/plugin_entities.ts"() {
|
|
6202
6399
|
"use strict";
|
|
6203
6400
|
init_plugins();
|
|
6204
|
-
pluginEntities =
|
|
6401
|
+
pluginEntities = pgTable67(
|
|
6205
6402
|
"plugin_entities",
|
|
6206
6403
|
{
|
|
6207
|
-
id:
|
|
6208
|
-
pluginId:
|
|
6209
|
-
entityType:
|
|
6210
|
-
scopeKind:
|
|
6211
|
-
scopeId:
|
|
6404
|
+
id: uuid65("id").primaryKey().defaultRandom(),
|
|
6405
|
+
pluginId: uuid65("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
|
|
6406
|
+
entityType: text68("entity_type").notNull(),
|
|
6407
|
+
scopeKind: text68("scope_kind").$type().notNull(),
|
|
6408
|
+
scopeId: text68("scope_id"),
|
|
6212
6409
|
// NULL for global scope (text to match plugin_state.scope_id)
|
|
6213
|
-
externalId:
|
|
6410
|
+
externalId: text68("external_id"),
|
|
6214
6411
|
// ID in the external system
|
|
6215
|
-
title:
|
|
6216
|
-
status:
|
|
6217
|
-
data:
|
|
6218
|
-
createdAt:
|
|
6219
|
-
updatedAt:
|
|
6412
|
+
title: text68("title"),
|
|
6413
|
+
status: text68("status"),
|
|
6414
|
+
data: jsonb34("data").$type().notNull().default({}),
|
|
6415
|
+
createdAt: timestamp67("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6416
|
+
updatedAt: timestamp67("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6220
6417
|
},
|
|
6221
6418
|
(table) => ({
|
|
6222
|
-
pluginIdx:
|
|
6223
|
-
typeIdx:
|
|
6224
|
-
scopeIdx:
|
|
6419
|
+
pluginIdx: index61("plugin_entities_plugin_idx").on(table.pluginId),
|
|
6420
|
+
typeIdx: index61("plugin_entities_type_idx").on(table.entityType),
|
|
6421
|
+
scopeIdx: index61("plugin_entities_scope_idx").on(table.scopeKind, table.scopeId),
|
|
6225
6422
|
externalIdx: uniqueIndex37("plugin_entities_external_idx").on(
|
|
6226
6423
|
table.pluginId,
|
|
6227
6424
|
table.entityType,
|
|
@@ -6234,13 +6431,13 @@ var init_plugin_entities = __esm({
|
|
|
6234
6431
|
|
|
6235
6432
|
// ../packages/db/src/schema/plugin_jobs.ts
|
|
6236
6433
|
import {
|
|
6237
|
-
pgTable as
|
|
6238
|
-
uuid as
|
|
6239
|
-
text as
|
|
6434
|
+
pgTable as pgTable68,
|
|
6435
|
+
uuid as uuid66,
|
|
6436
|
+
text as text69,
|
|
6240
6437
|
integer as integer22,
|
|
6241
|
-
timestamp as
|
|
6242
|
-
jsonb as
|
|
6243
|
-
index as
|
|
6438
|
+
timestamp as timestamp68,
|
|
6439
|
+
jsonb as jsonb35,
|
|
6440
|
+
index as index62,
|
|
6244
6441
|
uniqueIndex as uniqueIndex38
|
|
6245
6442
|
} from "drizzle-orm/pg-core";
|
|
6246
6443
|
var pluginJobs, pluginJobRuns;
|
|
@@ -6248,57 +6445,57 @@ var init_plugin_jobs = __esm({
|
|
|
6248
6445
|
"../packages/db/src/schema/plugin_jobs.ts"() {
|
|
6249
6446
|
"use strict";
|
|
6250
6447
|
init_plugins();
|
|
6251
|
-
pluginJobs =
|
|
6448
|
+
pluginJobs = pgTable68(
|
|
6252
6449
|
"plugin_jobs",
|
|
6253
6450
|
{
|
|
6254
|
-
id:
|
|
6451
|
+
id: uuid66("id").primaryKey().defaultRandom(),
|
|
6255
6452
|
/** FK to the owning plugin. Cascades on delete. */
|
|
6256
|
-
pluginId:
|
|
6453
|
+
pluginId: uuid66("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
|
|
6257
6454
|
/** Identifier matching the key in the plugin manifest's `jobs` array. */
|
|
6258
|
-
jobKey:
|
|
6455
|
+
jobKey: text69("job_key").notNull(),
|
|
6259
6456
|
/** Cron expression (e.g. `"0 * * * *"`) or interval string. */
|
|
6260
|
-
schedule:
|
|
6457
|
+
schedule: text69("schedule").notNull(),
|
|
6261
6458
|
/** Current scheduling state. */
|
|
6262
|
-
status:
|
|
6459
|
+
status: text69("status").$type().notNull().default("active"),
|
|
6263
6460
|
/** Timestamp of the most recent successful execution. */
|
|
6264
|
-
lastRunAt:
|
|
6461
|
+
lastRunAt: timestamp68("last_run_at", { withTimezone: true }),
|
|
6265
6462
|
/** Pre-computed timestamp of the next scheduled execution. */
|
|
6266
|
-
nextRunAt:
|
|
6267
|
-
createdAt:
|
|
6268
|
-
updatedAt:
|
|
6463
|
+
nextRunAt: timestamp68("next_run_at", { withTimezone: true }),
|
|
6464
|
+
createdAt: timestamp68("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6465
|
+
updatedAt: timestamp68("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6269
6466
|
},
|
|
6270
6467
|
(table) => ({
|
|
6271
|
-
pluginIdx:
|
|
6272
|
-
nextRunIdx:
|
|
6468
|
+
pluginIdx: index62("plugin_jobs_plugin_idx").on(table.pluginId),
|
|
6469
|
+
nextRunIdx: index62("plugin_jobs_next_run_idx").on(table.nextRunAt),
|
|
6273
6470
|
uniqueJobIdx: uniqueIndex38("plugin_jobs_unique_idx").on(table.pluginId, table.jobKey)
|
|
6274
6471
|
})
|
|
6275
6472
|
);
|
|
6276
|
-
pluginJobRuns =
|
|
6473
|
+
pluginJobRuns = pgTable68(
|
|
6277
6474
|
"plugin_job_runs",
|
|
6278
6475
|
{
|
|
6279
|
-
id:
|
|
6476
|
+
id: uuid66("id").primaryKey().defaultRandom(),
|
|
6280
6477
|
/** FK to the parent job definition. Cascades on delete. */
|
|
6281
|
-
jobId:
|
|
6478
|
+
jobId: uuid66("job_id").notNull().references(() => pluginJobs.id, { onDelete: "cascade" }),
|
|
6282
6479
|
/** Denormalized FK to the owning plugin for efficient querying. Cascades on delete. */
|
|
6283
|
-
pluginId:
|
|
6480
|
+
pluginId: uuid66("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
|
|
6284
6481
|
/** What caused this run to start (`"scheduled"` or `"manual"`). */
|
|
6285
|
-
trigger:
|
|
6482
|
+
trigger: text69("trigger").$type().notNull(),
|
|
6286
6483
|
/** Current lifecycle state of this run. */
|
|
6287
|
-
status:
|
|
6484
|
+
status: text69("status").$type().notNull().default("pending"),
|
|
6288
6485
|
/** Wall-clock duration in milliseconds. Null until the run finishes. */
|
|
6289
6486
|
durationMs: integer22("duration_ms"),
|
|
6290
6487
|
/** Error message if `status === "failed"`. */
|
|
6291
|
-
error:
|
|
6488
|
+
error: text69("error"),
|
|
6292
6489
|
/** Ordered list of log lines emitted during this run. */
|
|
6293
|
-
logs:
|
|
6294
|
-
startedAt:
|
|
6295
|
-
finishedAt:
|
|
6296
|
-
createdAt:
|
|
6490
|
+
logs: jsonb35("logs").$type().notNull().default([]),
|
|
6491
|
+
startedAt: timestamp68("started_at", { withTimezone: true }),
|
|
6492
|
+
finishedAt: timestamp68("finished_at", { withTimezone: true }),
|
|
6493
|
+
createdAt: timestamp68("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6297
6494
|
},
|
|
6298
6495
|
(table) => ({
|
|
6299
|
-
jobIdx:
|
|
6300
|
-
pluginIdx:
|
|
6301
|
-
statusIdx:
|
|
6496
|
+
jobIdx: index62("plugin_job_runs_job_idx").on(table.jobId),
|
|
6497
|
+
pluginIdx: index62("plugin_job_runs_plugin_idx").on(table.pluginId),
|
|
6498
|
+
statusIdx: index62("plugin_job_runs_status_idx").on(table.status)
|
|
6302
6499
|
})
|
|
6303
6500
|
);
|
|
6304
6501
|
}
|
|
@@ -6306,47 +6503,47 @@ var init_plugin_jobs = __esm({
|
|
|
6306
6503
|
|
|
6307
6504
|
// ../packages/db/src/schema/plugin_webhooks.ts
|
|
6308
6505
|
import {
|
|
6309
|
-
pgTable as
|
|
6310
|
-
uuid as
|
|
6311
|
-
text as
|
|
6506
|
+
pgTable as pgTable69,
|
|
6507
|
+
uuid as uuid67,
|
|
6508
|
+
text as text70,
|
|
6312
6509
|
integer as integer23,
|
|
6313
|
-
timestamp as
|
|
6314
|
-
jsonb as
|
|
6315
|
-
index as
|
|
6510
|
+
timestamp as timestamp69,
|
|
6511
|
+
jsonb as jsonb36,
|
|
6512
|
+
index as index63
|
|
6316
6513
|
} from "drizzle-orm/pg-core";
|
|
6317
6514
|
var pluginWebhookDeliveries;
|
|
6318
6515
|
var init_plugin_webhooks = __esm({
|
|
6319
6516
|
"../packages/db/src/schema/plugin_webhooks.ts"() {
|
|
6320
6517
|
"use strict";
|
|
6321
6518
|
init_plugins();
|
|
6322
|
-
pluginWebhookDeliveries =
|
|
6519
|
+
pluginWebhookDeliveries = pgTable69(
|
|
6323
6520
|
"plugin_webhook_deliveries",
|
|
6324
6521
|
{
|
|
6325
|
-
id:
|
|
6522
|
+
id: uuid67("id").primaryKey().defaultRandom(),
|
|
6326
6523
|
/** FK to the owning plugin. Cascades on delete. */
|
|
6327
|
-
pluginId:
|
|
6524
|
+
pluginId: uuid67("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
|
|
6328
6525
|
/** Identifier matching the key in the plugin manifest's `webhooks` array. */
|
|
6329
|
-
webhookKey:
|
|
6526
|
+
webhookKey: text70("webhook_key").notNull(),
|
|
6330
6527
|
/** Optional de-duplication ID provided by the external system. */
|
|
6331
|
-
externalId:
|
|
6528
|
+
externalId: text70("external_id"),
|
|
6332
6529
|
/** Current delivery state. */
|
|
6333
|
-
status:
|
|
6530
|
+
status: text70("status").$type().notNull().default("pending"),
|
|
6334
6531
|
/** Wall-clock processing duration in milliseconds. Null until delivery finishes. */
|
|
6335
6532
|
durationMs: integer23("duration_ms"),
|
|
6336
6533
|
/** Error message if `status === "failed"`. */
|
|
6337
|
-
error:
|
|
6534
|
+
error: text70("error"),
|
|
6338
6535
|
/** Raw JSON body of the inbound HTTP request. */
|
|
6339
|
-
payload:
|
|
6536
|
+
payload: jsonb36("payload").$type().notNull(),
|
|
6340
6537
|
/** Relevant HTTP headers from the inbound request (e.g. signature headers). */
|
|
6341
|
-
headers:
|
|
6342
|
-
startedAt:
|
|
6343
|
-
finishedAt:
|
|
6344
|
-
createdAt:
|
|
6538
|
+
headers: jsonb36("headers").$type().notNull().default({}),
|
|
6539
|
+
startedAt: timestamp69("started_at", { withTimezone: true }),
|
|
6540
|
+
finishedAt: timestamp69("finished_at", { withTimezone: true }),
|
|
6541
|
+
createdAt: timestamp69("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6345
6542
|
},
|
|
6346
6543
|
(table) => ({
|
|
6347
|
-
pluginIdx:
|
|
6348
|
-
statusIdx:
|
|
6349
|
-
keyIdx:
|
|
6544
|
+
pluginIdx: index63("plugin_webhook_deliveries_plugin_idx").on(table.pluginId),
|
|
6545
|
+
statusIdx: index63("plugin_webhook_deliveries_status_idx").on(table.status),
|
|
6546
|
+
keyIdx: index63("plugin_webhook_deliveries_key_idx").on(table.webhookKey)
|
|
6350
6547
|
})
|
|
6351
6548
|
);
|
|
6352
6549
|
}
|
|
@@ -6354,34 +6551,34 @@ var init_plugin_webhooks = __esm({
|
|
|
6354
6551
|
|
|
6355
6552
|
// ../packages/db/src/schema/plugin_logs.ts
|
|
6356
6553
|
import {
|
|
6357
|
-
pgTable as
|
|
6358
|
-
uuid as
|
|
6359
|
-
text as
|
|
6360
|
-
timestamp as
|
|
6361
|
-
jsonb as
|
|
6362
|
-
index as
|
|
6554
|
+
pgTable as pgTable70,
|
|
6555
|
+
uuid as uuid68,
|
|
6556
|
+
text as text71,
|
|
6557
|
+
timestamp as timestamp70,
|
|
6558
|
+
jsonb as jsonb37,
|
|
6559
|
+
index as index64
|
|
6363
6560
|
} from "drizzle-orm/pg-core";
|
|
6364
6561
|
var pluginLogs;
|
|
6365
6562
|
var init_plugin_logs = __esm({
|
|
6366
6563
|
"../packages/db/src/schema/plugin_logs.ts"() {
|
|
6367
6564
|
"use strict";
|
|
6368
6565
|
init_plugins();
|
|
6369
|
-
pluginLogs =
|
|
6566
|
+
pluginLogs = pgTable70(
|
|
6370
6567
|
"plugin_logs",
|
|
6371
6568
|
{
|
|
6372
|
-
id:
|
|
6373
|
-
pluginId:
|
|
6374
|
-
level:
|
|
6375
|
-
message:
|
|
6376
|
-
meta:
|
|
6377
|
-
createdAt:
|
|
6569
|
+
id: uuid68("id").primaryKey().defaultRandom(),
|
|
6570
|
+
pluginId: uuid68("plugin_id").notNull().references(() => plugins.id, { onDelete: "cascade" }),
|
|
6571
|
+
level: text71("level").notNull().default("info"),
|
|
6572
|
+
message: text71("message").notNull(),
|
|
6573
|
+
meta: jsonb37("meta").$type(),
|
|
6574
|
+
createdAt: timestamp70("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6378
6575
|
},
|
|
6379
6576
|
(table) => ({
|
|
6380
|
-
pluginTimeIdx:
|
|
6577
|
+
pluginTimeIdx: index64("plugin_logs_plugin_time_idx").on(
|
|
6381
6578
|
table.pluginId,
|
|
6382
6579
|
table.createdAt
|
|
6383
6580
|
),
|
|
6384
|
-
levelIdx:
|
|
6581
|
+
levelIdx: index64("plugin_logs_level_idx").on(table.level)
|
|
6385
6582
|
})
|
|
6386
6583
|
);
|
|
6387
6584
|
}
|
|
@@ -6411,6 +6608,8 @@ __export(schema_exports, {
|
|
|
6411
6608
|
boardApiKeys: () => boardApiKeys,
|
|
6412
6609
|
budgetIncidents: () => budgetIncidents,
|
|
6413
6610
|
budgetPolicies: () => budgetPolicies,
|
|
6611
|
+
calendarEvents: () => calendarEvents,
|
|
6612
|
+
calendarSources: () => calendarSources,
|
|
6414
6613
|
chatAttachments: () => chatAttachments,
|
|
6415
6614
|
chatContextLinks: () => chatContextLinks,
|
|
6416
6615
|
chatConversationUserStates: () => chatConversationUserStates,
|
|
@@ -6505,6 +6704,8 @@ var init_schema2 = __esm({
|
|
|
6505
6704
|
init_chat_messages();
|
|
6506
6705
|
init_chat_context_links();
|
|
6507
6706
|
init_chat_attachments();
|
|
6707
|
+
init_calendar_sources();
|
|
6708
|
+
init_calendar_events();
|
|
6508
6709
|
init_automations();
|
|
6509
6710
|
init_issue_work_products();
|
|
6510
6711
|
init_labels();
|
|
@@ -7369,7 +7570,7 @@ function sanitizeRestoreErrorMessage(error) {
|
|
|
7369
7570
|
}
|
|
7370
7571
|
return error instanceof Error ? error.message : String(error);
|
|
7371
7572
|
}
|
|
7372
|
-
function
|
|
7573
|
+
function timestamp71(date2 = /* @__PURE__ */ new Date()) {
|
|
7373
7574
|
const pad = (n) => String(n).padStart(2, "0");
|
|
7374
7575
|
return `${date2.getFullYear()}${pad(date2.getMonth() + 1)}${pad(date2.getDate())}-${pad(date2.getHours())}${pad(date2.getMinutes())}${pad(date2.getSeconds())}`;
|
|
7375
7576
|
}
|
|
@@ -7693,8 +7894,8 @@ async function runDatabaseBackup(opts) {
|
|
|
7693
7894
|
const rows = await sql4.unsafe(`SELECT * FROM ${qualifiedTableName}`).values();
|
|
7694
7895
|
const nullifiedColumns = nullifiedColumnsByTable.get(tablename) ?? /* @__PURE__ */ new Set();
|
|
7695
7896
|
for (const row of rows) {
|
|
7696
|
-
const values = row.map((rawValue,
|
|
7697
|
-
const columnName = cols[
|
|
7897
|
+
const values = row.map((rawValue, index65) => {
|
|
7898
|
+
const columnName = cols[index65]?.column_name;
|
|
7698
7899
|
const val = columnName && nullifiedColumns.has(columnName) ? null : rawValue;
|
|
7699
7900
|
if (val === null || val === void 0) return "NULL";
|
|
7700
7901
|
if (typeof val === "boolean") return val ? "true" : "false";
|
|
@@ -7724,7 +7925,7 @@ async function runDatabaseBackup(opts) {
|
|
|
7724
7925
|
emitStatement("COMMIT;");
|
|
7725
7926
|
emit("");
|
|
7726
7927
|
mkdirSync(opts.backupDir, { recursive: true });
|
|
7727
|
-
const backupFile = resolve2(opts.backupDir, `${filenamePrefix}-${
|
|
7928
|
+
const backupFile = resolve2(opts.backupDir, `${filenamePrefix}-${timestamp71()}.sql`);
|
|
7728
7929
|
await writeFile(backupFile, lines.join("\n"), "utf8");
|
|
7729
7930
|
const sizeBytes = statSync(backupFile).size;
|
|
7730
7931
|
const prunedCount = pruneOldBackups(opts.backupDir, retentionDays, filenamePrefix);
|
|
@@ -7796,6 +7997,8 @@ __export(src_exports, {
|
|
|
7796
7997
|
boardApiKeys: () => boardApiKeys,
|
|
7797
7998
|
budgetIncidents: () => budgetIncidents,
|
|
7798
7999
|
budgetPolicies: () => budgetPolicies,
|
|
8000
|
+
calendarEvents: () => calendarEvents,
|
|
8001
|
+
calendarSources: () => calendarSources,
|
|
7799
8002
|
chatAttachments: () => chatAttachments,
|
|
7800
8003
|
chatContextLinks: () => chatContextLinks,
|
|
7801
8004
|
chatConversationUserStates: () => chatConversationUserStates,
|
|
@@ -10220,8 +10423,8 @@ function compareStableSemver(a, b) {
|
|
|
10220
10423
|
const aMatch = a.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)$/);
|
|
10221
10424
|
const bMatch = b.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)$/);
|
|
10222
10425
|
if (!aMatch || !bMatch) return 0;
|
|
10223
|
-
for (let
|
|
10224
|
-
const diff = Number(aMatch[
|
|
10426
|
+
for (let index65 = 1; index65 <= 3; index65 += 1) {
|
|
10427
|
+
const diff = Number(aMatch[index65]) - Number(bMatch[index65]);
|
|
10225
10428
|
if (diff !== 0) return diff;
|
|
10226
10429
|
}
|
|
10227
10430
|
return 0;
|
|
@@ -10931,8 +11134,8 @@ function printClaudeStreamEvent(raw, debug) {
|
|
|
10931
11134
|
const block = blockRaw;
|
|
10932
11135
|
const blockType = typeof block.type === "string" ? block.type : "";
|
|
10933
11136
|
if (blockType === "text") {
|
|
10934
|
-
const
|
|
10935
|
-
if (
|
|
11137
|
+
const text72 = typeof block.text === "string" ? block.text : "";
|
|
11138
|
+
if (text72) console.log(pc10.green(`assistant: ${text72}`));
|
|
10936
11139
|
} else if (blockType === "tool_use") {
|
|
10937
11140
|
const name = typeof block.name === "string" ? block.name : "unknown";
|
|
10938
11141
|
console.log(pc10.yellow(`tool_call: ${name}`));
|
|
@@ -11024,13 +11227,13 @@ function printItemStarted(item) {
|
|
|
11024
11227
|
function printItemCompleted(item) {
|
|
11025
11228
|
const itemType = asString(item.type);
|
|
11026
11229
|
if (itemType === "agent_message") {
|
|
11027
|
-
const
|
|
11028
|
-
if (
|
|
11230
|
+
const text72 = asString(item.text);
|
|
11231
|
+
if (text72) console.log(pc11.green(`assistant: ${text72}`));
|
|
11029
11232
|
return true;
|
|
11030
11233
|
}
|
|
11031
11234
|
if (itemType === "reasoning") {
|
|
11032
|
-
const
|
|
11033
|
-
if (
|
|
11235
|
+
const text72 = asString(item.text);
|
|
11236
|
+
if (text72) console.log(pc11.gray(`thinking: ${text72}`));
|
|
11034
11237
|
return true;
|
|
11035
11238
|
}
|
|
11036
11239
|
if (itemType === "tool_use") {
|
|
@@ -11080,9 +11283,9 @@ function printItemCompleted(item) {
|
|
|
11080
11283
|
}
|
|
11081
11284
|
if (itemType === "tool_result") {
|
|
11082
11285
|
const isError = item.is_error === true || asString(item.status) === "error";
|
|
11083
|
-
const
|
|
11286
|
+
const text72 = asString(item.content) || asString(item.result) || asString(item.output);
|
|
11084
11287
|
console.log((isError ? pc11.red : pc11.cyan)(`tool_result${isError ? " (error)" : ""}`));
|
|
11085
|
-
if (
|
|
11288
|
+
if (text72) console.log((isError ? pc11.red : pc11.gray)(text72));
|
|
11086
11289
|
return true;
|
|
11087
11290
|
}
|
|
11088
11291
|
return false;
|
|
@@ -11201,8 +11404,8 @@ function stringifyUnknown(value) {
|
|
|
11201
11404
|
}
|
|
11202
11405
|
function printUserMessage(messageRaw) {
|
|
11203
11406
|
if (typeof messageRaw === "string") {
|
|
11204
|
-
const
|
|
11205
|
-
if (
|
|
11407
|
+
const text72 = messageRaw.trim();
|
|
11408
|
+
if (text72) console.log(pc12.gray(`user: ${text72}`));
|
|
11206
11409
|
return;
|
|
11207
11410
|
}
|
|
11208
11411
|
const message = asRecord2(messageRaw);
|
|
@@ -11215,14 +11418,14 @@ function printUserMessage(messageRaw) {
|
|
|
11215
11418
|
if (!part) continue;
|
|
11216
11419
|
const type = asString2(part.type).trim();
|
|
11217
11420
|
if (type !== "output_text" && type !== "text") continue;
|
|
11218
|
-
const
|
|
11219
|
-
if (
|
|
11421
|
+
const text72 = asString2(part.text).trim();
|
|
11422
|
+
if (text72) console.log(pc12.gray(`user: ${text72}`));
|
|
11220
11423
|
}
|
|
11221
11424
|
}
|
|
11222
11425
|
function printAssistantMessage(messageRaw) {
|
|
11223
11426
|
if (typeof messageRaw === "string") {
|
|
11224
|
-
const
|
|
11225
|
-
if (
|
|
11427
|
+
const text72 = messageRaw.trim();
|
|
11428
|
+
if (text72) console.log(pc12.green(`assistant: ${text72}`));
|
|
11226
11429
|
return;
|
|
11227
11430
|
}
|
|
11228
11431
|
const message = asRecord2(messageRaw);
|
|
@@ -11235,13 +11438,13 @@ function printAssistantMessage(messageRaw) {
|
|
|
11235
11438
|
if (!part) continue;
|
|
11236
11439
|
const type = asString2(part.type).trim();
|
|
11237
11440
|
if (type === "output_text" || type === "text") {
|
|
11238
|
-
const
|
|
11239
|
-
if (
|
|
11441
|
+
const text72 = asString2(part.text).trim();
|
|
11442
|
+
if (text72) console.log(pc12.green(`assistant: ${text72}`));
|
|
11240
11443
|
continue;
|
|
11241
11444
|
}
|
|
11242
11445
|
if (type === "thinking") {
|
|
11243
|
-
const
|
|
11244
|
-
if (
|
|
11446
|
+
const text72 = asString2(part.text).trim();
|
|
11447
|
+
if (text72) console.log(pc12.gray(`thinking: ${text72}`));
|
|
11245
11448
|
continue;
|
|
11246
11449
|
}
|
|
11247
11450
|
if (type === "tool_call") {
|
|
@@ -11361,8 +11564,8 @@ function printCursorStreamEvent(raw, _debug) {
|
|
|
11361
11564
|
return;
|
|
11362
11565
|
}
|
|
11363
11566
|
if (type === "thinking") {
|
|
11364
|
-
const
|
|
11365
|
-
if (
|
|
11567
|
+
const text72 = asString2(parsed.text).trim() || asString2(asRecord2(parsed.delta)?.text).trim();
|
|
11568
|
+
if (text72) console.log(pc12.gray(`thinking: ${text72}`));
|
|
11366
11569
|
return;
|
|
11367
11570
|
}
|
|
11368
11571
|
if (type === "tool_call") {
|
|
@@ -11400,8 +11603,8 @@ function printCursorStreamEvent(raw, _debug) {
|
|
|
11400
11603
|
}
|
|
11401
11604
|
if (type === "text") {
|
|
11402
11605
|
const part = asRecord2(parsed.part);
|
|
11403
|
-
const
|
|
11404
|
-
if (
|
|
11606
|
+
const text72 = asString2(part?.text);
|
|
11607
|
+
if (text72) console.log(pc12.green(`assistant: ${text72}`));
|
|
11405
11608
|
return;
|
|
11406
11609
|
}
|
|
11407
11610
|
if (type === "tool_use") {
|
|
@@ -11464,8 +11667,8 @@ function errorText2(value) {
|
|
|
11464
11667
|
}
|
|
11465
11668
|
function printTextMessage(prefix, colorize, messageRaw) {
|
|
11466
11669
|
if (typeof messageRaw === "string") {
|
|
11467
|
-
const
|
|
11468
|
-
if (
|
|
11670
|
+
const text72 = messageRaw.trim();
|
|
11671
|
+
if (text72) console.log(colorize(`${prefix}: ${text72}`));
|
|
11469
11672
|
return;
|
|
11470
11673
|
}
|
|
11471
11674
|
const message = asRecord3(messageRaw);
|
|
@@ -11478,13 +11681,13 @@ function printTextMessage(prefix, colorize, messageRaw) {
|
|
|
11478
11681
|
if (!part) continue;
|
|
11479
11682
|
const type = asString3(part.type).trim();
|
|
11480
11683
|
if (type === "output_text" || type === "text" || type === "content") {
|
|
11481
|
-
const
|
|
11482
|
-
if (
|
|
11684
|
+
const text72 = asString3(part.text).trim() || asString3(part.content).trim();
|
|
11685
|
+
if (text72) console.log(colorize(`${prefix}: ${text72}`));
|
|
11483
11686
|
continue;
|
|
11484
11687
|
}
|
|
11485
11688
|
if (type === "thinking") {
|
|
11486
|
-
const
|
|
11487
|
-
if (
|
|
11689
|
+
const text72 = asString3(part.text).trim();
|
|
11690
|
+
if (text72) console.log(pc13.gray(`thinking: ${text72}`));
|
|
11488
11691
|
continue;
|
|
11489
11692
|
}
|
|
11490
11693
|
if (type === "tool_call") {
|
|
@@ -11536,8 +11739,8 @@ function printGeminiStreamEvent(raw, _debug) {
|
|
|
11536
11739
|
return;
|
|
11537
11740
|
}
|
|
11538
11741
|
if (subtype === "error") {
|
|
11539
|
-
const
|
|
11540
|
-
if (
|
|
11742
|
+
const text72 = errorText2(parsed.error ?? parsed.message ?? parsed.detail);
|
|
11743
|
+
if (text72) console.log(pc13.red(`error: ${text72}`));
|
|
11541
11744
|
return;
|
|
11542
11745
|
}
|
|
11543
11746
|
console.log(pc13.blue(`system: ${subtype || "event"}`));
|
|
@@ -11552,8 +11755,8 @@ function printGeminiStreamEvent(raw, _debug) {
|
|
|
11552
11755
|
return;
|
|
11553
11756
|
}
|
|
11554
11757
|
if (type === "thinking") {
|
|
11555
|
-
const
|
|
11556
|
-
if (
|
|
11758
|
+
const text72 = asString3(parsed.text).trim() || asString3(asRecord3(parsed.delta)?.text).trim();
|
|
11759
|
+
if (text72) console.log(pc13.gray(`thinking: ${text72}`));
|
|
11557
11760
|
return;
|
|
11558
11761
|
}
|
|
11559
11762
|
if (type === "tool_call") {
|
|
@@ -11589,8 +11792,8 @@ function printGeminiStreamEvent(raw, _debug) {
|
|
|
11589
11792
|
return;
|
|
11590
11793
|
}
|
|
11591
11794
|
if (type === "error") {
|
|
11592
|
-
const
|
|
11593
|
-
if (
|
|
11795
|
+
const text72 = errorText2(parsed.error ?? parsed.message ?? parsed.detail);
|
|
11796
|
+
if (text72) console.log(pc13.red(`error: ${text72}`));
|
|
11594
11797
|
return;
|
|
11595
11798
|
}
|
|
11596
11799
|
console.log(line);
|
|
@@ -11598,9 +11801,9 @@ function printGeminiStreamEvent(raw, _debug) {
|
|
|
11598
11801
|
|
|
11599
11802
|
// ../packages/agent-runtimes/opencode-local/src/cli/format-event.ts
|
|
11600
11803
|
import pc14 from "picocolors";
|
|
11601
|
-
function safeJsonParse(
|
|
11804
|
+
function safeJsonParse(text72) {
|
|
11602
11805
|
try {
|
|
11603
|
-
return JSON.parse(
|
|
11806
|
+
return JSON.parse(text72);
|
|
11604
11807
|
} catch {
|
|
11605
11808
|
return null;
|
|
11606
11809
|
}
|
|
@@ -11644,14 +11847,14 @@ function printOpenCodeStreamEvent(raw, _debug) {
|
|
|
11644
11847
|
}
|
|
11645
11848
|
if (type === "text") {
|
|
11646
11849
|
const part = asRecord4(parsed.part);
|
|
11647
|
-
const
|
|
11648
|
-
if (
|
|
11850
|
+
const text72 = asString4(part?.text).trim();
|
|
11851
|
+
if (text72) console.log(pc14.green(`assistant: ${text72}`));
|
|
11649
11852
|
return;
|
|
11650
11853
|
}
|
|
11651
11854
|
if (type === "reasoning") {
|
|
11652
11855
|
const part = asRecord4(parsed.part);
|
|
11653
|
-
const
|
|
11654
|
-
if (
|
|
11856
|
+
const text72 = asString4(part?.text).trim();
|
|
11857
|
+
if (text72) console.log(pc14.gray(`thinking: ${text72}`));
|
|
11655
11858
|
return;
|
|
11656
11859
|
}
|
|
11657
11860
|
if (type === "tool_use") {
|
|
@@ -11699,9 +11902,9 @@ function printOpenCodeStreamEvent(raw, _debug) {
|
|
|
11699
11902
|
|
|
11700
11903
|
// ../packages/agent-runtimes/pi-local/src/cli/format-event.ts
|
|
11701
11904
|
import pc15 from "picocolors";
|
|
11702
|
-
function safeJsonParse2(
|
|
11905
|
+
function safeJsonParse2(text72) {
|
|
11703
11906
|
try {
|
|
11704
|
-
return JSON.parse(
|
|
11907
|
+
return JSON.parse(text72);
|
|
11705
11908
|
} catch {
|
|
11706
11909
|
return null;
|
|
11707
11910
|
}
|
|
@@ -11743,9 +11946,9 @@ function printPiStreamEvent(raw, _debug) {
|
|
|
11743
11946
|
const message = asRecord5(parsed.message);
|
|
11744
11947
|
if (message) {
|
|
11745
11948
|
const content = message.content;
|
|
11746
|
-
const
|
|
11747
|
-
if (
|
|
11748
|
-
console.log(pc15.green(`assistant: ${
|
|
11949
|
+
const text72 = extractTextContent(content);
|
|
11950
|
+
if (text72) {
|
|
11951
|
+
console.log(pc15.green(`assistant: ${text72}`));
|
|
11749
11952
|
}
|
|
11750
11953
|
}
|
|
11751
11954
|
return;
|
|
@@ -12314,11 +12517,11 @@ var RudderApiClient = class {
|
|
|
12314
12517
|
if (response.status === 204) {
|
|
12315
12518
|
return null;
|
|
12316
12519
|
}
|
|
12317
|
-
const
|
|
12318
|
-
if (!
|
|
12520
|
+
const text72 = await response.text();
|
|
12521
|
+
if (!text72.trim()) {
|
|
12319
12522
|
return null;
|
|
12320
12523
|
}
|
|
12321
|
-
return safeParseJson(
|
|
12524
|
+
return safeParseJson(text72);
|
|
12322
12525
|
}
|
|
12323
12526
|
};
|
|
12324
12527
|
function shouldAttachRunId(method) {
|
|
@@ -12333,16 +12536,16 @@ function buildUrl(apiBase, path23) {
|
|
|
12333
12536
|
if (query) url.search = query;
|
|
12334
12537
|
return url.toString();
|
|
12335
12538
|
}
|
|
12336
|
-
function safeParseJson(
|
|
12539
|
+
function safeParseJson(text72) {
|
|
12337
12540
|
try {
|
|
12338
|
-
return JSON.parse(
|
|
12541
|
+
return JSON.parse(text72);
|
|
12339
12542
|
} catch {
|
|
12340
|
-
return
|
|
12543
|
+
return text72;
|
|
12341
12544
|
}
|
|
12342
12545
|
}
|
|
12343
12546
|
async function toApiError(response) {
|
|
12344
|
-
const
|
|
12345
|
-
const parsed = safeParseJson(
|
|
12547
|
+
const text72 = await response.text();
|
|
12548
|
+
const parsed = safeParseJson(text72);
|
|
12346
12549
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
12347
12550
|
const body = parsed;
|
|
12348
12551
|
const message = typeof body.error === "string" && body.error.trim() || typeof body.message === "string" && body.message.trim() || `Request failed with status ${response.status}`;
|
|
@@ -14985,8 +15188,8 @@ function filterIssueRows(rows, match) {
|
|
|
14985
15188
|
if (!match?.trim()) return rows;
|
|
14986
15189
|
const needle = match.trim().toLowerCase();
|
|
14987
15190
|
return rows.filter((row) => {
|
|
14988
|
-
const
|
|
14989
|
-
return
|
|
15191
|
+
const text72 = [row.identifier, row.title, row.description].filter((part) => Boolean(part)).join("\n").toLowerCase();
|
|
15192
|
+
return text72.includes(needle);
|
|
14990
15193
|
});
|
|
14991
15194
|
}
|
|
14992
15195
|
|
|
@@ -18642,9 +18845,9 @@ import { LangfuseClient } from "@langfuse/client";
|
|
|
18642
18845
|
|
|
18643
18846
|
// ../packages/run-intelligence-core/src/trace.ts
|
|
18644
18847
|
function truncate(value, maxLength = 180) {
|
|
18645
|
-
const
|
|
18646
|
-
if (!
|
|
18647
|
-
return
|
|
18848
|
+
const text72 = value.trim();
|
|
18849
|
+
if (!text72) return "";
|
|
18850
|
+
return text72.length > maxLength ? `${text72.slice(0, maxLength - 1)}\u2026` : text72;
|
|
18648
18851
|
}
|
|
18649
18852
|
function firstMeaningfulLine(value) {
|
|
18650
18853
|
for (const line of value.split(/\r?\n/)) {
|
|
@@ -19448,9 +19651,9 @@ function extractPromptText(body) {
|
|
|
19448
19651
|
const nested = asString6(prompt.prompt) ?? asString6(prompt.text);
|
|
19449
19652
|
if (nested) return nested;
|
|
19450
19653
|
}
|
|
19451
|
-
const
|
|
19452
|
-
if (
|
|
19453
|
-
const nested = asString6(
|
|
19654
|
+
const text72 = body.text;
|
|
19655
|
+
if (text72 && typeof text72 === "object" && !Array.isArray(text72)) {
|
|
19656
|
+
const nested = asString6(text72.content) ?? asString6(text72.text);
|
|
19454
19657
|
if (nested) return nested;
|
|
19455
19658
|
}
|
|
19456
19659
|
return null;
|