bopodev-db 0.1.34 → 0.1.35

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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > bopodev-db@0.1.34 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopodev/packages/db
3
+ > bopodev-db@0.1.35 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopodev/packages/db
4
4
  > tsc -p tsconfig.json --emitDeclarationOnly
5
5
 
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Load the same env files as `apps/api` (`loadApiEnv`), so `db:migrate` targets the DB
3
+ * the API uses when developers run migrations from the shell without exporting variables.
4
+ */
5
+ export declare function loadMigrateEnv(): void;
@@ -19,6 +19,16 @@ export declare function getAssistantThreadById(db: BopoDb, companyId: string, th
19
19
  createdAt: Date;
20
20
  updatedAt: Date;
21
21
  } | null>;
22
+ /** Removes the thread and its messages (cascade). Returns whether a row was deleted. */
23
+ export declare function deleteAssistantThread(db: BopoDb, companyId: string, threadId: string): Promise<boolean>;
24
+ export type AssistantThreadSummary = {
25
+ id: string;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ previewBody: string | null;
29
+ };
30
+ /** Threads for the company, newest activity first, with last message body as preview (if any). */
31
+ export declare function listAssistantThreadsForCompany(db: BopoDb, companyId: string, limit?: number): Promise<AssistantThreadSummary[]>;
22
32
  export declare function touchAssistantThread(db: BopoDb, threadId: string): Promise<void>;
