@tickernelz/paperclip-pro-db 2026.925.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.
Files changed (1239) hide show
  1. package/dist/adapter-auth-sessions-schema.test.d.ts +2 -0
  2. package/dist/adapter-auth-sessions-schema.test.d.ts.map +1 -0
  3. package/dist/adapter-auth-sessions-schema.test.js +112 -0
  4. package/dist/adapter-auth-sessions-schema.test.js.map +1 -0
  5. package/dist/agent-chat-migration.test.d.ts +2 -0
  6. package/dist/agent-chat-migration.test.d.ts.map +1 -0
  7. package/dist/agent-chat-migration.test.js +111 -0
  8. package/dist/agent-chat-migration.test.js.map +1 -0
  9. package/dist/agent-wakeup-requests-schema.test.d.ts +2 -0
  10. package/dist/agent-wakeup-requests-schema.test.d.ts.map +1 -0
  11. package/dist/agent-wakeup-requests-schema.test.js +24 -0
  12. package/dist/agent-wakeup-requests-schema.test.js.map +1 -0
  13. package/dist/backup-lib.d.ts +42 -0
  14. package/dist/backup-lib.d.ts.map +1 -0
  15. package/dist/backup-lib.js +921 -0
  16. package/dist/backup-lib.js.map +1 -0
  17. package/dist/backup-lib.test.d.ts +2 -0
  18. package/dist/backup-lib.test.d.ts.map +1 -0
  19. package/dist/backup-lib.test.js +502 -0
  20. package/dist/backup-lib.test.js.map +1 -0
  21. package/dist/backup.d.ts +2 -0
  22. package/dist/backup.d.ts.map +1 -0
  23. package/dist/backup.js +77 -0
  24. package/dist/backup.js.map +1 -0
  25. package/dist/better-auth-account-issuer-migration.test.d.ts +9 -0
  26. package/dist/better-auth-account-issuer-migration.test.d.ts.map +1 -0
  27. package/dist/better-auth-account-issuer-migration.test.js +113 -0
  28. package/dist/better-auth-account-issuer-migration.test.js.map +1 -0
  29. package/dist/built-in-agent-unique-marker-migration.test.d.ts +2 -0
  30. package/dist/built-in-agent-unique-marker-migration.test.d.ts.map +1 -0
  31. package/dist/built-in-agent-unique-marker-migration.test.js +102 -0
  32. package/dist/built-in-agent-unique-marker-migration.test.js.map +1 -0
  33. package/dist/chat-github-migration.test.d.ts +2 -0
  34. package/dist/chat-github-migration.test.d.ts.map +1 -0
  35. package/dist/chat-github-migration.test.js +34 -0
  36. package/dist/chat-github-migration.test.js.map +1 -0
  37. package/dist/chat-identity-migration-reconciliation.test.d.ts +2 -0
  38. package/dist/chat-identity-migration-reconciliation.test.d.ts.map +1 -0
  39. package/dist/chat-identity-migration-reconciliation.test.js +531 -0
  40. package/dist/chat-identity-migration-reconciliation.test.js.map +1 -0
  41. package/dist/chat-telegram-draft-ids-migration.test.d.ts +2 -0
  42. package/dist/chat-telegram-draft-ids-migration.test.d.ts.map +1 -0
  43. package/dist/chat-telegram-draft-ids-migration.test.js +71 -0
  44. package/dist/chat-telegram-draft-ids-migration.test.js.map +1 -0
  45. package/dist/chat-tenant-foreign-keys.test.d.ts +2 -0
  46. package/dist/chat-tenant-foreign-keys.test.d.ts.map +1 -0
  47. package/dist/chat-tenant-foreign-keys.test.js +140 -0
  48. package/dist/chat-tenant-foreign-keys.test.js.map +1 -0
  49. package/dist/check-migration-numbering.d.ts +2 -0
  50. package/dist/check-migration-numbering.d.ts.map +1 -0
  51. package/dist/check-migration-numbering.js +64 -0
  52. package/dist/check-migration-numbering.js.map +1 -0
  53. package/dist/check-migration-safety.d.ts +27 -0
  54. package/dist/check-migration-safety.d.ts.map +1 -0
  55. package/dist/check-migration-safety.js +811 -0
  56. package/dist/check-migration-safety.js.map +1 -0
  57. package/dist/check-migration-safety.test.d.ts +2 -0
  58. package/dist/check-migration-safety.test.d.ts.map +1 -0
  59. package/dist/check-migration-safety.test.js +391 -0
  60. package/dist/check-migration-safety.test.js.map +1 -0
  61. package/dist/client-options.test.d.ts +2 -0
  62. package/dist/client-options.test.d.ts.map +1 -0
  63. package/dist/client-options.test.js +88 -0
  64. package/dist/client-options.test.js.map +1 -0
  65. package/dist/client-teardown-registry.test.d.ts +2 -0
  66. package/dist/client-teardown-registry.test.d.ts.map +1 -0
  67. package/dist/client-teardown-registry.test.js +100 -0
  68. package/dist/client-teardown-registry.test.js.map +1 -0
  69. package/dist/client.d.ts +111 -0
  70. package/dist/client.d.ts.map +1 -0
  71. package/dist/client.js +883 -0
  72. package/dist/client.js.map +1 -0
  73. package/dist/client.test.d.ts +2 -0
  74. package/dist/client.test.d.ts.map +1 -0
  75. package/dist/client.test.js +1759 -0
  76. package/dist/client.test.js.map +1 -0
  77. package/dist/company-secret-proposals-migration.test.d.ts +2 -0
  78. package/dist/company-secret-proposals-migration.test.d.ts.map +1 -0
  79. package/dist/company-secret-proposals-migration.test.js +40 -0
  80. package/dist/company-secret-proposals-migration.test.js.map +1 -0
  81. package/dist/connection-grants-phase2-migration.test.d.ts +2 -0
  82. package/dist/connection-grants-phase2-migration.test.d.ts.map +1 -0
  83. package/dist/connection-grants-phase2-migration.test.js +30 -0
  84. package/dist/connection-grants-phase2-migration.test.js.map +1 -0
  85. package/dist/connection-grants-phase4-migration.test.d.ts +2 -0
  86. package/dist/connection-grants-phase4-migration.test.d.ts.map +1 -0
  87. package/dist/connection-grants-phase4-migration.test.js +300 -0
  88. package/dist/connection-grants-phase4-migration.test.js.map +1 -0
  89. package/dist/connections-v3-schema-core-migration.test.d.ts +2 -0
  90. package/dist/connections-v3-schema-core-migration.test.d.ts.map +1 -0
  91. package/dist/connections-v3-schema-core-migration.test.js +98 -0
  92. package/dist/connections-v3-schema-core-migration.test.js.map +1 -0
  93. package/dist/decision-queue-migrations.test.d.ts +2 -0
  94. package/dist/decision-queue-migrations.test.d.ts.map +1 -0
  95. package/dist/decision-queue-migrations.test.js +78 -0
  96. package/dist/decision-queue-migrations.test.js.map +1 -0
  97. package/dist/embedded-postgres-error.d.ts +9 -0
  98. package/dist/embedded-postgres-error.d.ts.map +1 -0
  99. package/dist/embedded-postgres-error.js +73 -0
  100. package/dist/embedded-postgres-error.js.map +1 -0
  101. package/dist/embedded-postgres-error.test.d.ts +2 -0
  102. package/dist/embedded-postgres-error.test.d.ts.map +1 -0
  103. package/dist/embedded-postgres-error.test.js +25 -0
  104. package/dist/embedded-postgres-error.test.js.map +1 -0
  105. package/dist/embedded-postgres-lifecycle.d.ts +16 -0
  106. package/dist/embedded-postgres-lifecycle.d.ts.map +1 -0
  107. package/dist/embedded-postgres-lifecycle.js +43 -0
  108. package/dist/embedded-postgres-lifecycle.js.map +1 -0
  109. package/dist/embedded-postgres-lifecycle.test.d.ts +2 -0
  110. package/dist/embedded-postgres-lifecycle.test.d.ts.map +1 -0
  111. package/dist/embedded-postgres-lifecycle.test.js +64 -0
  112. package/dist/embedded-postgres-lifecycle.test.js.map +1 -0
  113. package/dist/embedded-postgres-native.d.ts +3 -0
  114. package/dist/embedded-postgres-native.d.ts.map +1 -0
  115. package/dist/embedded-postgres-native.js +83 -0
  116. package/dist/embedded-postgres-native.js.map +1 -0
  117. package/dist/embedded-postgres-native.test.d.ts +2 -0
  118. package/dist/embedded-postgres-native.test.d.ts.map +1 -0
  119. package/dist/embedded-postgres-native.test.js +49 -0
  120. package/dist/embedded-postgres-native.test.js.map +1 -0
  121. package/dist/environment-custom-images-schema.test.d.ts +2 -0
  122. package/dist/environment-custom-images-schema.test.d.ts.map +1 -0
  123. package/dist/environment-custom-images-schema.test.js +26 -0
  124. package/dist/environment-custom-images-schema.test.js.map +1 -0
  125. package/dist/external-objects-schema.test.d.ts +2 -0
  126. package/dist/external-objects-schema.test.d.ts.map +1 -0
  127. package/dist/external-objects-schema.test.js +46 -0
  128. package/dist/external-objects-schema.test.js.map +1 -0
  129. package/dist/heartbeat-context-snapshot-index-migration.test.d.ts +2 -0
  130. package/dist/heartbeat-context-snapshot-index-migration.test.d.ts.map +1 -0
  131. package/dist/heartbeat-context-snapshot-index-migration.test.js +60 -0
  132. package/dist/heartbeat-context-snapshot-index-migration.test.js.map +1 -0
  133. package/dist/inbox-archive-agent-policies-migration.test.d.ts +2 -0
  134. package/dist/inbox-archive-agent-policies-migration.test.d.ts.map +1 -0
  135. package/dist/inbox-archive-agent-policies-migration.test.js +155 -0
  136. package/dist/inbox-archive-agent-policies-migration.test.js.map +1 -0
  137. package/dist/index.d.ts +10 -0
  138. package/dist/index.d.ts.map +1 -0
  139. package/dist/index.js +10 -0
  140. package/dist/index.js.map +1 -0
  141. package/dist/issue-comment-derived-attribution-migration.test.d.ts +2 -0
  142. package/dist/issue-comment-derived-attribution-migration.test.d.ts.map +1 -0
  143. package/dist/issue-comment-derived-attribution-migration.test.js +287 -0
  144. package/dist/issue-comment-derived-attribution-migration.test.js.map +1 -0
  145. package/dist/issue-comment-on-behalf-migration.test.d.ts +2 -0
  146. package/dist/issue-comment-on-behalf-migration.test.d.ts.map +1 -0
  147. package/dist/issue-comment-on-behalf-migration.test.js +146 -0
  148. package/dist/issue-comment-on-behalf-migration.test.js.map +1 -0
  149. package/dist/issue-thread-interaction-resolver-policy-migration.test.d.ts +2 -0
  150. package/dist/issue-thread-interaction-resolver-policy-migration.test.d.ts.map +1 -0
  151. package/dist/issue-thread-interaction-resolver-policy-migration.test.js +146 -0
  152. package/dist/issue-thread-interaction-resolver-policy-migration.test.js.map +1 -0
  153. package/dist/migrate.d.ts +2 -0
  154. package/dist/migrate.d.ts.map +1 -0
  155. package/dist/migrate.js +25 -0
  156. package/dist/migrate.js.map +1 -0
  157. package/dist/migration-runtime.d.ts +7 -0
  158. package/dist/migration-runtime.d.ts.map +1 -0
  159. package/dist/migration-runtime.js +159 -0
  160. package/dist/migration-runtime.js.map +1 -0
  161. package/dist/migration-safety-baseline.d.ts +135 -0
  162. package/dist/migration-safety-baseline.d.ts.map +1 -0
  163. package/dist/migration-safety-baseline.js +150 -0
  164. package/dist/migration-safety-baseline.js.map +1 -0
  165. package/dist/migration-snapshot-drift.test.d.ts +2 -0
  166. package/dist/migration-snapshot-drift.test.d.ts.map +1 -0
  167. package/dist/migration-snapshot-drift.test.js +55 -0
  168. package/dist/migration-snapshot-drift.test.js.map +1 -0
  169. package/dist/migration-status.d.ts +2 -0
  170. package/dist/migration-status.d.ts.map +1 -0
  171. package/dist/migration-status.js +55 -0
  172. package/dist/migration-status.js.map +1 -0
  173. package/dist/migrations/0000_mature_masked_marvel.sql +208 -0
  174. package/dist/migrations/0001_fast_northstar.sql +87 -0
  175. package/dist/migrations/0002_big_zaladane.sql +1 -0
  176. package/dist/migrations/0003_shallow_quentin_quire.sql +5 -0
  177. package/dist/migrations/0004_issue_identifiers.sql +28 -0
  178. package/dist/migrations/0005_chief_luke_cage.sql +19 -0
  179. package/dist/migrations/0006_overjoyed_mister_sinister.sql +36 -0
  180. package/dist/migrations/0007_new_quentin_quire.sql +20 -0
  181. package/dist/migrations/0008_amused_zzzax.sql +1 -0
  182. package/dist/migrations/0009_fast_jackal.sql +36 -0
  183. package/dist/migrations/0010_stale_justin_hammer.sql +37 -0
  184. package/dist/migrations/0011_windy_corsair.sql +18 -0
  185. package/dist/migrations/0012_perpetual_ser_duncan.sql +2 -0
  186. package/dist/migrations/0013_dashing_wasp.sql +4 -0
  187. package/dist/migrations/0014_many_mikhail_rasputin.sql +135 -0
  188. package/dist/migrations/0015_project_color_archived.sql +2 -0
  189. package/dist/migrations/0016_agent_icon.sql +1 -0
  190. package/dist/migrations/0017_tiresome_gabe_jones.sql +51 -0
  191. package/dist/migrations/0018_flat_sleepwalker.sql +26 -0
  192. package/dist/migrations/0019_public_victor_mancha.sql +18 -0
  193. package/dist/migrations/0020_white_anita_blake.sql +1 -0
  194. package/dist/migrations/0021_chief_vindicator.sql +1 -0
  195. package/dist/migrations/0022_company_brand_color.sql +1 -0
  196. package/dist/migrations/0023_fair_lethal_legion.sql +3 -0
  197. package/dist/migrations/0024_far_beast.sql +2 -0
  198. package/dist/migrations/0025_nasty_salo.sql +15 -0
  199. package/dist/migrations/0026_lying_pete_wisdom.sql +39 -0
  200. package/dist/migrations/0027_tranquil_tenebrous.sql +2 -0
  201. package/dist/migrations/0028_harsh_goliath.sql +54 -0
  202. package/dist/migrations/0029_plugin_tables.sql +177 -0
  203. package/dist/migrations/0030_rich_magneto.sql +12 -0
  204. package/dist/migrations/0031_zippy_magma.sql +51 -0
  205. package/dist/migrations/0032_pretty_doctor_octopus.sql +102 -0
  206. package/dist/migrations/0033_shiny_black_tarantula.sql +2 -0
  207. package/dist/migrations/0034_fat_dormammu.sql +2 -0
  208. package/dist/migrations/0035_marvelous_satana.sql +91 -0
  209. package/dist/migrations/0036_cheerful_nitro.sql +9 -0
  210. package/dist/migrations/0037_friendly_eddie_brock.sql +29 -0
  211. package/dist/migrations/0038_careless_iron_monger.sql +5 -0
  212. package/dist/migrations/0039_fat_magneto.sql +161 -0
  213. package/dist/migrations/0040_eager_shotgun.sql +5 -0
  214. package/dist/migrations/0041_curly_maria_hill.sql +1 -0
  215. package/dist/migrations/0042_spotty_the_renegades.sql +26 -0
  216. package/dist/migrations/0043_reflective_captain_universe.sql +6 -0
  217. package/dist/migrations/0044_illegal_toad.sql +56 -0
  218. package/dist/migrations/0045_workable_shockwave.sql +17 -0
  219. package/dist/migrations/0046_smooth_sentinels.sql +11 -0
  220. package/dist/migrations/0047_overjoyed_groot.sql +102 -0
  221. package/dist/migrations/0048_flashy_marrow.sql +1 -0
  222. package/dist/migrations/0049_flawless_abomination.sql +21 -0
  223. package/dist/migrations/0050_stiff_luckman.sql +1 -0
  224. package/dist/migrations/0051_young_korg.sql +5 -0
  225. package/dist/migrations/0052_mushy_trauma.sql +26 -0
  226. package/dist/migrations/0053_sharp_wild_child.sql +18 -0
  227. package/dist/migrations/0054_draft_routines.sql +2 -0
  228. package/dist/migrations/0055_kind_weapon_omega.sql +1 -0
  229. package/dist/migrations/0056_spooky_ultragirl.sql +22 -0
  230. package/dist/migrations/0057_tidy_join_requests.sql +57 -0
  231. package/dist/migrations/0058_wealthy_starbolt.sql +6 -0
  232. package/dist/migrations/0059_plugin_database_namespaces.sql +41 -0
  233. package/dist/migrations/0060_orange_annihilus.sql +50 -0
  234. package/dist/migrations/0061_lively_thor_girl.sql +3 -0
  235. package/dist/migrations/0062_routine_run_dispatch_fingerprint.sql +9 -0
  236. package/dist/migrations/0063_issue_thread_interactions.sql +65 -0
  237. package/dist/migrations/0064_issue_thread_interaction_idempotency.sql +4 -0
  238. package/dist/migrations/0065_environments.sql +50 -0
  239. package/dist/migrations/0066_issue_tree_holds.sql +107 -0
  240. package/dist/migrations/0067_agent_default_environment.sql +3 -0
  241. package/dist/migrations/0068_environment_local_driver_unique.sql +2 -0
  242. package/dist/migrations/0069_liveness_recovery_dedupe.sql +13 -0
  243. package/dist/migrations/0070_active_run_output_watchdog.sql +70 -0
  244. package/dist/migrations/0071_default_hire_approval_off.sql +1 -0
  245. package/dist/migrations/0072_large_sandman.sql +6 -0
  246. package/dist/migrations/0073_shiny_salo.sql +1 -0
  247. package/dist/migrations/0074_striped_genesis.sql +4 -0
  248. package/dist/migrations/0075_cultured_sebastian_shaw.sql +7 -0
  249. package/dist/migrations/0076_useful_elektra.sql +29 -0
  250. package/dist/migrations/0077_unusual_karnak.sql +140 -0
  251. package/dist/migrations/0078_white_darwin.sql +3 -0
  252. package/dist/migrations/0079_company_search_document_indexes.sql +2 -0
  253. package/dist/migrations/0080_company_search_fuzzystrmatch.sql +1 -0
  254. package/dist/migrations/0081_optimal_dormammu.sql +1 -0
  255. package/dist/migrations/0082_dry_vision.sql +124 -0
  256. package/dist/migrations/0083_company_secret_provider_configs.sql +51 -0
  257. package/dist/migrations/0084_issue_recovery_actions.sql +64 -0
  258. package/dist/migrations/0085_tranquil_the_executioner.sql +8 -0
  259. package/dist/migrations/0086_routine_env_runtime_contract.sql +8 -0
  260. package/dist/migrations/0087_backfill_environment_manage_human_defaults.sql +29 -0
  261. package/dist/migrations/0088_backfill_principal_access_compatibility.sql +75 -0
  262. package/dist/migrations/0089_cloud_upstreams.sql +71 -0
  263. package/dist/migrations/0090_resource_memberships.sql +55 -0
  264. package/dist/migrations/0091_old_swarm.sql +189 -0
  265. package/dist/migrations/0092_mighty_puma.sql +28 -0
  266. package/dist/migrations/0093_giant_green_goblin.sql +6 -0
  267. package/dist/migrations/0094_backfill_archived_company_agent_pauses.sql +10 -0
  268. package/dist/migrations/0095_issue_comment_tombstones.sql +15 -0
  269. package/dist/migrations/0096_document_annotation_issue_comment_links.sql +7 -0
  270. package/dist/migrations/0097_low_trust_source_trust.sql +4 -0
  271. package/dist/migrations/0098_project_icon.sql +1 -0
  272. package/dist/migrations/0099_skills_store_foundation.sql +121 -0
  273. package/dist/migrations/0100_skill_install_count_backfill.sql +3 -0
  274. package/dist/migrations/0101_plugin_company_id_tenant_isolation.sql +14 -0
  275. package/dist/migrations/0102_managed_sandbox_dedup_index.sql +33 -0
  276. package/dist/migrations/0103_agent_error_reason.sql +1 -0
  277. package/dist/migrations/0104_issue_watchdogs.sql +90 -0
  278. package/dist/migrations/0105_instance_scoped_environments.sql +170 -0
  279. package/dist/migrations/0106_external_object_references.sql +106 -0
  280. package/dist/migrations/0107_external_object_display_metadata.sql +5 -0
  281. package/dist/migrations/0108_workspace_operations_issue_id.sql +41 -0
  282. package/dist/migrations/0109_routine_description_annotations.sql +170 -0
  283. package/dist/migrations/0110_document_company_cascade.sql +31 -0
  284. package/dist/migrations/0111_backfill_skill_create_human_defaults.sql +29 -0
  285. package/dist/migrations/0112_rename_skill_create_permission_key.sql +30 -0
  286. package/dist/migrations/0113_pipeline_foundation.sql +335 -0
  287. package/dist/migrations/0114_pipeline_case_issue_unlinked_event.sql +3 -0
  288. package/dist/migrations/0115_pipeline_routine_origin.sql +3 -0
  289. package/dist/migrations/0116_pipeline_upstream_drift_event.sql +3 -0
  290. package/dist/migrations/0117_pipeline_transition_forced_event.sql +3 -0
  291. package/dist/migrations/0118_pipeline_case_agent_fanout.sql +3 -0
  292. package/dist/migrations/0119_pipeline_drift_acknowledged_event.sql +3 -0
  293. package/dist/migrations/0120_pipeline_stage_working_primitives.sql +19 -0
  294. package/dist/migrations/0121_pipeline_automation_retry_effects.sql +43 -0
  295. package/dist/migrations/0122_pipeline_case_documents.sql +28 -0
  296. package/dist/migrations/0123_document_annotation_source_trust.sql +1 -0
  297. package/dist/migrations/0124_agent_api_key_scope_config.sql +1 -0
  298. package/dist/migrations/0125_environment_custom_image_templates.sql +147 -0
  299. package/dist/migrations/0127_environment_custom_images_instance_scoped.sql +106 -0
  300. package/dist/migrations/0128_user_specific_secrets.sql +178 -0
  301. package/dist/migrations/0129_agent_api_key_responsible_user.sql +41 -0
  302. package/dist/migrations/0131_repair_run_responsible_user_context_refs.sql +67 -0
  303. package/dist/migrations/0132_issue_comment_derived_attribution_fast.sql +82 -0
  304. package/dist/migrations/0133_resource_membership_stars.sql +7 -0
  305. package/dist/migrations/0134_run_responsible_user_invariant.sql +211 -0
  306. package/dist/migrations/0135_repair_run_responsible_user_updated_at_sweep.sql +84 -0
  307. package/dist/migrations/0136_acpx_default_engine_migration.sql +97 -0
  308. package/dist/migrations/0137_skill_studio_server_foundation.sql +76 -0
  309. package/dist/migrations/0138_skill_studio_run_retention.sql +5 -0
  310. package/dist/migrations/0139_skill_studio_run_templates.sql +44 -0
  311. package/dist/migrations/0140_built_in_managed_resources.sql +43 -0
  312. package/dist/migrations/0141_heartbeat_runs_company_created_at_index.sql +2 -0
  313. package/dist/migrations/0142_company_search_sort_indexes.sql +3 -0
  314. package/dist/migrations/0143_cases_foundation.sql +248 -0
  315. package/dist/migrations/0144_case_document_annotations.sql +31 -0
  316. package/dist/migrations/0145_inbox_dismissal_snooze_kind.sql +15 -0
  317. package/dist/migrations/0146_routine_activity_gate.sql +3 -0
  318. package/dist/migrations/0147_cost_event_status.sql +1 -0
  319. package/dist/migrations/0148_tool_access_mcp_connections.sql +126 -0
  320. package/dist/migrations/0149_agent_access_phase2_contracts.sql +612 -0
  321. package/dist/migrations/0150_tool_invocation_catalog_snapshots.sql +2 -0
  322. package/dist/migrations/0151_tool_gateway_sessions.sql +38 -0
  323. package/dist/migrations/0152_tool_connection_application_no_cascade.sql +18 -0
  324. package/dist/migrations/0153_tool_stdio_command_templates.sql +32 -0
  325. package/dist/migrations/0154_tool_oauth_states.sql +36 -0
  326. package/dist/migrations/0155_tool_oauth_state_actor_binding.sql +5 -0
  327. package/dist/migrations/0156_tool_oauth_state_session_binding.sql +1 -0
  328. package/dist/migrations/0157_tool_profile_new_tools_review.sql +1 -0
  329. package/dist/migrations/0158_tool_invocation_connected_mcp_metadata.sql +4 -0
  330. package/dist/migrations/0159_named_mcp_gateways.sql +72 -0
  331. package/dist/migrations/0160_mcp_gateway_contract_expansion.sql +176 -0
  332. package/dist/migrations/0161_environment_custom_image_company_scope_repair.sql +8 -0
  333. package/dist/migrations/0162_tool_runtime_metric_counters.sql +27 -0
  334. package/dist/migrations/0163_secret_binding_projection_class.sql +2 -0
  335. package/dist/migrations/0164_plugin_config_company_scope.sql +117 -0
  336. package/dist/migrations/0165_connection_token_issuances.sql +64 -0
  337. package/dist/migrations/0166_smoke_lab_results.sql +51 -0
  338. package/dist/migrations/0167_environment_custom_image_instance_scope_cleanup.sql +32 -0
  339. package/dist/migrations/0168_tool_connection_installs.sql +56 -0
  340. package/dist/migrations/0169_tool_gateway_protocol_rate_limit_counters.sql +43 -0
  341. package/dist/migrations/0170_company_skill_policies.sql +12 -0
  342. package/dist/migrations/0171_issue_create_idempotency_keys.sql +19 -0
  343. package/dist/migrations/0172_inbox_archive_agent_policies.sql +42 -0
  344. package/dist/migrations/0173_inbox_policy_agent_cleanup.sql +22 -0
  345. package/dist/migrations/0174_folders.sql +46 -0
  346. package/dist/migrations/0175_nested_skill_folders.sql +232 -0
  347. package/dist/migrations/0176_issue_create_idempotency_key_expiry.sql +2 -0
  348. package/dist/migrations/0177_activity_log_responsible_user.sql +10 -0
  349. package/dist/migrations/0178_summary_slots.sql +37 -0
  350. package/dist/migrations/0179_summary_slot_failure_reason.sql +1 -0
  351. package/dist/migrations/0180_decision_training_examples.sql +23 -0
  352. package/dist/migrations/0181_decision_training_retention_policy.sql +2 -0
  353. package/dist/migrations/0182_connections_v3_schema_core.sql +74 -0
  354. package/dist/migrations/0183_connection_user_authorization_state.sql +6 -0
  355. package/dist/migrations/0184_routable_blocked.sql +3 -0
  356. package/dist/migrations/0185_status_cards.sql +111 -0
  357. package/dist/migrations/0186_status_card_compile_provenance.sql +3 -0
  358. package/dist/migrations/0187_status_card_pending_change_hash.sql +1 -0
  359. package/dist/migrations/0188_status_card_generation_issue_index.sql +1 -0
  360. package/dist/migrations/0189_status_card_agent.sql +6 -0
  361. package/dist/migrations/0190_status_card_single_prompt.sql +2 -0
  362. package/dist/migrations/0191_status_card_mentioned_issue_ids.sql +1 -0
  363. package/dist/migrations/0192_task_watchdog_stop_snapshots.sql +2 -0
  364. package/dist/migrations/0193_document_memberships.sql +15 -0
  365. package/dist/migrations/0194_company_skill_releases.sql +4 -0
  366. package/dist/migrations/0195_built_in_agent_unique_marker.sql +53 -0
  367. package/dist/migrations/0196_drop_cloud_upstream_tables.sql +9 -0
  368. package/dist/migrations/0197_decisions_v1.sql +106 -0
  369. package/dist/migrations/0198_decision_queues_and_triage.sql +161 -0
  370. package/dist/migrations/0199_decision_queue_composite_key.sql +10 -0
  371. package/dist/migrations/0200_yellow_maria_hill.sql +64 -0
  372. package/dist/migrations/0201_concerned_captain_midlands.sql +1 -0
  373. package/dist/migrations/0202_eminent_marvel_zombies.sql +1 -0
  374. package/dist/migrations/0203_interaction_resolver_governance.sql +8 -0
  375. package/dist/migrations/0204_interaction_addressee.sql +6 -0
  376. package/dist/migrations/0205_narrow_shiva.sql +10 -0
  377. package/dist/migrations/0206_review_path_recovery_idempotency_index.sql +2 -0
  378. package/dist/migrations/0207_moaning_amazoness.sql +94 -0
  379. package/dist/migrations/0208_keen_sharon_carter.sql +1 -0
  380. package/dist/migrations/0209_heartbeat_context_snapshot_indexes.sql +4 -0
  381. package/dist/migrations/0210_heartbeat_context_taskkey_index.sql +1 -0
  382. package/dist/migrations/0211_bright_morg.sql +1 -0
  383. package/dist/migrations/0212_onboarding_first_task_unique.sql +3 -0
  384. package/dist/migrations/0213_complete_mystique.sql +24 -0
  385. package/dist/migrations/0214_lively_lord_tyger.sql +22 -0
  386. package/dist/migrations/0215_flat_daimon_hellstrom.sql +1 -0
  387. package/dist/migrations/0216_company_onboarding_seeds.sql +42 -0
  388. package/dist/migrations/0217_yielding_starbolt.sql +21 -0
  389. package/dist/migrations/0218_mushy_jack_murdock.sql +38 -0
  390. package/dist/migrations/0219_runtime_service_exposure.sql +3 -0
  391. package/dist/migrations/0220_execution_workspace_runtime_leases.sql +26 -0
  392. package/dist/migrations/0221_swift_justin_hammer.sql +20 -0
  393. package/dist/migrations/0222_orphan_cleanup_env_reference_survives_delete.sql +4 -0
  394. package/dist/migrations/0223_robust_zaladane.sql +6 -0
  395. package/dist/migrations/0224_unified_adapter_auth_sessions.sql +18 -0
  396. package/dist/migrations/0225_drop_claude_setup_token_sessions.sql +5 -0
  397. package/dist/migrations/0226_tan_colossus.sql +2 -0
  398. package/dist/migrations/0227_modern_pandemic.sql +410 -0
  399. package/dist/migrations/0228_nasty_grim_reaper.sql +59 -0
  400. package/dist/migrations/0229_drop_company_brand_color_and_attachment_max_bytes.sql +7 -0
  401. package/dist/migrations/0230_better_auth_account_issuer.sql +23 -0
  402. package/dist/migrations/0231_remove_app_connection_wide_includes.sql +10 -0
  403. package/dist/migrations/0232_fixed_hannibal_king.sql +202 -0
  404. package/dist/migrations/0233_living_dreaming_celestial.sql +13 -0
  405. package/dist/migrations/0234_provider_trace_records.sql +31 -0
  406. package/dist/migrations/0235_heartbeat_run_event_sequence_uniqueness.sql +28 -0
  407. package/dist/migrations/0236_remove_cheap_model_profiles.sql +108 -0
  408. package/dist/migrations/0237_clammy_colonel_america.sql +52 -0
  409. package/dist/migrations/0238_graceful_infant_terrible.sql +7 -0
  410. package/dist/migrations/0239_sturdy_santa_claus.sql +38 -0
  411. package/dist/migrations/0240_pink_fantastic_four.sql +25 -0
  412. package/dist/migrations/0241_conscious_adam_destine.sql +1 -0
  413. package/dist/migrations/0242_wide_lightspeed.sql +1 -0
  414. package/dist/migrations/0243_sleepy_metal_master.sql +1 -0
  415. package/dist/migrations/0244_organic_meltdown.sql +1 -0
  416. package/dist/migrations/0245_misty_nightshade.sql +3 -0
  417. package/dist/migrations/0246_nostalgic_medusa.sql +19 -0
  418. package/dist/migrations/0247_even_moon_knight.sql +2 -0
  419. package/dist/migrations/0248_small_manta.sql +36 -0
  420. package/dist/migrations/0249_fast_silverclaw.sql +33 -0
  421. package/dist/migrations/0250_exotic_dakota_north.sql +2 -0
  422. package/dist/migrations/0251_narrow_mastermind.sql +1 -0
  423. package/dist/migrations/0252_friendly_kate_bishop.sql +1 -0
  424. package/dist/migrations/0253_real_firebrand.sql +1 -0
  425. package/dist/migrations/0254_military_calypso.sql +3 -0
  426. package/dist/migrations/0255_previous_captain_america.sql +290 -0
  427. package/dist/migrations/0256_married_king_cobra.sql +3 -0
  428. package/dist/migrations/0257_bizarre_the_hunter.sql +8 -0
  429. package/dist/migrations/0258_typical_sauron.sql +2 -0
  430. package/dist/migrations/0259_tan_chat.sql +1 -0
  431. package/dist/migrations/0260_chat_interaction_wakeup_idempotency.sql +106 -0
  432. package/dist/migrations/0261_faulty_iceman.sql +4 -0
  433. package/dist/migrations/0262_lying_avengers.sql +3 -0
  434. package/dist/migrations/0263_nebulous_iron_lad.sql +3 -0
  435. package/dist/migrations/0264_cynical_hellcat.sql +3 -0
  436. package/dist/migrations/0265_chat_interaction_wakeup_provenance.sql +80 -0
  437. package/dist/migrations/0266_brave_living_mummy.sql +56 -0
  438. package/dist/migrations/0267_warm_wild_child.sql +8 -0
  439. package/dist/migrations/0268_lively_runaways.sql +1 -0
  440. package/dist/migrations/0269_fearless_young_avengers.sql +15 -0
  441. package/dist/migrations/0270_harsh_queen_noir.sql +12 -0
  442. package/dist/migrations/0271_woozy_silver_surfer.sql +1 -0
  443. package/dist/migrations/0272_light_kate_bishop.sql +98 -0
  444. package/dist/migrations/0273_aromatic_moondragon.sql +3 -0
  445. package/dist/migrations/0274_agent_chat.sql +33 -0
  446. package/dist/migrations/0275_easy_dragon_man.sql +5 -0
  447. package/dist/migrations/0276_hard_mandroid.sql +77 -0
  448. package/dist/migrations/0277_uneven_lady_deathstrike.sql +47 -0
  449. package/dist/migrations/0278_nappy_colonel_america.sql +6 -0
  450. package/dist/migrations/0279_tired_deathstrike.sql +3 -0
  451. package/dist/migrations/0280_unique_genesis.sql +11 -0
  452. package/dist/migrations/0281_true_boom_boom.sql +14 -0
  453. package/dist/migrations/0282_colossal_shocker.sql +2 -0
  454. package/dist/migrations/0283_jittery_psynapse.sql +81 -0
  455. package/dist/migrations/meta/_journal.json +1980 -0
  456. package/dist/native-runner-recovery-migration.test.d.ts +2 -0
  457. package/dist/native-runner-recovery-migration.test.d.ts.map +1 -0
  458. package/dist/native-runner-recovery-migration.test.js +121 -0
  459. package/dist/native-runner-recovery-migration.test.js.map +1 -0
  460. package/dist/nested-skill-folders-migration.test.d.ts +2 -0
  461. package/dist/nested-skill-folders-migration.test.d.ts.map +1 -0
  462. package/dist/nested-skill-folders-migration.test.js +106 -0
  463. package/dist/nested-skill-folders-migration.test.js.map +1 -0
  464. package/dist/pipelines-schema.test.d.ts +2 -0
  465. package/dist/pipelines-schema.test.d.ts.map +1 -0
  466. package/dist/pipelines-schema.test.js +205 -0
  467. package/dist/pipelines-schema.test.js.map +1 -0
  468. package/dist/postgres-connection-recovery.test.d.ts +2 -0
  469. package/dist/postgres-connection-recovery.test.d.ts.map +1 -0
  470. package/dist/postgres-connection-recovery.test.js +35 -0
  471. package/dist/postgres-connection-recovery.test.js.map +1 -0
  472. package/dist/question-response-delivery-migration.test.d.ts +2 -0
  473. package/dist/question-response-delivery-migration.test.d.ts.map +1 -0
  474. package/dist/question-response-delivery-migration.test.js +62 -0
  475. package/dist/question-response-delivery-migration.test.js.map +1 -0
  476. package/dist/run-event-payload.d.ts +30 -0
  477. package/dist/run-event-payload.d.ts.map +1 -0
  478. package/dist/run-event-payload.js +57 -0
  479. package/dist/run-event-payload.js.map +1 -0
  480. package/dist/run-event-payload.test.d.ts +2 -0
  481. package/dist/run-event-payload.test.d.ts.map +1 -0
  482. package/dist/run-event-payload.test.js +46 -0
  483. package/dist/run-event-payload.test.js.map +1 -0
  484. package/dist/run-identity-migration.test.d.ts +2 -0
  485. package/dist/run-identity-migration.test.d.ts.map +1 -0
  486. package/dist/run-identity-migration.test.js +60 -0
  487. package/dist/run-identity-migration.test.js.map +1 -0
  488. package/dist/runtime-config.d.ts +16 -0
  489. package/dist/runtime-config.d.ts.map +1 -0
  490. package/dist/runtime-config.js +168 -0
  491. package/dist/runtime-config.js.map +1 -0
  492. package/dist/runtime-config.test.d.ts +2 -0
  493. package/dist/runtime-config.test.d.ts.map +1 -0
  494. package/dist/runtime-config.test.js +111 -0
  495. package/dist/runtime-config.test.js.map +1 -0
  496. package/dist/schema/activity_log.d.ts +214 -0
  497. package/dist/schema/activity_log.d.ts.map +1 -0
  498. package/dist/schema/activity_log.js +25 -0
  499. package/dist/schema/activity_log.js.map +1 -0
  500. package/dist/schema/adapter_auth_sessions.d.ts +377 -0
  501. package/dist/schema/adapter_auth_sessions.d.ts.map +1 -0
  502. package/dist/schema/adapter_auth_sessions.js +88 -0
  503. package/dist/schema/adapter_auth_sessions.js.map +1 -0
  504. package/dist/schema/agent_api_keys.d.ts +204 -0
  505. package/dist/schema/agent_api_keys.d.ts.map +1 -0
  506. package/dist/schema/agent_api_keys.js +19 -0
  507. package/dist/schema/agent_api_keys.js.map +1 -0
  508. package/dist/schema/agent_config_revisions.d.ts +201 -0
  509. package/dist/schema/agent_config_revisions.d.ts.map +1 -0
  510. package/dist/schema/agent_config_revisions.js +20 -0
  511. package/dist/schema/agent_config_revisions.js.map +1 -0
  512. package/dist/schema/agent_memberships.d.ts +144 -0
  513. package/dist/schema/agent_memberships.d.ts.map +1 -0
  514. package/dist/schema/agent_memberships.js +19 -0
  515. package/dist/schema/agent_memberships.js.map +1 -0
  516. package/dist/schema/agent_runtime_state.d.ts +248 -0
  517. package/dist/schema/agent_runtime_state.d.ts.map +1 -0
  518. package/dist/schema/agent_runtime_state.js +23 -0
  519. package/dist/schema/agent_runtime_state.js.map +1 -0
  520. package/dist/schema/agent_task_sessions.d.ts +569 -0
  521. package/dist/schema/agent_task_sessions.d.ts.map +1 -0
  522. package/dist/schema/agent_task_sessions.js +51 -0
  523. package/dist/schema/agent_task_sessions.js.map +1 -0
  524. package/dist/schema/agent_wakeup_requests.d.ts +333 -0
  525. package/dist/schema/agent_wakeup_requests.d.ts.map +1 -0
  526. package/dist/schema/agent_wakeup_requests.js +56 -0
  527. package/dist/schema/agent_wakeup_requests.js.map +1 -0
  528. package/dist/schema/agents.d.ts +434 -0
  529. package/dist/schema/agents.d.ts.map +1 -0
  530. package/dist/schema/agents.js +35 -0
  531. package/dist/schema/agents.js.map +1 -0
  532. package/dist/schema/ai_connection_defaults.d.ts +132 -0
  533. package/dist/schema/ai_connection_defaults.d.ts.map +1 -0
  534. package/dist/schema/ai_connection_defaults.js +28 -0
  535. package/dist/schema/ai_connection_defaults.js.map +1 -0
  536. package/dist/schema/ai_provider_defaults.d.ts +114 -0
  537. package/dist/schema/ai_provider_defaults.d.ts.map +1 -0
  538. package/dist/schema/ai_provider_defaults.js +19 -0
  539. package/dist/schema/ai_provider_defaults.js.map +1 -0
  540. package/dist/schema/announcement_dismissals.d.ts +83 -0
  541. package/dist/schema/announcement_dismissals.d.ts.map +1 -0
  542. package/dist/schema/announcement_dismissals.js +15 -0
  543. package/dist/schema/announcement_dismissals.js.map +1 -0
  544. package/dist/schema/approval_comments.d.ts +144 -0
  545. package/dist/schema/approval_comments.d.ts.map +1 -0
  546. package/dist/schema/approval_comments.js +19 -0
  547. package/dist/schema/approval_comments.js.map +1 -0
  548. package/dist/schema/approvals.d.ts +214 -0
  549. package/dist/schema/approvals.d.ts.map +1 -0
  550. package/dist/schema/approvals.js +20 -0
  551. package/dist/schema/approvals.js.map +1 -0
  552. package/dist/schema/assets.d.ts +212 -0
  553. package/dist/schema/assets.d.ts.map +1 -0
  554. package/dist/schema/assets.js +22 -0
  555. package/dist/schema/assets.js.map +1 -0
  556. package/dist/schema/auth.d.ts +638 -0
  557. package/dist/schema/auth.d.ts.map +1 -0
  558. package/dist/schema/auth.js +61 -0
  559. package/dist/schema/auth.js.map +1 -0
  560. package/dist/schema/board_api_keys.d.ts +144 -0
  561. package/dist/schema/board_api_keys.d.ts.map +1 -0
  562. package/dist/schema/board_api_keys.js +16 -0
  563. package/dist/schema/board_api_keys.js.map +1 -0
  564. package/dist/schema/budget_incidents.d.ts +297 -0
  565. package/dist/schema/budget_incidents.d.ts.map +1 -0
  566. package/dist/schema/budget_incidents.js +29 -0
  567. package/dist/schema/budget_incidents.js.map +1 -0
  568. package/dist/schema/budget_policies.d.ts +263 -0
  569. package/dist/schema/budget_policies.d.ts.map +1 -0
  570. package/dist/schema/budget_policies.js +24 -0
  571. package/dist/schema/budget_policies.js.map +1 -0
  572. package/dist/schema/built_in_managed_resources.d.ts +197 -0
  573. package/dist/schema/built_in_managed_resources.d.ts.map +1 -0
  574. package/dist/schema/built_in_managed_resources.js +22 -0
  575. package/dist/schema/built_in_managed_resources.js.map +1 -0
  576. package/dist/schema/cases.d.ts +982 -0
  577. package/dist/schema/cases.d.ts.map +1 -0
  578. package/dist/schema/cases.js +122 -0
  579. package/dist/schema/cases.js.map +1 -0
  580. package/dist/schema/chat_channels.d.ts +3035 -0
  581. package/dist/schema/chat_channels.d.ts.map +1 -0
  582. package/dist/schema/chat_channels.js +605 -0
  583. package/dist/schema/chat_channels.js.map +1 -0
  584. package/dist/schema/chat_discord_command_owners.d.ts +93 -0
  585. package/dist/schema/chat_discord_command_owners.d.ts.map +1 -0
  586. package/dist/schema/chat_discord_command_owners.js +19 -0
  587. package/dist/schema/chat_discord_command_owners.js.map +1 -0
  588. package/dist/schema/chat_github.d.ts +730 -0
  589. package/dist/schema/chat_github.d.ts.map +1 -0
  590. package/dist/schema/chat_github.js +110 -0
  591. package/dist/schema/chat_github.js.map +1 -0
  592. package/dist/schema/chat_teams_file_transfers.d.ts +639 -0
  593. package/dist/schema/chat_teams_file_transfers.d.ts.map +1 -0
  594. package/dist/schema/chat_teams_file_transfers.js +86 -0
  595. package/dist/schema/chat_teams_file_transfers.js.map +1 -0
  596. package/dist/schema/chat_telegram_draft_ids.d.ts +2 -0
  597. package/dist/schema/chat_telegram_draft_ids.d.ts.map +1 -0
  598. package/dist/schema/chat_telegram_draft_ids.js +14 -0
  599. package/dist/schema/chat_telegram_draft_ids.js.map +1 -0
  600. package/dist/schema/cli_auth_challenges.d.ts +263 -0
  601. package/dist/schema/cli_auth_challenges.d.ts.map +1 -0
  602. package/dist/schema/cli_auth_challenges.js +26 -0
  603. package/dist/schema/cli_auth_challenges.js.map +1 -0
  604. package/dist/schema/companies.d.ts +333 -0
  605. package/dist/schema/companies.d.ts.map +1 -0
  606. package/dist/schema/companies.js +32 -0
  607. package/dist/schema/companies.js.map +1 -0
  608. package/dist/schema/company_logos.d.ts +93 -0
  609. package/dist/schema/company_logos.d.ts.map +1 -0
  610. package/dist/schema/company_logos.js +14 -0
  611. package/dist/schema/company_logos.js.map +1 -0
  612. package/dist/schema/company_memberships.d.ts +144 -0
  613. package/dist/schema/company_memberships.d.ts.map +1 -0
  614. package/dist/schema/company_memberships.js +17 -0
  615. package/dist/schema/company_memberships.js.map +1 -0
  616. package/dist/schema/company_onboarding_seeds.d.ts +257 -0
  617. package/dist/schema/company_onboarding_seeds.d.ts.map +1 -0
  618. package/dist/schema/company_onboarding_seeds.js +35 -0
  619. package/dist/schema/company_onboarding_seeds.js.map +1 -0
  620. package/dist/schema/company_secret_bindings.d.ts +229 -0
  621. package/dist/schema/company_secret_bindings.d.ts.map +1 -0
  622. package/dist/schema/company_secret_bindings.js +24 -0
  623. package/dist/schema/company_secret_bindings.js.map +1 -0
  624. package/dist/schema/company_secret_proposals.d.ts +575 -0
  625. package/dist/schema/company_secret_proposals.d.ts.map +1 -0
  626. package/dist/schema/company_secret_proposals.js +69 -0
  627. package/dist/schema/company_secret_proposals.js.map +1 -0
  628. package/dist/schema/company_secret_provider_configs.d.ts +284 -0
  629. package/dist/schema/company_secret_provider_configs.d.ts.map +1 -0
  630. package/dist/schema/company_secret_provider_configs.js +29 -0
  631. package/dist/schema/company_secret_provider_configs.js.map +1 -0
  632. package/dist/schema/company_secret_versions.d.ts +231 -0
  633. package/dist/schema/company_secret_versions.d.ts.map +1 -0
  634. package/dist/schema/company_secret_versions.js +24 -0
  635. package/dist/schema/company_secret_versions.js.map +1 -0
  636. package/dist/schema/company_secrets.d.ts +384 -0
  637. package/dist/schema/company_secrets.d.ts.map +1 -0
  638. package/dist/schema/company_secrets.js +56 -0
  639. package/dist/schema/company_secrets.js.map +1 -0
  640. package/dist/schema/company_skill_policies.d.ts +131 -0
  641. package/dist/schema/company_skill_policies.d.ts.map +1 -0
  642. package/dist/schema/company_skill_policies.js +12 -0
  643. package/dist/schema/company_skill_policies.js.map +1 -0
  644. package/dist/schema/company_skills.d.ts +1858 -0
  645. package/dist/schema/company_skills.d.ts.map +1 -0
  646. package/dist/schema/company_skills.js +157 -0
  647. package/dist/schema/company_skills.js.map +1 -0
  648. package/dist/schema/company_transfer_runs.d.ts +297 -0
  649. package/dist/schema/company_transfer_runs.d.ts.map +1 -0
  650. package/dist/schema/company_transfer_runs.js +42 -0
  651. package/dist/schema/company_transfer_runs.js.map +1 -0
  652. package/dist/schema/company_user_sidebar_preferences.d.ts +112 -0
  653. package/dist/schema/company_user_sidebar_preferences.d.ts.map +1 -0
  654. package/dist/schema/company_user_sidebar_preferences.js +15 -0
  655. package/dist/schema/company_user_sidebar_preferences.js.map +1 -0
  656. package/dist/schema/completion_contracts.d.ts +265 -0
  657. package/dist/schema/completion_contracts.d.ts.map +1 -0
  658. package/dist/schema/completion_contracts.js +35 -0
  659. package/dist/schema/completion_contracts.js.map +1 -0
  660. package/dist/schema/connection_event_deliveries.d.ts +291 -0
  661. package/dist/schema/connection_event_deliveries.d.ts.map +1 -0
  662. package/dist/schema/connection_event_deliveries.js +31 -0
  663. package/dist/schema/connection_event_deliveries.js.map +1 -0
  664. package/dist/schema/connection_intent_deliveries.d.ts +94 -0
  665. package/dist/schema/connection_intent_deliveries.d.ts.map +1 -0
  666. package/dist/schema/connection_intent_deliveries.js +12 -0
  667. package/dist/schema/connection_intent_deliveries.js.map +1 -0
  668. package/dist/schema/cost_events.d.ts +331 -0
  669. package/dist/schema/cost_events.d.ts.map +1 -0
  670. package/dist/schema/cost_events.js +35 -0
  671. package/dist/schema/cost_events.js.map +1 -0
  672. package/dist/schema/decision_queues.d.ts +1510 -0
  673. package/dist/schema/decision_queues.d.ts.map +1 -0
  674. package/dist/schema/decision_queues.js +161 -0
  675. package/dist/schema/decision_queues.js.map +1 -0
  676. package/dist/schema/decision_training_examples.d.ts +255 -0
  677. package/dist/schema/decision_training_examples.d.ts.map +1 -0
  678. package/dist/schema/decision_training_examples.js +27 -0
  679. package/dist/schema/decision_training_examples.js.map +1 -0
  680. package/dist/schema/decisions.d.ts +824 -0
  681. package/dist/schema/decisions.d.ts.map +1 -0
  682. package/dist/schema/decisions.js +78 -0
  683. package/dist/schema/decisions.js.map +1 -0
  684. package/dist/schema/document_annotation_anchor_snapshots.d.ts +255 -0
  685. package/dist/schema/document_annotation_anchor_snapshots.d.ts.map +1 -0
  686. package/dist/schema/document_annotation_anchor_snapshots.js +25 -0
  687. package/dist/schema/document_annotation_anchor_snapshots.js.map +1 -0
  688. package/dist/schema/document_annotation_comments.d.ts +285 -0
  689. package/dist/schema/document_annotation_comments.d.ts.map +1 -0
  690. package/dist/schema/document_annotation_comments.js +39 -0
  691. package/dist/schema/document_annotation_comments.js.map +1 -0
  692. package/dist/schema/document_annotation_threads.d.ts +510 -0
  693. package/dist/schema/document_annotation_threads.d.ts.map +1 -0
  694. package/dist/schema/document_annotation_threads.js +52 -0
  695. package/dist/schema/document_annotation_threads.js.map +1 -0
  696. package/dist/schema/document_memberships.d.ts +127 -0
  697. package/dist/schema/document_memberships.d.ts.map +1 -0
  698. package/dist/schema/document_memberships.js +16 -0
  699. package/dist/schema/document_memberships.js.map +1 -0
  700. package/dist/schema/document_revisions.d.ts +212 -0
  701. package/dist/schema/document_revisions.d.ts.map +1 -0
  702. package/dist/schema/document_revisions.js +23 -0
  703. package/dist/schema/document_revisions.js.map +1 -0
  704. package/dist/schema/documents.d.ts +300 -0
  705. package/dist/schema/documents.d.ts.map +1 -0
  706. package/dist/schema/documents.js +28 -0
  707. package/dist/schema/documents.js.map +1 -0
  708. package/dist/schema/email.d.ts +550 -0
  709. package/dist/schema/email.d.ts.map +1 -0
  710. package/dist/schema/email.js +80 -0
  711. package/dist/schema/email.js.map +1 -0
  712. package/dist/schema/environment_custom_image_setup_sessions.d.ts +351 -0
  713. package/dist/schema/environment_custom_image_setup_sessions.d.ts.map +1 -0
  714. package/dist/schema/environment_custom_image_setup_sessions.js +39 -0
  715. package/dist/schema/environment_custom_image_setup_sessions.js.map +1 -0
  716. package/dist/schema/environment_custom_image_templates.d.ts +284 -0
  717. package/dist/schema/environment_custom_image_templates.d.ts.map +1 -0
  718. package/dist/schema/environment_custom_image_templates.js +32 -0
  719. package/dist/schema/environment_custom_image_templates.js.map +1 -0
  720. package/dist/schema/environment_leases.d.ts +333 -0
  721. package/dist/schema/environment_leases.d.ts.map +1 -0
  722. package/dist/schema/environment_leases.js +42 -0
  723. package/dist/schema/environment_leases.js.map +1 -0
  724. package/dist/schema/environments.d.ts +184 -0
  725. package/dist/schema/environments.d.ts.map +1 -0
  726. package/dist/schema/environments.js +24 -0
  727. package/dist/schema/environments.js.map +1 -0
  728. package/dist/schema/execution_workspace_runtime_leases.d.ts +248 -0
  729. package/dist/schema/execution_workspace_runtime_leases.d.ts.map +1 -0
  730. package/dist/schema/execution_workspace_runtime_leases.js +35 -0
  731. package/dist/schema/execution_workspace_runtime_leases.js.map +1 -0
  732. package/dist/schema/execution_workspaces.d.ts +418 -0
  733. package/dist/schema/execution_workspaces.d.ts.map +1 -0
  734. package/dist/schema/execution_workspaces.js +39 -0
  735. package/dist/schema/execution_workspaces.js.map +1 -0
  736. package/dist/schema/external_object_mentions.d.ts +337 -0
  737. package/dist/schema/external_object_mentions.d.ts.map +1 -0
  738. package/dist/schema/external_object_mentions.js +34 -0
  739. package/dist/schema/external_object_mentions.js.map +1 -0
  740. package/dist/schema/external_objects.d.ts +543 -0
  741. package/dist/schema/external_objects.d.ts.map +1 -0
  742. package/dist/schema/external_objects.js +43 -0
  743. package/dist/schema/external_objects.js.map +1 -0
  744. package/dist/schema/feedback_exports.d.ts +450 -0
  745. package/dist/schema/feedback_exports.d.ts.map +1 -0
  746. package/dist/schema/feedback_exports.js +41 -0
  747. package/dist/schema/feedback_exports.js.map +1 -0
  748. package/dist/schema/feedback_votes.d.ts +246 -0
  749. package/dist/schema/feedback_votes.d.ts.map +1 -0
  750. package/dist/schema/feedback_votes.js +25 -0
  751. package/dist/schema/feedback_votes.js.map +1 -0
  752. package/dist/schema/finance_events.d.ts +469 -0
  753. package/dist/schema/finance_events.d.ts.map +1 -0
  754. package/dist/schema/finance_events.js +45 -0
  755. package/dist/schema/finance_events.js.map +1 -0
  756. package/dist/schema/folders.d.ts +198 -0
  757. package/dist/schema/folders.d.ts.map +1 -0
  758. package/dist/schema/folders.js +29 -0
  759. package/dist/schema/folders.js.map +1 -0
  760. package/dist/schema/goals.d.ts +178 -0
  761. package/dist/schema/goals.d.ts.map +1 -0
  762. package/dist/schema/goals.js +18 -0
  763. package/dist/schema/goals.js.map +1 -0
  764. package/dist/schema/heartbeat_run_events.d.ts +299 -0
  765. package/dist/schema/heartbeat_run_events.d.ts.map +1 -0
  766. package/dist/schema/heartbeat_run_events.js +36 -0
  767. package/dist/schema/heartbeat_run_events.js.map +1 -0
  768. package/dist/schema/heartbeat_run_watchdog_decisions.d.ts +195 -0
  769. package/dist/schema/heartbeat_run_watchdog_decisions.d.ts.map +1 -0
  770. package/dist/schema/heartbeat_run_watchdog_decisions.js +22 -0
  771. package/dist/schema/heartbeat_run_watchdog_decisions.js.map +1 -0
  772. package/dist/schema/heartbeat_runs.d.ts +1206 -0
  773. package/dist/schema/heartbeat_runs.d.ts.map +1 -0
  774. package/dist/schema/heartbeat_runs.js +103 -0
  775. package/dist/schema/heartbeat_runs.js.map +1 -0
  776. package/dist/schema/inbox_dismissals.d.ts +163 -0
  777. package/dist/schema/inbox_dismissals.d.ts.map +1 -0
  778. package/dist/schema/inbox_dismissals.js +18 -0
  779. package/dist/schema/inbox_dismissals.js.map +1 -0
  780. package/dist/schema/index.d.ts +138 -0
  781. package/dist/schema/index.d.ts.map +1 -0
  782. package/dist/schema/index.js +138 -0
  783. package/dist/schema/index.js.map +1 -0
  784. package/dist/schema/instance_settings.d.ts +131 -0
  785. package/dist/schema/instance_settings.d.ts.map +1 -0
  786. package/dist/schema/instance_settings.js +14 -0
  787. package/dist/schema/instance_settings.js.map +1 -0
  788. package/dist/schema/instance_user_roles.d.ts +93 -0
  789. package/dist/schema/instance_user_roles.d.ts.map +1 -0
  790. package/dist/schema/instance_user_roles.js +12 -0
  791. package/dist/schema/instance_user_roles.js.map +1 -0
  792. package/dist/schema/invites.d.ts +214 -0
  793. package/dist/schema/invites.d.ts.map +1 -0
  794. package/dist/schema/invites.js +20 -0
  795. package/dist/schema/invites.js.map +1 -0
  796. package/dist/schema/issue_approvals.d.ts +110 -0
  797. package/dist/schema/issue_approvals.d.ts.map +1 -0
  798. package/dist/schema/issue_approvals.js +19 -0
  799. package/dist/schema/issue_approvals.js.map +1 -0
  800. package/dist/schema/issue_attachments.d.ts +144 -0
  801. package/dist/schema/issue_attachments.d.ts.map +1 -0
  802. package/dist/schema/issue_attachments.js +24 -0
  803. package/dist/schema/issue_attachments.js.map +1 -0
  804. package/dist/schema/issue_comments.d.ts +429 -0
  805. package/dist/schema/issue_comments.d.ts.map +1 -0
  806. package/dist/schema/issue_comments.js +45 -0
  807. package/dist/schema/issue_comments.js.map +1 -0
  808. package/dist/schema/issue_create_idempotency_keys.d.ts +93 -0
  809. package/dist/schema/issue_create_idempotency_keys.d.ts.map +1 -0
  810. package/dist/schema/issue_create_idempotency_keys.js +15 -0
  811. package/dist/schema/issue_create_idempotency_keys.js.map +1 -0
  812. package/dist/schema/issue_documents.d.ts +127 -0
  813. package/dist/schema/issue_documents.d.ts.map +1 -0
  814. package/dist/schema/issue_documents.js +18 -0
  815. package/dist/schema/issue_documents.js.map +1 -0
  816. package/dist/schema/issue_execution_decisions.d.ts +212 -0
  817. package/dist/schema/issue_execution_decisions.d.ts.map +1 -0
  818. package/dist/schema/issue_execution_decisions.js +23 -0
  819. package/dist/schema/issue_execution_decisions.js.map +1 -0
  820. package/dist/schema/issue_inbox_archives.d.ts +180 -0
  821. package/dist/schema/issue_inbox_archives.d.ts.map +1 -0
  822. package/dist/schema/issue_inbox_archives.js +25 -0
  823. package/dist/schema/issue_inbox_archives.js.map +1 -0
  824. package/dist/schema/issue_labels.d.ts +76 -0
  825. package/dist/schema/issue_labels.d.ts.map +1 -0
  826. package/dist/schema/issue_labels.js +16 -0
  827. package/dist/schema/issue_labels.js.map +1 -0
  828. package/dist/schema/issue_plan_decompositions.d.ts +284 -0
  829. package/dist/schema/issue_plan_decompositions.d.ts.map +1 -0
  830. package/dist/schema/issue_plan_decompositions.js +36 -0
  831. package/dist/schema/issue_plan_decompositions.js.map +1 -0
  832. package/dist/schema/issue_question_response_deliveries.d.ts +320 -0
  833. package/dist/schema/issue_question_response_deliveries.d.ts.map +1 -0
  834. package/dist/schema/issue_question_response_deliveries.js +42 -0
  835. package/dist/schema/issue_question_response_deliveries.js.map +1 -0
  836. package/dist/schema/issue_read_states.d.ts +127 -0
  837. package/dist/schema/issue_read_states.d.ts.map +1 -0
  838. package/dist/schema/issue_read_states.js +17 -0
  839. package/dist/schema/issue_read_states.js.map +1 -0
  840. package/dist/schema/issue_recovery_actions.d.ts +456 -0
  841. package/dist/schema/issue_recovery_actions.d.ts.map +1 -0
  842. package/dist/schema/issue_recovery_actions.js +44 -0
  843. package/dist/schema/issue_recovery_actions.js.map +1 -0
  844. package/dist/schema/issue_reference_mentions.d.ts +180 -0
  845. package/dist/schema/issue_reference_mentions.d.ts.map +1 -0
  846. package/dist/schema/issue_reference_mentions.js +23 -0
  847. package/dist/schema/issue_reference_mentions.js.map +1 -0
  848. package/dist/schema/issue_relations.d.ts +163 -0
  849. package/dist/schema/issue_relations.d.ts.map +1 -0
  850. package/dist/schema/issue_relations.js +21 -0
  851. package/dist/schema/issue_relations.js.map +1 -0
  852. package/dist/schema/issue_thread_interactions.d.ts +516 -0
  853. package/dist/schema/issue_thread_interactions.d.ts.map +1 -0
  854. package/dist/schema/issue_thread_interactions.js +61 -0
  855. package/dist/schema/issue_thread_interactions.js.map +1 -0
  856. package/dist/schema/issue_tree_hold_members.d.ts +280 -0
  857. package/dist/schema/issue_tree_hold_members.d.ts.map +1 -0
  858. package/dist/schema/issue_tree_hold_members.js +29 -0
  859. package/dist/schema/issue_tree_hold_members.js.map +1 -0
  860. package/dist/schema/issue_tree_holds.d.ts +352 -0
  861. package/dist/schema/issue_tree_holds.d.ts.map +1 -0
  862. package/dist/schema/issue_tree_holds.js +31 -0
  863. package/dist/schema/issue_tree_holds.js.map +1 -0
  864. package/dist/schema/issue_watchdogs.d.ts +382 -0
  865. package/dist/schema/issue_watchdogs.d.ts.map +1 -0
  866. package/dist/schema/issue_watchdogs.js +38 -0
  867. package/dist/schema/issue_watchdogs.js.map +1 -0
  868. package/dist/schema/issue_work_products.d.ts +370 -0
  869. package/dist/schema/issue_work_products.d.ts.map +1 -0
  870. package/dist/schema/issue_work_products.js +38 -0
  871. package/dist/schema/issue_work_products.js.map +1 -0
  872. package/dist/schema/issues.d.ts +1062 -0
  873. package/dist/schema/issues.d.ts.map +1 -0
  874. package/dist/schema/issues.js +158 -0
  875. package/dist/schema/issues.js.map +1 -0
  876. package/dist/schema/join_requests.d.ts +384 -0
  877. package/dist/schema/join_requests.d.ts.map +1 -0
  878. package/dist/schema/join_requests.js +39 -0
  879. package/dist/schema/join_requests.js.map +1 -0
  880. package/dist/schema/labels.d.ts +110 -0
  881. package/dist/schema/labels.d.ts.map +1 -0
  882. package/dist/schema/labels.js +14 -0
  883. package/dist/schema/labels.js.map +1 -0
  884. package/dist/schema/managed_agent_profiles.d.ts +339 -0
  885. package/dist/schema/managed_agent_profiles.d.ts.map +1 -0
  886. package/dist/schema/managed_agent_profiles.js +44 -0
  887. package/dist/schema/managed_agent_profiles.js.map +1 -0
  888. package/dist/schema/native_run_finalizations.d.ts +403 -0
  889. package/dist/schema/native_run_finalizations.d.ts.map +1 -0
  890. package/dist/schema/native_run_finalizations.js +91 -0
  891. package/dist/schema/native_run_finalizations.js.map +1 -0
  892. package/dist/schema/native_run_results.d.ts +248 -0
  893. package/dist/schema/native_run_results.d.ts.map +1 -0
  894. package/dist/schema/native_run_results.js +56 -0
  895. package/dist/schema/native_run_results.js.map +1 -0
  896. package/dist/schema/pipeline_case_events.d.ts +231 -0
  897. package/dist/schema/pipeline_case_events.d.ts.map +1 -0
  898. package/dist/schema/pipeline_case_events.js +52 -0
  899. package/dist/schema/pipeline_case_events.js.map +1 -0
  900. package/dist/schema/pipeline_cases.d.ts +1388 -0
  901. package/dist/schema/pipeline_cases.d.ts.map +1 -0
  902. package/dist/schema/pipeline_cases.js +138 -0
  903. package/dist/schema/pipeline_cases.js.map +1 -0
  904. package/dist/schema/pipelines.d.ts +500 -0
  905. package/dist/schema/pipelines.d.ts.map +1 -0
  906. package/dist/schema/pipelines.js +52 -0
  907. package/dist/schema/pipelines.js.map +1 -0
  908. package/dist/schema/plugin_company_settings.d.ts +159 -0
  909. package/dist/schema/plugin_company_settings.d.ts.map +1 -0
  910. package/dist/schema/plugin_company_settings.js +35 -0
  911. package/dist/schema/plugin_company_settings.js.map +1 -0
  912. package/dist/schema/plugin_config.d.ts +139 -0
  913. package/dist/schema/plugin_config.d.ts.map +1 -0
  914. package/dist/schema/plugin_config.js +29 -0
  915. package/dist/schema/plugin_config.js.map +1 -0
  916. package/dist/schema/plugin_database.d.ts +357 -0
  917. package/dist/schema/plugin_database.d.ts.map +1 -0
  918. package/dist/schema/plugin_database.js +51 -0
  919. package/dist/schema/plugin_database.js.map +1 -0
  920. package/dist/schema/plugin_entities.d.ts +230 -0
  921. package/dist/schema/plugin_entities.d.ts.map +1 -0
  922. package/dist/schema/plugin_entities.js +52 -0
  923. package/dist/schema/plugin_entities.js.map +1 -0
  924. package/dist/schema/plugin_jobs.d.ts +409 -0
  925. package/dist/schema/plugin_jobs.d.ts.map +1 -0
  926. package/dist/schema/plugin_jobs.js +87 -0
  927. package/dist/schema/plugin_jobs.js.map +1 -0
  928. package/dist/schema/plugin_logs.d.ts +142 -0
  929. package/dist/schema/plugin_logs.d.ts.map +1 -0
  930. package/dist/schema/plugin_logs.js +33 -0
  931. package/dist/schema/plugin_logs.js.map +1 -0
  932. package/dist/schema/plugin_managed_resources.d.ts +180 -0
  933. package/dist/schema/plugin_managed_resources.d.ts.map +1 -0
  934. package/dist/schema/plugin_managed_resources.js +25 -0
  935. package/dist/schema/plugin_managed_resources.js.map +1 -0
  936. package/dist/schema/plugin_state.d.ts +169 -0
  937. package/dist/schema/plugin_state.d.ts.map +1 -0
  938. package/dist/schema/plugin_state.js +68 -0
  939. package/dist/schema/plugin_state.js.map +1 -0
  940. package/dist/schema/plugin_webhooks.d.ts +256 -0
  941. package/dist/schema/plugin_webhooks.d.ts.map +1 -0
  942. package/dist/schema/plugin_webhooks.js +56 -0
  943. package/dist/schema/plugin_webhooks.js.map +1 -0
  944. package/dist/schema/plugins.d.ts +246 -0
  945. package/dist/schema/plugins.d.ts.map +1 -0
  946. package/dist/schema/plugins.js +31 -0
  947. package/dist/schema/plugins.js.map +1 -0
  948. package/dist/schema/principal_permission_grants.d.ts +163 -0
  949. package/dist/schema/principal_permission_grants.d.ts.map +1 -0
  950. package/dist/schema/principal_permission_grants.js +17 -0
  951. package/dist/schema/principal_permission_grants.js.map +1 -0
  952. package/dist/schema/project_goals.d.ts +93 -0
  953. package/dist/schema/project_goals.d.ts.map +1 -0
  954. package/dist/schema/project_goals.js +17 -0
  955. package/dist/schema/project_goals.js.map +1 -0
  956. package/dist/schema/project_memberships.d.ts +144 -0
  957. package/dist/schema/project_memberships.d.ts.map +1 -0
  958. package/dist/schema/project_memberships.js +19 -0
  959. package/dist/schema/project_memberships.js.map +1 -0
  960. package/dist/schema/project_workspaces.d.ts +333 -0
  961. package/dist/schema/project_workspaces.d.ts.map +1 -0
  962. package/dist/schema/project_workspaces.js +32 -0
  963. package/dist/schema/project_workspaces.js.map +1 -0
  964. package/dist/schema/projects.d.ts +302 -0
  965. package/dist/schema/projects.d.ts.map +1 -0
  966. package/dist/schema/projects.js +26 -0
  967. package/dist/schema/projects.js.map +1 -0
  968. package/dist/schema/provider_trace_records.d.ts +264 -0
  969. package/dist/schema/provider_trace_records.d.ts.map +1 -0
  970. package/dist/schema/provider_trace_records.js +34 -0
  971. package/dist/schema/provider_trace_records.js.map +1 -0
  972. package/dist/schema/remote_agent_profiles.d.ts +238 -0
  973. package/dist/schema/remote_agent_profiles.d.ts.map +1 -0
  974. package/dist/schema/remote_agent_profiles.js +31 -0
  975. package/dist/schema/remote_agent_profiles.js.map +1 -0
  976. package/dist/schema/routine_documents.d.ts +127 -0
  977. package/dist/schema/routine_documents.d.ts.map +1 -0
  978. package/dist/schema/routine_documents.js +18 -0
  979. package/dist/schema/routine_documents.js.map +1 -0
  980. package/dist/schema/routines.d.ts +1611 -0
  981. package/dist/schema/routines.d.ts.map +1 -0
  982. package/dist/schema/routines.js +140 -0
  983. package/dist/schema/routines.js.map +1 -0
  984. package/dist/schema/run_identity_contexts.d.ts +248 -0
  985. package/dist/schema/run_identity_contexts.d.ts.map +1 -0
  986. package/dist/schema/run_identity_contexts.js +29 -0
  987. package/dist/schema/run_identity_contexts.js.map +1 -0
  988. package/dist/schema/secret_access_events.d.ts +382 -0
  989. package/dist/schema/secret_access_events.d.ts.map +1 -0
  990. package/dist/schema/secret_access_events.js +39 -0
  991. package/dist/schema/secret_access_events.js.map +1 -0
  992. package/dist/schema/smoke_lab.d.ts +367 -0
  993. package/dist/schema/smoke_lab.d.ts.map +1 -0
  994. package/dist/schema/smoke_lab.js +33 -0
  995. package/dist/schema/smoke_lab.js.map +1 -0
  996. package/dist/schema/status_cards.d.ts +949 -0
  997. package/dist/schema/status_cards.d.ts.map +1 -0
  998. package/dist/schema/status_cards.js +70 -0
  999. package/dist/schema/status_cards.js.map +1 -0
  1000. package/dist/schema/status_decision_effects.d.ts +299 -0
  1001. package/dist/schema/status_decision_effects.d.ts.map +1 -0
  1002. package/dist/schema/status_decision_effects.js +37 -0
  1003. package/dist/schema/status_decision_effects.js.map +1 -0
  1004. package/dist/schema/status_decisions.d.ts +282 -0
  1005. package/dist/schema/status_decisions.d.ts.map +1 -0
  1006. package/dist/schema/status_decisions.js +49 -0
  1007. package/dist/schema/status_decisions.js.map +1 -0
  1008. package/dist/schema/summary_slots.d.ts +252 -0
  1009. package/dist/schema/summary_slots.d.ts.map +1 -0
  1010. package/dist/schema/summary_slots.js +32 -0
  1011. package/dist/schema/summary_slots.js.map +1 -0
  1012. package/dist/schema/tool_access.d.ts +8382 -0
  1013. package/dist/schema/tool_access.d.ts.map +1 -0
  1014. package/dist/schema/tool_access.js +735 -0
  1015. package/dist/schema/tool_access.js.map +1 -0
  1016. package/dist/schema/tool_action_deliveries.d.ts +111 -0
  1017. package/dist/schema/tool_action_deliveries.d.ts.map +1 -0
  1018. package/dist/schema/tool_action_deliveries.js +27 -0
  1019. package/dist/schema/tool_action_deliveries.js.map +1 -0
  1020. package/dist/schema/user_inbox_agent_policies.d.ts +131 -0
  1021. package/dist/schema/user_inbox_agent_policies.d.ts.map +1 -0
  1022. package/dist/schema/user_inbox_agent_policies.js +17 -0
  1023. package/dist/schema/user_inbox_agent_policies.js.map +1 -0
  1024. package/dist/schema/user_secret_declarations.d.ts +229 -0
  1025. package/dist/schema/user_secret_declarations.d.ts.map +1 -0
  1026. package/dist/schema/user_secret_declarations.js +31 -0
  1027. package/dist/schema/user_secret_declarations.js.map +1 -0
  1028. package/dist/schema/user_secret_definitions.d.ts +316 -0
  1029. package/dist/schema/user_secret_definitions.d.ts.map +1 -0
  1030. package/dist/schema/user_secret_definitions.js +33 -0
  1031. package/dist/schema/user_secret_definitions.js.map +1 -0
  1032. package/dist/schema/user_sidebar_preferences.d.ts +95 -0
  1033. package/dist/schema/user_sidebar_preferences.d.ts.map +1 -0
  1034. package/dist/schema/user_sidebar_preferences.js +11 -0
  1035. package/dist/schema/user_sidebar_preferences.js.map +1 -0
  1036. package/dist/schema/work_assessments.d.ts +333 -0
  1037. package/dist/schema/work_assessments.d.ts.map +1 -0
  1038. package/dist/schema/work_assessments.js +67 -0
  1039. package/dist/schema/work_assessments.js.map +1 -0
  1040. package/dist/schema/workspace_operations.d.ts +384 -0
  1041. package/dist/schema/workspace_operations.d.ts.map +1 -0
  1042. package/dist/schema/workspace_operations.js +40 -0
  1043. package/dist/schema/workspace_operations.js.map +1 -0
  1044. package/dist/schema/workspace_runtime_services.d.ts +523 -0
  1045. package/dist/schema/workspace_runtime_services.d.ts.map +1 -0
  1046. package/dist/schema/workspace_runtime_services.js +53 -0
  1047. package/dist/schema/workspace_runtime_services.js.map +1 -0
  1048. package/dist/seed.d.ts +2 -0
  1049. package/dist/seed.d.ts.map +1 -0
  1050. package/dist/seed.js +91 -0
  1051. package/dist/seed.js.map +1 -0
  1052. package/dist/session-goal-migration.test.d.ts +2 -0
  1053. package/dist/session-goal-migration.test.d.ts.map +1 -0
  1054. package/dist/session-goal-migration.test.js +47 -0
  1055. package/dist/session-goal-migration.test.js.map +1 -0
  1056. package/dist/status-card-migrations.test.d.ts +2 -0
  1057. package/dist/status-card-migrations.test.d.ts.map +1 -0
  1058. package/dist/status-card-migrations.test.js +34 -0
  1059. package/dist/status-card-migrations.test.js.map +1 -0
  1060. package/dist/summary-slots-schema.test.d.ts +2 -0
  1061. package/dist/summary-slots-schema.test.d.ts.map +1 -0
  1062. package/dist/summary-slots-schema.test.js +62 -0
  1063. package/dist/summary-slots-schema.test.js.map +1 -0
  1064. package/dist/table-size-estimates.d.ts +366 -0
  1065. package/dist/table-size-estimates.d.ts.map +1 -0
  1066. package/dist/table-size-estimates.js +153 -0
  1067. package/dist/table-size-estimates.js.map +1 -0
  1068. package/dist/test-embedded-postgres.d.ts +37 -0
  1069. package/dist/test-embedded-postgres.d.ts.map +1 -0
  1070. package/dist/test-embedded-postgres.js +240 -0
  1071. package/dist/test-embedded-postgres.js.map +1 -0
  1072. package/dist/test-embedded-postgres.test.d.ts +2 -0
  1073. package/dist/test-embedded-postgres.test.d.ts.map +1 -0
  1074. package/dist/test-embedded-postgres.test.js +76 -0
  1075. package/dist/test-embedded-postgres.test.js.map +1 -0
  1076. package/dist/transient-write-retry.d.ts +4 -0
  1077. package/dist/transient-write-retry.d.ts.map +1 -0
  1078. package/dist/transient-write-retry.js +79 -0
  1079. package/dist/transient-write-retry.js.map +1 -0
  1080. package/dist/transient-write-retry.test.d.ts +2 -0
  1081. package/dist/transient-write-retry.test.d.ts.map +1 -0
  1082. package/dist/transient-write-retry.test.js +166 -0
  1083. package/dist/transient-write-retry.test.js.map +1 -0
  1084. package/dist/vercel-connect-credential-source-migration.test.d.ts +2 -0
  1085. package/dist/vercel-connect-credential-source-migration.test.d.ts.map +1 -0
  1086. package/dist/vercel-connect-credential-source-migration.test.js +71 -0
  1087. package/dist/vercel-connect-credential-source-migration.test.js.map +1 -0
  1088. package/node_modules/async-exit-hook/index.js +171 -0
  1089. package/node_modules/async-exit-hook/license +21 -0
  1090. package/node_modules/async-exit-hook/package.json +66 -0
  1091. package/node_modules/async-exit-hook/readme.md +118 -0
  1092. package/node_modules/embedded-postgres/LICENSE.md +9 -0
  1093. package/node_modules/embedded-postgres/README.md +191 -0
  1094. package/node_modules/embedded-postgres/dist/binary.d.ts +7 -0
  1095. package/node_modules/embedded-postgres/dist/binary.js +41 -0
  1096. package/node_modules/embedded-postgres/dist/index.d.ts +58 -0
  1097. package/node_modules/embedded-postgres/dist/index.js +366 -0
  1098. package/node_modules/embedded-postgres/dist/types.d.ts +54 -0
  1099. package/node_modules/embedded-postgres/dist/types.js +1 -0
  1100. package/node_modules/embedded-postgres/package.json +59 -0
  1101. package/node_modules/pg/LICENSE +21 -0
  1102. package/node_modules/pg/README.md +96 -0
  1103. package/node_modules/pg/esm/index.mjs +20 -0
  1104. package/node_modules/pg/lib/client.js +828 -0
  1105. package/node_modules/pg/lib/connection-parameters.js +184 -0
  1106. package/node_modules/pg/lib/connection.js +243 -0
  1107. package/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
  1108. package/node_modules/pg/lib/crypto/sasl.js +262 -0
  1109. package/node_modules/pg/lib/crypto/utils.js +89 -0
  1110. package/node_modules/pg/lib/defaults.js +94 -0
  1111. package/node_modules/pg/lib/index.js +73 -0
  1112. package/node_modules/pg/lib/native/client.js +420 -0
  1113. package/node_modules/pg/lib/native/index.js +2 -0
  1114. package/node_modules/pg/lib/native/query.js +165 -0
  1115. package/node_modules/pg/lib/query.js +259 -0
  1116. package/node_modules/pg/lib/result.js +109 -0
  1117. package/node_modules/pg/lib/stream.js +83 -0
  1118. package/node_modules/pg/lib/type-overrides.js +35 -0
  1119. package/node_modules/pg/lib/utils.js +207 -0
  1120. package/node_modules/pg/package.json +76 -0
  1121. package/node_modules/pg-cloudflare/LICENSE +21 -0
  1122. package/node_modules/pg-cloudflare/README.md +112 -0
  1123. package/node_modules/pg-cloudflare/dist/empty.d.ts +2 -0
  1124. package/node_modules/pg-cloudflare/dist/empty.js +6 -0
  1125. package/node_modules/pg-cloudflare/dist/empty.js.map +1 -0
  1126. package/node_modules/pg-cloudflare/dist/index.d.ts +31 -0
  1127. package/node_modules/pg-cloudflare/dist/index.js +154 -0
  1128. package/node_modules/pg-cloudflare/dist/index.js.map +1 -0
  1129. package/node_modules/pg-cloudflare/esm/index.mjs +3 -0
  1130. package/node_modules/pg-cloudflare/package.json +39 -0
  1131. package/node_modules/pg-cloudflare/src/empty.ts +3 -0
  1132. package/node_modules/pg-cloudflare/src/index.ts +169 -0
  1133. package/node_modules/pg-cloudflare/src/types.d.ts +25 -0
  1134. package/node_modules/pg-connection-string/LICENSE +21 -0
  1135. package/node_modules/pg-connection-string/README.md +105 -0
  1136. package/node_modules/pg-connection-string/esm/index.mjs +8 -0
  1137. package/node_modules/pg-connection-string/index.d.ts +37 -0
  1138. package/node_modules/pg-connection-string/index.js +237 -0
  1139. package/node_modules/pg-connection-string/package.json +52 -0
  1140. package/node_modules/pg-int8/LICENSE +13 -0
  1141. package/node_modules/pg-int8/README.md +16 -0
  1142. package/node_modules/pg-int8/index.js +100 -0
  1143. package/node_modules/pg-int8/package.json +24 -0
  1144. package/node_modules/pg-pool/LICENSE +21 -0
  1145. package/node_modules/pg-pool/README.md +357 -0
  1146. package/node_modules/pg-pool/esm/index.mjs +5 -0
  1147. package/node_modules/pg-pool/index.js +517 -0
  1148. package/node_modules/pg-pool/package.json +51 -0
  1149. package/node_modules/pg-protocol/LICENSE +21 -0
  1150. package/node_modules/pg-protocol/README.md +3 -0
  1151. package/node_modules/pg-protocol/dist/b.d.ts +1 -0
  1152. package/node_modules/pg-protocol/dist/b.js +23 -0
  1153. package/node_modules/pg-protocol/dist/b.js.map +1 -0
  1154. package/node_modules/pg-protocol/dist/buffer-reader.d.ts +14 -0
  1155. package/node_modules/pg-protocol/dist/buffer-reader.js +55 -0
  1156. package/node_modules/pg-protocol/dist/buffer-reader.js.map +1 -0
  1157. package/node_modules/pg-protocol/dist/buffer-writer.d.ts +17 -0
  1158. package/node_modules/pg-protocol/dist/buffer-writer.js +104 -0
  1159. package/node_modules/pg-protocol/dist/buffer-writer.js.map +1 -0
  1160. package/node_modules/pg-protocol/dist/inbound-parser.test.d.ts +1 -0
  1161. package/node_modules/pg-protocol/dist/inbound-parser.test.js +538 -0
  1162. package/node_modules/pg-protocol/dist/inbound-parser.test.js.map +1 -0
  1163. package/node_modules/pg-protocol/dist/index.d.ts +5 -0
  1164. package/node_modules/pg-protocol/dist/index.js +15 -0
  1165. package/node_modules/pg-protocol/dist/index.js.map +1 -0
  1166. package/node_modules/pg-protocol/dist/messages.d.ts +161 -0
  1167. package/node_modules/pg-protocol/dist/messages.js +160 -0
  1168. package/node_modules/pg-protocol/dist/messages.js.map +1 -0
  1169. package/node_modules/pg-protocol/dist/outbound-serializer.test.d.ts +1 -0
  1170. package/node_modules/pg-protocol/dist/outbound-serializer.test.js +325 -0
  1171. package/node_modules/pg-protocol/dist/outbound-serializer.test.js.map +1 -0
  1172. package/node_modules/pg-protocol/dist/parser.d.ts +22 -0
  1173. package/node_modules/pg-protocol/dist/parser.js +325 -0
  1174. package/node_modules/pg-protocol/dist/parser.js.map +1 -0
  1175. package/node_modules/pg-protocol/dist/serializer.d.ts +42 -0
  1176. package/node_modules/pg-protocol/dist/serializer.js +196 -0
  1177. package/node_modules/pg-protocol/dist/serializer.js.map +1 -0
  1178. package/node_modules/pg-protocol/esm/index.js +11 -0
  1179. package/node_modules/pg-protocol/package.json +44 -0
  1180. package/node_modules/pg-protocol/src/b.ts +25 -0
  1181. package/node_modules/pg-protocol/src/buffer-reader.ts +58 -0
  1182. package/node_modules/pg-protocol/src/buffer-writer.ts +110 -0
  1183. package/node_modules/pg-protocol/src/inbound-parser.test.ts +585 -0
  1184. package/node_modules/pg-protocol/src/index.ts +11 -0
  1185. package/node_modules/pg-protocol/src/messages.ts +262 -0
  1186. package/node_modules/pg-protocol/src/outbound-serializer.test.ts +356 -0
  1187. package/node_modules/pg-protocol/src/parser.ts +414 -0
  1188. package/node_modules/pg-protocol/src/serializer.ts +280 -0
  1189. package/node_modules/pg-protocol/src/testing/buffer-list.ts +67 -0
  1190. package/node_modules/pg-protocol/src/testing/test-buffers.ts +166 -0
  1191. package/node_modules/pg-types/.travis.yml +7 -0
  1192. package/node_modules/pg-types/Makefile +14 -0
  1193. package/node_modules/pg-types/README.md +75 -0
  1194. package/node_modules/pg-types/index.d.ts +137 -0
  1195. package/node_modules/pg-types/index.js +47 -0
  1196. package/node_modules/pg-types/index.test-d.ts +21 -0
  1197. package/node_modules/pg-types/lib/arrayParser.js +11 -0
  1198. package/node_modules/pg-types/lib/binaryParsers.js +257 -0
  1199. package/node_modules/pg-types/lib/builtins.js +73 -0
  1200. package/node_modules/pg-types/lib/textParsers.js +215 -0
  1201. package/node_modules/pg-types/package.json +42 -0
  1202. package/node_modules/pg-types/test/index.js +24 -0
  1203. package/node_modules/pg-types/test/types.js +597 -0
  1204. package/node_modules/pgpass/README.md +74 -0
  1205. package/node_modules/pgpass/lib/helper.js +233 -0
  1206. package/node_modules/pgpass/lib/index.js +23 -0
  1207. package/node_modules/pgpass/package.json +41 -0
  1208. package/node_modules/postgres-array/index.d.ts +4 -0
  1209. package/node_modules/postgres-array/index.js +97 -0
  1210. package/node_modules/postgres-array/license +21 -0
  1211. package/node_modules/postgres-array/package.json +35 -0
  1212. package/node_modules/postgres-array/readme.md +43 -0
  1213. package/node_modules/postgres-bytea/index.js +33 -0
  1214. package/node_modules/postgres-bytea/license +21 -0
  1215. package/node_modules/postgres-bytea/package.json +34 -0
  1216. package/node_modules/postgres-bytea/readme.md +34 -0
  1217. package/node_modules/postgres-date/index.js +116 -0
  1218. package/node_modules/postgres-date/license +21 -0
  1219. package/node_modules/postgres-date/package.json +33 -0
  1220. package/node_modules/postgres-date/readme.md +49 -0
  1221. package/node_modules/postgres-interval/index.d.ts +20 -0
  1222. package/node_modules/postgres-interval/index.js +125 -0
  1223. package/node_modules/postgres-interval/license +21 -0
  1224. package/node_modules/postgres-interval/package.json +36 -0
  1225. package/node_modules/postgres-interval/readme.md +48 -0
  1226. package/node_modules/split2/LICENSE +13 -0
  1227. package/node_modules/split2/README.md +85 -0
  1228. package/node_modules/split2/bench.js +27 -0
  1229. package/node_modules/split2/index.js +141 -0
  1230. package/node_modules/split2/package.json +39 -0
  1231. package/node_modules/split2/test.js +409 -0
  1232. package/node_modules/xtend/.jshintrc +30 -0
  1233. package/node_modules/xtend/LICENSE +20 -0
  1234. package/node_modules/xtend/README.md +32 -0
  1235. package/node_modules/xtend/immutable.js +19 -0
  1236. package/node_modules/xtend/mutable.js +17 -0
  1237. package/node_modules/xtend/package.json +55 -0
  1238. package/node_modules/xtend/test.js +103 -0
  1239. package/package.json +69 -0
