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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > bopodev-db@0.1.24 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopodev/packages/db
3
+ > bopodev-db@0.1.26 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopohq/packages/db
4
4
  > tsc -p tsconfig.json --emitDeclarationOnly
5
5
 
@@ -0,0 +1,4 @@
1
+
2
+ > bopodev-db@0.1.15 lint /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopohq/packages/db
3
+ > tsc -p tsconfig.json --noEmit
4
+
@@ -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.24 typecheck /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopohq/packages/db
3
3
  > tsc -p tsconfig.json --noEmit
4
4
 
@@ -36,13 +36,22 @@ export declare function listProjects(db: BopoDb, companyId: string): Promise<({
36
36
  description: string | null;
37
37
  status: string;
38
38
  plannedStartAt: Date | null;
39
+ monthlyBudgetUsd: string;
40
+ usedBudgetUsd: string;
41
+ budgetWindowStartAt: Date;
39
42
  executionWorkspacePolicy: string | null;
40
43
  updatedAt: Date;
41
44
  } & {
42
45
  executionWorkspacePolicy: Record<string, unknown> | null;
46
+ monthlyBudgetUsd: number;
47
+ usedBudgetUsd: number;
48
+ budgetWindowStartAt: string | null;
43
49
  workspaces: Array<typeof projectWorkspaces.$inferSelect>;
44
50
  primaryWorkspace: typeof projectWorkspaces.$inferSelect | null;
45
51
  })[] | {
52
+ monthlyBudgetUsd: number;
53
+ usedBudgetUsd: number;
54
+ budgetWindowStartAt: string | null;
46
55
  workspaceLocalPath: string | null;
47
56
  workspaceGithubRepo: string | null;
48
57
  executionWorkspacePolicy: Record<string, unknown> | null;
@@ -86,6 +95,9 @@ export declare function createProject(db: BopoDb, input: {
86
95
  description?: string | null;
87
96
  status?: "planned" | "active" | "paused" | "blocked" | "completed" | "archived";
88
97
  plannedStartAt?: Date | null;
98
+ monthlyBudgetUsd?: string;
99
+ usedBudgetUsd?: string;
100
+ budgetWindowStartAt?: Date | null;
89
101
  executionWorkspacePolicy?: Record<string, unknown> | null;
90
102
  workspaceLocalPath?: string | null;
91
103
  workspaceGithubRepo?: string | null;
@@ -97,13 +109,22 @@ export declare function createProject(db: BopoDb, input: {
97
109
  description: string | null;
98
110
  status: string;
99
111
  plannedStartAt: Date | null;
112
+ monthlyBudgetUsd: string;
113
+ usedBudgetUsd: string;
114
+ budgetWindowStartAt: Date;
100
115
  executionWorkspacePolicy: string | null;
101
116
  updatedAt: Date;
102
117
  } & {
103
118
  executionWorkspacePolicy: Record<string, unknown> | null;
119
+ monthlyBudgetUsd: number;
120
+ usedBudgetUsd: number;
121
+ budgetWindowStartAt: string | null;
104
122
  workspaces: Array<typeof projectWorkspaces.$inferSelect>;
105
123
  primaryWorkspace: typeof projectWorkspaces.$inferSelect | null;
106
124
  }) | {
125
+ monthlyBudgetUsd: number;
126
+ usedBudgetUsd: number;
127
+ budgetWindowStartAt: string | null;
107
128
  workspaceLocalPath: string | null;
108
129
  workspaceGithubRepo: string | null;
109
130
  executionWorkspacePolicy: Record<string, unknown> | null;
@@ -147,6 +168,9 @@ export declare function updateProject(db: BopoDb, input: {
147
168
  description?: string | null;
148
169
  status?: "planned" | "active" | "paused" | "blocked" | "completed" | "archived";
149
170
  plannedStartAt?: Date | null;
171
+ monthlyBudgetUsd?: string;
172
+ usedBudgetUsd?: string;
173
+ budgetWindowStartAt?: Date | null;
150
174
  executionWorkspacePolicy?: Record<string, unknown> | null;
151
175
  workspaceLocalPath?: string | null;
152
176
  workspaceGithubRepo?: string | null;
@@ -158,13 +182,22 @@ export declare function updateProject(db: BopoDb, input: {
158
182
  description: string | null;
159
183
  status: string;
160
184
  plannedStartAt: Date | null;
185
+ monthlyBudgetUsd: string;
186
+ usedBudgetUsd: string;
187
+ budgetWindowStartAt: Date;
161
188
  executionWorkspacePolicy: string | null;
162
189
  updatedAt: Date;
163
190
  } & {
164
191
  executionWorkspacePolicy: Record<string, unknown> | null;
192
+ monthlyBudgetUsd: number;
193
+ usedBudgetUsd: number;
194
+ budgetWindowStartAt: string | null;
165
195
  workspaces: Array<typeof projectWorkspaces.$inferSelect>;
166
196
  primaryWorkspace: typeof projectWorkspaces.$inferSelect | null;
167
197
  }) | {
198
+ monthlyBudgetUsd: number;
199
+ usedBudgetUsd: number;
200
+ budgetWindowStartAt: string | null;
168
201
  workspaceLocalPath: string | null;
169
202
  workspaceGithubRepo: string | null;
170
203
  executionWorkspacePolicy: Record<string, unknown> | null;
@@ -413,23 +446,67 @@ export declare function addIssueComment(db: BopoDb, input: {
413
446
  issueId: string;
414
447
  authorType: "human" | "agent" | "system";
415
448
  authorId?: string | null;
449
+ runId?: string | null;
450
+ recipients?: Array<{
451
+ recipientType: "agent" | "board" | "member";
452
+ recipientId?: string | null;
453
+ deliveryStatus?: "pending" | "dispatched" | "failed" | "skipped";
454
+ dispatchedRunId?: string | null;
455
+ dispatchedAt?: string | null;
456
+ acknowledgedAt?: string | null;
457
+ }>;
416
458
  body: string;
417
459
  }): Promise<{
460
+ recipients: {
461
+ recipientType: "agent" | "board" | "member";
462
+ recipientId: string | null;
463
+ deliveryStatus: "pending" | "dispatched" | "failed" | "skipped";
464
+ dispatchedRunId: string | null;
465
+ dispatchedAt: string | null;
466
+ acknowledgedAt: string | null;
467
+ }[];
468
+ id: string;
469
+ createdAt: Date;
470
+ companyId: string;
471
+ body: string;
472
+ issueId: string;
473
+ authorType: string;
474
+ authorId: string | null;
475
+ runId: string | null;
476
+ } | {
477
+ id: string;
418
478
  companyId: string;
419
479
  issueId: string;
420
480
  authorType: "human" | "agent" | "system";
421
- authorId?: string | null;
481
+ authorId: string | null;
422
482
  body: string;
423
- id: string;
483
+ runId: string | null;
484
+ recipients: {
485
+ recipientType: "agent" | "board" | "member";
486
+ recipientId?: string | null;
487
+ deliveryStatus?: "pending" | "dispatched" | "failed" | "skipped";
488
+ dispatchedRunId?: string | null;
489
+ dispatchedAt?: string | null;
490
+ acknowledgedAt?: string | null;
491
+ }[];
424
492
  }>;
425
493
  export declare function listIssueComments(db: BopoDb, companyId: string, issueId: string): Promise<{
494
+ recipients: {
495
+ recipientType: "agent" | "board" | "member";
496
+ recipientId: string | null;
497
+ deliveryStatus: "pending" | "dispatched" | "failed" | "skipped";
498
+ dispatchedRunId: string | null;
499
+ dispatchedAt: string | null;
500
+ acknowledgedAt: string | null;
501
+ }[];
426
502
  id: string;
427
- issueId: string;
503
+ createdAt: Date;
428
504
  companyId: string;
505
+ body: string;
506
+ issueId: string;
429
507
  authorType: string;
430
508
  authorId: string | null;
431
- body: string;
432
- createdAt: Date;
509
+ runId: string | null;
433
510
  }[]>;
434
511
  export declare function listIssueActivity(db: BopoDb, companyId: string, issueId: string, limit?: number): Promise<{
435
512
  id: string;
@@ -447,13 +524,52 @@ export declare function updateIssueComment(db: BopoDb, input: {
447
524
  id: string;
448
525
  body: string;
449
526
  }): Promise<{
527
+ recipients: {
528
+ recipientType: "agent" | "board" | "member";
529
+ recipientId: string | null;
530
+ deliveryStatus: "pending" | "dispatched" | "failed" | "skipped";
531
+ dispatchedRunId: string | null;
532
+ dispatchedAt: string | null;
533
+ acknowledgedAt: string | null;
534
+ }[];
450
535
  id: string;
451
- issueId: string;
536
+ createdAt: Date;
452
537
  companyId: string;
538
+ body: string;
539
+ issueId: string;
453
540
  authorType: string;
454
541
  authorId: string | null;
455
- body: string;
542
+ runId: string | null;
543
+ } | null>;
544
+ export declare function updateIssueCommentRecipients(db: BopoDb, input: {
545
+ companyId: string;
546
+ issueId: string;
547
+ id: string;
548
+ recipients: Array<{
549
+ recipientType: "agent" | "board" | "member";
550
+ recipientId?: string | null;
551
+ deliveryStatus?: "pending" | "dispatched" | "failed" | "skipped";
552
+ dispatchedRunId?: string | null;
553
+ dispatchedAt?: string | null;
554
+ acknowledgedAt?: string | null;
555
+ }>;
556
+ }): Promise<{
557
+ recipients: {
558
+ recipientType: "agent" | "board" | "member";
559
+ recipientId: string | null;
560
+ deliveryStatus: "pending" | "dispatched" | "failed" | "skipped";
561
+ dispatchedRunId: string | null;
562
+ dispatchedAt: string | null;
563
+ acknowledgedAt: string | null;
564
+ }[];
565
+ id: string;
456
566
  createdAt: Date;
567
+ companyId: string;
568
+ body: string;
569
+ issueId: string;
570
+ authorType: string;
571
+ authorId: string | null;
572
+ runId: string | null;
457
573
  } | null>;
458
574
  export declare function deleteIssueComment(db: BopoDb, companyId: string, issueId: string, id: string): Promise<boolean>;
459
575
  export declare function createGoal(db: BopoDb, input: {
@@ -510,6 +626,8 @@ export declare function createAgent(db: BopoDb, input: {
510
626
  companyId: string;
511
627
  managerAgentId?: string | null;
512
628
  role: string;
629
+ roleKey?: string | null;
630
+ title?: string | null;
513
631
  name: string;
514
632
  providerType: "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli" | "openai_api" | "anthropic_api" | "http" | "shell";
515
633
  heartbeatCron: string;
@@ -532,6 +650,8 @@ export declare function createAgent(db: BopoDb, input: {
532
650
  companyId: string;
533
651
  managerAgentId?: string | null;
534
652
  role: string;
653
+ roleKey?: string | null;
654
+ title?: string | null;
535
655
  name: string;
536
656
  providerType: "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli" | "openai_api" | "anthropic_api" | "http" | "shell";
537
657
  heartbeatCron: string;
@@ -555,6 +675,8 @@ export declare function listAgents(db: BopoDb, companyId: string): Promise<{
555
675
  companyId: string;
556
676
  managerAgentId: string | null;
557
677
  role: string;
678
+ roleKey: string | null;
679
+ title: string | null;
558
680
  name: string;
559
681
  providerType: string;
560
682
  status: string;
@@ -583,6 +705,8 @@ export declare function updateAgent(db: BopoDb, input: {
583
705
  id: string;
584
706
  managerAgentId?: string | null;
585
707
  role?: string;
708
+ roleKey?: string | null;
709
+ title?: string | null;
586
710
  name?: string;
587
711
  providerType?: "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli" | "openai_api" | "anthropic_api" | "http" | "shell";
588
712
  status?: string;
@@ -605,6 +729,8 @@ export declare function updateAgent(db: BopoDb, input: {
605
729
  companyId: string;
606
730
  managerAgentId: string | null;
607
731
  role: string;
732
+ roleKey: string | null;
733
+ title: string | null;
608
734
  name: string;
609
735
  providerType: string;
610
736
  status: string;
@@ -704,13 +830,55 @@ export declare function clearApprovalInboxDismissed(db: BopoDb, input: {
704
830
  actorId: string;
705
831
  approvalId: string;
706
832
  }): Promise<void>;
833
+ export declare function listAttentionInboxStates(db: BopoDb, companyId: string, actorId: string): Promise<{
834
+ companyId: string;
835
+ actorId: string;
836
+ itemKey: string;
837
+ seenAt: Date | null;
838
+ acknowledgedAt: Date | null;
839
+ dismissedAt: Date | null;
840
+ resolvedAt: Date | null;
841
+ createdAt: Date;
842
+ updatedAt: Date;
843
+ }[]>;
844
+ export declare function markAttentionInboxSeen(db: BopoDb, input: {
845
+ companyId: string;
846
+ actorId: string;
847
+ itemKey: string;
848
+ seenAt?: Date;
849
+ }): Promise<void>;
850
+ export declare function markAttentionInboxAcknowledged(db: BopoDb, input: {
851
+ companyId: string;
852
+ actorId: string;
853
+ itemKey: string;
854
+ acknowledgedAt?: Date;
855
+ }): Promise<void>;
856
+ export declare function markAttentionInboxDismissed(db: BopoDb, input: {
857
+ companyId: string;
858
+ actorId: string;
859
+ itemKey: string;
860
+ dismissedAt?: Date;
861
+ }): Promise<void>;
862
+ export declare function clearAttentionInboxDismissed(db: BopoDb, input: {
863
+ companyId: string;
864
+ actorId: string;
865
+ itemKey: string;
866
+ }): Promise<void>;
867
+ export declare function markAttentionInboxResolved(db: BopoDb, input: {
868
+ companyId: string;
869
+ actorId: string;
870
+ itemKey: string;
871
+ resolvedAt?: Date;
872
+ }): Promise<void>;
707
873
  export declare function appendCost(db: BopoDb, input: {
708
874
  companyId: string;
875
+ runId?: string | null;
709
876
  providerType: string;
710
877
  runtimeModelId?: string | null;
711
878
  pricingProviderType?: string | null;
712
879
  pricingModelId?: string | null;
713
880
  pricingSource?: "exact" | "missing" | null;
881
+ usdCostStatus?: "exact" | "estimated" | "unknown" | null;
714
882
  tokenInput: number;
715
883
  tokenOutput: number;
716
884
  usdCost: string;
@@ -721,6 +889,7 @@ export declare function appendCost(db: BopoDb, input: {
721
889
  export declare function listCostEntries(db: BopoDb, companyId: string, limit?: number): Promise<{
722
890
  id: string;
723
891
  companyId: string;
892
+ runId: string | null;
724
893
  projectId: string | null;
725
894
  issueId: string | null;
726
895
  agentId: string | null;
@@ -732,6 +901,7 @@ export declare function listCostEntries(db: BopoDb, companyId: string, limit?: n
732
901
  tokenInput: number;
733
902
  tokenOutput: number;
734
903
  usdCost: string;
904
+ usdCostStatus: string | null;
735
905
  createdAt: Date;
736
906
  }[]>;
737
907
  export declare function listHeartbeatRuns(db: BopoDb, companyId: string, limit?: number): Promise<{
@@ -743,6 +913,226 @@ export declare function listHeartbeatRuns(db: BopoDb, companyId: string, limit?:
743
913
  finishedAt: Date | null;
744
914
  message: string | null;
745
915
  }[]>;
916
+ export type HeartbeatQueueJobType = "manual" | "scheduler" | "resume" | "redo" | "comment_dispatch";
917
+ export type HeartbeatQueueJobStatus = "pending" | "running" | "completed" | "failed" | "dead_letter" | "canceled";
918
+ export declare function enqueueHeartbeatJob(db: BopoDb, input: {
919
+ companyId: string;
920
+ agentId: string;
921
+ jobType: HeartbeatQueueJobType;
922
+ payload?: Record<string, unknown>;
923
+ priority?: number;
924
+ availableAt?: Date;
925
+ maxAttempts?: number;
926
+ idempotencyKey?: string | null;
927
+ }): Promise<{
928
+ payload: Record<string, unknown>;
929
+ id: string;
930
+ companyId: string;
931
+ agentId: string;
932
+ jobType: string;
933
+ payloadJson: string;
934
+ status: string;
935
+ priority: number;
936
+ idempotencyKey: string | null;
937
+ availableAt: Date;
938
+ attemptCount: number;
939
+ maxAttempts: number;
940
+ lastError: string | null;
941
+ startedAt: Date | null;
942
+ finishedAt: Date | null;
943
+ heartbeatRunId: string | null;
944
+ createdAt: Date;
945
+ updatedAt: Date;
946
+ }>;
947
+ export declare function claimNextHeartbeatJob(db: BopoDb, companyId: string): Promise<{
948
+ payload: Record<string, unknown>;
949
+ id: string;
950
+ companyId: string;
951
+ agentId: string;
952
+ jobType: string;
953
+ payloadJson: string;
954
+ status: string;
955
+ priority: number;
956
+ idempotencyKey: string | null;
957
+ availableAt: Date;
958
+ attemptCount: number;
959
+ maxAttempts: number;
960
+ lastError: string | null;
961
+ startedAt: Date | null;
962
+ finishedAt: Date | null;
963
+ heartbeatRunId: string | null;
964
+ createdAt: Date;
965
+ updatedAt: Date;
966
+ } | null>;
967
+ export declare function getHeartbeatQueueJob(db: BopoDb, companyId: string, id: string): Promise<{
968
+ payload: Record<string, unknown>;
969
+ id: string;
970
+ companyId: string;
971
+ agentId: string;
972
+ jobType: string;
973
+ payloadJson: string;
974
+ status: string;
975
+ priority: number;
976
+ idempotencyKey: string | null;
977
+ availableAt: Date;
978
+ attemptCount: number;
979
+ maxAttempts: number;
980
+ lastError: string | null;
981
+ startedAt: Date | null;
982
+ finishedAt: Date | null;
983
+ heartbeatRunId: string | null;
984
+ createdAt: Date;
985
+ updatedAt: Date;
986
+ } | null>;
987
+ export declare function markHeartbeatJobCompleted(db: BopoDb, input: {
988
+ companyId: string;
989
+ id: string;
990
+ heartbeatRunId?: string | null;
991
+ }): Promise<{
992
+ payload: Record<string, unknown>;
993
+ id: string;
994
+ companyId: string;
995
+ agentId: string;
996
+ jobType: string;
997
+ payloadJson: string;
998
+ status: string;
999
+ priority: number;
1000
+ idempotencyKey: string | null;
1001
+ availableAt: Date;
1002
+ attemptCount: number;
1003
+ maxAttempts: number;
1004
+ lastError: string | null;
1005
+ startedAt: Date | null;
1006
+ finishedAt: Date | null;
1007
+ heartbeatRunId: string | null;
1008
+ createdAt: Date;
1009
+ updatedAt: Date;
1010
+ } | null>;
1011
+ export declare function markHeartbeatJobRetry(db: BopoDb, input: {
1012
+ companyId: string;
1013
+ id: string;
1014
+ retryAt: Date;
1015
+ error?: string | null;
1016
+ heartbeatRunId?: string | null;
1017
+ }): Promise<{
1018
+ payload: Record<string, unknown>;
1019
+ id: string;
1020
+ companyId: string;
1021
+ agentId: string;
1022
+ jobType: string;
1023
+ payloadJson: string;
1024
+ status: string;
1025
+ priority: number;
1026
+ idempotencyKey: string | null;
1027
+ availableAt: Date;
1028
+ attemptCount: number;
1029
+ maxAttempts: number;
1030
+ lastError: string | null;
1031
+ startedAt: Date | null;
1032
+ finishedAt: Date | null;
1033
+ heartbeatRunId: string | null;
1034
+ createdAt: Date;
1035
+ updatedAt: Date;
1036
+ } | null>;
1037
+ export declare function markHeartbeatJobFailed(db: BopoDb, input: {
1038
+ companyId: string;
1039
+ id: string;
1040
+ error?: string | null;
1041
+ heartbeatRunId?: string | null;
1042
+ }): Promise<{
1043
+ payload: Record<string, unknown>;
1044
+ id: string;
1045
+ companyId: string;
1046
+ agentId: string;
1047
+ jobType: string;
1048
+ payloadJson: string;
1049
+ status: string;
1050
+ priority: number;
1051
+ idempotencyKey: string | null;
1052
+ availableAt: Date;
1053
+ attemptCount: number;
1054
+ maxAttempts: number;
1055
+ lastError: string | null;
1056
+ startedAt: Date | null;
1057
+ finishedAt: Date | null;
1058
+ heartbeatRunId: string | null;
1059
+ createdAt: Date;
1060
+ updatedAt: Date;
1061
+ } | null>;
1062
+ export declare function markHeartbeatJobDeadLetter(db: BopoDb, input: {
1063
+ companyId: string;
1064
+ id: string;
1065
+ error?: string | null;
1066
+ heartbeatRunId?: string | null;
1067
+ }): Promise<{
1068
+ payload: Record<string, unknown>;
1069
+ id: string;
1070
+ companyId: string;
1071
+ agentId: string;
1072
+ jobType: string;
1073
+ payloadJson: string;
1074
+ status: string;
1075
+ priority: number;
1076
+ idempotencyKey: string | null;
1077
+ availableAt: Date;
1078
+ attemptCount: number;
1079
+ maxAttempts: number;
1080
+ lastError: string | null;
1081
+ startedAt: Date | null;
1082
+ finishedAt: Date | null;
1083
+ heartbeatRunId: string | null;
1084
+ createdAt: Date;
1085
+ updatedAt: Date;
1086
+ } | null>;
1087
+ export declare function cancelHeartbeatJob(db: BopoDb, input: {
1088
+ companyId: string;
1089
+ id: string;
1090
+ }): Promise<{
1091
+ payload: Record<string, unknown>;
1092
+ id: string;
1093
+ companyId: string;
1094
+ agentId: string;
1095
+ jobType: string;
1096
+ payloadJson: string;
1097
+ status: string;
1098
+ priority: number;
1099
+ idempotencyKey: string | null;
1100
+ availableAt: Date;
1101
+ attemptCount: number;
1102
+ maxAttempts: number;
1103
+ lastError: string | null;
1104
+ startedAt: Date | null;
1105
+ finishedAt: Date | null;
1106
+ heartbeatRunId: string | null;
1107
+ createdAt: Date;
1108
+ updatedAt: Date;
1109
+ } | null>;
1110
+ export declare function listHeartbeatQueueJobs(db: BopoDb, input: {
1111
+ companyId: string;
1112
+ status?: HeartbeatQueueJobStatus;
1113
+ agentId?: string;
1114
+ jobType?: HeartbeatQueueJobType;
1115
+ limit?: number;
1116
+ }): Promise<{
1117
+ payload: Record<string, unknown>;
1118
+ id: string;
1119
+ companyId: string;
1120
+ agentId: string;
1121
+ jobType: string;
1122
+ payloadJson: string;
1123
+ status: string;
1124
+ priority: number;
1125
+ idempotencyKey: string | null;
1126
+ availableAt: Date;
1127
+ attemptCount: number;
1128
+ maxAttempts: number;
1129
+ lastError: string | null;
1130
+ startedAt: Date | null;
1131
+ finishedAt: Date | null;
1132
+ heartbeatRunId: string | null;
1133
+ createdAt: Date;
1134
+ updatedAt: Date;
1135
+ }[]>;
746
1136
  export declare function getHeartbeatRun(db: BopoDb, companyId: string, runId: string): Promise<{
747
1137
  id: string;
748
1138
  companyId: string;