23
33
  export declare function insertAssistantMessage(db: BopoDb, input: {
24
34
  threadId: string;
@@ -263,8 +263,8 @@ export declare function listIssues(db: BopoDb, companyId: string, projectId?: st
263
263
  externalLink: string | null;
264
264
  isClaimed: boolean;
265
265
  claimedByHeartbeatRunId: string | null;
266
- loopId: string | null;
267
- loopRunId: string | null;
266
+ routineId: string | null;
267
+ routineRunId: string | null;
268
268
  createdAt: Date;
269
269
  updatedAt: Date;
270
270
  }[]>;
@@ -290,8 +290,8 @@ export declare function getIssue(db: BopoDb, companyId: string, issueId: string)
290
290
  externalLink: string | null;
291
291
  isClaimed: boolean;
292
292
  claimedByHeartbeatRunId: string | null;
293
- loopId: string | null;
294
- loopRunId: string | null;
293
+ routineId: string | null;
294
+ routineRunId: string | null;
295
295
  createdAt: Date;
296
296
  updatedAt: Date;
297
297
  } | null>;
@@ -308,8 +308,8 @@ export declare function createIssue(db: BopoDb, input: {
308
308
  assigneeAgentId?: string | null;
309
309
  labels?: string[];
310
310
  tags?: string[];
311
- loopId?: string | null;
312
- loopRunId?: string | null;
311
+ routineId?: string | null;
312
+ routineRunId?: string | null;
313
313
  }): Promise<{
314
314
  id: string;
315
315
  createdAt: Date;
@@ -327,8 +327,8 @@ export declare function createIssue(db: BopoDb, input: {
327
327
  externalLink: string | null;
328
328
  isClaimed: boolean;
329
329
  claimedByHeartbeatRunId: string | null;
330
- loopId: string | null;
331
- loopRunId: string | null;
330
+ routineId: string | null;
331
+ routineRunId: string | null;
332
332
  }>;
333
333
  export declare function updateIssue(db: BopoDb, input: {
334
334
  companyId: string;
@@ -358,8 +358,8 @@ export declare function updateIssue(db: BopoDb, input: {
358
358
  externalLink: string | null;
359
359
  isClaimed: boolean;
360
360
  claimedByHeartbeatRunId: string | null;
361
- loopId: string | null;
362
- loopRunId: string | null;
361
+ routineId: string | null;
362
+ routineRunId: string | null;
363
363
  createdAt: Date;
364
364
  updatedAt: Date;
365
365
  } | null>;
@@ -624,6 +624,8 @@ export declare function createAgent(db: BopoDb, input: {
624
624
  heartbeatCron: string;
625
625
  monthlyBudgetUsd: string;
626
626
  canHireAgents?: boolean;
627
+ canAssignAgents?: boolean;
628
+ canCreateIssues?: boolean;
627
629
  avatarSeed?: string;
628
630
  runtimeCommand?: string | null;
629
631
  runtimeArgsJson?: string;
@@ -649,6 +651,8 @@ export declare function createAgent(db: BopoDb, input: {
649
651
  heartbeatCron: string;
650
652
  monthlyBudgetUsd: string;
651
653
  canHireAgents?: boolean;
654
+ canAssignAgents?: boolean;
655
+ canCreateIssues?: boolean;
652
656
  runtimeCommand?: string | null;
653
657
  runtimeArgsJson?: string;
654
658
  runtimeCwd?: string | null;
@@ -678,7 +682,10 @@ export declare function listAgents(db: BopoDb, companyId: string): Promise<{
678
682
  usedBudgetUsd: string;
679
683
  tokenUsage: number;
680
684
  canHireAgents: boolean;
685
+ canAssignAgents: boolean;
686
+ canCreateIssues: boolean;
681
687
  avatarSeed: string;
688
+ lucideIconName: string;
682
689
  runtimeCommand: string | null;
683
690
  runtimeArgsJson: string;
684
691
  runtimeCwd: string | null;
@@ -693,6 +700,40 @@ export declare function listAgents(db: BopoDb, companyId: string): Promise<{
693
700
  createdAt: Date;
694
701
  updatedAt: Date;
695
702
  }[]>;
703
+ export declare function getCompanyAgent(db: BopoDb, companyId: string, agentId: string): Promise<{
704
+ id: string;
705
+ companyId: string;
706
+ managerAgentId: string | null;
707
+ role: string;
708
+ roleKey: string | null;
709
+ title: string | null;
710
+ capabilities: string | null;
711
+ name: string;
712
+ providerType: string;
713
+ status: string;
714
+ heartbeatCron: string;
715
+ monthlyBudgetUsd: string;
716
+ usedBudgetUsd: string;
717
+ tokenUsage: number;
718
+ canHireAgents: boolean;
719
+ canAssignAgents: boolean;
720
+ canCreateIssues: boolean;
721
+ avatarSeed: string;
722
+ lucideIconName: string;
723
+ runtimeCommand: string | null;
724
+ runtimeArgsJson: string;
725
+ runtimeCwd: string | null;
726
+ runtimeEnvJson: string;
727
+ runtimeModel: string | null;
728
+ runtimeThinkingEffort: string;
729
+ bootstrapPrompt: string | null;
730
+ runtimeTimeoutSec: number;
731
+ interruptGraceSec: number;
732
+ runPolicyJson: string;
733
+ stateBlob: string;
734
+ createdAt: Date;
735
+ updatedAt: Date;
736
+ } | null>;
696
737
  export declare function updateAgent(db: BopoDb, input: {
697
738
  companyId: string;
698
739
  id: string;
@@ -707,6 +748,8 @@ export declare function updateAgent(db: BopoDb, input: {
707
748
  heartbeatCron?: string;
708
749
  monthlyBudgetUsd?: string;
709
750
  canHireAgents?: boolean;
751
+ canAssignAgents?: boolean;
752
+ canCreateIssues?: boolean;
710
753
  runtimeCommand?: string | null;
711
754
  runtimeArgsJson?: string;
712
755
  runtimeCwd?: string | null;
@@ -718,6 +761,8 @@ export declare function updateAgent(db: BopoDb, input: {
718
761
  interruptGraceSec?: number;
719
762
  runPolicyJson?: string;
720
763
  stateBlob?: Record<string, unknown>;
764
+ lucideIconName?: string;
765
+ avatarSeed?: string;
721
766
  }): Promise<{
722
767
  id: string;
723
768
  companyId: string;
@@ -734,7 +779,10 @@ export declare function updateAgent(db: BopoDb, input: {
734
779
  usedBudgetUsd: string;
735
780
  tokenUsage: number;
736
781
  canHireAgents: boolean;
782
+ canAssignAgents: boolean;
783
+ canCreateIssues: boolean;
737
784
  avatarSeed: string;
785
+ lucideIconName: string;
738
786
  runtimeCommand: string | null;
739
787
  runtimeArgsJson: string;
740
788
  runtimeCwd: string | null;
@@ -1271,6 +1319,66 @@ export declare function appendPluginRun(db: BopoDb, input: {
1271
1319
  error?: string | null;
1272
1320
  diagnosticsJson?: string;
1273
1321
  }): Promise<string>;
1322
+ export declare function appendPluginInstall(db: BopoDb, input: {
1323
+ companyId: string;
1324
+ pluginId: string;
1325
+ pluginVersion: string;
1326
+ sourceType: string;
1327
+ sourceRef?: string | null;
1328
+ integrity?: string | null;
1329
+ buildHash?: string | null;
1330
+ artifactPath?: string | null;
1331
+ manifestJson: string;
1332
+ status?: "active" | "superseded" | "rolled_back";
1333
+ }): Promise<string>;
1334
+ export declare function listPluginInstalls(db: BopoDb, input: {
1335
+ companyId: string;
1336
+ pluginId: string;
1337
+ limit?: number;
1338
+ }): Promise<{
1339
+ id: string;
1340
+ companyId: string;
1341
+ pluginId: string;
1342
+ pluginVersion: string;
1343
+ sourceType: string;
1344
+ sourceRef: string | null;
1345
+ integrity: string | null;
1346
+ buildHash: string | null;
1347
+ artifactPath: string | null;
1348
+ manifestJson: string;
1349
+ status: string;
1350
+ createdAt: Date;
1351
+ }[]>;
1352
+ /** Per-plugin counts of `plugin_installs` rows for rollback UX (need ≥2 revisions to roll back). */
1353
+ export declare function countPluginInstallRevisionsByCompany(db: BopoDb, companyId: string): Promise<Map<string, number>>;
1354
+ export declare function getPluginInstallById(db: BopoDb, input: {
1355
+ companyId: string;
1356
+ pluginId: string;
1357
+ installId: string;
1358
+ }): Promise<{
1359
+ id: string;
1360
+ companyId: string;
1361
+ pluginId: string;
1362
+ pluginVersion: string;
1363
+ sourceType: string;
1364
+ sourceRef: string | null;
1365
+ integrity: string | null;
1366
+ buildHash: string | null;
1367
+ artifactPath: string | null;
1368
+ manifestJson: string;
1369
+ status: string;
1370
+ createdAt: Date;
1371
+ } | null>;
1372
+ export declare function markPluginInstallsSuperseded(db: BopoDb, input: {
1373
+ companyId: string;
1374
+ pluginId: string;
1375
+ }): Promise<void>;
1376
+ export declare function markPluginInstallStatus(db: BopoDb, input: {
1377
+ companyId: string;
1378
+ pluginId: string;
1379
+ installId: string;
1380
+ status: "active" | "superseded" | "rolled_back";
1381
+ }): Promise<void>;
1274
1382
  export declare function listPluginRuns(db: BopoDb, input: {
1275
1383
  companyId: string;
1276
1384
  pluginId?: string;