@@ -0,0 +1,1759 @@
1
+ import { createHash } from "node:crypto";
2
+ import fs from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { drizzle } from "drizzle-orm/postgres-js";
6
+ import { migrate } from "drizzle-orm/postgres-js/migrator";
7
+ import { afterEach, describe, expect, it } from "vitest";
8
+ import postgres from "postgres";
9
+ import { DEFAULT_DATABASE_APPLICATION_NAME, applyPendingMigrations, closeRegisteredClients, createDb, ensurePostgresDatabase, inspectMigrations, resetPostgresDatabase, } from "./client.js";
10
+ import { getEmbeddedPostgresTestSupport, startEmbeddedPostgresTestDatabase, } from "./test-embedded-postgres.js";
11
+ const cleanups = [];
12
+ const embeddedPostgresSupport = await getEmbeddedPostgresTestSupport();
13
+ const describeEmbeddedPostgres = embeddedPostgresSupport.supported ? describe : describe.skip;
14
+ async function createTempDatabase() {
15
+ const db = await startEmbeddedPostgresTestDatabase("paperclip-db-client-");
16
+ cleanups.push(db.cleanup);
17
+ return db.connectionString;
18
+ }
19
+ async function migrationHash(migrationFile) {
20
+ const content = await fs.promises.readFile(new URL(`./migrations/${migrationFile}`, import.meta.url), "utf8");
21
+ return createHash("sha256").update(content).digest("hex");
22
+ }
23
+ const userVisibleUpdatedAtTables = new Set([
24
+ "companies",
25
+ "heartbeat_runs",
26
+ "issue_comments",
27
+ "issues",
28
+ "routine_runs",
29
+ "routines",
30
+ ]);
31
+ const migrationUpdatedAtUpdateAllowlist = new Map([
32
+ [
33
+ "0105_instance_scoped_environments.sql",
34
+ new Set(["issues"]),
35
+ ],
36
+ [
37
+ "0131_repair_run_responsible_user_context_refs.sql",
38
+ new Set(["heartbeat_runs"]),
39
+ ],
40
+ [
41
+ "0135_repair_run_responsible_user_updated_at_sweep.sql",
42
+ new Set(["companies", "heartbeat_runs", "issues", "routine_runs", "routines"]),
43
+ ],
44
+ ]);
45
+ function findUserVisibleUpdatedAtBackfillViolations(migrationFile, content) {
46
+ const allowedTables = migrationUpdatedAtUpdateAllowlist.get(migrationFile) ?? new Set();
47
+ const violations = [];
48
+ for (const statement of content.split("--> statement-breakpoint")) {
49
+ const updateMatch = statement.match(/\bUPDATE\s+"([^"]+)"/i);
50
+ if (!updateMatch)
51
+ continue;
52
+ const tableName = updateMatch[1];
53
+ if (!userVisibleUpdatedAtTables.has(tableName))
54
+ continue;
55
+ if (!/\bSET\b[\s\S]*"updated_at"\s*=/i.test(statement))
56
+ continue;
57
+ if (allowedTables.has(tableName))
58
+ continue;
59
+ violations.push(`${migrationFile}: UPDATE "${tableName}" sets updated_at`);
60
+ }
61
+ return violations;
62
+ }
63
+ afterEach(async () => {
64
+ while (cleanups.length > 0) {
65
+ const cleanup = cleanups.pop();
66
+ await cleanup?.();
67
+ }
68
+ });
69
+ if (!embeddedPostgresSupport.supported) {
70
+ console.warn(`Skipping embedded Postgres migration tests on this host: ${embeddedPostgresSupport.reason ?? "unsupported environment"}`);
71
+ }
72
+ describeEmbeddedPostgres("createDb pool defaults", () => {
73
+ it("names its backends and closes them once idle", async () => {
74
+ const url = await createTempDatabase();
75
+ const observer = postgres(url, { max: 1, onnotice: () => { } });
76
+ cleanups.push(async () => {
77
+ await observer.end({ timeout: 1 });
78
+ });
79
+ const backendsNamed = async (name) => {
80
+ const rows = await observer `
81
+ select count(*)::int as count from pg_stat_activity where application_name = ${name}
82
+ `;
83
+ return rows[0]?.count ?? 0;
84
+ };
85
+ const db = createDb(url);
86
+ cleanups.push(async () => {
87
+ await db.$client.end({ timeout: 1 });
88
+ });
89
+ const [self] = await db.$client `select application_name from pg_stat_activity where pid = pg_backend_pid()`;
90
+ expect(self?.application_name).toBe(DEFAULT_DATABASE_APPLICATION_NAME);
91
+ const shortLived = createDb(url, { applicationName: "paperclip-idle-test", idleTimeoutSeconds: 1 });
92
+ cleanups.push(async () => {
93
+ await shortLived.$client.end({ timeout: 1 });
94
+ });
95
+ await shortLived.$client `select 1`;
96
+ expect(await backendsNamed("paperclip-idle-test")).toBe(1);
97
+ // The driver closes the idle connection after `idle_timeout`; without the
98
+ // option (the driver default) the backend would stay until the process
99
+ // exits. Wait past the timeout, then poll PostgreSQL's own view.
100
+ const deadline = Date.now() + 10_000;
101
+ let remaining = await backendsNamed("paperclip-idle-test");
102
+ while (remaining > 0 && Date.now() < deadline) {
103
+ await new Promise((resolve) => setTimeout(resolve, 250));
104
+ remaining = await backendsNamed("paperclip-idle-test");
105
+ }
106
+ expect(remaining).toBe(0);
107
+ }, 30_000);
108
+ });
109
+ describeEmbeddedPostgres("resetPostgresDatabase", () => {
110
+ it("recreates an existing database so stale tables are removed", async () => {
111
+ const connectionString = await createTempDatabase();
112
+ const adminUrl = new URL(connectionString);
113
+ const databaseName = adminUrl.pathname.replace(/^\//, "");
114
+ adminUrl.pathname = "/postgres";
115
+ const setupSql = postgres(connectionString, { max: 1, onnotice: () => { } });
116
+ try {
117
+ await setupSql.unsafe(`CREATE TABLE stale_reseed_target_only (id integer PRIMARY KEY)`);
118
+ }
119
+ finally {
120
+ await setupSql.end();
121
+ }
122
+ await resetPostgresDatabase(adminUrl.toString(), databaseName);
123
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
124
+ try {
125
+ const rows = await verifySql.unsafe(`SELECT to_regclass('public.stale_reseed_target_only')::text AS stale_table`);
126
+ expect(rows[0]?.stale_table).toBeNull();
127
+ }
128
+ finally {
129
+ await verifySql.end();
130
+ }
131
+ }, 30_000);
132
+ });
133
+ describeEmbeddedPostgres("applyPendingMigrations", () => {
134
+ it("upgrades renumbered recovery migrations and replays their schema idempotently", async () => {
135
+ const connectionString = await createTempDatabase();
136
+ await applyPendingMigrations(connectionString);
137
+ const recoveryFiles = [
138
+ "0250_exotic_dakota_north.sql", "0251_narrow_mastermind.sql",
139
+ "0252_friendly_kate_bishop.sql", "0253_real_firebrand.sql",
140
+ "0254_military_calypso.sql",
141
+ ];
142
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
143
+ try {
144
+ // An instance may have applied this identical SQL under the pre-rebase
145
+ // numbers, before the new session-goal and tool-action migrations existed.
146
+ for (const file of recoveryFiles) {
147
+ const hash = await migrationHash(file);
148
+ await sql `UPDATE "drizzle"."__drizzle_migrations" SET created_at = 1788825600000 WHERE hash = ${hash}`;
149
+ const source = await fs.promises.readFile(new URL(`./migrations/${file}`, import.meta.url), "utf8");
150
+ for (const statement of source.split("--> statement-breakpoint")) {
151
+ if (statement.trim())
152
+ await sql.unsafe(statement);
153
+ }
154
+ }
155
+ for (const file of ["0248_small_manta.sql", "0249_fast_silverclaw.sql"]) {
156
+ const hash = await migrationHash(file);
157
+ await sql `DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = ${hash}`;
158
+ }
159
+ await applyPendingMigrations(connectionString);
160
+ expect((await inspectMigrations(connectionString)).status).toBe("upToDate");
161
+ for (const file of recoveryFiles) {
162
+ const hash = await migrationHash(file);
163
+ const rows = await sql `SELECT id FROM "drizzle"."__drizzle_migrations" WHERE hash = ${hash}`;
164
+ expect(rows).toHaveLength(1);
165
+ }
166
+ const indexes = await sql `SELECT indexname FROM pg_indexes WHERE indexname = 'heartbeat_runs_native_replacement_predecessor_uq'`;
167
+ expect(indexes).toHaveLength(1);
168
+ }
169
+ finally {
170
+ await sql.end();
171
+ }
172
+ }, 30_000);
173
+ it("rejects unallowlisted migration backfills that bump updated_at on user-visible tables", async () => {
174
+ const entries = await fs.promises.readdir(new URL("./migrations", import.meta.url), {
175
+ withFileTypes: true,
176
+ });
177
+ const violations = [];
178
+ for (const entry of entries) {
179
+ if (!entry.isFile() || !entry.name.endsWith(".sql"))
180
+ continue;
181
+ const content = await fs.promises.readFile(new URL(`./migrations/${entry.name}`, import.meta.url), "utf8");
182
+ violations.push(...findUserVisibleUpdatedAtBackfillViolations(entry.name, content));
183
+ }
184
+ expect(violations).toEqual([]);
185
+ expect(findUserVisibleUpdatedAtBackfillViolations("9999_bad_backfill.sql", `
186
+ UPDATE "issues" AS i
187
+ SET "responsible_user_id" = 'owner-user',
188
+ "updated_at" = now()
189
+ WHERE i."responsible_user_id" IS NULL;
190
+ `)).toEqual(['9999_bad_backfill.sql: UPDATE "issues" sets updated_at']);
191
+ });
192
+ it("applies an inserted earlier migration without replaying later legacy migrations", async () => {
193
+ const connectionString = await createTempDatabase();
194
+ await applyPendingMigrations(connectionString);
195
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
196
+ try {
197
+ const richMagnetoHash = await migrationHash("0030_rich_magneto.sql");
198
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${richMagnetoHash}'`);
199
+ await sql.unsafe(`DROP TABLE "company_logos"`);
200
+ }
201
+ finally {
202
+ await sql.end();
203
+ }
204
+ const pendingState = await inspectMigrations(connectionString);
205
+ expect(pendingState).toMatchObject({
206
+ status: "needsMigrations",
207
+ pendingMigrations: ["0030_rich_magneto.sql"],
208
+ reason: "pending-migrations",
209
+ });
210
+ await applyPendingMigrations(connectionString);
211
+ const finalState = await inspectMigrations(connectionString);
212
+ expect(finalState.status).toBe("upToDate");
213
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
214
+ try {
215
+ const rows = await verifySql.unsafe(`
216
+ SELECT table_name
217
+ FROM information_schema.tables
218
+ WHERE table_schema = 'public'
219
+ AND table_name IN ('company_logos', 'execution_workspaces')
220
+ ORDER BY table_name
221
+ `);
222
+ expect(rows.map((row) => row.table_name)).toEqual([
223
+ "company_logos",
224
+ "execution_workspaces",
225
+ ]);
226
+ }
227
+ finally {
228
+ await verifySql.end();
229
+ }
230
+ }, 20_000);
231
+ it("replays migration 0044 safely when its schema changes already exist", async () => {
232
+ const connectionString = await createTempDatabase();
233
+ await applyPendingMigrations(connectionString);
234
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
235
+ try {
236
+ const illegalToadHash = await migrationHash("0044_illegal_toad.sql");
237
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${illegalToadHash}'`);
238
+ const columns = await sql.unsafe(`
239
+ SELECT column_name
240
+ FROM information_schema.columns
241
+ WHERE table_schema = 'public'
242
+ AND table_name = 'instance_settings'
243
+ AND column_name = 'general'
244
+ `);
245
+ expect(columns).toHaveLength(1);
246
+ }
247
+ finally {
248
+ await sql.end();
249
+ }
250
+ const pendingState = await inspectMigrations(connectionString);
251
+ expect(pendingState).toMatchObject({
252
+ status: "needsMigrations",
253
+ pendingMigrations: ["0044_illegal_toad.sql"],
254
+ reason: "pending-migrations",
255
+ });
256
+ await applyPendingMigrations(connectionString);
257
+ const finalState = await inspectMigrations(connectionString);
258
+ expect(finalState.status).toBe("upToDate");
259
+ }, 20_000);
260
+ it("enforces a unique board_api_keys.key_hash after migration 0044", async () => {
261
+ const connectionString = await createTempDatabase();
262
+ await applyPendingMigrations(connectionString);
263
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
264
+ try {
265
+ await sql.unsafe(`
266
+ INSERT INTO "user" ("id", "name", "email", "email_verified", "created_at", "updated_at")
267
+ VALUES ('user-1', 'User One', 'user@example.com', true, now(), now())
268
+ `);
269
+ await sql.unsafe(`
270
+ INSERT INTO "board_api_keys" ("id", "user_id", "name", "key_hash", "created_at")
271
+ VALUES ('00000000-0000-0000-0000-000000000001', 'user-1', 'Key One', 'dup-hash', now())
272
+ `);
273
+ await expect(sql.unsafe(`
274
+ INSERT INTO "board_api_keys" ("id", "user_id", "name", "key_hash", "created_at")
275
+ VALUES ('00000000-0000-0000-0000-000000000002', 'user-1', 'Key Two', 'dup-hash', now())
276
+ `)).rejects.toThrow();
277
+ }
278
+ finally {
279
+ await sql.end();
280
+ }
281
+ }, 20_000);
282
+ it("replays migration 0046 safely when document revision columns already exist", async () => {
283
+ const connectionString = await createTempDatabase();
284
+ await applyPendingMigrations(connectionString);
285
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
286
+ try {
287
+ const smoothSentinelsHash = await migrationHash("0046_smooth_sentinels.sql");
288
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${smoothSentinelsHash}'`);
289
+ const columns = await sql.unsafe(`
290
+ SELECT column_name, is_nullable, column_default
291
+ FROM information_schema.columns
292
+ WHERE table_schema = 'public'
293
+ AND table_name = 'document_revisions'
294
+ AND column_name IN ('title', 'format')
295
+ ORDER BY column_name
296
+ `);
297
+ expect(columns).toHaveLength(2);
298
+ }
299
+ finally {
300
+ await sql.end();
301
+ }
302
+ const pendingState = await inspectMigrations(connectionString);
303
+ expect(pendingState).toMatchObject({
304
+ status: "needsMigrations",
305
+ pendingMigrations: ["0046_smooth_sentinels.sql"],
306
+ reason: "pending-migrations",
307
+ });
308
+ await applyPendingMigrations(connectionString);
309
+ const finalState = await inspectMigrations(connectionString);
310
+ expect(finalState.status).toBe("upToDate");
311
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
312
+ try {
313
+ const columns = await verifySql.unsafe(`
314
+ SELECT column_name, is_nullable, column_default
315
+ FROM information_schema.columns
316
+ WHERE table_schema = 'public'
317
+ AND table_name = 'document_revisions'
318
+ AND column_name IN ('title', 'format')
319
+ ORDER BY column_name
320
+ `);
321
+ expect(columns).toEqual([
322
+ expect.objectContaining({
323
+ column_name: "format",
324
+ is_nullable: "NO",
325
+ }),
326
+ expect.objectContaining({
327
+ column_name: "title",
328
+ is_nullable: "YES",
329
+ }),
330
+ ]);
331
+ expect(columns[0]?.column_default).toContain("'markdown'");
332
+ }
333
+ finally {
334
+ await verifySql.end();
335
+ }
336
+ }, 20_000);
337
+ it("replays migration 0047 safely when feedback tables and run columns already exist", async () => {
338
+ const connectionString = await createTempDatabase();
339
+ await applyPendingMigrations(connectionString);
340
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
341
+ try {
342
+ const overjoyedGrootHash = await migrationHash("0047_overjoyed_groot.sql");
343
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${overjoyedGrootHash}'`);
344
+ const tables = await sql.unsafe(`
345
+ SELECT table_name
346
+ FROM information_schema.tables
347
+ WHERE table_schema = 'public'
348
+ AND table_name IN ('feedback_exports', 'feedback_votes')
349
+ ORDER BY table_name
350
+ `);
351
+ expect(tables.map((row) => row.table_name)).toEqual([
352
+ "feedback_exports",
353
+ "feedback_votes",
354
+ ]);
355
+ const columns = await sql.unsafe(`
356
+ SELECT table_name, column_name
357
+ FROM information_schema.columns
358
+ WHERE table_schema = 'public'
359
+ AND (
360
+ (table_name = 'companies' AND column_name IN (
361
+ 'feedback_data_sharing_enabled',
362
+ 'feedback_data_sharing_consent_at',
363
+ 'feedback_data_sharing_consent_by_user_id',
364
+ 'feedback_data_sharing_terms_version'
365
+ ))
366
+ OR (table_name = 'document_revisions' AND column_name = 'created_by_run_id')
367
+ OR (table_name = 'issue_comments' AND column_name = 'created_by_run_id')
368
+ )
369
+ ORDER BY table_name, column_name
370
+ `);
371
+ expect(columns).toHaveLength(6);
372
+ }
373
+ finally {
374
+ await sql.end();
375
+ }
376
+ const pendingState = await inspectMigrations(connectionString);
377
+ expect(pendingState).toMatchObject({
378
+ status: "needsMigrations",
379
+ pendingMigrations: ["0047_overjoyed_groot.sql"],
380
+ reason: "pending-migrations",
381
+ });
382
+ await applyPendingMigrations(connectionString);
383
+ const finalState = await inspectMigrations(connectionString);
384
+ expect(finalState.status).toBe("upToDate");
385
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
386
+ try {
387
+ const constraints = await verifySql.unsafe(`
388
+ SELECT conname
389
+ FROM pg_constraint
390
+ WHERE conname IN (
391
+ 'feedback_exports_company_id_companies_id_fk',
392
+ 'feedback_exports_feedback_vote_id_feedback_votes_id_fk',
393
+ 'feedback_exports_issue_id_issues_id_fk',
394
+ 'feedback_votes_company_id_companies_id_fk',
395
+ 'feedback_votes_issue_id_issues_id_fk'
396
+ )
397
+ ORDER BY conname
398
+ `);
399
+ expect(constraints.map((row) => row.conname)).toEqual([
400
+ "feedback_exports_company_id_companies_id_fk",
401
+ "feedback_exports_feedback_vote_id_feedback_votes_id_fk",
402
+ "feedback_exports_issue_id_issues_id_fk",
403
+ "feedback_votes_company_id_companies_id_fk",
404
+ "feedback_votes_issue_id_issues_id_fk",
405
+ ]);
406
+ }
407
+ finally {
408
+ await verifySql.end();
409
+ }
410
+ }, 20_000);
411
+ it("replays migration 0048 safely when routines.variables already exists", async () => {
412
+ const connectionString = await createTempDatabase();
413
+ await applyPendingMigrations(connectionString);
414
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
415
+ try {
416
+ const flashyMarrowHash = await migrationHash("0048_flashy_marrow.sql");
417
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${flashyMarrowHash}'`);
418
+ const columns = await sql.unsafe(`
419
+ SELECT column_name
420
+ FROM information_schema.columns
421
+ WHERE table_schema = 'public'
422
+ AND table_name = 'routines'
423
+ AND column_name = 'variables'
424
+ `);
425
+ expect(columns).toHaveLength(1);
426
+ }
427
+ finally {
428
+ await sql.end();
429
+ }
430
+ const pendingState = await inspectMigrations(connectionString);
431
+ expect(pendingState).toMatchObject({
432
+ status: "needsMigrations",
433
+ pendingMigrations: ["0048_flashy_marrow.sql"],
434
+ reason: "pending-migrations",
435
+ });
436
+ await applyPendingMigrations(connectionString);
437
+ const finalState = await inspectMigrations(connectionString);
438
+ expect(finalState.status).toBe("upToDate");
439
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
440
+ try {
441
+ const columns = await verifySql.unsafe(`
442
+ SELECT column_name, is_nullable, data_type
443
+ FROM information_schema.columns
444
+ WHERE table_schema = 'public'
445
+ AND table_name = 'routines'
446
+ AND column_name = 'variables'
447
+ `);
448
+ expect(columns).toEqual([
449
+ expect.objectContaining({
450
+ column_name: "variables",
451
+ is_nullable: "NO",
452
+ data_type: "jsonb",
453
+ }),
454
+ ]);
455
+ }
456
+ finally {
457
+ await verifySql.end();
458
+ }
459
+ }, 20_000);
460
+ it("replays migration 0050 safely when projects.env already exists", async () => {
461
+ const connectionString = await createTempDatabase();
462
+ await applyPendingMigrations(connectionString);
463
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
464
+ try {
465
+ const stiffLuckmanHash = await migrationHash("0050_stiff_luckman.sql");
466
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${stiffLuckmanHash}'`);
467
+ const columns = await sql.unsafe(`
468
+ SELECT column_name
469
+ FROM information_schema.columns
470
+ WHERE table_schema = 'public'
471
+ AND table_name = 'projects'
472
+ AND column_name = 'env'
473
+ `);
474
+ expect(columns).toHaveLength(1);
475
+ }
476
+ finally {
477
+ await sql.end();
478
+ }
479
+ const pendingState = await inspectMigrations(connectionString);
480
+ expect(pendingState).toMatchObject({
481
+ status: "needsMigrations",
482
+ pendingMigrations: ["0050_stiff_luckman.sql"],
483
+ reason: "pending-migrations",
484
+ });
485
+ await applyPendingMigrations(connectionString);
486
+ const finalState = await inspectMigrations(connectionString);
487
+ expect(finalState.status).toBe("upToDate");
488
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
489
+ try {
490
+ const columns = await verifySql.unsafe(`
491
+ SELECT column_name, is_nullable, data_type
492
+ FROM information_schema.columns
493
+ WHERE table_schema = 'public'
494
+ AND table_name = 'projects'
495
+ AND column_name = 'env'
496
+ `);
497
+ expect(columns).toEqual([
498
+ expect.objectContaining({
499
+ column_name: "env",
500
+ is_nullable: "YES",
501
+ data_type: "jsonb",
502
+ }),
503
+ ]);
504
+ }
505
+ finally {
506
+ await verifySql.end();
507
+ }
508
+ }, 20_000);
509
+ it("replays migration 0059 safely when plugin_database_namespaces already exists", async () => {
510
+ const connectionString = await createTempDatabase();
511
+ await applyPendingMigrations(connectionString);
512
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
513
+ try {
514
+ const pluginNamespacesHash = await migrationHash("0059_plugin_database_namespaces.sql");
515
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${pluginNamespacesHash}'`);
516
+ const tables = await sql.unsafe(`
517
+ SELECT table_name
518
+ FROM information_schema.tables
519
+ WHERE table_schema = 'public'
520
+ AND table_name IN ('plugin_database_namespaces', 'plugin_migrations')
521
+ ORDER BY table_name
522
+ `);
523
+ expect(tables.map((row) => row.table_name)).toEqual([
524
+ "plugin_database_namespaces",
525
+ "plugin_migrations",
526
+ ]);
527
+ }
528
+ finally {
529
+ await sql.end();
530
+ }
531
+ const pendingState = await inspectMigrations(connectionString);
532
+ expect(pendingState).toMatchObject({
533
+ status: "needsMigrations",
534
+ pendingMigrations: ["0059_plugin_database_namespaces.sql"],
535
+ reason: "pending-migrations",
536
+ });
537
+ await applyPendingMigrations(connectionString);
538
+ const finalState = await inspectMigrations(connectionString);
539
+ expect(finalState.status).toBe("upToDate");
540
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
541
+ try {
542
+ const indexes = await verifySql.unsafe(`
543
+ SELECT indexname
544
+ FROM pg_indexes
545
+ WHERE schemaname = 'public'
546
+ AND tablename IN ('plugin_database_namespaces', 'plugin_migrations')
547
+ ORDER BY indexname
548
+ `);
549
+ expect(indexes.map((row) => row.indexname)).toEqual(expect.arrayContaining([
550
+ "plugin_database_namespaces_namespace_idx",
551
+ "plugin_database_namespaces_plugin_idx",
552
+ "plugin_database_namespaces_status_idx",
553
+ "plugin_migrations_plugin_idx",
554
+ "plugin_migrations_plugin_key_idx",
555
+ "plugin_migrations_status_idx",
556
+ ]));
557
+ }
558
+ finally {
559
+ await verifySql.end();
560
+ }
561
+ }, 20_000);
562
+ it("replays the built-in managed resources migration after the legacy 0136 journal entry", async () => {
563
+ const connectionString = await createTempDatabase();
564
+ await applyPendingMigrations(connectionString);
565
+ const builtInResourcesHash = await migrationHash("0140_built_in_managed_resources.sql");
566
+ const legacyBuiltInResourcesHash = createHash("sha256")
567
+ .update("legacy 0136_built_in_managed_resources.sql")
568
+ .digest("hex");
569
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
570
+ try {
571
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${builtInResourcesHash}'`);
572
+ await sql.unsafe(`
573
+ INSERT INTO "drizzle"."__drizzle_migrations" ("hash", "created_at")
574
+ VALUES ('${legacyBuiltInResourcesHash}', 1783555200000)
575
+ `);
576
+ await sql.unsafe(`
577
+ ALTER TABLE "built_in_managed_resources"
578
+ DROP CONSTRAINT IF EXISTS "built_in_managed_resources_company_id_companies_id_fk"
579
+ `);
580
+ await sql.unsafe(`DROP INDEX IF EXISTS "built_in_managed_resources_company_idx"`);
581
+ await sql.unsafe(`DROP INDEX IF EXISTS "built_in_managed_resources_resource_idx"`);
582
+ await sql.unsafe(`DROP INDEX IF EXISTS "built_in_managed_resources_company_bundle_resource_uq"`);
583
+ }
584
+ finally {
585
+ await sql.end();
586
+ }
587
+ const pendingState = await inspectMigrations(connectionString);
588
+ expect(pendingState).toMatchObject({
589
+ status: "needsMigrations",
590
+ pendingMigrations: ["0140_built_in_managed_resources.sql"],
591
+ reason: "pending-migrations",
592
+ });
593
+ await applyPendingMigrations(connectionString);
594
+ const finalState = await inspectMigrations(connectionString);
595
+ expect(finalState.status).toBe("upToDate");
596
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
597
+ try {
598
+ const rows = await verifySql.unsafe(`
599
+ SELECT
600
+ EXISTS (
601
+ SELECT 1
602
+ FROM "pg_constraint" c
603
+ JOIN "pg_class" t ON t.oid = c.conrelid
604
+ JOIN "pg_namespace" n ON n.oid = t.relnamespace
605
+ WHERE n.nspname = 'public'
606
+ AND t.relname = 'built_in_managed_resources'
607
+ AND c.conname = 'built_in_managed_resources_company_id_companies_id_fk'
608
+ ) AS "foreign_key_exists",
609
+ EXISTS (
610
+ SELECT 1
611
+ FROM "pg_class" c
612
+ JOIN "pg_namespace" n ON n.oid = c.relnamespace
613
+ WHERE n.nspname = 'public'
614
+ AND c.relkind = 'i'
615
+ AND c.relname = 'built_in_managed_resources_company_idx'
616
+ ) AS "company_index_exists",
617
+ EXISTS (
618
+ SELECT 1
619
+ FROM "pg_class" c
620
+ JOIN "pg_namespace" n ON n.oid = c.relnamespace
621
+ WHERE n.nspname = 'public'
622
+ AND c.relkind = 'i'
623
+ AND c.relname = 'built_in_managed_resources_resource_idx'
624
+ ) AS "resource_index_exists",
625
+ EXISTS (
626
+ SELECT 1
627
+ FROM "pg_class" c
628
+ JOIN "pg_namespace" n ON n.oid = c.relnamespace
629
+ WHERE n.nspname = 'public'
630
+ AND c.relkind = 'i'
631
+ AND c.relname = 'built_in_managed_resources_company_bundle_resource_uq'
632
+ ) AS "unique_index_exists"
633
+ `);
634
+ expect(rows[0]).toEqual({
635
+ foreign_key_exists: true,
636
+ company_index_exists: true,
637
+ resource_index_exists: true,
638
+ unique_index_exists: true,
639
+ });
640
+ }
641
+ finally {
642
+ await verifySql.end();
643
+ }
644
+ }, 20_000);
645
+ it("replays migration 0134 without bumping issue updated_at for inbox archives", async () => {
646
+ const connectionString = await createTempDatabase();
647
+ await applyPendingMigrations(connectionString);
648
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
649
+ try {
650
+ const runResponsibleUserHash = await migrationHash("0134_run_responsible_user_invariant.sql");
651
+ await sql.unsafe(`
652
+ INSERT INTO "companies" ("id", "name", "issue_prefix", "created_at", "updated_at")
653
+ VALUES (
654
+ '00000000-0000-0000-0000-000000000120',
655
+ 'Migration Inbox Co',
656
+ 'TST120',
657
+ '2026-03-26T09:00:00.000Z',
658
+ '2026-03-26T09:00:00.000Z'
659
+ )
660
+ `);
661
+ await sql.unsafe(`
662
+ INSERT INTO "company_memberships" (
663
+ "id",
664
+ "company_id",
665
+ "principal_type",
666
+ "principal_id",
667
+ "status",
668
+ "membership_role",
669
+ "created_at",
670
+ "updated_at"
671
+ )
672
+ VALUES (
673
+ '00000000-0000-0000-0000-000000000121',
674
+ '00000000-0000-0000-0000-000000000120',
675
+ 'user',
676
+ 'owner-user',
677
+ 'active',
678
+ 'owner',
679
+ '2026-03-26T09:00:00.000Z',
680
+ '2026-03-26T09:00:00.000Z'
681
+ )
682
+ `);
683
+ await sql.unsafe(`
684
+ INSERT INTO "issues" (
685
+ "id",
686
+ "company_id",
687
+ "title",
688
+ "status",
689
+ "responsible_user_id",
690
+ "created_at",
691
+ "updated_at"
692
+ )
693
+ VALUES (
694
+ '00000000-0000-0000-0000-000000000122',
695
+ '00000000-0000-0000-0000-000000000120',
696
+ 'Archived issue needing responsible user backfill',
697
+ 'todo',
698
+ NULL,
699
+ '2026-03-26T10:00:00.000Z',
700
+ '2026-03-26T10:00:00.000Z'
701
+ )
702
+ `);
703
+ await sql.unsafe(`
704
+ INSERT INTO "issue_inbox_archives" (
705
+ "id",
706
+ "company_id",
707
+ "issue_id",
708
+ "user_id",
709
+ "archived_at",
710
+ "created_at",
711
+ "updated_at"
712
+ )
713
+ VALUES (
714
+ '00000000-0000-0000-0000-000000000123',
715
+ '00000000-0000-0000-0000-000000000120',
716
+ '00000000-0000-0000-0000-000000000122',
717
+ 'owner-user',
718
+ '2026-03-26T12:00:00.000Z',
719
+ '2026-03-26T12:00:00.000Z',
720
+ '2026-03-26T12:00:00.000Z'
721
+ )
722
+ `);
723
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${runResponsibleUserHash}'`);
724
+ }
725
+ finally {
726
+ await sql.end();
727
+ }
728
+ const pendingState = await inspectMigrations(connectionString);
729
+ expect(pendingState).toMatchObject({
730
+ status: "needsMigrations",
731
+ pendingMigrations: ["0134_run_responsible_user_invariant.sql"],
732
+ reason: "pending-migrations",
733
+ });
734
+ await applyPendingMigrations(connectionString);
735
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
736
+ try {
737
+ const rows = await verifySql.unsafe(`
738
+ SELECT
739
+ i."responsible_user_id",
740
+ i."updated_at",
741
+ EXISTS (
742
+ SELECT 1
743
+ FROM "issue_inbox_archives" AS archive
744
+ WHERE archive."company_id" = i."company_id"
745
+ AND archive."issue_id" = i."id"
746
+ AND archive."user_id" = 'owner-user'
747
+ AND archive."archived_at" >= i."updated_at"
748
+ ) AS "inbox_archive_still_current"
749
+ FROM "issues" AS i
750
+ WHERE i."id" = '00000000-0000-0000-0000-000000000122'
751
+ `);
752
+ expect(rows).toHaveLength(1);
753
+ expect(rows[0]?.responsible_user_id).toBe("owner-user");
754
+ expect(rows[0]?.updated_at.toISOString()).toBe("2026-03-26T10:00:00.000Z");
755
+ expect(rows[0]?.inbox_archive_still_current).toBe(true);
756
+ }
757
+ finally {
758
+ await verifySql.end();
759
+ }
760
+ }, 20_000);
761
+ it("replays migration 0135 to repair updated_at sweeps and no-op when clean", async () => {
762
+ const connectionString = await createTempDatabase();
763
+ await applyPendingMigrations(connectionString);
764
+ const repairSweepHash = await migrationHash("0135_repair_run_responsible_user_updated_at_sweep.sql");
765
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
766
+ try {
767
+ await sql.unsafe(`
768
+ INSERT INTO "companies" ("id", "name", "issue_prefix", "created_at", "updated_at")
769
+ VALUES (
770
+ '00000000-0000-0000-0000-000000000240',
771
+ 'Clean Migration Co',
772
+ 'CLN134',
773
+ '2026-04-01T09:00:00.000Z',
774
+ '2026-04-02T09:00:00.000Z'
775
+ )
776
+ `);
777
+ await sql.unsafe(`
778
+ INSERT INTO "issues" ("id", "company_id", "title", "status", "created_at", "updated_at")
779
+ VALUES (
780
+ '00000000-0000-0000-0000-000000000241',
781
+ '00000000-0000-0000-0000-000000000240',
782
+ 'Clean issue should not be touched',
783
+ 'todo',
784
+ '2026-04-01T10:00:00.000Z',
785
+ '2026-04-02T10:00:00.000Z'
786
+ )
787
+ `);
788
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${repairSweepHash}'`);
789
+ }
790
+ finally {
791
+ await sql.end();
792
+ }
793
+ await applyPendingMigrations(connectionString);
794
+ const afterCleanReplay = postgres(connectionString, { max: 1, onnotice: () => { } });
795
+ try {
796
+ const cleanRows = await afterCleanReplay.unsafe(`
797
+ SELECT "updated_at"
798
+ FROM "issues"
799
+ WHERE "id" = '00000000-0000-0000-0000-000000000241'
800
+ `);
801
+ expect(cleanRows[0]?.updated_at.toISOString()).toBe("2026-04-02T10:00:00.000Z");
802
+ await afterCleanReplay.unsafe(`
803
+ INSERT INTO "companies" ("id", "name", "issue_prefix", "created_at", "updated_at")
804
+ VALUES (
805
+ '00000000-0000-0000-0000-000000000250',
806
+ 'Sweep Migration Co',
807
+ 'SWP134',
808
+ '2026-01-01T00:00:00.000Z',
809
+ '2026-04-03T12:00:00.123456Z'
810
+ )
811
+ `);
812
+ await afterCleanReplay.unsafe(`
813
+ INSERT INTO "agents" ("id", "company_id", "name", "role", "adapter_type", "created_at", "updated_at")
814
+ VALUES (
815
+ '00000000-0000-0000-0000-000000000251',
816
+ '00000000-0000-0000-0000-000000000250',
817
+ 'Sweep Agent',
818
+ 'general',
819
+ 'process',
820
+ '2026-01-02T00:00:00.000Z',
821
+ '2026-01-02T00:00:00.000Z'
822
+ )
823
+ `);
824
+ await afterCleanReplay.unsafe(`
825
+ INSERT INTO "issues" ("id", "company_id", "title", "status", "created_at", "updated_at")
826
+ SELECT
827
+ ('10000000-0000-0000-0000-' || lpad(gs::text, 12, '0'))::uuid,
828
+ '00000000-0000-0000-0000-000000000250',
829
+ 'Swept issue ' || gs::text,
830
+ 'todo',
831
+ '2026-02-01T00:00:00.000Z'::timestamptz + (gs::text || ' minutes')::interval,
832
+ '2026-04-03T12:00:00.123456Z'
833
+ FROM generate_series(1, 101) AS gs
834
+ `);
835
+ await afterCleanReplay.unsafe(`
836
+ UPDATE "issues"
837
+ SET
838
+ "status" = 'done',
839
+ "completed_at" = '2026-04-03T12:00:00.123456Z'
840
+ WHERE "id" = '10000000-0000-0000-0000-000000000003'
841
+ `);
842
+ await afterCleanReplay.unsafe(`
843
+ INSERT INTO "issue_comments" ("id", "company_id", "issue_id", "body", "created_at", "updated_at")
844
+ VALUES (
845
+ '00000000-0000-0000-0000-000000000252',
846
+ '00000000-0000-0000-0000-000000000250',
847
+ '10000000-0000-0000-0000-000000000001',
848
+ 'Latest pre-sweep activity',
849
+ '2026-03-01T15:30:00.000Z',
850
+ '2026-03-02T16:45:00.000Z'
851
+ )
852
+ `);
853
+ await afterCleanReplay.unsafe(`
854
+ INSERT INTO "heartbeat_runs" (
855
+ "id",
856
+ "company_id",
857
+ "agent_id",
858
+ "status",
859
+ "started_at",
860
+ "finished_at",
861
+ "created_at",
862
+ "updated_at"
863
+ )
864
+ VALUES (
865
+ '00000000-0000-0000-0000-000000000253',
866
+ '00000000-0000-0000-0000-000000000250',
867
+ '00000000-0000-0000-0000-000000000251',
868
+ 'completed',
869
+ '2026-02-10T10:00:00.000Z',
870
+ '2026-02-10T10:30:00.000Z',
871
+ '2026-02-10T09:55:00.000Z',
872
+ '2026-04-03T12:00:00.123456Z'
873
+ )
874
+ `);
875
+ await afterCleanReplay.unsafe(`
876
+ INSERT INTO "heartbeat_runs" (
877
+ "id",
878
+ "company_id",
879
+ "agent_id",
880
+ "status",
881
+ "started_at",
882
+ "last_output_at",
883
+ "created_at",
884
+ "updated_at"
885
+ )
886
+ VALUES (
887
+ '00000000-0000-0000-0000-000000000256',
888
+ '00000000-0000-0000-0000-000000000250',
889
+ '00000000-0000-0000-0000-000000000251',
890
+ 'running',
891
+ '2026-02-10T11:00:00.000Z',
892
+ '2026-04-03T12:00:00.123456Z',
893
+ '2026-02-10T10:55:00.000Z',
894
+ '2026-04-03T12:00:00.123456Z'
895
+ )
896
+ `);
897
+ await afterCleanReplay.unsafe(`
898
+ INSERT INTO "routines" (
899
+ "id",
900
+ "company_id",
901
+ "title",
902
+ "last_triggered_at",
903
+ "last_enqueued_at",
904
+ "created_at",
905
+ "updated_at"
906
+ )
907
+ VALUES (
908
+ '00000000-0000-0000-0000-000000000254',
909
+ '00000000-0000-0000-0000-000000000250',
910
+ 'Swept routine',
911
+ '2026-03-20T10:00:00.000Z',
912
+ '2026-03-21T11:00:00.000Z',
913
+ '2026-02-11T00:00:00.000Z',
914
+ '2026-04-03T12:00:00.123456Z'
915
+ )
916
+ `);
917
+ await afterCleanReplay.unsafe(`
918
+ INSERT INTO "routines" (
919
+ "id",
920
+ "company_id",
921
+ "title",
922
+ "last_triggered_at",
923
+ "last_enqueued_at",
924
+ "created_at",
925
+ "updated_at"
926
+ )
927
+ VALUES (
928
+ '00000000-0000-0000-0000-000000000257',
929
+ '00000000-0000-0000-0000-000000000250',
930
+ 'Same-timestamp active routine',
931
+ '2026-03-20T10:00:00.000Z',
932
+ '2026-04-03T12:00:00.123456Z',
933
+ '2026-02-11T00:00:00.000Z',
934
+ '2026-04-03T12:00:00.123456Z'
935
+ )
936
+ `);
937
+ await afterCleanReplay.unsafe(`
938
+ INSERT INTO "routine_runs" (
939
+ "id",
940
+ "company_id",
941
+ "routine_id",
942
+ "source",
943
+ "status",
944
+ "completed_at",
945
+ "created_at",
946
+ "updated_at"
947
+ )
948
+ VALUES (
949
+ '00000000-0000-0000-0000-000000000255',
950
+ '00000000-0000-0000-0000-000000000250',
951
+ '00000000-0000-0000-0000-000000000254',
952
+ 'schedule',
953
+ 'completed',
954
+ '2026-02-12T12:00:00.000Z',
955
+ '2026-02-12T11:00:00.000Z',
956
+ '2026-04-03T12:00:00.123456Z'
957
+ )
958
+ `);
959
+ await afterCleanReplay.unsafe(`
960
+ INSERT INTO "routine_runs" (
961
+ "id",
962
+ "company_id",
963
+ "routine_id",
964
+ "source",
965
+ "status",
966
+ "triggered_at",
967
+ "created_at",
968
+ "updated_at"
969
+ )
970
+ VALUES (
971
+ '00000000-0000-0000-0000-000000000258',
972
+ '00000000-0000-0000-0000-000000000250',
973
+ '00000000-0000-0000-0000-000000000257',
974
+ 'schedule',
975
+ 'running',
976
+ '2026-04-03T12:00:00.123456Z',
977
+ '2026-02-12T13:00:00.000Z',
978
+ '2026-04-03T12:00:00.123456Z'
979
+ )
980
+ `);
981
+ await afterCleanReplay.unsafe(`
982
+ INSERT INTO "companies" ("id", "name", "issue_prefix", "created_at", "updated_at")
983
+ VALUES (
984
+ '00000000-0000-0000-0000-000000000260',
985
+ 'Coincident Timestamp Co',
986
+ 'CTS134',
987
+ '2026-01-05T00:00:00.000Z',
988
+ '2026-04-03T12:00:00.123456Z'
989
+ )
990
+ `);
991
+ await afterCleanReplay.unsafe(`
992
+ INSERT INTO "agents" ("id", "company_id", "name", "role", "adapter_type", "created_at", "updated_at")
993
+ VALUES (
994
+ '00000000-0000-0000-0000-000000000261',
995
+ '00000000-0000-0000-0000-000000000260',
996
+ 'Coincident Agent',
997
+ 'general',
998
+ 'process',
999
+ '2026-01-05T00:10:00.000Z',
1000
+ '2026-01-05T00:10:00.000Z'
1001
+ )
1002
+ `);
1003
+ await afterCleanReplay.unsafe(`
1004
+ INSERT INTO "issues" ("id", "company_id", "title", "status", "created_at", "updated_at")
1005
+ VALUES (
1006
+ '20000000-0000-0000-0000-000000000001',
1007
+ '00000000-0000-0000-0000-000000000260',
1008
+ 'Coincident timestamp issue should not be touched',
1009
+ 'todo',
1010
+ '2026-02-05T00:00:00.000Z',
1011
+ '2026-04-03T12:00:00.123456Z'
1012
+ )
1013
+ `);
1014
+ await afterCleanReplay.unsafe(`
1015
+ INSERT INTO "heartbeat_runs" (
1016
+ "id",
1017
+ "company_id",
1018
+ "agent_id",
1019
+ "status",
1020
+ "started_at",
1021
+ "finished_at",
1022
+ "created_at",
1023
+ "updated_at"
1024
+ )
1025
+ VALUES (
1026
+ '00000000-0000-0000-0000-000000000262',
1027
+ '00000000-0000-0000-0000-000000000260',
1028
+ '00000000-0000-0000-0000-000000000261',
1029
+ 'completed',
1030
+ '2026-02-05T10:00:00.000Z',
1031
+ '2026-02-05T10:30:00.000Z',
1032
+ '2026-02-05T09:55:00.000Z',
1033
+ '2026-04-03T12:00:00.123456Z'
1034
+ )
1035
+ `);
1036
+ await afterCleanReplay.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${repairSweepHash}'`);
1037
+ }
1038
+ finally {
1039
+ await afterCleanReplay.end();
1040
+ }
1041
+ await applyPendingMigrations(connectionString);
1042
+ const afterRepair = postgres(connectionString, { max: 1, onnotice: () => { } });
1043
+ try {
1044
+ const repairedRows = await afterRepair.unsafe(`
1045
+ SELECT 'company' AS subject, "updated_at"
1046
+ FROM "companies"
1047
+ WHERE "id" = '00000000-0000-0000-0000-000000000250'
1048
+ UNION ALL
1049
+ SELECT 'issue_with_comment' AS subject, "updated_at"
1050
+ FROM "issues"
1051
+ WHERE "id" = '10000000-0000-0000-0000-000000000001'
1052
+ UNION ALL
1053
+ SELECT 'issue_without_comment' AS subject, "updated_at"
1054
+ FROM "issues"
1055
+ WHERE "id" = '10000000-0000-0000-0000-000000000002'
1056
+ UNION ALL
1057
+ SELECT 'issue_with_state_activity' AS subject, "updated_at"
1058
+ FROM "issues"
1059
+ WHERE "id" = '10000000-0000-0000-0000-000000000003'
1060
+ UNION ALL
1061
+ SELECT 'heartbeat_run' AS subject, "updated_at"
1062
+ FROM "heartbeat_runs"
1063
+ WHERE "id" = '00000000-0000-0000-0000-000000000253'
1064
+ UNION ALL
1065
+ SELECT 'heartbeat_run_with_output' AS subject, "updated_at"
1066
+ FROM "heartbeat_runs"
1067
+ WHERE "id" = '00000000-0000-0000-0000-000000000256'
1068
+ UNION ALL
1069
+ SELECT 'other_company' AS subject, "updated_at"
1070
+ FROM "companies"
1071
+ WHERE "id" = '00000000-0000-0000-0000-000000000260'
1072
+ UNION ALL
1073
+ SELECT 'other_heartbeat_run' AS subject, "updated_at"
1074
+ FROM "heartbeat_runs"
1075
+ WHERE "id" = '00000000-0000-0000-0000-000000000262'
1076
+ UNION ALL
1077
+ SELECT 'other_issue' AS subject, "updated_at"
1078
+ FROM "issues"
1079
+ WHERE "id" = '20000000-0000-0000-0000-000000000001'
1080
+ UNION ALL
1081
+ SELECT 'routine' AS subject, "updated_at"
1082
+ FROM "routines"
1083
+ WHERE "id" = '00000000-0000-0000-0000-000000000254'
1084
+ UNION ALL
1085
+ SELECT 'routine_with_activity' AS subject, "updated_at"
1086
+ FROM "routines"
1087
+ WHERE "id" = '00000000-0000-0000-0000-000000000257'
1088
+ UNION ALL
1089
+ SELECT 'routine_run' AS subject, "updated_at"
1090
+ FROM "routine_runs"
1091
+ WHERE "id" = '00000000-0000-0000-0000-000000000255'
1092
+ UNION ALL
1093
+ SELECT 'routine_run_with_trigger' AS subject, "updated_at"
1094
+ FROM "routine_runs"
1095
+ WHERE "id" = '00000000-0000-0000-0000-000000000258'
1096
+ ORDER BY subject
1097
+ `);
1098
+ const repaired = Object.fromEntries(repairedRows.map((row) => [row.subject, row.updated_at.toISOString()]));
1099
+ expect(repaired).toEqual({
1100
+ company: "2026-01-01T00:00:00.000Z",
1101
+ heartbeat_run: "2026-02-10T10:30:00.000Z",
1102
+ heartbeat_run_with_output: "2026-04-03T12:00:00.123Z",
1103
+ issue_with_comment: "2026-03-02T16:45:00.000Z",
1104
+ issue_with_state_activity: "2026-04-03T12:00:00.123Z",
1105
+ issue_without_comment: "2026-02-01T00:02:00.000Z",
1106
+ other_company: "2026-04-03T12:00:00.123Z",
1107
+ other_heartbeat_run: "2026-04-03T12:00:00.123Z",
1108
+ other_issue: "2026-04-03T12:00:00.123Z",
1109
+ routine: "2026-03-21T11:00:00.000Z",
1110
+ routine_run_with_trigger: "2026-04-03T12:00:00.123Z",
1111
+ routine_with_activity: "2026-04-03T12:00:00.123Z",
1112
+ routine_run: "2026-02-12T12:00:00.000Z",
1113
+ });
1114
+ await afterRepair.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${repairSweepHash}'`);
1115
+ }
1116
+ finally {
1117
+ await afterRepair.end();
1118
+ }
1119
+ await applyPendingMigrations(connectionString);
1120
+ const afterSecondRun = postgres(connectionString, { max: 1, onnotice: () => { } });
1121
+ try {
1122
+ const secondRunRows = await afterSecondRun.unsafe(`
1123
+ SELECT "updated_at"
1124
+ FROM "issues"
1125
+ WHERE "id" = '10000000-0000-0000-0000-000000000001'
1126
+ `);
1127
+ expect(secondRunRows[0]?.updated_at.toISOString()).toBe("2026-03-02T16:45:00.000Z");
1128
+ }
1129
+ finally {
1130
+ await afterSecondRun.end();
1131
+ }
1132
+ }, 20_000);
1133
+ it("replays the run responsible user repair migration when heartbeat run issue refs are identifiers", async () => {
1134
+ const connectionString = await createTempDatabase();
1135
+ await applyPendingMigrations(connectionString);
1136
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
1137
+ try {
1138
+ const runResponsibleUserRepairHash = await migrationHash("0131_repair_run_responsible_user_context_refs.sql");
1139
+ await sql.unsafe(`
1140
+ INSERT INTO "companies" ("id", "name", "issue_prefix", "created_at", "updated_at")
1141
+ VALUES ('00000000-0000-0000-0000-000000000130', 'Migration Test Co', 'TST130', now(), now())
1142
+ `);
1143
+ await sql.unsafe(`
1144
+ INSERT INTO "company_memberships" (
1145
+ "id",
1146
+ "company_id",
1147
+ "principal_type",
1148
+ "principal_id",
1149
+ "status",
1150
+ "membership_role",
1151
+ "created_at",
1152
+ "updated_at"
1153
+ )
1154
+ VALUES (
1155
+ '00000000-0000-0000-0000-000000000131',
1156
+ '00000000-0000-0000-0000-000000000130',
1157
+ 'user',
1158
+ 'owner-user',
1159
+ 'active',
1160
+ 'owner',
1161
+ now(),
1162
+ now()
1163
+ )
1164
+ `);
1165
+ await sql.unsafe(`
1166
+ INSERT INTO "agents" ("id", "company_id", "name", "role", "adapter_type", "created_at", "updated_at")
1167
+ VALUES (
1168
+ '00000000-0000-0000-0000-000000000132',
1169
+ '00000000-0000-0000-0000-000000000130',
1170
+ 'Migration Agent',
1171
+ 'general',
1172
+ 'process',
1173
+ now(),
1174
+ now()
1175
+ )
1176
+ `);
1177
+ await sql.unsafe(`
1178
+ INSERT INTO "issues" (
1179
+ "id",
1180
+ "company_id",
1181
+ "title",
1182
+ "status",
1183
+ "responsible_user_id",
1184
+ "identifier",
1185
+ "created_at",
1186
+ "updated_at"
1187
+ )
1188
+ VALUES (
1189
+ '00000000-0000-0000-0000-000000000133',
1190
+ '00000000-0000-0000-0000-000000000130',
1191
+ 'Identifier referenced issue',
1192
+ 'todo',
1193
+ 'issue-user',
1194
+ 'TST130-1',
1195
+ now(),
1196
+ now()
1197
+ )
1198
+ `);
1199
+ await sql.unsafe(`
1200
+ INSERT INTO "heartbeat_runs" (
1201
+ "id",
1202
+ "company_id",
1203
+ "agent_id",
1204
+ "status",
1205
+ "responsible_user_id",
1206
+ "context_snapshot",
1207
+ "created_at",
1208
+ "updated_at"
1209
+ )
1210
+ VALUES (
1211
+ '00000000-0000-0000-0000-000000000134',
1212
+ '00000000-0000-0000-0000-000000000130',
1213
+ '00000000-0000-0000-0000-000000000132',
1214
+ 'completed',
1215
+ NULL,
1216
+ '{"issueId":"TST130-1"}'::jsonb,
1217
+ now(),
1218
+ now()
1219
+ )
1220
+ `);
1221
+ await sql.unsafe(`DELETE FROM "drizzle"."__drizzle_migrations" WHERE hash = '${runResponsibleUserRepairHash}'`);
1222
+ }
1223
+ finally {
1224
+ await sql.end();
1225
+ }
1226
+ const pendingState = await inspectMigrations(connectionString);
1227
+ expect(pendingState).toMatchObject({
1228
+ status: "needsMigrations",
1229
+ pendingMigrations: ["0131_repair_run_responsible_user_context_refs.sql"],
1230
+ reason: "pending-migrations",
1231
+ });
1232
+ await applyPendingMigrations(connectionString);
1233
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
1234
+ try {
1235
+ const runs = await verifySql.unsafe(`
1236
+ SELECT "responsible_user_id"
1237
+ FROM "heartbeat_runs"
1238
+ WHERE "id" = '00000000-0000-0000-0000-000000000134'
1239
+ `);
1240
+ expect(runs).toEqual([{ responsible_user_id: "issue-user" }]);
1241
+ }
1242
+ finally {
1243
+ await verifySql.end();
1244
+ }
1245
+ }, 20_000);
1246
+ it("preserves legacy runs while adding native persistence and replay-safe status versioning", async () => {
1247
+ const clusterUrl = await createTempDatabase();
1248
+ await ensurePostgresDatabase(clusterUrl, "native_legacy");
1249
+ const legacyUrl = new URL(clusterUrl);
1250
+ legacyUrl.pathname = "/native_legacy";
1251
+ const connectionString = legacyUrl.href;
1252
+ cleanups.push(() => closeRegisteredClients(connectionString));
1253
+ const directory = await fs.promises.mkdtemp(join(tmpdir(), "paperclip-native-prior-migrations-"));
1254
+ cleanups.push(() => fs.promises.rm(directory, { recursive: true, force: true }));
1255
+ const migrationsRoot = new URL("./migrations/", import.meta.url);
1256
+ const journal = JSON.parse(await fs.promises.readFile(new URL("meta/_journal.json", migrationsRoot), "utf8"));
1257
+ const priorEntries = journal.entries.filter((entry) => entry.idx < 227);
1258
+ await fs.promises.mkdir(join(directory, "meta"));
1259
+ for (const entry of priorEntries) {
1260
+ await fs.promises.copyFile(new URL(`${entry.tag}.sql`, migrationsRoot), join(directory, `${entry.tag}.sql`));
1261
+ }
1262
+ await fs.promises.writeFile(join(directory, "meta/_journal.json"), JSON.stringify({ ...journal, entries: priorEntries }));
1263
+ const nativePersistenceHash = await migrationHash("0227_modern_pandemic.sql");
1264
+ const eventSequenceUniquenessHash = await migrationHash("0235_heartbeat_run_event_sequence_uniqueness.sql");
1265
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
1266
+ const companyId = "10000000-0000-4000-8000-000000000227";
1267
+ const agentId = "20000000-0000-4000-8000-000000000227";
1268
+ const runId = "30000000-0000-4000-8000-000000000227";
1269
+ const issueId = "40000000-0000-4000-8000-000000000227";
1270
+ const contractId = "50000000-0000-4000-8000-000000000227";
1271
+ const resultId = "60000000-0000-4000-8000-000000000227";
1272
+ const assessmentId = "70000000-0000-4000-8000-000000000227";
1273
+ const decisionId = "80000000-0000-4000-8000-000000000227";
1274
+ const otherCompanyId = "11000000-0000-4000-8000-000000000227";
1275
+ const otherAgentId = "21000000-0000-4000-8000-000000000227";
1276
+ const otherRunId = "31000000-0000-4000-8000-000000000227";
1277
+ const otherIssueId = "41000000-0000-4000-8000-000000000227";
1278
+ const otherContractId = "51000000-0000-4000-8000-000000000227";
1279
+ const otherResultId = "61000000-0000-4000-8000-000000000227";
1280
+ const otherAssessmentId = "71000000-0000-4000-8000-000000000227";
1281
+ const otherDecisionId = "81000000-0000-4000-8000-000000000227";
1282
+ try {
1283
+ // Build the real pre-native schema. Downgrading the latest schema by
1284
+ // dropping its unique index is invalid once later tenant FKs use it.
1285
+ await migrate(drizzle(sql), { migrationsFolder: directory });
1286
+ expect(await sql `SELECT to_regclass('public.native_run_results') AS native_results`).toEqual([{ native_results: null }]);
1287
+ await sql `
1288
+ INSERT INTO companies (id, name, issue_prefix)
1289
+ VALUES (${companyId}, 'Native persistence fixture', 'NPF')
1290
+ `;
1291
+ await sql `
1292
+ INSERT INTO agents (id, company_id, name)
1293
+ VALUES (${agentId}, ${companyId}, 'Legacy migration agent')
1294
+ `;
1295
+ await sql `
1296
+ INSERT INTO heartbeat_runs (id, company_id, agent_id, status)
1297
+ VALUES (${runId}, ${companyId}, ${agentId}, 'succeeded')
1298
+ `;
1299
+ await sql `
1300
+ INSERT INTO issues (id, company_id, title, status)
1301
+ VALUES (${issueId}, ${companyId}, 'Legacy migration issue', 'in_progress')
1302
+ `;
1303
+ await sql.unsafe(`
1304
+ INSERT INTO heartbeat_run_events
1305
+ (company_id, run_id, agent_id, seq, event_type, stream, level, message, payload, created_at)
1306
+ VALUES
1307
+ ('${companyId}', '${runId}', '${agentId}', 1, 'legacy.start', 'system', 'info', 'one', '{"bytes":"alpha-1"}'::jsonb, '2026-08-01T00:00:01.000Z'),
1308
+ ('${companyId}', '${runId}', '${agentId}', 5, 'legacy.log', 'stdout', 'info', 'first-five', '{"bytes":"beta-5a"}'::jsonb, '2026-08-01T00:00:02.000Z'),
1309
+ ('${companyId}', '${runId}', '${agentId}', 5, 'legacy.log', 'stderr', 'warn', 'duplicate-five', '{"bytes":"gamma-5b"}'::jsonb, '2026-08-01T00:00:03.000Z'),
1310
+ ('${companyId}', '${runId}', '${agentId}', 9, 'legacy.end', 'system', 'info', 'nine', '{"bytes":"delta-9"}'::jsonb, '2026-08-01T00:00:04.000Z')
1311
+ `);
1312
+ }
1313
+ finally {
1314
+ await sql.end();
1315
+ }
1316
+ await applyPendingMigrations(connectionString);
1317
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
1318
+ try {
1319
+ const events = await verifySql.unsafe(`
1320
+ SELECT seq, event_type, stream, level, message, payload, created_at
1321
+ FROM heartbeat_run_events
1322
+ WHERE run_id = '${runId}'
1323
+ ORDER BY id
1324
+ `);
1325
+ // 0235 preserves every legacy event while moving only duplicate
1326
+ // sequence values above the old run maximum before installing the
1327
+ // durable (run_id, seq) uniqueness invariant.
1328
+ expect(events.map((event) => Number(event.seq))).toEqual([1, 5, 10, 9]);
1329
+ expect(events.map(({ seq: _seq, ...event }) => ({
1330
+ ...event,
1331
+ created_at: event.created_at.toISOString(),
1332
+ }))).toEqual([
1333
+ {
1334
+ event_type: "legacy.start",
1335
+ stream: "system",
1336
+ level: "info",
1337
+ message: "one",
1338
+ payload: { bytes: "alpha-1" },
1339
+ created_at: "2026-08-01T00:00:01.000Z",
1340
+ },
1341
+ {
1342
+ event_type: "legacy.log",
1343
+ stream: "stdout",
1344
+ level: "info",
1345
+ message: "first-five",
1346
+ payload: { bytes: "beta-5a" },
1347
+ created_at: "2026-08-01T00:00:02.000Z",
1348
+ },
1349
+ {
1350
+ event_type: "legacy.log",
1351
+ stream: "stderr",
1352
+ level: "warn",
1353
+ message: "duplicate-five",
1354
+ payload: { bytes: "gamma-5b" },
1355
+ created_at: "2026-08-01T00:00:03.000Z",
1356
+ },
1357
+ {
1358
+ event_type: "legacy.end",
1359
+ stream: "system",
1360
+ level: "info",
1361
+ message: "nine",
1362
+ payload: { bytes: "delta-9" },
1363
+ created_at: "2026-08-01T00:00:04.000Z",
1364
+ },
1365
+ ]);
1366
+ const runs = await verifySql.unsafe(`
1367
+ SELECT runtime_mode, next_event_seq
1368
+ FROM heartbeat_runs
1369
+ WHERE id = '${runId}'
1370
+ `);
1371
+ expect(runs.map((run) => ({
1372
+ runtimeMode: run.runtime_mode,
1373
+ nextEventSeq: Number(run.next_event_seq),
1374
+ }))).toEqual([{ runtimeMode: "legacy", nextEventSeq: 11 }]);
1375
+ const nativeRowsBefore = await verifySql.unsafe(`
1376
+ SELECT 'completion_contracts' AS table_name, count(*)::int AS row_count FROM completion_contracts
1377
+ UNION ALL SELECT 'native_run_results', count(*)::int FROM native_run_results
1378
+ UNION ALL SELECT 'native_run_finalizations', count(*)::int FROM native_run_finalizations
1379
+ UNION ALL SELECT 'work_assessments', count(*)::int FROM work_assessments
1380
+ UNION ALL SELECT 'status_decisions', count(*)::int FROM status_decisions
1381
+ UNION ALL SELECT 'status_decision_effects', count(*)::int FROM status_decision_effects
1382
+ ORDER BY table_name
1383
+ `);
1384
+ expect(nativeRowsBefore.every((row) => row.row_count === 0)).toBe(true);
1385
+ await verifySql `
1386
+ INSERT INTO companies (id, name, issue_prefix)
1387
+ VALUES (${otherCompanyId}, 'Other native persistence fixture', 'ONP')
1388
+ `;
1389
+ await verifySql `
1390
+ INSERT INTO agents (id, company_id, name)
1391
+ VALUES (${otherAgentId}, ${otherCompanyId}, 'Other native migration agent')
1392
+ `;
1393
+ await verifySql `
1394
+ INSERT INTO heartbeat_runs (
1395
+ id, company_id, agent_id, status, native_issue_id, completion_contract_id
1396
+ ) VALUES (
1397
+ ${otherRunId}, ${otherCompanyId}, ${otherAgentId}, 'succeeded',
1398
+ ${otherIssueId}, ${otherContractId}
1399
+ )
1400
+ `;
1401
+ await verifySql `
1402
+ INSERT INTO issues (id, company_id, title, status)
1403
+ VALUES (${otherIssueId}, ${otherCompanyId}, 'Other native issue', 'in_progress')
1404
+ `;
1405
+ await verifySql `
1406
+ UPDATE heartbeat_runs
1407
+ SET native_issue_id = ${issueId}, completion_contract_id = ${contractId}
1408
+ WHERE id = ${runId}
1409
+ `;
1410
+ await expect(verifySql `
1411
+ INSERT INTO completion_contracts (
1412
+ company_id, issue_id, revision, schema_version, policy_version,
1413
+ risk, completion_authority, incomplete_criteria_policy, contract_json,
1414
+ canonical_sha256, created_by_actor_type, created_by_actor_id
1415
+ ) VALUES (
1416
+ ${companyId}, ${otherIssueId}, 1, 'paperclip.completion-contract.v1',
1417
+ 'policy-v1', 'low', 'server', 'review', ${JSON.stringify({ criteria: [] })}::jsonb,
1418
+ 'cross-company-contract-sha', 'system', 'migration-test'
1419
+ )
1420
+ `).rejects.toThrow(/completion_contracts_issue_company_fk/);
1421
+ await verifySql `
1422
+ INSERT INTO completion_contracts (
1423
+ id, company_id, issue_id, revision, schema_version, policy_version,
1424
+ risk, completion_authority, incomplete_criteria_policy, contract_json,
1425
+ canonical_sha256, created_by_actor_type, created_by_actor_id
1426
+ ) VALUES (
1427
+ ${contractId}, ${companyId}, ${issueId}, 1, 'paperclip.completion-contract.v1',
1428
+ 'policy-v1', 'low', 'server', 'review', ${JSON.stringify({ criteria: [] })}::jsonb,
1429
+ 'contract-sha', 'system', 'migration-test'
1430
+ )
1431
+ `;
1432
+ await verifySql `
1433
+ INSERT INTO completion_contracts (
1434
+ id, company_id, issue_id, revision, schema_version, policy_version,
1435
+ risk, completion_authority, incomplete_criteria_policy, contract_json,
1436
+ canonical_sha256, created_by_actor_type, created_by_actor_id
1437
+ ) VALUES (
1438
+ ${otherContractId}, ${otherCompanyId}, ${otherIssueId}, 1,
1439
+ 'paperclip.completion-contract.v1', 'policy-v1', 'low', 'server', 'review',
1440
+ ${JSON.stringify({ criteria: [] })}::jsonb, 'other-contract-sha',
1441
+ 'system', 'migration-test'
1442
+ )
1443
+ `;
1444
+ await expect(verifySql `
1445
+ INSERT INTO native_run_results (
1446
+ company_id, issue_id, run_id, completion_contract_id,
1447
+ server_fingerprint, schema_status, result_json, canonical_sha256
1448
+ ) VALUES (
1449
+ ${companyId}, ${issueId}, ${otherRunId}, ${contractId},
1450
+ 'cross-company-run', 'valid', ${JSON.stringify({ summary: "invalid" })}::jsonb,
1451
+ 'cross-company-run-sha'
1452
+ )
1453
+ `).rejects.toThrow(/native_run_results_run_contract_owner_fk/);
1454
+ await expect(verifySql `
1455
+ INSERT INTO native_run_results (
1456
+ company_id, issue_id, run_id, completion_contract_id,
1457
+ server_fingerprint, schema_status, result_json, canonical_sha256
1458
+ ) VALUES (
1459
+ ${companyId}, ${issueId}, ${runId}, ${otherContractId},
1460
+ 'cross-company-contract', 'valid', ${JSON.stringify({ summary: "invalid" })}::jsonb,
1461
+ 'cross-company-contract-sha'
1462
+ )
1463
+ `).rejects.toThrow(/native_run_results_run_contract_owner_fk/);
1464
+ await verifySql `
1465
+ INSERT INTO native_run_results (
1466
+ id, company_id, issue_id, run_id, completion_contract_id,
1467
+ server_fingerprint, schema_status, result_json, canonical_sha256
1468
+ ) VALUES (
1469
+ ${resultId}, ${companyId}, ${issueId}, ${runId}, ${contractId},
1470
+ 'result-fingerprint', 'valid', ${JSON.stringify({ summary: "done" })}::jsonb, 'result-sha'
1471
+ )
1472
+ `;
1473
+ await verifySql `
1474
+ INSERT INTO native_run_results (
1475
+ id, company_id, issue_id, run_id, completion_contract_id,
1476
+ server_fingerprint, schema_status, result_json, canonical_sha256
1477
+ ) VALUES (
1478
+ ${otherResultId}, ${otherCompanyId}, ${otherIssueId}, ${otherRunId},
1479
+ ${otherContractId}, 'other-result-fingerprint', 'valid',
1480
+ ${JSON.stringify({ summary: "other" })}::jsonb, 'other-result-sha'
1481
+ )
1482
+ `;
1483
+ await expect(verifySql `
1484
+ INSERT INTO work_assessments (
1485
+ company_id, issue_id, run_id, contract_id, result_id,
1486
+ trigger_kind, trigger_actor_company_id, prior_issue_status,
1487
+ prior_status_version, policy_version, assessment_json, input_digest
1488
+ ) VALUES (
1489
+ ${companyId}, ${issueId}, ${runId}, ${contractId}, ${otherResultId},
1490
+ 'run_terminal', ${companyId}, 'in_progress', 0, 'policy-v1',
1491
+ ${JSON.stringify({ disposition: "invalid" })}::jsonb,
1492
+ 'cross-company-assessment-input-sha'
1493
+ )
1494
+ `).rejects.toThrow(/work_assessments_result_owner_fk/);
1495
+ await expect(verifySql `
1496
+ INSERT INTO work_assessments (
1497
+ company_id, issue_id, run_id, contract_id, result_id,
1498
+ trigger_kind, trigger_actor_company_id, prior_issue_status,
1499
+ prior_status_version, policy_version, assessment_json, input_digest
1500
+ ) VALUES (
1501
+ ${companyId}, ${issueId}, ${runId}, ${contractId}, ${resultId},
1502
+ 'run_terminal', ${otherCompanyId}, 'in_progress', 0, 'policy-v1',
1503
+ ${JSON.stringify({ disposition: "invalid" })}::jsonb,
1504
+ 'cross-company-trigger-input-sha'
1505
+ )
1506
+ `).rejects.toThrow(/work_assessments_trigger_actor_company_check/);
1507
+ await verifySql `
1508
+ INSERT INTO work_assessments (
1509
+ id, company_id, issue_id, run_id, contract_id, result_id,
1510
+ trigger_kind, trigger_actor_company_id, prior_issue_status,
1511
+ prior_status_version, policy_version, assessment_json, input_digest
1512
+ ) VALUES (
1513
+ ${assessmentId}, ${companyId}, ${issueId}, ${runId}, ${contractId}, ${resultId},
1514
+ 'run_terminal', ${companyId}, 'in_progress', 0, 'policy-v1',
1515
+ ${JSON.stringify({ disposition: "done" })}::jsonb, 'assessment-input-sha'
1516
+ )
1517
+ `;
1518
+ await verifySql `
1519
+ INSERT INTO work_assessments (
1520
+ id, company_id, issue_id, run_id, contract_id, result_id,
1521
+ trigger_kind, trigger_actor_company_id, prior_issue_status,
1522
+ prior_status_version, policy_version, assessment_json, input_digest
1523
+ ) VALUES (
1524
+ ${otherAssessmentId}, ${otherCompanyId}, ${otherIssueId}, ${otherRunId},
1525
+ ${otherContractId}, ${otherResultId}, 'run_terminal', ${otherCompanyId},
1526
+ 'in_progress', 0, 'policy-v1',
1527
+ ${JSON.stringify({ disposition: "done" })}::jsonb, 'other-assessment-input-sha'
1528
+ )
1529
+ `;
1530
+ await expect(verifySql `
1531
+ INSERT INTO status_decisions (
1532
+ company_id, issue_id, run_id, assessment_id, decision_version,
1533
+ policy_version, from_status, to_status, reason_code,
1534
+ decision_json, decision_digest
1535
+ ) VALUES (
1536
+ ${companyId}, ${issueId}, ${runId}, ${otherAssessmentId}, 1,
1537
+ 'policy-v1', 'in_progress', 'done', 'native_result_accepted',
1538
+ ${JSON.stringify({ toStatus: "done" })}::jsonb, 'cross-company-decision-sha'
1539
+ )
1540
+ `).rejects.toThrow(/status_decisions_assessment_owner_fk/);
1541
+ await verifySql `
1542
+ INSERT INTO status_decisions (
1543
+ id, company_id, issue_id, run_id, assessment_id, decision_version,
1544
+ policy_version, from_status, to_status, reason_code,
1545
+ decision_json, decision_digest
1546
+ ) VALUES (
1547
+ ${decisionId}, ${companyId}, ${issueId}, ${runId}, ${assessmentId}, 1,
1548
+ 'policy-v1', 'in_progress', 'done', 'native_result_accepted',
1549
+ ${JSON.stringify({ toStatus: "done" })}::jsonb, 'decision-sha'
1550
+ )
1551
+ `;
1552
+ await verifySql `
1553
+ INSERT INTO status_decisions (
1554
+ id, company_id, issue_id, run_id, assessment_id, decision_version,
1555
+ policy_version, from_status, to_status, reason_code,
1556
+ decision_json, decision_digest
1557
+ ) VALUES (
1558
+ ${otherDecisionId}, ${otherCompanyId}, ${otherIssueId}, ${otherRunId},
1559
+ ${otherAssessmentId}, 1, 'policy-v1', 'in_progress', 'done',
1560
+ 'native_result_accepted', ${JSON.stringify({ toStatus: "done" })}::jsonb,
1561
+ 'other-decision-sha'
1562
+ )
1563
+ `;
1564
+ await expect(verifySql `
1565
+ INSERT INTO status_decision_effects (
1566
+ company_id, issue_id, decision_id, ordinal, effect_kind,
1567
+ target_type, idempotency_key, payload
1568
+ ) VALUES (
1569
+ ${companyId}, ${issueId}, ${otherDecisionId}, 0, 'update_issue_status',
1570
+ 'issue', 'cross-company-decision-effect', ${JSON.stringify({ status: "done" })}::jsonb
1571
+ )
1572
+ `).rejects.toThrow(/status_decision_effects_decision_owner_fk/);
1573
+ await verifySql `
1574
+ INSERT INTO status_decision_effects (
1575
+ company_id, issue_id, decision_id, ordinal, effect_kind,
1576
+ target_type, idempotency_key, payload
1577
+ ) VALUES (
1578
+ ${companyId}, ${issueId}, ${decisionId}, 0, 'update_issue_status',
1579
+ 'issue', 'decision-effect-1', ${JSON.stringify({ status: "done" })}::jsonb
1580
+ )
1581
+ `;
1582
+ await expect(verifySql `
1583
+ INSERT INTO native_run_finalizations (
1584
+ run_id, company_id, issue_id, phase, result_id, assessment_id, decision_id
1585
+ ) VALUES (
1586
+ ${runId}, ${companyId}, ${issueId}, 'committed', ${resultId},
1587
+ ${assessmentId}, ${otherDecisionId}
1588
+ )
1589
+ `).rejects.toThrow(/native_run_finalizations_decision_owner_fk/);
1590
+ await verifySql `
1591
+ INSERT INTO native_run_finalizations (
1592
+ run_id, company_id, issue_id, phase, result_id, assessment_id, decision_id
1593
+ ) VALUES (
1594
+ ${runId}, ${companyId}, ${issueId}, 'committed', ${resultId}, ${assessmentId}, ${decisionId}
1595
+ )
1596
+ `;
1597
+ await verifySql `UPDATE issues SET title = 'Renamed legacy issue' WHERE id = ${issueId}`;
1598
+ await verifySql `UPDATE issues SET status = 'done' WHERE id = ${issueId}`;
1599
+ const issues = await verifySql.unsafe(`
1600
+ SELECT status, status_version
1601
+ FROM issues
1602
+ WHERE id = '${issueId}'
1603
+ `);
1604
+ expect(issues.map((issue) => ({
1605
+ status: issue.status,
1606
+ statusVersion: Number(issue.status_version),
1607
+ }))).toEqual([{ status: "done", statusVersion: 1 }]);
1608
+ await verifySql `DELETE FROM "drizzle"."__drizzle_migrations" WHERE "hash" = ${nativePersistenceHash}`;
1609
+ await verifySql `DELETE FROM "drizzle"."__drizzle_migrations" WHERE "hash" = ${eventSequenceUniquenessHash}`;
1610
+ }
1611
+ finally {
1612
+ await verifySql.end();
1613
+ }
1614
+ await expect(applyPendingMigrations(connectionString)).resolves.toBeUndefined();
1615
+ await expect(inspectMigrations(connectionString)).resolves.toMatchObject({
1616
+ status: "upToDate",
1617
+ });
1618
+ const replaySql = postgres(connectionString, { max: 1, onnotice: () => { } });
1619
+ try {
1620
+ const replayed = await replaySql.unsafe(`
1621
+ SELECT
1622
+ issue.status_version,
1623
+ run.next_event_seq,
1624
+ (
1625
+ SELECT count(*)::int
1626
+ FROM pg_trigger
1627
+ WHERE tgname = 'paperclip_issue_status_version_trigger'
1628
+ AND NOT tgisinternal
1629
+ ) AS trigger_count,
1630
+ (
1631
+ SELECT count(*)::int
1632
+ FROM native_run_finalizations
1633
+ WHERE run_id = '${runId}'
1634
+ ) AS finalization_count
1635
+ FROM issues issue
1636
+ CROSS JOIN heartbeat_runs run
1637
+ WHERE issue.id = '${issueId}' AND run.id = '${runId}'
1638
+ `);
1639
+ expect(replayed.map((row) => ({
1640
+ statusVersion: Number(row.status_version),
1641
+ nextEventSeq: Number(row.next_event_seq),
1642
+ triggerCount: row.trigger_count,
1643
+ finalizationCount: row.finalization_count,
1644
+ }))).toEqual([{
1645
+ statusVersion: 1,
1646
+ nextEventSeq: 11,
1647
+ triggerCount: 1,
1648
+ finalizationCount: 1,
1649
+ }]);
1650
+ }
1651
+ finally {
1652
+ await replaySql.end();
1653
+ }
1654
+ }, 60_000);
1655
+ it("replays the idempotent provider trace migration", async () => {
1656
+ const connectionString = await createTempDatabase();
1657
+ await applyPendingMigrations(connectionString);
1658
+ const hash = await migrationHash("0234_provider_trace_records.sql");
1659
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
1660
+ try {
1661
+ await sql `
1662
+ DELETE FROM "drizzle"."__drizzle_migrations"
1663
+ WHERE "hash" = ${hash}
1664
+ `;
1665
+ }
1666
+ finally {
1667
+ await sql.end();
1668
+ }
1669
+ await expect(applyPendingMigrations(connectionString)).resolves.toBeUndefined();
1670
+ await expect(inspectMigrations(connectionString)).resolves.toMatchObject({
1671
+ status: "upToDate",
1672
+ });
1673
+ }, 30_000);
1674
+ it("removes retired model profiles from live records and configuration revisions", async () => {
1675
+ const connectionString = await createTempDatabase();
1676
+ await applyPendingMigrations(connectionString);
1677
+ const hash = await migrationHash("0236_remove_cheap_model_profiles.sql");
1678
+ const companyId = "10000000-0000-4000-8000-000000000236";
1679
+ const agentId = "20000000-0000-4000-8000-000000000236";
1680
+ const issueId = "30000000-0000-4000-8000-000000000236";
1681
+ const sql = postgres(connectionString, { max: 1, onnotice: () => { } });
1682
+ try {
1683
+ await sql `
1684
+ INSERT INTO companies (id, name, issue_prefix)
1685
+ VALUES (${companyId}, 'Model profile migration fixture', 'MPF')
1686
+ `;
1687
+ await sql `
1688
+ INSERT INTO agents (id, company_id, name, runtime_config)
1689
+ VALUES (
1690
+ ${agentId},
1691
+ ${companyId},
1692
+ 'Legacy model profile agent',
1693
+ '{"heartbeat":{"enabled":true},"modelProfiles":{"cheap":{"model":"legacy"}}}'::jsonb
1694
+ )
1695
+ `;
1696
+ await sql `
1697
+ INSERT INTO issues (id, company_id, title, assignee_adapter_overrides)
1698
+ VALUES (
1699
+ ${issueId},
1700
+ ${companyId},
1701
+ 'Legacy model profile issue',
1702
+ '{"modelProfile":"cheap","workingDirectory":"/workspace"}'::jsonb
1703
+ )
1704
+ `;
1705
+ await sql `
1706
+ INSERT INTO agent_config_revisions (
1707
+ company_id,
1708
+ agent_id,
1709
+ changed_keys,
1710
+ before_config,
1711
+ after_config
1712
+ )
1713
+ VALUES (
1714
+ ${companyId},
1715
+ ${agentId},
1716
+ '["runtimeConfig"]'::jsonb,
1717
+ '{"name":"Legacy model profile agent","runtimeConfig":{"modelProfiles":{"cheap":{"model":"legacy-before"}},"heartbeat":{"enabled":true}}}'::jsonb,
1718
+ '{"name":"Legacy model profile agent","runtimeConfig":{"modelProfiles":{"cheap":{"model":"legacy-after"}},"heartbeat":{"enabled":false}}}'::jsonb
1719
+ )
1720
+ `;
1721
+ await sql `
1722
+ DELETE FROM "drizzle"."__drizzle_migrations"
1723
+ WHERE "hash" = ${hash}
1724
+ `;
1725
+ }
1726
+ finally {
1727
+ await sql.end();
1728
+ }
1729
+ await applyPendingMigrations(connectionString);
1730
+ const verifySql = postgres(connectionString, { max: 1, onnotice: () => { } });
1731
+ try {
1732
+ const [result] = await verifySql.unsafe(`
1733
+ SELECT
1734
+ agent.runtime_config,
1735
+ issue.assignee_adapter_overrides,
1736
+ revision.before_config,
1737
+ revision.after_config
1738
+ FROM agents agent
1739
+ JOIN issues issue ON issue.company_id = agent.company_id
1740
+ JOIN agent_config_revisions revision ON revision.agent_id = agent.id
1741
+ WHERE agent.id = '${agentId}' AND issue.id = '${issueId}'
1742
+ `);
1743
+ expect(result.runtime_config).toEqual({ heartbeat: { enabled: true } });
1744
+ expect(result.assignee_adapter_overrides).toEqual({ workingDirectory: "/workspace" });
1745
+ expect(result.before_config).toEqual({
1746
+ name: "Legacy model profile agent",
1747
+ runtimeConfig: { heartbeat: { enabled: true } },
1748
+ });
1749
+ expect(result.after_config).toEqual({
1750
+ name: "Legacy model profile agent",
1751
+ runtimeConfig: { heartbeat: { enabled: false } },
1752
+ });
1753
+ }
1754
+ finally {
1755
+ await verifySql.end();
1756
+ }
1757
+ }, 30_000);
1758
+ });
1759
+ //# sourceMappingURL=client.test.js.map