bopodev-db 0.1.34 → 0.1.36

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.36 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopodev/packages/db
4
4
  > tsc -p tsconfig.json --emitDeclarationOnly
5
5
 
@@ -1,4 +1,4 @@
1
1
 
2
- > bopodev-db@0.1.20 typecheck /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopodev/packages/db
2
+ > bopodev-db@0.1.35 typecheck /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopodev/packages/db
3
3
  > tsc -p tsconfig.json --noEmit
4
4
 
@@ -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;
@@ -260,11 +260,12 @@ export declare function listIssues(db: BopoDb, companyId: string, projectId?: st
260
260
  assigneeAgentId: string | null;
261
261
  labelsJson: string;
262
262
  tagsJson: string;
263
+ knowledgePathsJson: string;
263
264
  externalLink: string | null;
264
265
  isClaimed: boolean;
265
266
  claimedByHeartbeatRunId: string | null;
266
- loopId: string | null;
267
- loopRunId: string | null;
267
+ routineId: string | null;
268
+ routineRunId: string | null;
268
269
  createdAt: Date;
269
270
  updatedAt: Date;
270
271
  }[]>;
@@ -287,11 +288,12 @@ export declare function getIssue(db: BopoDb, companyId: string, issueId: string)
287
288
  assigneeAgentId: string | null;
288
289
  labelsJson: string;
289
290
  tagsJson: string;
291
+ knowledgePathsJson: string;
290
292
  externalLink: string | null;
291
293
  isClaimed: boolean;
292
294
  claimedByHeartbeatRunId: string | null;
293
- loopId: string | null;
294
- loopRunId: string | null;
295
+ routineId: string | null;
296
+ routineRunId: string | null;
295
297
  createdAt: Date;
296
298
  updatedAt: Date;
297
299
  } | null>;
