bopodev-db 0.1.23 → 0.1.25

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/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,6 +257,24 @@ 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")
@@ -390,9 +443,11 @@ export const schema = {
390
443
  issueAttachments,
391
444
  activityLogs,
392
445
  heartbeatRuns,
446
+ heartbeatRunQueue,
393
447
  heartbeatRunMessages,
394
448
  approvalRequests,
395
449
  approvalInboxStates,
450
+ attentionInboxStates,
396
451
  costLedger,
397
452
  auditEvents,
398
453
  plugins,