bopodev-db 0.1.24 → 0.1.26
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-lint.log +4 -0
- package/.turbo/turbo-typecheck.log +1 -1
- package/dist/repositories.d.ts +397 -7
- package/dist/schema.d.ts +1356 -138
- package/package.json +1 -1
- package/src/bootstrap.ts +109 -0
- package/src/repositories.ts +609 -13
- package/src/schema.ts +57 -0
package/src/schema.ts
CHANGED
|
@@ -17,6 +17,13 @@ export const projects = pgTable("projects", {
|
|
|
17
17
|
description: text("description"),
|
|
18
18
|
status: text("status").notNull().default("planned"),
|
|
19
19
|
plannedStartAt: timestamp("planned_start_at", { mode: "date" }),
|
|
20
|
+
monthlyBudgetUsd: numeric("monthly_budget_usd", { precision: 12, scale: 4 })
|
|
21
|
+
.notNull()
|
|
22
|
+
.default("100"),
|
|
23
|
+
usedBudgetUsd: numeric("used_budget_usd", { precision: 12, scale: 4 })
|
|
24
|
+
.notNull()
|
|
25
|
+
.default("0"),
|
|
26
|
+
budgetWindowStartAt: timestamp("budget_window_start_at", { mode: "date" }).notNull().defaultNow(),
|
|
20
27
|
executionWorkspacePolicy: text("execution_workspace_policy"),
|
|
21
28
|
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
|
|
22
29
|
updatedAt: timestamp("updated_at", { mode: "date" }).defaultNow().notNull()
|
|
@@ -61,6 +68,8 @@ export const agents = pgTable("agents", {
|
|
|
61
68
|
.references(() => companies.id, { onDelete: "cascade" }),
|
|
62
69
|
managerAgentId: text("manager_agent_id"),
|
|
63
70
|
role: text("role").notNull(),
|
|
71
|
+
roleKey: text("role_key"),
|
|
72
|
+
title: text("title"),
|
|
64
73
|
name: text("name").notNull(),
|
|
65
74
|
providerType: text("provider_type").notNull(),
|
|
66
75
|
status: text("status").notNull().default("idle"),
|
|
@@ -121,6 +130,8 @@ export const issueComments = pgTable("issue_comments", {
|
|
|
121
130
|
.references(() => companies.id, { onDelete: "cascade" }),
|
|
122
131
|
authorType: text("author_type").notNull(),
|
|
123
132
|
authorId: text("author_id"),
|
|
133
|
+
recipientsJson: text("recipients_json").notNull().default("[]"),
|
|
134
|
+
runId: text("run_id"),
|
|
124
135
|
body: text("body").notNull(),
|
|
125
136
|
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull()
|
|
126
137
|
});
|
|
@@ -172,6 +183,30 @@ export const heartbeatRuns = pgTable("heartbeat_runs", {
|
|
|
172
183
|
message: text("message")
|
|
173
184
|
});
|
|
174
185
|
|
|
186
|
+
export const heartbeatRunQueue = pgTable("heartbeat_run_queue", {
|
|
187
|
+
id: text("id").primaryKey(),
|
|
188
|
+
companyId: text("company_id")
|
|
189
|
+
.notNull()
|
|
190
|
+
.references(() => companies.id, { onDelete: "cascade" }),
|
|
191
|
+
agentId: text("agent_id")
|
|
192
|
+
.notNull()
|
|
193
|
+
.references(() => agents.id, { onDelete: "cascade" }),
|
|
194
|
+
jobType: text("job_type").notNull(),
|
|
195
|
+
payloadJson: text("payload_json").notNull().default("{}"),
|
|
196
|
+
status: text("status").notNull().default("pending"),
|
|
197
|
+
priority: integer("priority").notNull().default(100),
|
|
198
|
+
idempotencyKey: text("idempotency_key"),
|
|
199
|
+
availableAt: timestamp("available_at", { mode: "date" }).defaultNow().notNull(),
|
|
200
|
+
attemptCount: integer("attempt_count").notNull().default(0),
|
|
201
|
+
maxAttempts: integer("max_attempts").notNull().default(10),
|
|
202
|
+
lastError: text("last_error"),
|
|
203
|
+
startedAt: timestamp("started_at", { mode: "date" }),
|
|
204
|
+
finishedAt: timestamp("finished_at", { mode: "date" }),
|
|
205
|
+
heartbeatRunId: text("heartbeat_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
|
|
206
|
+
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
|
|
207
|
+
updatedAt: timestamp("updated_at", { mode: "date" }).defaultNow().notNull()
|
|
208
|
+
});
|
|
209
|
+
|
|
175
210
|
export const heartbeatRunMessages = pgTable("heartbeat_run_messages", {
|
|
176
211
|
id: text("id").primaryKey(),
|
|
177
212
|
companyId: text("company_id")
|
|
@@ -222,11 +257,30 @@ export const approvalInboxStates = pgTable(
|
|
|
222
257
|
(table) => [primaryKey({ columns: [table.companyId, table.actorId, table.approvalId] })]
|
|
223
258
|
);
|
|
224
259
|
|
|
260
|
+
export const attentionInboxStates = pgTable(
|
|
261
|
+
"attention_inbox_states",
|
|
262
|
+
{
|
|
263
|
+
companyId: text("company_id")
|
|
264
|
+
.notNull()
|
|
265
|
+
.references(() => companies.id, { onDelete: "cascade" }),
|
|
266
|
+
actorId: text("actor_id").notNull(),
|
|
267
|
+
itemKey: text("item_key").notNull(),
|
|
268
|
+
seenAt: timestamp("seen_at", { mode: "date" }),
|
|
269
|
+
acknowledgedAt: timestamp("acknowledged_at", { mode: "date" }),
|
|
270
|
+
dismissedAt: timestamp("dismissed_at", { mode: "date" }),
|
|
271
|
+
resolvedAt: timestamp("resolved_at", { mode: "date" }),
|
|
272
|
+
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
|
|
273
|
+
updatedAt: timestamp("updated_at", { mode: "date" }).defaultNow().notNull()
|
|
274
|
+
},
|
|
275
|
+
(table) => [primaryKey({ columns: [table.companyId, table.actorId, table.itemKey] })]
|
|
276
|
+
);
|
|
277
|
+
|
|
225
278
|
export const costLedger = pgTable("cost_ledger", {
|
|
226
279
|
id: text("id").primaryKey(),
|
|
227
280
|
companyId: text("company_id")
|
|
228
281
|
.notNull()
|
|
229
282
|
.references(() => companies.id, { onDelete: "cascade" }),
|
|
283
|
+
runId: text("run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
|
|
230
284
|
projectId: text("project_id").references(() => projects.id, { onDelete: "set null" }),
|
|
231
285
|
issueId: text("issue_id").references(() => issues.id, { onDelete: "set null" }),
|
|
232
286
|
agentId: text("agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
@@ -238,6 +292,7 @@ export const costLedger = pgTable("cost_ledger", {
|
|
|
238
292
|
tokenInput: integer("token_input").notNull().default(0),
|
|
239
293
|
tokenOutput: integer("token_output").notNull().default(0),
|
|
240
294
|
usdCost: numeric("usd_cost", { precision: 12, scale: 6 }).notNull().default("0"),
|
|
295
|
+
usdCostStatus: text("usd_cost_status"),
|
|
241
296
|
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull()
|
|
242
297
|
});
|
|
243
298
|
|
|
@@ -390,9 +445,11 @@ export const schema = {
|
|
|
390
445
|
issueAttachments,
|
|
391
446
|
activityLogs,
|
|
392
447
|
heartbeatRuns,
|
|
448
|
+
heartbeatRunQueue,
|
|
393
449
|
heartbeatRunMessages,
|
|
394
450
|
approvalRequests,
|
|
395
451
|
approvalInboxStates,
|
|
452
|
+
attentionInboxStates,
|
|
396
453
|
costLedger,
|
|
397
454
|
auditEvents,
|
|
398
455
|
plugins,
|