@penclipai/db 2026.704.0 → 2026.714.0
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.
- package/dist/backup-lib.test.js +1 -1
- package/dist/backup-lib.test.js.map +1 -1
- package/dist/check-migration-safety.d.ts +27 -0
- package/dist/check-migration-safety.d.ts.map +1 -0
- package/dist/check-migration-safety.js +811 -0
- package/dist/check-migration-safety.js.map +1 -0
- package/dist/check-migration-safety.test.d.ts +2 -0
- package/dist/check-migration-safety.test.d.ts.map +1 -0
- package/dist/check-migration-safety.test.js +391 -0
- package/dist/check-migration-safety.test.js.map +1 -0
- package/dist/client.test.js +743 -0
- package/dist/client.test.js.map +1 -1
- package/dist/issue-comment-derived-attribution-migration.test.d.ts +2 -0
- package/dist/issue-comment-derived-attribution-migration.test.d.ts.map +1 -0
- package/dist/issue-comment-derived-attribution-migration.test.js +287 -0
- package/dist/issue-comment-derived-attribution-migration.test.js.map +1 -0
- package/dist/migration-safety-baseline.d.ts +135 -0
- package/dist/migration-safety-baseline.d.ts.map +1 -0
- package/dist/migration-safety-baseline.js +150 -0
- package/dist/migration-safety-baseline.js.map +1 -0
- package/dist/migrations/0128_user_specific_secrets.sql +178 -0
- package/dist/migrations/0129_agent_api_key_responsible_user.sql +41 -0
- package/dist/migrations/0131_repair_run_responsible_user_context_refs.sql +67 -0
- package/dist/migrations/0132_issue_comment_derived_attribution_fast.sql +82 -0
- package/dist/migrations/0133_resource_membership_stars.sql +7 -0
- package/dist/migrations/0134_run_responsible_user_invariant.sql +211 -0
- package/dist/migrations/0135_repair_run_responsible_user_updated_at_sweep.sql +84 -0
- package/dist/migrations/0136_acpx_default_engine_migration.sql +97 -0
- package/dist/migrations/0137_skill_studio_server_foundation.sql +76 -0
- package/dist/migrations/0138_skill_studio_run_retention.sql +5 -0
- package/dist/migrations/0139_skill_studio_run_templates.sql +44 -0
- package/dist/migrations/0140_built_in_managed_resources.sql +43 -0
- package/dist/migrations/0141_heartbeat_runs_company_created_at_index.sql +2 -0
- package/dist/migrations/0142_company_search_sort_indexes.sql +3 -0
- package/dist/migrations/0143_cases_foundation.sql +248 -0
- package/dist/migrations/0144_case_document_annotations.sql +31 -0
- package/dist/migrations/0145_inbox_dismissal_snooze_kind.sql +15 -0
- package/dist/migrations/0146_routine_activity_gate.sql +3 -0
- package/dist/migrations/0147_cost_event_status.sql +1 -0
- package/dist/migrations/meta/_journal.json +132 -6
- package/dist/schema/agent_api_keys.d.ts +23 -0
- package/dist/schema/agent_api_keys.d.ts.map +1 -1
- package/dist/schema/agent_api_keys.js +1 -0
- package/dist/schema/agent_api_keys.js.map +1 -1
- package/dist/schema/agent_memberships.d.ts +17 -0
- package/dist/schema/agent_memberships.d.ts.map +1 -1
- package/dist/schema/agent_memberships.js +2 -0
- package/dist/schema/agent_memberships.js.map +1 -1
- package/dist/schema/built_in_managed_resources.d.ts +197 -0
- package/dist/schema/built_in_managed_resources.d.ts.map +1 -0
- package/dist/schema/built_in_managed_resources.js +22 -0
- package/dist/schema/built_in_managed_resources.js.map +1 -0
- package/dist/schema/cases.d.ts +982 -0
- package/dist/schema/cases.d.ts.map +1 -0
- package/dist/schema/cases.js +122 -0
- package/dist/schema/cases.js.map +1 -0
- package/dist/schema/companies.d.ts +17 -0
- package/dist/schema/companies.d.ts.map +1 -1
- package/dist/schema/companies.js +1 -0
- package/dist/schema/companies.js.map +1 -1
- package/dist/schema/company_secrets.d.ts +51 -0
- package/dist/schema/company_secrets.d.ts.map +1 -1
- package/dist/schema/company_secrets.js +27 -3
- package/dist/schema/company_secrets.js.map +1 -1
- package/dist/schema/company_skills.d.ts +788 -0
- package/dist/schema/company_skills.d.ts.map +1 -1
- package/dist/schema/company_skills.js +63 -0
- package/dist/schema/company_skills.js.map +1 -1
- package/dist/schema/cost_events.d.ts +17 -0
- package/dist/schema/cost_events.d.ts.map +1 -1
- package/dist/schema/cost_events.js +1 -0
- package/dist/schema/cost_events.js.map +1 -1
- package/dist/schema/document_annotation_comments.d.ts +17 -0
- package/dist/schema/document_annotation_comments.d.ts.map +1 -1
- package/dist/schema/document_annotation_comments.js +4 -1
- package/dist/schema/document_annotation_comments.js.map +1 -1
- package/dist/schema/document_annotation_threads.d.ts +17 -0
- package/dist/schema/document_annotation_threads.d.ts.map +1 -1
- package/dist/schema/document_annotation_threads.js +4 -1
- package/dist/schema/document_annotation_threads.js.map +1 -1
- package/dist/schema/heartbeat_runs.d.ts +17 -0
- package/dist/schema/heartbeat_runs.d.ts.map +1 -1
- package/dist/schema/heartbeat_runs.js +3 -0
- package/dist/schema/heartbeat_runs.js.map +1 -1
- package/dist/schema/inbox_dismissals.d.ts +36 -0
- package/dist/schema/inbox_dismissals.d.ts.map +1 -1
- package/dist/schema/inbox_dismissals.js +2 -0
- package/dist/schema/inbox_dismissals.js.map +1 -1
- package/dist/schema/index.d.ts +5 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +5 -1
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/issues.d.ts +34 -0
- package/dist/schema/issues.d.ts.map +1 -1
- package/dist/schema/issues.js +7 -0
- package/dist/schema/issues.js.map +1 -1
- package/dist/schema/project_memberships.d.ts +17 -0
- package/dist/schema/project_memberships.d.ts.map +1 -1
- package/dist/schema/project_memberships.js +2 -0
- package/dist/schema/project_memberships.js.map +1 -1
- package/dist/schema/routines.d.ts +85 -0
- package/dist/schema/routines.d.ts.map +1 -1
- package/dist/schema/routines.js +8 -0
- package/dist/schema/routines.js.map +1 -1
- package/dist/schema/secret_access_events.d.ts +103 -1
- package/dist/schema/secret_access_events.d.ts.map +1 -1
- package/dist/schema/secret_access_events.js +10 -1
- package/dist/schema/secret_access_events.js.map +1 -1
- package/dist/schema/user_secret_declarations.d.ts +229 -0
- package/dist/schema/user_secret_declarations.d.ts.map +1 -0
- package/dist/schema/user_secret_declarations.js +31 -0
- package/dist/schema/user_secret_declarations.js.map +1 -0
- package/dist/schema/user_secret_definitions.d.ts +316 -0
- package/dist/schema/user_secret_definitions.d.ts.map +1 -0
- package/dist/schema/user_secret_definitions.js +33 -0
- package/dist/schema/user_secret_definitions.js.map +1 -0
- package/dist/table-size-estimates.d.ts +372 -0
- package/dist/table-size-estimates.d.ts.map +1 -0
- package/dist/table-size-estimates.js +155 -0
- package/dist/table-size-estimates.js.map +1 -0
- package/package.json +3 -3
- package/dist/migrations/0126_issue_comment_derived_attribution.sql +0 -69
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
export type TableSizeBucket = "large" | "medium" | "small";
|
|
2
|
+
export type LocalTableRowCount = {
|
|
3
|
+
readonly table: string;
|
|
4
|
+
readonly localRows: number;
|
|
5
|
+
};
|
|
6
|
+
export type TableSizeEstimate = LocalTableRowCount & {
|
|
7
|
+
readonly estimateFactor: number;
|
|
8
|
+
readonly estimatedRows: number;
|
|
9
|
+
readonly bucket: TableSizeBucket;
|
|
10
|
+
};
|
|
11
|
+
export declare const TABLE_SIZE_ESTIMATE_SOURCE: {
|
|
12
|
+
readonly collectedAt: "2026-07-06";
|
|
13
|
+
readonly database: "default local dev embedded Postgres";
|
|
14
|
+
readonly method: "SELECT count(*) in a read-only transaction";
|
|
15
|
+
};
|
|
16
|
+
export declare const TABLE_SIZE_ESTIMATE_FACTOR = 250;
|
|
17
|
+
export declare const TABLE_SIZE_BUCKET_THRESHOLDS: {
|
|
18
|
+
readonly largeRows: 1000000;
|
|
19
|
+
readonly mediumRows: 100000;
|
|
20
|
+
};
|
|
21
|
+
export declare const LOCAL_TABLE_ROW_COUNTS: readonly [{
|
|
22
|
+
readonly table: "agent_wakeup_requests";
|
|
23
|
+
readonly localRows: 52791;
|
|
24
|
+
}, {
|
|
25
|
+
readonly table: "activity_log";
|
|
26
|
+
readonly localRows: 22930;
|
|
27
|
+
}, {
|
|
28
|
+
readonly table: "issue_reference_mentions";
|
|
29
|
+
readonly localRows: 13218;
|
|
30
|
+
}, {
|
|
31
|
+
readonly table: "heartbeat_run_events";
|
|
32
|
+
readonly localRows: 10833;
|
|
33
|
+
}, {
|
|
34
|
+
readonly table: "issue_comments";
|
|
35
|
+
readonly localRows: 5034;
|
|
36
|
+
}, {
|
|
37
|
+
readonly table: "document_revisions";
|
|
38
|
+
readonly localRows: 3906;
|
|
39
|
+
}, {
|
|
40
|
+
readonly table: "heartbeat_runs";
|
|
41
|
+
readonly localRows: 3620;
|
|
42
|
+
}, {
|
|
43
|
+
readonly table: "workspace_operations";
|
|
44
|
+
readonly localRows: 3600;
|
|
45
|
+
}, {
|
|
46
|
+
readonly table: "environment_leases";
|
|
47
|
+
readonly localRows: 3492;
|
|
48
|
+
}, {
|
|
49
|
+
readonly table: "cost_events";
|
|
50
|
+
readonly localRows: 3330;
|
|
51
|
+
}, {
|
|
52
|
+
readonly table: "agent_task_sessions";
|
|
53
|
+
readonly localRows: 1743;
|
|
54
|
+
}, {
|
|
55
|
+
readonly table: "documents";
|
|
56
|
+
readonly localRows: 1692;
|
|
57
|
+
}, {
|
|
58
|
+
readonly table: "issue_documents";
|
|
59
|
+
readonly localRows: 1678;
|
|
60
|
+
}, {
|
|
61
|
+
readonly table: "issues";
|
|
62
|
+
readonly localRows: 1609;
|
|
63
|
+
}, {
|
|
64
|
+
readonly table: "secret_access_events";
|
|
65
|
+
readonly localRows: 933;
|
|
66
|
+
}, {
|
|
67
|
+
readonly table: "issue_read_states";
|
|
68
|
+
readonly localRows: 608;
|
|
69
|
+
}, {
|
|
70
|
+
readonly table: "issue_thread_interactions";
|
|
71
|
+
readonly localRows: 455;
|
|
72
|
+
}, {
|
|
73
|
+
readonly table: "issue_relations";
|
|
74
|
+
readonly localRows: 445;
|
|
75
|
+
}, {
|
|
76
|
+
readonly table: "execution_workspaces";
|
|
77
|
+
readonly localRows: 414;
|
|
78
|
+
}, {
|
|
79
|
+
readonly table: "agent_config_revisions";
|
|
80
|
+
readonly localRows: 145;
|
|
81
|
+
}, {
|
|
82
|
+
readonly table: "document_annotation_anchor_snapshots";
|
|
83
|
+
readonly localRows: 132;
|
|
84
|
+
}, {
|
|
85
|
+
readonly table: "document_annotation_comments";
|
|
86
|
+
readonly localRows: 122;
|
|
87
|
+
}, {
|
|
88
|
+
readonly table: "document_annotation_threads";
|
|
89
|
+
readonly localRows: 80;
|
|
90
|
+
}, {
|
|
91
|
+
readonly table: "routine_revisions";
|
|
92
|
+
readonly localRows: 64;
|
|
93
|
+
}, {
|
|
94
|
+
readonly table: "issue_tree_hold_members";
|
|
95
|
+
readonly localRows: 62;
|
|
96
|
+
}, {
|
|
97
|
+
readonly table: "routine_runs";
|
|
98
|
+
readonly localRows: 52;
|
|
99
|
+
}, {
|
|
100
|
+
readonly table: "issue_recovery_actions";
|
|
101
|
+
readonly localRows: 50;
|
|
102
|
+
}, {
|
|
103
|
+
readonly table: "assets";
|
|
104
|
+
readonly localRows: 46;
|
|
105
|
+
}, {
|
|
106
|
+
readonly table: "issue_attachments";
|
|
107
|
+
readonly localRows: 44;
|
|
108
|
+
}, {
|
|
109
|
+
readonly table: "principal_permission_grants";
|
|
110
|
+
readonly localRows: 25;
|
|
111
|
+
}, {
|
|
112
|
+
readonly table: "company_memberships";
|
|
113
|
+
readonly localRows: 19;
|
|
114
|
+
}, {
|
|
115
|
+
readonly table: "agent_runtime_state";
|
|
116
|
+
readonly localRows: 18;
|
|
117
|
+
}, {
|
|
118
|
+
readonly table: "agents";
|
|
119
|
+
readonly localRows: 18;
|
|
120
|
+
}, {
|
|
121
|
+
readonly table: "routine_triggers";
|
|
122
|
+
readonly localRows: 16;
|
|
123
|
+
}, {
|
|
124
|
+
readonly table: "company_skills";
|
|
125
|
+
readonly localRows: 15;
|
|
126
|
+
}, {
|
|
127
|
+
readonly table: "routine_documents";
|
|
128
|
+
readonly localRows: 14;
|
|
129
|
+
}, {
|
|
130
|
+
readonly table: "routines";
|
|
131
|
+
readonly localRows: 14;
|
|
132
|
+
}, {
|
|
133
|
+
readonly table: "issue_inbox_archives";
|
|
134
|
+
readonly localRows: 13;
|
|
135
|
+
}, {
|
|
136
|
+
readonly table: "issue_approvals";
|
|
137
|
+
readonly localRows: 12;
|
|
138
|
+
}, {
|
|
139
|
+
readonly table: "company_secret_bindings";
|
|
140
|
+
readonly localRows: 11;
|
|
141
|
+
}, {
|
|
142
|
+
readonly table: "issue_tree_holds";
|
|
143
|
+
readonly localRows: 10;
|
|
144
|
+
}, {
|
|
145
|
+
readonly table: "approvals";
|
|
146
|
+
readonly localRows: 9;
|
|
147
|
+
}, {
|
|
148
|
+
readonly table: "session";
|
|
149
|
+
readonly localRows: 9;
|
|
150
|
+
}, {
|
|
151
|
+
readonly table: "issue_work_products";
|
|
152
|
+
readonly localRows: 7;
|
|
153
|
+
}, {
|
|
154
|
+
readonly table: "company_skill_versions";
|
|
155
|
+
readonly localRows: 6;
|
|
156
|
+
}, {
|
|
157
|
+
readonly table: "feedback_exports";
|
|
158
|
+
readonly localRows: 6;
|
|
159
|
+
}, {
|
|
160
|
+
readonly table: "feedback_votes";
|
|
161
|
+
readonly localRows: 6;
|
|
162
|
+
}, {
|
|
163
|
+
readonly table: "issue_execution_decisions";
|
|
164
|
+
readonly localRows: 6;
|
|
165
|
+
}, {
|
|
166
|
+
readonly table: "company_secret_versions";
|
|
167
|
+
readonly localRows: 3;
|
|
168
|
+
}, {
|
|
169
|
+
readonly table: "company_secrets";
|
|
170
|
+
readonly localRows: 3;
|
|
171
|
+
}, {
|
|
172
|
+
readonly table: "projects";
|
|
173
|
+
readonly localRows: 3;
|
|
174
|
+
}, {
|
|
175
|
+
readonly table: "approval_comments";
|
|
176
|
+
readonly localRows: 2;
|
|
177
|
+
}, {
|
|
178
|
+
readonly table: "goals";
|
|
179
|
+
readonly localRows: 2;
|
|
180
|
+
}, {
|
|
181
|
+
readonly table: "project_goals";
|
|
182
|
+
readonly localRows: 2;
|
|
183
|
+
}, {
|
|
184
|
+
readonly table: "project_workspaces";
|
|
185
|
+
readonly localRows: 2;
|
|
186
|
+
}, {
|
|
187
|
+
readonly table: "account";
|
|
188
|
+
readonly localRows: 1;
|
|
189
|
+
}, {
|
|
190
|
+
readonly table: "companies";
|
|
191
|
+
readonly localRows: 1;
|
|
192
|
+
}, {
|
|
193
|
+
readonly table: "environments";
|
|
194
|
+
readonly localRows: 1;
|
|
195
|
+
}, {
|
|
196
|
+
readonly table: "instance_settings";
|
|
197
|
+
readonly localRows: 1;
|
|
198
|
+
}, {
|
|
199
|
+
readonly table: "instance_user_roles";
|
|
200
|
+
readonly localRows: 1;
|
|
201
|
+
}, {
|
|
202
|
+
readonly table: "user";
|
|
203
|
+
readonly localRows: 1;
|
|
204
|
+
}, {
|
|
205
|
+
readonly table: "agent_api_keys";
|
|
206
|
+
readonly localRows: 0;
|
|
207
|
+
}, {
|
|
208
|
+
readonly table: "agent_memberships";
|
|
209
|
+
readonly localRows: 0;
|
|
210
|
+
}, {
|
|
211
|
+
readonly table: "board_api_keys";
|
|
212
|
+
readonly localRows: 0;
|
|
213
|
+
}, {
|
|
214
|
+
readonly table: "budget_incidents";
|
|
215
|
+
readonly localRows: 0;
|
|
216
|
+
}, {
|
|
217
|
+
readonly table: "budget_policies";
|
|
218
|
+
readonly localRows: 0;
|
|
219
|
+
}, {
|
|
220
|
+
readonly table: "cli_auth_challenges";
|
|
221
|
+
readonly localRows: 0;
|
|
222
|
+
}, {
|
|
223
|
+
readonly table: "cloud_upstream_connections";
|
|
224
|
+
readonly localRows: 0;
|
|
225
|
+
}, {
|
|
226
|
+
readonly table: "cloud_upstream_runs";
|
|
227
|
+
readonly localRows: 0;
|
|
228
|
+
}, {
|
|
229
|
+
readonly table: "company_logos";
|
|
230
|
+
readonly localRows: 0;
|
|
231
|
+
}, {
|
|
232
|
+
readonly table: "company_secret_provider_configs";
|
|
233
|
+
readonly localRows: 0;
|
|
234
|
+
}, {
|
|
235
|
+
readonly table: "company_skill_comments";
|
|
236
|
+
readonly localRows: 0;
|
|
237
|
+
}, {
|
|
238
|
+
readonly table: "company_skill_stars";
|
|
239
|
+
readonly localRows: 0;
|
|
240
|
+
}, {
|
|
241
|
+
readonly table: "company_user_sidebar_preferences";
|
|
242
|
+
readonly localRows: 0;
|
|
243
|
+
}, {
|
|
244
|
+
readonly table: "environment_custom_image_setup_sessions";
|
|
245
|
+
readonly localRows: 0;
|
|
246
|
+
}, {
|
|
247
|
+
readonly table: "environment_custom_image_templates";
|
|
248
|
+
readonly localRows: 0;
|
|
249
|
+
}, {
|
|
250
|
+
readonly table: "external_object_mentions";
|
|
251
|
+
readonly localRows: 0;
|
|
252
|
+
}, {
|
|
253
|
+
readonly table: "external_objects";
|
|
254
|
+
readonly localRows: 0;
|
|
255
|
+
}, {
|
|
256
|
+
readonly table: "finance_events";
|
|
257
|
+
readonly localRows: 0;
|
|
258
|
+
}, {
|
|
259
|
+
readonly table: "heartbeat_run_watchdog_decisions";
|
|
260
|
+
readonly localRows: 0;
|
|
261
|
+
}, {
|
|
262
|
+
readonly table: "inbox_dismissals";
|
|
263
|
+
readonly localRows: 0;
|
|
264
|
+
}, {
|
|
265
|
+
readonly table: "invites";
|
|
266
|
+
readonly localRows: 0;
|
|
267
|
+
}, {
|
|
268
|
+
readonly table: "issue_labels";
|
|
269
|
+
readonly localRows: 0;
|
|
270
|
+
}, {
|
|
271
|
+
readonly table: "issue_plan_decompositions";
|
|
272
|
+
readonly localRows: 0;
|
|
273
|
+
}, {
|
|
274
|
+
readonly table: "issue_watchdogs";
|
|
275
|
+
readonly localRows: 0;
|
|
276
|
+
}, {
|
|
277
|
+
readonly table: "join_requests";
|
|
278
|
+
readonly localRows: 0;
|
|
279
|
+
}, {
|
|
280
|
+
readonly table: "labels";
|
|
281
|
+
readonly localRows: 0;
|
|
282
|
+
}, {
|
|
283
|
+
readonly table: "pipeline_automation_executions";
|
|
284
|
+
readonly localRows: 0;
|
|
285
|
+
}, {
|
|
286
|
+
readonly table: "pipeline_case_blockers";
|
|
287
|
+
readonly localRows: 0;
|
|
288
|
+
}, {
|
|
289
|
+
readonly table: "pipeline_case_documents";
|
|
290
|
+
readonly localRows: 0;
|
|
291
|
+
}, {
|
|
292
|
+
readonly table: "pipeline_case_events";
|
|
293
|
+
readonly localRows: 0;
|
|
294
|
+
}, {
|
|
295
|
+
readonly table: "pipeline_case_issue_links";
|
|
296
|
+
readonly localRows: 0;
|
|
297
|
+
}, {
|
|
298
|
+
readonly table: "pipeline_cases";
|
|
299
|
+
readonly localRows: 0;
|
|
300
|
+
}, {
|
|
301
|
+
readonly table: "pipeline_documents";
|
|
302
|
+
readonly localRows: 0;
|
|
303
|
+
}, {
|
|
304
|
+
readonly table: "pipeline_stages";
|
|
305
|
+
readonly localRows: 0;
|
|
306
|
+
}, {
|
|
307
|
+
readonly table: "pipeline_transitions";
|
|
308
|
+
readonly localRows: 0;
|
|
309
|
+
}, {
|
|
310
|
+
readonly table: "pipelines";
|
|
311
|
+
readonly localRows: 0;
|
|
312
|
+
}, {
|
|
313
|
+
readonly table: "plugin_company_settings";
|
|
314
|
+
readonly localRows: 0;
|
|
315
|
+
}, {
|
|
316
|
+
readonly table: "plugin_config";
|
|
317
|
+
readonly localRows: 0;
|
|
318
|
+
}, {
|
|
319
|
+
readonly table: "plugin_database_namespaces";
|
|
320
|
+
readonly localRows: 0;
|
|
321
|
+
}, {
|
|
322
|
+
readonly table: "plugin_entities";
|
|
323
|
+
readonly localRows: 0;
|
|
324
|
+
}, {
|
|
325
|
+
readonly table: "plugin_job_runs";
|
|
326
|
+
readonly localRows: 0;
|
|
327
|
+
}, {
|
|
328
|
+
readonly table: "plugin_jobs";
|
|
329
|
+
readonly localRows: 0;
|
|
330
|
+
}, {
|
|
331
|
+
readonly table: "plugin_logs";
|
|
332
|
+
readonly localRows: 0;
|
|
333
|
+
}, {
|
|
334
|
+
readonly table: "plugin_managed_resources";
|
|
335
|
+
readonly localRows: 0;
|
|
336
|
+
}, {
|
|
337
|
+
readonly table: "plugin_migrations";
|
|
338
|
+
readonly localRows: 0;
|
|
339
|
+
}, {
|
|
340
|
+
readonly table: "plugin_state";
|
|
341
|
+
readonly localRows: 0;
|
|
342
|
+
}, {
|
|
343
|
+
readonly table: "plugin_webhook_deliveries";
|
|
344
|
+
readonly localRows: 0;
|
|
345
|
+
}, {
|
|
346
|
+
readonly table: "plugins";
|
|
347
|
+
readonly localRows: 0;
|
|
348
|
+
}, {
|
|
349
|
+
readonly table: "project_memberships";
|
|
350
|
+
readonly localRows: 0;
|
|
351
|
+
}, {
|
|
352
|
+
readonly table: "user_secret_declarations";
|
|
353
|
+
readonly localRows: 0;
|
|
354
|
+
}, {
|
|
355
|
+
readonly table: "user_secret_definitions";
|
|
356
|
+
readonly localRows: 0;
|
|
357
|
+
}, {
|
|
358
|
+
readonly table: "user_sidebar_preferences";
|
|
359
|
+
readonly localRows: 0;
|
|
360
|
+
}, {
|
|
361
|
+
readonly table: "verification";
|
|
362
|
+
readonly localRows: 0;
|
|
363
|
+
}, {
|
|
364
|
+
readonly table: "workspace_runtime_services";
|
|
365
|
+
readonly localRows: 0;
|
|
366
|
+
}];
|
|
367
|
+
export declare const TABLE_SIZE_ESTIMATES: readonly TableSizeEstimate[];
|
|
368
|
+
export declare const TABLE_SIZE_ESTIMATES_BY_TABLE: ReadonlyMap<string, TableSizeEstimate>;
|
|
369
|
+
export declare function getTableSizeEstimate(table: string): TableSizeEstimate | undefined;
|
|
370
|
+
export declare function getTableSizeBucket(table: string): TableSizeBucket;
|
|
371
|
+
export declare function isKnownLargeTable(table: string): boolean;
|
|
372
|
+
//# sourceMappingURL=table-size-estimates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-size-estimates.d.ts","sourceRoot":"","sources":["../src/table-size-estimates.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE3D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,iBAAiB,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4
|
+
method: "SELECT count(*) in a read-only transaction",
|
|
5
|
+
};
|
|
6
|
+
export const TABLE_SIZE_ESTIMATE_FACTOR = 250;
|
|
7
|
+
export const TABLE_SIZE_BUCKET_THRESHOLDS = {
|
|
8
|
+
largeRows: 1_000_000,
|
|
9
|
+
mediumRows: 100_000,
|
|
10
|
+
};
|
|
11
|
+
export const LOCAL_TABLE_ROW_COUNTS = [
|
|
12
|
+
{ table: "agent_wakeup_requests", localRows: 52_791 },
|
|
13
|
+
{ table: "activity_log", localRows: 22_930 },
|
|
14
|
+
{ table: "issue_reference_mentions", localRows: 13_218 },
|
|
15
|
+
{ table: "heartbeat_run_events", localRows: 10_833 },
|
|
16
|
+
{ table: "issue_comments", localRows: 5_034 },
|
|
17
|
+
{ table: "document_revisions", localRows: 3_906 },
|
|
18
|
+
{ table: "heartbeat_runs", localRows: 3_620 },
|
|
19
|
+
{ table: "workspace_operations", localRows: 3_600 },
|
|
20
|
+
{ table: "environment_leases", localRows: 3_492 },
|
|
21
|
+
{ table: "cost_events", localRows: 3_330 },
|
|
22
|
+
{ table: "agent_task_sessions", localRows: 1_743 },
|
|
23
|
+
{ table: "documents", localRows: 1_692 },
|
|
24
|
+
{ table: "issue_documents", localRows: 1_678 },
|
|
25
|
+
{ table: "issues", localRows: 1_609 },
|
|
26
|
+
{ table: "secret_access_events", localRows: 933 },
|
|
27
|
+
{ table: "issue_read_states", localRows: 608 },
|
|
28
|
+
{ table: "issue_thread_interactions", localRows: 455 },
|
|
29
|
+
{ table: "issue_relations", localRows: 445 },
|
|
30
|
+
{ table: "execution_workspaces", localRows: 414 },
|
|
31
|
+
{ table: "agent_config_revisions", localRows: 145 },
|
|
32
|
+
{ table: "document_annotation_anchor_snapshots", localRows: 132 },
|
|
33
|
+
{ table: "document_annotation_comments", localRows: 122 },
|
|
34
|
+
{ table: "document_annotation_threads", localRows: 80 },
|
|
35
|
+
{ table: "routine_revisions", localRows: 64 },
|
|
36
|
+
{ table: "issue_tree_hold_members", localRows: 62 },
|
|
37
|
+
{ table: "routine_runs", localRows: 52 },
|
|
38
|
+
{ table: "issue_recovery_actions", localRows: 50 },
|
|
39
|
+
{ table: "assets", localRows: 46 },
|
|
40
|
+
{ table: "issue_attachments", localRows: 44 },
|
|
41
|
+
{ table: "principal_permission_grants", localRows: 25 },
|
|
42
|
+
{ table: "company_memberships", localRows: 19 },
|
|
43
|
+
{ table: "agent_runtime_state", localRows: 18 },
|
|
44
|
+
{ table: "agents", localRows: 18 },
|
|
45
|
+
{ table: "routine_triggers", localRows: 16 },
|
|
46
|
+
{ table: "company_skills", localRows: 15 },
|
|
47
|
+
{ table: "routine_documents", localRows: 14 },
|
|
48
|
+
{ table: "routines", localRows: 14 },
|
|
49
|
+
{ table: "issue_inbox_archives", localRows: 13 },
|
|
50
|
+
{ table: "issue_approvals", localRows: 12 },
|
|
51
|
+
{ table: "company_secret_bindings", localRows: 11 },
|
|
52
|
+
{ table: "issue_tree_holds", localRows: 10 },
|
|
53
|
+
{ table: "approvals", localRows: 9 },
|
|
54
|
+
{ table: "session", localRows: 9 },
|
|
55
|
+
{ table: "issue_work_products", localRows: 7 },
|
|
56
|
+
{ table: "company_skill_versions", localRows: 6 },
|
|
57
|
+
{ table: "feedback_exports", localRows: 6 },
|
|
58
|
+
{ table: "feedback_votes", localRows: 6 },
|
|
59
|
+
{ table: "issue_execution_decisions", localRows: 6 },
|
|
60
|
+
{ table: "company_secret_versions", localRows: 3 },
|
|
61
|
+
{ table: "company_secrets", localRows: 3 },
|
|
62
|
+
{ table: "projects", localRows: 3 },
|
|
63
|
+
{ table: "approval_comments", localRows: 2 },
|
|
64
|
+
{ table: "goals", localRows: 2 },
|
|
65
|
+
{ table: "project_goals", localRows: 2 },
|
|
66
|
+
{ table: "project_workspaces", localRows: 2 },
|
|
67
|
+
{ table: "account", localRows: 1 },
|
|
68
|
+
{ table: "companies", localRows: 1 },
|
|
69
|
+
{ table: "environments", localRows: 1 },
|
|
70
|
+
{ table: "instance_settings", localRows: 1 },
|
|
71
|
+
{ table: "instance_user_roles", localRows: 1 },
|
|
72
|
+
{ table: "user", localRows: 1 },
|
|
73
|
+
{ table: "agent_api_keys", localRows: 0 },
|
|
74
|
+
{ table: "agent_memberships", localRows: 0 },
|
|
75
|
+
{ table: "board_api_keys", localRows: 0 },
|
|
76
|
+
{ table: "budget_incidents", localRows: 0 },
|
|
77
|
+
{ table: "budget_policies", localRows: 0 },
|
|
78
|
+
{ table: "cli_auth_challenges", localRows: 0 },
|
|
79
|
+
{ table: "cloud_upstream_connections", localRows: 0 },
|
|
80
|
+
{ table: "cloud_upstream_runs", localRows: 0 },
|
|
81
|
+
{ table: "company_logos", localRows: 0 },
|
|
82
|
+
{ table: "company_secret_provider_configs", localRows: 0 },
|
|
83
|
+
{ table: "company_skill_comments", localRows: 0 },
|
|
84
|
+
{ table: "company_skill_stars", localRows: 0 },
|
|
85
|
+
{ table: "company_user_sidebar_preferences", localRows: 0 },
|
|
86
|
+
{ table: "environment_custom_image_setup_sessions", localRows: 0 },
|
|
87
|
+
{ table: "environment_custom_image_templates", localRows: 0 },
|
|
88
|
+
{ table: "external_object_mentions", localRows: 0 },
|
|
89
|
+
{ table: "external_objects", localRows: 0 },
|
|
90
|
+
{ table: "finance_events", localRows: 0 },
|
|
91
|
+
{ table: "heartbeat_run_watchdog_decisions", localRows: 0 },
|
|
92
|
+
{ table: "inbox_dismissals", localRows: 0 },
|
|
93
|
+
{ table: "invites", localRows: 0 },
|
|
94
|
+
{ table: "issue_labels", localRows: 0 },
|
|
95
|
+
{ table: "issue_plan_decompositions", localRows: 0 },
|
|
96
|
+
{ table: "issue_watchdogs", localRows: 0 },
|
|
97
|
+
{ table: "join_requests", localRows: 0 },
|
|
98
|
+
{ table: "labels", localRows: 0 },
|
|
99
|
+
{ table: "pipeline_automation_executions", localRows: 0 },
|
|
100
|
+
{ table: "pipeline_case_blockers", localRows: 0 },
|
|
101
|
+
{ table: "pipeline_case_documents", localRows: 0 },
|
|
102
|
+
{ table: "pipeline_case_events", localRows: 0 },
|
|
103
|
+
{ table: "pipeline_case_issue_links", localRows: 0 },
|
|
104
|
+
{ table: "pipeline_cases", localRows: 0 },
|
|
105
|
+
{ table: "pipeline_documents", localRows: 0 },
|
|
106
|
+
{ table: "pipeline_stages", localRows: 0 },
|
|
107
|
+
{ table: "pipeline_transitions", localRows: 0 },
|
|
108
|
+
{ table: "pipelines", localRows: 0 },
|
|
109
|
+
{ table: "plugin_company_settings", localRows: 0 },
|
|
110
|
+
{ table: "plugin_config", localRows: 0 },
|
|
111
|
+
{ table: "plugin_database_namespaces", localRows: 0 },
|
|
112
|
+
{ table: "plugin_entities", localRows: 0 },
|
|
113
|
+
{ table: "plugin_job_runs", localRows: 0 },
|
|
114
|
+
{ table: "plugin_jobs", localRows: 0 },
|
|
115
|
+
{ table: "plugin_logs", localRows: 0 },
|
|
116
|
+
{ table: "plugin_managed_resources", localRows: 0 },
|
|
117
|
+
{ table: "plugin_migrations", localRows: 0 },
|
|
118
|
+
{ table: "plugin_state", localRows: 0 },
|
|
119
|
+
{ table: "plugin_webhook_deliveries", localRows: 0 },
|
|
120
|
+
{ table: "plugins", localRows: 0 },
|
|
121
|
+
{ table: "project_memberships", localRows: 0 },
|
|
122
|
+
{ table: "user_secret_declarations", localRows: 0 },
|
|
123
|
+
{ table: "user_secret_definitions", localRows: 0 },
|
|
124
|
+
{ table: "user_sidebar_preferences", localRows: 0 },
|
|
125
|
+
{ table: "verification", localRows: 0 },
|
|
126
|
+
{ table: "workspace_runtime_services", localRows: 0 },
|
|
127
|
+
];
|
|
128
|
+
function bucketForEstimatedRows(estimatedRows) {
|
|
129
|
+
if (estimatedRows >= TABLE_SIZE_BUCKET_THRESHOLDS.largeRows)
|
|
130
|
+
return "large";
|
|
131
|
+
if (estimatedRows >= TABLE_SIZE_BUCKET_THRESHOLDS.mediumRows)
|
|
132
|
+
return "medium";
|
|
133
|
+
return "small";
|
|
134
|
+
}
|
|
135
|
+
export const TABLE_SIZE_ESTIMATES = LOCAL_TABLE_ROW_COUNTS.map(({ table, localRows }) => {
|
|
136
|
+
const estimatedRows = localRows * TABLE_SIZE_ESTIMATE_FACTOR;
|
|
137
|
+
return {
|
|
138
|
+
table,
|
|
139
|
+
localRows,
|
|
140
|
+
estimateFactor: TABLE_SIZE_ESTIMATE_FACTOR,
|
|
141
|
+
estimatedRows,
|
|
142
|
+
bucket: bucketForEstimatedRows(estimatedRows),
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
export const TABLE_SIZE_ESTIMATES_BY_TABLE = new Map(TABLE_SIZE_ESTIMATES.map((estimate) => [estimate.table, estimate]));
|
|
146
|
+
export function getTableSizeEstimate(table) {
|
|
147
|
+
return TABLE_SIZE_ESTIMATES_BY_TABLE.get(table);
|
|
148
|
+
}
|
|
149
|
+
export function getTableSizeBucket(table) {
|
|
150
|
+
return getTableSizeEstimate(table)?.bucket ?? "small";
|
|
151
|
+
}
|
|
152
|
+
export function isKnownLargeTable(table) {
|
|
153
|
+
return getTableSizeBucket(table) === "large";
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=table-size-estimates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-size-estimates.js","sourceRoot":"","sources":["../src/table-size-estimates.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE,qCAAqC;IAC/C,MAAM,EAAE,4CAA4C;CAC5C,CAAC;AAEX,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,OAAO;CACX,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,EAAE,KAAK,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,EAAE;IACrD,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE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,EAAE,EAAE,EAAE;IACvB,MAAM,aAAa,GAAG,SAAS,GAAG,0BAA0B,CAAC;IAC7D,OAAO;QACL,KAAK;QACL,SAAS;QACT,cAAc,EAAE,0BAA0B;QAC1C,aAAa;QACb,MAAM,EAAE,sBAAsB,CAAC,aAAa,CAAC;KAC9C,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAA2C,IAAI,GAAG,CAC1F,oBAAoB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CACnE,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,6BAA6B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,oBAAoB,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,kBAAkB,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC;AAC/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@penclipai/db",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.714.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/penclipai/paperclip-cn",
|
|
6
6
|
"bugs": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@penclipai/shared": "2026.
|
|
32
|
+
"@penclipai/shared": "2026.714.0",
|
|
33
33
|
"drizzle-orm": "^0.45.2",
|
|
34
34
|
"embedded-postgres": "^18.3.0-beta.17",
|
|
35
35
|
"postgres": "^3.4.9"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"vitest": "^4.1.8"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
|
-
"check:migrations": "tsx src/check-migration-numbering.ts",
|
|
45
|
+
"check:migrations": "tsx src/check-migration-numbering.ts && tsx src/check-migration-safety.ts",
|
|
46
46
|
"build": "pnpm run check:migrations && tsc && node ../../scripts/fs-ops.mjs cp src/migrations dist/migrations",
|
|
47
47
|
"clean": "node ../../scripts/fs-ops.mjs rm dist",
|
|
48
48
|
"typecheck": "pnpm run check:migrations && tsc --noEmit",
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
ALTER TABLE "issue_comments" ADD COLUMN IF NOT EXISTS "derived_author_agent_id" uuid;--> statement-breakpoint
|
|
2
|
-
ALTER TABLE "issue_comments" ADD COLUMN IF NOT EXISTS "derived_created_by_run_id" uuid;--> statement-breakpoint
|
|
3
|
-
ALTER TABLE "issue_comments" ADD COLUMN IF NOT EXISTS "derived_author_source" text;--> statement-breakpoint
|
|
4
|
-
DO $$ BEGIN
|
|
5
|
-
IF NOT EXISTS (
|
|
6
|
-
SELECT 1 FROM "pg_constraint" WHERE "conname" = 'issue_comments_derived_author_agent_id_agents_id_fk'
|
|
7
|
-
) THEN
|
|
8
|
-
ALTER TABLE "issue_comments" ADD CONSTRAINT "issue_comments_derived_author_agent_id_agents_id_fk" FOREIGN KEY ("derived_author_agent_id") REFERENCES "public"."agents"("id") ON DELETE set null ON UPDATE no action;
|
|
9
|
-
END IF;
|
|
10
|
-
END $$;--> statement-breakpoint
|
|
11
|
-
DO $$ BEGIN
|
|
12
|
-
IF NOT EXISTS (
|
|
13
|
-
SELECT 1 FROM "pg_constraint" WHERE "conname" = 'issue_comments_derived_created_by_run_id_heartbeat_runs_id_fk'
|
|
14
|
-
) THEN
|
|
15
|
-
ALTER TABLE "issue_comments" ADD CONSTRAINT "issue_comments_derived_created_by_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("derived_created_by_run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE set null ON UPDATE no action;
|
|
16
|
-
END IF;
|
|
17
|
-
END $$;--> statement-breakpoint
|
|
18
|
-
-- Backfill agent attribution for historical non-human ("Board") comments so old
|
|
19
|
-
-- threads stop rendering as blue board bubbles and the read path stops
|
|
20
|
-
-- re-scanning run logs. Two SQL-computable tiers, both guarded to NEVER touch a
|
|
21
|
-
-- comment whose author maps to a genuine user profile. The log-marker tier is
|
|
22
|
-
-- handled lazily on read (it needs object-storage log bodies).
|
|
23
|
-
--
|
|
24
|
-
-- Tier `run_id`: the comment's own authoring run resolves to an agent (lossless).
|
|
25
|
-
-- Batched to keep lock/WAL footprint bounded on large histories.
|
|
26
|
-
DO $$
|
|
27
|
-
DECLARE
|
|
28
|
-
affected integer;
|
|
29
|
-
BEGIN
|
|
30
|
-
LOOP
|
|
31
|
-
WITH batch AS (
|
|
32
|
-
SELECT c.id AS comment_id, hr.agent_id, hr.id AS run_id
|
|
33
|
-
FROM issue_comments c
|
|
34
|
-
JOIN heartbeat_runs hr ON hr.id = c.created_by_run_id
|
|
35
|
-
WHERE c.author_agent_id IS NULL
|
|
36
|
-
AND c.derived_author_agent_id IS NULL
|
|
37
|
-
AND c.author_user_id IS NOT NULL
|
|
38
|
-
-- Only the non-human board sentinel or non-`user` authors are
|
|
39
|
-
-- eligible. `local-board` IS a row in "user" (the implicit board
|
|
40
|
-
-- admin), so it must be allowed explicitly; genuine signups are not.
|
|
41
|
-
AND (c.author_user_id = 'local-board'
|
|
42
|
-
OR NOT EXISTS (SELECT 1 FROM "user" u WHERE u.id = c.author_user_id))
|
|
43
|
-
LIMIT 5000
|
|
44
|
-
)
|
|
45
|
-
UPDATE issue_comments c
|
|
46
|
-
SET derived_author_agent_id = b.agent_id,
|
|
47
|
-
derived_created_by_run_id = b.run_id,
|
|
48
|
-
derived_author_source = 'run_id'
|
|
49
|
-
FROM batch b
|
|
50
|
-
WHERE c.id = b.comment_id;
|
|
51
|
-
GET DIAGNOSTICS affected = ROW_COUNT;
|
|
52
|
-
EXIT WHEN affected = 0;
|
|
53
|
-
END LOOP;
|
|
54
|
-
END $$;--> statement-breakpoint
|
|
55
|
-
-- Option A: the pure run-window TIMING tiers are intentionally NOT applied.
|
|
56
|
-
-- Because agents post through the `local-board` subprocess, an agent comment and
|
|
57
|
-
-- a genuine human board comment are indistinguishable rows, so any timing-overlap
|
|
58
|
-
-- guess mis-attributes human board comments that merely coincided with an agent
|
|
59
|
-
-- run (e.g. a human board reply typed while an agent run was in flight).
|
|
60
|
-
-- Only the lossless `run_id` backfill above (and the read-path `run_log_comment_post`
|
|
61
|
-
-- tier) attribute history; everything else stays "Board".
|
|
62
|
-
--
|
|
63
|
-
-- This statement also reverts any attribution a PRIOR revision of this migration
|
|
64
|
-
-- persisted via the timing tiers, so re-applying / upgrading is idempotent.
|
|
65
|
-
UPDATE issue_comments
|
|
66
|
-
SET derived_author_agent_id = NULL,
|
|
67
|
-
derived_created_by_run_id = NULL,
|
|
68
|
-
derived_author_source = NULL
|
|
69
|
-
WHERE derived_author_source IN ('run_window_unique', 'run_window_agent_unique');
|