@@ -308,8 +310,9 @@ export declare function createIssue(db: BopoDb, input: {
308
310
  assigneeAgentId?: string | null;
309
311
  labels?: string[];
310
312
  tags?: string[];
311
- loopId?: string | null;
312
- loopRunId?: string | null;
313
+ knowledgePaths?: string[];
314
+ routineId?: string | null;
315
+ routineRunId?: string | null;
313
316
  }): Promise<{
314
317
  id: string;
315
318
  createdAt: Date;
@@ -324,11 +327,12 @@ export declare function createIssue(db: BopoDb, input: {
324
327
  assigneeAgentId: string | null;
325
328
  labelsJson: string;
326
329
  tagsJson: string;
330
+ knowledgePathsJson: string;
327
331
  externalLink: string | null;
328
332
  isClaimed: boolean;
329
333
  claimedByHeartbeatRunId: string | null;
330
- loopId: string | null;
331
- loopRunId: string | null;
334
+ routineId: string | null;
335
+ routineRunId: string | null;
332
336
  }>;
333
337
  export declare function updateIssue(db: BopoDb, input: {
334
338
  companyId: string;
@@ -343,6 +347,7 @@ export declare function updateIssue(db: BopoDb, input: {
343
347
  assigneeAgentId?: string | null;
344
348
  labels?: string[];
345
349
  tags?: string[];
350
+ knowledgePaths?: string[];
346
351
  }): Promise<{
347
352
  id: string;
348
353
  companyId: string;
@@ -355,11 +360,12 @@ export declare function updateIssue(db: BopoDb, input: {
355
360
  assigneeAgentId: string | null;
356
361
  labelsJson: string;
357
362
  tagsJson: string;
363
+ knowledgePathsJson: string;
358
364
  externalLink: string | null;
359
365
  isClaimed: boolean;
360
366
  claimedByHeartbeatRunId: string | null;
361
- loopId: string | null;
362
- loopRunId: string | null;
367
+ routineId: string | null;
368
+ routineRunId: string | null;
363
369
  createdAt: Date;
364
370
  updatedAt: Date;
365
371
  } | null>;
@@ -624,6 +630,8 @@ export declare function createAgent(db: BopoDb, input: {
624
630
  heartbeatCron: string;
625
631
  monthlyBudgetUsd: string;
626
632
  canHireAgents?: boolean;
633
+ canAssignAgents?: boolean;
634
+ canCreateIssues?: boolean;
627
635
  avatarSeed?: string;
628
636
  runtimeCommand?: string | null;
629
637
  runtimeArgsJson?: string;
@@ -649,6 +657,8 @@ export declare function createAgent(db: BopoDb, input: {
649
657
  heartbeatCron: string;
650
658
  monthlyBudgetUsd: string;
651
659
  canHireAgents?: boolean;
660
+ canAssignAgents?: boolean;
661
+ canCreateIssues?: boolean;
652
662
  runtimeCommand?: string | null;
653
663
  runtimeArgsJson?: string;
654
664
  runtimeCwd?: string | null;
@@ -678,7 +688,10 @@ export declare function listAgents(db: BopoDb, companyId: string): Promise<{
678
688
  usedBudgetUsd: string;
679
689
  tokenUsage: number;
680
690
  canHireAgents: boolean;
691
+ canAssignAgents: boolean;
692
+ canCreateIssues: boolean;
681
693
  avatarSeed: string;
694
+ lucideIconName: string;
682
695
  runtimeCommand: string | null;
683
696
  runtimeArgsJson: string;
684
697
  runtimeCwd: string | null;
@@ -693,6 +706,40 @@ export declare function listAgents(db: BopoDb, companyId: string): Promise<{
693
706
  createdAt: Date;
694
707
  updatedAt: Date;
695
708
  }[]>;
709
+ export declare function getCompanyAgent(db: BopoDb, companyId: string, agentId: string): Promise<{
710
+ id: string;
711
+ companyId: string;
712
+ managerAgentId: string | null;
713
+ role: string;
714
+ roleKey: string | null;
715
+ title: string | null;
716
+ capabilities: string | null;
717
+ name: string;
718
+ providerType: string;
719
+ status: string;
720
+ heartbeatCron: string;
721
+ monthlyBudgetUsd: string;
722
+ usedBudgetUsd: string;
723
+ tokenUsage: number;
724
+ canHireAgents: boolean;
725
+ canAssignAgents: boolean;
726
+ canCreateIssues: boolean;
727
+ avatarSeed: string;
728
+ lucideIconName: string;
729
+ runtimeCommand: string | null;
730
+ runtimeArgsJson: string;
731
+ runtimeCwd: string | null;
732
+ runtimeEnvJson: string;
733
+ runtimeModel: string | null;
734
+ runtimeThinkingEffort: string;
735
+ bootstrapPrompt: string | null;
736
+ runtimeTimeoutSec: number;
737
+ interruptGraceSec: number;
738
+ runPolicyJson: string;
739
+ stateBlob: string;
740
+ createdAt: Date;
741
+ updatedAt: Date;
742
+ } | null>;
696
743
  export declare function updateAgent(db: BopoDb, input: {
697
744
  companyId: string;
698
745
  id: string;
@@ -707,6 +754,8 @@ export declare function updateAgent(db: BopoDb, input: {
707
754
  heartbeatCron?: string;
708
755
  monthlyBudgetUsd?: string;
709
756
  canHireAgents?: boolean;
757
+ canAssignAgents?: boolean;
758
+ canCreateIssues?: boolean;
710
759
  runtimeCommand?: string | null;
711
760
  runtimeArgsJson?: string;
712
761
  runtimeCwd?: string | null;
@@ -718,6 +767,8 @@ export declare function updateAgent(db: BopoDb, input: {
718
767
  interruptGraceSec?: number;
719
768
  runPolicyJson?: string;
720
769
  stateBlob?: Record<string, unknown>;
770
+ lucideIconName?: string;
771
+ avatarSeed?: string;
721
772
  }): Promise<{
722
773
  id: string;
723
774
  companyId: string;
@@ -734,7 +785,10 @@ export declare function updateAgent(db: BopoDb, input: {
734
785
  usedBudgetUsd: string;
735
786
  tokenUsage: number;
736
787
  canHireAgents: boolean;
788
+ canAssignAgents: boolean;
789
+ canCreateIssues: boolean;
737
790
  avatarSeed: string;
791
+ lucideIconName: string;
738
792
  runtimeCommand: string | null;
739
793
  runtimeArgsJson: string;
740
794
  runtimeCwd: string | null;
@@ -1271,6 +1325,66 @@ export declare function appendPluginRun(db: BopoDb, input: {
1271
1325
  error?: string | null;
1272
1326
  diagnosticsJson?: string;
1273
1327
  }): Promise<string>;
1328
+ export declare function appendPluginInstall(db: BopoDb, input: {
1329
+ companyId: string;
1330
+ pluginId: string;
1331
+ pluginVersion: string;
1332
+ sourceType: string;
1333
+ sourceRef?: string | null;
1334
+ integrity?: string | null;
1335
+ buildHash?: string | null;
1336
+ artifactPath?: string | null;
1337
+ manifestJson: string;
1338
+ status?: "active" | "superseded" | "rolled_back";
1339
+ }): Promise<string>;
1340
+ export declare function listPluginInstalls(db: BopoDb, input: {
1341
+ companyId: string;
1342
+ pluginId: string;
1343
+ limit?: number;
1344
+ }): Promise<{
1345
+ id: string;
1346
+ companyId: string;
1347
+ pluginId: string;
1348
+ pluginVersion: string;
1349
+ sourceType: string;
1350
+ sourceRef: string | null;
1351
+ integrity: string | null;
1352
+ buildHash: string | null;
1353
+ artifactPath: string | null;
1354
+ manifestJson: string;
1355
+ status: string;
1356
+ createdAt: Date;
1357
+ }[]>;
1358
+ /** Per-plugin counts of `plugin_installs` rows for rollback UX (need ≥2 revisions to roll back). */
1359
+ export declare function countPluginInstallRevisionsByCompany(db: BopoDb, companyId: string): Promise<Map<string, number>>;
1360
+ export declare function getPluginInstallById(db: BopoDb, input: {
1361
+ companyId: string;
1362
+ pluginId: string;
1363
+ installId: string;
1364
+ }): Promise<{
1365
+ id: string;
1366
+ companyId: string;
1367
+ pluginId: string;
1368
+ pluginVersion: string;
1369
+ sourceType: string;
1370
+ sourceRef: string | null;
1371
+ integrity: string | null;
1372
+ buildHash: string | null;
1373
+ artifactPath: string | null;
1374
+ manifestJson: string;
1375
+ status: string;
1376
+ createdAt: Date;
1377
+ } | null>;
1378
+ export declare function markPluginInstallsSuperseded(db: BopoDb, input: {
1379
+ companyId: string;
1380
+ pluginId: string;
1381
+ }): Promise<void>;
1382
+ export declare function markPluginInstallStatus(db: BopoDb, input: {
1383
+ companyId: string;
1384
+ pluginId: string;
1385
+ installId: string;
1386
+ status: "active" | "superseded" | "rolled_back";
1387
+ }): Promise<void>;
1274
1388
  export declare function listPluginRuns(db: BopoDb, input: {
1275
1389
  companyId: string;
1276
1390
  pluginId?: string;