bopodev-db 0.1.28 → 0.1.30

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,1420 @@
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
+ capabilities?: string | null;
612
+ name: string;
613
+ providerType: "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli" | "openai_api" | "anthropic_api" | "openclaw_gateway" | "http" | "shell";
614
+ heartbeatCron: string;
615
+ monthlyBudgetUsd: string;
616
+ canHireAgents?: boolean;
617
+ avatarSeed?: string;
618
+ runtimeCommand?: string | null;
619
+ runtimeArgsJson?: string;
620
+ runtimeCwd?: string | null;
621
+ runtimeEnvJson?: string;
622
+ runtimeModel?: string | null;
623
+ runtimeThinkingEffort?: "auto" | "low" | "medium" | "high";
624
+ bootstrapPrompt?: string | null;
625
+ runtimeTimeoutSec?: number;
626
+ interruptGraceSec?: number;
627
+ runPolicyJson?: string;
628
+ initialState?: Record<string, unknown>;
629
+ }): Promise<{
630
+ avatarSeed: string;
631
+ companyId: string;
632
+ managerAgentId?: string | null;
633
+ role: string;
634
+ roleKey?: string | null;
635
+ title?: string | null;
636
+ capabilities?: string | null;
637
+ name: string;
638
+ providerType: "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli" | "openai_api" | "anthropic_api" | "openclaw_gateway" | "http" | "shell";
639
+ heartbeatCron: string;
640
+ monthlyBudgetUsd: string;
641
+ canHireAgents?: boolean;
642
+ runtimeCommand?: string | null;
643
+ runtimeArgsJson?: string;
644
+ runtimeCwd?: string | null;
645
+ runtimeEnvJson?: string;
646
+ runtimeModel?: string | null;
647
+ runtimeThinkingEffort?: "auto" | "low" | "medium" | "high";
648
+ bootstrapPrompt?: string | null;
649
+ runtimeTimeoutSec?: number;
650
+ interruptGraceSec?: number;
651
+ runPolicyJson?: string;
652
+ initialState?: Record<string, unknown>;
653
+ id: string;
654
+ }>;
655
+ export declare function listAgents(db: BopoDb, companyId: string): Promise<{
656
+ id: string;
657
+ companyId: string;
658
+ managerAgentId: string | null;
659
+ role: string;
660
+ roleKey: string | null;
661
+ title: string | null;
662
+ capabilities: string | null;
663
+ name: string;
664
+ providerType: string;
665
+ status: string;
666
+ heartbeatCron: string;
667
+ monthlyBudgetUsd: string;
668
+ usedBudgetUsd: string;
669
+ tokenUsage: number;
670
+ canHireAgents: boolean;
671
+ avatarSeed: string;
672
+ runtimeCommand: string | null;
673
+ runtimeArgsJson: string;
674
+ runtimeCwd: string | null;
675
+ runtimeEnvJson: string;
676
+ runtimeModel: string | null;
677
+ runtimeThinkingEffort: string;
678
+ bootstrapPrompt: string | null;
679
+ runtimeTimeoutSec: number;
680
+ interruptGraceSec: number;
681
+ runPolicyJson: string;
682
+ stateBlob: string;
683
+ createdAt: Date;
684
+ updatedAt: Date;
685
+ }[]>;
686
+ export declare function updateAgent(db: BopoDb, input: {
687
+ companyId: string;
688
+ id: string;
689
+ managerAgentId?: string | null;
690
+ role?: string;
691
+ roleKey?: string | null;
692
+ title?: string | null;
693
+ capabilities?: string | null;
694
+ name?: string;
695
+ providerType?: "claude_code" | "codex" | "cursor" | "opencode" | "gemini_cli" | "openai_api" | "anthropic_api" | "openclaw_gateway" | "http" | "shell";
696
+ status?: string;
697
+ heartbeatCron?: string;
698
+ monthlyBudgetUsd?: string;
699
+ canHireAgents?: boolean;
700
+ runtimeCommand?: string | null;
701
+ runtimeArgsJson?: string;
702
+ runtimeCwd?: string | null;
703
+ runtimeEnvJson?: string;
704
+ runtimeModel?: string | null;
705
+ runtimeThinkingEffort?: "auto" | "low" | "medium" | "high";
706
+ bootstrapPrompt?: string | null;
707
+ runtimeTimeoutSec?: number;
708
+ interruptGraceSec?: number;
709
+ runPolicyJson?: string;
710
+ stateBlob?: Record<string, unknown>;
711
+ }): Promise<{
712
+ id: string;
713
+ companyId: string;
714
+ managerAgentId: string | null;
715
+ role: string;
716
+ roleKey: string | null;
717
+ title: string | null;
718
+ capabilities: string | null;
719
+ name: string;
720
+ providerType: string;
721
+ status: string;
722
+ heartbeatCron: string;
723
+ monthlyBudgetUsd: string;
724
+ usedBudgetUsd: string;
725
+ tokenUsage: number;
726
+ canHireAgents: boolean;
727
+ avatarSeed: string;
728
+ runtimeCommand: string | null;
729
+ runtimeArgsJson: string;
730
+ runtimeCwd: string | null;
731
+ runtimeEnvJson: string;
732
+ runtimeModel: string | null;
733
+ runtimeThinkingEffort: string;
734
+ bootstrapPrompt: string | null;
735
+ runtimeTimeoutSec: number;
736
+ interruptGraceSec: number;
737
+ runPolicyJson: string;
738
+ stateBlob: string;
739
+ createdAt: Date;
740
+ updatedAt: Date;
741
+ } | null>;
742
+ export declare function deleteAgent(db: BopoDb, companyId: string, id: string): Promise<boolean>;
743
+ export declare function appendAuditEvent(db: BopoDb, input: {
744
+ companyId: string;
745
+ actorType: "human" | "agent" | "system";
746
+ actorId?: string | null;
747
+ eventType: string;
748
+ entityType: string;
749
+ entityId: string;
750
+ correlationId?: string | null;
751
+ payload: Record<string, unknown>;
752
+ }): Promise<string>;
753
+ export declare function listAuditEvents(db: BopoDb, companyId: string, limit?: number): Promise<{
754
+ id: string;
755
+ companyId: string;
756
+ actorType: string;
757
+ actorId: string | null;
758
+ eventType: string;
759
+ entityType: string;
760
+ entityId: string;
761
+ correlationId: string | null;
762
+ payloadJson: string;
763
+ createdAt: Date;
764
+ }[]>;
765
+ export declare function createApprovalRequest(db: BopoDb, input: {
766
+ companyId: string;
767
+ requestedByAgentId?: string | null;
768
+ action: string;
769
+ payload: Record<string, unknown>;
770
+ }): Promise<string>;
771
+ export declare function getApprovalRequest(db: BopoDb, companyId: string, approvalId: string): Promise<{
772
+ id: string;
773
+ companyId: string;
774
+ requestedByAgentId: string | null;
775
+ action: string;
776
+ payloadJson: string;
777
+ status: string;
778
+ createdAt: Date;
779
+ resolvedAt: Date | null;
780
+ } | null>;
781
+ export declare function listApprovalRequests(db: BopoDb, companyId: string): Promise<{
782
+ id: string;
783
+ companyId: string;
784
+ requestedByAgentId: string | null;
785
+ action: string;
786
+ payloadJson: string;
787
+ status: string;
788
+ createdAt: Date;
789
+ resolvedAt: Date | null;
790
+ }[]>;
791
+ export declare function countPendingApprovalRequests(db: BopoDb, companyId: string): Promise<number>;
792
+ export declare function listApprovalInboxStates(db: BopoDb, companyId: string, actorId: string): Promise<{
793
+ companyId: string;
794
+ actorId: string;
795
+ approvalId: string;
796
+ seenAt: Date | null;
797
+ dismissedAt: Date | null;
798
+ createdAt: Date;
799
+ updatedAt: Date;
800
+ }[]>;
801
+ export declare function markApprovalInboxSeen(db: BopoDb, input: {
802
+ companyId: string;
803
+ actorId: string;
804
+ approvalId: string;
805
+ seenAt?: Date;
806
+ }): Promise<void>;
807
+ export declare function markApprovalInboxDismissed(db: BopoDb, input: {
808
+ companyId: string;
809
+ actorId: string;
810
+ approvalId: string;
811
+ dismissedAt?: Date;
812
+ }): Promise<void>;
813
+ export declare function clearApprovalInboxDismissed(db: BopoDb, input: {
814
+ companyId: string;
815
+ actorId: string;
816
+ approvalId: string;
817
+ }): Promise<void>;
818
+ export declare function listAttentionInboxStates(db: BopoDb, companyId: string, actorId: string): Promise<{
819
+ companyId: string;
820
+ actorId: string;
821
+ itemKey: string;
822
+ seenAt: Date | null;
823
+ acknowledgedAt: Date | null;
824
+ dismissedAt: Date | null;
825
+ resolvedAt: Date | null;
826
+ createdAt: Date;
827
+ updatedAt: Date;
828
+ }[]>;
829
+ export declare function markAttentionInboxSeen(db: BopoDb, input: {
830
+ companyId: string;
831
+ actorId: string;
832
+ itemKey: string;
833
+ seenAt?: Date;
834
+ }): Promise<void>;
835
+ export declare function markAttentionInboxAcknowledged(db: BopoDb, input: {
836
+ companyId: string;
837
+ actorId: string;
838
+ itemKey: string;
839
+ acknowledgedAt?: Date;
840
+ }): Promise<void>;
841
+ export declare function markAttentionInboxDismissed(db: BopoDb, input: {
842
+ companyId: string;
843
+ actorId: string;
844
+ itemKey: string;
845
+ dismissedAt?: Date;
846
+ }): Promise<void>;
847
+ export declare function clearAttentionInboxDismissed(db: BopoDb, input: {
848
+ companyId: string;
849
+ actorId: string;
850
+ itemKey: string;
851
+ }): Promise<void>;
852
+ export declare function markAttentionInboxResolved(db: BopoDb, input: {
853
+ companyId: string;
854
+ actorId: string;
855
+ itemKey: string;
856
+ resolvedAt?: Date;
857
+ }): Promise<void>;
858
+ export declare function appendCost(db: BopoDb, input: {
859
+ companyId: string;
860
+ runId?: string | null;
861
+ providerType: string;
862
+ runtimeModelId?: string | null;
863
+ pricingProviderType?: string | null;
864
+ pricingModelId?: string | null;
865
+ pricingSource?: "exact" | "missing" | null;
866
+ usdCostStatus?: "exact" | "estimated" | "unknown" | null;
867
+ tokenInput: number;
868
+ tokenOutput: number;
869
+ usdCost: string;
870
+ projectId?: string | null;
871
+ issueId?: string | null;
872
+ agentId?: string | null;
873
+ }): Promise<string>;
874
+ export declare function listCostEntries(db: BopoDb, companyId: string, limit?: number): Promise<{
875
+ id: string;
876
+ companyId: string;
877
+ runId: string | null;
878
+ projectId: string | null;
879
+ issueId: string | null;
880
+ agentId: string | null;
881
+ providerType: string;
882
+ runtimeModelId: string | null;
883
+ pricingProviderType: string | null;
884
+ pricingModelId: string | null;
885
+ pricingSource: string | null;
886
+ tokenInput: number;
887
+ tokenOutput: number;
888
+ usdCost: string;
889
+ usdCostStatus: string | null;
890
+ createdAt: Date;
891
+ }[]>;
892
+ export declare function listHeartbeatRuns(db: BopoDb, companyId: string, limit?: number): Promise<{
893
+ id: string;
894
+ companyId: string;
895
+ agentId: string;
896
+ status: string;
897
+ startedAt: Date;
898
+ finishedAt: Date | null;
899
+ message: string | null;
900
+ }[]>;
901
+ export type HeartbeatQueueJobType = "manual" | "scheduler" | "resume" | "redo" | "comment_dispatch";
902
+ export type HeartbeatQueueJobStatus = "pending" | "running" | "completed" | "failed" | "dead_letter" | "canceled";
903
+ export declare function enqueueHeartbeatJob(db: BopoDb, input: {
904
+ companyId: string;
905
+ agentId: string;
906
+ jobType: HeartbeatQueueJobType;
907
+ payload?: Record<string, unknown>;
908
+ priority?: number;
909
+ availableAt?: Date;
910
+ maxAttempts?: number;
911
+ idempotencyKey?: string | null;
912
+ }): Promise<{
913
+ payload: Record<string, unknown>;
914
+ id: string;
915
+ companyId: string;
916
+ agentId: string;
917
+ jobType: string;
918
+ payloadJson: string;
919
+ status: string;
920
+ priority: number;
921
+ idempotencyKey: string | null;
922
+ availableAt: Date;
923
+ attemptCount: number;
924
+ maxAttempts: number;
925
+ lastError: string | null;
926
+ startedAt: Date | null;
927
+ finishedAt: Date | null;
928
+ heartbeatRunId: string | null;
929
+ createdAt: Date;
930
+ updatedAt: Date;
931
+ }>;
932
+ export declare function claimNextHeartbeatJob(db: BopoDb, companyId: string): Promise<{
933
+ payload: Record<string, unknown>;
934
+ id: string;
935
+ companyId: string;
936
+ agentId: string;
937
+ jobType: string;
938
+ payloadJson: string;
939
+ status: string;
940
+ priority: number;
941
+ idempotencyKey: string | null;
942
+ availableAt: Date;
943
+ attemptCount: number;
944
+ maxAttempts: number;
945
+ lastError: string | null;
946
+ startedAt: Date | null;
947
+ finishedAt: Date | null;
948
+ heartbeatRunId: string | null;
949
+ createdAt: Date;
950
+ updatedAt: Date;
951
+ } | null>;
952
+ export declare function getHeartbeatQueueJob(db: BopoDb, companyId: string, id: string): Promise<{
953
+ payload: Record<string, unknown>;
954
+ id: string;
955
+ companyId: string;
956
+ agentId: string;
957
+ jobType: string;
958
+ payloadJson: string;
959
+ status: string;
960
+ priority: number;
961
+ idempotencyKey: string | null;
962
+ availableAt: Date;
963
+ attemptCount: number;
964
+ maxAttempts: number;
965
+ lastError: string | null;
966
+ startedAt: Date | null;
967
+ finishedAt: Date | null;
968
+ heartbeatRunId: string | null;
969
+ createdAt: Date;
970
+ updatedAt: Date;
971
+ } | null>;
972
+ export declare function markHeartbeatJobCompleted(db: BopoDb, input: {
973
+ companyId: string;
974
+ id: string;
975
+ heartbeatRunId?: string | null;
976
+ }): Promise<{
977
+ payload: Record<string, unknown>;
978
+ id: string;
979
+ companyId: string;
980
+ agentId: string;
981
+ jobType: string;
982
+ payloadJson: string;
983
+ status: string;
984
+ priority: number;
985
+ idempotencyKey: string | null;
986
+ availableAt: Date;
987
+ attemptCount: number;
988
+ maxAttempts: number;
989
+ lastError: string | null;
990
+ startedAt: Date | null;
991
+ finishedAt: Date | null;
992
+ heartbeatRunId: string | null;
993
+ createdAt: Date;
994
+ updatedAt: Date;
995
+ } | null>;
996
+ export declare function markHeartbeatJobRetry(db: BopoDb, input: {
997
+ companyId: string;
998
+ id: string;
999
+ retryAt: Date;
1000
+ error?: string | null;
1001
+ heartbeatRunId?: string | null;
1002
+ }): Promise<{
1003
+ payload: Record<string, unknown>;
1004
+ id: string;
1005
+ companyId: string;
1006
+ agentId: string;
1007
+ jobType: string;
1008
+ payloadJson: string;
1009
+ status: string;
1010
+ priority: number;
1011
+ idempotencyKey: string | null;
1012
+ availableAt: Date;
1013
+ attemptCount: number;
1014
+ maxAttempts: number;
1015
+ lastError: string | null;
1016
+ startedAt: Date | null;
1017
+ finishedAt: Date | null;
1018
+ heartbeatRunId: string | null;
1019
+ createdAt: Date;
1020
+ updatedAt: Date;
1021
+ } | null>;
1022
+ export declare function markHeartbeatJobFailed(db: BopoDb, input: {
1023
+ companyId: string;
1024
+ id: string;
1025
+ error?: string | null;
1026
+ heartbeatRunId?: string | null;
1027
+ }): Promise<{
1028
+ payload: Record<string, unknown>;
1029
+ id: string;
1030
+ companyId: string;
1031
+ agentId: string;
1032
+ jobType: string;
1033
+ payloadJson: string;
1034
+ status: string;
1035
+ priority: number;
1036
+ idempotencyKey: string | null;
1037
+ availableAt: Date;
1038
+ attemptCount: number;
1039
+ maxAttempts: number;
1040
+ lastError: string | null;
1041
+ startedAt: Date | null;
1042
+ finishedAt: Date | null;
1043
+ heartbeatRunId: string | null;
1044
+ createdAt: Date;
1045
+ updatedAt: Date;
1046
+ } | null>;
1047
+ export declare function markHeartbeatJobDeadLetter(db: BopoDb, input: {
1048
+ companyId: string;
1049
+ id: string;
1050
+ error?: string | null;
1051
+ heartbeatRunId?: string | null;
1052
+ }): Promise<{
1053
+ payload: Record<string, unknown>;
1054
+ id: string;
1055
+ companyId: string;
1056
+ agentId: string;
1057
+ jobType: string;
1058
+ payloadJson: string;
1059
+ status: string;
1060
+ priority: number;
1061
+ idempotencyKey: string | null;
1062
+ availableAt: Date;
1063
+ attemptCount: number;
1064
+ maxAttempts: number;
1065
+ lastError: string | null;
1066
+ startedAt: Date | null;
1067
+ finishedAt: Date | null;
1068
+ heartbeatRunId: string | null;
1069
+ createdAt: Date;
1070
+ updatedAt: Date;
1071
+ } | null>;
1072
+ export declare function cancelHeartbeatJob(db: BopoDb, input: {
1073
+ companyId: string;
1074
+ id: string;
1075
+ }): Promise<{
1076
+ payload: Record<string, unknown>;
1077
+ id: string;
1078
+ companyId: string;
1079
+ agentId: string;
1080
+ jobType: string;
1081
+ payloadJson: string;
1082
+ status: string;
1083
+ priority: number;
1084
+ idempotencyKey: string | null;
1085
+ availableAt: Date;
1086
+ attemptCount: number;
1087
+ maxAttempts: number;
1088
+ lastError: string | null;
1089
+ startedAt: Date | null;
1090
+ finishedAt: Date | null;
1091
+ heartbeatRunId: string | null;
1092
+ createdAt: Date;
1093
+ updatedAt: Date;
1094
+ } | null>;
1095
+ export declare function listHeartbeatQueueJobs(db: BopoDb, input: {
1096
+ companyId: string;
1097
+ status?: HeartbeatQueueJobStatus;
1098
+ agentId?: string;
1099
+ jobType?: HeartbeatQueueJobType;
1100
+ limit?: number;
1101
+ }): Promise<{
1102
+ payload: Record<string, unknown>;
1103
+ id: string;
1104
+ companyId: string;
1105
+ agentId: string;
1106
+ jobType: string;
1107
+ payloadJson: string;
1108
+ status: string;
1109
+ priority: number;
1110
+ idempotencyKey: string | null;
1111
+ availableAt: Date;
1112
+ attemptCount: number;
1113
+ maxAttempts: number;
1114
+ lastError: string | null;
1115
+ startedAt: Date | null;
1116
+ finishedAt: Date | null;
1117
+ heartbeatRunId: string | null;
1118
+ createdAt: Date;
1119
+ updatedAt: Date;
1120
+ }[]>;
1121
+ export declare function getHeartbeatRun(db: BopoDb, companyId: string, runId: string): Promise<{
1122
+ id: string;
1123
+ companyId: string;
1124
+ agentId: string;
1125
+ status: string;
1126
+ startedAt: Date;
1127
+ finishedAt: Date | null;
1128
+ message: string | null;
1129
+ } | null>;
1130
+ export declare function appendHeartbeatRunMessages(db: BopoDb, input: {
1131
+ companyId: string;
1132
+ runId: string;
1133
+ messages: Array<{
1134
+ id?: string;
1135
+ sequence: number;
1136
+ kind: string;
1137
+ label?: string | null;
1138
+ text?: string | null;
1139
+ payloadJson?: string | null;
1140
+ signalLevel?: "high" | "medium" | "low" | "noise" | null;
1141
+ groupKey?: string | null;
1142
+ source?: "stdout" | "stderr" | "trace_fallback" | null;
1143
+ createdAt?: Date;
1144
+ }>;
1145
+ }): Promise<string[]>;
1146
+ export declare function listHeartbeatRunMessages(db: BopoDb, input: {
1147
+ companyId: string;
1148
+ runId: string;
1149
+ afterSequence?: number;
1150
+ limit?: number;
1151
+ }): Promise<{
1152
+ items: {
1153
+ id: string;
1154
+ companyId: string;
1155
+ runId: string;
1156
+ sequence: number;
1157
+ kind: string;
1158
+ label: string | null;
1159
+ text: string | null;
1160
+ payloadJson: string | null;
1161
+ signalLevel: string | null;
1162
+ groupKey: string | null;
1163
+ source: string | null;
1164
+ createdAt: Date;
1165
+ }[];
1166
+ nextCursor: string | null;
1167
+ }>;
1168
+ export declare function listHeartbeatRunMessagesForRuns(db: BopoDb, input: {
1169
+ companyId: string;
1170
+ runIds: string[];
1171
+ perRunLimit?: number;
1172
+ }): Promise<Map<string, {
1173
+ items: Array<(typeof heartbeatRunMessages.$inferSelect)>;
1174
+ nextCursor: string | null;
1175
+ }>>;
1176
+ export declare function appendActivity(db: BopoDb, input: {
1177
+ companyId: string;
1178
+ issueId?: string | null;
1179
+ actorType: "human" | "agent" | "system";
1180
+ actorId?: string | null;
1181
+ eventType: string;
1182
+ payload: Record<string, unknown>;
1183
+ }): Promise<string>;
1184
+ export declare function upsertPlugin(db: BopoDb, input: {
1185
+ id: string;
1186
+ name: string;
1187
+ version: string;
1188
+ kind: string;
1189
+ runtimeType: string;
1190
+ runtimeEntrypoint: string;
1191
+ hooksJson?: string;
1192
+ capabilitiesJson?: string;
1193
+ manifestJson?: string;
1194
+ }): Promise<string>;
1195
+ export declare function listPlugins(db: BopoDb): Promise<{
1196
+ id: string;
1197
+ name: string;
1198
+ version: string;
1199
+ kind: string;
1200
+ runtimeType: string;
1201
+ runtimeEntrypoint: string;
1202
+ hooksJson: string;
1203
+ capabilitiesJson: string;
1204
+ manifestJson: string;
1205
+ createdAt: Date;
1206
+ updatedAt: Date;
1207
+ }[]>;
1208
+ export declare function updatePluginConfig(db: BopoDb, input: {
1209
+ companyId: string;
1210
+ pluginId: string;
1211
+ enabled?: boolean;
1212
+ priority?: number;
1213
+ configJson?: string;
1214
+ grantedCapabilitiesJson?: string;
1215
+ }): Promise<void>;
1216
+ export declare function deletePluginConfig(db: BopoDb, input: {
1217
+ companyId: string;
1218
+ pluginId: string;
1219
+ }): Promise<void>;
1220
+ export declare function deletePluginById(db: BopoDb, pluginId: string): Promise<void>;
1221
+ export declare function listCompanyPluginConfigs(db: BopoDb, companyId: string): Promise<{
1222
+ companyId: string;
1223
+ pluginId: string;
1224
+ enabled: boolean;
1225
+ priority: number;
1226
+ configJson: string;
1227
+ grantedCapabilitiesJson: string;
1228
+ pluginName: string;
1229
+ pluginVersion: string;
1230
+ pluginKind: string;
1231
+ runtimeType: string;
1232
+ runtimeEntrypoint: string;
1233
+ hooksJson: string;
1234
+ capabilitiesJson: string;
1235
+ manifestJson: string;
1236
+ }[]>;
1237
+ export declare function appendPluginRun(db: BopoDb, input: {
1238
+ companyId: string;
1239
+ runId?: string | null;
1240
+ pluginId: string;
1241
+ hook: string;
1242
+ status: string;
1243
+ durationMs: number;
1244
+ error?: string | null;
1245
+ diagnosticsJson?: string;
1246
+ }): Promise<string>;
1247
+ export declare function listPluginRuns(db: BopoDb, input: {
1248
+ companyId: string;
1249
+ pluginId?: string;
1250
+ runId?: string;
1251
+ limit?: number;
1252
+ }): Promise<{
1253
+ id: string;
1254
+ companyId: string;
1255
+ runId: string | null;
1256
+ pluginId: string;
1257
+ hook: string;
1258
+ status: string;
1259
+ durationMs: number;
1260
+ error: string | null;
1261
+ diagnosticsJson: string;
1262
+ createdAt: Date;
1263
+ }[]>;
1264
+ export declare function listTemplates(db: BopoDb, companyId: string): Promise<{
1265
+ id: string;
1266
+ companyId: string;
1267
+ slug: string;
1268
+ name: string;
1269
+ description: string | null;
1270
+ currentVersion: string;
1271
+ status: string;
1272
+ visibility: string;
1273
+ variablesJson: string;
1274
+ createdAt: Date;
1275
+ updatedAt: Date;
1276
+ }[]>;
1277
+ export declare function getTemplate(db: BopoDb, companyId: string, templateId: string): Promise<{
1278
+ id: string;
1279
+ companyId: string;
1280
+ slug: string;
1281
+ name: string;
1282
+ description: string | null;
1283
+ currentVersion: string;
1284
+ status: string;
1285
+ visibility: string;
1286
+ variablesJson: string;
1287
+ createdAt: Date;
1288
+ updatedAt: Date;
1289
+ } | null>;
1290
+ export declare function getTemplateBySlug(db: BopoDb, companyId: string, slug: string): Promise<{
1291
+ id: string;
1292
+ companyId: string;
1293
+ slug: string;
1294
+ name: string;
1295
+ description: string | null;
1296
+ currentVersion: string;
1297
+ status: string;
1298
+ visibility: string;
1299
+ variablesJson: string;
1300
+ createdAt: Date;
1301
+ updatedAt: Date;
1302
+ } | null>;
1303
+ export declare function createTemplate(db: BopoDb, input: {
1304
+ companyId: string;
1305
+ slug: string;
1306
+ name: string;
1307
+ description?: string | null;
1308
+ currentVersion?: string;
1309
+ status?: "draft" | "published" | "archived";
1310
+ visibility?: "company" | "private";
1311
+ variablesJson?: string;
1312
+ }): Promise<{
1313
+ id: string;
1314
+ name: string;
1315
+ createdAt: Date;
1316
+ companyId: string;
1317
+ description: string | null;
1318
+ status: string;
1319
+ updatedAt: Date;
1320
+ slug: string;
1321
+ currentVersion: string;
1322
+ visibility: string;
1323
+ variablesJson: string;
1324
+ } | null>;
1325
+ export declare function updateTemplate(db: BopoDb, input: {
1326
+ companyId: string;
1327
+ id: string;
1328
+ slug?: string;
1329
+ name?: string;
1330
+ description?: string | null;
1331
+ currentVersion?: string;
1332
+ status?: "draft" | "published" | "archived";
1333
+ visibility?: "company" | "private";
1334
+ variablesJson?: string;
1335
+ }): Promise<{
1336
+ id: string;
1337
+ companyId: string;
1338
+ slug: string;
1339
+ name: string;
1340
+ description: string | null;
1341
+ currentVersion: string;
1342
+ status: string;
1343
+ visibility: string;
1344
+ variablesJson: string;
1345
+ createdAt: Date;
1346
+ updatedAt: Date;
1347
+ } | null>;
1348
+ export declare function deleteTemplate(db: BopoDb, companyId: string, templateId: string): Promise<boolean>;
1349
+ export declare function listTemplateVersions(db: BopoDb, companyId: string, templateId: string): Promise<{
1350
+ id: string;
1351
+ companyId: string;
1352
+ templateId: string;
1353
+ version: string;
1354
+ manifestJson: string;
1355
+ createdAt: Date;
1356
+ }[]>;
1357
+ export declare function getTemplateVersionByVersion(db: BopoDb, input: {
1358
+ companyId: string;
1359
+ templateId: string;
1360
+ version: string;
1361
+ }): Promise<{
1362
+ id: string;
1363
+ companyId: string;
1364
+ templateId: string;
1365
+ version: string;
1366
+ manifestJson: string;
1367
+ createdAt: Date;
1368
+ } | null>;
1369
+ export declare function getCurrentTemplateVersion(db: BopoDb, companyId: string, templateId: string): Promise<{
1370
+ id: string;
1371
+ companyId: string;
1372
+ templateId: string;
1373
+ version: string;
1374
+ manifestJson: string;
1375
+ createdAt: Date;
1376
+ } | null>;
1377
+ export declare function createTemplateVersion(db: BopoDb, input: {
1378
+ companyId: string;
1379
+ templateId: string;
1380
+ version: string;
1381
+ manifestJson: string;
1382
+ }): Promise<{
1383
+ id: string;
1384
+ createdAt: Date;
1385
+ companyId: string;
1386
+ version: string;
1387
+ manifestJson: string;
1388
+ templateId: string;
1389
+ } | null>;
1390
+ export declare function listTemplateInstalls(db: BopoDb, input: {
1391
+ companyId: string;
1392
+ templateId?: string;
1393
+ limit?: number;
1394
+ }): Promise<{
1395
+ id: string;
1396
+ companyId: string;
1397
+ templateId: string | null;
1398
+ templateVersionId: string | null;
1399
+ status: string;
1400
+ summaryJson: string;
1401
+ variablesJson: string;
1402
+ createdAt: Date;
1403
+ }[]>;
1404
+ export declare function createTemplateInstall(db: BopoDb, input: {
1405
+ companyId: string;
1406
+ templateId?: string | null;
1407
+ templateVersionId?: string | null;
1408
+ status?: "applied" | "queued" | "failed";
1409
+ summaryJson?: string;
1410
+ variablesJson?: string;
1411
+ }): Promise<{
1412
+ id: string;
1413
+ createdAt: Date;
1414
+ companyId: string;
1415
+ status: string;
1416
+ variablesJson: string;
1417
+ templateId: string | null;
1418
+ templateVersionId: string | null;
1419
+ summaryJson: string;
1420
+ } | null>;