bopodev-db 0.1.28 → 0.1.29

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.
@@ -0,0 +1,1415 @@
1
+ import type { BopoDb } from "../client";
2
+ import { heartbeatRunMessages, projectWorkspaces } from "../schema";
3
+ export declare function listProjects(db: BopoDb, companyId: string): Promise<({
4
+ id: string;
5
+ name: string;
6
+ createdAt: Date;
7
+ companyId: string;
8
+ description: string | null;
9
+ status: string;
10
+ plannedStartAt: Date | null;
11
+ monthlyBudgetUsd: string;
12
+ usedBudgetUsd: string;
13
+ budgetWindowStartAt: Date;
14
+ executionWorkspacePolicy: string | null;
15
+ updatedAt: Date;
16
+ } & {
17
+ executionWorkspacePolicy: Record<string, unknown> | null;
18
+ monthlyBudgetUsd: number;
19
+ usedBudgetUsd: number;
20
+ budgetWindowStartAt: string | null;
21
+ workspaces: Array<typeof projectWorkspaces.$inferSelect>;
22
+ primaryWorkspace: typeof projectWorkspaces.$inferSelect | null;
23
+ })[] | {
24
+ monthlyBudgetUsd: number;
25
+ usedBudgetUsd: number;
26
+ budgetWindowStartAt: string | null;
27
+ workspaceLocalPath: string | null;
28
+ workspaceGithubRepo: string | null;
29
+ executionWorkspacePolicy: Record<string, unknown> | null;
30
+ workspaces: {
31
+ id: string;
32
+ name: string;
33
+ createdAt: Date;
34
+ companyId: string;
35
+ updatedAt: Date;
36
+ projectId: string;
37
+ cwd: string | null;
38
+ repoUrl: string | null;
39
+ repoRef: string | null;
40
+ isPrimary: boolean;
41
+ }[];
42
+ primaryWorkspace: {
43
+ id: string;
44
+ name: string;
45
+ createdAt: Date;
46
+ companyId: string;
47
+ updatedAt: Date;
48
+ projectId: string;
49
+ cwd: string | null;
50
+ repoUrl: string | null;
51
+ repoRef: string | null;
52
+ isPrimary: boolean;
53
+ } | null;
54
+ id: string;
55
+ name: string;
56
+ createdAt: Date;
57
+ companyId: string;
58
+ description: string | null;
59
+ status: string;
60
+ plannedStartAt: Date | null;
61
+ updatedAt: Date;
62
+ }[]>;
63
+ export declare function createProject(db: BopoDb, input: {
64
+ id?: string;
65
+ companyId: string;
66
+ name: string;
67
+ description?: string | null;
68
+ status?: "planned" | "active" | "paused" | "blocked" | "completed" | "archived";
69
+ plannedStartAt?: Date | null;
70
+ monthlyBudgetUsd?: string;
71
+ usedBudgetUsd?: string;
72
+ budgetWindowStartAt?: Date | null;
73
+ executionWorkspacePolicy?: Record<string, unknown> | null;
74
+ workspaceLocalPath?: string | null;
75
+ workspaceGithubRepo?: string | null;
76
+ }): Promise<({
77
+ id: string;
78
+ name: string;
79
+ createdAt: Date;
80
+ companyId: string;
81
+ description: string | null;
82
+ status: string;
83
+ plannedStartAt: Date | null;
84
+ monthlyBudgetUsd: string;
85
+ usedBudgetUsd: string;
86
+ budgetWindowStartAt: Date;
87
+ executionWorkspacePolicy: string | null;
88
+ updatedAt: Date;
89
+ } & {
90
+ executionWorkspacePolicy: Record<string, unknown> | null;
91
+ monthlyBudgetUsd: number;
92
+ usedBudgetUsd: number;
93
+ budgetWindowStartAt: string | null;
94
+ workspaces: Array<typeof projectWorkspaces.$inferSelect>;
95
+ primaryWorkspace: typeof projectWorkspaces.$inferSelect | null;
96
+ }) | {
97
+ monthlyBudgetUsd: number;
98
+ usedBudgetUsd: number;
99
+ budgetWindowStartAt: string | null;
100
+ workspaceLocalPath: string | null;
101
+ workspaceGithubRepo: string | null;
102
+ executionWorkspacePolicy: Record<string, unknown> | null;
103
+ workspaces: {
104
+ id: string;
105
+ name: string;
106
+ createdAt: Date;
107
+ companyId: string;
108
+ updatedAt: Date;
109
+ projectId: string;
110
+ cwd: string | null;
111
+ repoUrl: string | null;
112
+ repoRef: string | null;
113
+ isPrimary: boolean;
114
+ }[];
115
+ primaryWorkspace: {
116
+ id: string;
117
+ name: string;
118
+ createdAt: Date;
119
+ companyId: string;
120
+ updatedAt: Date;
121
+ projectId: string;
122
+ cwd: string | null;
123
+ repoUrl: string | null;
124
+ repoRef: string | null;
125
+ isPrimary: boolean;
126
+ } | null;
127
+ id: string;
128
+ name: string;
129
+ createdAt: Date;
130
+ companyId: string;
131
+ description: string | null;
132
+ status: string;
133
+ plannedStartAt: Date | null;
134
+ updatedAt: Date;
135
+ } | null>;
136
+ export declare function updateProject(db: BopoDb, input: {
137
+ companyId: string;
138
+ id: string;
139
+ name?: string;
140
+ description?: string | null;
141
+ status?: "planned" | "active" | "paused" | "blocked" | "completed" | "archived";
142
+ plannedStartAt?: Date | null;
143
+ monthlyBudgetUsd?: string;
144
+ usedBudgetUsd?: string;
145
+ budgetWindowStartAt?: Date | null;
146
+ executionWorkspacePolicy?: Record<string, unknown> | null;
147
+ workspaceLocalPath?: string | null;
148
+ workspaceGithubRepo?: string | null;
149
+ }): Promise<({
150
+ id: string;
151
+ name: string;
152
+ createdAt: Date;
153
+ companyId: string;
154
+ description: string | null;
155
+ status: string;
156
+ plannedStartAt: Date | null;
157
+ monthlyBudgetUsd: string;
158
+ usedBudgetUsd: string;
159
+ budgetWindowStartAt: Date;
160
+ executionWorkspacePolicy: string | null;
161
+ updatedAt: Date;
162
+ } & {
163
+ executionWorkspacePolicy: Record<string, unknown> | null;
164
+ monthlyBudgetUsd: number;
165
+ usedBudgetUsd: number;
166
+ budgetWindowStartAt: string | null;
167
+ workspaces: Array<typeof projectWorkspaces.$inferSelect>;
168
+ primaryWorkspace: typeof projectWorkspaces.$inferSelect | null;
169
+ }) | {
170
+ monthlyBudgetUsd: number;
171
+ usedBudgetUsd: number;
172
+ budgetWindowStartAt: string | null;
173
+ workspaceLocalPath: string | null;
174
+ workspaceGithubRepo: string | null;
175
+ executionWorkspacePolicy: Record<string, unknown> | null;
176
+ workspaces: {
177
+ id: string;
178
+ name: string;
179
+ createdAt: Date;
180
+ companyId: string;
181
+ updatedAt: Date;
182
+ projectId: string;
183
+ cwd: string | null;
184
+ repoUrl: string | null;
185
+ repoRef: string | null;
186
+ isPrimary: boolean;
187
+ }[];
188
+ primaryWorkspace: {
189
+ id: string;
190
+ name: string;
191
+ createdAt: Date;
192
+ companyId: string;
193
+ updatedAt: Date;
194
+ projectId: string;
195
+ cwd: string | null;
196
+ repoUrl: string | null;
197
+ repoRef: string | null;
198
+ isPrimary: boolean;
199
+ } | null;
200
+ id: string;
201
+ name: string;
202
+ createdAt: Date;
203
+ companyId: string;
204
+ description: string | null;
205
+ status: string;
206
+ plannedStartAt: Date | null;
207
+ updatedAt: Date;
208
+ } | null>;
209
+ export declare function listProjectWorkspaces(db: BopoDb, companyId: string, projectId: string): Promise<{
210
+ id: string;
211
+ companyId: string;
212
+ projectId: string;
213
+ name: string;
214
+ cwd: string | null;
215
+ repoUrl: string | null;
216
+ repoRef: string | null;
217
+ isPrimary: boolean;
218
+ createdAt: Date;
219
+ updatedAt: Date;
220
+ }[]>;
221
+ export declare function createProjectWorkspace(db: BopoDb, input: {
222
+ companyId: string;
223
+ projectId: string;
224
+ name: string;
225
+ cwd?: string | null;
226
+ repoUrl?: string | null;
227
+ repoRef?: string | null;
228
+ isPrimary?: boolean;
229
+ }): Promise<any>;
230
+ export declare function updateProjectWorkspace(db: BopoDb, input: {
231
+ companyId: string;
232
+ projectId: string;
233
+ id: string;
234
+ name?: string;
235
+ cwd?: string | null;
236
+ repoUrl?: string | null;
237
+ repoRef?: string | null;
238
+ isPrimary?: boolean;
239
+ }): Promise<any>;
240
+ export declare function deleteProjectWorkspace(db: BopoDb, input: {
241
+ companyId: string;
242
+ projectId: string;
243
+ id: string;
244
+ }): Promise<any>;
245
+ export declare function syncProjectGoals(db: BopoDb, input: {
246
+ companyId: string;
247
+ projectId: string;
248
+ goalIds: string[];
249
+ }): Promise<void>;
250
+ export declare function deleteProject(db: BopoDb, companyId: string, id: string): Promise<boolean>;
251
+ export declare function listIssues(db: BopoDb, companyId: string, projectId?: string): Promise<{
252
+ id: string;
253
+ companyId: string;
254
+ projectId: string;
255
+ parentIssueId: string | null;
256
+ title: string;
257
+ body: string | null;
258
+ status: string;
259
+ priority: string;
260
+ assigneeAgentId: string | null;
261
+ labelsJson: string;
262
+ tagsJson: string;
263
+ externalLink: string | null;
264
+ isClaimed: boolean;
265
+ claimedByHeartbeatRunId: string | null;
266
+ createdAt: Date;
267
+ updatedAt: Date;
268
+ }[]>;
269
+ export declare function listIssueGoalIdsBatch(db: BopoDb, companyId: string, issueIds: string[]): Promise<Map<string, string[]>>;
270
+ export declare function syncIssueGoals(db: BopoDb, input: {
271
+ companyId: string;
272
+ issueId: string;
273
+ projectId: string;
274
+ goalIds: string[];
275
+ }): Promise<void>;
276
+ export declare function getIssue(db: BopoDb, companyId: string, issueId: string): Promise<{
277
+ id: string;
278
+ companyId: string;
279
+ projectId: string;
280
+ parentIssueId: string | null;
281
+ title: string;
282
+ body: string | null;
283
+ status: string;
284
+ priority: string;
285
+ assigneeAgentId: string | null;
286
+ labelsJson: string;
287
+ tagsJson: string;
288
+ externalLink: string | null;
289
+ isClaimed: boolean;
290
+ claimedByHeartbeatRunId: string | null;
291
+ createdAt: Date;
292
+ updatedAt: Date;
293
+ } | null>;
294
+ export declare function createIssue(db: BopoDb, input: {
295
+ companyId: string;
296
+ projectId: string;
297
+ parentIssueId?: string | null;
298
+ goalIds?: string[];
299
+ title: string;
300
+ body?: string;
301
+ externalLink?: string | null;
302
+ status?: string;
303
+ priority?: string;
304
+ assigneeAgentId?: string | null;
305
+ labels?: string[];
306
+ tags?: string[];
307
+ }): Promise<{
308
+ id: string;
309
+ createdAt: Date;
310
+ companyId: string;
311
+ status: string;
312
+ updatedAt: Date;
313
+ projectId: string;
314
+ title: string;
315
+ parentIssueId: string | null;
316
+ body: string | null;
317
+ priority: string;
318
+ assigneeAgentId: string | null;
319
+ labelsJson: string;
320
+ tagsJson: string;
321
+ externalLink: string | null;
322
+ isClaimed: boolean;
323
+ claimedByHeartbeatRunId: string | null;
324
+ }>;
325
+ export declare function updateIssue(db: BopoDb, input: {
326
+ companyId: string;
327
+ id: string;
328
+ projectId?: string;
329
+ goalIds?: string[];
330
+ title?: string;
331
+ body?: string | null;
332
+ externalLink?: string | null;
333
+ status?: string;
334
+ priority?: string;
335
+ assigneeAgentId?: string | null;
336
+ labels?: string[];
337
+ tags?: string[];
338
+ }): Promise<{
339
+ id: string;
340
+ companyId: string;
341
+ projectId: string;
342
+ parentIssueId: string | null;
343
+ title: string;
344
+ body: string | null;
345
+ status: string;
346
+ priority: string;
347
+ assigneeAgentId: string | null;
348
+ labelsJson: string;
349
+ tagsJson: string;
350
+ externalLink: string | null;
351
+ isClaimed: boolean;
352
+ claimedByHeartbeatRunId: string | null;
353
+ createdAt: Date;
354
+ updatedAt: Date;
355
+ } | null>;
356
+ export declare function deleteIssue(db: BopoDb, companyId: string, id: string): Promise<boolean>;
357
+ export declare function addIssueAttachment(db: BopoDb, input: {
358
+ id?: string;
359
+ companyId: string;
360
+ issueId: string;
361
+ projectId: string;
362
+ fileName: string;
363
+ mimeType?: string | null;
364
+ fileSizeBytes: number;
365
+ relativePath: string;
366
+ uploadedByActorType?: "human" | "agent" | "system";
367
+ uploadedByActorId?: string | null;
368
+ }): Promise<{
369
+ id: string;
370
+ companyId: string;
371
+ issueId: string;
372
+ projectId: string;
373
+ fileName: string;
374
+ mimeType?: string | null;
375
+ fileSizeBytes: number;
376
+ relativePath: string;
377
+ uploadedByActorType?: "human" | "agent" | "system";
378
+ uploadedByActorId?: string | null;
379
+ }>;
380
+ export declare function listIssueAttachments(db: BopoDb, companyId: string, issueId: string): Promise<{
381
+ id: string;
382
+ companyId: string;
383
+ issueId: string;
384
+ projectId: string;
385
+ fileName: string;
386
+ mimeType: string | null;
387
+ fileSizeBytes: number;
388
+ relativePath: string;
389
+ uploadedByActorType: string;
390
+ uploadedByActorId: string | null;
391
+ createdAt: Date;
392
+ }[]>;
393
+ export declare function getIssueAttachment(db: BopoDb, companyId: string, issueId: string, attachmentId: string): Promise<{
394
+ id: string;
395
+ companyId: string;
396
+ issueId: string;
397
+ projectId: string;
398
+ fileName: string;
399
+ mimeType: string | null;
400
+ fileSizeBytes: number;
401
+ relativePath: string;
402
+ uploadedByActorType: string;
403
+ uploadedByActorId: string | null;
404
+ createdAt: Date;
405
+ } | null>;
406
+ export declare function deleteIssueAttachment(db: BopoDb, companyId: string, issueId: string, attachmentId: string): Promise<{
407
+ id: string;
408
+ createdAt: Date;
409
+ companyId: string;
410
+ projectId: string;
411
+ issueId: string;
412
+ fileName: string;
413
+ mimeType: string | null;
414
+ fileSizeBytes: number;
415
+ relativePath: string;
416
+ uploadedByActorType: string;
417
+ uploadedByActorId: string | null;
418
+ } | null>;
419
+ export declare function addIssueComment(db: BopoDb, input: {
420
+ companyId: string;
421
+ issueId: string;
422
+ authorType: "human" | "agent" | "system";
423
+ authorId?: string | null;
424
+ runId?: string | null;
425
+ recipients?: Array<{
426
+ recipientType: "agent" | "board" | "member";
427
+ recipientId?: string | null;
428
+ deliveryStatus?: "pending" | "dispatched" | "failed" | "skipped";
429
+ dispatchedRunId?: string | null;
430
+ dispatchedAt?: string | null;
431
+ acknowledgedAt?: string | null;
432
+ }>;
433
+ body: string;
434
+ }): Promise<{
435
+ recipients: {
436
+ recipientType: "agent" | "board" | "member";
437
+ recipientId: string | null;
438
+ deliveryStatus: "pending" | "dispatched" | "failed" | "skipped";
439
+ dispatchedRunId: string | null;
440
+ dispatchedAt: string | null;
441
+ acknowledgedAt: string | null;
442
+ }[];
443
+ id: string;
444
+ createdAt: Date;
445
+ companyId: string;
446
+ body: string;
447
+ issueId: string;
448
+ authorType: string;
449
+ authorId: string | null;
450
+ runId: string | null;
451
+ } | {
452
+ id: string;
453
+ companyId: string;
454
+ issueId: string;
455
+ authorType: "human" | "agent" | "system";
456
+ authorId: string | null;
457
+ body: string;
458
+ runId: string | null;
459
+ recipients: {
460
+ recipientType: "agent" | "board" | "member";
461
+ recipientId?: string | null;
462
+ deliveryStatus?: "pending" | "dispatched" | "failed" | "skipped";
463
+ dispatchedRunId?: string | null;
464
+ dispatchedAt?: string | null;
465
+ acknowledgedAt?: string | null;
466
+ }[];
467
+ }>;
468
+ export declare function listIssueComments(db: BopoDb, companyId: string, issueId: string): Promise<{
469
+ recipients: {
470
+ recipientType: "agent" | "board" | "member";
471
+ recipientId: string | null;
472
+ deliveryStatus: "pending" | "dispatched" | "failed" | "skipped";
473
+ dispatchedRunId: string | null;
474
+ dispatchedAt: string | null;
475
+ acknowledgedAt: string | null;
476
+ }[];
477
+ id: string;
478
+ createdAt: Date;
479
+ companyId: string;
480
+ body: string;
481
+ issueId: string;
482
+ authorType: string;
483
+ authorId: string | null;
484
+ runId: string | null;
485
+ }[]>;
486
+ export declare function listIssueActivity(db: BopoDb, companyId: string, issueId: string, limit?: number): Promise<{
487
+ id: string;
488
+ companyId: string;
489
+ issueId: string | null;
490
+ actorType: string;
491
+ actorId: string | null;
492
+ eventType: string;
493
+ payloadJson: string;
494
+ createdAt: Date;
495
+ }[]>;
496
+ export declare function updateIssueComment(db: BopoDb, input: {
497
+ companyId: string;
498
+ issueId: string;
499
+ id: string;
500
+ body: string;
501
+ }): Promise<{
502
+ recipients: {
503
+ recipientType: "agent" | "board" | "member";
504
+ recipientId: string | null;
505
+ deliveryStatus: "pending" | "dispatched" | "failed" | "skipped";
506
+ dispatchedRunId: string | null;
507
+ dispatchedAt: string | null;
508
+ acknowledgedAt: string | null;
509
+ }[];
510
+ id: string;
511
+ createdAt: Date;
512
+ companyId: string;
513
+ body: string;
514
+ issueId: string;
515
+ authorType: string;
516
+ authorId: string | null;
517
+ runId: string | null;
518
+ } | null>;
519
+ export declare function updateIssueCommentRecipients(db: BopoDb, input: {
520
+ companyId: string;
521
+ issueId: string;
522
+ id: string;
523
+ recipients: Array<{
524
+ recipientType: "agent" | "board" | "member";
525
+ recipientId?: string | null;
526
+ deliveryStatus?: "pending" | "dispatched" | "failed" | "skipped";
527
+ dispatchedRunId?: string | null;
528
+ dispatchedAt?: string | null;
529
+ acknowledgedAt?: string | null;
530
+ }>;
531
+ }): Promise<{
532
+ recipients: {
533
+ recipientType: "agent" | "board" | "member";
534
+ recipientId: string | null;
535
+ deliveryStatus: "pending" | "dispatched" | "failed" | "skipped";
536
+ dispatchedRunId: string | null;
537
+ dispatchedAt: string | null;
538
+ acknowledgedAt: string | null;
539
+ }[];
540
+ id: string;
541
+ createdAt: Date;
542
+ companyId: string;
543
+ body: string;
544
+ issueId: string;
545
+ authorType: string;
546
+ authorId: string | null;
547
+ runId: string | null;
548
+ } | null>;
549
+ export declare function deleteIssueComment(db: BopoDb, companyId: string, issueId: string, id: string): Promise<boolean>;
550
+ export declare function createGoal(db: BopoDb, input: {
551
+ companyId: string;
552
+ projectId?: string | null;
553
+ parentGoalId?: string | null;
554
+ ownerAgentId?: string | null;
555
+ level: "company" | "project" | "agent";
556
+ title: string;
557
+ description?: string;
558
+ }): Promise<{
559
+ companyId: string;
560
+ projectId?: string | null;
561
+ parentGoalId?: string | null;
562
+ ownerAgentId?: string | null;
563
+ level: "company" | "project" | "agent";
564
+ title: string;
565
+ description?: string;
566
+ id: string;
567
+ }>;
568
+ export declare function listGoals(db: BopoDb, companyId: string): Promise<{
569
+ id: string;
570
+ companyId: string;
571
+ projectId: string | null;
572
+ parentGoalId: string | null;
573
+ ownerAgentId: string | null;
574
+ level: string;
575
+ title: string;
576
+ description: string | null;
577
+ status: string;
578
+ createdAt: Date;
579
+ updatedAt: Date;
580
+ }[]>;
581
+ export declare function updateGoal(db: BopoDb, input: {
582
+ companyId: string;
583
+ id: string;
584
+ projectId?: string | null;
585
+ parentGoalId?: string | null;
586
+ ownerAgentId?: string | null;
587
+ level?: "company" | "project" | "agent";
588
+ title?: string;
589
+ description?: string | null;
590
+ status?: string;
591
+ }): Promise<{
592
+ id: string;
593
+ companyId: string;
594
+ projectId: string | null;
595
+ parentGoalId: string | null;
596
+ ownerAgentId: string | null;
597
+ level: string;
598
+ title: string;
599
+ description: string | null;
600
+ status: string;
601
+ createdAt: Date;
602
+ updatedAt: Date;
603
+ } | null>;
604
+ export declare function deleteGoal(db: BopoDb, companyId: string, id: string): Promise<boolean>;
605
+ export declare function createAgent(db: BopoDb, input: {
606
+ companyId: string;
607
+ managerAgentId?: string | null;
608
+ role: string;
609
+ roleKey?: string | null;
610
+ title?: string | null;
611
+ name: string;
612
+ providerType: "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli" | "openai_api" | "anthropic_api" | "http" | "shell";
613
+ heartbeatCron: string;
614
+ monthlyBudgetUsd: string;
615
+ canHireAgents?: boolean;
616
+ avatarSeed?: string;
617
+ runtimeCommand?: string | null;
618
+ runtimeArgsJson?: string;
619
+ runtimeCwd?: string | null;
620
+ runtimeEnvJson?: string;
621
+ runtimeModel?: string | null;
622
+ runtimeThinkingEffort?: "auto" | "low" | "medium" | "high";
623
+ bootstrapPrompt?: string | null;
624
+ runtimeTimeoutSec?: number;
625
+ interruptGraceSec?: number;
626
+ runPolicyJson?: string;
627
+ initialState?: Record<string, unknown>;
628
+ }): Promise<{
629
+ avatarSeed: string;
630
+ companyId: string;
631
+ managerAgentId?: string | null;
632
+ role: string;
633
+ roleKey?: string | null;
634
+ title?: string | null;
635
+ name: string;
636
+ providerType: "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli" | "openai_api" | "anthropic_api" | "http" | "shell";
637
+ heartbeatCron: string;
638
+ monthlyBudgetUsd: string;
639
+ canHireAgents?: boolean;
640
+ runtimeCommand?: string | null;
641
+ runtimeArgsJson?: string;
642
+ runtimeCwd?: string | null;
643
+ runtimeEnvJson?: string;
644
+ runtimeModel?: string | null;
645
+ runtimeThinkingEffort?: "auto" | "low" | "medium" | "high";
646
+ bootstrapPrompt?: string | null;
647
+ runtimeTimeoutSec?: number;
648
+ interruptGraceSec?: number;
649
+ runPolicyJson?: string;
650
+ initialState?: Record<string, unknown>;
651
+ id: string;
652
+ }>;
653
+ export declare function listAgents(db: BopoDb, companyId: string): Promise<{
654
+ id: string;
655
+ companyId: string;
656
+ managerAgentId: string | null;
657
+ role: string;
658
+ roleKey: string | null;
659
+ title: string | null;
660
+ name: string;
661
+ providerType: string;
662
+ status: string;
663
+ heartbeatCron: string;
664
+ monthlyBudgetUsd: string;
665
+ usedBudgetUsd: string;
666
+ tokenUsage: number;
667
+ canHireAgents: boolean;
668
+ avatarSeed: string;
669
+ runtimeCommand: string | null;
670
+ runtimeArgsJson: string;
671
+ runtimeCwd: string | null;
672
+ runtimeEnvJson: string;
673
+ runtimeModel: string | null;
674
+ runtimeThinkingEffort: string;
675
+ bootstrapPrompt: string | null;
676
+ runtimeTimeoutSec: number;
677
+ interruptGraceSec: number;
678
+ runPolicyJson: string;
679
+ stateBlob: string;
680
+ createdAt: Date;
681
+ updatedAt: Date;
682
+ }[]>;
683
+ export declare function updateAgent(db: BopoDb, input: {
684
+ companyId: string;
685
+ id: string;
686
+ managerAgentId?: string | null;
687
+ role?: string;
688
+ roleKey?: string | null;
689
+ title?: string | null;
690
+ name?: string;
691
+ providerType?: "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli" | "openai_api" | "anthropic_api" | "http" | "shell";
692
+ status?: string;
693
+ heartbeatCron?: string;
694
+ monthlyBudgetUsd?: string;
695
+ canHireAgents?: boolean;
696
+ runtimeCommand?: string | null;
697
+ runtimeArgsJson?: string;
698
+ runtimeCwd?: string | null;
699
+ runtimeEnvJson?: string;
700
+ runtimeModel?: string | null;
701
+ runtimeThinkingEffort?: "auto" | "low" | "medium" | "high";
702
+ bootstrapPrompt?: string | null;
703
+ runtimeTimeoutSec?: number;
704
+ interruptGraceSec?: number;
705
+ runPolicyJson?: string;
706
+ stateBlob?: Record<string, unknown>;
707
+ }): Promise<{
708
+ id: string;
709
+ companyId: string;
710
+ managerAgentId: string | null;
711
+ role: string;
712
+ roleKey: string | null;
713
+ title: string | null;
714
+ name: string;
715
+ providerType: string;
716
+ status: string;
717
+ heartbeatCron: string;
718
+ monthlyBudgetUsd: string;
719
+ usedBudgetUsd: string;
720
+ tokenUsage: number;
721
+ canHireAgents: boolean;
722
+ avatarSeed: 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>;
737
+ export declare function deleteAgent(db: BopoDb, companyId: string, id: string): Promise<boolean>;
738
+ export declare function appendAuditEvent(db: BopoDb, input: {
739
+ companyId: string;
740
+ actorType: "human" | "agent" | "system";
741
+ actorId?: string | null;
742
+ eventType: string;
743
+ entityType: string;
744
+ entityId: string;
745
+ correlationId?: string | null;
746
+ payload: Record<string, unknown>;
747
+ }): Promise<string>;
748
+ export declare function listAuditEvents(db: BopoDb, companyId: string, limit?: number): Promise<{
749
+ id: string;
750
+ companyId: string;
751
+ actorType: string;
752
+ actorId: string | null;
753
+ eventType: string;
754
+ entityType: string;
755
+ entityId: string;
756
+ correlationId: string | null;
757
+ payloadJson: string;
758
+ createdAt: Date;
759
+ }[]>;
760
+ export declare function createApprovalRequest(db: BopoDb, input: {
761
+ companyId: string;
762
+ requestedByAgentId?: string | null;
763
+ action: string;
764
+ payload: Record<string, unknown>;
765
+ }): Promise<string>;
766
+ export declare function getApprovalRequest(db: BopoDb, companyId: string, approvalId: string): Promise<{
767
+ id: string;
768
+ companyId: string;
769
+ requestedByAgentId: string | null;
770
+ action: string;
771
+ payloadJson: string;
772
+ status: string;
773
+ createdAt: Date;
774
+ resolvedAt: Date | null;
775
+ } | null>;
776
+ export declare function listApprovalRequests(db: BopoDb, companyId: string): Promise<{
777
+ id: string;
778
+ companyId: string;
779
+ requestedByAgentId: string | null;
780
+ action: string;
781
+ payloadJson: string;
782
+ status: string;
783
+ createdAt: Date;
784
+ resolvedAt: Date | null;
785
+ }[]>;
786
+ export declare function countPendingApprovalRequests(db: BopoDb, companyId: string): Promise<number>;
787
+ export declare function listApprovalInboxStates(db: BopoDb, companyId: string, actorId: string): Promise<{
788
+ companyId: string;
789
+ actorId: string;
790
+ approvalId: string;
791
+ seenAt: Date | null;
792
+ dismissedAt: Date | null;
793
+ createdAt: Date;
794
+ updatedAt: Date;
795
+ }[]>;
796
+ export declare function markApprovalInboxSeen(db: BopoDb, input: {
797
+ companyId: string;
798
+ actorId: string;
799
+ approvalId: string;
800
+ seenAt?: Date;
801
+ }): Promise<void>;
802
+ export declare function markApprovalInboxDismissed(db: BopoDb, input: {
803
+ companyId: string;
804
+ actorId: string;
805
+ approvalId: string;
806
+ dismissedAt?: Date;
807
+ }): Promise<void>;
808
+ export declare function clearApprovalInboxDismissed(db: BopoDb, input: {
809
+ companyId: string;
810
+ actorId: string;
811
+ approvalId: string;
812
+ }): Promise<void>;
813
+ export declare function listAttentionInboxStates(db: BopoDb, companyId: string, actorId: string): Promise<{
814
+ companyId: string;
815
+ actorId: string;
816
+ itemKey: string;
817
+ seenAt: Date | null;
818
+ acknowledgedAt: Date | null;
819
+ dismissedAt: Date | null;
820
+ resolvedAt: Date | null;
821
+ createdAt: Date;
822
+ updatedAt: Date;
823
+ }[]>;
824
+ export declare function markAttentionInboxSeen(db: BopoDb, input: {
825
+ companyId: string;
826
+ actorId: string;
827
+ itemKey: string;
828
+ seenAt?: Date;
829
+ }): Promise<void>;
830
+ export declare function markAttentionInboxAcknowledged(db: BopoDb, input: {
831
+ companyId: string;
832
+ actorId: string;
833
+ itemKey: string;
834
+ acknowledgedAt?: Date;
835
+ }): Promise<void>;
836
+ export declare function markAttentionInboxDismissed(db: BopoDb, input: {
837
+ companyId: string;
838
+ actorId: string;
839
+ itemKey: string;
840
+ dismissedAt?: Date;
841
+ }): Promise<void>;
842
+ export declare function clearAttentionInboxDismissed(db: BopoDb, input: {
843
+ companyId: string;
844
+ actorId: string;
845
+ itemKey: string;
846
+ }): Promise<void>;
847
+ export declare function markAttentionInboxResolved(db: BopoDb, input: {
848
+ companyId: string;
849
+ actorId: string;
850
+ itemKey: string;
851
+ resolvedAt?: Date;
852
+ }): Promise<void>;
853
+ export declare function appendCost(db: BopoDb, input: {
854
+ companyId: string;
855
+ runId?: string | null;
856
+ providerType: string;
857
+ runtimeModelId?: string | null;
858
+ pricingProviderType?: string | null;
859
+ pricingModelId?: string | null;
860
+ pricingSource?: "exact" | "missing" | null;
861
+ usdCostStatus?: "exact" | "estimated" | "unknown" | null;
862
+ tokenInput: number;
863
+ tokenOutput: number;
864
+ usdCost: string;
865
+ projectId?: string | null;
866
+ issueId?: string | null;
867
+ agentId?: string | null;
868
+ }): Promise<string>;
869
+ export declare function listCostEntries(db: BopoDb, companyId: string, limit?: number): Promise<{
870
+ id: string;
871
+ companyId: string;
872
+ runId: string | null;
873
+ projectId: string | null;
874
+ issueId: string | null;
875
+ agentId: string | null;
876
+ providerType: string;
877
+ runtimeModelId: string | null;
878
+ pricingProviderType: string | null;
879
+ pricingModelId: string | null;
880
+ pricingSource: string | null;
881
+ tokenInput: number;
882
+ tokenOutput: number;
883
+ usdCost: string;
884
+ usdCostStatus: string | null;
885
+ createdAt: Date;
886
+ }[]>;
887
+ export declare function listHeartbeatRuns(db: BopoDb, companyId: string, limit?: number): Promise<{
888
+ id: string;
889
+ companyId: string;
890
+ agentId: string;
891
+ status: string;
892
+ startedAt: Date;
893
+ finishedAt: Date | null;
894
+ message: string | null;
895
+ }[]>;
896
+ export type HeartbeatQueueJobType = "manual" | "scheduler" | "resume" | "redo" | "comment_dispatch";
897
+ export type HeartbeatQueueJobStatus = "pending" | "running" | "completed" | "failed" | "dead_letter" | "canceled";
898
+ export declare function enqueueHeartbeatJob(db: BopoDb, input: {
899
+ companyId: string;
900
+ agentId: string;
901
+ jobType: HeartbeatQueueJobType;
902
+ payload?: Record<string, unknown>;
903
+ priority?: number;
904
+ availableAt?: Date;
905
+ maxAttempts?: number;
906
+ idempotencyKey?: string | null;
907
+ }): Promise<{
908
+ payload: Record<string, unknown>;
909
+ id: string;
910
+ companyId: string;
911
+ agentId: string;
912
+ jobType: string;
913
+ payloadJson: string;
914
+ status: string;
915
+ priority: number;
916
+ idempotencyKey: string | null;
917
+ availableAt: Date;
918
+ attemptCount: number;
919
+ maxAttempts: number;
920
+ lastError: string | null;
921
+ startedAt: Date | null;
922
+ finishedAt: Date | null;
923
+ heartbeatRunId: string | null;
924
+ createdAt: Date;
925
+ updatedAt: Date;
926
+ }>;
927
+ export declare function claimNextHeartbeatJob(db: BopoDb, companyId: string): 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
+ } | null>;
947
+ export declare function getHeartbeatQueueJob(db: BopoDb, companyId: string, id: 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 markHeartbeatJobCompleted(db: BopoDb, input: {
968
+ companyId: string;
969
+ id: string;
970
+ heartbeatRunId?: string | null;
971
+ }): Promise<{
972
+ payload: Record<string, unknown>;
973
+ id: string;
974
+ companyId: string;
975
+ agentId: string;
976
+ jobType: string;
977
+ payloadJson: string;
978
+ status: string;
979
+ priority: number;
980
+ idempotencyKey: string | null;
981
+ availableAt: Date;
982
+ attemptCount: number;
983
+ maxAttempts: number;
984
+ lastError: string | null;
985
+ startedAt: Date | null;
986
+ finishedAt: Date | null;
987
+ heartbeatRunId: string | null;
988
+ createdAt: Date;
989
+ updatedAt: Date;
990
+ } | null>;
991
+ export declare function markHeartbeatJobRetry(db: BopoDb, input: {
992
+ companyId: string;
993
+ id: string;
994
+ retryAt: Date;
995
+ error?: string | null;
996
+ heartbeatRunId?: string | null;
997
+ }): Promise<{
998
+ payload: Record<string, unknown>;
999
+ id: string;
1000
+ companyId: string;
1001
+ agentId: string;
1002
+ jobType: string;
1003
+ payloadJson: string;
1004
+ status: string;
1005
+ priority: number;
1006
+ idempotencyKey: string | null;
1007
+ availableAt: Date;
1008
+ attemptCount: number;
1009
+ maxAttempts: number;
1010
+ lastError: string | null;
1011
+ startedAt: Date | null;
1012
+ finishedAt: Date | null;
1013
+ heartbeatRunId: string | null;
1014
+ createdAt: Date;
1015
+ updatedAt: Date;
1016
+ } | null>;
1017
+ export declare function markHeartbeatJobFailed(db: BopoDb, input: {
1018
+ companyId: string;
1019
+ id: string;
1020
+ error?: string | null;
1021
+ heartbeatRunId?: string | null;
1022
+ }): Promise<{
1023
+ payload: Record<string, unknown>;
1024
+ id: string;
1025
+ companyId: string;
1026
+ agentId: string;
1027
+ jobType: string;
1028
+ payloadJson: string;
1029
+ status: string;
1030
+ priority: number;
1031
+ idempotencyKey: string | null;
1032
+ availableAt: Date;
1033
+ attemptCount: number;
1034
+ maxAttempts: number;
1035
+ lastError: string | null;
1036
+ startedAt: Date | null;
1037
+ finishedAt: Date | null;
1038
+ heartbeatRunId: string | null;
1039
+ createdAt: Date;
1040
+ updatedAt: Date;
1041
+ } | null>;
1042
+ export declare function markHeartbeatJobDeadLetter(db: BopoDb, input: {
1043
+ companyId: string;
1044
+ id: string;
1045
+ error?: string | null;
1046
+ heartbeatRunId?: string | null;
1047
+ }): Promise<{
1048
+ payload: Record<string, unknown>;
1049
+ id: string;
1050
+ companyId: string;
1051
+ agentId: string;
1052
+ jobType: string;
1053
+ payloadJson: string;
1054
+ status: string;
1055
+ priority: number;
1056
+ idempotencyKey: string | null;
1057
+ availableAt: Date;
1058
+ attemptCount: number;
1059
+ maxAttempts: number;
1060
+ lastError: string | null;
1061
+ startedAt: Date | null;
1062
+ finishedAt: Date | null;
1063
+ heartbeatRunId: string | null;
1064
+ createdAt: Date;
1065
+ updatedAt: Date;
1066
+ } | null>;
1067
+ export declare function cancelHeartbeatJob(db: BopoDb, input: {
1068
+ companyId: string;
1069
+ id: string;
1070
+ }): Promise<{
1071
+ payload: Record<string, unknown>;
1072
+ id: string;
1073
+ companyId: string;
1074
+ agentId: string;
1075
+ jobType: string;
1076
+ payloadJson: string;
1077
+ status: string;
1078
+ priority: number;
1079
+ idempotencyKey: string | null;
1080
+ availableAt: Date;
1081
+ attemptCount: number;
1082
+ maxAttempts: number;
1083
+ lastError: string | null;
1084
+ startedAt: Date | null;
1085
+ finishedAt: Date | null;
1086
+ heartbeatRunId: string | null;
1087
+ createdAt: Date;
1088
+ updatedAt: Date;
1089
+ } | null>;
1090
+ export declare function listHeartbeatQueueJobs(db: BopoDb, input: {
1091
+ companyId: string;
1092
+ status?: HeartbeatQueueJobStatus;
1093
+ agentId?: string;
1094
+ jobType?: HeartbeatQueueJobType;
1095
+ limit?: number;
1096
+ }): Promise<{
1097
+ payload: Record<string, unknown>;
1098
+ id: string;
1099
+ companyId: string;
1100
+ agentId: string;
1101
+ jobType: string;
1102
+ payloadJson: string;
1103
+ status: string;
1104
+ priority: number;
1105
+ idempotencyKey: string | null;
1106
+ availableAt: Date;
1107
+ attemptCount: number;
1108
+ maxAttempts: number;
1109
+ lastError: string | null;
1110
+ startedAt: Date | null;
1111
+ finishedAt: Date | null;
1112
+ heartbeatRunId: string | null;
1113
+ createdAt: Date;
1114
+ updatedAt: Date;
1115
+ }[]>;
1116
+ export declare function getHeartbeatRun(db: BopoDb, companyId: string, runId: string): Promise<{
1117
+ id: string;
1118
+ companyId: string;
1119
+ agentId: string;
1120
+ status: string;
1121
+ startedAt: Date;
1122
+ finishedAt: Date | null;
1123
+ message: string | null;
1124
+ } | null>;
1125
+ export declare function appendHeartbeatRunMessages(db: BopoDb, input: {
1126
+ companyId: string;
1127
+ runId: string;
1128
+ messages: Array<{
1129
+ id?: string;
1130
+ sequence: number;
1131
+ kind: string;
1132
+ label?: string | null;
1133
+ text?: string | null;
1134
+ payloadJson?: string | null;
1135
+ signalLevel?: "high" | "medium" | "low" | "noise" | null;
1136
+ groupKey?: string | null;
1137
+ source?: "stdout" | "stderr" | "trace_fallback" | null;
1138
+ createdAt?: Date;
1139
+ }>;
1140
+ }): Promise<string[]>;
1141
+ export declare function listHeartbeatRunMessages(db: BopoDb, input: {
1142
+ companyId: string;
1143
+ runId: string;
1144
+ afterSequence?: number;
1145
+ limit?: number;
1146
+ }): Promise<{
1147
+ items: {
1148
+ id: string;
1149
+ companyId: string;
1150
+ runId: string;
1151
+ sequence: number;
1152
+ kind: string;
1153
+ label: string | null;
1154
+ text: string | null;
1155
+ payloadJson: string | null;
1156
+ signalLevel: string | null;
1157
+ groupKey: string | null;
1158
+ source: string | null;
1159
+ createdAt: Date;
1160
+ }[];
1161
+ nextCursor: string | null;
1162
+ }>;
1163
+ export declare function listHeartbeatRunMessagesForRuns(db: BopoDb, input: {
1164
+ companyId: string;
1165
+ runIds: string[];
1166
+ perRunLimit?: number;
1167
+ }): Promise<Map<string, {
1168
+ items: Array<(typeof heartbeatRunMessages.$inferSelect)>;
1169
+ nextCursor: string | null;
1170
+ }>>;
1171
+ export declare function appendActivity(db: BopoDb, input: {
1172
+ companyId: string;
1173
+ issueId?: string | null;
1174
+ actorType: "human" | "agent" | "system";
1175
+ actorId?: string | null;
1176
+ eventType: string;
1177
+ payload: Record<string, unknown>;
1178
+ }): Promise<string>;
1179
+ export declare function upsertPlugin(db: BopoDb, input: {
1180
+ id: string;
1181
+ name: string;
1182
+ version: string;
1183
+ kind: string;
1184
+ runtimeType: string;
1185
+ runtimeEntrypoint: string;
1186
+ hooksJson?: string;
1187
+ capabilitiesJson?: string;
1188
+ manifestJson?: string;
1189
+ }): Promise<string>;
1190
+ export declare function listPlugins(db: BopoDb): Promise<{
1191
+ id: string;
1192
+ name: string;
1193
+ version: string;
1194
+ kind: string;
1195
+ runtimeType: string;
1196
+ runtimeEntrypoint: string;
1197
+ hooksJson: string;
1198
+ capabilitiesJson: string;
1199
+ manifestJson: string;
1200
+ createdAt: Date;
1201
+ updatedAt: Date;
1202
+ }[]>;
1203
+ export declare function updatePluginConfig(db: BopoDb, input: {
1204
+ companyId: string;
1205
+ pluginId: string;
1206
+ enabled?: boolean;
1207
+ priority?: number;
1208
+ configJson?: string;
1209
+ grantedCapabilitiesJson?: string;
1210
+ }): Promise<void>;
1211
+ export declare function deletePluginConfig(db: BopoDb, input: {
1212
+ companyId: string;
1213
+ pluginId: string;
1214
+ }): Promise<void>;
1215
+ export declare function deletePluginById(db: BopoDb, pluginId: string): Promise<void>;
1216
+ export declare function listCompanyPluginConfigs(db: BopoDb, companyId: string): Promise<{
1217
+ companyId: string;
1218
+ pluginId: string;
1219
+ enabled: boolean;
1220
+ priority: number;
1221
+ configJson: string;
1222
+ grantedCapabilitiesJson: string;
1223
+ pluginName: string;
1224
+ pluginVersion: string;
1225
+ pluginKind: string;
1226
+ runtimeType: string;
1227
+ runtimeEntrypoint: string;
1228
+ hooksJson: string;
1229
+ capabilitiesJson: string;
1230
+ manifestJson: string;
1231
+ }[]>;
1232
+ export declare function appendPluginRun(db: BopoDb, input: {
1233
+ companyId: string;
1234
+ runId?: string | null;
1235
+ pluginId: string;
1236
+ hook: string;
1237
+ status: string;
1238
+ durationMs: number;
1239
+ error?: string | null;
1240
+ diagnosticsJson?: string;
1241
+ }): Promise<string>;
1242
+ export declare function listPluginRuns(db: BopoDb, input: {
1243
+ companyId: string;
1244
+ pluginId?: string;
1245
+ runId?: string;
1246
+ limit?: number;
1247
+ }): Promise<{
1248
+ id: string;
1249
+ companyId: string;
1250
+ runId: string | null;
1251
+ pluginId: string;
1252
+ hook: string;
1253
+ status: string;
1254
+ durationMs: number;
1255
+ error: string | null;
1256
+ diagnosticsJson: string;
1257
+ createdAt: Date;
1258
+ }[]>;
1259
+ export declare function listTemplates(db: BopoDb, companyId: string): Promise<{
1260
+ id: string;
1261
+ companyId: string;
1262
+ slug: string;
1263
+ name: string;
1264
+ description: string | null;
1265
+ currentVersion: string;
1266
+ status: string;
1267
+ visibility: string;
1268
+ variablesJson: string;
1269
+ createdAt: Date;
1270
+ updatedAt: Date;
1271
+ }[]>;
1272
+ export declare function getTemplate(db: BopoDb, companyId: string, templateId: string): Promise<{
1273
+ id: string;
1274
+ companyId: string;
1275
+ slug: string;
1276
+ name: string;
1277
+ description: string | null;
1278
+ currentVersion: string;
1279
+ status: string;
1280
+ visibility: string;
1281
+ variablesJson: string;
1282
+ createdAt: Date;
1283
+ updatedAt: Date;
1284
+ } | null>;
1285
+ export declare function getTemplateBySlug(db: BopoDb, companyId: string, slug: string): Promise<{
1286
+ id: string;
1287
+ companyId: string;
1288
+ slug: string;
1289
+ name: string;
1290
+ description: string | null;
1291
+ currentVersion: string;
1292
+ status: string;
1293
+ visibility: string;
1294
+ variablesJson: string;
1295
+ createdAt: Date;
1296
+ updatedAt: Date;
1297
+ } | null>;
1298
+ export declare function createTemplate(db: BopoDb, input: {
1299
+ companyId: string;
1300
+ slug: string;
1301
+ name: string;
1302
+ description?: string | null;
1303
+ currentVersion?: string;
1304
+ status?: "draft" | "published" | "archived";
1305
+ visibility?: "company" | "private";
1306
+ variablesJson?: string;
1307
+ }): Promise<{
1308
+ id: string;
1309
+ name: string;
1310
+ createdAt: Date;
1311
+ companyId: string;
1312
+ description: string | null;
1313
+ status: string;
1314
+ updatedAt: Date;
1315
+ slug: string;
1316
+ currentVersion: string;
1317
+ visibility: string;
1318
+ variablesJson: string;
1319
+ } | null>;
1320
+ export declare function updateTemplate(db: BopoDb, input: {
1321
+ companyId: string;
1322
+ id: string;
1323
+ slug?: string;
1324
+ name?: string;
1325
+ description?: string | null;
1326
+ currentVersion?: string;
1327
+ status?: "draft" | "published" | "archived";
1328
+ visibility?: "company" | "private";
1329
+ variablesJson?: string;
1330
+ }): Promise<{
1331
+ id: string;
1332
+ companyId: string;
1333
+ slug: string;
1334
+ name: string;
1335
+ description: string | null;
1336
+ currentVersion: string;
1337
+ status: string;
1338
+ visibility: string;
1339
+ variablesJson: string;
1340
+ createdAt: Date;
1341
+ updatedAt: Date;
1342
+ } | null>;
1343
+ export declare function deleteTemplate(db: BopoDb, companyId: string, templateId: string): Promise<boolean>;
1344
+ export declare function listTemplateVersions(db: BopoDb, companyId: string, templateId: string): Promise<{
1345
+ id: string;
1346
+ companyId: string;
1347
+ templateId: string;
1348
+ version: string;
1349
+ manifestJson: string;
1350
+ createdAt: Date;
1351
+ }[]>;
1352
+ export declare function getTemplateVersionByVersion(db: BopoDb, input: {
1353
+ companyId: string;
1354
+ templateId: string;
1355
+ version: string;
1356
+ }): Promise<{
1357
+ id: string;
1358
+ companyId: string;
1359
+ templateId: string;
1360
+ version: string;
1361
+ manifestJson: string;
1362
+ createdAt: Date;
1363
+ } | null>;
1364
+ export declare function getCurrentTemplateVersion(db: BopoDb, companyId: string, templateId: string): Promise<{
1365
+ id: string;
1366
+ companyId: string;
1367
+ templateId: string;
1368
+ version: string;
1369
+ manifestJson: string;
1370
+ createdAt: Date;
1371
+ } | null>;
1372
+ export declare function createTemplateVersion(db: BopoDb, input: {
1373
+ companyId: string;
1374
+ templateId: string;
1375
+ version: string;
1376
+ manifestJson: string;
1377
+ }): Promise<{
1378
+ id: string;
1379
+ createdAt: Date;
1380
+ companyId: string;
1381
+ version: string;
1382
+ manifestJson: string;
1383
+ templateId: string;
1384
+ } | null>;
1385
+ export declare function listTemplateInstalls(db: BopoDb, input: {
1386
+ companyId: string;
1387
+ templateId?: string;
1388
+ limit?: number;
1389
+ }): Promise<{
1390
+ id: string;
1391
+ companyId: string;
1392
+ templateId: string | null;
1393
+ templateVersionId: string | null;
1394
+ status: string;
1395
+ summaryJson: string;
1396
+ variablesJson: string;
1397
+ createdAt: Date;
1398
+ }[]>;
1399
+ export declare function createTemplateInstall(db: BopoDb, input: {
1400
+ companyId: string;
1401
+ templateId?: string | null;
1402
+ templateVersionId?: string | null;
1403
+ status?: "applied" | "queued" | "failed";
1404
+ summaryJson?: string;
1405
+ variablesJson?: string;
1406
+ }): Promise<{
1407
+ id: string;
1408
+ createdAt: Date;
1409
+ companyId: string;
1410
+ status: string;
1411
+ variablesJson: string;
1412
+ templateId: string | null;
1413
+ templateVersionId: string | null;
1414
+ summaryJson: string;
1415
+ } | null>;