bopodev-db 0.1.12 → 0.1.14
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/LICENSE +1 -1
- package/dist/repositories.d.ts +247 -4
- package/dist/schema.d.ts +3124 -830
- package/package.json +1 -1
- package/src/bootstrap.ts +143 -0
- package/src/repositories.ts +509 -3
- package/src/schema.ts +118 -9
package/src/schema.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { sql } from "drizzle-orm";
|
|
2
|
-
import {
|
|
3
|
-
boolean,
|
|
4
|
-
integer,
|
|
5
|
-
numeric,
|
|
6
|
-
pgTable,
|
|
7
|
-
primaryKey,
|
|
8
|
-
text,
|
|
9
|
-
timestamp
|
|
10
|
-
} from "drizzle-orm/pg-core";
|
|
2
|
+
import { boolean, integer, numeric, pgTable, primaryKey, text, timestamp } from "drizzle-orm/pg-core";
|
|
11
3
|
|
|
12
4
|
export const companies = pgTable("companies", {
|
|
13
5
|
id: text("id").primaryKey(),
|
|
@@ -116,6 +108,26 @@ export const issueComments = pgTable("issue_comments", {
|
|
|
116
108
|
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull()
|
|
117
109
|
});
|
|
118
110
|
|
|
111
|
+
export const issueAttachments = pgTable("issue_attachments", {
|
|
112
|
+
id: text("id").primaryKey(),
|
|
113
|
+
companyId: text("company_id")
|
|
114
|
+
.notNull()
|
|
115
|
+
.references(() => companies.id, { onDelete: "cascade" }),
|
|
116
|
+
issueId: text("issue_id")
|
|
117
|
+
.notNull()
|
|
118
|
+
.references(() => issues.id, { onDelete: "cascade" }),
|
|
119
|
+
projectId: text("project_id")
|
|
120
|
+
.notNull()
|
|
121
|
+
.references(() => projects.id, { onDelete: "cascade" }),
|
|
122
|
+
fileName: text("file_name").notNull(),
|
|
123
|
+
mimeType: text("mime_type"),
|
|
124
|
+
fileSizeBytes: integer("file_size_bytes").notNull(),
|
|
125
|
+
relativePath: text("relative_path").notNull(),
|
|
126
|
+
uploadedByActorType: text("uploaded_by_actor_type").notNull().default("human"),
|
|
127
|
+
uploadedByActorId: text("uploaded_by_actor_id"),
|
|
128
|
+
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull()
|
|
129
|
+
});
|
|
130
|
+
|
|
119
131
|
export const activityLogs = pgTable("activity_logs", {
|
|
120
132
|
id: text("id").primaryKey(),
|
|
121
133
|
companyId: text("company_id")
|
|
@@ -143,6 +155,25 @@ export const heartbeatRuns = pgTable("heartbeat_runs", {
|
|
|
143
155
|
message: text("message")
|
|
144
156
|
});
|
|
145
157
|
|
|
158
|
+
export const heartbeatRunMessages = pgTable("heartbeat_run_messages", {
|
|
159
|
+
id: text("id").primaryKey(),
|
|
160
|
+
companyId: text("company_id")
|
|
161
|
+
.notNull()
|
|
162
|
+
.references(() => companies.id, { onDelete: "cascade" }),
|
|
163
|
+
runId: text("run_id")
|
|
164
|
+
.notNull()
|
|
165
|
+
.references(() => heartbeatRuns.id, { onDelete: "cascade" }),
|
|
166
|
+
sequence: integer("sequence").notNull(),
|
|
167
|
+
kind: text("kind").notNull(),
|
|
168
|
+
label: text("label"),
|
|
169
|
+
text: text("text"),
|
|
170
|
+
payloadJson: text("payload_json"),
|
|
171
|
+
signalLevel: text("signal_level"),
|
|
172
|
+
groupKey: text("group_key"),
|
|
173
|
+
source: text("source"),
|
|
174
|
+
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull()
|
|
175
|
+
});
|
|
176
|
+
|
|
146
177
|
export const approvalRequests = pgTable("approval_requests", {
|
|
147
178
|
id: text("id").primaryKey(),
|
|
148
179
|
companyId: text("company_id")
|
|
@@ -183,6 +214,10 @@ export const costLedger = pgTable("cost_ledger", {
|
|
|
183
214
|
issueId: text("issue_id").references(() => issues.id, { onDelete: "set null" }),
|
|
184
215
|
agentId: text("agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
185
216
|
providerType: text("provider_type").notNull(),
|
|
217
|
+
runtimeModelId: text("runtime_model_id"),
|
|
218
|
+
pricingProviderType: text("pricing_provider_type"),
|
|
219
|
+
pricingModelId: text("pricing_model_id"),
|
|
220
|
+
pricingSource: text("pricing_source"),
|
|
186
221
|
tokenInput: integer("token_input").notNull().default(0),
|
|
187
222
|
tokenOutput: integer("token_output").notNull().default(0),
|
|
188
223
|
usdCost: numeric("usd_cost", { precision: 12, scale: 6 }).notNull().default("0"),
|
|
@@ -204,6 +239,74 @@ export const auditEvents = pgTable("audit_events", {
|
|
|
204
239
|
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull()
|
|
205
240
|
});
|
|
206
241
|
|
|
242
|
+
export const plugins = pgTable("plugins", {
|
|
243
|
+
id: text("id").primaryKey(),
|
|
244
|
+
name: text("name").notNull(),
|
|
245
|
+
version: text("version").notNull(),
|
|
246
|
+
kind: text("kind").notNull(),
|
|
247
|
+
runtimeType: text("runtime_type").notNull(),
|
|
248
|
+
runtimeEntrypoint: text("runtime_entrypoint").notNull(),
|
|
249
|
+
hooksJson: text("hooks_json").notNull().default("[]"),
|
|
250
|
+
capabilitiesJson: text("capabilities_json").notNull().default("[]"),
|
|
251
|
+
manifestJson: text("manifest_json").notNull().default("{}"),
|
|
252
|
+
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
|
|
253
|
+
updatedAt: timestamp("updated_at", { mode: "date" }).defaultNow().notNull()
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
export const modelPricing = pgTable(
|
|
257
|
+
"model_pricing",
|
|
258
|
+
{
|
|
259
|
+
companyId: text("company_id")
|
|
260
|
+
.notNull()
|
|
261
|
+
.references(() => companies.id, { onDelete: "cascade" }),
|
|
262
|
+
providerType: text("provider_type").notNull(),
|
|
263
|
+
modelId: text("model_id").notNull(),
|
|
264
|
+
displayName: text("display_name"),
|
|
265
|
+
inputUsdPer1M: numeric("input_usd_per_1m", { precision: 12, scale: 6 }).notNull().default("0"),
|
|
266
|
+
outputUsdPer1M: numeric("output_usd_per_1m", { precision: 12, scale: 6 }).notNull().default("0"),
|
|
267
|
+
currency: text("currency").notNull().default("USD"),
|
|
268
|
+
updatedAt: timestamp("updated_at", { mode: "date" }).defaultNow().notNull(),
|
|
269
|
+
updatedBy: text("updated_by")
|
|
270
|
+
},
|
|
271
|
+
(table) => [primaryKey({ columns: [table.companyId, table.providerType, table.modelId] })]
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
export const pluginConfigs = pgTable(
|
|
275
|
+
"plugin_configs",
|
|
276
|
+
{
|
|
277
|
+
companyId: text("company_id")
|
|
278
|
+
.notNull()
|
|
279
|
+
.references(() => companies.id, { onDelete: "cascade" }),
|
|
280
|
+
pluginId: text("plugin_id")
|
|
281
|
+
.notNull()
|
|
282
|
+
.references(() => plugins.id, { onDelete: "cascade" }),
|
|
283
|
+
enabled: boolean("enabled").notNull().default(false),
|
|
284
|
+
priority: integer("priority").notNull().default(100),
|
|
285
|
+
configJson: text("config_json").notNull().default("{}"),
|
|
286
|
+
grantedCapabilitiesJson: text("granted_capabilities_json").notNull().default("[]"),
|
|
287
|
+
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
|
|
288
|
+
updatedAt: timestamp("updated_at", { mode: "date" }).defaultNow().notNull()
|
|
289
|
+
},
|
|
290
|
+
(table) => [primaryKey({ columns: [table.companyId, table.pluginId] })]
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
export const pluginRuns = pgTable("plugin_runs", {
|
|
294
|
+
id: text("id").primaryKey(),
|
|
295
|
+
companyId: text("company_id")
|
|
296
|
+
.notNull()
|
|
297
|
+
.references(() => companies.id, { onDelete: "cascade" }),
|
|
298
|
+
runId: text("run_id").references(() => heartbeatRuns.id, { onDelete: "cascade" }),
|
|
299
|
+
pluginId: text("plugin_id")
|
|
300
|
+
.notNull()
|
|
301
|
+
.references(() => plugins.id, { onDelete: "cascade" }),
|
|
302
|
+
hook: text("hook").notNull(),
|
|
303
|
+
status: text("status").notNull(),
|
|
304
|
+
durationMs: integer("duration_ms").notNull().default(0),
|
|
305
|
+
error: text("error"),
|
|
306
|
+
diagnosticsJson: text("diagnostics_json").notNull().default("{}"),
|
|
307
|
+
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull()
|
|
308
|
+
});
|
|
309
|
+
|
|
207
310
|
export const agentIssueLabels = pgTable(
|
|
208
311
|
"agent_issue_labels",
|
|
209
312
|
{
|
|
@@ -225,12 +328,18 @@ export const schema = {
|
|
|
225
328
|
agents,
|
|
226
329
|
issues,
|
|
227
330
|
issueComments,
|
|
331
|
+
issueAttachments,
|
|
228
332
|
activityLogs,
|
|
229
333
|
heartbeatRuns,
|
|
334
|
+
heartbeatRunMessages,
|
|
230
335
|
approvalRequests,
|
|
231
336
|
approvalInboxStates,
|
|
232
337
|
costLedger,
|
|
233
338
|
auditEvents,
|
|
339
|
+
plugins,
|
|
340
|
+
pluginConfigs,
|
|
341
|
+
pluginRuns,
|
|
342
|
+
modelPricing,
|
|
234
343
|
agentIssueLabels
|
|
235
344
|
};
|
|
236
345
|
|